index-B5KMHzxr.js 1.9 MB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450
  1. function F9(t,e){for(var n=0;n<e.length;n++){const i=e[n];if(typeof i!="string"&&!Array.isArray(i)){for(const r in i)if(r!=="default"&&!(r in t)){const a=Object.getOwnPropertyDescriptor(i,r);a&&Object.defineProperty(t,r,a.get?a:{enumerable:!0,get:()=>i[r]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))i(r);new MutationObserver(r=>{for(const a of r)if(a.type==="childList")for(const s of a.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&i(s)}).observe(document,{childList:!0,subtree:!0});function n(r){const a={};return r.integrity&&(a.integrity=r.integrity),r.referrerPolicy&&(a.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?a.credentials="include":r.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function i(r){if(r.ep)return;r.ep=!0;const a=n(r);fetch(r.href,a)}})();var s0=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Xs(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var bS={exports:{}},Xh={};var LD;function z9(){if(LD)return Xh;LD=1;var t=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function n(i,r,a){var s=null;if(a!==void 0&&(s=""+a),r.key!==void 0&&(s=""+r.key),"key"in r){a={};for(var l in r)l!=="key"&&(a[l]=r[l])}else a=r;return r=a.ref,{$$typeof:t,type:i,key:s,ref:r!==void 0?r:null,props:a}}return Xh.Fragment=e,Xh.jsx=n,Xh.jsxs=n,Xh}var ID;function B9(){return ID||(ID=1,bS.exports=z9()),bS.exports}var E=B9(),_S={exports:{}},Ft={};var UD;function j9(){if(UD)return Ft;UD=1;var t=Symbol.for("react.transitional.element"),e=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),r=Symbol.for("react.profiler"),a=Symbol.for("react.consumer"),s=Symbol.for("react.context"),l=Symbol.for("react.forward_ref"),c=Symbol.for("react.suspense"),d=Symbol.for("react.memo"),f=Symbol.for("react.lazy"),h=Symbol.for("react.activity"),g=Symbol.iterator;function m(H){return H===null||typeof H!="object"?null:(H=g&&H[g]||H["@@iterator"],typeof H=="function"?H:null)}var b={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},y=Object.assign,x={};function v(H,q,re){this.props=H,this.context=q,this.refs=x,this.updater=re||b}v.prototype.isReactComponent={},v.prototype.setState=function(H,q){if(typeof H!="object"&&typeof H!="function"&&H!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,H,q,"setState")},v.prototype.forceUpdate=function(H){this.updater.enqueueForceUpdate(this,H,"forceUpdate")};function w(){}w.prototype=v.prototype;function S(H,q,re){this.props=H,this.context=q,this.refs=x,this.updater=re||b}var A=S.prototype=new w;A.constructor=S,y(A,v.prototype),A.isPureReactComponent=!0;var R=Array.isArray;function N(){}var C={H:null,A:null,T:null,S:null},F=Object.prototype.hasOwnProperty;function P(H,q,re){var ce=re.ref;return{$$typeof:t,type:H,key:q,ref:ce!==void 0?ce:null,props:re}}function L(H,q){return P(H.type,q,H.props)}function B(H){return typeof H=="object"&&H!==null&&H.$$typeof===t}function U(H){var q={"=":"=0",":":"=2"};return"$"+H.replace(/[=:]/g,function(re){return q[re]})}var $=/\/+/g;function I(H,q){return typeof H=="object"&&H!==null&&H.key!=null?U(""+H.key):q.toString(36)}function W(H){switch(H.status){case"fulfilled":return H.value;case"rejected":throw H.reason;default:switch(typeof H.status=="string"?H.then(N,N):(H.status="pending",H.then(function(q){H.status==="pending"&&(H.status="fulfilled",H.value=q)},function(q){H.status==="pending"&&(H.status="rejected",H.reason=q)})),H.status){case"fulfilled":return H.value;case"rejected":throw H.reason}}throw H}function X(H,q,re,ce,ye){var me=typeof H;(me==="undefined"||me==="boolean")&&(H=null);var be=!1;if(H===null)be=!0;else switch(me){case"bigint":case"string":case"number":be=!0;break;case"object":switch(H.$$typeof){case t:case e:be=!0;break;case f:return be=H._init,X(be(H._payload),q,re,ce,ye)}}if(be)return ye=ye(H),be=ce===""?"."+I(H,0):ce,R(ye)?(re="",be!=null&&(re=be.replace($,"$&/")+"/"),X(ye,q,re,"",function(Ae){return Ae})):ye!=null&&(B(ye)&&(ye=L(ye,re+(ye.key==null||H&&H.key===ye.key?"":(""+ye.key).replace($,"$&/")+"/")+be)),q.push(ye)),1;be=0;var Ne=ce===""?".":ce+":";if(R(H))for(var he=0;he<H.length;he++)ce=H[he],me=Ne+I(ce,he),be+=X(ce,q,re,me,ye);else if(he=m(H),typeof he=="function")for(H=he.call(H),he=0;!(ce=H.next()).done;)ce=ce.value,me=Ne+I(ce,he++),be+=X(ce,q,re,me,ye);else if(me==="object"){if(typeof H.then=="function")return X(W(H),q,re,ce,ye);throw q=String(H),Error("Objects are not valid as a React child (found: "+(q==="[object Object]"?"object with keys {"+Object.keys(H).join(", ")+"}":q)+"). If you meant to render a collection of children, use an array instead.")}return be}function V(H,q,re){if(H==null)return H;var ce=[],ye=0;return X(H,ce,"","",function(me){return q.call(re,me,ye++)}),ce}function Y(H){if(H._status===-1){var q=H._result;q=q(),q.then(function(re){(H._status===0||H._status===-1)&&(H._status=1,H._result=re)},function(re){(H._status===0||H._status===-1)&&(H._status=2,H._result=re)}),H._status===-1&&(H._status=0,H._result=q)}if(H._status===1)return H._result.default;throw H._result}var J=typeof reportError=="function"?reportError:function(H){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var q=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof H=="object"&&H!==null&&typeof H.message=="string"?String(H.message):String(H),error:H});if(!window.dispatchEvent(q))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",H);return}console.error(H)},se={map:V,forEach:function(H,q,re){V(H,function(){q.apply(this,arguments)},re)},count:function(H){var q=0;return V(H,function(){q++}),q},toArray:function(H){return V(H,function(q){return q})||[]},only:function(H){if(!B(H))throw Error("React.Children.only expected to receive a single React element child.");return H}};return Ft.Activity=h,Ft.Children=se,Ft.Component=v,Ft.Fragment=n,Ft.Profiler=r,Ft.PureComponent=S,Ft.StrictMode=i,Ft.Suspense=c,Ft.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=C,Ft.__COMPILER_RUNTIME={__proto__:null,c:function(H){return C.H.useMemoCache(H)}},Ft.cache=function(H){return function(){return H.apply(null,arguments)}},Ft.cacheSignal=function(){return null},Ft.cloneElement=function(H,q,re){if(H==null)throw Error("The argument must be a React element, but you passed "+H+".");var ce=y({},H.props),ye=H.key;if(q!=null)for(me in q.key!==void 0&&(ye=""+q.key),q)!F.call(q,me)||me==="key"||me==="__self"||me==="__source"||me==="ref"&&q.ref===void 0||(ce[me]=q[me]);var me=arguments.length-2;if(me===1)ce.children=re;else if(1<me){for(var be=Array(me),Ne=0;Ne<me;Ne++)be[Ne]=arguments[Ne+2];ce.children=be}return P(H.type,ye,ce)},Ft.createContext=function(H){return H={$$typeof:s,_currentValue:H,_currentValue2:H,_threadCount:0,Provider:null,Consumer:null},H.Provider=H,H.Consumer={$$typeof:a,_context:H},H},Ft.createElement=function(H,q,re){var ce,ye={},me=null;if(q!=null)for(ce in q.key!==void 0&&(me=""+q.key),q)F.call(q,ce)&&ce!=="key"&&ce!=="__self"&&ce!=="__source"&&(ye[ce]=q[ce]);var be=arguments.length-2;if(be===1)ye.children=re;else if(1<be){for(var Ne=Array(be),he=0;he<be;he++)Ne[he]=arguments[he+2];ye.children=Ne}if(H&&H.defaultProps)for(ce in be=H.defaultProps,be)ye[ce]===void 0&&(ye[ce]=be[ce]);return P(H,me,ye)},Ft.createRef=function(){return{current:null}},Ft.forwardRef=function(H){return{$$typeof:l,render:H}},Ft.isValidElement=B,Ft.lazy=function(H){return{$$typeof:f,_payload:{_status:-1,_result:H},_init:Y}},Ft.memo=function(H,q){return{$$typeof:d,type:H,compare:q===void 0?null:q}},Ft.startTransition=function(H){var q=C.T,re={};C.T=re;try{var ce=H(),ye=C.S;ye!==null&&ye(re,ce),typeof ce=="object"&&ce!==null&&typeof ce.then=="function"&&ce.then(N,J)}catch(me){J(me)}finally{q!==null&&re.types!==null&&(q.types=re.types),C.T=q}},Ft.unstable_useCacheRefresh=function(){return C.H.useCacheRefresh()},Ft.use=function(H){return C.H.use(H)},Ft.useActionState=function(H,q,re){return C.H.useActionState(H,q,re)},Ft.useCallback=function(H,q){return C.H.useCallback(H,q)},Ft.useContext=function(H){return C.H.useContext(H)},Ft.useDebugValue=function(){},Ft.useDeferredValue=function(H,q){return C.H.useDeferredValue(H,q)},Ft.useEffect=function(H,q){return C.H.useEffect(H,q)},Ft.useEffectEvent=function(H){return C.H.useEffectEvent(H)},Ft.useId=function(){return C.H.useId()},Ft.useImperativeHandle=function(H,q,re){return C.H.useImperativeHandle(H,q,re)},Ft.useInsertionEffect=function(H,q){return C.H.useInsertionEffect(H,q)},Ft.useLayoutEffect=function(H,q){return C.H.useLayoutEffect(H,q)},Ft.useMemo=function(H,q){return C.H.useMemo(H,q)},Ft.useOptimistic=function(H,q){return C.H.useOptimistic(H,q)},Ft.useReducer=function(H,q,re){return C.H.useReducer(H,q,re)},Ft.useRef=function(H){return C.H.useRef(H)},Ft.useState=function(H){return C.H.useState(H)},Ft.useSyncExternalStore=function(H,q,re){return C.H.useSyncExternalStore(H,q,re)},Ft.useTransition=function(){return C.H.useTransition()},Ft.version="19.2.0",Ft}var kD;function If(){return kD||(kD=1,_S.exports=j9()),_S.exports}var T=If();const Or=Xs(T),H9=F9({__proto__:null,default:Or},[T]);var SS={exports:{}},qh={},wS={exports:{}},ES={};var FD;function G9(){return FD||(FD=1,(function(t){function e(X,V){var Y=X.length;X.push(V);e:for(;0<Y;){var J=Y-1>>>1,se=X[J];if(0<r(se,V))X[J]=V,X[Y]=se,Y=J;else break e}}function n(X){return X.length===0?null:X[0]}function i(X){if(X.length===0)return null;var V=X[0],Y=X.pop();if(Y!==V){X[0]=Y;e:for(var J=0,se=X.length,H=se>>>1;J<H;){var q=2*(J+1)-1,re=X[q],ce=q+1,ye=X[ce];if(0>r(re,Y))ce<se&&0>r(ye,re)?(X[J]=ye,X[ce]=Y,J=ce):(X[J]=re,X[q]=Y,J=q);else if(ce<se&&0>r(ye,Y))X[J]=ye,X[ce]=Y,J=ce;else break e}}return V}function r(X,V){var Y=X.sortIndex-V.sortIndex;return Y!==0?Y:X.id-V.id}if(t.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var a=performance;t.unstable_now=function(){return a.now()}}else{var s=Date,l=s.now();t.unstable_now=function(){return s.now()-l}}var c=[],d=[],f=1,h=null,g=3,m=!1,b=!1,y=!1,x=!1,v=typeof setTimeout=="function"?setTimeout:null,w=typeof clearTimeout=="function"?clearTimeout:null,S=typeof setImmediate<"u"?setImmediate:null;function A(X){for(var V=n(d);V!==null;){if(V.callback===null)i(d);else if(V.startTime<=X)i(d),V.sortIndex=V.expirationTime,e(c,V);else break;V=n(d)}}function R(X){if(y=!1,A(X),!b)if(n(c)!==null)b=!0,N||(N=!0,U());else{var V=n(d);V!==null&&W(R,V.startTime-X)}}var N=!1,C=-1,F=5,P=-1;function L(){return x?!0:!(t.unstable_now()-P<F)}function B(){if(x=!1,N){var X=t.unstable_now();P=X;var V=!0;try{e:{b=!1,y&&(y=!1,w(C),C=-1),m=!0;var Y=g;try{t:{for(A(X),h=n(c);h!==null&&!(h.expirationTime>X&&L());){var J=h.callback;if(typeof J=="function"){h.callback=null,g=h.priorityLevel;var se=J(h.expirationTime<=X);if(X=t.unstable_now(),typeof se=="function"){h.callback=se,A(X),V=!0;break t}h===n(c)&&i(c),A(X)}else i(c);h=n(c)}if(h!==null)V=!0;else{var H=n(d);H!==null&&W(R,H.startTime-X),V=!1}}break e}finally{h=null,g=Y,m=!1}V=void 0}}finally{V?U():N=!1}}}var U;if(typeof S=="function")U=function(){S(B)};else if(typeof MessageChannel<"u"){var $=new MessageChannel,I=$.port2;$.port1.onmessage=B,U=function(){I.postMessage(null)}}else U=function(){v(B,0)};function W(X,V){C=v(function(){X(t.unstable_now())},V)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(X){X.callback=null},t.unstable_forceFrameRate=function(X){0>X||125<X?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):F=0<X?Math.floor(1e3/X):5},t.unstable_getCurrentPriorityLevel=function(){return g},t.unstable_next=function(X){switch(g){case 1:case 2:case 3:var V=3;break;default:V=g}var Y=g;g=V;try{return X()}finally{g=Y}},t.unstable_requestPaint=function(){x=!0},t.unstable_runWithPriority=function(X,V){switch(X){case 1:case 2:case 3:case 4:case 5:break;default:X=3}var Y=g;g=X;try{return V()}finally{g=Y}},t.unstable_scheduleCallback=function(X,V,Y){var J=t.unstable_now();switch(typeof Y=="object"&&Y!==null?(Y=Y.delay,Y=typeof Y=="number"&&0<Y?J+Y:J):Y=J,X){case 1:var se=-1;break;case 2:se=250;break;case 5:se=1073741823;break;case 4:se=1e4;break;default:se=5e3}return se=Y+se,X={id:f++,callback:V,priorityLevel:X,startTime:Y,expirationTime:se,sortIndex:-1},Y>J?(X.sortIndex=Y,e(d,X),n(c)===null&&X===n(d)&&(y?(w(C),C=-1):y=!0,W(R,Y-J))):(X.sortIndex=se,e(c,X),b||m||(b=!0,N||(N=!0,U()))),X},t.unstable_shouldYield=L,t.unstable_wrapCallback=function(X){var V=g;return function(){var Y=g;g=V;try{return X.apply(this,arguments)}finally{g=Y}}}})(ES)),ES}var zD;function V9(){return zD||(zD=1,wS.exports=G9()),wS.exports}var MS={exports:{}},gr={};var BD;function $9(){if(BD)return gr;BD=1;var t=If();function e(c){var d="https://react.dev/errors/"+c;if(1<arguments.length){d+="?args[]="+encodeURIComponent(arguments[1]);for(var f=2;f<arguments.length;f++)d+="&args[]="+encodeURIComponent(arguments[f])}return"Minified React error #"+c+"; visit "+d+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function n(){}var i={d:{f:n,r:function(){throw Error(e(522))},D:n,C:n,L:n,m:n,X:n,S:n,M:n},p:0,findDOMNode:null},r=Symbol.for("react.portal");function a(c,d,f){var h=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:r,key:h==null?null:""+h,children:c,containerInfo:d,implementation:f}}var s=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function l(c,d){if(c==="font")return"";if(typeof d=="string")return d==="use-credentials"?d:""}return gr.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=i,gr.createPortal=function(c,d){var f=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!d||d.nodeType!==1&&d.nodeType!==9&&d.nodeType!==11)throw Error(e(299));return a(c,d,null,f)},gr.flushSync=function(c){var d=s.T,f=i.p;try{if(s.T=null,i.p=2,c)return c()}finally{s.T=d,i.p=f,i.d.f()}},gr.preconnect=function(c,d){typeof c=="string"&&(d?(d=d.crossOrigin,d=typeof d=="string"?d==="use-credentials"?d:"":void 0):d=null,i.d.C(c,d))},gr.prefetchDNS=function(c){typeof c=="string"&&i.d.D(c)},gr.preinit=function(c,d){if(typeof c=="string"&&d&&typeof d.as=="string"){var f=d.as,h=l(f,d.crossOrigin),g=typeof d.integrity=="string"?d.integrity:void 0,m=typeof d.fetchPriority=="string"?d.fetchPriority:void 0;f==="style"?i.d.S(c,typeof d.precedence=="string"?d.precedence:void 0,{crossOrigin:h,integrity:g,fetchPriority:m}):f==="script"&&i.d.X(c,{crossOrigin:h,integrity:g,fetchPriority:m,nonce:typeof d.nonce=="string"?d.nonce:void 0})}},gr.preinitModule=function(c,d){if(typeof c=="string")if(typeof d=="object"&&d!==null){if(d.as==null||d.as==="script"){var f=l(d.as,d.crossOrigin);i.d.M(c,{crossOrigin:f,integrity:typeof d.integrity=="string"?d.integrity:void 0,nonce:typeof d.nonce=="string"?d.nonce:void 0})}}else d==null&&i.d.M(c)},gr.preload=function(c,d){if(typeof c=="string"&&typeof d=="object"&&d!==null&&typeof d.as=="string"){var f=d.as,h=l(f,d.crossOrigin);i.d.L(c,f,{crossOrigin:h,integrity:typeof d.integrity=="string"?d.integrity:void 0,nonce:typeof d.nonce=="string"?d.nonce:void 0,type:typeof d.type=="string"?d.type:void 0,fetchPriority:typeof d.fetchPriority=="string"?d.fetchPriority:void 0,referrerPolicy:typeof d.referrerPolicy=="string"?d.referrerPolicy:void 0,imageSrcSet:typeof d.imageSrcSet=="string"?d.imageSrcSet:void 0,imageSizes:typeof d.imageSizes=="string"?d.imageSizes:void 0,media:typeof d.media=="string"?d.media:void 0})}},gr.preloadModule=function(c,d){if(typeof c=="string")if(d){var f=l(d.as,d.crossOrigin);i.d.m(c,{as:typeof d.as=="string"&&d.as!=="script"?d.as:void 0,crossOrigin:f,integrity:typeof d.integrity=="string"?d.integrity:void 0})}else i.d.m(c)},gr.requestFormReset=function(c){i.d.r(c)},gr.unstable_batchedUpdates=function(c,d){return c(d)},gr.useFormState=function(c,d,f){return s.H.useFormState(c,d,f)},gr.useFormStatus=function(){return s.H.useHostTransitionStatus()},gr.version="19.2.0",gr}var jD;function Q4(){if(jD)return MS.exports;jD=1;function t(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(e){console.error(e)}}return t(),MS.exports=$9(),MS.exports}var HD;function W9(){if(HD)return qh;HD=1;var t=V9(),e=If(),n=Q4();function i(o){var u="https://react.dev/errors/"+o;if(1<arguments.length){u+="?args[]="+encodeURIComponent(arguments[1]);for(var p=2;p<arguments.length;p++)u+="&args[]="+encodeURIComponent(arguments[p])}return"Minified React error #"+o+"; visit "+u+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function r(o){return!(!o||o.nodeType!==1&&o.nodeType!==9&&o.nodeType!==11)}function a(o){var u=o,p=o;if(o.alternate)for(;u.return;)u=u.return;else{o=u;do u=o,(u.flags&4098)!==0&&(p=u.return),o=u.return;while(o)}return u.tag===3?p:null}function s(o){if(o.tag===13){var u=o.memoizedState;if(u===null&&(o=o.alternate,o!==null&&(u=o.memoizedState)),u!==null)return u.dehydrated}return null}function l(o){if(o.tag===31){var u=o.memoizedState;if(u===null&&(o=o.alternate,o!==null&&(u=o.memoizedState)),u!==null)return u.dehydrated}return null}function c(o){if(a(o)!==o)throw Error(i(188))}function d(o){var u=o.alternate;if(!u){if(u=a(o),u===null)throw Error(i(188));return u!==o?null:o}for(var p=o,_=u;;){var M=p.return;if(M===null)break;var D=M.alternate;if(D===null){if(_=M.return,_!==null){p=_;continue}break}if(M.child===D.child){for(D=M.child;D;){if(D===p)return c(M),o;if(D===_)return c(M),u;D=D.sibling}throw Error(i(188))}if(p.return!==_.return)p=M,_=D;else{for(var j=!1,te=M.child;te;){if(te===p){j=!0,p=M,_=D;break}if(te===_){j=!0,_=M,p=D;break}te=te.sibling}if(!j){for(te=D.child;te;){if(te===p){j=!0,p=D,_=M;break}if(te===_){j=!0,_=D,p=M;break}te=te.sibling}if(!j)throw Error(i(189))}}if(p.alternate!==_)throw Error(i(190))}if(p.tag!==3)throw Error(i(188));return p.stateNode.current===p?o:u}function f(o){var u=o.tag;if(u===5||u===26||u===27||u===6)return o;for(o=o.child;o!==null;){if(u=f(o),u!==null)return u;o=o.sibling}return null}var h=Object.assign,g=Symbol.for("react.element"),m=Symbol.for("react.transitional.element"),b=Symbol.for("react.portal"),y=Symbol.for("react.fragment"),x=Symbol.for("react.strict_mode"),v=Symbol.for("react.profiler"),w=Symbol.for("react.consumer"),S=Symbol.for("react.context"),A=Symbol.for("react.forward_ref"),R=Symbol.for("react.suspense"),N=Symbol.for("react.suspense_list"),C=Symbol.for("react.memo"),F=Symbol.for("react.lazy"),P=Symbol.for("react.activity"),L=Symbol.for("react.memo_cache_sentinel"),B=Symbol.iterator;function U(o){return o===null||typeof o!="object"?null:(o=B&&o[B]||o["@@iterator"],typeof o=="function"?o:null)}var $=Symbol.for("react.client.reference");function I(o){if(o==null)return null;if(typeof o=="function")return o.$$typeof===$?null:o.displayName||o.name||null;if(typeof o=="string")return o;switch(o){case y:return"Fragment";case v:return"Profiler";case x:return"StrictMode";case R:return"Suspense";case N:return"SuspenseList";case P:return"Activity"}if(typeof o=="object")switch(o.$$typeof){case b:return"Portal";case S:return o.displayName||"Context";case w:return(o._context.displayName||"Context")+".Consumer";case A:var u=o.render;return o=o.displayName,o||(o=u.displayName||u.name||"",o=o!==""?"ForwardRef("+o+")":"ForwardRef"),o;case C:return u=o.displayName||null,u!==null?u:I(o.type)||"Memo";case F:u=o._payload,o=o._init;try{return I(o(u))}catch{}}return null}var W=Array.isArray,X=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,V=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Y={pending:!1,data:null,method:null,action:null},J=[],se=-1;function H(o){return{current:o}}function q(o){0>se||(o.current=J[se],J[se]=null,se--)}function re(o,u){se++,J[se]=o.current,o.current=u}var ce=H(null),ye=H(null),me=H(null),be=H(null);function Ne(o,u){switch(re(me,u),re(ye,o),re(ce,null),u.nodeType){case 9:case 11:o=(o=u.documentElement)&&(o=o.namespaceURI)?iD(o):0;break;default:if(o=u.tagName,u=u.namespaceURI)u=iD(u),o=rD(u,o);else switch(o){case"svg":o=1;break;case"math":o=2;break;default:o=0}}q(ce),re(ce,o)}function he(){q(ce),q(ye),q(me)}function Ae(o){o.memoizedState!==null&&re(be,o);var u=ce.current,p=rD(u,o.type);u!==p&&(re(ye,o),re(ce,p))}function Be(o){ye.current===o&&(q(ce),q(ye)),be.current===o&&(q(be),Gh._currentValue=Y)}var le,lt;function z(o){if(le===void 0)try{throw Error()}catch(p){var u=p.stack.trim().match(/\n( *(at )?)/);le=u&&u[1]||"",lt=-1<p.stack.indexOf(`
  2. at`)?" (<anonymous>)":-1<p.stack.indexOf("@")?"@unknown:0:0":""}return`
  3. `+le+o+lt}var G=!1;function ne(o,u){if(!o||G)return"";G=!0;var p=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var _={DetermineComponentFrameRoot:function(){try{if(u){var it=function(){throw Error()};if(Object.defineProperty(it.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(it,[])}catch(Ye){var Ge=Ye}Reflect.construct(o,[],it)}else{try{it.call()}catch(Ye){Ge=Ye}o.call(it.prototype)}}else{try{throw Error()}catch(Ye){Ge=Ye}(it=o())&&typeof it.catch=="function"&&it.catch(function(){})}}catch(Ye){if(Ye&&Ge&&typeof Ye.stack=="string")return[Ye.stack,Ge.stack]}return[null,null]}};_.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var M=Object.getOwnPropertyDescriptor(_.DetermineComponentFrameRoot,"name");M&&M.configurable&&Object.defineProperty(_.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var D=_.DetermineComponentFrameRoot(),j=D[0],te=D[1];if(j&&te){var Se=j.split(`
  4. `),ze=te.split(`
  5. `);for(M=_=0;_<Se.length&&!Se[_].includes("DetermineComponentFrameRoot");)_++;for(;M<ze.length&&!ze[M].includes("DetermineComponentFrameRoot");)M++;if(_===Se.length||M===ze.length)for(_=Se.length-1,M=ze.length-1;1<=_&&0<=M&&Se[_]!==ze[M];)M--;for(;1<=_&&0<=M;_--,M--)if(Se[_]!==ze[M]){if(_!==1||M!==1)do if(_--,M--,0>M||Se[_]!==ze[M]){var Qe=`
  6. `+Se[_].replace(" at new "," at ");return o.displayName&&Qe.includes("<anonymous>")&&(Qe=Qe.replace("<anonymous>",o.displayName)),Qe}while(1<=_&&0<=M);break}}}finally{G=!1,Error.prepareStackTrace=p}return(p=o?o.displayName||o.name:"")?z(p):""}function Q(o,u){switch(o.tag){case 26:case 27:case 5:return z(o.type);case 16:return z("Lazy");case 13:return o.child!==u&&u!==null?z("Suspense Fallback"):z("Suspense");case 19:return z("SuspenseList");case 0:case 15:return ne(o.type,!1);case 11:return ne(o.type.render,!1);case 1:return ne(o.type,!0);case 31:return z("Activity");default:return""}}function ee(o){try{var u="",p=null;do u+=Q(o,p),p=o,o=o.return;while(o);return u}catch(_){return`
  7. Error generating stack: `+_.message+`
  8. `+_.stack}}var ae=Object.prototype.hasOwnProperty,ie=t.unstable_scheduleCallback,we=t.unstable_cancelCallback,ve=t.unstable_shouldYield,k=t.unstable_requestPaint,O=t.unstable_now,K=t.unstable_getCurrentPriorityLevel,pe=t.unstable_ImmediatePriority,xe=t.unstable_UserBlockingPriority,fe=t.unstable_NormalPriority,Ke=t.unstable_LowPriority,Ie=t.unstable_IdlePriority,$e=t.log,rt=t.unstable_setDisableYieldValue,ke=null,De=null;function ct(o){if(typeof $e=="function"&&rt(o),De&&typeof De.setStrictMode=="function")try{De.setStrictMode(ke,o)}catch{}}var et=Math.clz32?Math.clz32:ue,Je=Math.log,st=Math.LN2;function ue(o){return o>>>=0,o===0?32:31-(Je(o)/st|0)|0}var tt=256,de=262144,Le=4194304;function Me(o){var u=o&42;if(u!==0)return u;switch(o&-o){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return o&261888;case 262144:case 524288:case 1048576:case 2097152:return o&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return o&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return o}}function ge(o,u,p){var _=o.pendingLanes;if(_===0)return 0;var M=0,D=o.suspendedLanes,j=o.pingedLanes;o=o.warmLanes;var te=_&134217727;return te!==0?(_=te&~D,_!==0?M=Me(_):(j&=te,j!==0?M=Me(j):p||(p=te&~o,p!==0&&(M=Me(p))))):(te=_&~D,te!==0?M=Me(te):j!==0?M=Me(j):p||(p=_&~o,p!==0&&(M=Me(p)))),M===0?0:u!==0&&u!==M&&(u&D)===0&&(D=M&-M,p=u&-u,D>=p||D===32&&(p&4194048)!==0)?u:M}function je(o,u){return(o.pendingLanes&~(o.suspendedLanes&~o.pingedLanes)&u)===0}function at(o,u){switch(o){case 1:case 2:case 4:case 8:case 64:return u+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return u+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function mt(){var o=Le;return Le<<=1,(Le&62914560)===0&&(Le=4194304),o}function wt(o){for(var u=[],p=0;31>p;p++)u.push(o);return u}function Wt(o,u){o.pendingLanes|=u,u!==268435456&&(o.suspendedLanes=0,o.pingedLanes=0,o.warmLanes=0)}function Ct(o,u,p,_,M,D){var j=o.pendingLanes;o.pendingLanes=p,o.suspendedLanes=0,o.pingedLanes=0,o.warmLanes=0,o.expiredLanes&=p,o.entangledLanes&=p,o.errorRecoveryDisabledLanes&=p,o.shellSuspendCounter=0;var te=o.entanglements,Se=o.expirationTimes,ze=o.hiddenUpdates;for(p=j&~p;0<p;){var Qe=31-et(p),it=1<<Qe;te[Qe]=0,Se[Qe]=-1;var Ge=ze[Qe];if(Ge!==null)for(ze[Qe]=null,Qe=0;Qe<Ge.length;Qe++){var Ye=Ge[Qe];Ye!==null&&(Ye.lane&=-536870913)}p&=~it}_!==0&&mn(o,_,0),D!==0&&M===0&&o.tag!==0&&(o.suspendedLanes|=D&~(j&~u))}function mn(o,u,p){o.pendingLanes|=u,o.suspendedLanes&=~u;var _=31-et(u);o.entangledLanes|=u,o.entanglements[_]=o.entanglements[_]|1073741824|p&261930}function Rn(o,u){var p=o.entangledLanes|=u;for(o=o.entanglements;p;){var _=31-et(p),M=1<<_;M&u|o[_]&u&&(o[_]|=u),p&=~M}}function zi(o,u){var p=u&-u;return p=(p&42)!==0?1:wi(p),(p&(o.suspendedLanes|u))!==0?0:p}function wi(o){switch(o){case 2:o=1;break;case 8:o=4;break;case 32:o=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:o=128;break;case 268435456:o=134217728;break;default:o=0}return o}function Bi(o){return o&=-o,2<o?8<o?(o&134217727)!==0?32:268435456:8:2}function tr(){var o=V.p;return o!==0?o:(o=window.event,o===void 0?32:TD(o.type))}function mr(o,u){var p=V.p;try{return V.p=o,u()}finally{V.p=p}}var li=Math.random().toString(36).slice(2),Wn="__reactFiber$"+li,ei="__reactProps$"+li,Ja="__reactContainer$"+li,ol="__reactEvents$"+li,oe="__reactListeners$"+li,Ue="__reactHandles$"+li,Xe="__reactResources$"+li,qe="__reactMarker$"+li;function We(o){delete o[Wn],delete o[ei],delete o[ol],delete o[oe],delete o[Ue]}function gt(o){var u=o[Wn];if(u)return u;for(var p=o.parentNode;p;){if(u=p[Ja]||p[Wn]){if(p=u.alternate,u.child!==null||p!==null&&p.child!==null)for(o=dD(o);o!==null;){if(p=o[Wn])return p;o=dD(o)}return u}o=p,p=o.parentNode}return null}function Z(o){if(o=o[Wn]||o[Ja]){var u=o.tag;if(u===5||u===6||u===13||u===31||u===26||u===27||u===3)return o}return null}function _e(o){var u=o.tag;if(u===5||u===26||u===27||u===6)return o.stateNode;throw Error(i(33))}function Pe(o){var u=o[Xe];return u||(u=o[Xe]={hoistableStyles:new Map,hoistableScripts:new Map}),u}function Re(o){o[qe]=!0}var Ee=new Set,Ze={};function ot(o,u){ft(o,u),ft(o+"Capture",u)}function ft(o,u){for(Ze[o]=u,o=0;o<u.length;o++)Ee.add(u[o])}var dt=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),Et={},xt={};function ut(o){return ae.call(xt,o)?!0:ae.call(Et,o)?!1:dt.test(o)?xt[o]=!0:(Et[o]=!0,!1)}function Lt(o,u,p){if(ut(u))if(p===null)o.removeAttribute(u);else{switch(typeof p){case"undefined":case"function":case"symbol":o.removeAttribute(u);return;case"boolean":var _=u.toLowerCase().slice(0,5);if(_!=="data-"&&_!=="aria-"){o.removeAttribute(u);return}}o.setAttribute(u,""+p)}}function Pt(o,u,p){if(p===null)o.removeAttribute(u);else{switch(typeof p){case"undefined":case"function":case"symbol":case"boolean":o.removeAttribute(u);return}o.setAttribute(u,""+p)}}function Ht(o,u,p,_){if(_===null)o.removeAttribute(p);else{switch(typeof _){case"undefined":case"function":case"symbol":case"boolean":o.removeAttribute(p);return}o.setAttributeNS(u,p,""+_)}}function qt(o){switch(typeof o){case"bigint":case"boolean":case"number":case"string":case"undefined":return o;case"object":return o;default:return""}}function Jt(o){var u=o.type;return(o=o.nodeName)&&o.toLowerCase()==="input"&&(u==="checkbox"||u==="radio")}function Rt(o,u,p){var _=Object.getOwnPropertyDescriptor(o.constructor.prototype,u);if(!o.hasOwnProperty(u)&&typeof _<"u"&&typeof _.get=="function"&&typeof _.set=="function"){var M=_.get,D=_.set;return Object.defineProperty(o,u,{configurable:!0,get:function(){return M.call(this)},set:function(j){p=""+j,D.call(this,j)}}),Object.defineProperty(o,u,{enumerable:_.enumerable}),{getValue:function(){return p},setValue:function(j){p=""+j},stopTracking:function(){o._valueTracker=null,delete o[u]}}}}function kt(o){if(!o._valueTracker){var u=Jt(o)?"checked":"value";o._valueTracker=Rt(o,u,""+o[u])}}function zt(o){if(!o)return!1;var u=o._valueTracker;if(!u)return!0;var p=u.getValue(),_="";return o&&(_=Jt(o)?o.checked?"true":"false":o.value),o=_,o!==p?(u.setValue(o),!0):!1}function Kn(o){if(o=o||(typeof document<"u"?document:void 0),typeof o>"u")return null;try{return o.activeElement||o.body}catch{return o.body}}var ti=/[\n"\\]/g;function pn(o){return o.replace(ti,function(u){return"\\"+u.charCodeAt(0).toString(16)+" "})}function es(o,u,p,_,M,D,j,te){o.name="",j!=null&&typeof j!="function"&&typeof j!="symbol"&&typeof j!="boolean"?o.type=j:o.removeAttribute("type"),u!=null?j==="number"?(u===0&&o.value===""||o.value!=u)&&(o.value=""+qt(u)):o.value!==""+qt(u)&&(o.value=""+qt(u)):j!=="submit"&&j!=="reset"||o.removeAttribute("value"),u!=null?ji(o,j,qt(u)):p!=null?ji(o,j,qt(p)):_!=null&&o.removeAttribute("value"),M==null&&D!=null&&(o.defaultChecked=!!D),M!=null&&(o.checked=M&&typeof M!="function"&&typeof M!="symbol"),te!=null&&typeof te!="function"&&typeof te!="symbol"&&typeof te!="boolean"?o.name=""+qt(te):o.removeAttribute("name")}function gn(o,u,p,_,M,D,j,te){if(D!=null&&typeof D!="function"&&typeof D!="symbol"&&typeof D!="boolean"&&(o.type=D),u!=null||p!=null){if(!(D!=="submit"&&D!=="reset"||u!=null)){kt(o);return}p=p!=null?""+qt(p):"",u=u!=null?""+qt(u):p,te||u===o.value||(o.value=u),o.defaultValue=u}_=_??M,_=typeof _!="function"&&typeof _!="symbol"&&!!_,o.checked=te?o.checked:!!_,o.defaultChecked=!!_,j!=null&&typeof j!="function"&&typeof j!="symbol"&&typeof j!="boolean"&&(o.name=j),kt(o)}function ji(o,u,p){u==="number"&&Kn(o.ownerDocument)===o||o.defaultValue===""+p||(o.defaultValue=""+p)}function Ei(o,u,p,_){if(o=o.options,u){u={};for(var M=0;M<p.length;M++)u["$"+p[M]]=!0;for(p=0;p<o.length;p++)M=u.hasOwnProperty("$"+o[p].value),o[p].selected!==M&&(o[p].selected=M),M&&_&&(o[p].defaultSelected=!0)}else{for(p=""+qt(p),u=null,M=0;M<o.length;M++){if(o[M].value===p){o[M].selected=!0,_&&(o[M].defaultSelected=!0);return}u!==null||o[M].disabled||(u=o[M])}u!==null&&(u.selected=!0)}}function Hi(o,u,p){if(u!=null&&(u=""+qt(u),u!==o.value&&(o.value=u),p==null)){o.defaultValue!==u&&(o.defaultValue=u);return}o.defaultValue=p!=null?""+qt(p):""}function nr(o,u,p,_){if(u==null){if(_!=null){if(p!=null)throw Error(i(92));if(W(_)){if(1<_.length)throw Error(i(93));_=_[0]}p=_}p==null&&(p=""),u=p}p=qt(u),o.defaultValue=p,_=o.textContent,_===p&&_!==""&&_!==null&&(o.value=_),kt(o)}function Es(o,u){if(u){var p=o.firstChild;if(p&&p===o.lastChild&&p.nodeType===3){p.nodeValue=u;return}}o.textContent=u}var Zs=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function e3(o,u,p){var _=u.indexOf("--")===0;p==null||typeof p=="boolean"||p===""?_?o.setProperty(u,""):u==="float"?o.cssFloat="":o[u]="":_?o.setProperty(u,p):typeof p!="number"||p===0||Zs.has(u)?u==="float"?o.cssFloat=p:o[u]=(""+p).trim():o[u]=p+"px"}function t3(o,u,p){if(u!=null&&typeof u!="object")throw Error(i(62));if(o=o.style,p!=null){for(var _ in p)!p.hasOwnProperty(_)||u!=null&&u.hasOwnProperty(_)||(_.indexOf("--")===0?o.setProperty(_,""):_==="float"?o.cssFloat="":o[_]="");for(var M in u)_=u[M],u.hasOwnProperty(M)&&p[M]!==_&&e3(o,M,_)}else for(var D in u)u.hasOwnProperty(D)&&e3(o,D,u[D])}function gb(o){if(o.indexOf("-")===-1)return!1;switch(o){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var LG=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),IG=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function Zm(o){return IG.test(""+o)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":o}function Qs(){}var vb=null;function xb(o){return o=o.target||o.srcElement||window,o.correspondingUseElement&&(o=o.correspondingUseElement),o.nodeType===3?o.parentNode:o}var zu=null,Bu=null;function n3(o){var u=Z(o);if(u&&(o=u.stateNode)){var p=o[ei]||null;e:switch(o=u.stateNode,u.type){case"input":if(es(o,p.value,p.defaultValue,p.defaultValue,p.checked,p.defaultChecked,p.type,p.name),u=p.name,p.type==="radio"&&u!=null){for(p=o;p.parentNode;)p=p.parentNode;for(p=p.querySelectorAll('input[name="'+pn(""+u)+'"][type="radio"]'),u=0;u<p.length;u++){var _=p[u];if(_!==o&&_.form===o.form){var M=_[ei]||null;if(!M)throw Error(i(90));es(_,M.value,M.defaultValue,M.defaultValue,M.checked,M.defaultChecked,M.type,M.name)}}for(u=0;u<p.length;u++)_=p[u],_.form===o.form&&zt(_)}break e;case"textarea":Hi(o,p.value,p.defaultValue);break e;case"select":u=p.value,u!=null&&Ei(o,!!p.multiple,u,!1)}}}var yb=!1;function i3(o,u,p){if(yb)return o(u,p);yb=!0;try{var _=o(u);return _}finally{if(yb=!1,(zu!==null||Bu!==null)&&(Fg(),zu&&(u=zu,o=Bu,Bu=zu=null,n3(u),o)))for(u=0;u<o.length;u++)n3(o[u])}}function sh(o,u){var p=o.stateNode;if(p===null)return null;var _=p[ei]||null;if(_===null)return null;p=_[u];e:switch(u){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(_=!_.disabled)||(o=o.type,_=!(o==="button"||o==="input"||o==="select"||o==="textarea")),o=!_;break e;default:o=!1}if(o)return null;if(p&&typeof p!="function")throw Error(i(231,u,typeof p));return p}var Js=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),bb=!1;if(Js)try{var oh={};Object.defineProperty(oh,"passive",{get:function(){bb=!0}}),window.addEventListener("test",oh,oh),window.removeEventListener("test",oh,oh)}catch{bb=!1}var ll=null,_b=null,Qm=null;function r3(){if(Qm)return Qm;var o,u=_b,p=u.length,_,M="value"in ll?ll.value:ll.textContent,D=M.length;for(o=0;o<p&&u[o]===M[o];o++);var j=p-o;for(_=1;_<=j&&u[p-_]===M[D-_];_++);return Qm=M.slice(o,1<_?1-_:void 0)}function Jm(o){var u=o.keyCode;return"charCode"in o?(o=o.charCode,o===0&&u===13&&(o=13)):o=u,o===10&&(o=13),32<=o||o===13?o:0}function eg(){return!0}function a3(){return!1}function zr(o){function u(p,_,M,D,j){this._reactName=p,this._targetInst=M,this.type=_,this.nativeEvent=D,this.target=j,this.currentTarget=null;for(var te in o)o.hasOwnProperty(te)&&(p=o[te],this[te]=p?p(D):D[te]);return this.isDefaultPrevented=(D.defaultPrevented!=null?D.defaultPrevented:D.returnValue===!1)?eg:a3,this.isPropagationStopped=a3,this}return h(u.prototype,{preventDefault:function(){this.defaultPrevented=!0;var p=this.nativeEvent;p&&(p.preventDefault?p.preventDefault():typeof p.returnValue!="unknown"&&(p.returnValue=!1),this.isDefaultPrevented=eg)},stopPropagation:function(){var p=this.nativeEvent;p&&(p.stopPropagation?p.stopPropagation():typeof p.cancelBubble!="unknown"&&(p.cancelBubble=!0),this.isPropagationStopped=eg)},persist:function(){},isPersistent:eg}),u}var yc={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(o){return o.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},tg=zr(yc),lh=h({},yc,{view:0,detail:0}),UG=zr(lh),Sb,wb,ch,ng=h({},lh,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Mb,button:0,buttons:0,relatedTarget:function(o){return o.relatedTarget===void 0?o.fromElement===o.srcElement?o.toElement:o.fromElement:o.relatedTarget},movementX:function(o){return"movementX"in o?o.movementX:(o!==ch&&(ch&&o.type==="mousemove"?(Sb=o.screenX-ch.screenX,wb=o.screenY-ch.screenY):wb=Sb=0,ch=o),Sb)},movementY:function(o){return"movementY"in o?o.movementY:wb}}),s3=zr(ng),kG=h({},ng,{dataTransfer:0}),FG=zr(kG),zG=h({},lh,{relatedTarget:0}),Eb=zr(zG),BG=h({},yc,{animationName:0,elapsedTime:0,pseudoElement:0}),jG=zr(BG),HG=h({},yc,{clipboardData:function(o){return"clipboardData"in o?o.clipboardData:window.clipboardData}}),GG=zr(HG),VG=h({},yc,{data:0}),o3=zr(VG),$G={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},WG={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},XG={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function qG(o){var u=this.nativeEvent;return u.getModifierState?u.getModifierState(o):(o=XG[o])?!!u[o]:!1}function Mb(){return qG}var YG=h({},lh,{key:function(o){if(o.key){var u=$G[o.key]||o.key;if(u!=="Unidentified")return u}return o.type==="keypress"?(o=Jm(o),o===13?"Enter":String.fromCharCode(o)):o.type==="keydown"||o.type==="keyup"?WG[o.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Mb,charCode:function(o){return o.type==="keypress"?Jm(o):0},keyCode:function(o){return o.type==="keydown"||o.type==="keyup"?o.keyCode:0},which:function(o){return o.type==="keypress"?Jm(o):o.type==="keydown"||o.type==="keyup"?o.keyCode:0}}),KG=zr(YG),ZG=h({},ng,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),l3=zr(ZG),QG=h({},lh,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Mb}),JG=zr(QG),eV=h({},yc,{propertyName:0,elapsedTime:0,pseudoElement:0}),tV=zr(eV),nV=h({},ng,{deltaX:function(o){return"deltaX"in o?o.deltaX:"wheelDeltaX"in o?-o.wheelDeltaX:0},deltaY:function(o){return"deltaY"in o?o.deltaY:"wheelDeltaY"in o?-o.wheelDeltaY:"wheelDelta"in o?-o.wheelDelta:0},deltaZ:0,deltaMode:0}),iV=zr(nV),rV=h({},yc,{newState:0,oldState:0}),aV=zr(rV),sV=[9,13,27,32],Ab=Js&&"CompositionEvent"in window,uh=null;Js&&"documentMode"in document&&(uh=document.documentMode);var oV=Js&&"TextEvent"in window&&!uh,c3=Js&&(!Ab||uh&&8<uh&&11>=uh),u3=" ",d3=!1;function f3(o,u){switch(o){case"keyup":return sV.indexOf(u.keyCode)!==-1;case"keydown":return u.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function h3(o){return o=o.detail,typeof o=="object"&&"data"in o?o.data:null}var ju=!1;function lV(o,u){switch(o){case"compositionend":return h3(u);case"keypress":return u.which!==32?null:(d3=!0,u3);case"textInput":return o=u.data,o===u3&&d3?null:o;default:return null}}function cV(o,u){if(ju)return o==="compositionend"||!Ab&&f3(o,u)?(o=r3(),Qm=_b=ll=null,ju=!1,o):null;switch(o){case"paste":return null;case"keypress":if(!(u.ctrlKey||u.altKey||u.metaKey)||u.ctrlKey&&u.altKey){if(u.char&&1<u.char.length)return u.char;if(u.which)return String.fromCharCode(u.which)}return null;case"compositionend":return c3&&u.locale!=="ko"?null:u.data;default:return null}}var uV={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function p3(o){var u=o&&o.nodeName&&o.nodeName.toLowerCase();return u==="input"?!!uV[o.type]:u==="textarea"}function m3(o,u,p,_){zu?Bu?Bu.push(_):Bu=[_]:zu=_,u=$g(u,"onChange"),0<u.length&&(p=new tg("onChange","change",null,p,_),o.push({event:p,listeners:u}))}var dh=null,fh=null;function dV(o){ZP(o,0)}function ig(o){var u=_e(o);if(zt(u))return o}function g3(o,u){if(o==="change")return u}var v3=!1;if(Js){var Tb;if(Js){var Cb="oninput"in document;if(!Cb){var x3=document.createElement("div");x3.setAttribute("oninput","return;"),Cb=typeof x3.oninput=="function"}Tb=Cb}else Tb=!1;v3=Tb&&(!document.documentMode||9<document.documentMode)}function y3(){dh&&(dh.detachEvent("onpropertychange",b3),fh=dh=null)}function b3(o){if(o.propertyName==="value"&&ig(fh)){var u=[];m3(u,fh,o,xb(o)),i3(dV,u)}}function fV(o,u,p){o==="focusin"?(y3(),dh=u,fh=p,dh.attachEvent("onpropertychange",b3)):o==="focusout"&&y3()}function hV(o){if(o==="selectionchange"||o==="keyup"||o==="keydown")return ig(fh)}function pV(o,u){if(o==="click")return ig(u)}function mV(o,u){if(o==="input"||o==="change")return ig(u)}function gV(o,u){return o===u&&(o!==0||1/o===1/u)||o!==o&&u!==u}var ia=typeof Object.is=="function"?Object.is:gV;function hh(o,u){if(ia(o,u))return!0;if(typeof o!="object"||o===null||typeof u!="object"||u===null)return!1;var p=Object.keys(o),_=Object.keys(u);if(p.length!==_.length)return!1;for(_=0;_<p.length;_++){var M=p[_];if(!ae.call(u,M)||!ia(o[M],u[M]))return!1}return!0}function _3(o){for(;o&&o.firstChild;)o=o.firstChild;return o}function S3(o,u){var p=_3(o);o=0;for(var _;p;){if(p.nodeType===3){if(_=o+p.textContent.length,o<=u&&_>=u)return{node:p,offset:u-o};o=_}e:{for(;p;){if(p.nextSibling){p=p.nextSibling;break e}p=p.parentNode}p=void 0}p=_3(p)}}function w3(o,u){return o&&u?o===u?!0:o&&o.nodeType===3?!1:u&&u.nodeType===3?w3(o,u.parentNode):"contains"in o?o.contains(u):o.compareDocumentPosition?!!(o.compareDocumentPosition(u)&16):!1:!1}function E3(o){o=o!=null&&o.ownerDocument!=null&&o.ownerDocument.defaultView!=null?o.ownerDocument.defaultView:window;for(var u=Kn(o.document);u instanceof o.HTMLIFrameElement;){try{var p=typeof u.contentWindow.location.href=="string"}catch{p=!1}if(p)o=u.contentWindow;else break;u=Kn(o.document)}return u}function Rb(o){var u=o&&o.nodeName&&o.nodeName.toLowerCase();return u&&(u==="input"&&(o.type==="text"||o.type==="search"||o.type==="tel"||o.type==="url"||o.type==="password")||u==="textarea"||o.contentEditable==="true")}var vV=Js&&"documentMode"in document&&11>=document.documentMode,Hu=null,Pb=null,ph=null,Db=!1;function M3(o,u,p){var _=p.window===p?p.document:p.nodeType===9?p:p.ownerDocument;Db||Hu==null||Hu!==Kn(_)||(_=Hu,"selectionStart"in _&&Rb(_)?_={start:_.selectionStart,end:_.selectionEnd}:(_=(_.ownerDocument&&_.ownerDocument.defaultView||window).getSelection(),_={anchorNode:_.anchorNode,anchorOffset:_.anchorOffset,focusNode:_.focusNode,focusOffset:_.focusOffset}),ph&&hh(ph,_)||(ph=_,_=$g(Pb,"onSelect"),0<_.length&&(u=new tg("onSelect","select",null,u,p),o.push({event:u,listeners:_}),u.target=Hu)))}function bc(o,u){var p={};return p[o.toLowerCase()]=u.toLowerCase(),p["Webkit"+o]="webkit"+u,p["Moz"+o]="moz"+u,p}var Gu={animationend:bc("Animation","AnimationEnd"),animationiteration:bc("Animation","AnimationIteration"),animationstart:bc("Animation","AnimationStart"),transitionrun:bc("Transition","TransitionRun"),transitionstart:bc("Transition","TransitionStart"),transitioncancel:bc("Transition","TransitionCancel"),transitionend:bc("Transition","TransitionEnd")},Nb={},A3={};Js&&(A3=document.createElement("div").style,"AnimationEvent"in window||(delete Gu.animationend.animation,delete Gu.animationiteration.animation,delete Gu.animationstart.animation),"TransitionEvent"in window||delete Gu.transitionend.transition);function _c(o){if(Nb[o])return Nb[o];if(!Gu[o])return o;var u=Gu[o],p;for(p in u)if(u.hasOwnProperty(p)&&p in A3)return Nb[o]=u[p];return o}var T3=_c("animationend"),C3=_c("animationiteration"),R3=_c("animationstart"),xV=_c("transitionrun"),yV=_c("transitionstart"),bV=_c("transitioncancel"),P3=_c("transitionend"),D3=new Map,Ob="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");Ob.push("scrollEnd");function ts(o,u){D3.set(o,u),ot(u,[o])}var rg=typeof reportError=="function"?reportError:function(o){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var u=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof o=="object"&&o!==null&&typeof o.message=="string"?String(o.message):String(o),error:o});if(!window.dispatchEvent(u))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",o);return}console.error(o)},Ea=[],Vu=0,Lb=0;function ag(){for(var o=Vu,u=Lb=Vu=0;u<o;){var p=Ea[u];Ea[u++]=null;var _=Ea[u];Ea[u++]=null;var M=Ea[u];Ea[u++]=null;var D=Ea[u];if(Ea[u++]=null,_!==null&&M!==null){var j=_.pending;j===null?M.next=M:(M.next=j.next,j.next=M),_.pending=M}D!==0&&N3(p,M,D)}}function sg(o,u,p,_){Ea[Vu++]=o,Ea[Vu++]=u,Ea[Vu++]=p,Ea[Vu++]=_,Lb|=_,o.lanes|=_,o=o.alternate,o!==null&&(o.lanes|=_)}function Ib(o,u,p,_){return sg(o,u,p,_),og(o)}function Sc(o,u){return sg(o,null,null,u),og(o)}function N3(o,u,p){o.lanes|=p;var _=o.alternate;_!==null&&(_.lanes|=p);for(var M=!1,D=o.return;D!==null;)D.childLanes|=p,_=D.alternate,_!==null&&(_.childLanes|=p),D.tag===22&&(o=D.stateNode,o===null||o._visibility&1||(M=!0)),o=D,D=D.return;return o.tag===3?(D=o.stateNode,M&&u!==null&&(M=31-et(p),o=D.hiddenUpdates,_=o[M],_===null?o[M]=[u]:_.push(u),u.lane=p|536870912),D):null}function og(o){if(50<Uh)throw Uh=0,V_=null,Error(i(185));for(var u=o.return;u!==null;)o=u,u=o.return;return o.tag===3?o.stateNode:null}var $u={};function _V(o,u,p,_){this.tag=o,this.key=p,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=u,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=_,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function ra(o,u,p,_){return new _V(o,u,p,_)}function Ub(o){return o=o.prototype,!(!o||!o.isReactComponent)}function eo(o,u){var p=o.alternate;return p===null?(p=ra(o.tag,u,o.key,o.mode),p.elementType=o.elementType,p.type=o.type,p.stateNode=o.stateNode,p.alternate=o,o.alternate=p):(p.pendingProps=u,p.type=o.type,p.flags=0,p.subtreeFlags=0,p.deletions=null),p.flags=o.flags&65011712,p.childLanes=o.childLanes,p.lanes=o.lanes,p.child=o.child,p.memoizedProps=o.memoizedProps,p.memoizedState=o.memoizedState,p.updateQueue=o.updateQueue,u=o.dependencies,p.dependencies=u===null?null:{lanes:u.lanes,firstContext:u.firstContext},p.sibling=o.sibling,p.index=o.index,p.ref=o.ref,p.refCleanup=o.refCleanup,p}function O3(o,u){o.flags&=65011714;var p=o.alternate;return p===null?(o.childLanes=0,o.lanes=u,o.child=null,o.subtreeFlags=0,o.memoizedProps=null,o.memoizedState=null,o.updateQueue=null,o.dependencies=null,o.stateNode=null):(o.childLanes=p.childLanes,o.lanes=p.lanes,o.child=p.child,o.subtreeFlags=0,o.deletions=null,o.memoizedProps=p.memoizedProps,o.memoizedState=p.memoizedState,o.updateQueue=p.updateQueue,o.type=p.type,u=p.dependencies,o.dependencies=u===null?null:{lanes:u.lanes,firstContext:u.firstContext}),o}function lg(o,u,p,_,M,D){var j=0;if(_=o,typeof o=="function")Ub(o)&&(j=1);else if(typeof o=="string")j=A9(o,p,ce.current)?26:o==="html"||o==="head"||o==="body"?27:5;else e:switch(o){case P:return o=ra(31,p,u,M),o.elementType=P,o.lanes=D,o;case y:return wc(p.children,M,D,u);case x:j=8,M|=24;break;case v:return o=ra(12,p,u,M|2),o.elementType=v,o.lanes=D,o;case R:return o=ra(13,p,u,M),o.elementType=R,o.lanes=D,o;case N:return o=ra(19,p,u,M),o.elementType=N,o.lanes=D,o;default:if(typeof o=="object"&&o!==null)switch(o.$$typeof){case S:j=10;break e;case w:j=9;break e;case A:j=11;break e;case C:j=14;break e;case F:j=16,_=null;break e}j=29,p=Error(i(130,o===null?"null":typeof o,"")),_=null}return u=ra(j,p,u,M),u.elementType=o,u.type=_,u.lanes=D,u}function wc(o,u,p,_){return o=ra(7,o,_,u),o.lanes=p,o}function kb(o,u,p){return o=ra(6,o,null,u),o.lanes=p,o}function L3(o){var u=ra(18,null,null,0);return u.stateNode=o,u}function Fb(o,u,p){return u=ra(4,o.children!==null?o.children:[],o.key,u),u.lanes=p,u.stateNode={containerInfo:o.containerInfo,pendingChildren:null,implementation:o.implementation},u}var I3=new WeakMap;function Ma(o,u){if(typeof o=="object"&&o!==null){var p=I3.get(o);return p!==void 0?p:(u={value:o,source:u,stack:ee(u)},I3.set(o,u),u)}return{value:o,source:u,stack:ee(u)}}var Wu=[],Xu=0,cg=null,mh=0,Aa=[],Ta=0,cl=null,Ms=1,As="";function to(o,u){Wu[Xu++]=mh,Wu[Xu++]=cg,cg=o,mh=u}function U3(o,u,p){Aa[Ta++]=Ms,Aa[Ta++]=As,Aa[Ta++]=cl,cl=o;var _=Ms;o=As;var M=32-et(_)-1;_&=~(1<<M),p+=1;var D=32-et(u)+M;if(30<D){var j=M-M%5;D=(_&(1<<j)-1).toString(32),_>>=j,M-=j,Ms=1<<32-et(u)+M|p<<M|_,As=D+o}else Ms=1<<D|p<<M|_,As=o}function zb(o){o.return!==null&&(to(o,1),U3(o,1,0))}function Bb(o){for(;o===cg;)cg=Wu[--Xu],Wu[Xu]=null,mh=Wu[--Xu],Wu[Xu]=null;for(;o===cl;)cl=Aa[--Ta],Aa[Ta]=null,As=Aa[--Ta],Aa[Ta]=null,Ms=Aa[--Ta],Aa[Ta]=null}function k3(o,u){Aa[Ta++]=Ms,Aa[Ta++]=As,Aa[Ta++]=cl,Ms=u.id,As=u.overflow,cl=o}var ir=null,Un=null,rn=!1,ul=null,Ca=!1,jb=Error(i(519));function dl(o){var u=Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw gh(Ma(u,o)),jb}function F3(o){var u=o.stateNode,p=o.type,_=o.memoizedProps;switch(u[Wn]=o,u[ei]=_,p){case"dialog":Zt("cancel",u),Zt("close",u);break;case"iframe":case"object":case"embed":Zt("load",u);break;case"video":case"audio":for(p=0;p<Fh.length;p++)Zt(Fh[p],u);break;case"source":Zt("error",u);break;case"img":case"image":case"link":Zt("error",u),Zt("load",u);break;case"details":Zt("toggle",u);break;case"input":Zt("invalid",u),gn(u,_.value,_.defaultValue,_.checked,_.defaultChecked,_.type,_.name,!0);break;case"select":Zt("invalid",u);break;case"textarea":Zt("invalid",u),nr(u,_.value,_.defaultValue,_.children)}p=_.children,typeof p!="string"&&typeof p!="number"&&typeof p!="bigint"||u.textContent===""+p||_.suppressHydrationWarning===!0||tD(u.textContent,p)?(_.popover!=null&&(Zt("beforetoggle",u),Zt("toggle",u)),_.onScroll!=null&&Zt("scroll",u),_.onScrollEnd!=null&&Zt("scrollend",u),_.onClick!=null&&(u.onclick=Qs),u=!0):u=!1,u||dl(o,!0)}function z3(o){for(ir=o.return;ir;)switch(ir.tag){case 5:case 31:case 13:Ca=!1;return;case 27:case 3:Ca=!0;return;default:ir=ir.return}}function qu(o){if(o!==ir)return!1;if(!rn)return z3(o),rn=!0,!1;var u=o.tag,p;if((p=u!==3&&u!==27)&&((p=u===5)&&(p=o.type,p=!(p!=="form"&&p!=="button")||aS(o.type,o.memoizedProps)),p=!p),p&&Un&&dl(o),z3(o),u===13){if(o=o.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(i(317));Un=uD(o)}else if(u===31){if(o=o.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(i(317));Un=uD(o)}else u===27?(u=Un,Ml(o.type)?(o=uS,uS=null,Un=o):Un=u):Un=ir?Pa(o.stateNode.nextSibling):null;return!0}function Ec(){Un=ir=null,rn=!1}function Hb(){var o=ul;return o!==null&&(Gr===null?Gr=o:Gr.push.apply(Gr,o),ul=null),o}function gh(o){ul===null?ul=[o]:ul.push(o)}var Gb=H(null),Mc=null,no=null;function fl(o,u,p){re(Gb,u._currentValue),u._currentValue=p}function io(o){o._currentValue=Gb.current,q(Gb)}function Vb(o,u,p){for(;o!==null;){var _=o.alternate;if((o.childLanes&u)!==u?(o.childLanes|=u,_!==null&&(_.childLanes|=u)):_!==null&&(_.childLanes&u)!==u&&(_.childLanes|=u),o===p)break;o=o.return}}function $b(o,u,p,_){var M=o.child;for(M!==null&&(M.return=o);M!==null;){var D=M.dependencies;if(D!==null){var j=M.child;D=D.firstContext;e:for(;D!==null;){var te=D;D=M;for(var Se=0;Se<u.length;Se++)if(te.context===u[Se]){D.lanes|=p,te=D.alternate,te!==null&&(te.lanes|=p),Vb(D.return,p,o),_||(j=null);break e}D=te.next}}else if(M.tag===18){if(j=M.return,j===null)throw Error(i(341));j.lanes|=p,D=j.alternate,D!==null&&(D.lanes|=p),Vb(j,p,o),j=null}else j=M.child;if(j!==null)j.return=M;else for(j=M;j!==null;){if(j===o){j=null;break}if(M=j.sibling,M!==null){M.return=j.return,j=M;break}j=j.return}M=j}}function Yu(o,u,p,_){o=null;for(var M=u,D=!1;M!==null;){if(!D){if((M.flags&524288)!==0)D=!0;else if((M.flags&262144)!==0)break}if(M.tag===10){var j=M.alternate;if(j===null)throw Error(i(387));if(j=j.memoizedProps,j!==null){var te=M.type;ia(M.pendingProps.value,j.value)||(o!==null?o.push(te):o=[te])}}else if(M===be.current){if(j=M.alternate,j===null)throw Error(i(387));j.memoizedState.memoizedState!==M.memoizedState.memoizedState&&(o!==null?o.push(Gh):o=[Gh])}M=M.return}o!==null&&$b(u,o,p,_),u.flags|=262144}function ug(o){for(o=o.firstContext;o!==null;){if(!ia(o.context._currentValue,o.memoizedValue))return!0;o=o.next}return!1}function Ac(o){Mc=o,no=null,o=o.dependencies,o!==null&&(o.firstContext=null)}function rr(o){return B3(Mc,o)}function dg(o,u){return Mc===null&&Ac(o),B3(o,u)}function B3(o,u){var p=u._currentValue;if(u={context:u,memoizedValue:p,next:null},no===null){if(o===null)throw Error(i(308));no=u,o.dependencies={lanes:0,firstContext:u},o.flags|=524288}else no=no.next=u;return p}var SV=typeof AbortController<"u"?AbortController:function(){var o=[],u=this.signal={aborted:!1,addEventListener:function(p,_){o.push(_)}};this.abort=function(){u.aborted=!0,o.forEach(function(p){return p()})}},wV=t.unstable_scheduleCallback,EV=t.unstable_NormalPriority,ci={$$typeof:S,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Wb(){return{controller:new SV,data:new Map,refCount:0}}function vh(o){o.refCount--,o.refCount===0&&wV(EV,function(){o.controller.abort()})}var xh=null,Xb=0,Ku=0,Zu=null;function MV(o,u){if(xh===null){var p=xh=[];Xb=0,Ku=K_(),Zu={status:"pending",value:void 0,then:function(_){p.push(_)}}}return Xb++,u.then(j3,j3),u}function j3(){if(--Xb===0&&xh!==null){Zu!==null&&(Zu.status="fulfilled");var o=xh;xh=null,Ku=0,Zu=null;for(var u=0;u<o.length;u++)(0,o[u])()}}function AV(o,u){var p=[],_={status:"pending",value:null,reason:null,then:function(M){p.push(M)}};return o.then(function(){_.status="fulfilled",_.value=u;for(var M=0;M<p.length;M++)(0,p[M])(u)},function(M){for(_.status="rejected",_.reason=M,M=0;M<p.length;M++)(0,p[M])(void 0)}),_}var H3=X.S;X.S=function(o,u){MP=O(),typeof u=="object"&&u!==null&&typeof u.then=="function"&&MV(o,u),H3!==null&&H3(o,u)};var Tc=H(null);function qb(){var o=Tc.current;return o!==null?o:Pn.pooledCache}function fg(o,u){u===null?re(Tc,Tc.current):re(Tc,u.pool)}function G3(){var o=qb();return o===null?null:{parent:ci._currentValue,pool:o}}var Qu=Error(i(460)),Yb=Error(i(474)),hg=Error(i(542)),pg={then:function(){}};function V3(o){return o=o.status,o==="fulfilled"||o==="rejected"}function $3(o,u,p){switch(p=o[p],p===void 0?o.push(u):p!==u&&(u.then(Qs,Qs),u=p),u.status){case"fulfilled":return u.value;case"rejected":throw o=u.reason,X3(o),o;default:if(typeof u.status=="string")u.then(Qs,Qs);else{if(o=Pn,o!==null&&100<o.shellSuspendCounter)throw Error(i(482));o=u,o.status="pending",o.then(function(_){if(u.status==="pending"){var M=u;M.status="fulfilled",M.value=_}},function(_){if(u.status==="pending"){var M=u;M.status="rejected",M.reason=_}})}switch(u.status){case"fulfilled":return u.value;case"rejected":throw o=u.reason,X3(o),o}throw Rc=u,Qu}}function Cc(o){try{var u=o._init;return u(o._payload)}catch(p){throw p!==null&&typeof p=="object"&&typeof p.then=="function"?(Rc=p,Qu):p}}var Rc=null;function W3(){if(Rc===null)throw Error(i(459));var o=Rc;return Rc=null,o}function X3(o){if(o===Qu||o===hg)throw Error(i(483))}var Ju=null,yh=0;function mg(o){var u=yh;return yh+=1,Ju===null&&(Ju=[]),$3(Ju,o,u)}function bh(o,u){u=u.props.ref,o.ref=u!==void 0?u:null}function gg(o,u){throw u.$$typeof===g?Error(i(525)):(o=Object.prototype.toString.call(u),Error(i(31,o==="[object Object]"?"object with keys {"+Object.keys(u).join(", ")+"}":o)))}function q3(o){function u(Oe,Te){if(o){var Fe=Oe.deletions;Fe===null?(Oe.deletions=[Te],Oe.flags|=16):Fe.push(Te)}}function p(Oe,Te){if(!o)return null;for(;Te!==null;)u(Oe,Te),Te=Te.sibling;return null}function _(Oe){for(var Te=new Map;Oe!==null;)Oe.key!==null?Te.set(Oe.key,Oe):Te.set(Oe.index,Oe),Oe=Oe.sibling;return Te}function M(Oe,Te){return Oe=eo(Oe,Te),Oe.index=0,Oe.sibling=null,Oe}function D(Oe,Te,Fe){return Oe.index=Fe,o?(Fe=Oe.alternate,Fe!==null?(Fe=Fe.index,Fe<Te?(Oe.flags|=67108866,Te):Fe):(Oe.flags|=67108866,Te)):(Oe.flags|=1048576,Te)}function j(Oe){return o&&Oe.alternate===null&&(Oe.flags|=67108866),Oe}function te(Oe,Te,Fe,nt){return Te===null||Te.tag!==6?(Te=kb(Fe,Oe.mode,nt),Te.return=Oe,Te):(Te=M(Te,Fe),Te.return=Oe,Te)}function Se(Oe,Te,Fe,nt){var Dt=Fe.type;return Dt===y?Qe(Oe,Te,Fe.props.children,nt,Fe.key):Te!==null&&(Te.elementType===Dt||typeof Dt=="object"&&Dt!==null&&Dt.$$typeof===F&&Cc(Dt)===Te.type)?(Te=M(Te,Fe.props),bh(Te,Fe),Te.return=Oe,Te):(Te=lg(Fe.type,Fe.key,Fe.props,null,Oe.mode,nt),bh(Te,Fe),Te.return=Oe,Te)}function ze(Oe,Te,Fe,nt){return Te===null||Te.tag!==4||Te.stateNode.containerInfo!==Fe.containerInfo||Te.stateNode.implementation!==Fe.implementation?(Te=Fb(Fe,Oe.mode,nt),Te.return=Oe,Te):(Te=M(Te,Fe.children||[]),Te.return=Oe,Te)}function Qe(Oe,Te,Fe,nt,Dt){return Te===null||Te.tag!==7?(Te=wc(Fe,Oe.mode,nt,Dt),Te.return=Oe,Te):(Te=M(Te,Fe),Te.return=Oe,Te)}function it(Oe,Te,Fe){if(typeof Te=="string"&&Te!==""||typeof Te=="number"||typeof Te=="bigint")return Te=kb(""+Te,Oe.mode,Fe),Te.return=Oe,Te;if(typeof Te=="object"&&Te!==null){switch(Te.$$typeof){case m:return Fe=lg(Te.type,Te.key,Te.props,null,Oe.mode,Fe),bh(Fe,Te),Fe.return=Oe,Fe;case b:return Te=Fb(Te,Oe.mode,Fe),Te.return=Oe,Te;case F:return Te=Cc(Te),it(Oe,Te,Fe)}if(W(Te)||U(Te))return Te=wc(Te,Oe.mode,Fe,null),Te.return=Oe,Te;if(typeof Te.then=="function")return it(Oe,mg(Te),Fe);if(Te.$$typeof===S)return it(Oe,dg(Oe,Te),Fe);gg(Oe,Te)}return null}function Ge(Oe,Te,Fe,nt){var Dt=Te!==null?Te.key:null;if(typeof Fe=="string"&&Fe!==""||typeof Fe=="number"||typeof Fe=="bigint")return Dt!==null?null:te(Oe,Te,""+Fe,nt);if(typeof Fe=="object"&&Fe!==null){switch(Fe.$$typeof){case m:return Fe.key===Dt?Se(Oe,Te,Fe,nt):null;case b:return Fe.key===Dt?ze(Oe,Te,Fe,nt):null;case F:return Fe=Cc(Fe),Ge(Oe,Te,Fe,nt)}if(W(Fe)||U(Fe))return Dt!==null?null:Qe(Oe,Te,Fe,nt,null);if(typeof Fe.then=="function")return Ge(Oe,Te,mg(Fe),nt);if(Fe.$$typeof===S)return Ge(Oe,Te,dg(Oe,Fe),nt);gg(Oe,Fe)}return null}function Ye(Oe,Te,Fe,nt,Dt){if(typeof nt=="string"&&nt!==""||typeof nt=="number"||typeof nt=="bigint")return Oe=Oe.get(Fe)||null,te(Te,Oe,""+nt,Dt);if(typeof nt=="object"&&nt!==null){switch(nt.$$typeof){case m:return Oe=Oe.get(nt.key===null?Fe:nt.key)||null,Se(Te,Oe,nt,Dt);case b:return Oe=Oe.get(nt.key===null?Fe:nt.key)||null,ze(Te,Oe,nt,Dt);case F:return nt=Cc(nt),Ye(Oe,Te,Fe,nt,Dt)}if(W(nt)||U(nt))return Oe=Oe.get(Fe)||null,Qe(Te,Oe,nt,Dt,null);if(typeof nt.then=="function")return Ye(Oe,Te,Fe,mg(nt),Dt);if(nt.$$typeof===S)return Ye(Oe,Te,Fe,dg(Te,nt),Dt);gg(Te,nt)}return null}function St(Oe,Te,Fe,nt){for(var Dt=null,on=null,Tt=Te,jt=Te=0,tn=null;Tt!==null&&jt<Fe.length;jt++){Tt.index>jt?(tn=Tt,Tt=null):tn=Tt.sibling;var ln=Ge(Oe,Tt,Fe[jt],nt);if(ln===null){Tt===null&&(Tt=tn);break}o&&Tt&&ln.alternate===null&&u(Oe,Tt),Te=D(ln,Te,jt),on===null?Dt=ln:on.sibling=ln,on=ln,Tt=tn}if(jt===Fe.length)return p(Oe,Tt),rn&&to(Oe,jt),Dt;if(Tt===null){for(;jt<Fe.length;jt++)Tt=it(Oe,Fe[jt],nt),Tt!==null&&(Te=D(Tt,Te,jt),on===null?Dt=Tt:on.sibling=Tt,on=Tt);return rn&&to(Oe,jt),Dt}for(Tt=_(Tt);jt<Fe.length;jt++)tn=Ye(Tt,Oe,jt,Fe[jt],nt),tn!==null&&(o&&tn.alternate!==null&&Tt.delete(tn.key===null?jt:tn.key),Te=D(tn,Te,jt),on===null?Dt=tn:on.sibling=tn,on=tn);return o&&Tt.forEach(function(Pl){return u(Oe,Pl)}),rn&&to(Oe,jt),Dt}function Ot(Oe,Te,Fe,nt){if(Fe==null)throw Error(i(151));for(var Dt=null,on=null,Tt=Te,jt=Te=0,tn=null,ln=Fe.next();Tt!==null&&!ln.done;jt++,ln=Fe.next()){Tt.index>jt?(tn=Tt,Tt=null):tn=Tt.sibling;var Pl=Ge(Oe,Tt,ln.value,nt);if(Pl===null){Tt===null&&(Tt=tn);break}o&&Tt&&Pl.alternate===null&&u(Oe,Tt),Te=D(Pl,Te,jt),on===null?Dt=Pl:on.sibling=Pl,on=Pl,Tt=tn}if(ln.done)return p(Oe,Tt),rn&&to(Oe,jt),Dt;if(Tt===null){for(;!ln.done;jt++,ln=Fe.next())ln=it(Oe,ln.value,nt),ln!==null&&(Te=D(ln,Te,jt),on===null?Dt=ln:on.sibling=ln,on=ln);return rn&&to(Oe,jt),Dt}for(Tt=_(Tt);!ln.done;jt++,ln=Fe.next())ln=Ye(Tt,Oe,jt,ln.value,nt),ln!==null&&(o&&ln.alternate!==null&&Tt.delete(ln.key===null?jt:ln.key),Te=D(ln,Te,jt),on===null?Dt=ln:on.sibling=ln,on=ln);return o&&Tt.forEach(function(k9){return u(Oe,k9)}),rn&&to(Oe,jt),Dt}function Sn(Oe,Te,Fe,nt){if(typeof Fe=="object"&&Fe!==null&&Fe.type===y&&Fe.key===null&&(Fe=Fe.props.children),typeof Fe=="object"&&Fe!==null){switch(Fe.$$typeof){case m:e:{for(var Dt=Fe.key;Te!==null;){if(Te.key===Dt){if(Dt=Fe.type,Dt===y){if(Te.tag===7){p(Oe,Te.sibling),nt=M(Te,Fe.props.children),nt.return=Oe,Oe=nt;break e}}else if(Te.elementType===Dt||typeof Dt=="object"&&Dt!==null&&Dt.$$typeof===F&&Cc(Dt)===Te.type){p(Oe,Te.sibling),nt=M(Te,Fe.props),bh(nt,Fe),nt.return=Oe,Oe=nt;break e}p(Oe,Te);break}else u(Oe,Te);Te=Te.sibling}Fe.type===y?(nt=wc(Fe.props.children,Oe.mode,nt,Fe.key),nt.return=Oe,Oe=nt):(nt=lg(Fe.type,Fe.key,Fe.props,null,Oe.mode,nt),bh(nt,Fe),nt.return=Oe,Oe=nt)}return j(Oe);case b:e:{for(Dt=Fe.key;Te!==null;){if(Te.key===Dt)if(Te.tag===4&&Te.stateNode.containerInfo===Fe.containerInfo&&Te.stateNode.implementation===Fe.implementation){p(Oe,Te.sibling),nt=M(Te,Fe.children||[]),nt.return=Oe,Oe=nt;break e}else{p(Oe,Te);break}else u(Oe,Te);Te=Te.sibling}nt=Fb(Fe,Oe.mode,nt),nt.return=Oe,Oe=nt}return j(Oe);case F:return Fe=Cc(Fe),Sn(Oe,Te,Fe,nt)}if(W(Fe))return St(Oe,Te,Fe,nt);if(U(Fe)){if(Dt=U(Fe),typeof Dt!="function")throw Error(i(150));return Fe=Dt.call(Fe),Ot(Oe,Te,Fe,nt)}if(typeof Fe.then=="function")return Sn(Oe,Te,mg(Fe),nt);if(Fe.$$typeof===S)return Sn(Oe,Te,dg(Oe,Fe),nt);gg(Oe,Fe)}return typeof Fe=="string"&&Fe!==""||typeof Fe=="number"||typeof Fe=="bigint"?(Fe=""+Fe,Te!==null&&Te.tag===6?(p(Oe,Te.sibling),nt=M(Te,Fe),nt.return=Oe,Oe=nt):(p(Oe,Te),nt=kb(Fe,Oe.mode,nt),nt.return=Oe,Oe=nt),j(Oe)):p(Oe,Te)}return function(Oe,Te,Fe,nt){try{yh=0;var Dt=Sn(Oe,Te,Fe,nt);return Ju=null,Dt}catch(Tt){if(Tt===Qu||Tt===hg)throw Tt;var on=ra(29,Tt,null,Oe.mode);return on.lanes=nt,on.return=Oe,on}finally{}}}var Pc=q3(!0),Y3=q3(!1),hl=!1;function Kb(o){o.updateQueue={baseState:o.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Zb(o,u){o=o.updateQueue,u.updateQueue===o&&(u.updateQueue={baseState:o.baseState,firstBaseUpdate:o.firstBaseUpdate,lastBaseUpdate:o.lastBaseUpdate,shared:o.shared,callbacks:null})}function pl(o){return{lane:o,tag:0,payload:null,callback:null,next:null}}function ml(o,u,p){var _=o.updateQueue;if(_===null)return null;if(_=_.shared,(hn&2)!==0){var M=_.pending;return M===null?u.next=u:(u.next=M.next,M.next=u),_.pending=u,u=og(o),N3(o,null,p),u}return sg(o,_,u,p),og(o)}function _h(o,u,p){if(u=u.updateQueue,u!==null&&(u=u.shared,(p&4194048)!==0)){var _=u.lanes;_&=o.pendingLanes,p|=_,u.lanes=p,Rn(o,p)}}function Qb(o,u){var p=o.updateQueue,_=o.alternate;if(_!==null&&(_=_.updateQueue,p===_)){var M=null,D=null;if(p=p.firstBaseUpdate,p!==null){do{var j={lane:p.lane,tag:p.tag,payload:p.payload,callback:null,next:null};D===null?M=D=j:D=D.next=j,p=p.next}while(p!==null);D===null?M=D=u:D=D.next=u}else M=D=u;p={baseState:_.baseState,firstBaseUpdate:M,lastBaseUpdate:D,shared:_.shared,callbacks:_.callbacks},o.updateQueue=p;return}o=p.lastBaseUpdate,o===null?p.firstBaseUpdate=u:o.next=u,p.lastBaseUpdate=u}var Jb=!1;function Sh(){if(Jb){var o=Zu;if(o!==null)throw o}}function wh(o,u,p,_){Jb=!1;var M=o.updateQueue;hl=!1;var D=M.firstBaseUpdate,j=M.lastBaseUpdate,te=M.shared.pending;if(te!==null){M.shared.pending=null;var Se=te,ze=Se.next;Se.next=null,j===null?D=ze:j.next=ze,j=Se;var Qe=o.alternate;Qe!==null&&(Qe=Qe.updateQueue,te=Qe.lastBaseUpdate,te!==j&&(te===null?Qe.firstBaseUpdate=ze:te.next=ze,Qe.lastBaseUpdate=Se))}if(D!==null){var it=M.baseState;j=0,Qe=ze=Se=null,te=D;do{var Ge=te.lane&-536870913,Ye=Ge!==te.lane;if(Ye?(en&Ge)===Ge:(_&Ge)===Ge){Ge!==0&&Ge===Ku&&(Jb=!0),Qe!==null&&(Qe=Qe.next={lane:0,tag:te.tag,payload:te.payload,callback:null,next:null});e:{var St=o,Ot=te;Ge=u;var Sn=p;switch(Ot.tag){case 1:if(St=Ot.payload,typeof St=="function"){it=St.call(Sn,it,Ge);break e}it=St;break e;case 3:St.flags=St.flags&-65537|128;case 0:if(St=Ot.payload,Ge=typeof St=="function"?St.call(Sn,it,Ge):St,Ge==null)break e;it=h({},it,Ge);break e;case 2:hl=!0}}Ge=te.callback,Ge!==null&&(o.flags|=64,Ye&&(o.flags|=8192),Ye=M.callbacks,Ye===null?M.callbacks=[Ge]:Ye.push(Ge))}else Ye={lane:Ge,tag:te.tag,payload:te.payload,callback:te.callback,next:null},Qe===null?(ze=Qe=Ye,Se=it):Qe=Qe.next=Ye,j|=Ge;if(te=te.next,te===null){if(te=M.shared.pending,te===null)break;Ye=te,te=Ye.next,Ye.next=null,M.lastBaseUpdate=Ye,M.shared.pending=null}}while(!0);Qe===null&&(Se=it),M.baseState=Se,M.firstBaseUpdate=ze,M.lastBaseUpdate=Qe,D===null&&(M.shared.lanes=0),bl|=j,o.lanes=j,o.memoizedState=it}}function K3(o,u){if(typeof o!="function")throw Error(i(191,o));o.call(u)}function Z3(o,u){var p=o.callbacks;if(p!==null)for(o.callbacks=null,o=0;o<p.length;o++)K3(p[o],u)}var ed=H(null),vg=H(0);function Q3(o,u){o=ho,re(vg,o),re(ed,u),ho=o|u.baseLanes}function e_(){re(vg,ho),re(ed,ed.current)}function t_(){ho=vg.current,q(ed),q(vg)}var aa=H(null),Ra=null;function gl(o){var u=o.alternate;re(ni,ni.current&1),re(aa,o),Ra===null&&(u===null||ed.current!==null||u.memoizedState!==null)&&(Ra=o)}function n_(o){re(ni,ni.current),re(aa,o),Ra===null&&(Ra=o)}function J3(o){o.tag===22?(re(ni,ni.current),re(aa,o),Ra===null&&(Ra=o)):vl()}function vl(){re(ni,ni.current),re(aa,aa.current)}function sa(o){q(aa),Ra===o&&(Ra=null),q(ni)}var ni=H(0);function xg(o){for(var u=o;u!==null;){if(u.tag===13){var p=u.memoizedState;if(p!==null&&(p=p.dehydrated,p===null||lS(p)||cS(p)))return u}else if(u.tag===19&&(u.memoizedProps.revealOrder==="forwards"||u.memoizedProps.revealOrder==="backwards"||u.memoizedProps.revealOrder==="unstable_legacy-backwards"||u.memoizedProps.revealOrder==="together")){if((u.flags&128)!==0)return u}else if(u.child!==null){u.child.return=u,u=u.child;continue}if(u===o)break;for(;u.sibling===null;){if(u.return===null||u.return===o)return null;u=u.return}u.sibling.return=u.return,u=u.sibling}return null}var ro=0,Bt=null,bn=null,ui=null,yg=!1,td=!1,Dc=!1,bg=0,Eh=0,nd=null,TV=0;function Zn(){throw Error(i(321))}function i_(o,u){if(u===null)return!1;for(var p=0;p<u.length&&p<o.length;p++)if(!ia(o[p],u[p]))return!1;return!0}function r_(o,u,p,_,M,D){return ro=D,Bt=u,u.memoizedState=null,u.updateQueue=null,u.lanes=0,X.H=o===null||o.memoizedState===null?UR:y_,Dc=!1,D=p(_,M),Dc=!1,td&&(D=tR(u,p,_,M)),eR(o),D}function eR(o){X.H=Th;var u=bn!==null&&bn.next!==null;if(ro=0,ui=bn=Bt=null,yg=!1,Eh=0,nd=null,u)throw Error(i(300));o===null||di||(o=o.dependencies,o!==null&&ug(o)&&(di=!0))}function tR(o,u,p,_){Bt=o;var M=0;do{if(td&&(nd=null),Eh=0,td=!1,25<=M)throw Error(i(301));if(M+=1,ui=bn=null,o.updateQueue!=null){var D=o.updateQueue;D.lastEffect=null,D.events=null,D.stores=null,D.memoCache!=null&&(D.memoCache.index=0)}X.H=kR,D=u(p,_)}while(td);return D}function CV(){var o=X.H,u=o.useState()[0];return u=typeof u.then=="function"?Mh(u):u,o=o.useState()[0],(bn!==null?bn.memoizedState:null)!==o&&(Bt.flags|=1024),u}function a_(){var o=bg!==0;return bg=0,o}function s_(o,u,p){u.updateQueue=o.updateQueue,u.flags&=-2053,o.lanes&=~p}function o_(o){if(yg){for(o=o.memoizedState;o!==null;){var u=o.queue;u!==null&&(u.pending=null),o=o.next}yg=!1}ro=0,ui=bn=Bt=null,td=!1,Eh=bg=0,nd=null}function Tr(){var o={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return ui===null?Bt.memoizedState=ui=o:ui=ui.next=o,ui}function ii(){if(bn===null){var o=Bt.alternate;o=o!==null?o.memoizedState:null}else o=bn.next;var u=ui===null?Bt.memoizedState:ui.next;if(u!==null)ui=u,bn=o;else{if(o===null)throw Bt.alternate===null?Error(i(467)):Error(i(310));bn=o,o={memoizedState:bn.memoizedState,baseState:bn.baseState,baseQueue:bn.baseQueue,queue:bn.queue,next:null},ui===null?Bt.memoizedState=ui=o:ui=ui.next=o}return ui}function _g(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Mh(o){var u=Eh;return Eh+=1,nd===null&&(nd=[]),o=$3(nd,o,u),u=Bt,(ui===null?u.memoizedState:ui.next)===null&&(u=u.alternate,X.H=u===null||u.memoizedState===null?UR:y_),o}function Sg(o){if(o!==null&&typeof o=="object"){if(typeof o.then=="function")return Mh(o);if(o.$$typeof===S)return rr(o)}throw Error(i(438,String(o)))}function l_(o){var u=null,p=Bt.updateQueue;if(p!==null&&(u=p.memoCache),u==null){var _=Bt.alternate;_!==null&&(_=_.updateQueue,_!==null&&(_=_.memoCache,_!=null&&(u={data:_.data.map(function(M){return M.slice()}),index:0})))}if(u==null&&(u={data:[],index:0}),p===null&&(p=_g(),Bt.updateQueue=p),p.memoCache=u,p=u.data[u.index],p===void 0)for(p=u.data[u.index]=Array(o),_=0;_<o;_++)p[_]=L;return u.index++,p}function ao(o,u){return typeof u=="function"?u(o):u}function wg(o){var u=ii();return c_(u,bn,o)}function c_(o,u,p){var _=o.queue;if(_===null)throw Error(i(311));_.lastRenderedReducer=p;var M=o.baseQueue,D=_.pending;if(D!==null){if(M!==null){var j=M.next;M.next=D.next,D.next=j}u.baseQueue=M=D,_.pending=null}if(D=o.baseState,M===null)o.memoizedState=D;else{u=M.next;var te=j=null,Se=null,ze=u,Qe=!1;do{var it=ze.lane&-536870913;if(it!==ze.lane?(en&it)===it:(ro&it)===it){var Ge=ze.revertLane;if(Ge===0)Se!==null&&(Se=Se.next={lane:0,revertLane:0,gesture:null,action:ze.action,hasEagerState:ze.hasEagerState,eagerState:ze.eagerState,next:null}),it===Ku&&(Qe=!0);else if((ro&Ge)===Ge){ze=ze.next,Ge===Ku&&(Qe=!0);continue}else it={lane:0,revertLane:ze.revertLane,gesture:null,action:ze.action,hasEagerState:ze.hasEagerState,eagerState:ze.eagerState,next:null},Se===null?(te=Se=it,j=D):Se=Se.next=it,Bt.lanes|=Ge,bl|=Ge;it=ze.action,Dc&&p(D,it),D=ze.hasEagerState?ze.eagerState:p(D,it)}else Ge={lane:it,revertLane:ze.revertLane,gesture:ze.gesture,action:ze.action,hasEagerState:ze.hasEagerState,eagerState:ze.eagerState,next:null},Se===null?(te=Se=Ge,j=D):Se=Se.next=Ge,Bt.lanes|=it,bl|=it;ze=ze.next}while(ze!==null&&ze!==u);if(Se===null?j=D:Se.next=te,!ia(D,o.memoizedState)&&(di=!0,Qe&&(p=Zu,p!==null)))throw p;o.memoizedState=D,o.baseState=j,o.baseQueue=Se,_.lastRenderedState=D}return M===null&&(_.lanes=0),[o.memoizedState,_.dispatch]}function u_(o){var u=ii(),p=u.queue;if(p===null)throw Error(i(311));p.lastRenderedReducer=o;var _=p.dispatch,M=p.pending,D=u.memoizedState;if(M!==null){p.pending=null;var j=M=M.next;do D=o(D,j.action),j=j.next;while(j!==M);ia(D,u.memoizedState)||(di=!0),u.memoizedState=D,u.baseQueue===null&&(u.baseState=D),p.lastRenderedState=D}return[D,_]}function nR(o,u,p){var _=Bt,M=ii(),D=rn;if(D){if(p===void 0)throw Error(i(407));p=p()}else p=u();var j=!ia((bn||M).memoizedState,p);if(j&&(M.memoizedState=p,di=!0),M=M.queue,h_(aR.bind(null,_,M,o),[o]),M.getSnapshot!==u||j||ui!==null&&ui.memoizedState.tag&1){if(_.flags|=2048,id(9,{destroy:void 0},rR.bind(null,_,M,p,u),null),Pn===null)throw Error(i(349));D||(ro&127)!==0||iR(_,u,p)}return p}function iR(o,u,p){o.flags|=16384,o={getSnapshot:u,value:p},u=Bt.updateQueue,u===null?(u=_g(),Bt.updateQueue=u,u.stores=[o]):(p=u.stores,p===null?u.stores=[o]:p.push(o))}function rR(o,u,p,_){u.value=p,u.getSnapshot=_,sR(u)&&oR(o)}function aR(o,u,p){return p(function(){sR(u)&&oR(o)})}function sR(o){var u=o.getSnapshot;o=o.value;try{var p=u();return!ia(o,p)}catch{return!0}}function oR(o){var u=Sc(o,2);u!==null&&Vr(u,o,2)}function d_(o){var u=Tr();if(typeof o=="function"){var p=o;if(o=p(),Dc){ct(!0);try{p()}finally{ct(!1)}}}return u.memoizedState=u.baseState=o,u.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ao,lastRenderedState:o},u}function lR(o,u,p,_){return o.baseState=p,c_(o,bn,typeof _=="function"?_:ao)}function RV(o,u,p,_,M){if(Ag(o))throw Error(i(485));if(o=u.action,o!==null){var D={payload:M,action:o,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(j){D.listeners.push(j)}};X.T!==null?p(!0):D.isTransition=!1,_(D),p=u.pending,p===null?(D.next=u.pending=D,cR(u,D)):(D.next=p.next,u.pending=p.next=D)}}function cR(o,u){var p=u.action,_=u.payload,M=o.state;if(u.isTransition){var D=X.T,j={};X.T=j;try{var te=p(M,_),Se=X.S;Se!==null&&Se(j,te),uR(o,u,te)}catch(ze){f_(o,u,ze)}finally{D!==null&&j.types!==null&&(D.types=j.types),X.T=D}}else try{D=p(M,_),uR(o,u,D)}catch(ze){f_(o,u,ze)}}function uR(o,u,p){p!==null&&typeof p=="object"&&typeof p.then=="function"?p.then(function(_){dR(o,u,_)},function(_){return f_(o,u,_)}):dR(o,u,p)}function dR(o,u,p){u.status="fulfilled",u.value=p,fR(u),o.state=p,u=o.pending,u!==null&&(p=u.next,p===u?o.pending=null:(p=p.next,u.next=p,cR(o,p)))}function f_(o,u,p){var _=o.pending;if(o.pending=null,_!==null){_=_.next;do u.status="rejected",u.reason=p,fR(u),u=u.next;while(u!==_)}o.action=null}function fR(o){o=o.listeners;for(var u=0;u<o.length;u++)(0,o[u])()}function hR(o,u){return u}function pR(o,u){if(rn){var p=Pn.formState;if(p!==null){e:{var _=Bt;if(rn){if(Un){t:{for(var M=Un,D=Ca;M.nodeType!==8;){if(!D){M=null;break t}if(M=Pa(M.nextSibling),M===null){M=null;break t}}D=M.data,M=D==="F!"||D==="F"?M:null}if(M){Un=Pa(M.nextSibling),_=M.data==="F!";break e}}dl(_)}_=!1}_&&(u=p[0])}}return p=Tr(),p.memoizedState=p.baseState=u,_={pending:null,lanes:0,dispatch:null,lastRenderedReducer:hR,lastRenderedState:u},p.queue=_,p=OR.bind(null,Bt,_),_.dispatch=p,_=d_(!1),D=x_.bind(null,Bt,!1,_.queue),_=Tr(),M={state:u,dispatch:null,action:o,pending:null},_.queue=M,p=RV.bind(null,Bt,M,D,p),M.dispatch=p,_.memoizedState=o,[u,p,!1]}function mR(o){var u=ii();return gR(u,bn,o)}function gR(o,u,p){if(u=c_(o,u,hR)[0],o=wg(ao)[0],typeof u=="object"&&u!==null&&typeof u.then=="function")try{var _=Mh(u)}catch(j){throw j===Qu?hg:j}else _=u;u=ii();var M=u.queue,D=M.dispatch;return p!==u.memoizedState&&(Bt.flags|=2048,id(9,{destroy:void 0},PV.bind(null,M,p),null)),[_,D,o]}function PV(o,u){o.action=u}function vR(o){var u=ii(),p=bn;if(p!==null)return gR(u,p,o);ii(),u=u.memoizedState,p=ii();var _=p.queue.dispatch;return p.memoizedState=o,[u,_,!1]}function id(o,u,p,_){return o={tag:o,create:p,deps:_,inst:u,next:null},u=Bt.updateQueue,u===null&&(u=_g(),Bt.updateQueue=u),p=u.lastEffect,p===null?u.lastEffect=o.next=o:(_=p.next,p.next=o,o.next=_,u.lastEffect=o),o}function xR(){return ii().memoizedState}function Eg(o,u,p,_){var M=Tr();Bt.flags|=o,M.memoizedState=id(1|u,{destroy:void 0},p,_===void 0?null:_)}function Mg(o,u,p,_){var M=ii();_=_===void 0?null:_;var D=M.memoizedState.inst;bn!==null&&_!==null&&i_(_,bn.memoizedState.deps)?M.memoizedState=id(u,D,p,_):(Bt.flags|=o,M.memoizedState=id(1|u,D,p,_))}function yR(o,u){Eg(8390656,8,o,u)}function h_(o,u){Mg(2048,8,o,u)}function DV(o){Bt.flags|=4;var u=Bt.updateQueue;if(u===null)u=_g(),Bt.updateQueue=u,u.events=[o];else{var p=u.events;p===null?u.events=[o]:p.push(o)}}function bR(o){var u=ii().memoizedState;return DV({ref:u,nextImpl:o}),function(){if((hn&2)!==0)throw Error(i(440));return u.impl.apply(void 0,arguments)}}function _R(o,u){return Mg(4,2,o,u)}function SR(o,u){return Mg(4,4,o,u)}function wR(o,u){if(typeof u=="function"){o=o();var p=u(o);return function(){typeof p=="function"?p():u(null)}}if(u!=null)return o=o(),u.current=o,function(){u.current=null}}function ER(o,u,p){p=p!=null?p.concat([o]):null,Mg(4,4,wR.bind(null,u,o),p)}function p_(){}function MR(o,u){var p=ii();u=u===void 0?null:u;var _=p.memoizedState;return u!==null&&i_(u,_[1])?_[0]:(p.memoizedState=[o,u],o)}function AR(o,u){var p=ii();u=u===void 0?null:u;var _=p.memoizedState;if(u!==null&&i_(u,_[1]))return _[0];if(_=o(),Dc){ct(!0);try{o()}finally{ct(!1)}}return p.memoizedState=[_,u],_}function m_(o,u,p){return p===void 0||(ro&1073741824)!==0&&(en&261930)===0?o.memoizedState=u:(o.memoizedState=p,o=TP(),Bt.lanes|=o,bl|=o,p)}function TR(o,u,p,_){return ia(p,u)?p:ed.current!==null?(o=m_(o,p,_),ia(o,u)||(di=!0),o):(ro&42)===0||(ro&1073741824)!==0&&(en&261930)===0?(di=!0,o.memoizedState=p):(o=TP(),Bt.lanes|=o,bl|=o,u)}function CR(o,u,p,_,M){var D=V.p;V.p=D!==0&&8>D?D:8;var j=X.T,te={};X.T=te,x_(o,!1,u,p);try{var Se=M(),ze=X.S;if(ze!==null&&ze(te,Se),Se!==null&&typeof Se=="object"&&typeof Se.then=="function"){var Qe=AV(Se,_);Ah(o,u,Qe,ca(o))}else Ah(o,u,_,ca(o))}catch(it){Ah(o,u,{then:function(){},status:"rejected",reason:it},ca())}finally{V.p=D,j!==null&&te.types!==null&&(j.types=te.types),X.T=j}}function NV(){}function g_(o,u,p,_){if(o.tag!==5)throw Error(i(476));var M=RR(o).queue;CR(o,M,u,Y,p===null?NV:function(){return PR(o),p(_)})}function RR(o){var u=o.memoizedState;if(u!==null)return u;u={memoizedState:Y,baseState:Y,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ao,lastRenderedState:Y},next:null};var p={};return u.next={memoizedState:p,baseState:p,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ao,lastRenderedState:p},next:null},o.memoizedState=u,o=o.alternate,o!==null&&(o.memoizedState=u),u}function PR(o){var u=RR(o);u.next===null&&(u=o.alternate.memoizedState),Ah(o,u.next.queue,{},ca())}function v_(){return rr(Gh)}function DR(){return ii().memoizedState}function NR(){return ii().memoizedState}function OV(o){for(var u=o.return;u!==null;){switch(u.tag){case 24:case 3:var p=ca();o=pl(p);var _=ml(u,o,p);_!==null&&(Vr(_,u,p),_h(_,u,p)),u={cache:Wb()},o.payload=u;return}u=u.return}}function LV(o,u,p){var _=ca();p={lane:_,revertLane:0,gesture:null,action:p,hasEagerState:!1,eagerState:null,next:null},Ag(o)?LR(u,p):(p=Ib(o,u,p,_),p!==null&&(Vr(p,o,_),IR(p,u,_)))}function OR(o,u,p){var _=ca();Ah(o,u,p,_)}function Ah(o,u,p,_){var M={lane:_,revertLane:0,gesture:null,action:p,hasEagerState:!1,eagerState:null,next:null};if(Ag(o))LR(u,M);else{var D=o.alternate;if(o.lanes===0&&(D===null||D.lanes===0)&&(D=u.lastRenderedReducer,D!==null))try{var j=u.lastRenderedState,te=D(j,p);if(M.hasEagerState=!0,M.eagerState=te,ia(te,j))return sg(o,u,M,0),Pn===null&&ag(),!1}catch{}finally{}if(p=Ib(o,u,M,_),p!==null)return Vr(p,o,_),IR(p,u,_),!0}return!1}function x_(o,u,p,_){if(_={lane:2,revertLane:K_(),gesture:null,action:_,hasEagerState:!1,eagerState:null,next:null},Ag(o)){if(u)throw Error(i(479))}else u=Ib(o,p,_,2),u!==null&&Vr(u,o,2)}function Ag(o){var u=o.alternate;return o===Bt||u!==null&&u===Bt}function LR(o,u){td=yg=!0;var p=o.pending;p===null?u.next=u:(u.next=p.next,p.next=u),o.pending=u}function IR(o,u,p){if((p&4194048)!==0){var _=u.lanes;_&=o.pendingLanes,p|=_,u.lanes=p,Rn(o,p)}}var Th={readContext:rr,use:Sg,useCallback:Zn,useContext:Zn,useEffect:Zn,useImperativeHandle:Zn,useLayoutEffect:Zn,useInsertionEffect:Zn,useMemo:Zn,useReducer:Zn,useRef:Zn,useState:Zn,useDebugValue:Zn,useDeferredValue:Zn,useTransition:Zn,useSyncExternalStore:Zn,useId:Zn,useHostTransitionStatus:Zn,useFormState:Zn,useActionState:Zn,useOptimistic:Zn,useMemoCache:Zn,useCacheRefresh:Zn};Th.useEffectEvent=Zn;var UR={readContext:rr,use:Sg,useCallback:function(o,u){return Tr().memoizedState=[o,u===void 0?null:u],o},useContext:rr,useEffect:yR,useImperativeHandle:function(o,u,p){p=p!=null?p.concat([o]):null,Eg(4194308,4,wR.bind(null,u,o),p)},useLayoutEffect:function(o,u){return Eg(4194308,4,o,u)},useInsertionEffect:function(o,u){Eg(4,2,o,u)},useMemo:function(o,u){var p=Tr();u=u===void 0?null:u;var _=o();if(Dc){ct(!0);try{o()}finally{ct(!1)}}return p.memoizedState=[_,u],_},useReducer:function(o,u,p){var _=Tr();if(p!==void 0){var M=p(u);if(Dc){ct(!0);try{p(u)}finally{ct(!1)}}}else M=u;return _.memoizedState=_.baseState=M,o={pending:null,lanes:0,dispatch:null,lastRenderedReducer:o,lastRenderedState:M},_.queue=o,o=o.dispatch=LV.bind(null,Bt,o),[_.memoizedState,o]},useRef:function(o){var u=Tr();return o={current:o},u.memoizedState=o},useState:function(o){o=d_(o);var u=o.queue,p=OR.bind(null,Bt,u);return u.dispatch=p,[o.memoizedState,p]},useDebugValue:p_,useDeferredValue:function(o,u){var p=Tr();return m_(p,o,u)},useTransition:function(){var o=d_(!1);return o=CR.bind(null,Bt,o.queue,!0,!1),Tr().memoizedState=o,[!1,o]},useSyncExternalStore:function(o,u,p){var _=Bt,M=Tr();if(rn){if(p===void 0)throw Error(i(407));p=p()}else{if(p=u(),Pn===null)throw Error(i(349));(en&127)!==0||iR(_,u,p)}M.memoizedState=p;var D={value:p,getSnapshot:u};return M.queue=D,yR(aR.bind(null,_,D,o),[o]),_.flags|=2048,id(9,{destroy:void 0},rR.bind(null,_,D,p,u),null),p},useId:function(){var o=Tr(),u=Pn.identifierPrefix;if(rn){var p=As,_=Ms;p=(_&~(1<<32-et(_)-1)).toString(32)+p,u="_"+u+"R_"+p,p=bg++,0<p&&(u+="H"+p.toString(32)),u+="_"}else p=TV++,u="_"+u+"r_"+p.toString(32)+"_";return o.memoizedState=u},useHostTransitionStatus:v_,useFormState:pR,useActionState:pR,useOptimistic:function(o){var u=Tr();u.memoizedState=u.baseState=o;var p={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return u.queue=p,u=x_.bind(null,Bt,!0,p),p.dispatch=u,[o,u]},useMemoCache:l_,useCacheRefresh:function(){return Tr().memoizedState=OV.bind(null,Bt)},useEffectEvent:function(o){var u=Tr(),p={impl:o};return u.memoizedState=p,function(){if((hn&2)!==0)throw Error(i(440));return p.impl.apply(void 0,arguments)}}},y_={readContext:rr,use:Sg,useCallback:MR,useContext:rr,useEffect:h_,useImperativeHandle:ER,useInsertionEffect:_R,useLayoutEffect:SR,useMemo:AR,useReducer:wg,useRef:xR,useState:function(){return wg(ao)},useDebugValue:p_,useDeferredValue:function(o,u){var p=ii();return TR(p,bn.memoizedState,o,u)},useTransition:function(){var o=wg(ao)[0],u=ii().memoizedState;return[typeof o=="boolean"?o:Mh(o),u]},useSyncExternalStore:nR,useId:DR,useHostTransitionStatus:v_,useFormState:mR,useActionState:mR,useOptimistic:function(o,u){var p=ii();return lR(p,bn,o,u)},useMemoCache:l_,useCacheRefresh:NR};y_.useEffectEvent=bR;var kR={readContext:rr,use:Sg,useCallback:MR,useContext:rr,useEffect:h_,useImperativeHandle:ER,useInsertionEffect:_R,useLayoutEffect:SR,useMemo:AR,useReducer:u_,useRef:xR,useState:function(){return u_(ao)},useDebugValue:p_,useDeferredValue:function(o,u){var p=ii();return bn===null?m_(p,o,u):TR(p,bn.memoizedState,o,u)},useTransition:function(){var o=u_(ao)[0],u=ii().memoizedState;return[typeof o=="boolean"?o:Mh(o),u]},useSyncExternalStore:nR,useId:DR,useHostTransitionStatus:v_,useFormState:vR,useActionState:vR,useOptimistic:function(o,u){var p=ii();return bn!==null?lR(p,bn,o,u):(p.baseState=o,[o,p.queue.dispatch])},useMemoCache:l_,useCacheRefresh:NR};kR.useEffectEvent=bR;function b_(o,u,p,_){u=o.memoizedState,p=p(_,u),p=p==null?u:h({},u,p),o.memoizedState=p,o.lanes===0&&(o.updateQueue.baseState=p)}var __={enqueueSetState:function(o,u,p){o=o._reactInternals;var _=ca(),M=pl(_);M.payload=u,p!=null&&(M.callback=p),u=ml(o,M,_),u!==null&&(Vr(u,o,_),_h(u,o,_))},enqueueReplaceState:function(o,u,p){o=o._reactInternals;var _=ca(),M=pl(_);M.tag=1,M.payload=u,p!=null&&(M.callback=p),u=ml(o,M,_),u!==null&&(Vr(u,o,_),_h(u,o,_))},enqueueForceUpdate:function(o,u){o=o._reactInternals;var p=ca(),_=pl(p);_.tag=2,u!=null&&(_.callback=u),u=ml(o,_,p),u!==null&&(Vr(u,o,p),_h(u,o,p))}};function FR(o,u,p,_,M,D,j){return o=o.stateNode,typeof o.shouldComponentUpdate=="function"?o.shouldComponentUpdate(_,D,j):u.prototype&&u.prototype.isPureReactComponent?!hh(p,_)||!hh(M,D):!0}function zR(o,u,p,_){o=u.state,typeof u.componentWillReceiveProps=="function"&&u.componentWillReceiveProps(p,_),typeof u.UNSAFE_componentWillReceiveProps=="function"&&u.UNSAFE_componentWillReceiveProps(p,_),u.state!==o&&__.enqueueReplaceState(u,u.state,null)}function Nc(o,u){var p=u;if("ref"in u){p={};for(var _ in u)_!=="ref"&&(p[_]=u[_])}if(o=o.defaultProps){p===u&&(p=h({},p));for(var M in o)p[M]===void 0&&(p[M]=o[M])}return p}function BR(o){rg(o)}function jR(o){console.error(o)}function HR(o){rg(o)}function Tg(o,u){try{var p=o.onUncaughtError;p(u.value,{componentStack:u.stack})}catch(_){setTimeout(function(){throw _})}}function GR(o,u,p){try{var _=o.onCaughtError;_(p.value,{componentStack:p.stack,errorBoundary:u.tag===1?u.stateNode:null})}catch(M){setTimeout(function(){throw M})}}function S_(o,u,p){return p=pl(p),p.tag=3,p.payload={element:null},p.callback=function(){Tg(o,u)},p}function VR(o){return o=pl(o),o.tag=3,o}function $R(o,u,p,_){var M=p.type.getDerivedStateFromError;if(typeof M=="function"){var D=_.value;o.payload=function(){return M(D)},o.callback=function(){GR(u,p,_)}}var j=p.stateNode;j!==null&&typeof j.componentDidCatch=="function"&&(o.callback=function(){GR(u,p,_),typeof M!="function"&&(_l===null?_l=new Set([this]):_l.add(this));var te=_.stack;this.componentDidCatch(_.value,{componentStack:te!==null?te:""})})}function IV(o,u,p,_,M){if(p.flags|=32768,_!==null&&typeof _=="object"&&typeof _.then=="function"){if(u=p.alternate,u!==null&&Yu(u,p,M,!0),p=aa.current,p!==null){switch(p.tag){case 31:case 13:return Ra===null?zg():p.alternate===null&&Qn===0&&(Qn=3),p.flags&=-257,p.flags|=65536,p.lanes=M,_===pg?p.flags|=16384:(u=p.updateQueue,u===null?p.updateQueue=new Set([_]):u.add(_),X_(o,_,M)),!1;case 22:return p.flags|=65536,_===pg?p.flags|=16384:(u=p.updateQueue,u===null?(u={transitions:null,markerInstances:null,retryQueue:new Set([_])},p.updateQueue=u):(p=u.retryQueue,p===null?u.retryQueue=new Set([_]):p.add(_)),X_(o,_,M)),!1}throw Error(i(435,p.tag))}return X_(o,_,M),zg(),!1}if(rn)return u=aa.current,u!==null?((u.flags&65536)===0&&(u.flags|=256),u.flags|=65536,u.lanes=M,_!==jb&&(o=Error(i(422),{cause:_}),gh(Ma(o,p)))):(_!==jb&&(u=Error(i(423),{cause:_}),gh(Ma(u,p))),o=o.current.alternate,o.flags|=65536,M&=-M,o.lanes|=M,_=Ma(_,p),M=S_(o.stateNode,_,M),Qb(o,M),Qn!==4&&(Qn=2)),!1;var D=Error(i(520),{cause:_});if(D=Ma(D,p),Ih===null?Ih=[D]:Ih.push(D),Qn!==4&&(Qn=2),u===null)return!0;_=Ma(_,p),p=u;do{switch(p.tag){case 3:return p.flags|=65536,o=M&-M,p.lanes|=o,o=S_(p.stateNode,_,o),Qb(p,o),!1;case 1:if(u=p.type,D=p.stateNode,(p.flags&128)===0&&(typeof u.getDerivedStateFromError=="function"||D!==null&&typeof D.componentDidCatch=="function"&&(_l===null||!_l.has(D))))return p.flags|=65536,M&=-M,p.lanes|=M,M=VR(M),$R(M,o,p,_),Qb(p,M),!1}p=p.return}while(p!==null);return!1}var w_=Error(i(461)),di=!1;function ar(o,u,p,_){u.child=o===null?Y3(u,null,p,_):Pc(u,o.child,p,_)}function WR(o,u,p,_,M){p=p.render;var D=u.ref;if("ref"in _){var j={};for(var te in _)te!=="ref"&&(j[te]=_[te])}else j=_;return Ac(u),_=r_(o,u,p,j,D,M),te=a_(),o!==null&&!di?(s_(o,u,M),so(o,u,M)):(rn&&te&&zb(u),u.flags|=1,ar(o,u,_,M),u.child)}function XR(o,u,p,_,M){if(o===null){var D=p.type;return typeof D=="function"&&!Ub(D)&&D.defaultProps===void 0&&p.compare===null?(u.tag=15,u.type=D,qR(o,u,D,_,M)):(o=lg(p.type,null,_,u,u.mode,M),o.ref=u.ref,o.return=u,u.child=o)}if(D=o.child,!D_(o,M)){var j=D.memoizedProps;if(p=p.compare,p=p!==null?p:hh,p(j,_)&&o.ref===u.ref)return so(o,u,M)}return u.flags|=1,o=eo(D,_),o.ref=u.ref,o.return=u,u.child=o}function qR(o,u,p,_,M){if(o!==null){var D=o.memoizedProps;if(hh(D,_)&&o.ref===u.ref)if(di=!1,u.pendingProps=_=D,D_(o,M))(o.flags&131072)!==0&&(di=!0);else return u.lanes=o.lanes,so(o,u,M)}return E_(o,u,p,_,M)}function YR(o,u,p,_){var M=_.children,D=o!==null?o.memoizedState:null;if(o===null&&u.stateNode===null&&(u.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),_.mode==="hidden"){if((u.flags&128)!==0){if(D=D!==null?D.baseLanes|p:p,o!==null){for(_=u.child=o.child,M=0;_!==null;)M=M|_.lanes|_.childLanes,_=_.sibling;_=M&~D}else _=0,u.child=null;return KR(o,u,D,p,_)}if((p&536870912)!==0)u.memoizedState={baseLanes:0,cachePool:null},o!==null&&fg(u,D!==null?D.cachePool:null),D!==null?Q3(u,D):e_(),J3(u);else return _=u.lanes=536870912,KR(o,u,D!==null?D.baseLanes|p:p,p,_)}else D!==null?(fg(u,D.cachePool),Q3(u,D),vl(),u.memoizedState=null):(o!==null&&fg(u,null),e_(),vl());return ar(o,u,M,p),u.child}function Ch(o,u){return o!==null&&o.tag===22||u.stateNode!==null||(u.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),u.sibling}function KR(o,u,p,_,M){var D=qb();return D=D===null?null:{parent:ci._currentValue,pool:D},u.memoizedState={baseLanes:p,cachePool:D},o!==null&&fg(u,null),e_(),J3(u),o!==null&&Yu(o,u,_,!0),u.childLanes=M,null}function Cg(o,u){return u=Pg({mode:u.mode,children:u.children},o.mode),u.ref=o.ref,o.child=u,u.return=o,u}function ZR(o,u,p){return Pc(u,o.child,null,p),o=Cg(u,u.pendingProps),o.flags|=2,sa(u),u.memoizedState=null,o}function UV(o,u,p){var _=u.pendingProps,M=(u.flags&128)!==0;if(u.flags&=-129,o===null){if(rn){if(_.mode==="hidden")return o=Cg(u,_),u.lanes=536870912,Ch(null,o);if(n_(u),(o=Un)?(o=cD(o,Ca),o=o!==null&&o.data==="&"?o:null,o!==null&&(u.memoizedState={dehydrated:o,treeContext:cl!==null?{id:Ms,overflow:As}:null,retryLane:536870912,hydrationErrors:null},p=L3(o),p.return=u,u.child=p,ir=u,Un=null)):o=null,o===null)throw dl(u);return u.lanes=536870912,null}return Cg(u,_)}var D=o.memoizedState;if(D!==null){var j=D.dehydrated;if(n_(u),M)if(u.flags&256)u.flags&=-257,u=ZR(o,u,p);else if(u.memoizedState!==null)u.child=o.child,u.flags|=128,u=null;else throw Error(i(558));else if(di||Yu(o,u,p,!1),M=(p&o.childLanes)!==0,di||M){if(_=Pn,_!==null&&(j=zi(_,p),j!==0&&j!==D.retryLane))throw D.retryLane=j,Sc(o,j),Vr(_,o,j),w_;zg(),u=ZR(o,u,p)}else o=D.treeContext,Un=Pa(j.nextSibling),ir=u,rn=!0,ul=null,Ca=!1,o!==null&&k3(u,o),u=Cg(u,_),u.flags|=4096;return u}return o=eo(o.child,{mode:_.mode,children:_.children}),o.ref=u.ref,u.child=o,o.return=u,o}function Rg(o,u){var p=u.ref;if(p===null)o!==null&&o.ref!==null&&(u.flags|=4194816);else{if(typeof p!="function"&&typeof p!="object")throw Error(i(284));(o===null||o.ref!==p)&&(u.flags|=4194816)}}function E_(o,u,p,_,M){return Ac(u),p=r_(o,u,p,_,void 0,M),_=a_(),o!==null&&!di?(s_(o,u,M),so(o,u,M)):(rn&&_&&zb(u),u.flags|=1,ar(o,u,p,M),u.child)}function QR(o,u,p,_,M,D){return Ac(u),u.updateQueue=null,p=tR(u,_,p,M),eR(o),_=a_(),o!==null&&!di?(s_(o,u,D),so(o,u,D)):(rn&&_&&zb(u),u.flags|=1,ar(o,u,p,D),u.child)}function JR(o,u,p,_,M){if(Ac(u),u.stateNode===null){var D=$u,j=p.contextType;typeof j=="object"&&j!==null&&(D=rr(j)),D=new p(_,D),u.memoizedState=D.state!==null&&D.state!==void 0?D.state:null,D.updater=__,u.stateNode=D,D._reactInternals=u,D=u.stateNode,D.props=_,D.state=u.memoizedState,D.refs={},Kb(u),j=p.contextType,D.context=typeof j=="object"&&j!==null?rr(j):$u,D.state=u.memoizedState,j=p.getDerivedStateFromProps,typeof j=="function"&&(b_(u,p,j,_),D.state=u.memoizedState),typeof p.getDerivedStateFromProps=="function"||typeof D.getSnapshotBeforeUpdate=="function"||typeof D.UNSAFE_componentWillMount!="function"&&typeof D.componentWillMount!="function"||(j=D.state,typeof D.componentWillMount=="function"&&D.componentWillMount(),typeof D.UNSAFE_componentWillMount=="function"&&D.UNSAFE_componentWillMount(),j!==D.state&&__.enqueueReplaceState(D,D.state,null),wh(u,_,D,M),Sh(),D.state=u.memoizedState),typeof D.componentDidMount=="function"&&(u.flags|=4194308),_=!0}else if(o===null){D=u.stateNode;var te=u.memoizedProps,Se=Nc(p,te);D.props=Se;var ze=D.context,Qe=p.contextType;j=$u,typeof Qe=="object"&&Qe!==null&&(j=rr(Qe));var it=p.getDerivedStateFromProps;Qe=typeof it=="function"||typeof D.getSnapshotBeforeUpdate=="function",te=u.pendingProps!==te,Qe||typeof D.UNSAFE_componentWillReceiveProps!="function"&&typeof D.componentWillReceiveProps!="function"||(te||ze!==j)&&zR(u,D,_,j),hl=!1;var Ge=u.memoizedState;D.state=Ge,wh(u,_,D,M),Sh(),ze=u.memoizedState,te||Ge!==ze||hl?(typeof it=="function"&&(b_(u,p,it,_),ze=u.memoizedState),(Se=hl||FR(u,p,Se,_,Ge,ze,j))?(Qe||typeof D.UNSAFE_componentWillMount!="function"&&typeof D.componentWillMount!="function"||(typeof D.componentWillMount=="function"&&D.componentWillMount(),typeof D.UNSAFE_componentWillMount=="function"&&D.UNSAFE_componentWillMount()),typeof D.componentDidMount=="function"&&(u.flags|=4194308)):(typeof D.componentDidMount=="function"&&(u.flags|=4194308),u.memoizedProps=_,u.memoizedState=ze),D.props=_,D.state=ze,D.context=j,_=Se):(typeof D.componentDidMount=="function"&&(u.flags|=4194308),_=!1)}else{D=u.stateNode,Zb(o,u),j=u.memoizedProps,Qe=Nc(p,j),D.props=Qe,it=u.pendingProps,Ge=D.context,ze=p.contextType,Se=$u,typeof ze=="object"&&ze!==null&&(Se=rr(ze)),te=p.getDerivedStateFromProps,(ze=typeof te=="function"||typeof D.getSnapshotBeforeUpdate=="function")||typeof D.UNSAFE_componentWillReceiveProps!="function"&&typeof D.componentWillReceiveProps!="function"||(j!==it||Ge!==Se)&&zR(u,D,_,Se),hl=!1,Ge=u.memoizedState,D.state=Ge,wh(u,_,D,M),Sh();var Ye=u.memoizedState;j!==it||Ge!==Ye||hl||o!==null&&o.dependencies!==null&&ug(o.dependencies)?(typeof te=="function"&&(b_(u,p,te,_),Ye=u.memoizedState),(Qe=hl||FR(u,p,Qe,_,Ge,Ye,Se)||o!==null&&o.dependencies!==null&&ug(o.dependencies))?(ze||typeof D.UNSAFE_componentWillUpdate!="function"&&typeof D.componentWillUpdate!="function"||(typeof D.componentWillUpdate=="function"&&D.componentWillUpdate(_,Ye,Se),typeof D.UNSAFE_componentWillUpdate=="function"&&D.UNSAFE_componentWillUpdate(_,Ye,Se)),typeof D.componentDidUpdate=="function"&&(u.flags|=4),typeof D.getSnapshotBeforeUpdate=="function"&&(u.flags|=1024)):(typeof D.componentDidUpdate!="function"||j===o.memoizedProps&&Ge===o.memoizedState||(u.flags|=4),typeof D.getSnapshotBeforeUpdate!="function"||j===o.memoizedProps&&Ge===o.memoizedState||(u.flags|=1024),u.memoizedProps=_,u.memoizedState=Ye),D.props=_,D.state=Ye,D.context=Se,_=Qe):(typeof D.componentDidUpdate!="function"||j===o.memoizedProps&&Ge===o.memoizedState||(u.flags|=4),typeof D.getSnapshotBeforeUpdate!="function"||j===o.memoizedProps&&Ge===o.memoizedState||(u.flags|=1024),_=!1)}return D=_,Rg(o,u),_=(u.flags&128)!==0,D||_?(D=u.stateNode,p=_&&typeof p.getDerivedStateFromError!="function"?null:D.render(),u.flags|=1,o!==null&&_?(u.child=Pc(u,o.child,null,M),u.child=Pc(u,null,p,M)):ar(o,u,p,M),u.memoizedState=D.state,o=u.child):o=so(o,u,M),o}function eP(o,u,p,_){return Ec(),u.flags|=256,ar(o,u,p,_),u.child}var M_={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function A_(o){return{baseLanes:o,cachePool:G3()}}function T_(o,u,p){return o=o!==null?o.childLanes&~p:0,u&&(o|=la),o}function tP(o,u,p){var _=u.pendingProps,M=!1,D=(u.flags&128)!==0,j;if((j=D)||(j=o!==null&&o.memoizedState===null?!1:(ni.current&2)!==0),j&&(M=!0,u.flags&=-129),j=(u.flags&32)!==0,u.flags&=-33,o===null){if(rn){if(M?gl(u):vl(),(o=Un)?(o=cD(o,Ca),o=o!==null&&o.data!=="&"?o:null,o!==null&&(u.memoizedState={dehydrated:o,treeContext:cl!==null?{id:Ms,overflow:As}:null,retryLane:536870912,hydrationErrors:null},p=L3(o),p.return=u,u.child=p,ir=u,Un=null)):o=null,o===null)throw dl(u);return cS(o)?u.lanes=32:u.lanes=536870912,null}var te=_.children;return _=_.fallback,M?(vl(),M=u.mode,te=Pg({mode:"hidden",children:te},M),_=wc(_,M,p,null),te.return=u,_.return=u,te.sibling=_,u.child=te,_=u.child,_.memoizedState=A_(p),_.childLanes=T_(o,j,p),u.memoizedState=M_,Ch(null,_)):(gl(u),C_(u,te))}var Se=o.memoizedState;if(Se!==null&&(te=Se.dehydrated,te!==null)){if(D)u.flags&256?(gl(u),u.flags&=-257,u=R_(o,u,p)):u.memoizedState!==null?(vl(),u.child=o.child,u.flags|=128,u=null):(vl(),te=_.fallback,M=u.mode,_=Pg({mode:"visible",children:_.children},M),te=wc(te,M,p,null),te.flags|=2,_.return=u,te.return=u,_.sibling=te,u.child=_,Pc(u,o.child,null,p),_=u.child,_.memoizedState=A_(p),_.childLanes=T_(o,j,p),u.memoizedState=M_,u=Ch(null,_));else if(gl(u),cS(te)){if(j=te.nextSibling&&te.nextSibling.dataset,j)var ze=j.dgst;j=ze,_=Error(i(419)),_.stack="",_.digest=j,gh({value:_,source:null,stack:null}),u=R_(o,u,p)}else if(di||Yu(o,u,p,!1),j=(p&o.childLanes)!==0,di||j){if(j=Pn,j!==null&&(_=zi(j,p),_!==0&&_!==Se.retryLane))throw Se.retryLane=_,Sc(o,_),Vr(j,o,_),w_;lS(te)||zg(),u=R_(o,u,p)}else lS(te)?(u.flags|=192,u.child=o.child,u=null):(o=Se.treeContext,Un=Pa(te.nextSibling),ir=u,rn=!0,ul=null,Ca=!1,o!==null&&k3(u,o),u=C_(u,_.children),u.flags|=4096);return u}return M?(vl(),te=_.fallback,M=u.mode,Se=o.child,ze=Se.sibling,_=eo(Se,{mode:"hidden",children:_.children}),_.subtreeFlags=Se.subtreeFlags&65011712,ze!==null?te=eo(ze,te):(te=wc(te,M,p,null),te.flags|=2),te.return=u,_.return=u,_.sibling=te,u.child=_,Ch(null,_),_=u.child,te=o.child.memoizedState,te===null?te=A_(p):(M=te.cachePool,M!==null?(Se=ci._currentValue,M=M.parent!==Se?{parent:Se,pool:Se}:M):M=G3(),te={baseLanes:te.baseLanes|p,cachePool:M}),_.memoizedState=te,_.childLanes=T_(o,j,p),u.memoizedState=M_,Ch(o.child,_)):(gl(u),p=o.child,o=p.sibling,p=eo(p,{mode:"visible",children:_.children}),p.return=u,p.sibling=null,o!==null&&(j=u.deletions,j===null?(u.deletions=[o],u.flags|=16):j.push(o)),u.child=p,u.memoizedState=null,p)}function C_(o,u){return u=Pg({mode:"visible",children:u},o.mode),u.return=o,o.child=u}function Pg(o,u){return o=ra(22,o,null,u),o.lanes=0,o}function R_(o,u,p){return Pc(u,o.child,null,p),o=C_(u,u.pendingProps.children),o.flags|=2,u.memoizedState=null,o}function nP(o,u,p){o.lanes|=u;var _=o.alternate;_!==null&&(_.lanes|=u),Vb(o.return,u,p)}function P_(o,u,p,_,M,D){var j=o.memoizedState;j===null?o.memoizedState={isBackwards:u,rendering:null,renderingStartTime:0,last:_,tail:p,tailMode:M,treeForkCount:D}:(j.isBackwards=u,j.rendering=null,j.renderingStartTime=0,j.last=_,j.tail=p,j.tailMode=M,j.treeForkCount=D)}function iP(o,u,p){var _=u.pendingProps,M=_.revealOrder,D=_.tail;_=_.children;var j=ni.current,te=(j&2)!==0;if(te?(j=j&1|2,u.flags|=128):j&=1,re(ni,j),ar(o,u,_,p),_=rn?mh:0,!te&&o!==null&&(o.flags&128)!==0)e:for(o=u.child;o!==null;){if(o.tag===13)o.memoizedState!==null&&nP(o,p,u);else if(o.tag===19)nP(o,p,u);else if(o.child!==null){o.child.return=o,o=o.child;continue}if(o===u)break e;for(;o.sibling===null;){if(o.return===null||o.return===u)break e;o=o.return}o.sibling.return=o.return,o=o.sibling}switch(M){case"forwards":for(p=u.child,M=null;p!==null;)o=p.alternate,o!==null&&xg(o)===null&&(M=p),p=p.sibling;p=M,p===null?(M=u.child,u.child=null):(M=p.sibling,p.sibling=null),P_(u,!1,M,p,D,_);break;case"backwards":case"unstable_legacy-backwards":for(p=null,M=u.child,u.child=null;M!==null;){if(o=M.alternate,o!==null&&xg(o)===null){u.child=M;break}o=M.sibling,M.sibling=p,p=M,M=o}P_(u,!0,p,null,D,_);break;case"together":P_(u,!1,null,null,void 0,_);break;default:u.memoizedState=null}return u.child}function so(o,u,p){if(o!==null&&(u.dependencies=o.dependencies),bl|=u.lanes,(p&u.childLanes)===0)if(o!==null){if(Yu(o,u,p,!1),(p&u.childLanes)===0)return null}else return null;if(o!==null&&u.child!==o.child)throw Error(i(153));if(u.child!==null){for(o=u.child,p=eo(o,o.pendingProps),u.child=p,p.return=u;o.sibling!==null;)o=o.sibling,p=p.sibling=eo(o,o.pendingProps),p.return=u;p.sibling=null}return u.child}function D_(o,u){return(o.lanes&u)!==0?!0:(o=o.dependencies,!!(o!==null&&ug(o)))}function kV(o,u,p){switch(u.tag){case 3:Ne(u,u.stateNode.containerInfo),fl(u,ci,o.memoizedState.cache),Ec();break;case 27:case 5:Ae(u);break;case 4:Ne(u,u.stateNode.containerInfo);break;case 10:fl(u,u.type,u.memoizedProps.value);break;case 31:if(u.memoizedState!==null)return u.flags|=128,n_(u),null;break;case 13:var _=u.memoizedState;if(_!==null)return _.dehydrated!==null?(gl(u),u.flags|=128,null):(p&u.child.childLanes)!==0?tP(o,u,p):(gl(u),o=so(o,u,p),o!==null?o.sibling:null);gl(u);break;case 19:var M=(o.flags&128)!==0;if(_=(p&u.childLanes)!==0,_||(Yu(o,u,p,!1),_=(p&u.childLanes)!==0),M){if(_)return iP(o,u,p);u.flags|=128}if(M=u.memoizedState,M!==null&&(M.rendering=null,M.tail=null,M.lastEffect=null),re(ni,ni.current),_)break;return null;case 22:return u.lanes=0,YR(o,u,p,u.pendingProps);case 24:fl(u,ci,o.memoizedState.cache)}return so(o,u,p)}function rP(o,u,p){if(o!==null)if(o.memoizedProps!==u.pendingProps)di=!0;else{if(!D_(o,p)&&(u.flags&128)===0)return di=!1,kV(o,u,p);di=(o.flags&131072)!==0}else di=!1,rn&&(u.flags&1048576)!==0&&U3(u,mh,u.index);switch(u.lanes=0,u.tag){case 16:e:{var _=u.pendingProps;if(o=Cc(u.elementType),u.type=o,typeof o=="function")Ub(o)?(_=Nc(o,_),u.tag=1,u=JR(null,u,o,_,p)):(u.tag=0,u=E_(null,u,o,_,p));else{if(o!=null){var M=o.$$typeof;if(M===A){u.tag=11,u=WR(null,u,o,_,p);break e}else if(M===C){u.tag=14,u=XR(null,u,o,_,p);break e}}throw u=I(o)||o,Error(i(306,u,""))}}return u;case 0:return E_(o,u,u.type,u.pendingProps,p);case 1:return _=u.type,M=Nc(_,u.pendingProps),JR(o,u,_,M,p);case 3:e:{if(Ne(u,u.stateNode.containerInfo),o===null)throw Error(i(387));_=u.pendingProps;var D=u.memoizedState;M=D.element,Zb(o,u),wh(u,_,null,p);var j=u.memoizedState;if(_=j.cache,fl(u,ci,_),_!==D.cache&&$b(u,[ci],p,!0),Sh(),_=j.element,D.isDehydrated)if(D={element:_,isDehydrated:!1,cache:j.cache},u.updateQueue.baseState=D,u.memoizedState=D,u.flags&256){u=eP(o,u,_,p);break e}else if(_!==M){M=Ma(Error(i(424)),u),gh(M),u=eP(o,u,_,p);break e}else{switch(o=u.stateNode.containerInfo,o.nodeType){case 9:o=o.body;break;default:o=o.nodeName==="HTML"?o.ownerDocument.body:o}for(Un=Pa(o.firstChild),ir=u,rn=!0,ul=null,Ca=!0,p=Y3(u,null,_,p),u.child=p;p;)p.flags=p.flags&-3|4096,p=p.sibling}else{if(Ec(),_===M){u=so(o,u,p);break e}ar(o,u,_,p)}u=u.child}return u;case 26:return Rg(o,u),o===null?(p=mD(u.type,null,u.pendingProps,null))?u.memoizedState=p:rn||(p=u.type,o=u.pendingProps,_=Wg(me.current).createElement(p),_[Wn]=u,_[ei]=o,sr(_,p,o),Re(_),u.stateNode=_):u.memoizedState=mD(u.type,o.memoizedProps,u.pendingProps,o.memoizedState),null;case 27:return Ae(u),o===null&&rn&&(_=u.stateNode=fD(u.type,u.pendingProps,me.current),ir=u,Ca=!0,M=Un,Ml(u.type)?(uS=M,Un=Pa(_.firstChild)):Un=M),ar(o,u,u.pendingProps.children,p),Rg(o,u),o===null&&(u.flags|=4194304),u.child;case 5:return o===null&&rn&&((M=_=Un)&&(_=h9(_,u.type,u.pendingProps,Ca),_!==null?(u.stateNode=_,ir=u,Un=Pa(_.firstChild),Ca=!1,M=!0):M=!1),M||dl(u)),Ae(u),M=u.type,D=u.pendingProps,j=o!==null?o.memoizedProps:null,_=D.children,aS(M,D)?_=null:j!==null&&aS(M,j)&&(u.flags|=32),u.memoizedState!==null&&(M=r_(o,u,CV,null,null,p),Gh._currentValue=M),Rg(o,u),ar(o,u,_,p),u.child;case 6:return o===null&&rn&&((o=p=Un)&&(p=p9(p,u.pendingProps,Ca),p!==null?(u.stateNode=p,ir=u,Un=null,o=!0):o=!1),o||dl(u)),null;case 13:return tP(o,u,p);case 4:return Ne(u,u.stateNode.containerInfo),_=u.pendingProps,o===null?u.child=Pc(u,null,_,p):ar(o,u,_,p),u.child;case 11:return WR(o,u,u.type,u.pendingProps,p);case 7:return ar(o,u,u.pendingProps,p),u.child;case 8:return ar(o,u,u.pendingProps.children,p),u.child;case 12:return ar(o,u,u.pendingProps.children,p),u.child;case 10:return _=u.pendingProps,fl(u,u.type,_.value),ar(o,u,_.children,p),u.child;case 9:return M=u.type._context,_=u.pendingProps.children,Ac(u),M=rr(M),_=_(M),u.flags|=1,ar(o,u,_,p),u.child;case 14:return XR(o,u,u.type,u.pendingProps,p);case 15:return qR(o,u,u.type,u.pendingProps,p);case 19:return iP(o,u,p);case 31:return UV(o,u,p);case 22:return YR(o,u,p,u.pendingProps);case 24:return Ac(u),_=rr(ci),o===null?(M=qb(),M===null&&(M=Pn,D=Wb(),M.pooledCache=D,D.refCount++,D!==null&&(M.pooledCacheLanes|=p),M=D),u.memoizedState={parent:_,cache:M},Kb(u),fl(u,ci,M)):((o.lanes&p)!==0&&(Zb(o,u),wh(u,null,null,p),Sh()),M=o.memoizedState,D=u.memoizedState,M.parent!==_?(M={parent:_,cache:_},u.memoizedState=M,u.lanes===0&&(u.memoizedState=u.updateQueue.baseState=M),fl(u,ci,_)):(_=D.cache,fl(u,ci,_),_!==M.cache&&$b(u,[ci],p,!0))),ar(o,u,u.pendingProps.children,p),u.child;case 29:throw u.pendingProps}throw Error(i(156,u.tag))}function oo(o){o.flags|=4}function N_(o,u,p,_,M){if((u=(o.mode&32)!==0)&&(u=!1),u){if(o.flags|=16777216,(M&335544128)===M)if(o.stateNode.complete)o.flags|=8192;else if(DP())o.flags|=8192;else throw Rc=pg,Yb}else o.flags&=-16777217}function aP(o,u){if(u.type!=="stylesheet"||(u.state.loading&4)!==0)o.flags&=-16777217;else if(o.flags|=16777216,!bD(u))if(DP())o.flags|=8192;else throw Rc=pg,Yb}function Dg(o,u){u!==null&&(o.flags|=4),o.flags&16384&&(u=o.tag!==22?mt():536870912,o.lanes|=u,od|=u)}function Rh(o,u){if(!rn)switch(o.tailMode){case"hidden":u=o.tail;for(var p=null;u!==null;)u.alternate!==null&&(p=u),u=u.sibling;p===null?o.tail=null:p.sibling=null;break;case"collapsed":p=o.tail;for(var _=null;p!==null;)p.alternate!==null&&(_=p),p=p.sibling;_===null?u||o.tail===null?o.tail=null:o.tail.sibling=null:_.sibling=null}}function kn(o){var u=o.alternate!==null&&o.alternate.child===o.child,p=0,_=0;if(u)for(var M=o.child;M!==null;)p|=M.lanes|M.childLanes,_|=M.subtreeFlags&65011712,_|=M.flags&65011712,M.return=o,M=M.sibling;else for(M=o.child;M!==null;)p|=M.lanes|M.childLanes,_|=M.subtreeFlags,_|=M.flags,M.return=o,M=M.sibling;return o.subtreeFlags|=_,o.childLanes=p,u}function FV(o,u,p){var _=u.pendingProps;switch(Bb(u),u.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return kn(u),null;case 1:return kn(u),null;case 3:return p=u.stateNode,_=null,o!==null&&(_=o.memoizedState.cache),u.memoizedState.cache!==_&&(u.flags|=2048),io(ci),he(),p.pendingContext&&(p.context=p.pendingContext,p.pendingContext=null),(o===null||o.child===null)&&(qu(u)?oo(u):o===null||o.memoizedState.isDehydrated&&(u.flags&256)===0||(u.flags|=1024,Hb())),kn(u),null;case 26:var M=u.type,D=u.memoizedState;return o===null?(oo(u),D!==null?(kn(u),aP(u,D)):(kn(u),N_(u,M,null,_,p))):D?D!==o.memoizedState?(oo(u),kn(u),aP(u,D)):(kn(u),u.flags&=-16777217):(o=o.memoizedProps,o!==_&&oo(u),kn(u),N_(u,M,o,_,p)),null;case 27:if(Be(u),p=me.current,M=u.type,o!==null&&u.stateNode!=null)o.memoizedProps!==_&&oo(u);else{if(!_){if(u.stateNode===null)throw Error(i(166));return kn(u),null}o=ce.current,qu(u)?F3(u):(o=fD(M,_,p),u.stateNode=o,oo(u))}return kn(u),null;case 5:if(Be(u),M=u.type,o!==null&&u.stateNode!=null)o.memoizedProps!==_&&oo(u);else{if(!_){if(u.stateNode===null)throw Error(i(166));return kn(u),null}if(D=ce.current,qu(u))F3(u);else{var j=Wg(me.current);switch(D){case 1:D=j.createElementNS("http://www.w3.org/2000/svg",M);break;case 2:D=j.createElementNS("http://www.w3.org/1998/Math/MathML",M);break;default:switch(M){case"svg":D=j.createElementNS("http://www.w3.org/2000/svg",M);break;case"math":D=j.createElementNS("http://www.w3.org/1998/Math/MathML",M);break;case"script":D=j.createElement("div"),D.innerHTML="<script><\/script>",D=D.removeChild(D.firstChild);break;case"select":D=typeof _.is=="string"?j.createElement("select",{is:_.is}):j.createElement("select"),_.multiple?D.multiple=!0:_.size&&(D.size=_.size);break;default:D=typeof _.is=="string"?j.createElement(M,{is:_.is}):j.createElement(M)}}D[Wn]=u,D[ei]=_;e:for(j=u.child;j!==null;){if(j.tag===5||j.tag===6)D.appendChild(j.stateNode);else if(j.tag!==4&&j.tag!==27&&j.child!==null){j.child.return=j,j=j.child;continue}if(j===u)break e;for(;j.sibling===null;){if(j.return===null||j.return===u)break e;j=j.return}j.sibling.return=j.return,j=j.sibling}u.stateNode=D;e:switch(sr(D,M,_),M){case"button":case"input":case"select":case"textarea":_=!!_.autoFocus;break e;case"img":_=!0;break e;default:_=!1}_&&oo(u)}}return kn(u),N_(u,u.type,o===null?null:o.memoizedProps,u.pendingProps,p),null;case 6:if(o&&u.stateNode!=null)o.memoizedProps!==_&&oo(u);else{if(typeof _!="string"&&u.stateNode===null)throw Error(i(166));if(o=me.current,qu(u)){if(o=u.stateNode,p=u.memoizedProps,_=null,M=ir,M!==null)switch(M.tag){case 27:case 5:_=M.memoizedProps}o[Wn]=u,o=!!(o.nodeValue===p||_!==null&&_.suppressHydrationWarning===!0||tD(o.nodeValue,p)),o||dl(u,!0)}else o=Wg(o).createTextNode(_),o[Wn]=u,u.stateNode=o}return kn(u),null;case 31:if(p=u.memoizedState,o===null||o.memoizedState!==null){if(_=qu(u),p!==null){if(o===null){if(!_)throw Error(i(318));if(o=u.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(i(557));o[Wn]=u}else Ec(),(u.flags&128)===0&&(u.memoizedState=null),u.flags|=4;kn(u),o=!1}else p=Hb(),o!==null&&o.memoizedState!==null&&(o.memoizedState.hydrationErrors=p),o=!0;if(!o)return u.flags&256?(sa(u),u):(sa(u),null);if((u.flags&128)!==0)throw Error(i(558))}return kn(u),null;case 13:if(_=u.memoizedState,o===null||o.memoizedState!==null&&o.memoizedState.dehydrated!==null){if(M=qu(u),_!==null&&_.dehydrated!==null){if(o===null){if(!M)throw Error(i(318));if(M=u.memoizedState,M=M!==null?M.dehydrated:null,!M)throw Error(i(317));M[Wn]=u}else Ec(),(u.flags&128)===0&&(u.memoizedState=null),u.flags|=4;kn(u),M=!1}else M=Hb(),o!==null&&o.memoizedState!==null&&(o.memoizedState.hydrationErrors=M),M=!0;if(!M)return u.flags&256?(sa(u),u):(sa(u),null)}return sa(u),(u.flags&128)!==0?(u.lanes=p,u):(p=_!==null,o=o!==null&&o.memoizedState!==null,p&&(_=u.child,M=null,_.alternate!==null&&_.alternate.memoizedState!==null&&_.alternate.memoizedState.cachePool!==null&&(M=_.alternate.memoizedState.cachePool.pool),D=null,_.memoizedState!==null&&_.memoizedState.cachePool!==null&&(D=_.memoizedState.cachePool.pool),D!==M&&(_.flags|=2048)),p!==o&&p&&(u.child.flags|=8192),Dg(u,u.updateQueue),kn(u),null);case 4:return he(),o===null&&eS(u.stateNode.containerInfo),kn(u),null;case 10:return io(u.type),kn(u),null;case 19:if(q(ni),_=u.memoizedState,_===null)return kn(u),null;if(M=(u.flags&128)!==0,D=_.rendering,D===null)if(M)Rh(_,!1);else{if(Qn!==0||o!==null&&(o.flags&128)!==0)for(o=u.child;o!==null;){if(D=xg(o),D!==null){for(u.flags|=128,Rh(_,!1),o=D.updateQueue,u.updateQueue=o,Dg(u,o),u.subtreeFlags=0,o=p,p=u.child;p!==null;)O3(p,o),p=p.sibling;return re(ni,ni.current&1|2),rn&&to(u,_.treeForkCount),u.child}o=o.sibling}_.tail!==null&&O()>Ug&&(u.flags|=128,M=!0,Rh(_,!1),u.lanes=4194304)}else{if(!M)if(o=xg(D),o!==null){if(u.flags|=128,M=!0,o=o.updateQueue,u.updateQueue=o,Dg(u,o),Rh(_,!0),_.tail===null&&_.tailMode==="hidden"&&!D.alternate&&!rn)return kn(u),null}else 2*O()-_.renderingStartTime>Ug&&p!==536870912&&(u.flags|=128,M=!0,Rh(_,!1),u.lanes=4194304);_.isBackwards?(D.sibling=u.child,u.child=D):(o=_.last,o!==null?o.sibling=D:u.child=D,_.last=D)}return _.tail!==null?(o=_.tail,_.rendering=o,_.tail=o.sibling,_.renderingStartTime=O(),o.sibling=null,p=ni.current,re(ni,M?p&1|2:p&1),rn&&to(u,_.treeForkCount),o):(kn(u),null);case 22:case 23:return sa(u),t_(),_=u.memoizedState!==null,o!==null?o.memoizedState!==null!==_&&(u.flags|=8192):_&&(u.flags|=8192),_?(p&536870912)!==0&&(u.flags&128)===0&&(kn(u),u.subtreeFlags&6&&(u.flags|=8192)):kn(u),p=u.updateQueue,p!==null&&Dg(u,p.retryQueue),p=null,o!==null&&o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(p=o.memoizedState.cachePool.pool),_=null,u.memoizedState!==null&&u.memoizedState.cachePool!==null&&(_=u.memoizedState.cachePool.pool),_!==p&&(u.flags|=2048),o!==null&&q(Tc),null;case 24:return p=null,o!==null&&(p=o.memoizedState.cache),u.memoizedState.cache!==p&&(u.flags|=2048),io(ci),kn(u),null;case 25:return null;case 30:return null}throw Error(i(156,u.tag))}function zV(o,u){switch(Bb(u),u.tag){case 1:return o=u.flags,o&65536?(u.flags=o&-65537|128,u):null;case 3:return io(ci),he(),o=u.flags,(o&65536)!==0&&(o&128)===0?(u.flags=o&-65537|128,u):null;case 26:case 27:case 5:return Be(u),null;case 31:if(u.memoizedState!==null){if(sa(u),u.alternate===null)throw Error(i(340));Ec()}return o=u.flags,o&65536?(u.flags=o&-65537|128,u):null;case 13:if(sa(u),o=u.memoizedState,o!==null&&o.dehydrated!==null){if(u.alternate===null)throw Error(i(340));Ec()}return o=u.flags,o&65536?(u.flags=o&-65537|128,u):null;case 19:return q(ni),null;case 4:return he(),null;case 10:return io(u.type),null;case 22:case 23:return sa(u),t_(),o!==null&&q(Tc),o=u.flags,o&65536?(u.flags=o&-65537|128,u):null;case 24:return io(ci),null;case 25:return null;default:return null}}function sP(o,u){switch(Bb(u),u.tag){case 3:io(ci),he();break;case 26:case 27:case 5:Be(u);break;case 4:he();break;case 31:u.memoizedState!==null&&sa(u);break;case 13:sa(u);break;case 19:q(ni);break;case 10:io(u.type);break;case 22:case 23:sa(u),t_(),o!==null&&q(Tc);break;case 24:io(ci)}}function Ph(o,u){try{var p=u.updateQueue,_=p!==null?p.lastEffect:null;if(_!==null){var M=_.next;p=M;do{if((p.tag&o)===o){_=void 0;var D=p.create,j=p.inst;_=D(),j.destroy=_}p=p.next}while(p!==M)}}catch(te){xn(u,u.return,te)}}function xl(o,u,p){try{var _=u.updateQueue,M=_!==null?_.lastEffect:null;if(M!==null){var D=M.next;_=D;do{if((_.tag&o)===o){var j=_.inst,te=j.destroy;if(te!==void 0){j.destroy=void 0,M=u;var Se=p,ze=te;try{ze()}catch(Qe){xn(M,Se,Qe)}}}_=_.next}while(_!==D)}}catch(Qe){xn(u,u.return,Qe)}}function oP(o){var u=o.updateQueue;if(u!==null){var p=o.stateNode;try{Z3(u,p)}catch(_){xn(o,o.return,_)}}}function lP(o,u,p){p.props=Nc(o.type,o.memoizedProps),p.state=o.memoizedState;try{p.componentWillUnmount()}catch(_){xn(o,u,_)}}function Dh(o,u){try{var p=o.ref;if(p!==null){switch(o.tag){case 26:case 27:case 5:var _=o.stateNode;break;case 30:_=o.stateNode;break;default:_=o.stateNode}typeof p=="function"?o.refCleanup=p(_):p.current=_}}catch(M){xn(o,u,M)}}function Ts(o,u){var p=o.ref,_=o.refCleanup;if(p!==null)if(typeof _=="function")try{_()}catch(M){xn(o,u,M)}finally{o.refCleanup=null,o=o.alternate,o!=null&&(o.refCleanup=null)}else if(typeof p=="function")try{p(null)}catch(M){xn(o,u,M)}else p.current=null}function cP(o){var u=o.type,p=o.memoizedProps,_=o.stateNode;try{e:switch(u){case"button":case"input":case"select":case"textarea":p.autoFocus&&_.focus();break e;case"img":p.src?_.src=p.src:p.srcSet&&(_.srcset=p.srcSet)}}catch(M){xn(o,o.return,M)}}function O_(o,u,p){try{var _=o.stateNode;o9(_,o.type,p,u),_[ei]=u}catch(M){xn(o,o.return,M)}}function uP(o){return o.tag===5||o.tag===3||o.tag===26||o.tag===27&&Ml(o.type)||o.tag===4}function L_(o){e:for(;;){for(;o.sibling===null;){if(o.return===null||uP(o.return))return null;o=o.return}for(o.sibling.return=o.return,o=o.sibling;o.tag!==5&&o.tag!==6&&o.tag!==18;){if(o.tag===27&&Ml(o.type)||o.flags&2||o.child===null||o.tag===4)continue e;o.child.return=o,o=o.child}if(!(o.flags&2))return o.stateNode}}function I_(o,u,p){var _=o.tag;if(_===5||_===6)o=o.stateNode,u?(p.nodeType===9?p.body:p.nodeName==="HTML"?p.ownerDocument.body:p).insertBefore(o,u):(u=p.nodeType===9?p.body:p.nodeName==="HTML"?p.ownerDocument.body:p,u.appendChild(o),p=p._reactRootContainer,p!=null||u.onclick!==null||(u.onclick=Qs));else if(_!==4&&(_===27&&Ml(o.type)&&(p=o.stateNode,u=null),o=o.child,o!==null))for(I_(o,u,p),o=o.sibling;o!==null;)I_(o,u,p),o=o.sibling}function Ng(o,u,p){var _=o.tag;if(_===5||_===6)o=o.stateNode,u?p.insertBefore(o,u):p.appendChild(o);else if(_!==4&&(_===27&&Ml(o.type)&&(p=o.stateNode),o=o.child,o!==null))for(Ng(o,u,p),o=o.sibling;o!==null;)Ng(o,u,p),o=o.sibling}function dP(o){var u=o.stateNode,p=o.memoizedProps;try{for(var _=o.type,M=u.attributes;M.length;)u.removeAttributeNode(M[0]);sr(u,_,p),u[Wn]=o,u[ei]=p}catch(D){xn(o,o.return,D)}}var lo=!1,fi=!1,U_=!1,fP=typeof WeakSet=="function"?WeakSet:Set,Gi=null;function BV(o,u){if(o=o.containerInfo,iS=Jg,o=E3(o),Rb(o)){if("selectionStart"in o)var p={start:o.selectionStart,end:o.selectionEnd};else e:{p=(p=o.ownerDocument)&&p.defaultView||window;var _=p.getSelection&&p.getSelection();if(_&&_.rangeCount!==0){p=_.anchorNode;var M=_.anchorOffset,D=_.focusNode;_=_.focusOffset;try{p.nodeType,D.nodeType}catch{p=null;break e}var j=0,te=-1,Se=-1,ze=0,Qe=0,it=o,Ge=null;t:for(;;){for(var Ye;it!==p||M!==0&&it.nodeType!==3||(te=j+M),it!==D||_!==0&&it.nodeType!==3||(Se=j+_),it.nodeType===3&&(j+=it.nodeValue.length),(Ye=it.firstChild)!==null;)Ge=it,it=Ye;for(;;){if(it===o)break t;if(Ge===p&&++ze===M&&(te=j),Ge===D&&++Qe===_&&(Se=j),(Ye=it.nextSibling)!==null)break;it=Ge,Ge=it.parentNode}it=Ye}p=te===-1||Se===-1?null:{start:te,end:Se}}else p=null}p=p||{start:0,end:0}}else p=null;for(rS={focusedElem:o,selectionRange:p},Jg=!1,Gi=u;Gi!==null;)if(u=Gi,o=u.child,(u.subtreeFlags&1028)!==0&&o!==null)o.return=u,Gi=o;else for(;Gi!==null;){switch(u=Gi,D=u.alternate,o=u.flags,u.tag){case 0:if((o&4)!==0&&(o=u.updateQueue,o=o!==null?o.events:null,o!==null))for(p=0;p<o.length;p++)M=o[p],M.ref.impl=M.nextImpl;break;case 11:case 15:break;case 1:if((o&1024)!==0&&D!==null){o=void 0,p=u,M=D.memoizedProps,D=D.memoizedState,_=p.stateNode;try{var St=Nc(p.type,M);o=_.getSnapshotBeforeUpdate(St,D),_.__reactInternalSnapshotBeforeUpdate=o}catch(Ot){xn(p,p.return,Ot)}}break;case 3:if((o&1024)!==0){if(o=u.stateNode.containerInfo,p=o.nodeType,p===9)oS(o);else if(p===1)switch(o.nodeName){case"HEAD":case"HTML":case"BODY":oS(o);break;default:o.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((o&1024)!==0)throw Error(i(163))}if(o=u.sibling,o!==null){o.return=u.return,Gi=o;break}Gi=u.return}}function hP(o,u,p){var _=p.flags;switch(p.tag){case 0:case 11:case 15:uo(o,p),_&4&&Ph(5,p);break;case 1:if(uo(o,p),_&4)if(o=p.stateNode,u===null)try{o.componentDidMount()}catch(j){xn(p,p.return,j)}else{var M=Nc(p.type,u.memoizedProps);u=u.memoizedState;try{o.componentDidUpdate(M,u,o.__reactInternalSnapshotBeforeUpdate)}catch(j){xn(p,p.return,j)}}_&64&&oP(p),_&512&&Dh(p,p.return);break;case 3:if(uo(o,p),_&64&&(o=p.updateQueue,o!==null)){if(u=null,p.child!==null)switch(p.child.tag){case 27:case 5:u=p.child.stateNode;break;case 1:u=p.child.stateNode}try{Z3(o,u)}catch(j){xn(p,p.return,j)}}break;case 27:u===null&&_&4&&dP(p);case 26:case 5:uo(o,p),u===null&&_&4&&cP(p),_&512&&Dh(p,p.return);break;case 12:uo(o,p);break;case 31:uo(o,p),_&4&&gP(o,p);break;case 13:uo(o,p),_&4&&vP(o,p),_&64&&(o=p.memoizedState,o!==null&&(o=o.dehydrated,o!==null&&(p=YV.bind(null,p),m9(o,p))));break;case 22:if(_=p.memoizedState!==null||lo,!_){u=u!==null&&u.memoizedState!==null||fi,M=lo;var D=fi;lo=_,(fi=u)&&!D?fo(o,p,(p.subtreeFlags&8772)!==0):uo(o,p),lo=M,fi=D}break;case 30:break;default:uo(o,p)}}function pP(o){var u=o.alternate;u!==null&&(o.alternate=null,pP(u)),o.child=null,o.deletions=null,o.sibling=null,o.tag===5&&(u=o.stateNode,u!==null&&We(u)),o.stateNode=null,o.return=null,o.dependencies=null,o.memoizedProps=null,o.memoizedState=null,o.pendingProps=null,o.stateNode=null,o.updateQueue=null}var Hn=null,Br=!1;function co(o,u,p){for(p=p.child;p!==null;)mP(o,u,p),p=p.sibling}function mP(o,u,p){if(De&&typeof De.onCommitFiberUnmount=="function")try{De.onCommitFiberUnmount(ke,p)}catch{}switch(p.tag){case 26:fi||Ts(p,u),co(o,u,p),p.memoizedState?p.memoizedState.count--:p.stateNode&&(p=p.stateNode,p.parentNode.removeChild(p));break;case 27:fi||Ts(p,u);var _=Hn,M=Br;Ml(p.type)&&(Hn=p.stateNode,Br=!1),co(o,u,p),Bh(p.stateNode),Hn=_,Br=M;break;case 5:fi||Ts(p,u);case 6:if(_=Hn,M=Br,Hn=null,co(o,u,p),Hn=_,Br=M,Hn!==null)if(Br)try{(Hn.nodeType===9?Hn.body:Hn.nodeName==="HTML"?Hn.ownerDocument.body:Hn).removeChild(p.stateNode)}catch(D){xn(p,u,D)}else try{Hn.removeChild(p.stateNode)}catch(D){xn(p,u,D)}break;case 18:Hn!==null&&(Br?(o=Hn,oD(o.nodeType===9?o.body:o.nodeName==="HTML"?o.ownerDocument.body:o,p.stateNode),md(o)):oD(Hn,p.stateNode));break;case 4:_=Hn,M=Br,Hn=p.stateNode.containerInfo,Br=!0,co(o,u,p),Hn=_,Br=M;break;case 0:case 11:case 14:case 15:xl(2,p,u),fi||xl(4,p,u),co(o,u,p);break;case 1:fi||(Ts(p,u),_=p.stateNode,typeof _.componentWillUnmount=="function"&&lP(p,u,_)),co(o,u,p);break;case 21:co(o,u,p);break;case 22:fi=(_=fi)||p.memoizedState!==null,co(o,u,p),fi=_;break;default:co(o,u,p)}}function gP(o,u){if(u.memoizedState===null&&(o=u.alternate,o!==null&&(o=o.memoizedState,o!==null))){o=o.dehydrated;try{md(o)}catch(p){xn(u,u.return,p)}}}function vP(o,u){if(u.memoizedState===null&&(o=u.alternate,o!==null&&(o=o.memoizedState,o!==null&&(o=o.dehydrated,o!==null))))try{md(o)}catch(p){xn(u,u.return,p)}}function jV(o){switch(o.tag){case 31:case 13:case 19:var u=o.stateNode;return u===null&&(u=o.stateNode=new fP),u;case 22:return o=o.stateNode,u=o._retryCache,u===null&&(u=o._retryCache=new fP),u;default:throw Error(i(435,o.tag))}}function Og(o,u){var p=jV(o);u.forEach(function(_){if(!p.has(_)){p.add(_);var M=KV.bind(null,o,_);_.then(M,M)}})}function jr(o,u){var p=u.deletions;if(p!==null)for(var _=0;_<p.length;_++){var M=p[_],D=o,j=u,te=j;e:for(;te!==null;){switch(te.tag){case 27:if(Ml(te.type)){Hn=te.stateNode,Br=!1;break e}break;case 5:Hn=te.stateNode,Br=!1;break e;case 3:case 4:Hn=te.stateNode.containerInfo,Br=!0;break e}te=te.return}if(Hn===null)throw Error(i(160));mP(D,j,M),Hn=null,Br=!1,D=M.alternate,D!==null&&(D.return=null),M.return=null}if(u.subtreeFlags&13886)for(u=u.child;u!==null;)xP(u,o),u=u.sibling}var ns=null;function xP(o,u){var p=o.alternate,_=o.flags;switch(o.tag){case 0:case 11:case 14:case 15:jr(u,o),Hr(o),_&4&&(xl(3,o,o.return),Ph(3,o),xl(5,o,o.return));break;case 1:jr(u,o),Hr(o),_&512&&(fi||p===null||Ts(p,p.return)),_&64&&lo&&(o=o.updateQueue,o!==null&&(_=o.callbacks,_!==null&&(p=o.shared.hiddenCallbacks,o.shared.hiddenCallbacks=p===null?_:p.concat(_))));break;case 26:var M=ns;if(jr(u,o),Hr(o),_&512&&(fi||p===null||Ts(p,p.return)),_&4){var D=p!==null?p.memoizedState:null;if(_=o.memoizedState,p===null)if(_===null)if(o.stateNode===null){e:{_=o.type,p=o.memoizedProps,M=M.ownerDocument||M;t:switch(_){case"title":D=M.getElementsByTagName("title")[0],(!D||D[qe]||D[Wn]||D.namespaceURI==="http://www.w3.org/2000/svg"||D.hasAttribute("itemprop"))&&(D=M.createElement(_),M.head.insertBefore(D,M.querySelector("head > title"))),sr(D,_,p),D[Wn]=o,Re(D),_=D;break e;case"link":var j=xD("link","href",M).get(_+(p.href||""));if(j){for(var te=0;te<j.length;te++)if(D=j[te],D.getAttribute("href")===(p.href==null||p.href===""?null:p.href)&&D.getAttribute("rel")===(p.rel==null?null:p.rel)&&D.getAttribute("title")===(p.title==null?null:p.title)&&D.getAttribute("crossorigin")===(p.crossOrigin==null?null:p.crossOrigin)){j.splice(te,1);break t}}D=M.createElement(_),sr(D,_,p),M.head.appendChild(D);break;case"meta":if(j=xD("meta","content",M).get(_+(p.content||""))){for(te=0;te<j.length;te++)if(D=j[te],D.getAttribute("content")===(p.content==null?null:""+p.content)&&D.getAttribute("name")===(p.name==null?null:p.name)&&D.getAttribute("property")===(p.property==null?null:p.property)&&D.getAttribute("http-equiv")===(p.httpEquiv==null?null:p.httpEquiv)&&D.getAttribute("charset")===(p.charSet==null?null:p.charSet)){j.splice(te,1);break t}}D=M.createElement(_),sr(D,_,p),M.head.appendChild(D);break;default:throw Error(i(468,_))}D[Wn]=o,Re(D),_=D}o.stateNode=_}else yD(M,o.type,o.stateNode);else o.stateNode=vD(M,_,o.memoizedProps);else D!==_?(D===null?p.stateNode!==null&&(p=p.stateNode,p.parentNode.removeChild(p)):D.count--,_===null?yD(M,o.type,o.stateNode):vD(M,_,o.memoizedProps)):_===null&&o.stateNode!==null&&O_(o,o.memoizedProps,p.memoizedProps)}break;case 27:jr(u,o),Hr(o),_&512&&(fi||p===null||Ts(p,p.return)),p!==null&&_&4&&O_(o,o.memoizedProps,p.memoizedProps);break;case 5:if(jr(u,o),Hr(o),_&512&&(fi||p===null||Ts(p,p.return)),o.flags&32){M=o.stateNode;try{Es(M,"")}catch(St){xn(o,o.return,St)}}_&4&&o.stateNode!=null&&(M=o.memoizedProps,O_(o,M,p!==null?p.memoizedProps:M)),_&1024&&(U_=!0);break;case 6:if(jr(u,o),Hr(o),_&4){if(o.stateNode===null)throw Error(i(162));_=o.memoizedProps,p=o.stateNode;try{p.nodeValue=_}catch(St){xn(o,o.return,St)}}break;case 3:if(Yg=null,M=ns,ns=Xg(u.containerInfo),jr(u,o),ns=M,Hr(o),_&4&&p!==null&&p.memoizedState.isDehydrated)try{md(u.containerInfo)}catch(St){xn(o,o.return,St)}U_&&(U_=!1,yP(o));break;case 4:_=ns,ns=Xg(o.stateNode.containerInfo),jr(u,o),Hr(o),ns=_;break;case 12:jr(u,o),Hr(o);break;case 31:jr(u,o),Hr(o),_&4&&(_=o.updateQueue,_!==null&&(o.updateQueue=null,Og(o,_)));break;case 13:jr(u,o),Hr(o),o.child.flags&8192&&o.memoizedState!==null!=(p!==null&&p.memoizedState!==null)&&(Ig=O()),_&4&&(_=o.updateQueue,_!==null&&(o.updateQueue=null,Og(o,_)));break;case 22:M=o.memoizedState!==null;var Se=p!==null&&p.memoizedState!==null,ze=lo,Qe=fi;if(lo=ze||M,fi=Qe||Se,jr(u,o),fi=Qe,lo=ze,Hr(o),_&8192)e:for(u=o.stateNode,u._visibility=M?u._visibility&-2:u._visibility|1,M&&(p===null||Se||lo||fi||Oc(o)),p=null,u=o;;){if(u.tag===5||u.tag===26){if(p===null){Se=p=u;try{if(D=Se.stateNode,M)j=D.style,typeof j.setProperty=="function"?j.setProperty("display","none","important"):j.display="none";else{te=Se.stateNode;var it=Se.memoizedProps.style,Ge=it!=null&&it.hasOwnProperty("display")?it.display:null;te.style.display=Ge==null||typeof Ge=="boolean"?"":(""+Ge).trim()}}catch(St){xn(Se,Se.return,St)}}}else if(u.tag===6){if(p===null){Se=u;try{Se.stateNode.nodeValue=M?"":Se.memoizedProps}catch(St){xn(Se,Se.return,St)}}}else if(u.tag===18){if(p===null){Se=u;try{var Ye=Se.stateNode;M?lD(Ye,!0):lD(Se.stateNode,!1)}catch(St){xn(Se,Se.return,St)}}}else if((u.tag!==22&&u.tag!==23||u.memoizedState===null||u===o)&&u.child!==null){u.child.return=u,u=u.child;continue}if(u===o)break e;for(;u.sibling===null;){if(u.return===null||u.return===o)break e;p===u&&(p=null),u=u.return}p===u&&(p=null),u.sibling.return=u.return,u=u.sibling}_&4&&(_=o.updateQueue,_!==null&&(p=_.retryQueue,p!==null&&(_.retryQueue=null,Og(o,p))));break;case 19:jr(u,o),Hr(o),_&4&&(_=o.updateQueue,_!==null&&(o.updateQueue=null,Og(o,_)));break;case 30:break;case 21:break;default:jr(u,o),Hr(o)}}function Hr(o){var u=o.flags;if(u&2){try{for(var p,_=o.return;_!==null;){if(uP(_)){p=_;break}_=_.return}if(p==null)throw Error(i(160));switch(p.tag){case 27:var M=p.stateNode,D=L_(o);Ng(o,D,M);break;case 5:var j=p.stateNode;p.flags&32&&(Es(j,""),p.flags&=-33);var te=L_(o);Ng(o,te,j);break;case 3:case 4:var Se=p.stateNode.containerInfo,ze=L_(o);I_(o,ze,Se);break;default:throw Error(i(161))}}catch(Qe){xn(o,o.return,Qe)}o.flags&=-3}u&4096&&(o.flags&=-4097)}function yP(o){if(o.subtreeFlags&1024)for(o=o.child;o!==null;){var u=o;yP(u),u.tag===5&&u.flags&1024&&u.stateNode.reset(),o=o.sibling}}function uo(o,u){if(u.subtreeFlags&8772)for(u=u.child;u!==null;)hP(o,u.alternate,u),u=u.sibling}function Oc(o){for(o=o.child;o!==null;){var u=o;switch(u.tag){case 0:case 11:case 14:case 15:xl(4,u,u.return),Oc(u);break;case 1:Ts(u,u.return);var p=u.stateNode;typeof p.componentWillUnmount=="function"&&lP(u,u.return,p),Oc(u);break;case 27:Bh(u.stateNode);case 26:case 5:Ts(u,u.return),Oc(u);break;case 22:u.memoizedState===null&&Oc(u);break;case 30:Oc(u);break;default:Oc(u)}o=o.sibling}}function fo(o,u,p){for(p=p&&(u.subtreeFlags&8772)!==0,u=u.child;u!==null;){var _=u.alternate,M=o,D=u,j=D.flags;switch(D.tag){case 0:case 11:case 15:fo(M,D,p),Ph(4,D);break;case 1:if(fo(M,D,p),_=D,M=_.stateNode,typeof M.componentDidMount=="function")try{M.componentDidMount()}catch(ze){xn(_,_.return,ze)}if(_=D,M=_.updateQueue,M!==null){var te=_.stateNode;try{var Se=M.shared.hiddenCallbacks;if(Se!==null)for(M.shared.hiddenCallbacks=null,M=0;M<Se.length;M++)K3(Se[M],te)}catch(ze){xn(_,_.return,ze)}}p&&j&64&&oP(D),Dh(D,D.return);break;case 27:dP(D);case 26:case 5:fo(M,D,p),p&&_===null&&j&4&&cP(D),Dh(D,D.return);break;case 12:fo(M,D,p);break;case 31:fo(M,D,p),p&&j&4&&gP(M,D);break;case 13:fo(M,D,p),p&&j&4&&vP(M,D);break;case 22:D.memoizedState===null&&fo(M,D,p),Dh(D,D.return);break;case 30:break;default:fo(M,D,p)}u=u.sibling}}function k_(o,u){var p=null;o!==null&&o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(p=o.memoizedState.cachePool.pool),o=null,u.memoizedState!==null&&u.memoizedState.cachePool!==null&&(o=u.memoizedState.cachePool.pool),o!==p&&(o!=null&&o.refCount++,p!=null&&vh(p))}function F_(o,u){o=null,u.alternate!==null&&(o=u.alternate.memoizedState.cache),u=u.memoizedState.cache,u!==o&&(u.refCount++,o!=null&&vh(o))}function is(o,u,p,_){if(u.subtreeFlags&10256)for(u=u.child;u!==null;)bP(o,u,p,_),u=u.sibling}function bP(o,u,p,_){var M=u.flags;switch(u.tag){case 0:case 11:case 15:is(o,u,p,_),M&2048&&Ph(9,u);break;case 1:is(o,u,p,_);break;case 3:is(o,u,p,_),M&2048&&(o=null,u.alternate!==null&&(o=u.alternate.memoizedState.cache),u=u.memoizedState.cache,u!==o&&(u.refCount++,o!=null&&vh(o)));break;case 12:if(M&2048){is(o,u,p,_),o=u.stateNode;try{var D=u.memoizedProps,j=D.id,te=D.onPostCommit;typeof te=="function"&&te(j,u.alternate===null?"mount":"update",o.passiveEffectDuration,-0)}catch(Se){xn(u,u.return,Se)}}else is(o,u,p,_);break;case 31:is(o,u,p,_);break;case 13:is(o,u,p,_);break;case 23:break;case 22:D=u.stateNode,j=u.alternate,u.memoizedState!==null?D._visibility&2?is(o,u,p,_):Nh(o,u):D._visibility&2?is(o,u,p,_):(D._visibility|=2,rd(o,u,p,_,(u.subtreeFlags&10256)!==0||!1)),M&2048&&k_(j,u);break;case 24:is(o,u,p,_),M&2048&&F_(u.alternate,u);break;default:is(o,u,p,_)}}function rd(o,u,p,_,M){for(M=M&&((u.subtreeFlags&10256)!==0||!1),u=u.child;u!==null;){var D=o,j=u,te=p,Se=_,ze=j.flags;switch(j.tag){case 0:case 11:case 15:rd(D,j,te,Se,M),Ph(8,j);break;case 23:break;case 22:var Qe=j.stateNode;j.memoizedState!==null?Qe._visibility&2?rd(D,j,te,Se,M):Nh(D,j):(Qe._visibility|=2,rd(D,j,te,Se,M)),M&&ze&2048&&k_(j.alternate,j);break;case 24:rd(D,j,te,Se,M),M&&ze&2048&&F_(j.alternate,j);break;default:rd(D,j,te,Se,M)}u=u.sibling}}function Nh(o,u){if(u.subtreeFlags&10256)for(u=u.child;u!==null;){var p=o,_=u,M=_.flags;switch(_.tag){case 22:Nh(p,_),M&2048&&k_(_.alternate,_);break;case 24:Nh(p,_),M&2048&&F_(_.alternate,_);break;default:Nh(p,_)}u=u.sibling}}var Oh=8192;function ad(o,u,p){if(o.subtreeFlags&Oh)for(o=o.child;o!==null;)_P(o,u,p),o=o.sibling}function _P(o,u,p){switch(o.tag){case 26:ad(o,u,p),o.flags&Oh&&o.memoizedState!==null&&T9(p,ns,o.memoizedState,o.memoizedProps);break;case 5:ad(o,u,p);break;case 3:case 4:var _=ns;ns=Xg(o.stateNode.containerInfo),ad(o,u,p),ns=_;break;case 22:o.memoizedState===null&&(_=o.alternate,_!==null&&_.memoizedState!==null?(_=Oh,Oh=16777216,ad(o,u,p),Oh=_):ad(o,u,p));break;default:ad(o,u,p)}}function SP(o){var u=o.alternate;if(u!==null&&(o=u.child,o!==null)){u.child=null;do u=o.sibling,o.sibling=null,o=u;while(o!==null)}}function Lh(o){var u=o.deletions;if((o.flags&16)!==0){if(u!==null)for(var p=0;p<u.length;p++){var _=u[p];Gi=_,EP(_,o)}SP(o)}if(o.subtreeFlags&10256)for(o=o.child;o!==null;)wP(o),o=o.sibling}function wP(o){switch(o.tag){case 0:case 11:case 15:Lh(o),o.flags&2048&&xl(9,o,o.return);break;case 3:Lh(o);break;case 12:Lh(o);break;case 22:var u=o.stateNode;o.memoizedState!==null&&u._visibility&2&&(o.return===null||o.return.tag!==13)?(u._visibility&=-3,Lg(o)):Lh(o);break;default:Lh(o)}}function Lg(o){var u=o.deletions;if((o.flags&16)!==0){if(u!==null)for(var p=0;p<u.length;p++){var _=u[p];Gi=_,EP(_,o)}SP(o)}for(o=o.child;o!==null;){switch(u=o,u.tag){case 0:case 11:case 15:xl(8,u,u.return),Lg(u);break;case 22:p=u.stateNode,p._visibility&2&&(p._visibility&=-3,Lg(u));break;default:Lg(u)}o=o.sibling}}function EP(o,u){for(;Gi!==null;){var p=Gi;switch(p.tag){case 0:case 11:case 15:xl(8,p,u);break;case 23:case 22:if(p.memoizedState!==null&&p.memoizedState.cachePool!==null){var _=p.memoizedState.cachePool.pool;_!=null&&_.refCount++}break;case 24:vh(p.memoizedState.cache)}if(_=p.child,_!==null)_.return=p,Gi=_;else e:for(p=o;Gi!==null;){_=Gi;var M=_.sibling,D=_.return;if(pP(_),_===p){Gi=null;break e}if(M!==null){M.return=D,Gi=M;break e}Gi=D}}}var HV={getCacheForType:function(o){var u=rr(ci),p=u.data.get(o);return p===void 0&&(p=o(),u.data.set(o,p)),p},cacheSignal:function(){return rr(ci).controller.signal}},GV=typeof WeakMap=="function"?WeakMap:Map,hn=0,Pn=null,Kt=null,en=0,vn=0,oa=null,yl=!1,sd=!1,z_=!1,ho=0,Qn=0,bl=0,Lc=0,B_=0,la=0,od=0,Ih=null,Gr=null,j_=!1,Ig=0,MP=0,Ug=1/0,kg=null,_l=null,Mi=0,Sl=null,ld=null,po=0,H_=0,G_=null,AP=null,Uh=0,V_=null;function ca(){return(hn&2)!==0&&en!==0?en&-en:X.T!==null?K_():tr()}function TP(){if(la===0)if((en&536870912)===0||rn){var o=de;de<<=1,(de&3932160)===0&&(de=262144),la=o}else la=536870912;return o=aa.current,o!==null&&(o.flags|=32),la}function Vr(o,u,p){(o===Pn&&(vn===2||vn===9)||o.cancelPendingCommit!==null)&&(cd(o,0),wl(o,en,la,!1)),Wt(o,p),((hn&2)===0||o!==Pn)&&(o===Pn&&((hn&2)===0&&(Lc|=p),Qn===4&&wl(o,en,la,!1)),Cs(o))}function CP(o,u,p){if((hn&6)!==0)throw Error(i(327));var _=!p&&(u&127)===0&&(u&o.expiredLanes)===0||je(o,u),M=_?WV(o,u):W_(o,u,!0),D=_;do{if(M===0){sd&&!_&&wl(o,u,0,!1);break}else{if(p=o.current.alternate,D&&!VV(p)){M=W_(o,u,!1),D=!1;continue}if(M===2){if(D=u,o.errorRecoveryDisabledLanes&D)var j=0;else j=o.pendingLanes&-536870913,j=j!==0?j:j&536870912?536870912:0;if(j!==0){u=j;e:{var te=o;M=Ih;var Se=te.current.memoizedState.isDehydrated;if(Se&&(cd(te,j).flags|=256),j=W_(te,j,!1),j!==2){if(z_&&!Se){te.errorRecoveryDisabledLanes|=D,Lc|=D,M=4;break e}D=Gr,Gr=M,D!==null&&(Gr===null?Gr=D:Gr.push.apply(Gr,D))}M=j}if(D=!1,M!==2)continue}}if(M===1){cd(o,0),wl(o,u,0,!0);break}e:{switch(_=o,D=M,D){case 0:case 1:throw Error(i(345));case 4:if((u&4194048)!==u)break;case 6:wl(_,u,la,!yl);break e;case 2:Gr=null;break;case 3:case 5:break;default:throw Error(i(329))}if((u&62914560)===u&&(M=Ig+300-O(),10<M)){if(wl(_,u,la,!yl),ge(_,0,!0)!==0)break e;po=u,_.timeoutHandle=aD(RP.bind(null,_,p,Gr,kg,j_,u,la,Lc,od,yl,D,"Throttled",-0,0),M);break e}RP(_,p,Gr,kg,j_,u,la,Lc,od,yl,D,null,-0,0)}}break}while(!0);Cs(o)}function RP(o,u,p,_,M,D,j,te,Se,ze,Qe,it,Ge,Ye){if(o.timeoutHandle=-1,it=u.subtreeFlags,it&8192||(it&16785408)===16785408){it={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Qs},_P(u,D,it);var St=(D&62914560)===D?Ig-O():(D&4194048)===D?MP-O():0;if(St=C9(it,St),St!==null){po=D,o.cancelPendingCommit=St(kP.bind(null,o,u,D,p,_,M,j,te,Se,Qe,it,null,Ge,Ye)),wl(o,D,j,!ze);return}}kP(o,u,D,p,_,M,j,te,Se)}function VV(o){for(var u=o;;){var p=u.tag;if((p===0||p===11||p===15)&&u.flags&16384&&(p=u.updateQueue,p!==null&&(p=p.stores,p!==null)))for(var _=0;_<p.length;_++){var M=p[_],D=M.getSnapshot;M=M.value;try{if(!ia(D(),M))return!1}catch{return!1}}if(p=u.child,u.subtreeFlags&16384&&p!==null)p.return=u,u=p;else{if(u===o)break;for(;u.sibling===null;){if(u.return===null||u.return===o)return!0;u=u.return}u.sibling.return=u.return,u=u.sibling}}return!0}function wl(o,u,p,_){u&=~B_,u&=~Lc,o.suspendedLanes|=u,o.pingedLanes&=~u,_&&(o.warmLanes|=u),_=o.expirationTimes;for(var M=u;0<M;){var D=31-et(M),j=1<<D;_[D]=-1,M&=~j}p!==0&&mn(o,p,u)}function Fg(){return(hn&6)===0?(kh(0),!1):!0}function $_(){if(Kt!==null){if(vn===0)var o=Kt.return;else o=Kt,no=Mc=null,o_(o),Ju=null,yh=0,o=Kt;for(;o!==null;)sP(o.alternate,o),o=o.return;Kt=null}}function cd(o,u){var p=o.timeoutHandle;p!==-1&&(o.timeoutHandle=-1,u9(p)),p=o.cancelPendingCommit,p!==null&&(o.cancelPendingCommit=null,p()),po=0,$_(),Pn=o,Kt=p=eo(o.current,null),en=u,vn=0,oa=null,yl=!1,sd=je(o,u),z_=!1,od=la=B_=Lc=bl=Qn=0,Gr=Ih=null,j_=!1,(u&8)!==0&&(u|=u&32);var _=o.entangledLanes;if(_!==0)for(o=o.entanglements,_&=u;0<_;){var M=31-et(_),D=1<<M;u|=o[M],_&=~D}return ho=u,ag(),p}function PP(o,u){Bt=null,X.H=Th,u===Qu||u===hg?(u=W3(),vn=3):u===Yb?(u=W3(),vn=4):vn=u===w_?8:u!==null&&typeof u=="object"&&typeof u.then=="function"?6:1,oa=u,Kt===null&&(Qn=1,Tg(o,Ma(u,o.current)))}function DP(){var o=aa.current;return o===null?!0:(en&4194048)===en?Ra===null:(en&62914560)===en||(en&536870912)!==0?o===Ra:!1}function NP(){var o=X.H;return X.H=Th,o===null?Th:o}function OP(){var o=X.A;return X.A=HV,o}function zg(){Qn=4,yl||(en&4194048)!==en&&aa.current!==null||(sd=!0),(bl&134217727)===0&&(Lc&134217727)===0||Pn===null||wl(Pn,en,la,!1)}function W_(o,u,p){var _=hn;hn|=2;var M=NP(),D=OP();(Pn!==o||en!==u)&&(kg=null,cd(o,u)),u=!1;var j=Qn;e:do try{if(vn!==0&&Kt!==null){var te=Kt,Se=oa;switch(vn){case 8:$_(),j=6;break e;case 3:case 2:case 9:case 6:aa.current===null&&(u=!0);var ze=vn;if(vn=0,oa=null,ud(o,te,Se,ze),p&&sd){j=0;break e}break;default:ze=vn,vn=0,oa=null,ud(o,te,Se,ze)}}$V(),j=Qn;break}catch(Qe){PP(o,Qe)}while(!0);return u&&o.shellSuspendCounter++,no=Mc=null,hn=_,X.H=M,X.A=D,Kt===null&&(Pn=null,en=0,ag()),j}function $V(){for(;Kt!==null;)LP(Kt)}function WV(o,u){var p=hn;hn|=2;var _=NP(),M=OP();Pn!==o||en!==u?(kg=null,Ug=O()+500,cd(o,u)):sd=je(o,u);e:do try{if(vn!==0&&Kt!==null){u=Kt;var D=oa;t:switch(vn){case 1:vn=0,oa=null,ud(o,u,D,1);break;case 2:case 9:if(V3(D)){vn=0,oa=null,IP(u);break}u=function(){vn!==2&&vn!==9||Pn!==o||(vn=7),Cs(o)},D.then(u,u);break e;case 3:vn=7;break e;case 4:vn=5;break e;case 7:V3(D)?(vn=0,oa=null,IP(u)):(vn=0,oa=null,ud(o,u,D,7));break;case 5:var j=null;switch(Kt.tag){case 26:j=Kt.memoizedState;case 5:case 27:var te=Kt;if(j?bD(j):te.stateNode.complete){vn=0,oa=null;var Se=te.sibling;if(Se!==null)Kt=Se;else{var ze=te.return;ze!==null?(Kt=ze,Bg(ze)):Kt=null}break t}}vn=0,oa=null,ud(o,u,D,5);break;case 6:vn=0,oa=null,ud(o,u,D,6);break;case 8:$_(),Qn=6;break e;default:throw Error(i(462))}}XV();break}catch(Qe){PP(o,Qe)}while(!0);return no=Mc=null,X.H=_,X.A=M,hn=p,Kt!==null?0:(Pn=null,en=0,ag(),Qn)}function XV(){for(;Kt!==null&&!ve();)LP(Kt)}function LP(o){var u=rP(o.alternate,o,ho);o.memoizedProps=o.pendingProps,u===null?Bg(o):Kt=u}function IP(o){var u=o,p=u.alternate;switch(u.tag){case 15:case 0:u=QR(p,u,u.pendingProps,u.type,void 0,en);break;case 11:u=QR(p,u,u.pendingProps,u.type.render,u.ref,en);break;case 5:o_(u);default:sP(p,u),u=Kt=O3(u,ho),u=rP(p,u,ho)}o.memoizedProps=o.pendingProps,u===null?Bg(o):Kt=u}function ud(o,u,p,_){no=Mc=null,o_(u),Ju=null,yh=0;var M=u.return;try{if(IV(o,M,u,p,en)){Qn=1,Tg(o,Ma(p,o.current)),Kt=null;return}}catch(D){if(M!==null)throw Kt=M,D;Qn=1,Tg(o,Ma(p,o.current)),Kt=null;return}u.flags&32768?(rn||_===1?o=!0:sd||(en&536870912)!==0?o=!1:(yl=o=!0,(_===2||_===9||_===3||_===6)&&(_=aa.current,_!==null&&_.tag===13&&(_.flags|=16384))),UP(u,o)):Bg(u)}function Bg(o){var u=o;do{if((u.flags&32768)!==0){UP(u,yl);return}o=u.return;var p=FV(u.alternate,u,ho);if(p!==null){Kt=p;return}if(u=u.sibling,u!==null){Kt=u;return}Kt=u=o}while(u!==null);Qn===0&&(Qn=5)}function UP(o,u){do{var p=zV(o.alternate,o);if(p!==null){p.flags&=32767,Kt=p;return}if(p=o.return,p!==null&&(p.flags|=32768,p.subtreeFlags=0,p.deletions=null),!u&&(o=o.sibling,o!==null)){Kt=o;return}Kt=o=p}while(o!==null);Qn=6,Kt=null}function kP(o,u,p,_,M,D,j,te,Se){o.cancelPendingCommit=null;do jg();while(Mi!==0);if((hn&6)!==0)throw Error(i(327));if(u!==null){if(u===o.current)throw Error(i(177));if(D=u.lanes|u.childLanes,D|=Lb,Ct(o,p,D,j,te,Se),o===Pn&&(Kt=Pn=null,en=0),ld=u,Sl=o,po=p,H_=D,G_=M,AP=_,(u.subtreeFlags&10256)!==0||(u.flags&10256)!==0?(o.callbackNode=null,o.callbackPriority=0,ZV(fe,function(){return HP(),null})):(o.callbackNode=null,o.callbackPriority=0),_=(u.flags&13878)!==0,(u.subtreeFlags&13878)!==0||_){_=X.T,X.T=null,M=V.p,V.p=2,j=hn,hn|=4;try{BV(o,u,p)}finally{hn=j,V.p=M,X.T=_}}Mi=1,FP(),zP(),BP()}}function FP(){if(Mi===1){Mi=0;var o=Sl,u=ld,p=(u.flags&13878)!==0;if((u.subtreeFlags&13878)!==0||p){p=X.T,X.T=null;var _=V.p;V.p=2;var M=hn;hn|=4;try{xP(u,o);var D=rS,j=E3(o.containerInfo),te=D.focusedElem,Se=D.selectionRange;if(j!==te&&te&&te.ownerDocument&&w3(te.ownerDocument.documentElement,te)){if(Se!==null&&Rb(te)){var ze=Se.start,Qe=Se.end;if(Qe===void 0&&(Qe=ze),"selectionStart"in te)te.selectionStart=ze,te.selectionEnd=Math.min(Qe,te.value.length);else{var it=te.ownerDocument||document,Ge=it&&it.defaultView||window;if(Ge.getSelection){var Ye=Ge.getSelection(),St=te.textContent.length,Ot=Math.min(Se.start,St),Sn=Se.end===void 0?Ot:Math.min(Se.end,St);!Ye.extend&&Ot>Sn&&(j=Sn,Sn=Ot,Ot=j);var Oe=S3(te,Ot),Te=S3(te,Sn);if(Oe&&Te&&(Ye.rangeCount!==1||Ye.anchorNode!==Oe.node||Ye.anchorOffset!==Oe.offset||Ye.focusNode!==Te.node||Ye.focusOffset!==Te.offset)){var Fe=it.createRange();Fe.setStart(Oe.node,Oe.offset),Ye.removeAllRanges(),Ot>Sn?(Ye.addRange(Fe),Ye.extend(Te.node,Te.offset)):(Fe.setEnd(Te.node,Te.offset),Ye.addRange(Fe))}}}}for(it=[],Ye=te;Ye=Ye.parentNode;)Ye.nodeType===1&&it.push({element:Ye,left:Ye.scrollLeft,top:Ye.scrollTop});for(typeof te.focus=="function"&&te.focus(),te=0;te<it.length;te++){var nt=it[te];nt.element.scrollLeft=nt.left,nt.element.scrollTop=nt.top}}Jg=!!iS,rS=iS=null}finally{hn=M,V.p=_,X.T=p}}o.current=u,Mi=2}}function zP(){if(Mi===2){Mi=0;var o=Sl,u=ld,p=(u.flags&8772)!==0;if((u.subtreeFlags&8772)!==0||p){p=X.T,X.T=null;var _=V.p;V.p=2;var M=hn;hn|=4;try{hP(o,u.alternate,u)}finally{hn=M,V.p=_,X.T=p}}Mi=3}}function BP(){if(Mi===4||Mi===3){Mi=0,k();var o=Sl,u=ld,p=po,_=AP;(u.subtreeFlags&10256)!==0||(u.flags&10256)!==0?Mi=5:(Mi=0,ld=Sl=null,jP(o,o.pendingLanes));var M=o.pendingLanes;if(M===0&&(_l=null),Bi(p),u=u.stateNode,De&&typeof De.onCommitFiberRoot=="function")try{De.onCommitFiberRoot(ke,u,void 0,(u.current.flags&128)===128)}catch{}if(_!==null){u=X.T,M=V.p,V.p=2,X.T=null;try{for(var D=o.onRecoverableError,j=0;j<_.length;j++){var te=_[j];D(te.value,{componentStack:te.stack})}}finally{X.T=u,V.p=M}}(po&3)!==0&&jg(),Cs(o),M=o.pendingLanes,(p&261930)!==0&&(M&42)!==0?o===V_?Uh++:(Uh=0,V_=o):Uh=0,kh(0)}}function jP(o,u){(o.pooledCacheLanes&=u)===0&&(u=o.pooledCache,u!=null&&(o.pooledCache=null,vh(u)))}function jg(){return FP(),zP(),BP(),HP()}function HP(){if(Mi!==5)return!1;var o=Sl,u=H_;H_=0;var p=Bi(po),_=X.T,M=V.p;try{V.p=32>p?32:p,X.T=null,p=G_,G_=null;var D=Sl,j=po;if(Mi=0,ld=Sl=null,po=0,(hn&6)!==0)throw Error(i(331));var te=hn;if(hn|=4,wP(D.current),bP(D,D.current,j,p),hn=te,kh(0,!1),De&&typeof De.onPostCommitFiberRoot=="function")try{De.onPostCommitFiberRoot(ke,D)}catch{}return!0}finally{V.p=M,X.T=_,jP(o,u)}}function GP(o,u,p){u=Ma(p,u),u=S_(o.stateNode,u,2),o=ml(o,u,2),o!==null&&(Wt(o,2),Cs(o))}function xn(o,u,p){if(o.tag===3)GP(o,o,p);else for(;u!==null;){if(u.tag===3){GP(u,o,p);break}else if(u.tag===1){var _=u.stateNode;if(typeof u.type.getDerivedStateFromError=="function"||typeof _.componentDidCatch=="function"&&(_l===null||!_l.has(_))){o=Ma(p,o),p=VR(2),_=ml(u,p,2),_!==null&&($R(p,_,u,o),Wt(_,2),Cs(_));break}}u=u.return}}function X_(o,u,p){var _=o.pingCache;if(_===null){_=o.pingCache=new GV;var M=new Set;_.set(u,M)}else M=_.get(u),M===void 0&&(M=new Set,_.set(u,M));M.has(p)||(z_=!0,M.add(p),o=qV.bind(null,o,u,p),u.then(o,o))}function qV(o,u,p){var _=o.pingCache;_!==null&&_.delete(u),o.pingedLanes|=o.suspendedLanes&p,o.warmLanes&=~p,Pn===o&&(en&p)===p&&(Qn===4||Qn===3&&(en&62914560)===en&&300>O()-Ig?(hn&2)===0&&cd(o,0):B_|=p,od===en&&(od=0)),Cs(o)}function VP(o,u){u===0&&(u=mt()),o=Sc(o,u),o!==null&&(Wt(o,u),Cs(o))}function YV(o){var u=o.memoizedState,p=0;u!==null&&(p=u.retryLane),VP(o,p)}function KV(o,u){var p=0;switch(o.tag){case 31:case 13:var _=o.stateNode,M=o.memoizedState;M!==null&&(p=M.retryLane);break;case 19:_=o.stateNode;break;case 22:_=o.stateNode._retryCache;break;default:throw Error(i(314))}_!==null&&_.delete(u),VP(o,p)}function ZV(o,u){return ie(o,u)}var Hg=null,dd=null,q_=!1,Gg=!1,Y_=!1,El=0;function Cs(o){o!==dd&&o.next===null&&(dd===null?Hg=dd=o:dd=dd.next=o),Gg=!0,q_||(q_=!0,JV())}function kh(o,u){if(!Y_&&Gg){Y_=!0;do for(var p=!1,_=Hg;_!==null;){if(o!==0){var M=_.pendingLanes;if(M===0)var D=0;else{var j=_.suspendedLanes,te=_.pingedLanes;D=(1<<31-et(42|o)+1)-1,D&=M&~(j&~te),D=D&201326741?D&201326741|1:D?D|2:0}D!==0&&(p=!0,qP(_,D))}else D=en,D=ge(_,_===Pn?D:0,_.cancelPendingCommit!==null||_.timeoutHandle!==-1),(D&3)===0||je(_,D)||(p=!0,qP(_,D));_=_.next}while(p);Y_=!1}}function QV(){$P()}function $P(){Gg=q_=!1;var o=0;El!==0&&c9()&&(o=El);for(var u=O(),p=null,_=Hg;_!==null;){var M=_.next,D=WP(_,u);D===0?(_.next=null,p===null?Hg=M:p.next=M,M===null&&(dd=p)):(p=_,(o!==0||(D&3)!==0)&&(Gg=!0)),_=M}Mi!==0&&Mi!==5||kh(o),El!==0&&(El=0)}function WP(o,u){for(var p=o.suspendedLanes,_=o.pingedLanes,M=o.expirationTimes,D=o.pendingLanes&-62914561;0<D;){var j=31-et(D),te=1<<j,Se=M[j];Se===-1?((te&p)===0||(te&_)!==0)&&(M[j]=at(te,u)):Se<=u&&(o.expiredLanes|=te),D&=~te}if(u=Pn,p=en,p=ge(o,o===u?p:0,o.cancelPendingCommit!==null||o.timeoutHandle!==-1),_=o.callbackNode,p===0||o===u&&(vn===2||vn===9)||o.cancelPendingCommit!==null)return _!==null&&_!==null&&we(_),o.callbackNode=null,o.callbackPriority=0;if((p&3)===0||je(o,p)){if(u=p&-p,u===o.callbackPriority)return u;switch(_!==null&&we(_),Bi(p)){case 2:case 8:p=xe;break;case 32:p=fe;break;case 268435456:p=Ie;break;default:p=fe}return _=XP.bind(null,o),p=ie(p,_),o.callbackPriority=u,o.callbackNode=p,u}return _!==null&&_!==null&&we(_),o.callbackPriority=2,o.callbackNode=null,2}function XP(o,u){if(Mi!==0&&Mi!==5)return o.callbackNode=null,o.callbackPriority=0,null;var p=o.callbackNode;if(jg()&&o.callbackNode!==p)return null;var _=en;return _=ge(o,o===Pn?_:0,o.cancelPendingCommit!==null||o.timeoutHandle!==-1),_===0?null:(CP(o,_,u),WP(o,O()),o.callbackNode!=null&&o.callbackNode===p?XP.bind(null,o):null)}function qP(o,u){if(jg())return null;CP(o,u,!0)}function JV(){d9(function(){(hn&6)!==0?ie(pe,QV):$P()})}function K_(){if(El===0){var o=Ku;o===0&&(o=tt,tt<<=1,(tt&261888)===0&&(tt=256)),El=o}return El}function YP(o){return o==null||typeof o=="symbol"||typeof o=="boolean"?null:typeof o=="function"?o:Zm(""+o)}function KP(o,u){var p=u.ownerDocument.createElement("input");return p.name=u.name,p.value=u.value,o.id&&p.setAttribute("form",o.id),u.parentNode.insertBefore(p,u),o=new FormData(o),p.parentNode.removeChild(p),o}function e9(o,u,p,_,M){if(u==="submit"&&p&&p.stateNode===M){var D=YP((M[ei]||null).action),j=_.submitter;j&&(u=(u=j[ei]||null)?YP(u.formAction):j.getAttribute("formAction"),u!==null&&(D=u,j=null));var te=new tg("action","action",null,_,M);o.push({event:te,listeners:[{instance:null,listener:function(){if(_.defaultPrevented){if(El!==0){var Se=j?KP(M,j):new FormData(M);g_(p,{pending:!0,data:Se,method:M.method,action:D},null,Se)}}else typeof D=="function"&&(te.preventDefault(),Se=j?KP(M,j):new FormData(M),g_(p,{pending:!0,data:Se,method:M.method,action:D},D,Se))},currentTarget:M}]})}}for(var Z_=0;Z_<Ob.length;Z_++){var Q_=Ob[Z_],t9=Q_.toLowerCase(),n9=Q_[0].toUpperCase()+Q_.slice(1);ts(t9,"on"+n9)}ts(T3,"onAnimationEnd"),ts(C3,"onAnimationIteration"),ts(R3,"onAnimationStart"),ts("dblclick","onDoubleClick"),ts("focusin","onFocus"),ts("focusout","onBlur"),ts(xV,"onTransitionRun"),ts(yV,"onTransitionStart"),ts(bV,"onTransitionCancel"),ts(P3,"onTransitionEnd"),ft("onMouseEnter",["mouseout","mouseover"]),ft("onMouseLeave",["mouseout","mouseover"]),ft("onPointerEnter",["pointerout","pointerover"]),ft("onPointerLeave",["pointerout","pointerover"]),ot("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),ot("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),ot("onBeforeInput",["compositionend","keypress","textInput","paste"]),ot("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),ot("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),ot("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Fh="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),i9=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Fh));function ZP(o,u){u=(u&4)!==0;for(var p=0;p<o.length;p++){var _=o[p],M=_.event;_=_.listeners;e:{var D=void 0;if(u)for(var j=_.length-1;0<=j;j--){var te=_[j],Se=te.instance,ze=te.currentTarget;if(te=te.listener,Se!==D&&M.isPropagationStopped())break e;D=te,M.currentTarget=ze;try{D(M)}catch(Qe){rg(Qe)}M.currentTarget=null,D=Se}else for(j=0;j<_.length;j++){if(te=_[j],Se=te.instance,ze=te.currentTarget,te=te.listener,Se!==D&&M.isPropagationStopped())break e;D=te,M.currentTarget=ze;try{D(M)}catch(Qe){rg(Qe)}M.currentTarget=null,D=Se}}}}function Zt(o,u){var p=u[ol];p===void 0&&(p=u[ol]=new Set);var _=o+"__bubble";p.has(_)||(QP(u,o,2,!1),p.add(_))}function J_(o,u,p){var _=0;u&&(_|=4),QP(p,o,_,u)}var Vg="_reactListening"+Math.random().toString(36).slice(2);function eS(o){if(!o[Vg]){o[Vg]=!0,Ee.forEach(function(p){p!=="selectionchange"&&(i9.has(p)||J_(p,!1,o),J_(p,!0,o))});var u=o.nodeType===9?o:o.ownerDocument;u===null||u[Vg]||(u[Vg]=!0,J_("selectionchange",!1,u))}}function QP(o,u,p,_){switch(TD(u)){case 2:var M=D9;break;case 8:M=N9;break;default:M=mS}p=M.bind(null,u,p,o),M=void 0,!bb||u!=="touchstart"&&u!=="touchmove"&&u!=="wheel"||(M=!0),_?M!==void 0?o.addEventListener(u,p,{capture:!0,passive:M}):o.addEventListener(u,p,!0):M!==void 0?o.addEventListener(u,p,{passive:M}):o.addEventListener(u,p,!1)}function tS(o,u,p,_,M){var D=_;if((u&1)===0&&(u&2)===0&&_!==null)e:for(;;){if(_===null)return;var j=_.tag;if(j===3||j===4){var te=_.stateNode.containerInfo;if(te===M)break;if(j===4)for(j=_.return;j!==null;){var Se=j.tag;if((Se===3||Se===4)&&j.stateNode.containerInfo===M)return;j=j.return}for(;te!==null;){if(j=gt(te),j===null)return;if(Se=j.tag,Se===5||Se===6||Se===26||Se===27){_=D=j;continue e}te=te.parentNode}}_=_.return}i3(function(){var ze=D,Qe=xb(p),it=[];e:{var Ge=D3.get(o);if(Ge!==void 0){var Ye=tg,St=o;switch(o){case"keypress":if(Jm(p)===0)break e;case"keydown":case"keyup":Ye=KG;break;case"focusin":St="focus",Ye=Eb;break;case"focusout":St="blur",Ye=Eb;break;case"beforeblur":case"afterblur":Ye=Eb;break;case"click":if(p.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":Ye=s3;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Ye=FG;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Ye=JG;break;case T3:case C3:case R3:Ye=jG;break;case P3:Ye=tV;break;case"scroll":case"scrollend":Ye=UG;break;case"wheel":Ye=iV;break;case"copy":case"cut":case"paste":Ye=GG;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Ye=l3;break;case"toggle":case"beforetoggle":Ye=aV}var Ot=(u&4)!==0,Sn=!Ot&&(o==="scroll"||o==="scrollend"),Oe=Ot?Ge!==null?Ge+"Capture":null:Ge;Ot=[];for(var Te=ze,Fe;Te!==null;){var nt=Te;if(Fe=nt.stateNode,nt=nt.tag,nt!==5&&nt!==26&&nt!==27||Fe===null||Oe===null||(nt=sh(Te,Oe),nt!=null&&Ot.push(zh(Te,nt,Fe))),Sn)break;Te=Te.return}0<Ot.length&&(Ge=new Ye(Ge,St,null,p,Qe),it.push({event:Ge,listeners:Ot}))}}if((u&7)===0){e:{if(Ge=o==="mouseover"||o==="pointerover",Ye=o==="mouseout"||o==="pointerout",Ge&&p!==vb&&(St=p.relatedTarget||p.fromElement)&&(gt(St)||St[Ja]))break e;if((Ye||Ge)&&(Ge=Qe.window===Qe?Qe:(Ge=Qe.ownerDocument)?Ge.defaultView||Ge.parentWindow:window,Ye?(St=p.relatedTarget||p.toElement,Ye=ze,St=St?gt(St):null,St!==null&&(Sn=a(St),Ot=St.tag,St!==Sn||Ot!==5&&Ot!==27&&Ot!==6)&&(St=null)):(Ye=null,St=ze),Ye!==St)){if(Ot=s3,nt="onMouseLeave",Oe="onMouseEnter",Te="mouse",(o==="pointerout"||o==="pointerover")&&(Ot=l3,nt="onPointerLeave",Oe="onPointerEnter",Te="pointer"),Sn=Ye==null?Ge:_e(Ye),Fe=St==null?Ge:_e(St),Ge=new Ot(nt,Te+"leave",Ye,p,Qe),Ge.target=Sn,Ge.relatedTarget=Fe,nt=null,gt(Qe)===ze&&(Ot=new Ot(Oe,Te+"enter",St,p,Qe),Ot.target=Fe,Ot.relatedTarget=Sn,nt=Ot),Sn=nt,Ye&&St)t:{for(Ot=r9,Oe=Ye,Te=St,Fe=0,nt=Oe;nt;nt=Ot(nt))Fe++;nt=0;for(var Dt=Te;Dt;Dt=Ot(Dt))nt++;for(;0<Fe-nt;)Oe=Ot(Oe),Fe--;for(;0<nt-Fe;)Te=Ot(Te),nt--;for(;Fe--;){if(Oe===Te||Te!==null&&Oe===Te.alternate){Ot=Oe;break t}Oe=Ot(Oe),Te=Ot(Te)}Ot=null}else Ot=null;Ye!==null&&JP(it,Ge,Ye,Ot,!1),St!==null&&Sn!==null&&JP(it,Sn,St,Ot,!0)}}e:{if(Ge=ze?_e(ze):window,Ye=Ge.nodeName&&Ge.nodeName.toLowerCase(),Ye==="select"||Ye==="input"&&Ge.type==="file")var on=g3;else if(p3(Ge))if(v3)on=mV;else{on=hV;var Tt=fV}else Ye=Ge.nodeName,!Ye||Ye.toLowerCase()!=="input"||Ge.type!=="checkbox"&&Ge.type!=="radio"?ze&&gb(ze.elementType)&&(on=g3):on=pV;if(on&&(on=on(o,ze))){m3(it,on,p,Qe);break e}Tt&&Tt(o,Ge,ze),o==="focusout"&&ze&&Ge.type==="number"&&ze.memoizedProps.value!=null&&ji(Ge,"number",Ge.value)}switch(Tt=ze?_e(ze):window,o){case"focusin":(p3(Tt)||Tt.contentEditable==="true")&&(Hu=Tt,Pb=ze,ph=null);break;case"focusout":ph=Pb=Hu=null;break;case"mousedown":Db=!0;break;case"contextmenu":case"mouseup":case"dragend":Db=!1,M3(it,p,Qe);break;case"selectionchange":if(vV)break;case"keydown":case"keyup":M3(it,p,Qe)}var jt;if(Ab)e:{switch(o){case"compositionstart":var tn="onCompositionStart";break e;case"compositionend":tn="onCompositionEnd";break e;case"compositionupdate":tn="onCompositionUpdate";break e}tn=void 0}else ju?f3(o,p)&&(tn="onCompositionEnd"):o==="keydown"&&p.keyCode===229&&(tn="onCompositionStart");tn&&(c3&&p.locale!=="ko"&&(ju||tn!=="onCompositionStart"?tn==="onCompositionEnd"&&ju&&(jt=r3()):(ll=Qe,_b="value"in ll?ll.value:ll.textContent,ju=!0)),Tt=$g(ze,tn),0<Tt.length&&(tn=new o3(tn,o,null,p,Qe),it.push({event:tn,listeners:Tt}),jt?tn.data=jt:(jt=h3(p),jt!==null&&(tn.data=jt)))),(jt=oV?lV(o,p):cV(o,p))&&(tn=$g(ze,"onBeforeInput"),0<tn.length&&(Tt=new o3("onBeforeInput","beforeinput",null,p,Qe),it.push({event:Tt,listeners:tn}),Tt.data=jt)),e9(it,o,ze,p,Qe)}ZP(it,u)})}function zh(o,u,p){return{instance:o,listener:u,currentTarget:p}}function $g(o,u){for(var p=u+"Capture",_=[];o!==null;){var M=o,D=M.stateNode;if(M=M.tag,M!==5&&M!==26&&M!==27||D===null||(M=sh(o,p),M!=null&&_.unshift(zh(o,M,D)),M=sh(o,u),M!=null&&_.push(zh(o,M,D))),o.tag===3)return _;o=o.return}return[]}function r9(o){if(o===null)return null;do o=o.return;while(o&&o.tag!==5&&o.tag!==27);return o||null}function JP(o,u,p,_,M){for(var D=u._reactName,j=[];p!==null&&p!==_;){var te=p,Se=te.alternate,ze=te.stateNode;if(te=te.tag,Se!==null&&Se===_)break;te!==5&&te!==26&&te!==27||ze===null||(Se=ze,M?(ze=sh(p,D),ze!=null&&j.unshift(zh(p,ze,Se))):M||(ze=sh(p,D),ze!=null&&j.push(zh(p,ze,Se)))),p=p.return}j.length!==0&&o.push({event:u,listeners:j})}var a9=/\r\n?/g,s9=/\u0000|\uFFFD/g;function eD(o){return(typeof o=="string"?o:""+o).replace(a9,`
  9. `).replace(s9,"")}function tD(o,u){return u=eD(u),eD(o)===u}function _n(o,u,p,_,M,D){switch(p){case"children":typeof _=="string"?u==="body"||u==="textarea"&&_===""||Es(o,_):(typeof _=="number"||typeof _=="bigint")&&u!=="body"&&Es(o,""+_);break;case"className":Pt(o,"class",_);break;case"tabIndex":Pt(o,"tabindex",_);break;case"dir":case"role":case"viewBox":case"width":case"height":Pt(o,p,_);break;case"style":t3(o,_,D);break;case"data":if(u!=="object"){Pt(o,"data",_);break}case"src":case"href":if(_===""&&(u!=="a"||p!=="href")){o.removeAttribute(p);break}if(_==null||typeof _=="function"||typeof _=="symbol"||typeof _=="boolean"){o.removeAttribute(p);break}_=Zm(""+_),o.setAttribute(p,_);break;case"action":case"formAction":if(typeof _=="function"){o.setAttribute(p,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof D=="function"&&(p==="formAction"?(u!=="input"&&_n(o,u,"name",M.name,M,null),_n(o,u,"formEncType",M.formEncType,M,null),_n(o,u,"formMethod",M.formMethod,M,null),_n(o,u,"formTarget",M.formTarget,M,null)):(_n(o,u,"encType",M.encType,M,null),_n(o,u,"method",M.method,M,null),_n(o,u,"target",M.target,M,null)));if(_==null||typeof _=="symbol"||typeof _=="boolean"){o.removeAttribute(p);break}_=Zm(""+_),o.setAttribute(p,_);break;case"onClick":_!=null&&(o.onclick=Qs);break;case"onScroll":_!=null&&Zt("scroll",o);break;case"onScrollEnd":_!=null&&Zt("scrollend",o);break;case"dangerouslySetInnerHTML":if(_!=null){if(typeof _!="object"||!("__html"in _))throw Error(i(61));if(p=_.__html,p!=null){if(M.children!=null)throw Error(i(60));o.innerHTML=p}}break;case"multiple":o.multiple=_&&typeof _!="function"&&typeof _!="symbol";break;case"muted":o.muted=_&&typeof _!="function"&&typeof _!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(_==null||typeof _=="function"||typeof _=="boolean"||typeof _=="symbol"){o.removeAttribute("xlink:href");break}p=Zm(""+_),o.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",p);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":_!=null&&typeof _!="function"&&typeof _!="symbol"?o.setAttribute(p,""+_):o.removeAttribute(p);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":_&&typeof _!="function"&&typeof _!="symbol"?o.setAttribute(p,""):o.removeAttribute(p);break;case"capture":case"download":_===!0?o.setAttribute(p,""):_!==!1&&_!=null&&typeof _!="function"&&typeof _!="symbol"?o.setAttribute(p,_):o.removeAttribute(p);break;case"cols":case"rows":case"size":case"span":_!=null&&typeof _!="function"&&typeof _!="symbol"&&!isNaN(_)&&1<=_?o.setAttribute(p,_):o.removeAttribute(p);break;case"rowSpan":case"start":_==null||typeof _=="function"||typeof _=="symbol"||isNaN(_)?o.removeAttribute(p):o.setAttribute(p,_);break;case"popover":Zt("beforetoggle",o),Zt("toggle",o),Lt(o,"popover",_);break;case"xlinkActuate":Ht(o,"http://www.w3.org/1999/xlink","xlink:actuate",_);break;case"xlinkArcrole":Ht(o,"http://www.w3.org/1999/xlink","xlink:arcrole",_);break;case"xlinkRole":Ht(o,"http://www.w3.org/1999/xlink","xlink:role",_);break;case"xlinkShow":Ht(o,"http://www.w3.org/1999/xlink","xlink:show",_);break;case"xlinkTitle":Ht(o,"http://www.w3.org/1999/xlink","xlink:title",_);break;case"xlinkType":Ht(o,"http://www.w3.org/1999/xlink","xlink:type",_);break;case"xmlBase":Ht(o,"http://www.w3.org/XML/1998/namespace","xml:base",_);break;case"xmlLang":Ht(o,"http://www.w3.org/XML/1998/namespace","xml:lang",_);break;case"xmlSpace":Ht(o,"http://www.w3.org/XML/1998/namespace","xml:space",_);break;case"is":Lt(o,"is",_);break;case"innerText":case"textContent":break;default:(!(2<p.length)||p[0]!=="o"&&p[0]!=="O"||p[1]!=="n"&&p[1]!=="N")&&(p=LG.get(p)||p,Lt(o,p,_))}}function nS(o,u,p,_,M,D){switch(p){case"style":t3(o,_,D);break;case"dangerouslySetInnerHTML":if(_!=null){if(typeof _!="object"||!("__html"in _))throw Error(i(61));if(p=_.__html,p!=null){if(M.children!=null)throw Error(i(60));o.innerHTML=p}}break;case"children":typeof _=="string"?Es(o,_):(typeof _=="number"||typeof _=="bigint")&&Es(o,""+_);break;case"onScroll":_!=null&&Zt("scroll",o);break;case"onScrollEnd":_!=null&&Zt("scrollend",o);break;case"onClick":_!=null&&(o.onclick=Qs);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Ze.hasOwnProperty(p))e:{if(p[0]==="o"&&p[1]==="n"&&(M=p.endsWith("Capture"),u=p.slice(2,M?p.length-7:void 0),D=o[ei]||null,D=D!=null?D[p]:null,typeof D=="function"&&o.removeEventListener(u,D,M),typeof _=="function")){typeof D!="function"&&D!==null&&(p in o?o[p]=null:o.hasAttribute(p)&&o.removeAttribute(p)),o.addEventListener(u,_,M);break e}p in o?o[p]=_:_===!0?o.setAttribute(p,""):Lt(o,p,_)}}}function sr(o,u,p){switch(u){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Zt("error",o),Zt("load",o);var _=!1,M=!1,D;for(D in p)if(p.hasOwnProperty(D)){var j=p[D];if(j!=null)switch(D){case"src":_=!0;break;case"srcSet":M=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(i(137,u));default:_n(o,u,D,j,p,null)}}M&&_n(o,u,"srcSet",p.srcSet,p,null),_&&_n(o,u,"src",p.src,p,null);return;case"input":Zt("invalid",o);var te=D=j=M=null,Se=null,ze=null;for(_ in p)if(p.hasOwnProperty(_)){var Qe=p[_];if(Qe!=null)switch(_){case"name":M=Qe;break;case"type":j=Qe;break;case"checked":Se=Qe;break;case"defaultChecked":ze=Qe;break;case"value":D=Qe;break;case"defaultValue":te=Qe;break;case"children":case"dangerouslySetInnerHTML":if(Qe!=null)throw Error(i(137,u));break;default:_n(o,u,_,Qe,p,null)}}gn(o,D,te,Se,ze,j,M,!1);return;case"select":Zt("invalid",o),_=j=D=null;for(M in p)if(p.hasOwnProperty(M)&&(te=p[M],te!=null))switch(M){case"value":D=te;break;case"defaultValue":j=te;break;case"multiple":_=te;default:_n(o,u,M,te,p,null)}u=D,p=j,o.multiple=!!_,u!=null?Ei(o,!!_,u,!1):p!=null&&Ei(o,!!_,p,!0);return;case"textarea":Zt("invalid",o),D=M=_=null;for(j in p)if(p.hasOwnProperty(j)&&(te=p[j],te!=null))switch(j){case"value":_=te;break;case"defaultValue":M=te;break;case"children":D=te;break;case"dangerouslySetInnerHTML":if(te!=null)throw Error(i(91));break;default:_n(o,u,j,te,p,null)}nr(o,_,M,D);return;case"option":for(Se in p)if(p.hasOwnProperty(Se)&&(_=p[Se],_!=null))switch(Se){case"selected":o.selected=_&&typeof _!="function"&&typeof _!="symbol";break;default:_n(o,u,Se,_,p,null)}return;case"dialog":Zt("beforetoggle",o),Zt("toggle",o),Zt("cancel",o),Zt("close",o);break;case"iframe":case"object":Zt("load",o);break;case"video":case"audio":for(_=0;_<Fh.length;_++)Zt(Fh[_],o);break;case"image":Zt("error",o),Zt("load",o);break;case"details":Zt("toggle",o);break;case"embed":case"source":case"link":Zt("error",o),Zt("load",o);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(ze in p)if(p.hasOwnProperty(ze)&&(_=p[ze],_!=null))switch(ze){case"children":case"dangerouslySetInnerHTML":throw Error(i(137,u));default:_n(o,u,ze,_,p,null)}return;default:if(gb(u)){for(Qe in p)p.hasOwnProperty(Qe)&&(_=p[Qe],_!==void 0&&nS(o,u,Qe,_,p,void 0));return}}for(te in p)p.hasOwnProperty(te)&&(_=p[te],_!=null&&_n(o,u,te,_,p,null))}function o9(o,u,p,_){switch(u){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var M=null,D=null,j=null,te=null,Se=null,ze=null,Qe=null;for(Ye in p){var it=p[Ye];if(p.hasOwnProperty(Ye)&&it!=null)switch(Ye){case"checked":break;case"value":break;case"defaultValue":Se=it;default:_.hasOwnProperty(Ye)||_n(o,u,Ye,null,_,it)}}for(var Ge in _){var Ye=_[Ge];if(it=p[Ge],_.hasOwnProperty(Ge)&&(Ye!=null||it!=null))switch(Ge){case"type":D=Ye;break;case"name":M=Ye;break;case"checked":ze=Ye;break;case"defaultChecked":Qe=Ye;break;case"value":j=Ye;break;case"defaultValue":te=Ye;break;case"children":case"dangerouslySetInnerHTML":if(Ye!=null)throw Error(i(137,u));break;default:Ye!==it&&_n(o,u,Ge,Ye,_,it)}}es(o,j,te,Se,ze,Qe,D,M);return;case"select":Ye=j=te=Ge=null;for(D in p)if(Se=p[D],p.hasOwnProperty(D)&&Se!=null)switch(D){case"value":break;case"multiple":Ye=Se;default:_.hasOwnProperty(D)||_n(o,u,D,null,_,Se)}for(M in _)if(D=_[M],Se=p[M],_.hasOwnProperty(M)&&(D!=null||Se!=null))switch(M){case"value":Ge=D;break;case"defaultValue":te=D;break;case"multiple":j=D;default:D!==Se&&_n(o,u,M,D,_,Se)}u=te,p=j,_=Ye,Ge!=null?Ei(o,!!p,Ge,!1):!!_!=!!p&&(u!=null?Ei(o,!!p,u,!0):Ei(o,!!p,p?[]:"",!1));return;case"textarea":Ye=Ge=null;for(te in p)if(M=p[te],p.hasOwnProperty(te)&&M!=null&&!_.hasOwnProperty(te))switch(te){case"value":break;case"children":break;default:_n(o,u,te,null,_,M)}for(j in _)if(M=_[j],D=p[j],_.hasOwnProperty(j)&&(M!=null||D!=null))switch(j){case"value":Ge=M;break;case"defaultValue":Ye=M;break;case"children":break;case"dangerouslySetInnerHTML":if(M!=null)throw Error(i(91));break;default:M!==D&&_n(o,u,j,M,_,D)}Hi(o,Ge,Ye);return;case"option":for(var St in p)if(Ge=p[St],p.hasOwnProperty(St)&&Ge!=null&&!_.hasOwnProperty(St))switch(St){case"selected":o.selected=!1;break;default:_n(o,u,St,null,_,Ge)}for(Se in _)if(Ge=_[Se],Ye=p[Se],_.hasOwnProperty(Se)&&Ge!==Ye&&(Ge!=null||Ye!=null))switch(Se){case"selected":o.selected=Ge&&typeof Ge!="function"&&typeof Ge!="symbol";break;default:_n(o,u,Se,Ge,_,Ye)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var Ot in p)Ge=p[Ot],p.hasOwnProperty(Ot)&&Ge!=null&&!_.hasOwnProperty(Ot)&&_n(o,u,Ot,null,_,Ge);for(ze in _)if(Ge=_[ze],Ye=p[ze],_.hasOwnProperty(ze)&&Ge!==Ye&&(Ge!=null||Ye!=null))switch(ze){case"children":case"dangerouslySetInnerHTML":if(Ge!=null)throw Error(i(137,u));break;default:_n(o,u,ze,Ge,_,Ye)}return;default:if(gb(u)){for(var Sn in p)Ge=p[Sn],p.hasOwnProperty(Sn)&&Ge!==void 0&&!_.hasOwnProperty(Sn)&&nS(o,u,Sn,void 0,_,Ge);for(Qe in _)Ge=_[Qe],Ye=p[Qe],!_.hasOwnProperty(Qe)||Ge===Ye||Ge===void 0&&Ye===void 0||nS(o,u,Qe,Ge,_,Ye);return}}for(var Oe in p)Ge=p[Oe],p.hasOwnProperty(Oe)&&Ge!=null&&!_.hasOwnProperty(Oe)&&_n(o,u,Oe,null,_,Ge);for(it in _)Ge=_[it],Ye=p[it],!_.hasOwnProperty(it)||Ge===Ye||Ge==null&&Ye==null||_n(o,u,it,Ge,_,Ye)}function nD(o){switch(o){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function l9(){if(typeof performance.getEntriesByType=="function"){for(var o=0,u=0,p=performance.getEntriesByType("resource"),_=0;_<p.length;_++){var M=p[_],D=M.transferSize,j=M.initiatorType,te=M.duration;if(D&&te&&nD(j)){for(j=0,te=M.responseEnd,_+=1;_<p.length;_++){var Se=p[_],ze=Se.startTime;if(ze>te)break;var Qe=Se.transferSize,it=Se.initiatorType;Qe&&nD(it)&&(Se=Se.responseEnd,j+=Qe*(Se<te?1:(te-ze)/(Se-ze)))}if(--_,u+=8*(D+j)/(M.duration/1e3),o++,10<o)break}}if(0<o)return u/o/1e6}return navigator.connection&&(o=navigator.connection.downlink,typeof o=="number")?o:5}var iS=null,rS=null;function Wg(o){return o.nodeType===9?o:o.ownerDocument}function iD(o){switch(o){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function rD(o,u){if(o===0)switch(u){case"svg":return 1;case"math":return 2;default:return 0}return o===1&&u==="foreignObject"?0:o}function aS(o,u){return o==="textarea"||o==="noscript"||typeof u.children=="string"||typeof u.children=="number"||typeof u.children=="bigint"||typeof u.dangerouslySetInnerHTML=="object"&&u.dangerouslySetInnerHTML!==null&&u.dangerouslySetInnerHTML.__html!=null}var sS=null;function c9(){var o=window.event;return o&&o.type==="popstate"?o===sS?!1:(sS=o,!0):(sS=null,!1)}var aD=typeof setTimeout=="function"?setTimeout:void 0,u9=typeof clearTimeout=="function"?clearTimeout:void 0,sD=typeof Promise=="function"?Promise:void 0,d9=typeof queueMicrotask=="function"?queueMicrotask:typeof sD<"u"?function(o){return sD.resolve(null).then(o).catch(f9)}:aD;function f9(o){setTimeout(function(){throw o})}function Ml(o){return o==="head"}function oD(o,u){var p=u,_=0;do{var M=p.nextSibling;if(o.removeChild(p),M&&M.nodeType===8)if(p=M.data,p==="/$"||p==="/&"){if(_===0){o.removeChild(M),md(u);return}_--}else if(p==="$"||p==="$?"||p==="$~"||p==="$!"||p==="&")_++;else if(p==="html")Bh(o.ownerDocument.documentElement);else if(p==="head"){p=o.ownerDocument.head,Bh(p);for(var D=p.firstChild;D;){var j=D.nextSibling,te=D.nodeName;D[qe]||te==="SCRIPT"||te==="STYLE"||te==="LINK"&&D.rel.toLowerCase()==="stylesheet"||p.removeChild(D),D=j}}else p==="body"&&Bh(o.ownerDocument.body);p=M}while(p);md(u)}function lD(o,u){var p=o;o=0;do{var _=p.nextSibling;if(p.nodeType===1?u?(p._stashedDisplay=p.style.display,p.style.display="none"):(p.style.display=p._stashedDisplay||"",p.getAttribute("style")===""&&p.removeAttribute("style")):p.nodeType===3&&(u?(p._stashedText=p.nodeValue,p.nodeValue=""):p.nodeValue=p._stashedText||""),_&&_.nodeType===8)if(p=_.data,p==="/$"){if(o===0)break;o--}else p!=="$"&&p!=="$?"&&p!=="$~"&&p!=="$!"||o++;p=_}while(p)}function oS(o){var u=o.firstChild;for(u&&u.nodeType===10&&(u=u.nextSibling);u;){var p=u;switch(u=u.nextSibling,p.nodeName){case"HTML":case"HEAD":case"BODY":oS(p),We(p);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(p.rel.toLowerCase()==="stylesheet")continue}o.removeChild(p)}}function h9(o,u,p,_){for(;o.nodeType===1;){var M=p;if(o.nodeName.toLowerCase()!==u.toLowerCase()){if(!_&&(o.nodeName!=="INPUT"||o.type!=="hidden"))break}else if(_){if(!o[qe])switch(u){case"meta":if(!o.hasAttribute("itemprop"))break;return o;case"link":if(D=o.getAttribute("rel"),D==="stylesheet"&&o.hasAttribute("data-precedence"))break;if(D!==M.rel||o.getAttribute("href")!==(M.href==null||M.href===""?null:M.href)||o.getAttribute("crossorigin")!==(M.crossOrigin==null?null:M.crossOrigin)||o.getAttribute("title")!==(M.title==null?null:M.title))break;return o;case"style":if(o.hasAttribute("data-precedence"))break;return o;case"script":if(D=o.getAttribute("src"),(D!==(M.src==null?null:M.src)||o.getAttribute("type")!==(M.type==null?null:M.type)||o.getAttribute("crossorigin")!==(M.crossOrigin==null?null:M.crossOrigin))&&D&&o.hasAttribute("async")&&!o.hasAttribute("itemprop"))break;return o;default:return o}}else if(u==="input"&&o.type==="hidden"){var D=M.name==null?null:""+M.name;if(M.type==="hidden"&&o.getAttribute("name")===D)return o}else return o;if(o=Pa(o.nextSibling),o===null)break}return null}function p9(o,u,p){if(u==="")return null;for(;o.nodeType!==3;)if((o.nodeType!==1||o.nodeName!=="INPUT"||o.type!=="hidden")&&!p||(o=Pa(o.nextSibling),o===null))return null;return o}function cD(o,u){for(;o.nodeType!==8;)if((o.nodeType!==1||o.nodeName!=="INPUT"||o.type!=="hidden")&&!u||(o=Pa(o.nextSibling),o===null))return null;return o}function lS(o){return o.data==="$?"||o.data==="$~"}function cS(o){return o.data==="$!"||o.data==="$?"&&o.ownerDocument.readyState!=="loading"}function m9(o,u){var p=o.ownerDocument;if(o.data==="$~")o._reactRetry=u;else if(o.data!=="$?"||p.readyState!=="loading")u();else{var _=function(){u(),p.removeEventListener("DOMContentLoaded",_)};p.addEventListener("DOMContentLoaded",_),o._reactRetry=_}}function Pa(o){for(;o!=null;o=o.nextSibling){var u=o.nodeType;if(u===1||u===3)break;if(u===8){if(u=o.data,u==="$"||u==="$!"||u==="$?"||u==="$~"||u==="&"||u==="F!"||u==="F")break;if(u==="/$"||u==="/&")return null}}return o}var uS=null;function uD(o){o=o.nextSibling;for(var u=0;o;){if(o.nodeType===8){var p=o.data;if(p==="/$"||p==="/&"){if(u===0)return Pa(o.nextSibling);u--}else p!=="$"&&p!=="$!"&&p!=="$?"&&p!=="$~"&&p!=="&"||u++}o=o.nextSibling}return null}function dD(o){o=o.previousSibling;for(var u=0;o;){if(o.nodeType===8){var p=o.data;if(p==="$"||p==="$!"||p==="$?"||p==="$~"||p==="&"){if(u===0)return o;u--}else p!=="/$"&&p!=="/&"||u++}o=o.previousSibling}return null}function fD(o,u,p){switch(u=Wg(p),o){case"html":if(o=u.documentElement,!o)throw Error(i(452));return o;case"head":if(o=u.head,!o)throw Error(i(453));return o;case"body":if(o=u.body,!o)throw Error(i(454));return o;default:throw Error(i(451))}}function Bh(o){for(var u=o.attributes;u.length;)o.removeAttributeNode(u[0]);We(o)}var Da=new Map,hD=new Set;function Xg(o){return typeof o.getRootNode=="function"?o.getRootNode():o.nodeType===9?o:o.ownerDocument}var mo=V.d;V.d={f:g9,r:v9,D:x9,C:y9,L:b9,m:_9,X:w9,S:S9,M:E9};function g9(){var o=mo.f(),u=Fg();return o||u}function v9(o){var u=Z(o);u!==null&&u.tag===5&&u.type==="form"?PR(u):mo.r(o)}var fd=typeof document>"u"?null:document;function pD(o,u,p){var _=fd;if(_&&typeof u=="string"&&u){var M=pn(u);M='link[rel="'+o+'"][href="'+M+'"]',typeof p=="string"&&(M+='[crossorigin="'+p+'"]'),hD.has(M)||(hD.add(M),o={rel:o,crossOrigin:p,href:u},_.querySelector(M)===null&&(u=_.createElement("link"),sr(u,"link",o),Re(u),_.head.appendChild(u)))}}function x9(o){mo.D(o),pD("dns-prefetch",o,null)}function y9(o,u){mo.C(o,u),pD("preconnect",o,u)}function b9(o,u,p){mo.L(o,u,p);var _=fd;if(_&&o&&u){var M='link[rel="preload"][as="'+pn(u)+'"]';u==="image"&&p&&p.imageSrcSet?(M+='[imagesrcset="'+pn(p.imageSrcSet)+'"]',typeof p.imageSizes=="string"&&(M+='[imagesizes="'+pn(p.imageSizes)+'"]')):M+='[href="'+pn(o)+'"]';var D=M;switch(u){case"style":D=hd(o);break;case"script":D=pd(o)}Da.has(D)||(o=h({rel:"preload",href:u==="image"&&p&&p.imageSrcSet?void 0:o,as:u},p),Da.set(D,o),_.querySelector(M)!==null||u==="style"&&_.querySelector(jh(D))||u==="script"&&_.querySelector(Hh(D))||(u=_.createElement("link"),sr(u,"link",o),Re(u),_.head.appendChild(u)))}}function _9(o,u){mo.m(o,u);var p=fd;if(p&&o){var _=u&&typeof u.as=="string"?u.as:"script",M='link[rel="modulepreload"][as="'+pn(_)+'"][href="'+pn(o)+'"]',D=M;switch(_){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":D=pd(o)}if(!Da.has(D)&&(o=h({rel:"modulepreload",href:o},u),Da.set(D,o),p.querySelector(M)===null)){switch(_){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(p.querySelector(Hh(D)))return}_=p.createElement("link"),sr(_,"link",o),Re(_),p.head.appendChild(_)}}}function S9(o,u,p){mo.S(o,u,p);var _=fd;if(_&&o){var M=Pe(_).hoistableStyles,D=hd(o);u=u||"default";var j=M.get(D);if(!j){var te={loading:0,preload:null};if(j=_.querySelector(jh(D)))te.loading=5;else{o=h({rel:"stylesheet",href:o,"data-precedence":u},p),(p=Da.get(D))&&dS(o,p);var Se=j=_.createElement("link");Re(Se),sr(Se,"link",o),Se._p=new Promise(function(ze,Qe){Se.onload=ze,Se.onerror=Qe}),Se.addEventListener("load",function(){te.loading|=1}),Se.addEventListener("error",function(){te.loading|=2}),te.loading|=4,qg(j,u,_)}j={type:"stylesheet",instance:j,count:1,state:te},M.set(D,j)}}}function w9(o,u){mo.X(o,u);var p=fd;if(p&&o){var _=Pe(p).hoistableScripts,M=pd(o),D=_.get(M);D||(D=p.querySelector(Hh(M)),D||(o=h({src:o,async:!0},u),(u=Da.get(M))&&fS(o,u),D=p.createElement("script"),Re(D),sr(D,"link",o),p.head.appendChild(D)),D={type:"script",instance:D,count:1,state:null},_.set(M,D))}}function E9(o,u){mo.M(o,u);var p=fd;if(p&&o){var _=Pe(p).hoistableScripts,M=pd(o),D=_.get(M);D||(D=p.querySelector(Hh(M)),D||(o=h({src:o,async:!0,type:"module"},u),(u=Da.get(M))&&fS(o,u),D=p.createElement("script"),Re(D),sr(D,"link",o),p.head.appendChild(D)),D={type:"script",instance:D,count:1,state:null},_.set(M,D))}}function mD(o,u,p,_){var M=(M=me.current)?Xg(M):null;if(!M)throw Error(i(446));switch(o){case"meta":case"title":return null;case"style":return typeof p.precedence=="string"&&typeof p.href=="string"?(u=hd(p.href),p=Pe(M).hoistableStyles,_=p.get(u),_||(_={type:"style",instance:null,count:0,state:null},p.set(u,_)),_):{type:"void",instance:null,count:0,state:null};case"link":if(p.rel==="stylesheet"&&typeof p.href=="string"&&typeof p.precedence=="string"){o=hd(p.href);var D=Pe(M).hoistableStyles,j=D.get(o);if(j||(M=M.ownerDocument||M,j={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},D.set(o,j),(D=M.querySelector(jh(o)))&&!D._p&&(j.instance=D,j.state.loading=5),Da.has(o)||(p={rel:"preload",as:"style",href:p.href,crossOrigin:p.crossOrigin,integrity:p.integrity,media:p.media,hrefLang:p.hrefLang,referrerPolicy:p.referrerPolicy},Da.set(o,p),D||M9(M,o,p,j.state))),u&&_===null)throw Error(i(528,""));return j}if(u&&_!==null)throw Error(i(529,""));return null;case"script":return u=p.async,p=p.src,typeof p=="string"&&u&&typeof u!="function"&&typeof u!="symbol"?(u=pd(p),p=Pe(M).hoistableScripts,_=p.get(u),_||(_={type:"script",instance:null,count:0,state:null},p.set(u,_)),_):{type:"void",instance:null,count:0,state:null};default:throw Error(i(444,o))}}function hd(o){return'href="'+pn(o)+'"'}function jh(o){return'link[rel="stylesheet"]['+o+"]"}function gD(o){return h({},o,{"data-precedence":o.precedence,precedence:null})}function M9(o,u,p,_){o.querySelector('link[rel="preload"][as="style"]['+u+"]")?_.loading=1:(u=o.createElement("link"),_.preload=u,u.addEventListener("load",function(){return _.loading|=1}),u.addEventListener("error",function(){return _.loading|=2}),sr(u,"link",p),Re(u),o.head.appendChild(u))}function pd(o){return'[src="'+pn(o)+'"]'}function Hh(o){return"script[async]"+o}function vD(o,u,p){if(u.count++,u.instance===null)switch(u.type){case"style":var _=o.querySelector('style[data-href~="'+pn(p.href)+'"]');if(_)return u.instance=_,Re(_),_;var M=h({},p,{"data-href":p.href,"data-precedence":p.precedence,href:null,precedence:null});return _=(o.ownerDocument||o).createElement("style"),Re(_),sr(_,"style",M),qg(_,p.precedence,o),u.instance=_;case"stylesheet":M=hd(p.href);var D=o.querySelector(jh(M));if(D)return u.state.loading|=4,u.instance=D,Re(D),D;_=gD(p),(M=Da.get(M))&&dS(_,M),D=(o.ownerDocument||o).createElement("link"),Re(D);var j=D;return j._p=new Promise(function(te,Se){j.onload=te,j.onerror=Se}),sr(D,"link",_),u.state.loading|=4,qg(D,p.precedence,o),u.instance=D;case"script":return D=pd(p.src),(M=o.querySelector(Hh(D)))?(u.instance=M,Re(M),M):(_=p,(M=Da.get(D))&&(_=h({},p),fS(_,M)),o=o.ownerDocument||o,M=o.createElement("script"),Re(M),sr(M,"link",_),o.head.appendChild(M),u.instance=M);case"void":return null;default:throw Error(i(443,u.type))}else u.type==="stylesheet"&&(u.state.loading&4)===0&&(_=u.instance,u.state.loading|=4,qg(_,p.precedence,o));return u.instance}function qg(o,u,p){for(var _=p.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),M=_.length?_[_.length-1]:null,D=M,j=0;j<_.length;j++){var te=_[j];if(te.dataset.precedence===u)D=te;else if(D!==M)break}D?D.parentNode.insertBefore(o,D.nextSibling):(u=p.nodeType===9?p.head:p,u.insertBefore(o,u.firstChild))}function dS(o,u){o.crossOrigin==null&&(o.crossOrigin=u.crossOrigin),o.referrerPolicy==null&&(o.referrerPolicy=u.referrerPolicy),o.title==null&&(o.title=u.title)}function fS(o,u){o.crossOrigin==null&&(o.crossOrigin=u.crossOrigin),o.referrerPolicy==null&&(o.referrerPolicy=u.referrerPolicy),o.integrity==null&&(o.integrity=u.integrity)}var Yg=null;function xD(o,u,p){if(Yg===null){var _=new Map,M=Yg=new Map;M.set(p,_)}else M=Yg,_=M.get(p),_||(_=new Map,M.set(p,_));if(_.has(o))return _;for(_.set(o,null),p=p.getElementsByTagName(o),M=0;M<p.length;M++){var D=p[M];if(!(D[qe]||D[Wn]||o==="link"&&D.getAttribute("rel")==="stylesheet")&&D.namespaceURI!=="http://www.w3.org/2000/svg"){var j=D.getAttribute(u)||"";j=o+j;var te=_.get(j);te?te.push(D):_.set(j,[D])}}return _}function yD(o,u,p){o=o.ownerDocument||o,o.head.insertBefore(p,u==="title"?o.querySelector("head > title"):null)}function A9(o,u,p){if(p===1||u.itemProp!=null)return!1;switch(o){case"meta":case"title":return!0;case"style":if(typeof u.precedence!="string"||typeof u.href!="string"||u.href==="")break;return!0;case"link":if(typeof u.rel!="string"||typeof u.href!="string"||u.href===""||u.onLoad||u.onError)break;switch(u.rel){case"stylesheet":return o=u.disabled,typeof u.precedence=="string"&&o==null;default:return!0}case"script":if(u.async&&typeof u.async!="function"&&typeof u.async!="symbol"&&!u.onLoad&&!u.onError&&u.src&&typeof u.src=="string")return!0}return!1}function bD(o){return!(o.type==="stylesheet"&&(o.state.loading&3)===0)}function T9(o,u,p,_){if(p.type==="stylesheet"&&(typeof _.media!="string"||matchMedia(_.media).matches!==!1)&&(p.state.loading&4)===0){if(p.instance===null){var M=hd(_.href),D=u.querySelector(jh(M));if(D){u=D._p,u!==null&&typeof u=="object"&&typeof u.then=="function"&&(o.count++,o=Kg.bind(o),u.then(o,o)),p.state.loading|=4,p.instance=D,Re(D);return}D=u.ownerDocument||u,_=gD(_),(M=Da.get(M))&&dS(_,M),D=D.createElement("link"),Re(D);var j=D;j._p=new Promise(function(te,Se){j.onload=te,j.onerror=Se}),sr(D,"link",_),p.instance=D}o.stylesheets===null&&(o.stylesheets=new Map),o.stylesheets.set(p,u),(u=p.state.preload)&&(p.state.loading&3)===0&&(o.count++,p=Kg.bind(o),u.addEventListener("load",p),u.addEventListener("error",p))}}var hS=0;function C9(o,u){return o.stylesheets&&o.count===0&&Qg(o,o.stylesheets),0<o.count||0<o.imgCount?function(p){var _=setTimeout(function(){if(o.stylesheets&&Qg(o,o.stylesheets),o.unsuspend){var D=o.unsuspend;o.unsuspend=null,D()}},6e4+u);0<o.imgBytes&&hS===0&&(hS=62500*l9());var M=setTimeout(function(){if(o.waitingForImages=!1,o.count===0&&(o.stylesheets&&Qg(o,o.stylesheets),o.unsuspend)){var D=o.unsuspend;o.unsuspend=null,D()}},(o.imgBytes>hS?50:800)+u);return o.unsuspend=p,function(){o.unsuspend=null,clearTimeout(_),clearTimeout(M)}}:null}function Kg(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Qg(this,this.stylesheets);else if(this.unsuspend){var o=this.unsuspend;this.unsuspend=null,o()}}}var Zg=null;function Qg(o,u){o.stylesheets=null,o.unsuspend!==null&&(o.count++,Zg=new Map,u.forEach(R9,o),Zg=null,Kg.call(o))}function R9(o,u){if(!(u.state.loading&4)){var p=Zg.get(o);if(p)var _=p.get(null);else{p=new Map,Zg.set(o,p);for(var M=o.querySelectorAll("link[data-precedence],style[data-precedence]"),D=0;D<M.length;D++){var j=M[D];(j.nodeName==="LINK"||j.getAttribute("media")!=="not all")&&(p.set(j.dataset.precedence,j),_=j)}_&&p.set(null,_)}M=u.instance,j=M.getAttribute("data-precedence"),D=p.get(j)||_,D===_&&p.set(null,M),p.set(j,M),this.count++,_=Kg.bind(this),M.addEventListener("load",_),M.addEventListener("error",_),D?D.parentNode.insertBefore(M,D.nextSibling):(o=o.nodeType===9?o.head:o,o.insertBefore(M,o.firstChild)),u.state.loading|=4}}var Gh={$$typeof:S,Provider:null,Consumer:null,_currentValue:Y,_currentValue2:Y,_threadCount:0};function P9(o,u,p,_,M,D,j,te,Se){this.tag=1,this.containerInfo=o,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=wt(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=wt(0),this.hiddenUpdates=wt(null),this.identifierPrefix=_,this.onUncaughtError=M,this.onCaughtError=D,this.onRecoverableError=j,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=Se,this.incompleteTransitions=new Map}function _D(o,u,p,_,M,D,j,te,Se,ze,Qe,it){return o=new P9(o,u,p,j,Se,ze,Qe,it,te),u=1,D===!0&&(u|=24),D=ra(3,null,null,u),o.current=D,D.stateNode=o,u=Wb(),u.refCount++,o.pooledCache=u,u.refCount++,D.memoizedState={element:_,isDehydrated:p,cache:u},Kb(D),o}function SD(o){return o?(o=$u,o):$u}function wD(o,u,p,_,M,D){M=SD(M),_.context===null?_.context=M:_.pendingContext=M,_=pl(u),_.payload={element:p},D=D===void 0?null:D,D!==null&&(_.callback=D),p=ml(o,_,u),p!==null&&(Vr(p,o,u),_h(p,o,u))}function ED(o,u){if(o=o.memoizedState,o!==null&&o.dehydrated!==null){var p=o.retryLane;o.retryLane=p!==0&&p<u?p:u}}function pS(o,u){ED(o,u),(o=o.alternate)&&ED(o,u)}function MD(o){if(o.tag===13||o.tag===31){var u=Sc(o,67108864);u!==null&&Vr(u,o,67108864),pS(o,67108864)}}function AD(o){if(o.tag===13||o.tag===31){var u=ca();u=wi(u);var p=Sc(o,u);p!==null&&Vr(p,o,u),pS(o,u)}}var Jg=!0;function D9(o,u,p,_){var M=X.T;X.T=null;var D=V.p;try{V.p=2,mS(o,u,p,_)}finally{V.p=D,X.T=M}}function N9(o,u,p,_){var M=X.T;X.T=null;var D=V.p;try{V.p=8,mS(o,u,p,_)}finally{V.p=D,X.T=M}}function mS(o,u,p,_){if(Jg){var M=gS(_);if(M===null)tS(o,u,_,e0,p),CD(o,_);else if(L9(M,o,u,p,_))_.stopPropagation();else if(CD(o,_),u&4&&-1<O9.indexOf(o)){for(;M!==null;){var D=Z(M);if(D!==null)switch(D.tag){case 3:if(D=D.stateNode,D.current.memoizedState.isDehydrated){var j=Me(D.pendingLanes);if(j!==0){var te=D;for(te.pendingLanes|=2,te.entangledLanes|=2;j;){var Se=1<<31-et(j);te.entanglements[1]|=Se,j&=~Se}Cs(D),(hn&6)===0&&(Ug=O()+500,kh(0))}}break;case 31:case 13:te=Sc(D,2),te!==null&&Vr(te,D,2),Fg(),pS(D,2)}if(D=gS(_),D===null&&tS(o,u,_,e0,p),D===M)break;M=D}M!==null&&_.stopPropagation()}else tS(o,u,_,null,p)}}function gS(o){return o=xb(o),vS(o)}var e0=null;function vS(o){if(e0=null,o=gt(o),o!==null){var u=a(o);if(u===null)o=null;else{var p=u.tag;if(p===13){if(o=s(u),o!==null)return o;o=null}else if(p===31){if(o=l(u),o!==null)return o;o=null}else if(p===3){if(u.stateNode.current.memoizedState.isDehydrated)return u.tag===3?u.stateNode.containerInfo:null;o=null}else u!==o&&(o=null)}}return e0=o,null}function TD(o){switch(o){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(K()){case pe:return 2;case xe:return 8;case fe:case Ke:return 32;case Ie:return 268435456;default:return 32}default:return 32}}var xS=!1,Al=null,Tl=null,Cl=null,Vh=new Map,$h=new Map,Rl=[],O9="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function CD(o,u){switch(o){case"focusin":case"focusout":Al=null;break;case"dragenter":case"dragleave":Tl=null;break;case"mouseover":case"mouseout":Cl=null;break;case"pointerover":case"pointerout":Vh.delete(u.pointerId);break;case"gotpointercapture":case"lostpointercapture":$h.delete(u.pointerId)}}function Wh(o,u,p,_,M,D){return o===null||o.nativeEvent!==D?(o={blockedOn:u,domEventName:p,eventSystemFlags:_,nativeEvent:D,targetContainers:[M]},u!==null&&(u=Z(u),u!==null&&MD(u)),o):(o.eventSystemFlags|=_,u=o.targetContainers,M!==null&&u.indexOf(M)===-1&&u.push(M),o)}function L9(o,u,p,_,M){switch(u){case"focusin":return Al=Wh(Al,o,u,p,_,M),!0;case"dragenter":return Tl=Wh(Tl,o,u,p,_,M),!0;case"mouseover":return Cl=Wh(Cl,o,u,p,_,M),!0;case"pointerover":var D=M.pointerId;return Vh.set(D,Wh(Vh.get(D)||null,o,u,p,_,M)),!0;case"gotpointercapture":return D=M.pointerId,$h.set(D,Wh($h.get(D)||null,o,u,p,_,M)),!0}return!1}function RD(o){var u=gt(o.target);if(u!==null){var p=a(u);if(p!==null){if(u=p.tag,u===13){if(u=s(p),u!==null){o.blockedOn=u,mr(o.priority,function(){AD(p)});return}}else if(u===31){if(u=l(p),u!==null){o.blockedOn=u,mr(o.priority,function(){AD(p)});return}}else if(u===3&&p.stateNode.current.memoizedState.isDehydrated){o.blockedOn=p.tag===3?p.stateNode.containerInfo:null;return}}}o.blockedOn=null}function t0(o){if(o.blockedOn!==null)return!1;for(var u=o.targetContainers;0<u.length;){var p=gS(o.nativeEvent);if(p===null){p=o.nativeEvent;var _=new p.constructor(p.type,p);vb=_,p.target.dispatchEvent(_),vb=null}else return u=Z(p),u!==null&&MD(u),o.blockedOn=p,!1;u.shift()}return!0}function PD(o,u,p){t0(o)&&p.delete(u)}function I9(){xS=!1,Al!==null&&t0(Al)&&(Al=null),Tl!==null&&t0(Tl)&&(Tl=null),Cl!==null&&t0(Cl)&&(Cl=null),Vh.forEach(PD),$h.forEach(PD)}function n0(o,u){o.blockedOn===u&&(o.blockedOn=null,xS||(xS=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,I9)))}var i0=null;function DD(o){i0!==o&&(i0=o,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){i0===o&&(i0=null);for(var u=0;u<o.length;u+=3){var p=o[u],_=o[u+1],M=o[u+2];if(typeof _!="function"){if(vS(_||p)===null)continue;break}var D=Z(p);D!==null&&(o.splice(u,3),u-=3,g_(D,{pending:!0,data:M,method:p.method,action:_},_,M))}}))}function md(o){function u(Se){return n0(Se,o)}Al!==null&&n0(Al,o),Tl!==null&&n0(Tl,o),Cl!==null&&n0(Cl,o),Vh.forEach(u),$h.forEach(u);for(var p=0;p<Rl.length;p++){var _=Rl[p];_.blockedOn===o&&(_.blockedOn=null)}for(;0<Rl.length&&(p=Rl[0],p.blockedOn===null);)RD(p),p.blockedOn===null&&Rl.shift();if(p=(o.ownerDocument||o).$$reactFormReplay,p!=null)for(_=0;_<p.length;_+=3){var M=p[_],D=p[_+1],j=M[ei]||null;if(typeof D=="function")j||DD(p);else if(j){var te=null;if(D&&D.hasAttribute("formAction")){if(M=D,j=D[ei]||null)te=j.formAction;else if(vS(M)!==null)continue}else te=j.action;typeof te=="function"?p[_+1]=te:(p.splice(_,3),_-=3),DD(p)}}}function ND(){function o(D){D.canIntercept&&D.info==="react-transition"&&D.intercept({handler:function(){return new Promise(function(j){return M=j})},focusReset:"manual",scroll:"manual"})}function u(){M!==null&&(M(),M=null),_||setTimeout(p,20)}function p(){if(!_&&!navigation.transition){var D=navigation.currentEntry;D&&D.url!=null&&navigation.navigate(D.url,{state:D.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var _=!1,M=null;return navigation.addEventListener("navigate",o),navigation.addEventListener("navigatesuccess",u),navigation.addEventListener("navigateerror",u),setTimeout(p,100),function(){_=!0,navigation.removeEventListener("navigate",o),navigation.removeEventListener("navigatesuccess",u),navigation.removeEventListener("navigateerror",u),M!==null&&(M(),M=null)}}}function yS(o){this._internalRoot=o}r0.prototype.render=yS.prototype.render=function(o){var u=this._internalRoot;if(u===null)throw Error(i(409));var p=u.current,_=ca();wD(p,_,o,u,null,null)},r0.prototype.unmount=yS.prototype.unmount=function(){var o=this._internalRoot;if(o!==null){this._internalRoot=null;var u=o.containerInfo;wD(o.current,2,null,o,null,null),Fg(),u[Ja]=null}};function r0(o){this._internalRoot=o}r0.prototype.unstable_scheduleHydration=function(o){if(o){var u=tr();o={blockedOn:null,target:o,priority:u};for(var p=0;p<Rl.length&&u!==0&&u<Rl[p].priority;p++);Rl.splice(p,0,o),p===0&&RD(o)}};var OD=e.version;if(OD!=="19.2.0")throw Error(i(527,OD,"19.2.0"));V.findDOMNode=function(o){var u=o._reactInternals;if(u===void 0)throw typeof o.render=="function"?Error(i(188)):(o=Object.keys(o).join(","),Error(i(268,o)));return o=d(u),o=o!==null?f(o):null,o=o===null?null:o.stateNode,o};var U9={bundleType:0,version:"19.2.0",rendererPackageName:"react-dom",currentDispatcherRef:X,reconcilerVersion:"19.2.0"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var a0=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!a0.isDisabled&&a0.supportsFiber)try{ke=a0.inject(U9),De=a0}catch{}}return qh.createRoot=function(o,u){if(!r(o))throw Error(i(299));var p=!1,_="",M=BR,D=jR,j=HR;return u!=null&&(u.unstable_strictMode===!0&&(p=!0),u.identifierPrefix!==void 0&&(_=u.identifierPrefix),u.onUncaughtError!==void 0&&(M=u.onUncaughtError),u.onCaughtError!==void 0&&(D=u.onCaughtError),u.onRecoverableError!==void 0&&(j=u.onRecoverableError)),u=_D(o,1,!1,null,null,p,_,null,M,D,j,ND),o[Ja]=u.current,eS(o),new yS(u)},qh.hydrateRoot=function(o,u,p){if(!r(o))throw Error(i(299));var _=!1,M="",D=BR,j=jR,te=HR,Se=null;return p!=null&&(p.unstable_strictMode===!0&&(_=!0),p.identifierPrefix!==void 0&&(M=p.identifierPrefix),p.onUncaughtError!==void 0&&(D=p.onUncaughtError),p.onCaughtError!==void 0&&(j=p.onCaughtError),p.onRecoverableError!==void 0&&(te=p.onRecoverableError),p.formState!==void 0&&(Se=p.formState)),u=_D(o,1,!0,u,p??null,_,M,Se,D,j,te,ND),u.context=SD(null),p=u.current,_=ca(),_=wi(_),M=pl(_),M.callback=null,ml(p,M,_),p=_,u.current.lanes=p,Wt(u,p),Cs(u),o[Ja]=u.current,eS(o),new r0(u)},qh.version="19.2.0",qh}var GD;function X9(){if(GD)return SS.exports;GD=1;function t(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(e){console.error(e)}}return t(),SS.exports=W9(),SS.exports}var q9=X9();var VD="popstate";function Y9(t={}){function e(i,r){let{pathname:a,search:s,hash:l}=i.location;return LE("",{pathname:a,search:s,hash:l},r.state&&r.state.usr||null,r.state&&r.state.key||"default")}function n(i,r){return typeof r=="string"?r:Lp(r)}return Z9(e,n,null,t)}function Xn(t,e){if(t===!1||t===null||typeof t>"u")throw new Error(e)}function ys(t,e){if(!t){typeof console<"u"&&console.warn(e);try{throw new Error(e)}catch{}}}function K9(){return Math.random().toString(36).substring(2,10)}function $D(t,e){return{usr:t.state,key:t.key,idx:e}}function LE(t,e,n=null,i){return{pathname:typeof t=="string"?t:t.pathname,search:"",hash:"",...typeof e=="string"?Uf(e):e,state:n,key:e&&e.key||i||K9()}}function Lp({pathname:t="/",search:e="",hash:n=""}){return e&&e!=="?"&&(t+=e.charAt(0)==="?"?e:"?"+e),n&&n!=="#"&&(t+=n.charAt(0)==="#"?n:"#"+n),t}function Uf(t){let e={};if(t){let n=t.indexOf("#");n>=0&&(e.hash=t.substring(n),t=t.substring(0,n));let i=t.indexOf("?");i>=0&&(e.search=t.substring(i),t=t.substring(0,i)),t&&(e.pathname=t)}return e}function Z9(t,e,n,i={}){let{window:r=document.defaultView,v5Compat:a=!1}=i,s=r.history,l="POP",c=null,d=f();d==null&&(d=0,s.replaceState({...s.state,idx:d},""));function f(){return(s.state||{idx:null}).idx}function h(){l="POP";let x=f(),v=x==null?null:x-d;d=x,c&&c({action:l,location:y.location,delta:v})}function g(x,v){l="PUSH";let w=LE(y.location,x,v);d=f()+1;let S=$D(w,d),A=y.createHref(w);try{s.pushState(S,"",A)}catch(R){if(R instanceof DOMException&&R.name==="DataCloneError")throw R;r.location.assign(A)}a&&c&&c({action:l,location:y.location,delta:1})}function m(x,v){l="REPLACE";let w=LE(y.location,x,v);d=f();let S=$D(w,d),A=y.createHref(w);s.replaceState(S,"",A),a&&c&&c({action:l,location:y.location,delta:0})}function b(x){return Q9(x)}let y={get action(){return l},get location(){return t(r,s)},listen(x){if(c)throw new Error("A history only accepts one active listener");return r.addEventListener(VD,h),c=x,()=>{r.removeEventListener(VD,h),c=null}},createHref(x){return e(r,x)},createURL:b,encodeLocation(x){let v=b(x);return{pathname:v.pathname,search:v.search,hash:v.hash}},push:g,replace:m,go(x){return s.go(x)}};return y}function Q9(t,e=!1){let n="http://localhost";typeof window<"u"&&(n=window.location.origin!=="null"?window.location.origin:window.location.href),Xn(n,"No window.location.(origin|href) available to create URL");let i=typeof t=="string"?t:Lp(t);return i=i.replace(/ $/,"%20"),!e&&i.startsWith("//")&&(i=n+i),new URL(i,n)}function J4(t,e,n="/"){return J9(t,e,n,!1)}function J9(t,e,n,i){let r=typeof e=="string"?Uf(e):e,a=Vo(r.pathname||"/",n);if(a==null)return null;let s=ez(t);e$(s);let l=null;for(let c=0;l==null&&c<s.length;++c){let d=d$(a);l=c$(s[c],d,i)}return l}function ez(t,e=[],n=[],i="",r=!1){let a=(s,l,c=r,d)=>{let f={relativePath:d===void 0?s.path||"":d,caseSensitive:s.caseSensitive===!0,childrenIndex:l,route:s};if(f.relativePath.startsWith("/")){if(!f.relativePath.startsWith(i)&&c)return;Xn(f.relativePath.startsWith(i),`Absolute route path "${f.relativePath}" nested under path "${i}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),f.relativePath=f.relativePath.slice(i.length)}let h=Fo([i,f.relativePath]),g=n.concat(f);s.children&&s.children.length>0&&(Xn(s.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${h}".`),ez(s.children,e,g,h,c)),!(s.path==null&&!s.index)&&e.push({path:h,score:o$(h,s.index),routesMeta:g})};return t.forEach((s,l)=>{if(s.path===""||!s.path?.includes("?"))a(s,l);else for(let c of tz(s.path))a(s,l,!0,c)}),e}function tz(t){let e=t.split("/");if(e.length===0)return[];let[n,...i]=e,r=n.endsWith("?"),a=n.replace(/\?$/,"");if(i.length===0)return r?[a,""]:[a];let s=tz(i.join("/")),l=[];return l.push(...s.map(c=>c===""?a:[a,c].join("/"))),r&&l.push(...s),l.map(c=>t.startsWith("/")&&c===""?"/":c)}function e$(t){t.sort((e,n)=>e.score!==n.score?n.score-e.score:l$(e.routesMeta.map(i=>i.childrenIndex),n.routesMeta.map(i=>i.childrenIndex)))}var t$=/^:[\w-]+$/,n$=3,i$=2,r$=1,a$=10,s$=-2,WD=t=>t==="*";function o$(t,e){let n=t.split("/"),i=n.length;return n.some(WD)&&(i+=s$),e&&(i+=i$),n.filter(r=>!WD(r)).reduce((r,a)=>r+(t$.test(a)?n$:a===""?r$:a$),i)}function l$(t,e){return t.length===e.length&&t.slice(0,-1).every((i,r)=>i===e[r])?t[t.length-1]-e[e.length-1]:0}function c$(t,e,n=!1){let{routesMeta:i}=t,r={},a="/",s=[];for(let l=0;l<i.length;++l){let c=i[l],d=l===i.length-1,f=a==="/"?e:e.slice(a.length)||"/",h=$v({path:c.relativePath,caseSensitive:c.caseSensitive,end:d},f),g=c.route;if(!h&&d&&n&&!i[i.length-1].route.index&&(h=$v({path:c.relativePath,caseSensitive:c.caseSensitive,end:!1},f)),!h)return null;Object.assign(r,h.params),s.push({params:r,pathname:Fo([a,h.pathname]),pathnameBase:g$(Fo([a,h.pathnameBase])),route:g}),h.pathnameBase!=="/"&&(a=Fo([a,h.pathnameBase]))}return s}function $v(t,e){typeof t=="string"&&(t={path:t,caseSensitive:!1,end:!0});let[n,i]=u$(t.path,t.caseSensitive,t.end),r=e.match(n);if(!r)return null;let a=r[0],s=a.replace(/(.)\/+$/,"$1"),l=r.slice(1);return{params:i.reduce((d,{paramName:f,isOptional:h},g)=>{if(f==="*"){let b=l[g]||"";s=a.slice(0,a.length-b.length).replace(/(.)\/+$/,"$1")}const m=l[g];return h&&!m?d[f]=void 0:d[f]=(m||"").replace(/%2F/g,"/"),d},{}),pathname:a,pathnameBase:s,pattern:t}}function u$(t,e=!1,n=!0){ys(t==="*"||!t.endsWith("*")||t.endsWith("/*"),`Route path "${t}" will be treated as if it were "${t.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${t.replace(/\*$/,"/*")}".`);let i=[],r="^"+t.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(s,l,c)=>(i.push({paramName:l,isOptional:c!=null}),c?"/?([^\\/]+)?":"/([^\\/]+)")).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return t.endsWith("*")?(i.push({paramName:"*"}),r+=t==="*"||t==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?r+="\\/*$":t!==""&&t!=="/"&&(r+="(?:(?=\\/|$))"),[new RegExp(r,e?void 0:"i"),i]}function d$(t){try{return t.split("/").map(e=>decodeURIComponent(e).replace(/\//g,"%2F")).join("/")}catch(e){return ys(!1,`The URL path "${t}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${e}).`),t}}function Vo(t,e){if(e==="/")return t;if(!t.toLowerCase().startsWith(e.toLowerCase()))return null;let n=e.endsWith("/")?e.length-1:e.length,i=t.charAt(n);return i&&i!=="/"?null:t.slice(n)||"/"}var f$=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,h$=t=>f$.test(t);function p$(t,e="/"){let{pathname:n,search:i="",hash:r=""}=typeof t=="string"?Uf(t):t,a;if(n)if(h$(n))a=n;else{if(n.includes("//")){let s=n;n=n.replace(/\/\/+/g,"/"),ys(!1,`Pathnames cannot have embedded double slashes - normalizing ${s} -> ${n}`)}n.startsWith("/")?a=XD(n.substring(1),"/"):a=XD(n,e)}else a=e;return{pathname:a,search:v$(i),hash:x$(r)}}function XD(t,e){let n=e.replace(/\/+$/,"").split("/");return t.split("/").forEach(r=>{r===".."?n.length>1&&n.pop():r!=="."&&n.push(r)}),n.length>1?n.join("/"):"/"}function AS(t,e,n,i){return`Cannot include a '${t}' character in a manually specified \`to.${e}\` field [${JSON.stringify(i)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function m$(t){return t.filter((e,n)=>n===0||e.route.path&&e.route.path.length>0)}function nz(t){let e=m$(t);return e.map((n,i)=>i===e.length-1?n.pathname:n.pathnameBase)}function iz(t,e,n,i=!1){let r;typeof t=="string"?r=Uf(t):(r={...t},Xn(!r.pathname||!r.pathname.includes("?"),AS("?","pathname","search",r)),Xn(!r.pathname||!r.pathname.includes("#"),AS("#","pathname","hash",r)),Xn(!r.search||!r.search.includes("#"),AS("#","search","hash",r)));let a=t===""||r.pathname==="",s=a?"/":r.pathname,l;if(s==null)l=n;else{let h=e.length-1;if(!i&&s.startsWith("..")){let g=s.split("/");for(;g[0]==="..";)g.shift(),h-=1;r.pathname=g.join("/")}l=h>=0?e[h]:"/"}let c=p$(r,l),d=s&&s!=="/"&&s.endsWith("/"),f=(a||s===".")&&n.endsWith("/");return!c.pathname.endsWith("/")&&(d||f)&&(c.pathname+="/"),c}var Fo=t=>t.join("/").replace(/\/\/+/g,"/"),g$=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),v$=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,x$=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t;function y$(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var rz=["POST","PUT","PATCH","DELETE"];new Set(rz);var b$=["GET",...rz];new Set(b$);var kf=T.createContext(null);kf.displayName="DataRouter";var cy=T.createContext(null);cy.displayName="DataRouterState";T.createContext(!1);var az=T.createContext({isTransitioning:!1});az.displayName="ViewTransition";var _$=T.createContext(new Map);_$.displayName="Fetchers";var S$=T.createContext(null);S$.displayName="Await";var qs=T.createContext(null);qs.displayName="Navigation";var pm=T.createContext(null);pm.displayName="Location";var Ys=T.createContext({outlet:null,matches:[],isDataRoute:!1});Ys.displayName="Route";var nT=T.createContext(null);nT.displayName="RouteError";function w$(t,{relative:e}={}){Xn(mm(),"useHref() may be used only in the context of a <Router> component.");let{basename:n,navigator:i}=T.useContext(qs),{hash:r,pathname:a,search:s}=gm(t,{relative:e}),l=a;return n!=="/"&&(l=a==="/"?n:Fo([n,a])),i.createHref({pathname:l,search:s,hash:r})}function mm(){return T.useContext(pm)!=null}function Ou(){return Xn(mm(),"useLocation() may be used only in the context of a <Router> component."),T.useContext(pm).location}var sz="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function oz(t){T.useContext(qs).static||T.useLayoutEffect(t)}function lz(){let{isDataRoute:t}=T.useContext(Ys);return t?F$():E$()}function E$(){Xn(mm(),"useNavigate() may be used only in the context of a <Router> component.");let t=T.useContext(kf),{basename:e,navigator:n}=T.useContext(qs),{matches:i}=T.useContext(Ys),{pathname:r}=Ou(),a=JSON.stringify(nz(i)),s=T.useRef(!1);return oz(()=>{s.current=!0}),T.useCallback((c,d={})=>{if(ys(s.current,sz),!s.current)return;if(typeof c=="number"){n.go(c);return}let f=iz(c,JSON.parse(a),r,d.relative==="path");t==null&&e!=="/"&&(f.pathname=f.pathname==="/"?e:Fo([e,f.pathname])),(d.replace?n.replace:n.push)(f,d.state,d)},[e,n,a,r,t])}var M$=T.createContext(null);function A$(t){let e=T.useContext(Ys).outlet;return T.useMemo(()=>e&&T.createElement(M$.Provider,{value:t},e),[e,t])}function gm(t,{relative:e}={}){let{matches:n}=T.useContext(Ys),{pathname:i}=Ou(),r=JSON.stringify(nz(n));return T.useMemo(()=>iz(t,JSON.parse(r),i,e==="path"),[t,r,i,e])}function T$(t,e){return cz(t,e)}function cz(t,e,n,i,r){Xn(mm(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:a}=T.useContext(qs),{matches:s}=T.useContext(Ys),l=s[s.length-1],c=l?l.params:{},d=l?l.pathname:"/",f=l?l.pathnameBase:"/",h=l&&l.route;{let w=h&&h.path||"";uz(d,!h||w.endsWith("*")||w.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${d}" (under <Route path="${w}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
  10. Please change the parent <Route path="${w}"> to <Route path="${w==="/"?"*":`${w}/*`}">.`)}let g=Ou(),m;if(e){let w=typeof e=="string"?Uf(e):e;Xn(f==="/"||w.pathname?.startsWith(f),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${f}" but pathname "${w.pathname}" was given in the \`location\` prop.`),m=w}else m=g;let b=m.pathname||"/",y=b;if(f!=="/"){let w=f.replace(/^\//,"").split("/");y="/"+b.replace(/^\//,"").split("/").slice(w.length).join("/")}let x=J4(t,{pathname:y});ys(h||x!=null,`No routes matched location "${m.pathname}${m.search}${m.hash}" `),ys(x==null||x[x.length-1].route.element!==void 0||x[x.length-1].route.Component!==void 0||x[x.length-1].route.lazy!==void 0,`Matched leaf route at location "${m.pathname}${m.search}${m.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let v=N$(x&&x.map(w=>Object.assign({},w,{params:Object.assign({},c,w.params),pathname:Fo([f,a.encodeLocation?a.encodeLocation(w.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:w.pathname]),pathnameBase:w.pathnameBase==="/"?f:Fo([f,a.encodeLocation?a.encodeLocation(w.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:w.pathnameBase])})),s,n,i,r);return e&&v?T.createElement(pm.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",...m},navigationType:"POP"}},v):v}function C$(){let t=k$(),e=y$(t)?`${t.status} ${t.statusText}`:t instanceof Error?t.message:JSON.stringify(t),n=t instanceof Error?t.stack:null,i="rgba(200,200,200, 0.5)",r={padding:"0.5rem",backgroundColor:i},a={padding:"2px 4px",backgroundColor:i},s=null;return console.error("Error handled by React Router default ErrorBoundary:",t),s=T.createElement(T.Fragment,null,T.createElement("p",null,"💿 Hey developer 👋"),T.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",T.createElement("code",{style:a},"ErrorBoundary")," or"," ",T.createElement("code",{style:a},"errorElement")," prop on your route.")),T.createElement(T.Fragment,null,T.createElement("h2",null,"Unexpected Application Error!"),T.createElement("h3",{style:{fontStyle:"italic"}},e),n?T.createElement("pre",{style:r},n):null,s)}var R$=T.createElement(C$,null),P$=class extends T.Component{constructor(t){super(t),this.state={location:t.location,revalidation:t.revalidation,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,e){return e.location!==t.location||e.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:e.error,location:e.location,revalidation:t.revalidation||e.revalidation}}componentDidCatch(t,e){this.props.onError?this.props.onError(t,e):console.error("React Router caught the following error during render",t)}render(){return this.state.error!==void 0?T.createElement(Ys.Provider,{value:this.props.routeContext},T.createElement(nT.Provider,{value:this.state.error,children:this.props.component})):this.props.children}};function D$({routeContext:t,match:e,children:n}){let i=T.useContext(kf);return i&&i.static&&i.staticContext&&(e.route.errorElement||e.route.ErrorBoundary)&&(i.staticContext._deepestRenderedBoundaryId=e.route.id),T.createElement(Ys.Provider,{value:t},n)}function N$(t,e=[],n=null,i=null,r=null){if(t==null){if(!n)return null;if(n.errors)t=n.matches;else if(e.length===0&&!n.initialized&&n.matches.length>0)t=n.matches;else return null}let a=t,s=n?.errors;if(s!=null){let f=a.findIndex(h=>h.route.id&&s?.[h.route.id]!==void 0);Xn(f>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(s).join(",")}`),a=a.slice(0,Math.min(a.length,f+1))}let l=!1,c=-1;if(n)for(let f=0;f<a.length;f++){let h=a[f];if((h.route.HydrateFallback||h.route.hydrateFallbackElement)&&(c=f),h.route.id){let{loaderData:g,errors:m}=n,b=h.route.loader&&!g.hasOwnProperty(h.route.id)&&(!m||m[h.route.id]===void 0);if(h.route.lazy||b){l=!0,c>=0?a=a.slice(0,c+1):a=[a[0]];break}}}let d=n&&i?(f,h)=>{i(f,{location:n.location,params:n.matches?.[0]?.params??{},errorInfo:h})}:void 0;return a.reduceRight((f,h,g)=>{let m,b=!1,y=null,x=null;n&&(m=s&&h.route.id?s[h.route.id]:void 0,y=h.route.errorElement||R$,l&&(c<0&&g===0?(uz("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),b=!0,x=null):c===g&&(b=!0,x=h.route.hydrateFallbackElement||null)));let v=e.concat(a.slice(0,g+1)),w=()=>{let S;return m?S=y:b?S=x:h.route.Component?S=T.createElement(h.route.Component,null):h.route.element?S=h.route.element:S=f,T.createElement(D$,{match:h,routeContext:{outlet:f,matches:v,isDataRoute:n!=null},children:S})};return n&&(h.route.ErrorBoundary||h.route.errorElement||g===0)?T.createElement(P$,{location:n.location,revalidation:n.revalidation,component:y,error:m,children:w(),routeContext:{outlet:null,matches:v,isDataRoute:!0},onError:d}):w()},null)}function iT(t){return`${t} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function O$(t){let e=T.useContext(kf);return Xn(e,iT(t)),e}function L$(t){let e=T.useContext(cy);return Xn(e,iT(t)),e}function I$(t){let e=T.useContext(Ys);return Xn(e,iT(t)),e}function rT(t){let e=I$(t),n=e.matches[e.matches.length-1];return Xn(n.route.id,`${t} can only be used on routes that contain a unique "id"`),n.route.id}function U$(){return rT("useRouteId")}function k$(){let t=T.useContext(nT),e=L$("useRouteError"),n=rT("useRouteError");return t!==void 0?t:e.errors?.[n]}function F$(){let{router:t}=O$("useNavigate"),e=rT("useNavigate"),n=T.useRef(!1);return oz(()=>{n.current=!0}),T.useCallback(async(r,a={})=>{ys(n.current,sz),n.current&&(typeof r=="number"?t.navigate(r):await t.navigate(r,{fromRouteId:e,...a}))},[t,e])}var qD={};function uz(t,e,n){!e&&!qD[t]&&(qD[t]=!0,ys(!1,n))}T.memo(z$);function z$({routes:t,future:e,state:n,unstable_onError:i}){return cz(t,void 0,n,i,e)}function B$(t){return A$(t.context)}function Wc(t){Xn(!1,"A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.")}function j$({basename:t="/",children:e=null,location:n,navigationType:i="POP",navigator:r,static:a=!1}){Xn(!mm(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let s=t.replace(/^\/*/,"/"),l=T.useMemo(()=>({basename:s,navigator:r,static:a,future:{}}),[s,r,a]);typeof n=="string"&&(n=Uf(n));let{pathname:c="/",search:d="",hash:f="",state:h=null,key:g="default"}=n,m=T.useMemo(()=>{let b=Vo(c,s);return b==null?null:{location:{pathname:b,search:d,hash:f,state:h,key:g},navigationType:i}},[s,c,d,f,h,g,i]);return ys(m!=null,`<Router basename="${s}"> is not able to match the URL "${c}${d}${f}" because it does not start with the basename, so the <Router> won't render anything.`),m==null?null:T.createElement(qs.Provider,{value:l},T.createElement(pm.Provider,{children:e,value:m}))}function H$({children:t,location:e}){return T$(IE(t),e)}function IE(t,e=[]){let n=[];return T.Children.forEach(t,(i,r)=>{if(!T.isValidElement(i))return;let a=[...e,r];if(i.type===T.Fragment){n.push.apply(n,IE(i.props.children,a));return}Xn(i.type===Wc,`[${typeof i.type=="string"?i.type:i.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),Xn(!i.props.index||!i.props.children,"An index route cannot have child routes.");let s={id:i.props.id||a.join("-"),caseSensitive:i.props.caseSensitive,element:i.props.element,Component:i.props.Component,index:i.props.index,path:i.props.path,middleware:i.props.middleware,loader:i.props.loader,action:i.props.action,hydrateFallbackElement:i.props.hydrateFallbackElement,HydrateFallback:i.props.HydrateFallback,errorElement:i.props.errorElement,ErrorBoundary:i.props.ErrorBoundary,hasErrorBoundary:i.props.hasErrorBoundary===!0||i.props.ErrorBoundary!=null||i.props.errorElement!=null,shouldRevalidate:i.props.shouldRevalidate,handle:i.props.handle,lazy:i.props.lazy};i.props.children&&(s.children=IE(i.props.children,a)),n.push(s)}),n}var Tv="get",Cv="application/x-www-form-urlencoded";function uy(t){return t!=null&&typeof t.tagName=="string"}function G$(t){return uy(t)&&t.tagName.toLowerCase()==="button"}function V$(t){return uy(t)&&t.tagName.toLowerCase()==="form"}function $$(t){return uy(t)&&t.tagName.toLowerCase()==="input"}function W$(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function X$(t,e){return t.button===0&&(!e||e==="_self")&&!W$(t)}var o0=null;function q$(){if(o0===null)try{new FormData(document.createElement("form"),0),o0=!1}catch{o0=!0}return o0}var Y$=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function TS(t){return t!=null&&!Y$.has(t)?(ys(!1,`"${t}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Cv}"`),null):t}function K$(t,e){let n,i,r,a,s;if(V$(t)){let l=t.getAttribute("action");i=l?Vo(l,e):null,n=t.getAttribute("method")||Tv,r=TS(t.getAttribute("enctype"))||Cv,a=new FormData(t)}else if(G$(t)||$$(t)&&(t.type==="submit"||t.type==="image")){let l=t.form;if(l==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let c=t.getAttribute("formaction")||l.getAttribute("action");if(i=c?Vo(c,e):null,n=t.getAttribute("formmethod")||l.getAttribute("method")||Tv,r=TS(t.getAttribute("formenctype"))||TS(l.getAttribute("enctype"))||Cv,a=new FormData(l,t),!q$()){let{name:d,type:f,value:h}=t;if(f==="image"){let g=d?`${d}.`:"";a.append(`${g}x`,"0"),a.append(`${g}y`,"0")}else d&&a.append(d,h)}}else{if(uy(t))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=Tv,i=null,r=Cv,s=t}return a&&r==="text/plain"&&(s=a,a=void 0),{action:i,method:n.toLowerCase(),encType:r,formData:a,body:s}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function aT(t,e){if(t===!1||t===null||typeof t>"u")throw new Error(e)}function Z$(t,e,n){let i=typeof t=="string"?new URL(t,typeof window>"u"?"server://singlefetch/":window.location.origin):t;return i.pathname==="/"?i.pathname=`_root.${n}`:e&&Vo(i.pathname,e)==="/"?i.pathname=`${e.replace(/\/$/,"")}/_root.${n}`:i.pathname=`${i.pathname.replace(/\/$/,"")}.${n}`,i}async function Q$(t,e){if(t.id in e)return e[t.id];try{let n=await import(t.module);return e[t.id]=n,n}catch(n){return console.error(`Error loading route module \`${t.module}\`, reloading page...`),console.error(n),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function J$(t){return t==null?!1:t.href==null?t.rel==="preload"&&typeof t.imageSrcSet=="string"&&typeof t.imageSizes=="string":typeof t.rel=="string"&&typeof t.href=="string"}async function e7(t,e,n){let i=await Promise.all(t.map(async r=>{let a=e.routes[r.route.id];if(a){let s=await Q$(a,n);return s.links?s.links():[]}return[]}));return r7(i.flat(1).filter(J$).filter(r=>r.rel==="stylesheet"||r.rel==="preload").map(r=>r.rel==="stylesheet"?{...r,rel:"prefetch",as:"style"}:{...r,rel:"prefetch"}))}function YD(t,e,n,i,r,a){let s=(c,d)=>n[d]?c.route.id!==n[d].route.id:!0,l=(c,d)=>n[d].pathname!==c.pathname||n[d].route.path?.endsWith("*")&&n[d].params["*"]!==c.params["*"];return a==="assets"?e.filter((c,d)=>s(c,d)||l(c,d)):a==="data"?e.filter((c,d)=>{let f=i.routes[c.route.id];if(!f||!f.hasLoader)return!1;if(s(c,d)||l(c,d))return!0;if(c.route.shouldRevalidate){let h=c.route.shouldRevalidate({currentUrl:new URL(r.pathname+r.search+r.hash,window.origin),currentParams:n[0]?.params||{},nextUrl:new URL(t,window.origin),nextParams:c.params,defaultShouldRevalidate:!0});if(typeof h=="boolean")return h}return!0}):[]}function t7(t,e,{includeHydrateFallback:n}={}){return n7(t.map(i=>{let r=e.routes[i.route.id];if(!r)return[];let a=[r.module];return r.clientActionModule&&(a=a.concat(r.clientActionModule)),r.clientLoaderModule&&(a=a.concat(r.clientLoaderModule)),n&&r.hydrateFallbackModule&&(a=a.concat(r.hydrateFallbackModule)),r.imports&&(a=a.concat(r.imports)),a}).flat(1))}function n7(t){return[...new Set(t)]}function i7(t){let e={},n=Object.keys(t).sort();for(let i of n)e[i]=t[i];return e}function r7(t,e){let n=new Set;return new Set(e),t.reduce((i,r)=>{let a=JSON.stringify(i7(r));return n.has(a)||(n.add(a),i.push({key:a,link:r})),i},[])}function dz(){let t=T.useContext(kf);return aT(t,"You must render this element inside a <DataRouterContext.Provider> element"),t}function a7(){let t=T.useContext(cy);return aT(t,"You must render this element inside a <DataRouterStateContext.Provider> element"),t}var sT=T.createContext(void 0);sT.displayName="FrameworkContext";function fz(){let t=T.useContext(sT);return aT(t,"You must render this element inside a <HydratedRouter> element"),t}function s7(t,e){let n=T.useContext(sT),[i,r]=T.useState(!1),[a,s]=T.useState(!1),{onFocus:l,onBlur:c,onMouseEnter:d,onMouseLeave:f,onTouchStart:h}=e,g=T.useRef(null);T.useEffect(()=>{if(t==="render"&&s(!0),t==="viewport"){let y=v=>{v.forEach(w=>{s(w.isIntersecting)})},x=new IntersectionObserver(y,{threshold:.5});return g.current&&x.observe(g.current),()=>{x.disconnect()}}},[t]),T.useEffect(()=>{if(i){let y=setTimeout(()=>{s(!0)},100);return()=>{clearTimeout(y)}}},[i]);let m=()=>{r(!0)},b=()=>{r(!1),s(!1)};return n?t!=="intent"?[a,g,{}]:[a,g,{onFocus:Yh(l,m),onBlur:Yh(c,b),onMouseEnter:Yh(d,m),onMouseLeave:Yh(f,b),onTouchStart:Yh(h,m)}]:[!1,g,{}]}function Yh(t,e){return n=>{t&&t(n),n.defaultPrevented||e(n)}}function o7({page:t,...e}){let{router:n}=dz(),i=T.useMemo(()=>J4(n.routes,t,n.basename),[n.routes,t,n.basename]);return i?T.createElement(c7,{page:t,matches:i,...e}):null}function l7(t){let{manifest:e,routeModules:n}=fz(),[i,r]=T.useState([]);return T.useEffect(()=>{let a=!1;return e7(t,e,n).then(s=>{a||r(s)}),()=>{a=!0}},[t,e,n]),i}function c7({page:t,matches:e,...n}){let i=Ou(),{manifest:r,routeModules:a}=fz(),{basename:s}=dz(),{loaderData:l,matches:c}=a7(),d=T.useMemo(()=>YD(t,e,c,r,i,"data"),[t,e,c,r,i]),f=T.useMemo(()=>YD(t,e,c,r,i,"assets"),[t,e,c,r,i]),h=T.useMemo(()=>{if(t===i.pathname+i.search+i.hash)return[];let b=new Set,y=!1;if(e.forEach(v=>{let w=r.routes[v.route.id];!w||!w.hasLoader||(!d.some(S=>S.route.id===v.route.id)&&v.route.id in l&&a[v.route.id]?.shouldRevalidate||w.hasClientLoader?y=!0:b.add(v.route.id))}),b.size===0)return[];let x=Z$(t,s,"data");return y&&b.size>0&&x.searchParams.set("_routes",e.filter(v=>b.has(v.route.id)).map(v=>v.route.id).join(",")),[x.pathname+x.search]},[s,l,i,r,d,e,t,a]),g=T.useMemo(()=>t7(f,r),[f,r]),m=l7(f);return T.createElement(T.Fragment,null,h.map(b=>T.createElement("link",{key:b,rel:"prefetch",as:"fetch",href:b,...n})),g.map(b=>T.createElement("link",{key:b,rel:"modulepreload",href:b,...n})),m.map(({key:b,link:y})=>T.createElement("link",{key:b,nonce:n.nonce,...y})))}function u7(...t){return e=>{t.forEach(n=>{typeof n=="function"?n(e):n!=null&&(n.current=e)})}}var hz=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{hz&&(window.__reactRouterVersion="7.9.6")}catch{}function d7({basename:t,children:e,window:n}){let i=T.useRef();i.current==null&&(i.current=Y9({window:n,v5Compat:!0}));let r=i.current,[a,s]=T.useState({action:r.action,location:r.location}),l=T.useCallback(c=>{T.startTransition(()=>s(c))},[s]);return T.useLayoutEffect(()=>r.listen(l),[r,l]),T.createElement(j$,{basename:t,children:e,location:a.location,navigationType:a.action,navigator:r})}var pz=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,mz=T.forwardRef(function({onClick:e,discover:n="render",prefetch:i="none",relative:r,reloadDocument:a,replace:s,state:l,target:c,to:d,preventScrollReset:f,viewTransition:h,...g},m){let{basename:b}=T.useContext(qs),y=typeof d=="string"&&pz.test(d),x,v=!1;if(typeof d=="string"&&y&&(x=d,hz))try{let P=new URL(window.location.href),L=d.startsWith("//")?new URL(P.protocol+d):new URL(d),B=Vo(L.pathname,b);L.origin===P.origin&&B!=null?d=B+L.search+L.hash:v=!0}catch{ys(!1,`<Link to="${d}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}let w=w$(d,{relative:r}),[S,A,R]=s7(i,g),N=p7(d,{replace:s,state:l,target:c,preventScrollReset:f,relative:r,viewTransition:h});function C(P){e&&e(P),P.defaultPrevented||N(P)}let F=T.createElement("a",{...g,...R,href:x||w,onClick:v||a?e:C,ref:u7(m,A),target:c,"data-discover":!y&&n==="render"?"true":void 0});return S&&!y?T.createElement(T.Fragment,null,F,T.createElement(o7,{page:w})):F});mz.displayName="Link";var gz=T.forwardRef(function({"aria-current":e="page",caseSensitive:n=!1,className:i="",end:r=!1,style:a,to:s,viewTransition:l,children:c,...d},f){let h=gm(s,{relative:d.relative}),g=Ou(),m=T.useContext(cy),{navigator:b,basename:y}=T.useContext(qs),x=m!=null&&y7(h)&&l===!0,v=b.encodeLocation?b.encodeLocation(h).pathname:h.pathname,w=g.pathname,S=m&&m.navigation&&m.navigation.location?m.navigation.location.pathname:null;n||(w=w.toLowerCase(),S=S?S.toLowerCase():null,v=v.toLowerCase()),S&&y&&(S=Vo(S,y)||S);const A=v!=="/"&&v.endsWith("/")?v.length-1:v.length;let R=w===v||!r&&w.startsWith(v)&&w.charAt(A)==="/",N=S!=null&&(S===v||!r&&S.startsWith(v)&&S.charAt(v.length)==="/"),C={isActive:R,isPending:N,isTransitioning:x},F=R?e:void 0,P;typeof i=="function"?P=i(C):P=[i,R?"active":null,N?"pending":null,x?"transitioning":null].filter(Boolean).join(" ");let L=typeof a=="function"?a(C):a;return T.createElement(mz,{...d,"aria-current":F,className:P,ref:f,style:L,to:s,viewTransition:l},typeof c=="function"?c(C):c)});gz.displayName="NavLink";var f7=T.forwardRef(({discover:t="render",fetcherKey:e,navigate:n,reloadDocument:i,replace:r,state:a,method:s=Tv,action:l,onSubmit:c,relative:d,preventScrollReset:f,viewTransition:h,...g},m)=>{let b=v7(),y=x7(l,{relative:d}),x=s.toLowerCase()==="get"?"get":"post",v=typeof l=="string"&&pz.test(l),w=S=>{if(c&&c(S),S.defaultPrevented)return;S.preventDefault();let A=S.nativeEvent.submitter,R=A?.getAttribute("formmethod")||s;b(A||S.currentTarget,{fetcherKey:e,method:R,navigate:n,replace:r,state:a,relative:d,preventScrollReset:f,viewTransition:h})};return T.createElement("form",{ref:m,method:x,action:y,onSubmit:i?c:w,...g,"data-discover":!v&&t==="render"?"true":void 0})});f7.displayName="Form";function h7(t){return`${t} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function vz(t){let e=T.useContext(kf);return Xn(e,h7(t)),e}function p7(t,{target:e,replace:n,state:i,preventScrollReset:r,relative:a,viewTransition:s}={}){let l=lz(),c=Ou(),d=gm(t,{relative:a});return T.useCallback(f=>{if(X$(f,e)){f.preventDefault();let h=n!==void 0?n:Lp(c)===Lp(d);l(t,{replace:h,state:i,preventScrollReset:r,relative:a,viewTransition:s})}},[c,l,d,n,i,e,t,r,a,s])}var m7=0,g7=()=>`__${String(++m7)}__`;function v7(){let{router:t}=vz("useSubmit"),{basename:e}=T.useContext(qs),n=U$();return T.useCallback(async(i,r={})=>{let{action:a,method:s,encType:l,formData:c,body:d}=K$(i,e);if(r.navigate===!1){let f=r.fetcherKey||g7();await t.fetch(f,n,r.action||a,{preventScrollReset:r.preventScrollReset,formData:c,body:d,formMethod:r.method||s,formEncType:r.encType||l,flushSync:r.flushSync})}else await t.navigate(r.action||a,{preventScrollReset:r.preventScrollReset,formData:c,body:d,formMethod:r.method||s,formEncType:r.encType||l,replace:r.replace,state:r.state,fromRouteId:n,flushSync:r.flushSync,viewTransition:r.viewTransition})},[t,e,n])}function x7(t,{relative:e}={}){let{basename:n}=T.useContext(qs),i=T.useContext(Ys);Xn(i,"useFormAction must be used inside a RouteContext");let[r]=i.matches.slice(-1),a={...gm(t||".",{relative:e})},s=Ou();if(t==null){a.search=s.search;let l=new URLSearchParams(a.search),c=l.getAll("index");if(c.some(f=>f==="")){l.delete("index"),c.filter(h=>h).forEach(h=>l.append("index",h));let f=l.toString();a.search=f?`?${f}`:""}}return(!t||t===".")&&r.route.index&&(a.search=a.search?a.search.replace(/^\?/,"?index&"):"?index"),n!=="/"&&(a.pathname=a.pathname==="/"?n:Fo([n,a.pathname])),Lp(a)}function y7(t,{relative:e}={}){let n=T.useContext(az);Xn(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:i}=vz("useViewTransitionState"),r=gm(t,{relative:e});if(!n.isTransitioning)return!1;let a=Vo(n.currentLocation.pathname,i)||n.currentLocation.pathname,s=Vo(n.nextLocation.pathname,i)||n.nextLocation.pathname;return $v(r.pathname,s)!=null||$v(r.pathname,a)!=null}var Zl=Q4(),Ff=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(t){return this.listeners.add(t),this.onSubscribe(),()=>{this.listeners.delete(t),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},b7={setTimeout:(t,e)=>setTimeout(t,e),clearTimeout:t=>clearTimeout(t),setInterval:(t,e)=>setInterval(t,e),clearInterval:t=>clearInterval(t)},_7=class{#e=b7;#t=!1;setTimeoutProvider(t){this.#e=t}setTimeout(t,e){return this.#e.setTimeout(t,e)}clearTimeout(t){this.#e.clearTimeout(t)}setInterval(t,e){return this.#e.setInterval(t,e)}clearInterval(t){this.#e.clearInterval(t)}},nu=new _7;function S7(t){setTimeout(t,0)}var gu=typeof window>"u"||"Deno"in globalThis;function Nr(){}function w7(t,e){return typeof t=="function"?t(e):t}function UE(t){return typeof t=="number"&&t>=0&&t!==1/0}function xz(t,e){return Math.max(t+(e||0)-Date.now(),0)}function tc(t,e){return typeof t=="function"?t(e):t}function Fa(t,e){return typeof t=="function"?t(e):t}function KD(t,e){const{type:n="all",exact:i,fetchStatus:r,predicate:a,queryKey:s,stale:l}=t;if(s){if(i){if(e.queryHash!==oT(s,e.options))return!1}else if(!Ip(e.queryKey,s))return!1}if(n!=="all"){const c=e.isActive();if(n==="active"&&!c||n==="inactive"&&c)return!1}return!(typeof l=="boolean"&&e.isStale()!==l||r&&r!==e.state.fetchStatus||a&&!a(e))}function ZD(t,e){const{exact:n,status:i,predicate:r,mutationKey:a}=t;if(a){if(!e.options.mutationKey)return!1;if(n){if(vu(e.options.mutationKey)!==vu(a))return!1}else if(!Ip(e.options.mutationKey,a))return!1}return!(i&&e.state.status!==i||r&&!r(e))}function oT(t,e){return(e?.queryKeyHashFn||vu)(t)}function vu(t){return JSON.stringify(t,(e,n)=>kE(n)?Object.keys(n).sort().reduce((i,r)=>(i[r]=n[r],i),{}):n)}function Ip(t,e){return t===e?!0:typeof t!=typeof e?!1:t&&e&&typeof t=="object"&&typeof e=="object"?Object.keys(e).every(n=>Ip(t[n],e[n])):!1}var E7=Object.prototype.hasOwnProperty;function yz(t,e){if(t===e)return t;const n=QD(t)&&QD(e);if(!n&&!(kE(t)&&kE(e)))return e;const r=(n?t:Object.keys(t)).length,a=n?e:Object.keys(e),s=a.length,l=n?new Array(s):{};let c=0;for(let d=0;d<s;d++){const f=n?d:a[d],h=t[f],g=e[f];if(h===g){l[f]=h,(n?d<r:E7.call(t,f))&&c++;continue}if(h===null||g===null||typeof h!="object"||typeof g!="object"){l[f]=g;continue}const m=yz(h,g);l[f]=m,m===h&&c++}return r===s&&c===r?t:l}function Wv(t,e){if(!e||Object.keys(t).length!==Object.keys(e).length)return!1;for(const n in t)if(t[n]!==e[n])return!1;return!0}function QD(t){return Array.isArray(t)&&t.length===Object.keys(t).length}function kE(t){if(!JD(t))return!1;const e=t.constructor;if(e===void 0)return!0;const n=e.prototype;return!(!JD(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(t)!==Object.prototype)}function JD(t){return Object.prototype.toString.call(t)==="[object Object]"}function M7(t){return new Promise(e=>{nu.setTimeout(e,t)})}function FE(t,e,n){return typeof n.structuralSharing=="function"?n.structuralSharing(t,e):n.structuralSharing!==!1?yz(t,e):e}function A7(t,e,n=0){const i=[...t,e];return n&&i.length>n?i.slice(1):i}function T7(t,e,n=0){const i=[e,...t];return n&&i.length>n?i.slice(0,-1):i}var lT=Symbol();function bz(t,e){return!t.queryFn&&e?.initialPromise?()=>e.initialPromise:!t.queryFn||t.queryFn===lT?()=>Promise.reject(new Error(`Missing queryFn: '${t.queryHash}'`)):t.queryFn}function _z(t,e){return typeof t=="function"?t(...e):!!t}var C7=class extends Ff{#e;#t;#n;constructor(){super(),this.#n=t=>{if(!gu&&window.addEventListener){const e=()=>t();return window.addEventListener("visibilitychange",e,!1),()=>{window.removeEventListener("visibilitychange",e)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(t){this.#n=t,this.#t?.(),this.#t=t(e=>{typeof e=="boolean"?this.setFocused(e):this.onFocus()})}setFocused(t){this.#e!==t&&(this.#e=t,this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(e=>{e(t)})}isFocused(){return typeof this.#e=="boolean"?this.#e:globalThis.document?.visibilityState!=="hidden"}},cT=new C7;function zE(){let t,e;const n=new Promise((r,a)=>{t=r,e=a});n.status="pending",n.catch(()=>{});function i(r){Object.assign(n,r),delete n.resolve,delete n.reject}return n.resolve=r=>{i({status:"fulfilled",value:r}),t(r)},n.reject=r=>{i({status:"rejected",reason:r}),e(r)},n}var R7=S7;function P7(){let t=[],e=0,n=l=>{l()},i=l=>{l()},r=R7;const a=l=>{e?t.push(l):r(()=>{n(l)})},s=()=>{const l=t;t=[],l.length&&r(()=>{i(()=>{l.forEach(c=>{n(c)})})})};return{batch:l=>{let c;e++;try{c=l()}finally{e--,e||s()}return c},batchCalls:l=>(...c)=>{a(()=>{l(...c)})},schedule:a,setNotifyFunction:l=>{n=l},setBatchNotifyFunction:l=>{i=l},setScheduler:l=>{r=l}}}var Ri=P7(),D7=class extends Ff{#e=!0;#t;#n;constructor(){super(),this.#n=t=>{if(!gu&&window.addEventListener){const e=()=>t(!0),n=()=>t(!1);return window.addEventListener("online",e,!1),window.addEventListener("offline",n,!1),()=>{window.removeEventListener("online",e),window.removeEventListener("offline",n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(t){this.#n=t,this.#t?.(),this.#t=t(this.setOnline.bind(this))}setOnline(t){this.#e!==t&&(this.#e=t,this.listeners.forEach(n=>{n(t)}))}isOnline(){return this.#e}},Xv=new D7;function N7(t){return Math.min(1e3*2**t,3e4)}function Sz(t){return(t??"online")==="online"?Xv.isOnline():!0}var BE=class extends Error{constructor(t){super("CancelledError"),this.revert=t?.revert,this.silent=t?.silent}};function wz(t){let e=!1,n=0,i;const r=zE(),a=()=>r.status!=="pending",s=y=>{if(!a()){const x=new BE(y);g(x),t.onCancel?.(x)}},l=()=>{e=!0},c=()=>{e=!1},d=()=>cT.isFocused()&&(t.networkMode==="always"||Xv.isOnline())&&t.canRun(),f=()=>Sz(t.networkMode)&&t.canRun(),h=y=>{a()||(i?.(),r.resolve(y))},g=y=>{a()||(i?.(),r.reject(y))},m=()=>new Promise(y=>{i=x=>{(a()||d())&&y(x)},t.onPause?.()}).then(()=>{i=void 0,a()||t.onContinue?.()}),b=()=>{if(a())return;let y;const x=n===0?t.initialPromise:void 0;try{y=x??t.fn()}catch(v){y=Promise.reject(v)}Promise.resolve(y).then(h).catch(v=>{if(a())return;const w=t.retry??(gu?0:3),S=t.retryDelay??N7,A=typeof S=="function"?S(n,v):S,R=w===!0||typeof w=="number"&&n<w||typeof w=="function"&&w(n,v);if(e||!R){g(v);return}n++,t.onFail?.(n,v),M7(A).then(()=>d()?void 0:m()).then(()=>{e?g(v):b()})})};return{promise:r,status:()=>r.status,cancel:s,continue:()=>(i?.(),r),cancelRetry:l,continueRetry:c,canStart:f,start:()=>(f()?b():m().then(b),r)}}var Ez=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),UE(this.gcTime)&&(this.#e=nu.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(t){this.gcTime=Math.max(this.gcTime||0,t??(gu?1/0:300*1e3))}clearGcTimeout(){this.#e&&(nu.clearTimeout(this.#e),this.#e=void 0)}},O7=class extends Ez{#e;#t;#n;#r;#i;#s;#o;constructor(t){super(),this.#o=!1,this.#s=t.defaultOptions,this.setOptions(t.options),this.observers=[],this.#r=t.client,this.#n=this.#r.getQueryCache(),this.queryKey=t.queryKey,this.queryHash=t.queryHash,this.#e=tN(this.options),this.state=t.state??this.#e,this.scheduleGc()}get meta(){return this.options.meta}get promise(){return this.#i?.promise}setOptions(t){if(this.options={...this.#s,...t},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const e=tN(this.options);e.data!==void 0&&(this.setState(eN(e.data,e.dataUpdatedAt)),this.#e=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&this.#n.remove(this)}setData(t,e){const n=FE(this.state.data,t,this.options);return this.#a({data:n,type:"success",dataUpdatedAt:e?.updatedAt,manual:e?.manual}),n}setState(t,e){this.#a({type:"setState",state:t,setStateOptions:e})}cancel(t){const e=this.#i?.promise;return this.#i?.cancel(t),e?e.then(Nr).catch(Nr):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(this.#e)}isActive(){return this.observers.some(t=>Fa(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===lT||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>tc(t.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(t=0){return this.state.data===void 0?!0:t==="static"?!1:this.state.isInvalidated?!0:!xz(this.state.dataUpdatedAt,t)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#i?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#i?.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),this.#n.notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(e=>e!==t),this.observers.length||(this.#i&&(this.#o?this.#i.cancel({revert:!0}):this.#i.cancelRetry()),this.scheduleGc()),this.#n.notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#a({type:"invalidate"})}async fetch(t,e){if(this.state.fetchStatus!=="idle"&&this.#i?.status()!=="rejected"){if(this.state.data!==void 0&&e?.cancelRefetch)this.cancel({silent:!0});else if(this.#i)return this.#i.continueRetry(),this.#i.promise}if(t&&this.setOptions(t),!this.options.queryFn){const l=this.observers.find(c=>c.options.queryFn);l&&this.setOptions(l.options)}const n=new AbortController,i=l=>{Object.defineProperty(l,"signal",{enumerable:!0,get:()=>(this.#o=!0,n.signal)})},r=()=>{const l=bz(this.options,e),d=(()=>{const f={client:this.#r,queryKey:this.queryKey,meta:this.meta};return i(f),f})();return this.#o=!1,this.options.persister?this.options.persister(l,d,this):l(d)},s=(()=>{const l={fetchOptions:e,options:this.options,queryKey:this.queryKey,client:this.#r,state:this.state,fetchFn:r};return i(l),l})();this.options.behavior?.onFetch(s,this),this.#t=this.state,(this.state.fetchStatus==="idle"||this.state.fetchMeta!==s.fetchOptions?.meta)&&this.#a({type:"fetch",meta:s.fetchOptions?.meta}),this.#i=wz({initialPromise:e?.initialPromise,fn:s.fetchFn,onCancel:l=>{l instanceof BE&&l.revert&&this.setState({...this.#t,fetchStatus:"idle"}),n.abort()},onFail:(l,c)=>{this.#a({type:"failed",failureCount:l,error:c})},onPause:()=>{this.#a({type:"pause"})},onContinue:()=>{this.#a({type:"continue"})},retry:s.options.retry,retryDelay:s.options.retryDelay,networkMode:s.options.networkMode,canRun:()=>!0});try{const l=await this.#i.start();if(l===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(l),this.#n.config.onSuccess?.(l,this),this.#n.config.onSettled?.(l,this.state.error,this),l}catch(l){if(l instanceof BE){if(l.silent)return this.#i.promise;if(l.revert){if(this.state.data===void 0)throw l;return this.state.data}}throw this.#a({type:"error",error:l}),this.#n.config.onError?.(l,this),this.#n.config.onSettled?.(this.state.data,l,this),l}finally{this.scheduleGc()}}#a(t){const e=n=>{switch(t.type){case"failed":return{...n,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...n,fetchStatus:"paused"};case"continue":return{...n,fetchStatus:"fetching"};case"fetch":return{...n,...Mz(n.data,this.options),fetchMeta:t.meta??null};case"success":const i={...n,...eN(t.data,t.dataUpdatedAt),dataUpdateCount:n.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return this.#t=t.manual?i:void 0,i;case"error":const r=t.error;return{...n,error:r,errorUpdateCount:n.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:n.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:"idle",status:"error"};case"invalidate":return{...n,isInvalidated:!0};case"setState":return{...n,...t.state}}};this.state=e(this.state),Ri.batch(()=>{this.observers.forEach(n=>{n.onQueryUpdate()}),this.#n.notify({query:this,type:"updated",action:t})})}};function Mz(t,e){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Sz(e.networkMode)?"fetching":"paused",...t===void 0&&{error:null,status:"pending"}}}function eN(t,e){return{data:t,dataUpdatedAt:e??Date.now(),error:null,isInvalidated:!1,status:"success"}}function tN(t){const e=typeof t.initialData=="function"?t.initialData():t.initialData,n=e!==void 0,i=n?typeof t.initialDataUpdatedAt=="function"?t.initialDataUpdatedAt():t.initialDataUpdatedAt:0;return{data:e,dataUpdateCount:0,dataUpdatedAt:n?i??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var L7=class extends Ff{constructor(t,e){super(),this.options=e,this.#e=t,this.#a=null,this.#o=zE(),this.bindMethods(),this.setOptions(e)}#e;#t=void 0;#n=void 0;#r=void 0;#i;#s;#o;#a;#m;#f;#h;#c;#u;#l;#p=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),nN(this.#t,this.options)?this.#d():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return jE(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return jE(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#_(),this.#t.removeObserver(this)}setOptions(t){const e=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Fa(this.options.enabled,this.#t)!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#S(),this.#t.setOptions(this.options),e._defaulted&&!Wv(this.options,e)&&this.#e.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#t,observer:this});const i=this.hasListeners();i&&iN(this.#t,n,this.options,e)&&this.#d(),this.updateResult(),i&&(this.#t!==n||Fa(this.options.enabled,this.#t)!==Fa(e.enabled,this.#t)||tc(this.options.staleTime,this.#t)!==tc(e.staleTime,this.#t))&&this.#g();const r=this.#v();i&&(this.#t!==n||Fa(this.options.enabled,this.#t)!==Fa(e.enabled,this.#t)||r!==this.#l)&&this.#x(r)}getOptimisticResult(t){const e=this.#e.getQueryCache().build(this.#e,t),n=this.createResult(e,t);return U7(this,n)&&(this.#r=n,this.#s=this.options,this.#i=this.#t.state),n}getCurrentResult(){return this.#r}trackResult(t,e){return new Proxy(t,{get:(n,i)=>(this.trackProp(i),e?.(i),i==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&this.#o.status==="pending"&&this.#o.reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(n,i))})}trackProp(t){this.#p.add(t)}getCurrentQuery(){return this.#t}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const e=this.#e.defaultQueryOptions(t),n=this.#e.getQueryCache().build(this.#e,e);return n.fetch().then(()=>this.createResult(n,e))}fetch(t){return this.#d({...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#d(t){this.#S();let e=this.#t.fetch(this.options,t);return t?.throwOnError||(e=e.catch(Nr)),e}#g(){this.#b();const t=tc(this.options.staleTime,this.#t);if(gu||this.#r.isStale||!UE(t))return;const n=xz(this.#r.dataUpdatedAt,t)+1;this.#c=nu.setTimeout(()=>{this.#r.isStale||this.updateResult()},n)}#v(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#x(t){this.#_(),this.#l=t,!(gu||Fa(this.options.enabled,this.#t)===!1||!UE(this.#l)||this.#l===0)&&(this.#u=nu.setInterval(()=>{(this.options.refetchIntervalInBackground||cT.isFocused())&&this.#d()},this.#l))}#y(){this.#g(),this.#x(this.#v())}#b(){this.#c&&(nu.clearTimeout(this.#c),this.#c=void 0)}#_(){this.#u&&(nu.clearInterval(this.#u),this.#u=void 0)}createResult(t,e){const n=this.#t,i=this.options,r=this.#r,a=this.#i,s=this.#s,c=t!==n?t.state:this.#n,{state:d}=t;let f={...d},h=!1,g;if(e._optimisticResults){const F=this.hasListeners(),P=!F&&nN(t,e),L=F&&iN(t,n,e,i);(P||L)&&(f={...f,...Mz(d.data,t.options)}),e._optimisticResults==="isRestoring"&&(f.fetchStatus="idle")}let{error:m,errorUpdatedAt:b,status:y}=f;g=f.data;let x=!1;if(e.placeholderData!==void 0&&g===void 0&&y==="pending"){let F;r?.isPlaceholderData&&e.placeholderData===s?.placeholderData?(F=r.data,x=!0):F=typeof e.placeholderData=="function"?e.placeholderData(this.#h?.state.data,this.#h):e.placeholderData,F!==void 0&&(y="success",g=FE(r?.data,F,e),h=!0)}if(e.select&&g!==void 0&&!x)if(r&&g===a?.data&&e.select===this.#m)g=this.#f;else try{this.#m=e.select,g=e.select(g),g=FE(r?.data,g,e),this.#f=g,this.#a=null}catch(F){this.#a=F}this.#a&&(m=this.#a,g=this.#f,b=Date.now(),y="error");const v=f.fetchStatus==="fetching",w=y==="pending",S=y==="error",A=w&&v,R=g!==void 0,C={status:y,fetchStatus:f.fetchStatus,isPending:w,isSuccess:y==="success",isError:S,isInitialLoading:A,isLoading:A,data:g,dataUpdatedAt:f.dataUpdatedAt,error:m,errorUpdatedAt:b,failureCount:f.fetchFailureCount,failureReason:f.fetchFailureReason,errorUpdateCount:f.errorUpdateCount,isFetched:f.dataUpdateCount>0||f.errorUpdateCount>0,isFetchedAfterMount:f.dataUpdateCount>c.dataUpdateCount||f.errorUpdateCount>c.errorUpdateCount,isFetching:v,isRefetching:v&&!w,isLoadingError:S&&!R,isPaused:f.fetchStatus==="paused",isPlaceholderData:h,isRefetchError:S&&R,isStale:uT(t,e),refetch:this.refetch,promise:this.#o,isEnabled:Fa(e.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const F=B=>{C.status==="error"?B.reject(C.error):C.data!==void 0&&B.resolve(C.data)},P=()=>{const B=this.#o=C.promise=zE();F(B)},L=this.#o;switch(L.status){case"pending":t.queryHash===n.queryHash&&F(L);break;case"fulfilled":(C.status==="error"||C.data!==L.value)&&P();break;case"rejected":(C.status!=="error"||C.error!==L.reason)&&P();break}}return C}updateResult(){const t=this.#r,e=this.createResult(this.#t,this.options);if(this.#i=this.#t.state,this.#s=this.options,this.#i.data!==void 0&&(this.#h=this.#t),Wv(e,t))return;this.#r=e;const n=()=>{if(!t)return!0;const{notifyOnChangeProps:i}=this.options,r=typeof i=="function"?i():i;if(r==="all"||!r&&!this.#p.size)return!0;const a=new Set(r??this.#p);return this.options.throwOnError&&a.add("error"),Object.keys(this.#r).some(s=>{const l=s;return this.#r[l]!==t[l]&&a.has(l)})};this.#w({listeners:n()})}#S(){const t=this.#e.getQueryCache().build(this.#e,this.options);if(t===this.#t)return;const e=this.#t;this.#t=t,this.#n=t.state,this.hasListeners()&&(e?.removeObserver(this),t.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}#w(t){Ri.batch(()=>{t.listeners&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:"observerResultsUpdated"})})}};function I7(t,e){return Fa(e.enabled,t)!==!1&&t.state.data===void 0&&!(t.state.status==="error"&&e.retryOnMount===!1)}function nN(t,e){return I7(t,e)||t.state.data!==void 0&&jE(t,e,e.refetchOnMount)}function jE(t,e,n){if(Fa(e.enabled,t)!==!1&&tc(e.staleTime,t)!=="static"){const i=typeof n=="function"?n(t):n;return i==="always"||i!==!1&&uT(t,e)}return!1}function iN(t,e,n,i){return(t!==e||Fa(i.enabled,t)===!1)&&(!n.suspense||t.state.status!=="error")&&uT(t,n)}function uT(t,e){return Fa(e.enabled,t)!==!1&&t.isStaleByTime(tc(e.staleTime,t))}function U7(t,e){return!Wv(t.getCurrentResult(),e)}function rN(t){return{onFetch:(e,n)=>{const i=e.options,r=e.fetchOptions?.meta?.fetchMore?.direction,a=e.state.data?.pages||[],s=e.state.data?.pageParams||[];let l={pages:[],pageParams:[]},c=0;const d=async()=>{let f=!1;const h=b=>{Object.defineProperty(b,"signal",{enumerable:!0,get:()=>(e.signal.aborted?f=!0:e.signal.addEventListener("abort",()=>{f=!0}),e.signal)})},g=bz(e.options,e.fetchOptions),m=async(b,y,x)=>{if(f)return Promise.reject();if(y==null&&b.pages.length)return Promise.resolve(b);const w=(()=>{const N={client:e.client,queryKey:e.queryKey,pageParam:y,direction:x?"backward":"forward",meta:e.options.meta};return h(N),N})(),S=await g(w),{maxPages:A}=e.options,R=x?T7:A7;return{pages:R(b.pages,S,A),pageParams:R(b.pageParams,y,A)}};if(r&&a.length){const b=r==="backward",y=b?k7:aN,x={pages:a,pageParams:s},v=y(i,x);l=await m(x,v,b)}else{const b=t??a.length;do{const y=c===0?s[0]??i.initialPageParam:aN(i,l);if(c>0&&y==null)break;l=await m(l,y),c++}while(c<b)}return l};e.options.persister?e.fetchFn=()=>e.options.persister?.(d,{client:e.client,queryKey:e.queryKey,meta:e.options.meta,signal:e.signal},n):e.fetchFn=d}}}function aN(t,{pages:e,pageParams:n}){const i=e.length-1;return e.length>0?t.getNextPageParam(e[i],e,n[i],n):void 0}function k7(t,{pages:e,pageParams:n}){return e.length>0?t.getPreviousPageParam?.(e[0],e,n[0],n):void 0}var F7=class extends Ez{#e;#t;#n;#r;constructor(t){super(),this.#e=t.client,this.mutationId=t.mutationId,this.#n=t.mutationCache,this.#t=[],this.state=t.state||Az(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){this.#t.includes(t)||(this.#t.push(t),this.clearGcTimeout(),this.#n.notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){this.#t=this.#t.filter(e=>e!==t),this.scheduleGc(),this.#n.notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){this.#t.length||(this.state.status==="pending"?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??this.execute(this.state.variables)}async execute(t){const e=()=>{this.#i({type:"continue"})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#r=wz({fn:()=>this.options.mutationFn?this.options.mutationFn(t,n):Promise.reject(new Error("No mutationFn found")),onFail:(a,s)=>{this.#i({type:"failed",failureCount:a,error:s})},onPause:()=>{this.#i({type:"pause"})},onContinue:e,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)});const i=this.state.status==="pending",r=!this.#r.canStart();try{if(i)e();else{this.#i({type:"pending",variables:t,isPaused:r}),await this.#n.config.onMutate?.(t,this,n);const s=await this.options.onMutate?.(t,n);s!==this.state.context&&this.#i({type:"pending",context:s,variables:t,isPaused:r})}const a=await this.#r.start();return await this.#n.config.onSuccess?.(a,t,this.state.context,this,n),await this.options.onSuccess?.(a,t,this.state.context,n),await this.#n.config.onSettled?.(a,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(a,null,t,this.state.context,n),this.#i({type:"success",data:a}),a}catch(a){try{throw await this.#n.config.onError?.(a,t,this.state.context,this,n),await this.options.onError?.(a,t,this.state.context,n),await this.#n.config.onSettled?.(void 0,a,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(void 0,a,t,this.state.context,n),a}finally{this.#i({type:"error",error:a})}}finally{this.#n.runNext(this)}}#i(t){const e=n=>{switch(t.type){case"failed":return{...n,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...n,isPaused:!0};case"continue":return{...n,isPaused:!1};case"pending":return{...n,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...n,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...n,data:void 0,error:t.error,failureCount:n.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=e(this.state),Ri.batch(()=>{this.#t.forEach(n=>{n.onMutationUpdate(t)}),this.#n.notify({mutation:this,type:"updated",action:t})})}};function Az(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var z7=class extends Ff{constructor(t={}){super(),this.config=t,this.#e=new Set,this.#t=new Map,this.#n=0}#e;#t;#n;build(t,e,n){const i=new F7({client:t,mutationCache:this,mutationId:++this.#n,options:t.defaultMutationOptions(e),state:n});return this.add(i),i}add(t){this.#e.add(t);const e=l0(t);if(typeof e=="string"){const n=this.#t.get(e);n?n.push(t):this.#t.set(e,[t])}this.notify({type:"added",mutation:t})}remove(t){if(this.#e.delete(t)){const e=l0(t);if(typeof e=="string"){const n=this.#t.get(e);if(n)if(n.length>1){const i=n.indexOf(t);i!==-1&&n.splice(i,1)}else n[0]===t&&this.#t.delete(e)}}this.notify({type:"removed",mutation:t})}canRun(t){const e=l0(t);if(typeof e=="string"){const i=this.#t.get(e)?.find(r=>r.state.status==="pending");return!i||i===t}else return!0}runNext(t){const e=l0(t);return typeof e=="string"?this.#t.get(e)?.find(i=>i!==t&&i.state.isPaused)?.continue()??Promise.resolve():Promise.resolve()}clear(){Ri.batch(()=>{this.#e.forEach(t=>{this.notify({type:"removed",mutation:t})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(t){const e={exact:!0,...t};return this.getAll().find(n=>ZD(e,n))}findAll(t={}){return this.getAll().filter(e=>ZD(t,e))}notify(t){Ri.batch(()=>{this.listeners.forEach(e=>{e(t)})})}resumePausedMutations(){const t=this.getAll().filter(e=>e.state.isPaused);return Ri.batch(()=>Promise.all(t.map(e=>e.continue().catch(Nr))))}};function l0(t){return t.options.scope?.id}var B7=class extends Ff{#e;#t=void 0;#n;#r;constructor(e,n){super(),this.#e=e,this.setOptions(n),this.bindMethods(),this.#i()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){const n=this.options;this.options=this.#e.defaultMutationOptions(e),Wv(this.options,n)||this.#e.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.#n,observer:this}),n?.mutationKey&&this.options.mutationKey&&vu(n.mutationKey)!==vu(this.options.mutationKey)?this.reset():this.#n?.state.status==="pending"&&this.#n.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#n?.removeObserver(this)}onMutationUpdate(e){this.#i(),this.#s(e)}getCurrentResult(){return this.#t}reset(){this.#n?.removeObserver(this),this.#n=void 0,this.#i(),this.#s()}mutate(e,n){return this.#r=n,this.#n?.removeObserver(this),this.#n=this.#e.getMutationCache().build(this.#e,this.options),this.#n.addObserver(this),this.#n.execute(e)}#i(){const e=this.#n?.state??Az();this.#t={...e,isPending:e.status==="pending",isSuccess:e.status==="success",isError:e.status==="error",isIdle:e.status==="idle",mutate:this.mutate,reset:this.reset}}#s(e){Ri.batch(()=>{if(this.#r&&this.hasListeners()){const n=this.#t.variables,i=this.#t.context,r={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};e?.type==="success"?(this.#r.onSuccess?.(e.data,n,i,r),this.#r.onSettled?.(e.data,null,n,i,r)):e?.type==="error"&&(this.#r.onError?.(e.error,n,i,r),this.#r.onSettled?.(void 0,e.error,n,i,r))}this.listeners.forEach(n=>{n(this.#t)})})}},j7=class extends Ff{constructor(t={}){super(),this.config=t,this.#e=new Map}#e;build(t,e,n){const i=e.queryKey,r=e.queryHash??oT(i,e);let a=this.get(r);return a||(a=new O7({client:t,queryKey:i,queryHash:r,options:t.defaultQueryOptions(e),state:n,defaultOptions:t.getQueryDefaults(i)}),this.add(a)),a}add(t){this.#e.has(t.queryHash)||(this.#e.set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const e=this.#e.get(t.queryHash);e&&(t.destroy(),e===t&&this.#e.delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){Ri.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return this.#e.get(t)}getAll(){return[...this.#e.values()]}find(t){const e={exact:!0,...t};return this.getAll().find(n=>KD(e,n))}findAll(t={}){const e=this.getAll();return Object.keys(t).length>0?e.filter(n=>KD(t,n)):e}notify(t){Ri.batch(()=>{this.listeners.forEach(e=>{e(t)})})}onFocus(){Ri.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){Ri.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},H7=class{#e;#t;#n;#r;#i;#s;#o;#a;constructor(t={}){this.#e=t.queryCache||new j7,this.#t=t.mutationCache||new z7,this.#n=t.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#s=0}mount(){this.#s++,this.#s===1&&(this.#o=cT.subscribe(async t=>{t&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#a=Xv.subscribe(async t=>{t&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#s--,this.#s===0&&(this.#o?.(),this.#o=void 0,this.#a?.(),this.#a=void 0)}isFetching(t){return this.#e.findAll({...t,fetchStatus:"fetching"}).length}isMutating(t){return this.#t.findAll({...t,status:"pending"}).length}getQueryData(t){const e=this.defaultQueryOptions({queryKey:t});return this.#e.get(e.queryHash)?.state.data}ensureQueryData(t){const e=this.defaultQueryOptions(t),n=this.#e.build(this,e),i=n.state.data;return i===void 0?this.fetchQuery(t):(t.revalidateIfStale&&n.isStaleByTime(tc(e.staleTime,n))&&this.prefetchQuery(e),Promise.resolve(i))}getQueriesData(t){return this.#e.findAll(t).map(({queryKey:e,state:n})=>{const i=n.data;return[e,i]})}setQueryData(t,e,n){const i=this.defaultQueryOptions({queryKey:t}),a=this.#e.get(i.queryHash)?.state.data,s=w7(e,a);if(s!==void 0)return this.#e.build(this,i).setData(s,{...n,manual:!0})}setQueriesData(t,e,n){return Ri.batch(()=>this.#e.findAll(t).map(({queryKey:i})=>[i,this.setQueryData(i,e,n)]))}getQueryState(t){const e=this.defaultQueryOptions({queryKey:t});return this.#e.get(e.queryHash)?.state}removeQueries(t){const e=this.#e;Ri.batch(()=>{e.findAll(t).forEach(n=>{e.remove(n)})})}resetQueries(t,e){const n=this.#e;return Ri.batch(()=>(n.findAll(t).forEach(i=>{i.reset()}),this.refetchQueries({type:"active",...t},e)))}cancelQueries(t,e={}){const n={revert:!0,...e},i=Ri.batch(()=>this.#e.findAll(t).map(r=>r.cancel(n)));return Promise.all(i).then(Nr).catch(Nr)}invalidateQueries(t,e={}){return Ri.batch(()=>(this.#e.findAll(t).forEach(n=>{n.invalidate()}),t?.refetchType==="none"?Promise.resolve():this.refetchQueries({...t,type:t?.refetchType??t?.type??"active"},e)))}refetchQueries(t,e={}){const n={...e,cancelRefetch:e.cancelRefetch??!0},i=Ri.batch(()=>this.#e.findAll(t).filter(r=>!r.isDisabled()&&!r.isStatic()).map(r=>{let a=r.fetch(void 0,n);return n.throwOnError||(a=a.catch(Nr)),r.state.fetchStatus==="paused"?Promise.resolve():a}));return Promise.all(i).then(Nr)}fetchQuery(t){const e=this.defaultQueryOptions(t);e.retry===void 0&&(e.retry=!1);const n=this.#e.build(this,e);return n.isStaleByTime(tc(e.staleTime,n))?n.fetch(e):Promise.resolve(n.state.data)}prefetchQuery(t){return this.fetchQuery(t).then(Nr).catch(Nr)}fetchInfiniteQuery(t){return t.behavior=rN(t.pages),this.fetchQuery(t)}prefetchInfiniteQuery(t){return this.fetchInfiniteQuery(t).then(Nr).catch(Nr)}ensureInfiniteQueryData(t){return t.behavior=rN(t.pages),this.ensureQueryData(t)}resumePausedMutations(){return Xv.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(t){this.#n=t}setQueryDefaults(t,e){this.#r.set(vu(t),{queryKey:t,defaultOptions:e})}getQueryDefaults(t){const e=[...this.#r.values()],n={};return e.forEach(i=>{Ip(t,i.queryKey)&&Object.assign(n,i.defaultOptions)}),n}setMutationDefaults(t,e){this.#i.set(vu(t),{mutationKey:t,defaultOptions:e})}getMutationDefaults(t){const e=[...this.#i.values()],n={};return e.forEach(i=>{Ip(t,i.mutationKey)&&Object.assign(n,i.defaultOptions)}),n}defaultQueryOptions(t){if(t._defaulted)return t;const e={...this.#n.queries,...this.getQueryDefaults(t.queryKey),...t,_defaulted:!0};return e.queryHash||(e.queryHash=oT(e.queryKey,e)),e.refetchOnReconnect===void 0&&(e.refetchOnReconnect=e.networkMode!=="always"),e.throwOnError===void 0&&(e.throwOnError=!!e.suspense),!e.networkMode&&e.persister&&(e.networkMode="offlineFirst"),e.queryFn===lT&&(e.enabled=!1),e}defaultMutationOptions(t){return t?._defaulted?t:{...this.#n.mutations,...t?.mutationKey&&this.getMutationDefaults(t.mutationKey),...t,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},Tz=T.createContext(void 0),wa=t=>{const e=T.useContext(Tz);if(!e)throw new Error("No QueryClient set, use QueryClientProvider to set one");return e},G7=({client:t,children:e})=>(T.useEffect(()=>(t.mount(),()=>{t.unmount()}),[t]),E.jsx(Tz.Provider,{value:t,children:e})),Cz=T.createContext(!1),V7=()=>T.useContext(Cz);Cz.Provider;function $7(){let t=!1;return{clearReset:()=>{t=!1},reset:()=>{t=!0},isReset:()=>t}}var W7=T.createContext($7()),X7=()=>T.useContext(W7),q7=(t,e)=>{(t.suspense||t.throwOnError||t.experimental_prefetchInRender)&&(e.isReset()||(t.retryOnMount=!1))},Y7=t=>{T.useEffect(()=>{t.clearReset()},[t])},K7=({result:t,errorResetBoundary:e,throwOnError:n,query:i,suspense:r})=>t.isError&&!e.isReset()&&!t.isFetching&&i&&(r&&t.data===void 0||_z(n,[t.error,i])),Z7=t=>{if(t.suspense){const n=r=>r==="static"?r:Math.max(r??1e3,1e3),i=t.staleTime;t.staleTime=typeof i=="function"?(...r)=>n(i(...r)):n(i),typeof t.gcTime=="number"&&(t.gcTime=Math.max(t.gcTime,1e3))}},Q7=(t,e)=>t.isLoading&&t.isFetching&&!e,J7=(t,e)=>t?.suspense&&e.isPending,sN=(t,e,n)=>e.fetchOptimistic(t).catch(()=>{n.clearReset()});function eW(t,e,n){const i=V7(),r=X7(),a=wa(),s=a.defaultQueryOptions(t);a.getDefaultOptions().queries?._experimental_beforeQuery?.(s),s._optimisticResults=i?"isRestoring":"optimistic",Z7(s),q7(s,r),Y7(r);const l=!a.getQueryCache().get(s.queryHash),[c]=T.useState(()=>new e(a,s)),d=c.getOptimisticResult(s),f=!i&&t.subscribed!==!1;if(T.useSyncExternalStore(T.useCallback(h=>{const g=f?c.subscribe(Ri.batchCalls(h)):Nr;return c.updateResult(),g},[c,f]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),T.useEffect(()=>{c.setOptions(s)},[s,c]),J7(s,d))throw sN(s,c,r);if(K7({result:d,errorResetBoundary:r,throwOnError:s.throwOnError,query:a.getQueryCache().get(s.queryHash),suspense:s.suspense}))throw d.error;return a.getDefaultOptions().queries?._experimental_afterQuery?.(s,d),s.experimental_prefetchInRender&&!gu&&Q7(d,i)&&(l?sN(s,c,r):a.getQueryCache().get(s.queryHash)?.promise)?.catch(Nr).finally(()=>{c.updateResult()}),s.notifyOnChangeProps?d:c.trackResult(d)}function Ki(t,e){return eW(t,L7)}function Qi(t,e){const n=wa(),[i]=T.useState(()=>new B7(n,t));T.useEffect(()=>{i.setOptions(t)},[i,t]);const r=T.useSyncExternalStore(T.useCallback(s=>i.subscribe(Ri.batchCalls(s)),[i]),()=>i.getCurrentResult(),()=>i.getCurrentResult()),a=T.useCallback((s,l)=>{i.mutate(s,l).catch(Nr)},[i]);if(r.error&&_z(i.options.throwOnError,[r.error]))throw r.error;return{...r,mutate:a,mutateAsync:r.mutate}}const tW=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),nW=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,n,i)=>i?i.toUpperCase():n.toLowerCase()),oN=t=>{const e=nW(t);return e.charAt(0).toUpperCase()+e.slice(1)},Rz=(...t)=>t.filter((e,n,i)=>!!e&&e.trim()!==""&&i.indexOf(e)===n).join(" ").trim(),iW=t=>{for(const e in t)if(e.startsWith("aria-")||e==="role"||e==="title")return!0};var rW={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const aW=T.forwardRef(({color:t="currentColor",size:e=24,strokeWidth:n=2,absoluteStrokeWidth:i,className:r="",children:a,iconNode:s,...l},c)=>T.createElement("svg",{ref:c,...rW,width:e,height:e,stroke:t,strokeWidth:i?Number(n)*24/Number(e):n,className:Rz("lucide",r),...!a&&!iW(l)&&{"aria-hidden":"true"},...l},[...s.map(([d,f])=>T.createElement(d,f)),...Array.isArray(a)?a:[a]]));const pt=(t,e)=>{const n=T.forwardRef(({className:i,...r},a)=>T.createElement(aW,{ref:a,iconNode:e,className:Rz(`lucide-${tW(oN(t))}`,`lucide-${t}`,i),...r}));return n.displayName=oN(t),n};const sW=[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]],oW=pt("archive",sW);const lW=[["path",{d:"m21 16-4 4-4-4",key:"f6ql7i"}],["path",{d:"M17 20V4",key:"1ejh1v"}],["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}]],cW=pt("arrow-up-down",lW);const uW=[["path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z",key:"hh9hay"}],["path",{d:"m3.3 7 8.7 5 8.7-5",key:"g66t2b"}],["path",{d:"M12 22V12",key:"d0xqtd"}]],Up=pt("box",uW);const dW=[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M8 14h.01",key:"6423bh"}],["path",{d:"M12 14h.01",key:"1etili"}],["path",{d:"M16 14h.01",key:"1gbofw"}],["path",{d:"M8 18h.01",key:"lrp35t"}],["path",{d:"M12 18h.01",key:"mhygvu"}],["path",{d:"M16 18h.01",key:"kzsmim"}]],fW=pt("calendar-days",dW);const hW=[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]],lN=pt("calendar",hW);const pW=[["path",{d:"M13.997 4a2 2 0 0 1 1.76 1.05l.486.9A2 2 0 0 0 18.003 7H20a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h1.997a2 2 0 0 0 1.759-1.048l.489-.904A2 2 0 0 1 10.004 4z",key:"18u6gg"}],["circle",{cx:"12",cy:"13",r:"3",key:"1vg3eu"}]],HE=pt("camera",pW);const mW=[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]],gW=pt("chart-column",mW);const vW=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],xW=pt("check",vW);const yW=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],bW=pt("chevron-down",yW);const _W=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],vm=pt("chevron-right",_W);const SW=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],gf=pt("chevron-left",SW);const wW=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],dT=pt("circle-alert",wW);const EW=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],fT=pt("circle-check-big",EW);const MW=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],Pz=pt("circle-x",MW);const AW=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],dy=pt("clock",AW);const TW=[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]],hT=pt("cloud",TW);const CW=[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]],RW=pt("code-xml",CW);const PW=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],DW=pt("copy",PW);const NW=[["line",{x1:"12",x2:"12",y1:"2",y2:"22",key:"7eqyqh"}],["path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",key:"1b0p4s"}]],OW=pt("dollar-sign",NW);const LW=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],ou=pt("download",LW);const IW=[["path",{d:"M12 22a7 7 0 0 0 7-7c0-2-1-3.9-3-5.5s-3.5-4-4-6.5c-.5 2.5-2 4.9-4 6.5C6 11.1 5 13 5 15a7 7 0 0 0 7 7z",key:"c7niix"}]],UW=pt("droplet",IW);const kW=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}]],FW=pt("ellipsis-vertical",kW);const zW=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],qv=pt("external-link",zW);const BW=[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],jW=pt("eye-off",BW);const HW=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],cN=pt("eye",HW);const GW=[["path",{d:"M14.5 22H18a2 2 0 0 0 2-2V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v3.8",key:"1kchwa"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M11.7 14.2 7 17l-4.7-2.8",key:"1yk8tc"}],["path",{d:"M3 13.1a2 2 0 0 0-.999 1.76v3.24a2 2 0 0 0 .969 1.78L6 21.7a2 2 0 0 0 2.03.01L11 19.9a2 2 0 0 0 1-1.76V14.9a2 2 0 0 0-.97-1.78L8 11.3a2 2 0 0 0-2.03-.01z",key:"19flxy"}],["path",{d:"M7 17v5",key:"1yj1jh"}]],VW=pt("file-box",GW);const $W=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],WW=pt("file-exclamation-point",$W);const XW=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],qW=pt("file-text",XW);const YW=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}]],Dz=pt("file",YW);const KW=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M7 3v18",key:"bbkbws"}],["path",{d:"M3 7.5h4",key:"zfgn84"}],["path",{d:"M3 12h18",key:"1i2n21"}],["path",{d:"M3 16.5h4",key:"1230mu"}],["path",{d:"M17 3v18",key:"in4fa5"}],["path",{d:"M17 7.5h4",key:"myr1c1"}],["path",{d:"M17 16.5h4",key:"go4c1d"}]],Ep=pt("film",KW);const ZW=[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]],QW=pt("folder-open",ZW);const JW=[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],eX=pt("folder",JW);const tX=[["path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",key:"sc7q7i"}]],nX=pt("funnel",tX);const iX=[["path",{d:"M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4",key:"tonef"}],["path",{d:"M9 18c-4.51 2-5-2-7-2",key:"9comsn"}]],rX=pt("github",iX);const aX=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]],GE=pt("globe",aX);const sX=[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]],oX=pt("grip-vertical",sX);const lX=[["line",{x1:"22",x2:"2",y1:"12",y2:"12",key:"1y58io"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}],["line",{x1:"6",x2:"6.01",y1:"16",y2:"16",key:"sgf278"}],["line",{x1:"10",x2:"10.01",y1:"16",y2:"16",key:"1l4acy"}]],Nz=pt("hard-drive",lX);const cX=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]],pT=pt("image",cX);const uX=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],dX=pt("info",uX);const fX=[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]],hX=pt("key",fX);const pX=[["path",{d:"M10 8h.01",key:"1r9ogq"}],["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M14 8h.01",key:"1primd"}],["path",{d:"M16 12h.01",key:"1l6xoz"}],["path",{d:"M18 8h.01",key:"emo2bl"}],["path",{d:"M6 8h.01",key:"x9i8wu"}],["path",{d:"M7 16h10",key:"wp8him"}],["path",{d:"M8 12h.01",key:"czm47f"}],["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}]],Oz=pt("keyboard",pX);const mX=[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]],Lz=pt("layers",mX);const gX=[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]],vX=pt("layout-grid",gX);const xX=[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]],yX=pt("list",xX);const bX=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],pr=pt("loader-circle",bX);const _X=[["path",{d:"m10 17 5-5-5-5",key:"1bsop3"}],["path",{d:"M15 12H3",key:"6jk70r"}],["path",{d:"M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4",key:"u53s6r"}]],uN=pt("log-in",_X);const SX=[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],wX=pt("log-out",SX);const EX=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"m21 3-7 7",key:"1l2asr"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M9 21H3v-6",key:"wtvkvv"}]],MX=pt("maximize-2",EX);const AX=[["path",{d:"m14 10 7-7",key:"oa77jy"}],["path",{d:"M20 10h-6V4",key:"mjg0md"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M4 14h6v6",key:"rmj7iw"}]],TX=pt("minimize-2",AX);const CX=[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]],RX=pt("moon",CX);const PX=[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]],Yv=pt("package",PX);const DX=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],dN=pt("pencil",DX);const NX=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Kv=pt("plus",NX);const OX=[["path",{d:"M6 18H4a2 2 0 0 1-2-2v-5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2h-2",key:"143wyd"}],["path",{d:"M6 9V3a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1v6",key:"1itne7"}],["rect",{x:"6",y:"14",width:"12",height:"8",rx:"1",key:"1ue0tg"}]],xu=pt("printer",OX);const LX=[["rect",{width:"5",height:"5",x:"3",y:"3",rx:"1",key:"1tu5fj"}],["rect",{width:"5",height:"5",x:"16",y:"3",rx:"1",key:"1v8r4q"}],["rect",{width:"5",height:"5",x:"3",y:"16",rx:"1",key:"1x03jg"}],["path",{d:"M21 16h-3a2 2 0 0 0-2 2v3",key:"177gqh"}],["path",{d:"M21 21v.01",key:"ents32"}],["path",{d:"M12 7v3a2 2 0 0 1-2 2H7",key:"8crl2c"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M12 3h.01",key:"n36tog"}],["path",{d:"M12 16v.01",key:"133mhm"}],["path",{d:"M16 12h1",key:"1slzba"}],["path",{d:"M21 12v.01",key:"1lwtk9"}],["path",{d:"M12 21v-1",key:"1880an"}]],IX=pt("qr-code",LX);const UX=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],mT=pt("refresh-cw",UX);const kX=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]],gT=pt("rotate-ccw",kX);const FX=[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]],Iz=pt("save",FX);const zX=[["path",{d:"M3 7V5a2 2 0 0 1 2-2h2",key:"aa7l1z"}],["path",{d:"M17 3h2a2 2 0 0 1 2 2v2",key:"4qcy5o"}],["path",{d:"M21 17v2a2 2 0 0 1-2 2h-2",key:"6vwrx8"}],["path",{d:"M7 21H5a2 2 0 0 1-2-2v-2",key:"ioqczr"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["path",{d:"m16 16-1.9-1.9",key:"1dq9hf"}]],BX=pt("scan-search",zX);const jX=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],Uz=pt("search",jX);const HX=[["path",{d:"M14 17H5",key:"gfn3mx"}],["path",{d:"M19 7h-9",key:"6i9tg"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]],GX=pt("settings-2",HX);const VX=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],$X=pt("settings",VX);const WX=[["path",{d:"M21 10.656V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h12.344",key:"2acyp4"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],Zv=pt("square-check-big",WX);const XX=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],VE=pt("square",XX);const qX=[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]],kp=pt("star",qX);const YX=[["path",{d:"M21 9a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 15 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2z",key:"1dfntj"}],["path",{d:"M15 3v5a1 1 0 0 0 1 1h5",key:"6s6qgf"}]],KX=pt("sticky-note",YX);const ZX=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]],QX=pt("sun",ZX);const JX=[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]],Fp=pt("tag",JX);const eq=[["path",{d:"M14 4v10.54a4 4 0 1 1-4 0V4a2 2 0 0 1 4 0Z",key:"17jzev"}]],CS=pt("thermometer",eq);const tq=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],yu=pt("trash-2",tq);const nq=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],iq=pt("triangle-alert",nq);const rq=[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]],Qv=pt("upload",rq);const aq=[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}],["path",{d:"M5 12.859a10 10 0 0 1 5.17-2.69",key:"1dl1wf"}],["path",{d:"M19 12.859a10 10 0 0 0-2.007-1.523",key:"4k23kn"}],["path",{d:"M2 8.82a15 15 0 0 1 4.177-2.643",key:"1grhjp"}],["path",{d:"M22 8.82a15 15 0 0 0-11.288-3.764",key:"z3jwby"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],sq=pt("wifi-off",aq);const oq=[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M2 8.82a15 15 0 0 1 20 0",key:"dnpr2z"}],["path",{d:"M5 12.859a10 10 0 0 1 14 0",key:"1x1e6c"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}]],lq=pt("wifi",oq);const cq=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Ji=pt("x",cq);const uq=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"11",x2:"11",y1:"8",y2:"14",key:"1vmskp"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]],dq=pt("zoom-in",uq);const fq=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]],hq=pt("zoom-out",fq),kz=T.createContext(void 0);function pq({children:t}){const[e,n]=T.useState(()=>{const a=localStorage.getItem("theme");return a||(window.matchMedia("(prefers-color-scheme: light)").matches?"light":"dark")});T.useEffect(()=>{const a=document.documentElement;e==="dark"?a.classList.add("dark"):a.classList.remove("dark"),localStorage.setItem("theme",e)},[e]);const i=()=>{n(a=>a==="dark"?"light":"dark")},r=a=>{n(a)};return E.jsx(kz.Provider,{value:{theme:e,toggleTheme:i,setTheme:r},children:t})}function mq(){const t=T.useContext(kz);if(!t)throw new Error("useTheme must be used within a ThemeProvider");return t}function vi({children:t,className:e="",onClick:n,onContextMenu:i}){return E.jsx("div",{className:`bg-bambu-dark-secondary rounded-xl border border-bambu-dark-tertiary ${e}`,onClick:n,onContextMenu:i,children:t})}function Rv({children:t,className:e=""}){return E.jsx("div",{className:`px-6 py-4 border-b border-bambu-dark-tertiary ${e}`,children:t})}function Pi({children:t,className:e=""}){return E.jsx("div",{className:`p-6 ${e}`,children:t})}const gq=[{category:"Navigation",items:[{keys:["1"],description:"Go to Printers"},{keys:["2"],description:"Go to Archives"},{keys:["3"],description:"Go to Statistics"},{keys:["4"],description:"Go to Cloud Profiles"},{keys:["5"],description:"Go to Settings"}]},{category:"Archives",items:[{keys:["/"],description:"Focus search"},{keys:["U"],description:"Open upload modal"},{keys:["Esc"],description:"Clear selection / blur input"},{keys:["Right-click"],description:"Context menu on cards"}]},{category:"General",items:[{keys:["?"],description:"Show this help"}]}];function fN({children:t}){return E.jsx("kbd",{className:"px-2 py-1 text-xs font-mono bg-bambu-dark border border-bambu-dark-tertiary rounded text-white",children:t})}function vq({onClose:t}){return E.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4",onClick:t,children:E.jsx(vi,{className:"w-full max-w-md",onClick:e=>e.stopPropagation(),children:E.jsxs(Pi,{className:"p-0",children:[E.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-bambu-dark-tertiary",children:[E.jsxs("div",{className:"flex items-center gap-2",children:[E.jsx(Oz,{className:"w-5 h-5 text-bambu-green"}),E.jsx("h2",{className:"text-xl font-semibold text-white",children:"Keyboard Shortcuts"})]}),E.jsx("button",{onClick:t,className:"text-bambu-gray hover:text-white transition-colors",children:E.jsx(Ji,{className:"w-5 h-5"})})]}),E.jsx("div",{className:"p-4 space-y-6 max-h-[60vh] overflow-y-auto",children:gq.map(e=>E.jsxs("div",{children:[E.jsx("h3",{className:"text-sm font-medium text-bambu-gray mb-3",children:e.category}),E.jsx("div",{className:"space-y-2",children:e.items.map(n=>E.jsxs("div",{className:"flex items-center justify-between",children:[E.jsx("span",{className:"text-white text-sm",children:n.description}),E.jsx("div",{className:"flex gap-1",children:n.keys.map(i=>E.jsx(fN,{children:i},i))})]},n.description))})]},e.category))}),E.jsx("div",{className:"p-4 border-t border-bambu-dark-tertiary",children:E.jsxs("p",{className:"text-xs text-bambu-gray text-center",children:["Press ",E.jsx(fN,{children:"Esc"})," or click outside to close"]})})]})})})}const xq=[{to:"/",icon:xu,label:"Printers"},{to:"/archives",icon:oW,label:"Archives"},{to:"/stats",icon:gW,label:"Statistics"},{to:"/cloud",icon:hT,label:"Cloud Profiles"},{to:"/settings",icon:$X,label:"Settings"}];function yq(){const t=lz(),{theme:e,toggleTheme:n}=mq(),[i,r]=T.useState(()=>localStorage.getItem("sidebarExpanded")!=="false"),[a,s]=T.useState(!1);T.useEffect(()=>{localStorage.setItem("sidebarExpanded",String(i))},[i]);const l=T.useCallback(c=>{const d=c.target;if(!(d.tagName==="INPUT"||d.tagName==="TEXTAREA"||d.isContentEditable)&&!c.metaKey&&!c.ctrlKey&&!c.altKey)switch(c.key){case"1":c.preventDefault(),t("/");break;case"2":c.preventDefault(),t("/archives");break;case"3":c.preventDefault(),t("/stats");break;case"4":c.preventDefault(),t("/cloud");break;case"5":c.preventDefault(),t("/settings");break;case"?":c.preventDefault(),s(!0);break;case"Escape":s(!1);break}},[t]);return T.useEffect(()=>(document.addEventListener("keydown",l),()=>document.removeEventListener("keydown",l)),[l]),E.jsxs("div",{className:"flex min-h-screen",children:[E.jsxs("aside",{className:`${i?"w-64":"w-16"} bg-bambu-dark-secondary border-r border-bambu-dark-tertiary flex flex-col fixed inset-y-0 left-0 z-30 transition-all duration-300`,children:[E.jsx("div",{className:"p-4 border-b border-bambu-dark-tertiary flex items-center justify-center overflow-hidden",children:E.jsx("div",{className:`${i?"":"w-10 h-10 overflow-hidden"}`,children:E.jsx("img",{src:e==="dark"?"/img/bambusy_logo_dark.png":"/img/bambusy_logo_light.png",alt:"Bambusy",className:i?"h-16 w-auto":"h-10 w-auto max-w-none"})})}),E.jsx("nav",{className:"flex-1 p-2",children:E.jsx("ul",{className:"space-y-2",children:xq.map(({to:c,icon:d,label:f})=>E.jsx("li",{children:E.jsxs(gz,{to:c,className:({isActive:h})=>`flex items-center ${i?"gap-3 px-4":"justify-center px-2"} py-3 rounded-lg transition-colors ${h?"bg-bambu-green text-white":"text-bambu-gray-light hover:bg-bambu-dark-tertiary hover:text-white"}`,title:i?void 0:f,children:[E.jsx(d,{className:"w-5 h-5 flex-shrink-0"}),i&&E.jsx("span",{children:f})]})},c))})}),E.jsx("button",{onClick:()=>r(!i),className:"p-2 mx-2 mb-2 rounded-lg hover:bg-bambu-dark-tertiary transition-colors text-bambu-gray-light hover:text-white flex items-center justify-center",title:i?"Collapse sidebar":"Expand sidebar",children:i?E.jsx(gf,{className:"w-5 h-5"}):E.jsx(vm,{className:"w-5 h-5"})}),E.jsx("div",{className:"p-2 border-t border-bambu-dark-tertiary",children:E.jsxs("div",{className:`flex items-center ${i?"justify-between px-2":"flex-col gap-2"}`,children:[i&&E.jsx("span",{className:"text-sm text-bambu-gray",children:"v0.1.1"}),E.jsxs("div",{className:"flex items-center gap-1",children:[E.jsx("a",{href:"https://github.com/maziggy/bambusy",target:"_blank",rel:"noopener noreferrer",className:"p-2 rounded-lg hover:bg-bambu-dark-tertiary transition-colors text-bambu-gray-light hover:text-white",title:"View on GitHub",children:E.jsx(rX,{className:"w-5 h-5"})}),E.jsx("button",{onClick:()=>s(!0),className:"p-2 rounded-lg hover:bg-bambu-dark-tertiary transition-colors text-bambu-gray-light hover:text-white",title:"Keyboard shortcuts (?)",children:E.jsx(Oz,{className:"w-5 h-5"})}),E.jsx("button",{onClick:n,className:"p-2 rounded-lg hover:bg-bambu-dark-tertiary transition-colors text-bambu-gray-light hover:text-white",title:e==="dark"?"Switch to light mode":"Switch to dark mode",children:e==="dark"?E.jsx(QX,{className:"w-5 h-5"}):E.jsx(RX,{className:"w-5 h-5"})})]})]})})]}),E.jsx("main",{className:`flex-1 bg-bambu-dark overflow-auto ${i?"ml-64":"ml-16"} transition-all duration-300`,children:E.jsx(B$,{})}),a&&E.jsx(vq,{onClose:()=>s(!1)})]})}const Rr="/api/v1";async function cn(t,e={}){const n=await fetch(`${Rr}${t}`,{...e,headers:{"Content-Type":"application/json",...e.headers}});if(!n.ok){const i=await n.json().catch(()=>({}));throw new Error(i.detail||`HTTP ${n.status}`)}return n.json()}const Mt={getPrinters:()=>cn("/printers/"),getPrinter:t=>cn(`/printers/${t}`),createPrinter:t=>cn("/printers/",{method:"POST",body:JSON.stringify(t)}),updatePrinter:(t,e)=>cn(`/printers/${t}`,{method:"PATCH",body:JSON.stringify(e)}),deletePrinter:t=>cn(`/printers/${t}`,{method:"DELETE"}),getPrinterStatus:t=>cn(`/printers/${t}/status`),connectPrinter:t=>cn(`/printers/${t}/connect`,{method:"POST"}),disconnectPrinter:t=>cn(`/printers/${t}/disconnect`,{method:"POST"}),getPrinterFiles:(t,e="/")=>cn(`/printers/${t}/files?path=${encodeURIComponent(e)}`),getPrinterFileDownloadUrl:(t,e)=>`${Rr}/printers/${t}/files/download?path=${encodeURIComponent(e)}`,deletePrinterFile:(t,e)=>cn(`/printers/${t}/files?path=${encodeURIComponent(e)}`,{method:"DELETE"}),getPrinterStorage:t=>cn(`/printers/${t}/storage`),getArchives:(t,e=50,n=0)=>{const i=new URLSearchParams;return t&&i.set("printer_id",String(t)),i.set("limit",String(e)),i.set("offset",String(n)),cn(`/archives/?${i}`)},getArchive:t=>cn(`/archives/${t}`),updateArchive:(t,e)=>cn(`/archives/${t}`,{method:"PATCH",body:JSON.stringify(e)}),toggleFavorite:t=>cn(`/archives/${t}/favorite`,{method:"POST"}),deleteArchive:t=>cn(`/archives/${t}`,{method:"DELETE"}),getArchiveStats:()=>cn("/archives/stats"),getArchiveThumbnail:t=>`${Rr}/archives/${t}/thumbnail`,getArchiveDownload:t=>`${Rr}/archives/${t}/download`,getArchiveGcode:t=>`${Rr}/archives/${t}/gcode`,getArchiveTimelapse:t=>`${Rr}/archives/${t}/timelapse`,scanArchiveTimelapse:t=>cn(`/archives/${t}/timelapse/scan`,{method:"POST"}),uploadArchiveTimelapse:async(t,e)=>{const n=new FormData;n.append("file",e);const i=await fetch(`${Rr}/archives/${t}/timelapse/upload`,{method:"POST",body:n});if(!i.ok){const r=await i.json().catch(()=>({}));throw new Error(r.detail||`HTTP ${i.status}`)}return i.json()},getArchivePhotoUrl:(t,e)=>`${Rr}/archives/${t}/photos/${encodeURIComponent(e)}`,uploadArchivePhoto:async(t,e)=>{const n=new FormData;n.append("file",e);const i=await fetch(`${Rr}/archives/${t}/photos`,{method:"POST",body:n});if(!i.ok){const r=await i.json().catch(()=>({}));throw new Error(r.detail||`HTTP ${i.status}`)}return i.json()},deleteArchivePhoto:(t,e)=>cn(`/archives/${t}/photos/${encodeURIComponent(e)}`,{method:"DELETE"}),getArchiveQRCodeUrl:(t,e=200)=>`${Rr}/archives/${t}/qrcode?size=${e}`,getArchiveCapabilities:t=>cn(`/archives/${t}/capabilities`),getArchiveForSlicer:(t,e)=>`${Rr}/archives/${t}/file/${encodeURIComponent(e.endsWith(".3mf")?e:e+".3mf")}`,reprintArchive:(t,e)=>cn(`/archives/${t}/reprint?printer_id=${e}`,{method:"POST"}),uploadArchive:async(t,e)=>{const n=new FormData;n.append("file",t);const i=e?`${Rr}/archives/upload?printer_id=${e}`:`${Rr}/archives/upload`,r=await fetch(i,{method:"POST",body:n});if(!r.ok){const a=await r.json().catch(()=>({}));throw new Error(a.detail||`HTTP ${r.status}`)}return r.json()},uploadArchivesBulk:async(t,e)=>{const n=new FormData;t.forEach(a=>n.append("files",a));const i=e?`${Rr}/archives/upload-bulk?printer_id=${e}`:`${Rr}/archives/upload-bulk`,r=await fetch(i,{method:"POST",body:n});if(!r.ok){const a=await r.json().catch(()=>({}));throw new Error(a.detail||`HTTP ${r.status}`)}return r.json()},getSettings:()=>cn("/settings/"),updateSettings:t=>cn("/settings/",{method:"PUT",body:JSON.stringify(t)}),resetSettings:()=>cn("/settings/reset",{method:"POST"}),getCloudStatus:()=>cn("/cloud/status"),cloudLogin:(t,e,n="global")=>cn("/cloud/login",{method:"POST",body:JSON.stringify({email:t,password:e,region:n})}),cloudVerify:(t,e)=>cn("/cloud/verify",{method:"POST",body:JSON.stringify({email:t,code:e})}),cloudSetToken:t=>cn("/cloud/token",{method:"POST",body:JSON.stringify({access_token:t})}),cloudLogout:()=>cn("/cloud/logout",{method:"POST"}),getCloudSettings:(t="01.09.00.00")=>cn(`/cloud/settings?version=${t}`),getCloudSettingDetail:t=>cn(`/cloud/settings/${t}`),getCloudDevices:()=>cn("/cloud/devices")};function At({variant:t="primary",size:e="md",className:n="",children:i,...r}){const a="inline-flex items-center justify-center font-medium rounded-lg transition-colors focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-offset-bambu-dark disabled:opacity-50 disabled:cursor-not-allowed",s={primary:"bg-bambu-green hover:bg-bambu-green-light text-white focus:ring-bambu-green",secondary:"bg-bambu-dark-tertiary hover:bg-bambu-gray-dark text-white focus:ring-bambu-gray",danger:"bg-red-600 hover:bg-red-700 text-white focus:ring-red-500",ghost:"bg-transparent hover:bg-bambu-dark-tertiary text-bambu-gray-light hover:text-white"},l={sm:"px-3 py-1.5 text-sm gap-1.5",md:"px-4 py-2 text-sm gap-2",lg:"px-6 py-3 text-base gap-2"};return E.jsx("button",{className:`${a} ${s[t]} ${l[e]} ${n}`,...r,children:i})}function zf({title:t,message:e,confirmText:n="Confirm",cancelText:i="Cancel",variant:r="default",onConfirm:a,onCancel:s}){T.useEffect(()=>{const d=f=>{f.key==="Escape"&&s()};return window.addEventListener("keydown",d),()=>window.removeEventListener("keydown",d)},[s]);const c={danger:{icon:"text-red-400",button:"bg-red-500 hover:bg-red-600"},warning:{icon:"text-yellow-400",button:"bg-yellow-500 hover:bg-yellow-600"},default:{icon:"text-bambu-green",button:"bg-bambu-green hover:bg-bambu-green-dark"}}[r];return E.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4",onClick:s,children:E.jsx(vi,{className:"w-full max-w-md",onClick:d=>d.stopPropagation(),children:E.jsxs(Pi,{className:"p-6",children:[E.jsxs("div",{className:"flex items-start gap-4",children:[E.jsx("div",{className:`p-2 rounded-full bg-bambu-dark ${c.icon}`,children:E.jsx(iq,{className:"w-6 h-6"})}),E.jsxs("div",{className:"flex-1",children:[E.jsx("h3",{className:"text-lg font-semibold text-white mb-2",children:t}),E.jsx("p",{className:"text-bambu-gray text-sm",children:e})]})]}),E.jsxs("div",{className:"flex gap-3 mt-6",children:[E.jsx(At,{variant:"secondary",onClick:s,className:"flex-1",children:i}),E.jsx(At,{onClick:a,className:`flex-1 ${c.button}`,children:n})]})]})})})}const Fz=T.createContext(void 0);function Lu(){const t=T.useContext(Fz);if(!t)throw new Error("useToast must be used within a ToastProvider");return t}const bq={success:E.jsx(fT,{className:"w-5 h-5 text-green-400"}),error:E.jsx(Pz,{className:"w-5 h-5 text-red-400"}),warning:E.jsx(dT,{className:"w-5 h-5 text-yellow-400"}),info:E.jsx(dX,{className:"w-5 h-5 text-blue-400"})},_q={success:"bg-green-500/10 border-green-500/30",error:"bg-red-500/10 border-red-500/30",warning:"bg-yellow-500/10 border-yellow-500/30",info:"bg-blue-500/10 border-blue-500/30"};function Sq({children:t}){const[e,n]=T.useState([]),i=T.useCallback((a,s="success")=>{const l=Math.random().toString(36).substr(2,9);n(c=>[...c,{id:l,message:a,type:s}]),setTimeout(()=>{n(c=>c.filter(d=>d.id!==l))},3e3)},[]),r=T.useCallback(a=>{n(s=>s.filter(l=>l.id!==a))},[]);return E.jsxs(Fz.Provider,{value:{showToast:i},children:[t,E.jsx("div",{className:"fixed bottom-4 right-4 z-50 flex flex-col gap-2",children:e.map(a=>E.jsxs("div",{className:`flex items-center gap-3 px-4 py-3 rounded-lg border shadow-lg backdrop-blur-sm animate-slide-in ${_q[a.type]}`,children:[bq[a.type],E.jsx("span",{className:"text-white text-sm",children:a.message}),E.jsx("button",{onClick:()=>r(a.id),className:"ml-2 text-bambu-gray hover:text-white transition-colors",children:E.jsx(Ji,{className:"w-4 h-4"})})]},a.id))})]})}function wq(t){if(t===0)return"0 B";const e=1024,n=["B","KB","MB","GB"],i=Math.floor(Math.log(t)/Math.log(e));return`${parseFloat((t/Math.pow(e,i)).toFixed(1))} ${n[i]}`}function Eq(t){if(t===0)return"0 GB";const e=t/(1024*1024*1024);return e>=1?`${e.toFixed(1)} GB`:`${(t/(1024*1024)).toFixed(0)} MB`}function Mq(t,e){if(e)return eX;switch(t.toLowerCase().split(".").pop()||""){case"3mf":return VW;case"gcode":return qW;case"mp4":case"avi":return Ep;case"png":case"jpg":case"jpeg":return pT;default:return Dz}}function Aq({printerId:t,printerName:e,onClose:n}){const{showToast:i}=Lu(),r=wa(),[a,s]=T.useState("/"),[l,c]=T.useState(null),[d,f]=T.useState(""),[h,g]=T.useState(null);T.useEffect(()=>{const C=F=>{F.key==="Escape"&&n()};return window.addEventListener("keydown",C),()=>window.removeEventListener("keydown",C)},[n]);const{data:m,isLoading:b,refetch:y}=Ki({queryKey:["printerFiles",t,a],queryFn:()=>Mt.getPrinterFiles(t,a)}),{data:x}=Ki({queryKey:["printerStorage",t],queryFn:()=>Mt.getPrinterStorage(t),staleTime:3e4}),v=Qi({mutationFn:C=>Mt.deletePrinterFile(t,C),onSuccess:(C,F)=>{i(`Deleted: ${F.split("/").pop()}`),r.invalidateQueries({queryKey:["printerFiles",t]}),c(null)},onError:C=>{i(`Delete failed: ${C.message}`,"error")}}),w=C=>{s(C),c(null)},S=()=>{if(a==="/")return;const C=a.split("/").filter(Boolean);C.pop(),s(C.length?"/"+C.join("/"):"/"),c(null)},A=C=>{window.open(Mt.getPrinterFileDownloadUrl(t,C),"_blank")},R=C=>{g(C)},N=[{path:"/",label:"Root"},{path:"/cache",label:"Cache"},{path:"/model",label:"Models"},{path:"/timelapse",label:"Timelapse"}];return E.jsxs("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4",onClick:n,children:[E.jsxs("div",{className:"w-full max-w-3xl max-h-[85vh] flex flex-col bg-bambu-dark-secondary rounded-xl border border-bambu-dark-tertiary overflow-hidden",onClick:C=>C.stopPropagation(),children:[E.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-bambu-dark-tertiary flex-shrink-0",children:[E.jsxs("div",{className:"flex items-center gap-3",children:[E.jsx(Nz,{className:"w-5 h-5 text-bambu-green"}),E.jsxs("div",{children:[E.jsx("h2",{className:"text-lg font-semibold text-white",children:"File Manager"}),E.jsx("p",{className:"text-sm text-bambu-gray",children:e})]})]}),E.jsxs("div",{className:"flex items-center gap-4",children:[x?.used_bytes!=null&&x.used_bytes>0&&E.jsxs("div",{className:"text-sm text-bambu-gray",children:["Used: ",Eq(x.used_bytes)]}),E.jsx("button",{onClick:n,className:"text-bambu-gray hover:text-white transition-colors",children:E.jsx(Ji,{className:"w-5 h-5"})})]})]}),E.jsxs("div",{className:"flex items-center gap-2 p-3 border-b border-bambu-dark-tertiary bg-bambu-dark/50 flex-shrink-0",children:[N.map(C=>E.jsx("button",{onClick:()=>{w(C.path),f("")},className:`px-3 py-1 text-sm rounded-full transition-colors ${a===C.path?"bg-bambu-green text-white":"bg-bambu-dark-tertiary text-bambu-gray hover:text-white"}`,children:C.label},C.path)),E.jsx("div",{className:"flex-1"}),E.jsxs("div",{className:"relative",children:[E.jsx(Uz,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray"}),E.jsx("input",{type:"text",placeholder:"Filter files...",value:d,onChange:C=>f(C.target.value),className:"w-40 pl-8 pr-3 py-1.5 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-sm focus:border-bambu-green focus:outline-none"})]}),E.jsx(At,{variant:"secondary",size:"sm",onClick:()=>y(),disabled:b,children:E.jsx(mT,{className:`w-4 h-4 ${b?"animate-spin":""}`})})]}),E.jsxs("div",{className:"flex items-center gap-2 px-4 py-2 bg-bambu-dark text-sm flex-shrink-0",children:[E.jsx("button",{onClick:S,disabled:a==="/",className:"p-1 rounded hover:bg-bambu-dark-tertiary disabled:opacity-50 disabled:cursor-not-allowed",children:E.jsx(gf,{className:"w-4 h-4"})}),E.jsx("span",{className:"text-bambu-gray font-mono",children:a})]}),E.jsx("div",{className:"flex-1 overflow-y-auto p-2 min-h-0",children:b?E.jsx("div",{className:"flex items-center justify-center py-12",children:E.jsx(pr,{className:"w-8 h-8 text-bambu-green animate-spin"})}):m?.files?.length?E.jsx("div",{className:"space-y-1",children:[...m.files].filter(C=>!d||C.name.toLowerCase().includes(d.toLowerCase())).sort((C,F)=>C.is_directory&&!F.is_directory?-1:!C.is_directory&&F.is_directory?1:C.name.localeCompare(F.name)).map(C=>{const F=Mq(C.name,C.is_directory),P=l===C.path;return E.jsxs("div",{className:`flex items-center gap-3 p-2 rounded-lg cursor-pointer transition-colors ${P?"bg-bambu-green/20 border border-bambu-green/50":"hover:bg-bambu-dark-tertiary"}`,onClick:()=>{C.is_directory?w(C.path):c(P?null:C.path)},children:[E.jsx(F,{className:`w-5 h-5 flex-shrink-0 ${C.is_directory?"text-bambu-green":"text-bambu-gray"}`}),E.jsx("span",{className:"flex-1 text-white truncate",children:C.name}),!C.is_directory&&E.jsx("span",{className:"text-sm text-bambu-gray",children:wq(C.size)}),C.is_directory&&E.jsx(gf,{className:"w-4 h-4 text-bambu-gray rotate-180"})]},C.path)})}):E.jsx("div",{className:"text-center py-12 text-bambu-gray",children:"No files in this directory"})}),E.jsxs("div",{className:"flex items-center justify-between p-4 border-t border-bambu-dark-tertiary bg-bambu-dark/50 flex-shrink-0",children:[E.jsx("div",{className:"text-sm text-bambu-gray",children:d?`${m?.files?.filter(C=>C.name.toLowerCase().includes(d.toLowerCase())).length||0} of ${m?.files?.length||0} items`:`${m?.files?.length||0} items`}),E.jsxs("div",{className:"flex gap-2",children:[E.jsxs(At,{variant:"secondary",disabled:!l,onClick:()=>l&&A(l),children:[E.jsx(ou,{className:"w-4 h-4"}),"Download"]}),E.jsxs(At,{variant:"secondary",disabled:!l||v.isPending,onClick:()=>l&&R(l),className:"text-red-400 hover:text-red-300",children:[v.isPending?E.jsx(pr,{className:"w-4 h-4 animate-spin"}):E.jsx(yu,{className:"w-4 h-4"}),"Delete"]})]})]})]}),h&&E.jsx(zf,{title:"Delete File",message:`Delete "${h.split("/").pop()}"? This cannot be undone.`,confirmText:"Delete",variant:"danger",onConfirm:()=>{v.mutate(h),g(null)},onCancel:()=>g(null)})]})}function Tq(t){const e=Math.floor(t/3600),n=Math.floor(t%3600/60);return e>0?`${e}h ${n}m`:`${n}m`}function Cq({url:t,printName:e}){const[n,i]=T.useState(!1),[r,a]=T.useState(!1),[s,l]=T.useState(!1);return E.jsxs(E.Fragment,{children:[E.jsx("div",{className:`w-20 h-20 flex-shrink-0 rounded-lg overflow-hidden bg-bambu-dark-tertiary flex items-center justify-center ${t&&n?"cursor-pointer":""}`,onClick:()=>t&&n&&l(!0),children:t&&!r?E.jsxs(E.Fragment,{children:[E.jsx("img",{src:t,alt:"Print preview",className:`w-full h-full object-cover ${n?"block":"hidden"}`,onLoad:()=>i(!0),onError:()=>a(!0)}),!n&&E.jsx(Up,{className:"w-8 h-8 text-bambu-gray"})]}):E.jsx(Up,{className:"w-8 h-8 text-bambu-gray"})}),s&&t&&E.jsx("div",{className:"fixed inset-0 bg-black/80 flex items-center justify-center z-50 p-8",onClick:()=>l(!1),children:E.jsxs("div",{className:"relative max-w-2xl max-h-full",children:[E.jsx("img",{src:t,alt:"Print preview",className:"max-w-full max-h-[80vh] rounded-lg shadow-2xl"}),e&&E.jsx("p",{className:"text-white text-center mt-4 text-lg",children:e})]})})]})}function Rq({printer:t}){const e=wa(),[n,i]=T.useState(!1),[r,a]=T.useState(!1),[s,l]=T.useState(!1),{data:c}=Ki({queryKey:["printerStatus",t.id],queryFn:()=>Mt.getPrinterStatus(t.id),refetchInterval:3e4}),d=Qi({mutationFn:()=>Mt.deletePrinter(t.id),onSuccess:()=>{e.invalidateQueries({queryKey:["printers"]})}}),f=Qi({mutationFn:()=>Mt.connectPrinter(t.id),onSuccess:()=>{e.invalidateQueries({queryKey:["printerStatus",t.id]})}});return E.jsxs(vi,{className:"relative",children:[E.jsxs(Pi,{children:[E.jsxs("div",{className:"flex items-start justify-between mb-4",children:[E.jsxs("div",{children:[E.jsx("h3",{className:"text-lg font-semibold text-white",children:t.name}),E.jsx("p",{className:"text-sm text-bambu-gray",children:t.model||"Unknown Model"})]}),E.jsxs("div",{className:"flex items-center gap-2",children:[E.jsxs("span",{className:`flex items-center gap-1.5 px-2 py-1 rounded-full text-xs ${c?.connected?"bg-bambu-green/20 text-bambu-green":"bg-red-500/20 text-red-400"}`,children:[c?.connected?E.jsx(lq,{className:"w-3 h-3"}):E.jsx(sq,{className:"w-3 h-3"}),c?.connected?"Connected":"Offline"]}),E.jsxs("div",{className:"relative",children:[E.jsx(At,{variant:"ghost",size:"sm",onClick:()=>i(!n),children:E.jsx(FW,{className:"w-4 h-4"})}),n&&E.jsxs("div",{className:"absolute right-0 mt-2 w-48 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg shadow-lg z-10",children:[E.jsxs("button",{className:"w-full px-4 py-2 text-left text-sm hover:bg-bambu-dark-tertiary flex items-center gap-2",onClick:()=>{f.mutate(),i(!1)},children:[E.jsx(mT,{className:"w-4 h-4"}),"Reconnect"]}),E.jsxs("button",{className:"w-full px-4 py-2 text-left text-sm text-red-400 hover:bg-bambu-dark-tertiary flex items-center gap-2",onClick:()=>{a(!0),i(!1)},children:[E.jsx(yu,{className:"w-4 h-4"}),"Delete"]})]})]})]})]}),r&&E.jsx(zf,{title:"Delete Printer",message:`Are you sure you want to delete "${t.name}"? This will also remove all connection settings.`,confirmText:"Delete",variant:"danger",onConfirm:()=>{d.mutate(),a(!1)},onCancel:()=>a(!1)}),c?.connected&&E.jsxs(E.Fragment,{children:[E.jsxs("div",{className:"mb-4",children:[E.jsx("p",{className:"text-sm text-bambu-gray mb-1",children:"Status"}),E.jsx("p",{className:"text-white font-medium capitalize",children:c.state?.toLowerCase()||"Idle"})]}),c.current_print&&c.state==="RUNNING"&&E.jsx("div",{className:"mb-4 p-3 bg-bambu-dark rounded-lg",children:E.jsxs("div",{className:"flex gap-3",children:[E.jsx(Cq,{url:c.cover_url,printName:c.subtask_name||c.current_print||void 0}),E.jsxs("div",{className:"flex-1 min-w-0",children:[E.jsx("p",{className:"text-sm text-bambu-gray mb-1",children:"Printing"}),E.jsx("p",{className:"text-white text-sm mb-2 truncate",children:c.subtask_name||c.current_print}),E.jsxs("div",{className:"flex items-center justify-between text-sm",children:[E.jsx("div",{className:"flex-1 bg-bambu-dark-tertiary rounded-full h-2 mr-3",children:E.jsx("div",{className:"bg-bambu-green h-2 rounded-full transition-all",style:{width:`${c.progress||0}%`}})}),E.jsxs("span",{className:"text-white",children:[Math.round(c.progress||0),"%"]})]}),E.jsxs("div",{className:"flex items-center gap-3 mt-2 text-xs text-bambu-gray",children:[c.remaining_time!=null&&c.remaining_time>0&&E.jsxs("span",{className:"flex items-center gap-1",children:[E.jsx(dy,{className:"w-3 h-3"}),Tq(c.remaining_time*60)]}),c.layer_num!=null&&c.total_layers!=null&&c.total_layers>0&&E.jsxs("span",{children:["Layer ",c.layer_num,"/",c.total_layers]})]})]})]})}),c.temperatures&&E.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[E.jsxs("div",{className:"text-center p-2 bg-bambu-dark rounded-lg",children:[E.jsx(CS,{className:"w-4 h-4 mx-auto mb-1 text-orange-400"}),E.jsx("p",{className:"text-xs text-bambu-gray",children:"Nozzle"}),E.jsxs("p",{className:"text-sm text-white",children:[Math.round(c.temperatures.nozzle||0),"°C"]})]}),E.jsxs("div",{className:"text-center p-2 bg-bambu-dark rounded-lg",children:[E.jsx(CS,{className:"w-4 h-4 mx-auto mb-1 text-blue-400"}),E.jsx("p",{className:"text-xs text-bambu-gray",children:"Bed"}),E.jsxs("p",{className:"text-sm text-white",children:[Math.round(c.temperatures.bed||0),"°C"]})]}),c.temperatures.chamber!==void 0&&E.jsxs("div",{className:"text-center p-2 bg-bambu-dark rounded-lg",children:[E.jsx(CS,{className:"w-4 h-4 mx-auto mb-1 text-green-400"}),E.jsx("p",{className:"text-xs text-bambu-gray",children:"Chamber"}),E.jsxs("p",{className:"text-sm text-white",children:[Math.round(c.temperatures.chamber||0),"°C"]})]})]})]}),E.jsxs("div",{className:"mt-4 pt-4 border-t border-bambu-dark-tertiary flex items-center justify-between",children:[E.jsxs("div",{className:"text-xs text-bambu-gray",children:[E.jsx("p",{children:t.ip_address}),E.jsx("p",{className:"truncate",children:t.serial_number})]}),E.jsxs(At,{variant:"secondary",size:"sm",onClick:()=>l(!0),title:"Browse printer files",children:[E.jsx(Nz,{className:"w-4 h-4"}),"Files"]})]})]}),s&&E.jsx(Aq,{printerId:t.id,printerName:t.name,onClose:()=>l(!1)})]})}function Pq({onClose:t,onAdd:e}){const[n,i]=T.useState({name:"",serial_number:"",ip_address:"",access_code:"",model:"",auto_archive:!0});return T.useEffect(()=>{const r=a=>{a.key==="Escape"&&t()};return window.addEventListener("keydown",r),()=>window.removeEventListener("keydown",r)},[t]),E.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",onClick:t,children:E.jsx(vi,{className:"w-full max-w-md",onClick:r=>r.stopPropagation(),children:E.jsxs(Pi,{children:[E.jsx("h2",{className:"text-xl font-semibold mb-4",children:"Add Printer"}),E.jsxs("form",{onSubmit:r=>{r.preventDefault(),e(n)},className:"space-y-4",children:[E.jsxs("div",{children:[E.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:"Name"}),E.jsx("input",{type:"text",required:!0,className:"w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none",value:n.name,onChange:r=>i({...n,name:r.target.value}),placeholder:"My Printer"})]}),E.jsxs("div",{children:[E.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:"IP Address"}),E.jsx("input",{type:"text",required:!0,pattern:"\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}",className:"w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none",value:n.ip_address,onChange:r=>i({...n,ip_address:r.target.value}),placeholder:"192.168.1.100"})]}),E.jsxs("div",{children:[E.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:"Serial Number"}),E.jsx("input",{type:"text",required:!0,className:"w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none",value:n.serial_number,onChange:r=>i({...n,serial_number:r.target.value}),placeholder:"01P00A000000000"})]}),E.jsxs("div",{children:[E.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:"Access Code"}),E.jsx("input",{type:"password",required:!0,className:"w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none",value:n.access_code,onChange:r=>i({...n,access_code:r.target.value}),placeholder:"From printer settings"})]}),E.jsxs("div",{children:[E.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:"Model (optional)"}),E.jsxs("select",{className:"w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none",value:n.model||"",onChange:r=>i({...n,model:r.target.value}),children:[E.jsx("option",{value:"",children:"Select model..."}),E.jsxs("optgroup",{label:"H2 Series",children:[E.jsx("option",{value:"H2C",children:"H2C"}),E.jsx("option",{value:"H2D",children:"H2D"}),E.jsx("option",{value:"H2S",children:"H2S"})]}),E.jsxs("optgroup",{label:"X1 Series",children:[E.jsx("option",{value:"X1E",children:"X1E"}),E.jsx("option",{value:"X1C",children:"X1 Carbon"}),E.jsx("option",{value:"X1",children:"X1"})]}),E.jsxs("optgroup",{label:"P Series",children:[E.jsx("option",{value:"P2S",children:"P2S"}),E.jsx("option",{value:"P1S",children:"P1S"}),E.jsx("option",{value:"P1P",children:"P1P"})]}),E.jsxs("optgroup",{label:"A1 Series",children:[E.jsx("option",{value:"A1",children:"A1"}),E.jsx("option",{value:"A1 Mini",children:"A1 Mini"})]})]})]}),E.jsxs("div",{className:"flex items-center gap-2",children:[E.jsx("input",{type:"checkbox",id:"auto_archive",checked:n.auto_archive,onChange:r=>i({...n,auto_archive:r.target.checked}),className:"rounded border-bambu-dark-tertiary bg-bambu-dark text-bambu-green focus:ring-bambu-green"}),E.jsx("label",{htmlFor:"auto_archive",className:"text-sm text-bambu-gray",children:"Auto-archive completed prints"})]}),E.jsxs("div",{className:"flex gap-3 pt-4",children:[E.jsx(At,{type:"button",variant:"secondary",onClick:t,className:"flex-1",children:"Cancel"}),E.jsx(At,{type:"submit",className:"flex-1",children:"Add Printer"})]})]})]})})})}function Dq(){const[t,e]=T.useState(!1),n=wa(),{data:i,isLoading:r}=Ki({queryKey:["printers"],queryFn:Mt.getPrinters}),a=Qi({mutationFn:Mt.createPrinter,onSuccess:()=>{n.invalidateQueries({queryKey:["printers"]}),e(!1)}});return E.jsxs("div",{className:"p-8",children:[E.jsxs("div",{className:"flex items-center justify-between mb-8",children:[E.jsxs("div",{children:[E.jsx("h1",{className:"text-2xl font-bold text-white",children:"Printers"}),E.jsx("p",{className:"text-bambu-gray",children:"Manage your Bambu Lab printers"})]}),E.jsxs(At,{onClick:()=>e(!0),children:[E.jsx(Kv,{className:"w-4 h-4"}),"Add Printer"]})]}),r?E.jsx("div",{className:"text-center py-12 text-bambu-gray",children:"Loading printers..."}):i?.length===0?E.jsx(vi,{children:E.jsxs(Pi,{className:"text-center py-12",children:[E.jsx("p",{className:"text-bambu-gray mb-4",children:"No printers configured yet"}),E.jsxs(At,{onClick:()=>e(!0),children:[E.jsx(Kv,{className:"w-4 h-4"}),"Add Your First Printer"]})]})}):E.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:i?.map(s=>E.jsx(Rq,{printer:s},s.id))}),t&&E.jsx(Pq,{onClose:()=>e(!1),onAdd:s=>a.mutate(s)})]})}const vT="181",sf={ROTATE:0,DOLLY:1,PAN:2},ef={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},Nq=0,hN=1,Oq=2,zz=1,Lq=2,To=3,oc=0,Kr=1,Os=2,zo=0,of=1,pN=2,mN=3,gN=4,Iq=5,Zc=100,Uq=101,kq=102,Fq=103,zq=104,Bq=200,jq=201,Hq=202,Gq=203,$E=204,WE=205,Vq=206,$q=207,Wq=208,Xq=209,qq=210,Yq=211,Kq=212,Zq=213,Qq=214,XE=0,qE=1,YE=2,vf=3,KE=4,ZE=5,QE=6,JE=7,xT=0,Jq=1,eY=2,nc=0,tY=1,nY=2,iY=3,rY=4,aY=5,sY=6,oY=7,Bz=300,xf=301,yf=302,eM=303,tM=304,fy=306,nM=1e3,Oo=1001,iM=1002,xa=1003,lY=1004,c0=1005,$a=1006,RS=1007,iu=1008,js=1009,jz=1010,Hz=1011,zp=1012,yT=1013,bu=1014,Lo=1015,Bf=1016,bT=1017,_T=1018,Bp=1020,Gz=35902,Vz=35899,$z=1021,Wz=1022,ms=1023,jp=1026,Hp=1027,Xz=1028,ST=1029,wT=1030,ET=1031,MT=1033,Pv=33776,Dv=33777,Nv=33778,Ov=33779,rM=35840,aM=35841,sM=35842,oM=35843,lM=36196,cM=37492,uM=37496,dM=37808,fM=37809,hM=37810,pM=37811,mM=37812,gM=37813,vM=37814,xM=37815,yM=37816,bM=37817,_M=37818,SM=37819,wM=37820,EM=37821,MM=36492,AM=36494,TM=36495,CM=36283,RM=36284,PM=36285,DM=36286,cY=3200,uY=3201,qz=0,dY=1,Yl="",za="srgb",bf="srgb-linear",Jv="linear",En="srgb",gd=7680,vN=519,fY=512,hY=513,pY=514,Yz=515,mY=516,gY=517,vY=518,xY=519,xN=35044,yN="300 es",Is=2e3,ex=2001;function Kz(t){for(let e=t.length-1;e>=0;--e)if(t[e]>=65535)return!0;return!1}function tx(t){return document.createElementNS("http://www.w3.org/1999/xhtml",t)}function yY(){const t=tx("canvas");return t.style.display="block",t}const bN={};function _N(...t){const e="THREE."+t.shift();console.log(e,...t)}function It(...t){const e="THREE."+t.shift();console.warn(e,...t)}function ai(...t){const e="THREE."+t.shift();console.error(e,...t)}function Gp(...t){const e=t.join(" ");e in bN||(bN[e]=!0,It(...t))}function bY(t,e,n){return new Promise(function(i,r){function a(){switch(t.clientWaitSync(e,t.SYNC_FLUSH_COMMANDS_BIT,0)){case t.WAIT_FAILED:r();break;case t.TIMEOUT_EXPIRED:setTimeout(a,n);break;default:i()}}setTimeout(a,n)})}let Iu=class{addEventListener(e,n){this._listeners===void 0&&(this._listeners={});const i=this._listeners;i[e]===void 0&&(i[e]=[]),i[e].indexOf(n)===-1&&i[e].push(n)}hasEventListener(e,n){const i=this._listeners;return i===void 0?!1:i[e]!==void 0&&i[e].indexOf(n)!==-1}removeEventListener(e,n){const i=this._listeners;if(i===void 0)return;const r=i[e];if(r!==void 0){const a=r.indexOf(n);a!==-1&&r.splice(a,1)}}dispatchEvent(e){const n=this._listeners;if(n===void 0)return;const i=n[e.type];if(i!==void 0){e.target=this;const r=i.slice(0);for(let a=0,s=r.length;a<s;a++)r[a].call(this,e);e.target=null}}};const vr=["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"],Lv=Math.PI/180,NM=180/Math.PI;function xm(){const t=Math.random()*4294967295|0,e=Math.random()*4294967295|0,n=Math.random()*4294967295|0,i=Math.random()*4294967295|0;return(vr[t&255]+vr[t>>8&255]+vr[t>>16&255]+vr[t>>24&255]+"-"+vr[e&255]+vr[e>>8&255]+"-"+vr[e>>16&15|64]+vr[e>>24&255]+"-"+vr[n&63|128]+vr[n>>8&255]+"-"+vr[n>>16&255]+vr[n>>24&255]+vr[i&255]+vr[i>>8&255]+vr[i>>16&255]+vr[i>>24&255]).toLowerCase()}function Qt(t,e,n){return Math.max(e,Math.min(n,t))}function _Y(t,e){return(t%e+e)%e}function PS(t,e,n){return(1-n)*t+n*e}function Kh(t,e){switch(e.constructor){case Float32Array:return t;case Uint32Array:return t/4294967295;case Uint16Array:return t/65535;case Uint8Array:return t/255;case Int32Array:return Math.max(t/2147483647,-1);case Int16Array:return Math.max(t/32767,-1);case Int8Array:return Math.max(t/127,-1);default:throw new Error("Invalid component type.")}}function $r(t,e){switch(e.constructor){case Float32Array:return t;case Uint32Array:return Math.round(t*4294967295);case Uint16Array:return Math.round(t*65535);case Uint8Array:return Math.round(t*255);case Int32Array:return Math.round(t*2147483647);case Int16Array:return Math.round(t*32767);case Int8Array:return Math.round(t*127);default:throw new Error("Invalid component type.")}}const SY={DEG2RAD:Lv};let $t=class Zz{constructor(e=0,n=0){Zz.prototype.isVector2=!0,this.x=e,this.y=n}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,n){return this.x=e,this.y=n,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,n){switch(e){case 0:this.x=n;break;case 1:this.y=n;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,n){return this.x=e.x+n.x,this.y=e.y+n.y,this}addScaledVector(e,n){return this.x+=e.x*n,this.y+=e.y*n,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,n){return this.x=e.x-n.x,this.y=e.y-n.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 n=this.x,i=this.y,r=e.elements;return this.x=r[0]*n+r[3]*i+r[6],this.y=r[1]*n+r[4]*i+r[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,n){return this.x=Qt(this.x,e.x,n.x),this.y=Qt(this.y,e.y,n.y),this}clampScalar(e,n){return this.x=Qt(this.x,e,n),this.y=Qt(this.y,e,n),this}clampLength(e,n){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Qt(i,e,n))}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=Math.trunc(this.x),this.y=Math.trunc(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}angleTo(e){const n=Math.sqrt(this.lengthSq()*e.lengthSq());if(n===0)return Math.PI/2;const i=this.dot(e)/n;return Math.acos(Qt(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const n=this.x-e.x,i=this.y-e.y;return n*n+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,n){return this.x+=(e.x-this.x)*n,this.y+=(e.y-this.y)*n,this}lerpVectors(e,n,i){return this.x=e.x+(n.x-e.x)*i,this.y=e.y+(n.y-e.y)*i,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,n=0){return this.x=e[n],this.y=e[n+1],this}toArray(e=[],n=0){return e[n]=this.x,e[n+1]=this.y,e}fromBufferAttribute(e,n){return this.x=e.getX(n),this.y=e.getY(n),this}rotateAround(e,n){const i=Math.cos(n),r=Math.sin(n),a=this.x-e.x,s=this.y-e.y;return this.x=a*i-s*r+e.x,this.y=a*r+s*i+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}},_u=class{constructor(e=0,n=0,i=0,r=1){this.isQuaternion=!0,this._x=e,this._y=n,this._z=i,this._w=r}static slerpFlat(e,n,i,r,a,s,l){let c=i[r+0],d=i[r+1],f=i[r+2],h=i[r+3],g=a[s+0],m=a[s+1],b=a[s+2],y=a[s+3];if(l<=0){e[n+0]=c,e[n+1]=d,e[n+2]=f,e[n+3]=h;return}if(l>=1){e[n+0]=g,e[n+1]=m,e[n+2]=b,e[n+3]=y;return}if(h!==y||c!==g||d!==m||f!==b){let x=c*g+d*m+f*b+h*y;x<0&&(g=-g,m=-m,b=-b,y=-y,x=-x);let v=1-l;if(x<.9995){const w=Math.acos(x),S=Math.sin(w);v=Math.sin(v*w)/S,l=Math.sin(l*w)/S,c=c*v+g*l,d=d*v+m*l,f=f*v+b*l,h=h*v+y*l}else{c=c*v+g*l,d=d*v+m*l,f=f*v+b*l,h=h*v+y*l;const w=1/Math.sqrt(c*c+d*d+f*f+h*h);c*=w,d*=w,f*=w,h*=w}}e[n]=c,e[n+1]=d,e[n+2]=f,e[n+3]=h}static multiplyQuaternionsFlat(e,n,i,r,a,s){const l=i[r],c=i[r+1],d=i[r+2],f=i[r+3],h=a[s],g=a[s+1],m=a[s+2],b=a[s+3];return e[n]=l*b+f*h+c*m-d*g,e[n+1]=c*b+f*g+d*h-l*m,e[n+2]=d*b+f*m+l*g-c*h,e[n+3]=f*b-l*h-c*g-d*m,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,n,i,r){return this._x=e,this._y=n,this._z=i,this._w=r,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,n=!0){const i=e._x,r=e._y,a=e._z,s=e._order,l=Math.cos,c=Math.sin,d=l(i/2),f=l(r/2),h=l(a/2),g=c(i/2),m=c(r/2),b=c(a/2);switch(s){case"XYZ":this._x=g*f*h+d*m*b,this._y=d*m*h-g*f*b,this._z=d*f*b+g*m*h,this._w=d*f*h-g*m*b;break;case"YXZ":this._x=g*f*h+d*m*b,this._y=d*m*h-g*f*b,this._z=d*f*b-g*m*h,this._w=d*f*h+g*m*b;break;case"ZXY":this._x=g*f*h-d*m*b,this._y=d*m*h+g*f*b,this._z=d*f*b+g*m*h,this._w=d*f*h-g*m*b;break;case"ZYX":this._x=g*f*h-d*m*b,this._y=d*m*h+g*f*b,this._z=d*f*b-g*m*h,this._w=d*f*h+g*m*b;break;case"YZX":this._x=g*f*h+d*m*b,this._y=d*m*h+g*f*b,this._z=d*f*b-g*m*h,this._w=d*f*h-g*m*b;break;case"XZY":this._x=g*f*h-d*m*b,this._y=d*m*h-g*f*b,this._z=d*f*b+g*m*h,this._w=d*f*h+g*m*b;break;default:It("Quaternion: .setFromEuler() encountered an unknown order: "+s)}return n===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,n){const i=n/2,r=Math.sin(i);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(i),this._onChangeCallback(),this}setFromRotationMatrix(e){const n=e.elements,i=n[0],r=n[4],a=n[8],s=n[1],l=n[5],c=n[9],d=n[2],f=n[6],h=n[10],g=i+l+h;if(g>0){const m=.5/Math.sqrt(g+1);this._w=.25/m,this._x=(f-c)*m,this._y=(a-d)*m,this._z=(s-r)*m}else if(i>l&&i>h){const m=2*Math.sqrt(1+i-l-h);this._w=(f-c)/m,this._x=.25*m,this._y=(r+s)/m,this._z=(a+d)/m}else if(l>h){const m=2*Math.sqrt(1+l-i-h);this._w=(a-d)/m,this._x=(r+s)/m,this._y=.25*m,this._z=(c+f)/m}else{const m=2*Math.sqrt(1+h-i-l);this._w=(s-r)/m,this._x=(a+d)/m,this._y=(c+f)/m,this._z=.25*m}return this._onChangeCallback(),this}setFromUnitVectors(e,n){let i=e.dot(n)+1;return i<1e-8?(i=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=i):(this._x=0,this._y=-e.z,this._z=e.y,this._w=i)):(this._x=e.y*n.z-e.z*n.y,this._y=e.z*n.x-e.x*n.z,this._z=e.x*n.y-e.y*n.x,this._w=i),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(Qt(this.dot(e),-1,1)))}rotateTowards(e,n){const i=this.angleTo(e);if(i===0)return this;const r=Math.min(1,n/i);return this.slerp(e,r),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,n){const i=e._x,r=e._y,a=e._z,s=e._w,l=n._x,c=n._y,d=n._z,f=n._w;return this._x=i*f+s*l+r*d-a*c,this._y=r*f+s*c+a*l-i*d,this._z=a*f+s*d+i*c-r*l,this._w=s*f-i*l-r*c-a*d,this._onChangeCallback(),this}slerp(e,n){if(n<=0)return this;if(n>=1)return this.copy(e);let i=e._x,r=e._y,a=e._z,s=e._w,l=this.dot(e);l<0&&(i=-i,r=-r,a=-a,s=-s,l=-l);let c=1-n;if(l<.9995){const d=Math.acos(l),f=Math.sin(d);c=Math.sin(c*d)/f,n=Math.sin(n*d)/f,this._x=this._x*c+i*n,this._y=this._y*c+r*n,this._z=this._z*c+a*n,this._w=this._w*c+s*n,this._onChangeCallback()}else this._x=this._x*c+i*n,this._y=this._y*c+r*n,this._z=this._z*c+a*n,this._w=this._w*c+s*n,this.normalize();return this}slerpQuaternions(e,n,i){return this.copy(e).slerp(n,i)}random(){const e=2*Math.PI*Math.random(),n=2*Math.PI*Math.random(),i=Math.random(),r=Math.sqrt(1-i),a=Math.sqrt(i);return this.set(r*Math.sin(e),r*Math.cos(e),a*Math.sin(n),a*Math.cos(n))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,n=0){return this._x=e[n],this._y=e[n+1],this._z=e[n+2],this._w=e[n+3],this._onChangeCallback(),this}toArray(e=[],n=0){return e[n]=this._x,e[n+1]=this._y,e[n+2]=this._z,e[n+3]=this._w,e}fromBufferAttribute(e,n){return this._x=e.getX(n),this._y=e.getY(n),this._z=e.getZ(n),this._w=e.getW(n),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}},Ve=class Qz{constructor(e=0,n=0,i=0){Qz.prototype.isVector3=!0,this.x=e,this.y=n,this.z=i}set(e,n,i){return i===void 0&&(i=this.z),this.x=e,this.y=n,this.z=i,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,n){switch(e){case 0:this.x=n;break;case 1:this.y=n;break;case 2:this.z=n;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,n){return this.x=e.x+n.x,this.y=e.y+n.y,this.z=e.z+n.z,this}addScaledVector(e,n){return this.x+=e.x*n,this.y+=e.y*n,this.z+=e.z*n,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,n){return this.x=e.x-n.x,this.y=e.y-n.y,this.z=e.z-n.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,n){return this.x=e.x*n.x,this.y=e.y*n.y,this.z=e.z*n.z,this}applyEuler(e){return this.applyQuaternion(SN.setFromEuler(e))}applyAxisAngle(e,n){return this.applyQuaternion(SN.setFromAxisAngle(e,n))}applyMatrix3(e){const n=this.x,i=this.y,r=this.z,a=e.elements;return this.x=a[0]*n+a[3]*i+a[6]*r,this.y=a[1]*n+a[4]*i+a[7]*r,this.z=a[2]*n+a[5]*i+a[8]*r,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const n=this.x,i=this.y,r=this.z,a=e.elements,s=1/(a[3]*n+a[7]*i+a[11]*r+a[15]);return this.x=(a[0]*n+a[4]*i+a[8]*r+a[12])*s,this.y=(a[1]*n+a[5]*i+a[9]*r+a[13])*s,this.z=(a[2]*n+a[6]*i+a[10]*r+a[14])*s,this}applyQuaternion(e){const n=this.x,i=this.y,r=this.z,a=e.x,s=e.y,l=e.z,c=e.w,d=2*(s*r-l*i),f=2*(l*n-a*r),h=2*(a*i-s*n);return this.x=n+c*d+s*h-l*f,this.y=i+c*f+l*d-a*h,this.z=r+c*h+a*f-s*d,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const n=this.x,i=this.y,r=this.z,a=e.elements;return this.x=a[0]*n+a[4]*i+a[8]*r,this.y=a[1]*n+a[5]*i+a[9]*r,this.z=a[2]*n+a[6]*i+a[10]*r,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,n){return this.x=Qt(this.x,e.x,n.x),this.y=Qt(this.y,e.y,n.y),this.z=Qt(this.z,e.z,n.z),this}clampScalar(e,n){return this.x=Qt(this.x,e,n),this.y=Qt(this.y,e,n),this.z=Qt(this.z,e,n),this}clampLength(e,n){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Qt(i,e,n))}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=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(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,n){return this.x+=(e.x-this.x)*n,this.y+=(e.y-this.y)*n,this.z+=(e.z-this.z)*n,this}lerpVectors(e,n,i){return this.x=e.x+(n.x-e.x)*i,this.y=e.y+(n.y-e.y)*i,this.z=e.z+(n.z-e.z)*i,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,n){const i=e.x,r=e.y,a=e.z,s=n.x,l=n.y,c=n.z;return this.x=r*c-a*l,this.y=a*s-i*c,this.z=i*l-r*s,this}projectOnVector(e){const n=e.lengthSq();if(n===0)return this.set(0,0,0);const i=e.dot(this)/n;return this.copy(e).multiplyScalar(i)}projectOnPlane(e){return DS.copy(this).projectOnVector(e),this.sub(DS)}reflect(e){return this.sub(DS.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const n=Math.sqrt(this.lengthSq()*e.lengthSq());if(n===0)return Math.PI/2;const i=this.dot(e)/n;return Math.acos(Qt(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const n=this.x-e.x,i=this.y-e.y,r=this.z-e.z;return n*n+i*i+r*r}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,n,i){const r=Math.sin(n)*e;return this.x=r*Math.sin(i),this.y=Math.cos(n)*e,this.z=r*Math.cos(i),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,n,i){return this.x=e*Math.sin(n),this.y=i,this.z=e*Math.cos(n),this}setFromMatrixPosition(e){const n=e.elements;return this.x=n[12],this.y=n[13],this.z=n[14],this}setFromMatrixScale(e){const n=this.setFromMatrixColumn(e,0).length(),i=this.setFromMatrixColumn(e,1).length(),r=this.setFromMatrixColumn(e,2).length();return this.x=n,this.y=i,this.z=r,this}setFromMatrixColumn(e,n){return this.fromArray(e.elements,n*4)}setFromMatrix3Column(e,n){return this.fromArray(e.elements,n*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,n=0){return this.x=e[n],this.y=e[n+1],this.z=e[n+2],this}toArray(e=[],n=0){return e[n]=this.x,e[n+1]=this.y,e[n+2]=this.z,e}fromBufferAttribute(e,n){return this.x=e.getX(n),this.y=e.getY(n),this.z=e.getZ(n),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=Math.random()*Math.PI*2,n=Math.random()*2-1,i=Math.sqrt(1-n*n);return this.x=i*Math.cos(e),this.y=n,this.z=i*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}};const DS=new Ve,SN=new _u;let Xt=class Jz{constructor(e,n,i,r,a,s,l,c,d){Jz.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,n,i,r,a,s,l,c,d)}set(e,n,i,r,a,s,l,c,d){const f=this.elements;return f[0]=e,f[1]=r,f[2]=l,f[3]=n,f[4]=a,f[5]=c,f[6]=i,f[7]=s,f[8]=d,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const n=this.elements,i=e.elements;return n[0]=i[0],n[1]=i[1],n[2]=i[2],n[3]=i[3],n[4]=i[4],n[5]=i[5],n[6]=i[6],n[7]=i[7],n[8]=i[8],this}extractBasis(e,n,i){return e.setFromMatrix3Column(this,0),n.setFromMatrix3Column(this,1),i.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const n=e.elements;return this.set(n[0],n[4],n[8],n[1],n[5],n[9],n[2],n[6],n[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,n){const i=e.elements,r=n.elements,a=this.elements,s=i[0],l=i[3],c=i[6],d=i[1],f=i[4],h=i[7],g=i[2],m=i[5],b=i[8],y=r[0],x=r[3],v=r[6],w=r[1],S=r[4],A=r[7],R=r[2],N=r[5],C=r[8];return a[0]=s*y+l*w+c*R,a[3]=s*x+l*S+c*N,a[6]=s*v+l*A+c*C,a[1]=d*y+f*w+h*R,a[4]=d*x+f*S+h*N,a[7]=d*v+f*A+h*C,a[2]=g*y+m*w+b*R,a[5]=g*x+m*S+b*N,a[8]=g*v+m*A+b*C,this}multiplyScalar(e){const n=this.elements;return n[0]*=e,n[3]*=e,n[6]*=e,n[1]*=e,n[4]*=e,n[7]*=e,n[2]*=e,n[5]*=e,n[8]*=e,this}determinant(){const e=this.elements,n=e[0],i=e[1],r=e[2],a=e[3],s=e[4],l=e[5],c=e[6],d=e[7],f=e[8];return n*s*f-n*l*d-i*a*f+i*l*c+r*a*d-r*s*c}invert(){const e=this.elements,n=e[0],i=e[1],r=e[2],a=e[3],s=e[4],l=e[5],c=e[6],d=e[7],f=e[8],h=f*s-l*d,g=l*c-f*a,m=d*a-s*c,b=n*h+i*g+r*m;if(b===0)return this.set(0,0,0,0,0,0,0,0,0);const y=1/b;return e[0]=h*y,e[1]=(r*d-f*i)*y,e[2]=(l*i-r*s)*y,e[3]=g*y,e[4]=(f*n-r*c)*y,e[5]=(r*a-l*n)*y,e[6]=m*y,e[7]=(i*c-d*n)*y,e[8]=(s*n-i*a)*y,this}transpose(){let e;const n=this.elements;return e=n[1],n[1]=n[3],n[3]=e,e=n[2],n[2]=n[6],n[6]=e,e=n[5],n[5]=n[7],n[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const n=this.elements;return e[0]=n[0],e[1]=n[3],e[2]=n[6],e[3]=n[1],e[4]=n[4],e[5]=n[7],e[6]=n[2],e[7]=n[5],e[8]=n[8],this}setUvTransform(e,n,i,r,a,s,l){const c=Math.cos(a),d=Math.sin(a);return this.set(i*c,i*d,-i*(c*s+d*l)+s+e,-r*d,r*c,-r*(-d*s+c*l)+l+n,0,0,1),this}scale(e,n){return this.premultiply(NS.makeScale(e,n)),this}rotate(e){return this.premultiply(NS.makeRotation(-e)),this}translate(e,n){return this.premultiply(NS.makeTranslation(e,n)),this}makeTranslation(e,n){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,n,0,0,1),this}makeRotation(e){const n=Math.cos(e),i=Math.sin(e);return this.set(n,-i,0,i,n,0,0,0,1),this}makeScale(e,n){return this.set(e,0,0,0,n,0,0,0,1),this}equals(e){const n=this.elements,i=e.elements;for(let r=0;r<9;r++)if(n[r]!==i[r])return!1;return!0}fromArray(e,n=0){for(let i=0;i<9;i++)this.elements[i]=e[i+n];return this}toArray(e=[],n=0){const i=this.elements;return e[n]=i[0],e[n+1]=i[1],e[n+2]=i[2],e[n+3]=i[3],e[n+4]=i[4],e[n+5]=i[5],e[n+6]=i[6],e[n+7]=i[7],e[n+8]=i[8],e}clone(){return new this.constructor().fromArray(this.elements)}};const NS=new Xt,wN=new Xt().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),EN=new Xt().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function wY(){const t={enabled:!0,workingColorSpace:bf,spaces:{},convert:function(r,a,s){return this.enabled===!1||a===s||!a||!s||(this.spaces[a].transfer===En&&(r.r=Bo(r.r),r.g=Bo(r.g),r.b=Bo(r.b)),this.spaces[a].primaries!==this.spaces[s].primaries&&(r.applyMatrix3(this.spaces[a].toXYZ),r.applyMatrix3(this.spaces[s].fromXYZ)),this.spaces[s].transfer===En&&(r.r=lf(r.r),r.g=lf(r.g),r.b=lf(r.b))),r},workingToColorSpace:function(r,a){return this.convert(r,this.workingColorSpace,a)},colorSpaceToWorking:function(r,a){return this.convert(r,a,this.workingColorSpace)},getPrimaries:function(r){return this.spaces[r].primaries},getTransfer:function(r){return r===Yl?Jv:this.spaces[r].transfer},getToneMappingMode:function(r){return this.spaces[r].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(r,a=this.workingColorSpace){return r.fromArray(this.spaces[a].luminanceCoefficients)},define:function(r){Object.assign(this.spaces,r)},_getMatrix:function(r,a,s){return r.copy(this.spaces[a].toXYZ).multiply(this.spaces[s].fromXYZ)},_getDrawingBufferColorSpace:function(r){return this.spaces[r].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(r=this.workingColorSpace){return this.spaces[r].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(r,a){return Gp("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),t.workingToColorSpace(r,a)},toWorkingColorSpace:function(r,a){return Gp("ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),t.colorSpaceToWorking(r,a)}},e=[.64,.33,.3,.6,.15,.06],n=[.2126,.7152,.0722],i=[.3127,.329];return t.define({[bf]:{primaries:e,whitePoint:i,transfer:Jv,toXYZ:wN,fromXYZ:EN,luminanceCoefficients:n,workingColorSpaceConfig:{unpackColorSpace:za},outputColorSpaceConfig:{drawingBufferColorSpace:za}},[za]:{primaries:e,whitePoint:i,transfer:En,toXYZ:wN,fromXYZ:EN,luminanceCoefficients:n,outputColorSpaceConfig:{drawingBufferColorSpace:za}}}),t}const un=wY();function Bo(t){return t<.04045?t*.0773993808:Math.pow(t*.9478672986+.0521327014,2.4)}function lf(t){return t<.0031308?t*12.92:1.055*Math.pow(t,.41666)-.055}let vd,EY=class{static getDataURL(e,n="image/png"){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let i;if(e instanceof HTMLCanvasElement)i=e;else{vd===void 0&&(vd=tx("canvas")),vd.width=e.width,vd.height=e.height;const r=vd.getContext("2d");e instanceof ImageData?r.putImageData(e,0,0):r.drawImage(e,0,0,e.width,e.height),i=vd}return i.toDataURL(n)}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){const n=tx("canvas");n.width=e.width,n.height=e.height;const i=n.getContext("2d");i.drawImage(e,0,0,e.width,e.height);const r=i.getImageData(0,0,e.width,e.height),a=r.data;for(let s=0;s<a.length;s++)a[s]=Bo(a[s]/255)*255;return i.putImageData(r,0,0),n}else if(e.data){const n=e.data.slice(0);for(let i=0;i<n.length;i++)n instanceof Uint8Array||n instanceof Uint8ClampedArray?n[i]=Math.floor(Bo(n[i]/255)*255):n[i]=Bo(n[i]);return{data:n,width:e.width,height:e.height}}else return It("ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}},MY=0,AT=class{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:MY++}),this.uuid=xm(),this.data=e,this.dataReady=!0,this.version=0}getSize(e){const n=this.data;return typeof HTMLVideoElement<"u"&&n instanceof HTMLVideoElement?e.set(n.videoWidth,n.videoHeight,0):n instanceof VideoFrame?e.set(n.displayHeight,n.displayWidth,0):n!==null?e.set(n.width,n.height,n.depth||0):e.set(0,0,0),e}set needsUpdate(e){e===!0&&this.version++}toJSON(e){const n=e===void 0||typeof e=="string";if(!n&&e.images[this.uuid]!==void 0)return e.images[this.uuid];const i={uuid:this.uuid,url:""},r=this.data;if(r!==null){let a;if(Array.isArray(r)){a=[];for(let s=0,l=r.length;s<l;s++)r[s].isDataTexture?a.push(OS(r[s].image)):a.push(OS(r[s]))}else a=OS(r);i.url=a}return n||(e.images[this.uuid]=i),i}};function OS(t){return typeof HTMLImageElement<"u"&&t instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&t instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&t instanceof ImageBitmap?EY.getDataURL(t):t.data?{data:Array.from(t.data),width:t.width,height:t.height,type:t.data.constructor.name}:(It("Texture: Unable to serialize Texture."),{})}let AY=0;const LS=new Ve;let Ss=class Iv extends Iu{constructor(e=Iv.DEFAULT_IMAGE,n=Iv.DEFAULT_MAPPING,i=Oo,r=Oo,a=$a,s=iu,l=ms,c=js,d=Iv.DEFAULT_ANISOTROPY,f=Yl){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:AY++}),this.uuid=xm(),this.name="",this.source=new AT(e),this.mipmaps=[],this.mapping=n,this.channel=0,this.wrapS=i,this.wrapT=r,this.magFilter=a,this.minFilter=s,this.anisotropy=d,this.format=l,this.internalFormat=null,this.type=c,this.offset=new $t(0,0),this.repeat=new $t(1,1),this.center=new $t(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Xt,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=f,this.userData={},this.updateRanges=[],this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.isArrayTexture=!!(e&&e.depth&&e.depth>1),this.pmremVersion=0}get width(){return this.source.getSize(LS).x}get height(){return this.source.getSize(LS).y}get depth(){return this.source.getSize(LS).z}get image(){return this.source.data}set image(e=null){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)}addUpdateRange(e,n){this.updateRanges.push({start:e,count:n})}clearUpdateRanges(){this.updateRanges.length=0}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.channel=e.channel,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.colorSpace=e.colorSpace,this.renderTarget=e.renderTarget,this.isRenderTargetTexture=e.isRenderTargetTexture,this.isArrayTexture=e.isArrayTexture,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}setValues(e){for(const n in e){const i=e[n];if(i===void 0){It(`Texture.setValues(): parameter '${n}' has value of undefined.`);continue}const r=this[n];if(r===void 0){It(`Texture.setValues(): property '${n}' does not exist.`);continue}r&&i&&r.isVector2&&i.isVector2||r&&i&&r.isVector3&&i.isVector3||r&&i&&r.isMatrix3&&i.isMatrix3?r.copy(i):this[n]=i}}toJSON(e){const n=e===void 0||typeof e=="string";if(!n&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];const i={metadata:{version:4.7,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,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,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,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&&(i.userData=this.userData),n||(e.textures[this.uuid]=i),i}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==Bz)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case nM:e.x=e.x-Math.floor(e.x);break;case Oo:e.x=e.x<0?0:1;break;case iM: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 nM:e.y=e.y-Math.floor(e.y);break;case Oo:e.y=e.y<0?0:1;break;case iM: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)}set needsPMREMUpdate(e){e===!0&&this.pmremVersion++}};Ss.DEFAULT_IMAGE=null;Ss.DEFAULT_MAPPING=Bz;Ss.DEFAULT_ANISOTROPY=1;let gi=class eB{constructor(e=0,n=0,i=0,r=1){eB.prototype.isVector4=!0,this.x=e,this.y=n,this.z=i,this.w=r}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,n,i,r){return this.x=e,this.y=n,this.z=i,this.w=r,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,n){switch(e){case 0:this.x=n;break;case 1:this.y=n;break;case 2:this.z=n;break;case 3:this.w=n;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,n){return this.x=e.x+n.x,this.y=e.y+n.y,this.z=e.z+n.z,this.w=e.w+n.w,this}addScaledVector(e,n){return this.x+=e.x*n,this.y+=e.y*n,this.z+=e.z*n,this.w+=e.w*n,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,n){return this.x=e.x-n.x,this.y=e.y-n.y,this.z=e.z-n.z,this.w=e.w-n.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 n=this.x,i=this.y,r=this.z,a=this.w,s=e.elements;return this.x=s[0]*n+s[4]*i+s[8]*r+s[12]*a,this.y=s[1]*n+s[5]*i+s[9]*r+s[13]*a,this.z=s[2]*n+s[6]*i+s[10]*r+s[14]*a,this.w=s[3]*n+s[7]*i+s[11]*r+s[15]*a,this}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const n=Math.sqrt(1-e.w*e.w);return n<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/n,this.y=e.y/n,this.z=e.z/n),this}setAxisAngleFromRotationMatrix(e){let n,i,r,a;const c=e.elements,d=c[0],f=c[4],h=c[8],g=c[1],m=c[5],b=c[9],y=c[2],x=c[6],v=c[10];if(Math.abs(f-g)<.01&&Math.abs(h-y)<.01&&Math.abs(b-x)<.01){if(Math.abs(f+g)<.1&&Math.abs(h+y)<.1&&Math.abs(b+x)<.1&&Math.abs(d+m+v-3)<.1)return this.set(1,0,0,0),this;n=Math.PI;const S=(d+1)/2,A=(m+1)/2,R=(v+1)/2,N=(f+g)/4,C=(h+y)/4,F=(b+x)/4;return S>A&&S>R?S<.01?(i=0,r=.707106781,a=.707106781):(i=Math.sqrt(S),r=N/i,a=C/i):A>R?A<.01?(i=.707106781,r=0,a=.707106781):(r=Math.sqrt(A),i=N/r,a=F/r):R<.01?(i=.707106781,r=.707106781,a=0):(a=Math.sqrt(R),i=C/a,r=F/a),this.set(i,r,a,n),this}let w=Math.sqrt((x-b)*(x-b)+(h-y)*(h-y)+(g-f)*(g-f));return Math.abs(w)<.001&&(w=1),this.x=(x-b)/w,this.y=(h-y)/w,this.z=(g-f)/w,this.w=Math.acos((d+m+v-1)/2),this}setFromMatrixPosition(e){const n=e.elements;return this.x=n[12],this.y=n[13],this.z=n[14],this.w=n[15],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,n){return this.x=Qt(this.x,e.x,n.x),this.y=Qt(this.y,e.y,n.y),this.z=Qt(this.z,e.z,n.z),this.w=Qt(this.w,e.w,n.w),this}clampScalar(e,n){return this.x=Qt(this.x,e,n),this.y=Qt(this.y,e,n),this.z=Qt(this.z,e,n),this.w=Qt(this.w,e,n),this}clampLength(e,n){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Qt(i,e,n))}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=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(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,n){return this.x+=(e.x-this.x)*n,this.y+=(e.y-this.y)*n,this.z+=(e.z-this.z)*n,this.w+=(e.w-this.w)*n,this}lerpVectors(e,n,i){return this.x=e.x+(n.x-e.x)*i,this.y=e.y+(n.y-e.y)*i,this.z=e.z+(n.z-e.z)*i,this.w=e.w+(n.w-e.w)*i,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,n=0){return this.x=e[n],this.y=e[n+1],this.z=e[n+2],this.w=e[n+3],this}toArray(e=[],n=0){return e[n]=this.x,e[n+1]=this.y,e[n+2]=this.z,e[n+3]=this.w,e}fromBufferAttribute(e,n){return this.x=e.getX(n),this.y=e.getY(n),this.z=e.getZ(n),this.w=e.getW(n),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}},TY=class extends Iu{constructor(e=1,n=1,i={}){super(),i=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:$a,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1},i),this.isRenderTarget=!0,this.width=e,this.height=n,this.depth=i.depth,this.scissor=new gi(0,0,e,n),this.scissorTest=!1,this.viewport=new gi(0,0,e,n);const r={width:e,height:n,depth:i.depth},a=new Ss(r);this.textures=[];const s=i.count;for(let l=0;l<s;l++)this.textures[l]=a.clone(),this.textures[l].isRenderTargetTexture=!0,this.textures[l].renderTarget=this;this._setTextureOptions(i),this.depthBuffer=i.depthBuffer,this.stencilBuffer=i.stencilBuffer,this.resolveDepthBuffer=i.resolveDepthBuffer,this.resolveStencilBuffer=i.resolveStencilBuffer,this._depthTexture=null,this.depthTexture=i.depthTexture,this.samples=i.samples,this.multiview=i.multiview}_setTextureOptions(e={}){const n={minFilter:$a,generateMipmaps:!1,flipY:!1,internalFormat:null};e.mapping!==void 0&&(n.mapping=e.mapping),e.wrapS!==void 0&&(n.wrapS=e.wrapS),e.wrapT!==void 0&&(n.wrapT=e.wrapT),e.wrapR!==void 0&&(n.wrapR=e.wrapR),e.magFilter!==void 0&&(n.magFilter=e.magFilter),e.minFilter!==void 0&&(n.minFilter=e.minFilter),e.format!==void 0&&(n.format=e.format),e.type!==void 0&&(n.type=e.type),e.anisotropy!==void 0&&(n.anisotropy=e.anisotropy),e.colorSpace!==void 0&&(n.colorSpace=e.colorSpace),e.flipY!==void 0&&(n.flipY=e.flipY),e.generateMipmaps!==void 0&&(n.generateMipmaps=e.generateMipmaps),e.internalFormat!==void 0&&(n.internalFormat=e.internalFormat);for(let i=0;i<this.textures.length;i++)this.textures[i].setValues(n)}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}set depthTexture(e){this._depthTexture!==null&&(this._depthTexture.renderTarget=null),e!==null&&(e.renderTarget=this),this._depthTexture=e}get depthTexture(){return this._depthTexture}setSize(e,n,i=1){if(this.width!==e||this.height!==n||this.depth!==i){this.width=e,this.height=n,this.depth=i;for(let r=0,a=this.textures.length;r<a;r++)this.textures[r].image.width=e,this.textures[r].image.height=n,this.textures[r].image.depth=i,this.textures[r].isData3DTexture!==!0&&(this.textures[r].isArrayTexture=this.textures[r].image.depth>1);this.dispose()}this.viewport.set(0,0,e,n),this.scissor.set(0,0,e,n)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let n=0,i=e.textures.length;n<i;n++){this.textures[n]=e.textures[n].clone(),this.textures[n].isRenderTargetTexture=!0,this.textures[n].renderTarget=this;const r=Object.assign({},e.textures[n].image);this.textures[n].source=new AT(r)}return this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.resolveDepthBuffer=e.resolveDepthBuffer,this.resolveStencilBuffer=e.resolveStencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}},Su=class extends TY{constructor(e=1,n=1,i={}){super(e,n,i),this.isWebGLRenderTarget=!0}},tB=class extends Ss{constructor(e=null,n=1,i=1,r=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:n,height:i,depth:r},this.magFilter=xa,this.minFilter=xa,this.wrapR=Oo,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}},CY=class extends Ss{constructor(e=null,n=1,i=1,r=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:n,height:i,depth:r},this.magFilter=xa,this.minFilter=xa,this.wrapR=Oo,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}},wu=class{constructor(e=new Ve(1/0,1/0,1/0),n=new Ve(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=n}set(e,n){return this.min.copy(e),this.max.copy(n),this}setFromArray(e){this.makeEmpty();for(let n=0,i=e.length;n<i;n+=3)this.expandByPoint(rs.fromArray(e,n));return this}setFromBufferAttribute(e){this.makeEmpty();for(let n=0,i=e.count;n<i;n++)this.expandByPoint(rs.fromBufferAttribute(e,n));return this}setFromPoints(e){this.makeEmpty();for(let n=0,i=e.length;n<i;n++)this.expandByPoint(e[n]);return this}setFromCenterAndSize(e,n){const i=rs.copy(n).multiplyScalar(.5);return this.min.copy(e).sub(i),this.max.copy(e).add(i),this}setFromObject(e,n=!1){return this.makeEmpty(),this.expandByObject(e,n)}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,n=!1){e.updateWorldMatrix(!1,!1);const i=e.geometry;if(i!==void 0){const a=i.getAttribute("position");if(n===!0&&a!==void 0&&e.isInstancedMesh!==!0)for(let s=0,l=a.count;s<l;s++)e.isMesh===!0?e.getVertexPosition(s,rs):rs.fromBufferAttribute(a,s),rs.applyMatrix4(e.matrixWorld),this.expandByPoint(rs);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),u0.copy(e.boundingBox)):(i.boundingBox===null&&i.computeBoundingBox(),u0.copy(i.boundingBox)),u0.applyMatrix4(e.matrixWorld),this.union(u0)}const r=e.children;for(let a=0,s=r.length;a<s;a++)this.expandByObject(r[a],n);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,n){return n.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,rs),rs.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let n,i;return e.normal.x>0?(n=e.normal.x*this.min.x,i=e.normal.x*this.max.x):(n=e.normal.x*this.max.x,i=e.normal.x*this.min.x),e.normal.y>0?(n+=e.normal.y*this.min.y,i+=e.normal.y*this.max.y):(n+=e.normal.y*this.max.y,i+=e.normal.y*this.min.y),e.normal.z>0?(n+=e.normal.z*this.min.z,i+=e.normal.z*this.max.z):(n+=e.normal.z*this.max.z,i+=e.normal.z*this.min.z),n<=-e.constant&&i>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(Zh),d0.subVectors(this.max,Zh),xd.subVectors(e.a,Zh),yd.subVectors(e.b,Zh),bd.subVectors(e.c,Zh),Dl.subVectors(yd,xd),Nl.subVectors(bd,yd),Ic.subVectors(xd,bd);let n=[0,-Dl.z,Dl.y,0,-Nl.z,Nl.y,0,-Ic.z,Ic.y,Dl.z,0,-Dl.x,Nl.z,0,-Nl.x,Ic.z,0,-Ic.x,-Dl.y,Dl.x,0,-Nl.y,Nl.x,0,-Ic.y,Ic.x,0];return!IS(n,xd,yd,bd,d0)||(n=[1,0,0,0,1,0,0,0,1],!IS(n,xd,yd,bd,d0))?!1:(f0.crossVectors(Dl,Nl),n=[f0.x,f0.y,f0.z],IS(n,xd,yd,bd,d0))}clampPoint(e,n){return n.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,rs).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(rs).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:(go[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),go[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),go[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),go[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),go[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),go[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),go[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),go[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(go),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)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(e){return this.min.fromArray(e.min),this.max.fromArray(e.max),this}};const go=[new Ve,new Ve,new Ve,new Ve,new Ve,new Ve,new Ve,new Ve],rs=new Ve,u0=new wu,xd=new Ve,yd=new Ve,bd=new Ve,Dl=new Ve,Nl=new Ve,Ic=new Ve,Zh=new Ve,d0=new Ve,f0=new Ve,Uc=new Ve;function IS(t,e,n,i,r){for(let a=0,s=t.length-3;a<=s;a+=3){Uc.fromArray(t,a);const l=r.x*Math.abs(Uc.x)+r.y*Math.abs(Uc.y)+r.z*Math.abs(Uc.z),c=e.dot(Uc),d=n.dot(Uc),f=i.dot(Uc);if(Math.max(-Math.max(c,d,f),Math.min(c,d,f))>l)return!1}return!0}const RY=new wu,Qh=new Ve,US=new Ve;let hy=class{constructor(e=new Ve,n=-1){this.isSphere=!0,this.center=e,this.radius=n}set(e,n){return this.center.copy(e),this.radius=n,this}setFromPoints(e,n){const i=this.center;n!==void 0?i.copy(n):RY.setFromPoints(e).getCenter(i);let r=0;for(let a=0,s=e.length;a<s;a++)r=Math.max(r,i.distanceToSquared(e[a]));return this.radius=Math.sqrt(r),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 n=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=n*n}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,n){const i=this.center.distanceToSquared(e);return n.copy(e),i>this.radius*this.radius&&(n.sub(this.center).normalize(),n.multiplyScalar(this.radius).add(this.center)),n}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;Qh.subVectors(e,this.center);const n=Qh.lengthSq();if(n>this.radius*this.radius){const i=Math.sqrt(n),r=(i-this.radius)*.5;this.center.addScaledVector(Qh,r/i),this.radius+=r}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):(US.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(Qh.copy(e.center).add(US)),this.expandByPoint(Qh.copy(e.center).sub(US))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(e){return this.radius=e.radius,this.center.fromArray(e.center),this}};const vo=new Ve,kS=new Ve,h0=new Ve,Ol=new Ve,FS=new Ve,p0=new Ve,zS=new Ve;let TT=class{constructor(e=new Ve,n=new Ve(0,0,-1)){this.origin=e,this.direction=n}set(e,n){return this.origin.copy(e),this.direction.copy(n),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,n){return n.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,vo)),this}closestPointToPoint(e,n){n.subVectors(e,this.origin);const i=n.dot(this.direction);return i<0?n.copy(this.origin):n.copy(this.origin).addScaledVector(this.direction,i)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const n=vo.subVectors(e,this.origin).dot(this.direction);return n<0?this.origin.distanceToSquared(e):(vo.copy(this.origin).addScaledVector(this.direction,n),vo.distanceToSquared(e))}distanceSqToSegment(e,n,i,r){kS.copy(e).add(n).multiplyScalar(.5),h0.copy(n).sub(e).normalize(),Ol.copy(this.origin).sub(kS);const a=e.distanceTo(n)*.5,s=-this.direction.dot(h0),l=Ol.dot(this.direction),c=-Ol.dot(h0),d=Ol.lengthSq(),f=Math.abs(1-s*s);let h,g,m,b;if(f>0)if(h=s*c-l,g=s*l-c,b=a*f,h>=0)if(g>=-b)if(g<=b){const y=1/f;h*=y,g*=y,m=h*(h+s*g+2*l)+g*(s*h+g+2*c)+d}else g=a,h=Math.max(0,-(s*g+l)),m=-h*h+g*(g+2*c)+d;else g=-a,h=Math.max(0,-(s*g+l)),m=-h*h+g*(g+2*c)+d;else g<=-b?(h=Math.max(0,-(-s*a+l)),g=h>0?-a:Math.min(Math.max(-a,-c),a),m=-h*h+g*(g+2*c)+d):g<=b?(h=0,g=Math.min(Math.max(-a,-c),a),m=g*(g+2*c)+d):(h=Math.max(0,-(s*a+l)),g=h>0?a:Math.min(Math.max(-a,-c),a),m=-h*h+g*(g+2*c)+d);else g=s>0?-a:a,h=Math.max(0,-(s*g+l)),m=-h*h+g*(g+2*c)+d;return i&&i.copy(this.origin).addScaledVector(this.direction,h),r&&r.copy(kS).addScaledVector(h0,g),m}intersectSphere(e,n){vo.subVectors(e.center,this.origin);const i=vo.dot(this.direction),r=vo.dot(vo)-i*i,a=e.radius*e.radius;if(r>a)return null;const s=Math.sqrt(a-r),l=i-s,c=i+s;return c<0?null:l<0?this.at(c,n):this.at(l,n)}intersectsSphere(e){return e.radius<0?!1:this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const n=e.normal.dot(this.direction);if(n===0)return e.distanceToPoint(this.origin)===0?0:null;const i=-(this.origin.dot(e.normal)+e.constant)/n;return i>=0?i:null}intersectPlane(e,n){const i=this.distanceToPlane(e);return i===null?null:this.at(i,n)}intersectsPlane(e){const n=e.distanceToPoint(this.origin);return n===0||e.normal.dot(this.direction)*n<0}intersectBox(e,n){let i,r,a,s,l,c;const d=1/this.direction.x,f=1/this.direction.y,h=1/this.direction.z,g=this.origin;return d>=0?(i=(e.min.x-g.x)*d,r=(e.max.x-g.x)*d):(i=(e.max.x-g.x)*d,r=(e.min.x-g.x)*d),f>=0?(a=(e.min.y-g.y)*f,s=(e.max.y-g.y)*f):(a=(e.max.y-g.y)*f,s=(e.min.y-g.y)*f),i>s||a>r||((a>i||isNaN(i))&&(i=a),(s<r||isNaN(r))&&(r=s),h>=0?(l=(e.min.z-g.z)*h,c=(e.max.z-g.z)*h):(l=(e.max.z-g.z)*h,c=(e.min.z-g.z)*h),i>c||l>r)||((l>i||i!==i)&&(i=l),(c<r||r!==r)&&(r=c),r<0)?null:this.at(i>=0?i:r,n)}intersectsBox(e){return this.intersectBox(e,vo)!==null}intersectTriangle(e,n,i,r,a){FS.subVectors(n,e),p0.subVectors(i,e),zS.crossVectors(FS,p0);let s=this.direction.dot(zS),l;if(s>0){if(r)return null;l=1}else if(s<0)l=-1,s=-s;else return null;Ol.subVectors(this.origin,e);const c=l*this.direction.dot(p0.crossVectors(Ol,p0));if(c<0)return null;const d=l*this.direction.dot(FS.cross(Ol));if(d<0||c+d>s)return null;const f=-l*Ol.dot(zS);return f<0?null:this.at(f/s,a)}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)}},bi=class OM{constructor(e,n,i,r,a,s,l,c,d,f,h,g,m,b,y,x){OM.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,n,i,r,a,s,l,c,d,f,h,g,m,b,y,x)}set(e,n,i,r,a,s,l,c,d,f,h,g,m,b,y,x){const v=this.elements;return v[0]=e,v[4]=n,v[8]=i,v[12]=r,v[1]=a,v[5]=s,v[9]=l,v[13]=c,v[2]=d,v[6]=f,v[10]=h,v[14]=g,v[3]=m,v[7]=b,v[11]=y,v[15]=x,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 OM().fromArray(this.elements)}copy(e){const n=this.elements,i=e.elements;return n[0]=i[0],n[1]=i[1],n[2]=i[2],n[3]=i[3],n[4]=i[4],n[5]=i[5],n[6]=i[6],n[7]=i[7],n[8]=i[8],n[9]=i[9],n[10]=i[10],n[11]=i[11],n[12]=i[12],n[13]=i[13],n[14]=i[14],n[15]=i[15],this}copyPosition(e){const n=this.elements,i=e.elements;return n[12]=i[12],n[13]=i[13],n[14]=i[14],this}setFromMatrix3(e){const n=e.elements;return this.set(n[0],n[3],n[6],0,n[1],n[4],n[7],0,n[2],n[5],n[8],0,0,0,0,1),this}extractBasis(e,n,i){return e.setFromMatrixColumn(this,0),n.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this}makeBasis(e,n,i){return this.set(e.x,n.x,i.x,0,e.y,n.y,i.y,0,e.z,n.z,i.z,0,0,0,0,1),this}extractRotation(e){const n=this.elements,i=e.elements,r=1/_d.setFromMatrixColumn(e,0).length(),a=1/_d.setFromMatrixColumn(e,1).length(),s=1/_d.setFromMatrixColumn(e,2).length();return n[0]=i[0]*r,n[1]=i[1]*r,n[2]=i[2]*r,n[3]=0,n[4]=i[4]*a,n[5]=i[5]*a,n[6]=i[6]*a,n[7]=0,n[8]=i[8]*s,n[9]=i[9]*s,n[10]=i[10]*s,n[11]=0,n[12]=0,n[13]=0,n[14]=0,n[15]=1,this}makeRotationFromEuler(e){const n=this.elements,i=e.x,r=e.y,a=e.z,s=Math.cos(i),l=Math.sin(i),c=Math.cos(r),d=Math.sin(r),f=Math.cos(a),h=Math.sin(a);if(e.order==="XYZ"){const g=s*f,m=s*h,b=l*f,y=l*h;n[0]=c*f,n[4]=-c*h,n[8]=d,n[1]=m+b*d,n[5]=g-y*d,n[9]=-l*c,n[2]=y-g*d,n[6]=b+m*d,n[10]=s*c}else if(e.order==="YXZ"){const g=c*f,m=c*h,b=d*f,y=d*h;n[0]=g+y*l,n[4]=b*l-m,n[8]=s*d,n[1]=s*h,n[5]=s*f,n[9]=-l,n[2]=m*l-b,n[6]=y+g*l,n[10]=s*c}else if(e.order==="ZXY"){const g=c*f,m=c*h,b=d*f,y=d*h;n[0]=g-y*l,n[4]=-s*h,n[8]=b+m*l,n[1]=m+b*l,n[5]=s*f,n[9]=y-g*l,n[2]=-s*d,n[6]=l,n[10]=s*c}else if(e.order==="ZYX"){const g=s*f,m=s*h,b=l*f,y=l*h;n[0]=c*f,n[4]=b*d-m,n[8]=g*d+y,n[1]=c*h,n[5]=y*d+g,n[9]=m*d-b,n[2]=-d,n[6]=l*c,n[10]=s*c}else if(e.order==="YZX"){const g=s*c,m=s*d,b=l*c,y=l*d;n[0]=c*f,n[4]=y-g*h,n[8]=b*h+m,n[1]=h,n[5]=s*f,n[9]=-l*f,n[2]=-d*f,n[6]=m*h+b,n[10]=g-y*h}else if(e.order==="XZY"){const g=s*c,m=s*d,b=l*c,y=l*d;n[0]=c*f,n[4]=-h,n[8]=d*f,n[1]=g*h+y,n[5]=s*f,n[9]=m*h-b,n[2]=b*h-m,n[6]=l*f,n[10]=y*h+g}return n[3]=0,n[7]=0,n[11]=0,n[12]=0,n[13]=0,n[14]=0,n[15]=1,this}makeRotationFromQuaternion(e){return this.compose(PY,e,DY)}lookAt(e,n,i){const r=this.elements;return ua.subVectors(e,n),ua.lengthSq()===0&&(ua.z=1),ua.normalize(),Ll.crossVectors(i,ua),Ll.lengthSq()===0&&(Math.abs(i.z)===1?ua.x+=1e-4:ua.z+=1e-4,ua.normalize(),Ll.crossVectors(i,ua)),Ll.normalize(),m0.crossVectors(ua,Ll),r[0]=Ll.x,r[4]=m0.x,r[8]=ua.x,r[1]=Ll.y,r[5]=m0.y,r[9]=ua.y,r[2]=Ll.z,r[6]=m0.z,r[10]=ua.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,n){const i=e.elements,r=n.elements,a=this.elements,s=i[0],l=i[4],c=i[8],d=i[12],f=i[1],h=i[5],g=i[9],m=i[13],b=i[2],y=i[6],x=i[10],v=i[14],w=i[3],S=i[7],A=i[11],R=i[15],N=r[0],C=r[4],F=r[8],P=r[12],L=r[1],B=r[5],U=r[9],$=r[13],I=r[2],W=r[6],X=r[10],V=r[14],Y=r[3],J=r[7],se=r[11],H=r[15];return a[0]=s*N+l*L+c*I+d*Y,a[4]=s*C+l*B+c*W+d*J,a[8]=s*F+l*U+c*X+d*se,a[12]=s*P+l*$+c*V+d*H,a[1]=f*N+h*L+g*I+m*Y,a[5]=f*C+h*B+g*W+m*J,a[9]=f*F+h*U+g*X+m*se,a[13]=f*P+h*$+g*V+m*H,a[2]=b*N+y*L+x*I+v*Y,a[6]=b*C+y*B+x*W+v*J,a[10]=b*F+y*U+x*X+v*se,a[14]=b*P+y*$+x*V+v*H,a[3]=w*N+S*L+A*I+R*Y,a[7]=w*C+S*B+A*W+R*J,a[11]=w*F+S*U+A*X+R*se,a[15]=w*P+S*$+A*V+R*H,this}multiplyScalar(e){const n=this.elements;return n[0]*=e,n[4]*=e,n[8]*=e,n[12]*=e,n[1]*=e,n[5]*=e,n[9]*=e,n[13]*=e,n[2]*=e,n[6]*=e,n[10]*=e,n[14]*=e,n[3]*=e,n[7]*=e,n[11]*=e,n[15]*=e,this}determinant(){const e=this.elements,n=e[0],i=e[4],r=e[8],a=e[12],s=e[1],l=e[5],c=e[9],d=e[13],f=e[2],h=e[6],g=e[10],m=e[14],b=e[3],y=e[7],x=e[11],v=e[15];return b*(+a*c*h-r*d*h-a*l*g+i*d*g+r*l*m-i*c*m)+y*(+n*c*m-n*d*g+a*s*g-r*s*m+r*d*f-a*c*f)+x*(+n*d*h-n*l*m-a*s*h+i*s*m+a*l*f-i*d*f)+v*(-r*l*f-n*c*h+n*l*g+r*s*h-i*s*g+i*c*f)}transpose(){const e=this.elements;let n;return n=e[1],e[1]=e[4],e[4]=n,n=e[2],e[2]=e[8],e[8]=n,n=e[6],e[6]=e[9],e[9]=n,n=e[3],e[3]=e[12],e[12]=n,n=e[7],e[7]=e[13],e[13]=n,n=e[11],e[11]=e[14],e[14]=n,this}setPosition(e,n,i){const r=this.elements;return e.isVector3?(r[12]=e.x,r[13]=e.y,r[14]=e.z):(r[12]=e,r[13]=n,r[14]=i),this}invert(){const e=this.elements,n=e[0],i=e[1],r=e[2],a=e[3],s=e[4],l=e[5],c=e[6],d=e[7],f=e[8],h=e[9],g=e[10],m=e[11],b=e[12],y=e[13],x=e[14],v=e[15],w=h*x*d-y*g*d+y*c*m-l*x*m-h*c*v+l*g*v,S=b*g*d-f*x*d-b*c*m+s*x*m+f*c*v-s*g*v,A=f*y*d-b*h*d+b*l*m-s*y*m-f*l*v+s*h*v,R=b*h*c-f*y*c-b*l*g+s*y*g+f*l*x-s*h*x,N=n*w+i*S+r*A+a*R;if(N===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const C=1/N;return e[0]=w*C,e[1]=(y*g*a-h*x*a-y*r*m+i*x*m+h*r*v-i*g*v)*C,e[2]=(l*x*a-y*c*a+y*r*d-i*x*d-l*r*v+i*c*v)*C,e[3]=(h*c*a-l*g*a-h*r*d+i*g*d+l*r*m-i*c*m)*C,e[4]=S*C,e[5]=(f*x*a-b*g*a+b*r*m-n*x*m-f*r*v+n*g*v)*C,e[6]=(b*c*a-s*x*a-b*r*d+n*x*d+s*r*v-n*c*v)*C,e[7]=(s*g*a-f*c*a+f*r*d-n*g*d-s*r*m+n*c*m)*C,e[8]=A*C,e[9]=(b*h*a-f*y*a-b*i*m+n*y*m+f*i*v-n*h*v)*C,e[10]=(s*y*a-b*l*a+b*i*d-n*y*d-s*i*v+n*l*v)*C,e[11]=(f*l*a-s*h*a-f*i*d+n*h*d+s*i*m-n*l*m)*C,e[12]=R*C,e[13]=(f*y*r-b*h*r+b*i*g-n*y*g-f*i*x+n*h*x)*C,e[14]=(b*l*r-s*y*r-b*i*c+n*y*c+s*i*x-n*l*x)*C,e[15]=(s*h*r-f*l*r+f*i*c-n*h*c-s*i*g+n*l*g)*C,this}scale(e){const n=this.elements,i=e.x,r=e.y,a=e.z;return n[0]*=i,n[4]*=r,n[8]*=a,n[1]*=i,n[5]*=r,n[9]*=a,n[2]*=i,n[6]*=r,n[10]*=a,n[3]*=i,n[7]*=r,n[11]*=a,this}getMaxScaleOnAxis(){const e=this.elements,n=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],i=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],r=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(n,i,r))}makeTranslation(e,n,i){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,n,0,0,1,i,0,0,0,1),this}makeRotationX(e){const n=Math.cos(e),i=Math.sin(e);return this.set(1,0,0,0,0,n,-i,0,0,i,n,0,0,0,0,1),this}makeRotationY(e){const n=Math.cos(e),i=Math.sin(e);return this.set(n,0,i,0,0,1,0,0,-i,0,n,0,0,0,0,1),this}makeRotationZ(e){const n=Math.cos(e),i=Math.sin(e);return this.set(n,-i,0,0,i,n,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,n){const i=Math.cos(n),r=Math.sin(n),a=1-i,s=e.x,l=e.y,c=e.z,d=a*s,f=a*l;return this.set(d*s+i,d*l-r*c,d*c+r*l,0,d*l+r*c,f*l+i,f*c-r*s,0,d*c-r*l,f*c+r*s,a*c*c+i,0,0,0,0,1),this}makeScale(e,n,i){return this.set(e,0,0,0,0,n,0,0,0,0,i,0,0,0,0,1),this}makeShear(e,n,i,r,a,s){return this.set(1,i,a,0,e,1,s,0,n,r,1,0,0,0,0,1),this}compose(e,n,i){const r=this.elements,a=n._x,s=n._y,l=n._z,c=n._w,d=a+a,f=s+s,h=l+l,g=a*d,m=a*f,b=a*h,y=s*f,x=s*h,v=l*h,w=c*d,S=c*f,A=c*h,R=i.x,N=i.y,C=i.z;return r[0]=(1-(y+v))*R,r[1]=(m+A)*R,r[2]=(b-S)*R,r[3]=0,r[4]=(m-A)*N,r[5]=(1-(g+v))*N,r[6]=(x+w)*N,r[7]=0,r[8]=(b+S)*C,r[9]=(x-w)*C,r[10]=(1-(g+y))*C,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this}decompose(e,n,i){const r=this.elements;let a=_d.set(r[0],r[1],r[2]).length();const s=_d.set(r[4],r[5],r[6]).length(),l=_d.set(r[8],r[9],r[10]).length();this.determinant()<0&&(a=-a),e.x=r[12],e.y=r[13],e.z=r[14],as.copy(this);const d=1/a,f=1/s,h=1/l;return as.elements[0]*=d,as.elements[1]*=d,as.elements[2]*=d,as.elements[4]*=f,as.elements[5]*=f,as.elements[6]*=f,as.elements[8]*=h,as.elements[9]*=h,as.elements[10]*=h,n.setFromRotationMatrix(as),i.x=a,i.y=s,i.z=l,this}makePerspective(e,n,i,r,a,s,l=Is,c=!1){const d=this.elements,f=2*a/(n-e),h=2*a/(i-r),g=(n+e)/(n-e),m=(i+r)/(i-r);let b,y;if(c)b=a/(s-a),y=s*a/(s-a);else if(l===Is)b=-(s+a)/(s-a),y=-2*s*a/(s-a);else if(l===ex)b=-s/(s-a),y=-s*a/(s-a);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+l);return d[0]=f,d[4]=0,d[8]=g,d[12]=0,d[1]=0,d[5]=h,d[9]=m,d[13]=0,d[2]=0,d[6]=0,d[10]=b,d[14]=y,d[3]=0,d[7]=0,d[11]=-1,d[15]=0,this}makeOrthographic(e,n,i,r,a,s,l=Is,c=!1){const d=this.elements,f=2/(n-e),h=2/(i-r),g=-(n+e)/(n-e),m=-(i+r)/(i-r);let b,y;if(c)b=1/(s-a),y=s/(s-a);else if(l===Is)b=-2/(s-a),y=-(s+a)/(s-a);else if(l===ex)b=-1/(s-a),y=-a/(s-a);else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+l);return d[0]=f,d[4]=0,d[8]=0,d[12]=g,d[1]=0,d[5]=h,d[9]=0,d[13]=m,d[2]=0,d[6]=0,d[10]=b,d[14]=y,d[3]=0,d[7]=0,d[11]=0,d[15]=1,this}equals(e){const n=this.elements,i=e.elements;for(let r=0;r<16;r++)if(n[r]!==i[r])return!1;return!0}fromArray(e,n=0){for(let i=0;i<16;i++)this.elements[i]=e[i+n];return this}toArray(e=[],n=0){const i=this.elements;return e[n]=i[0],e[n+1]=i[1],e[n+2]=i[2],e[n+3]=i[3],e[n+4]=i[4],e[n+5]=i[5],e[n+6]=i[6],e[n+7]=i[7],e[n+8]=i[8],e[n+9]=i[9],e[n+10]=i[10],e[n+11]=i[11],e[n+12]=i[12],e[n+13]=i[13],e[n+14]=i[14],e[n+15]=i[15],e}};const _d=new Ve,as=new bi,PY=new Ve(0,0,0),DY=new Ve(1,1,1),Ll=new Ve,m0=new Ve,ua=new Ve,MN=new bi,AN=new _u;let lc=class nB{constructor(e=0,n=0,i=0,r=nB.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=n,this._z=i,this._order=r}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,n,i,r=this._order){return this._x=e,this._y=n,this._z=i,this._order=r,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,n=this._order,i=!0){const r=e.elements,a=r[0],s=r[4],l=r[8],c=r[1],d=r[5],f=r[9],h=r[2],g=r[6],m=r[10];switch(n){case"XYZ":this._y=Math.asin(Qt(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-f,m),this._z=Math.atan2(-s,a)):(this._x=Math.atan2(g,d),this._z=0);break;case"YXZ":this._x=Math.asin(-Qt(f,-1,1)),Math.abs(f)<.9999999?(this._y=Math.atan2(l,m),this._z=Math.atan2(c,d)):(this._y=Math.atan2(-h,a),this._z=0);break;case"ZXY":this._x=Math.asin(Qt(g,-1,1)),Math.abs(g)<.9999999?(this._y=Math.atan2(-h,m),this._z=Math.atan2(-s,d)):(this._y=0,this._z=Math.atan2(c,a));break;case"ZYX":this._y=Math.asin(-Qt(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(g,m),this._z=Math.atan2(c,a)):(this._x=0,this._z=Math.atan2(-s,d));break;case"YZX":this._z=Math.asin(Qt(c,-1,1)),Math.abs(c)<.9999999?(this._x=Math.atan2(-f,d),this._y=Math.atan2(-h,a)):(this._x=0,this._y=Math.atan2(l,m));break;case"XZY":this._z=Math.asin(-Qt(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(g,d),this._y=Math.atan2(l,a)):(this._x=Math.atan2(-f,m),this._y=0);break;default:It("Euler: .setFromRotationMatrix() encountered an unknown order: "+n)}return this._order=n,i===!0&&this._onChangeCallback(),this}setFromQuaternion(e,n,i){return MN.makeRotationFromQuaternion(e),this.setFromRotationMatrix(MN,n,i)}setFromVector3(e,n=this._order){return this.set(e.x,e.y,e.z,n)}reorder(e){return AN.setFromEuler(this),this.setFromQuaternion(AN,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=[],n=0){return e[n]=this._x,e[n+1]=this._y,e[n+2]=this._z,e[n+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}};lc.DEFAULT_ORDER="XYZ";let iB=class{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}},NY=0;const TN=new Ve,Sd=new _u,xo=new bi,g0=new Ve,Jh=new Ve,OY=new Ve,LY=new _u,CN=new Ve(1,0,0),RN=new Ve(0,1,0),PN=new Ve(0,0,1),DN={type:"added"},IY={type:"removed"},wd={type:"childadded",child:null},BS={type:"childremoved",child:null};let _a=class Uv extends Iu{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:NY++}),this.uuid=xm(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=Uv.DEFAULT_UP.clone();const e=new Ve,n=new lc,i=new _u,r=new Ve(1,1,1);function a(){i.setFromEuler(n,!1)}function s(){n.setFromQuaternion(i,void 0,!1)}n._onChange(a),i._onChange(s),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:n},quaternion:{configurable:!0,enumerable:!0,value:i},scale:{configurable:!0,enumerable:!0,value:r},modelViewMatrix:{value:new bi},normalMatrix:{value:new Xt}}),this.matrix=new bi,this.matrixWorld=new bi,this.matrixAutoUpdate=Uv.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=Uv.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new iB,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.customDepthMaterial=void 0,this.customDistanceMaterial=void 0,this.userData={}}onBeforeShadow(){}onAfterShadow(){}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,n){this.quaternion.setFromAxisAngle(e,n)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,n){return Sd.setFromAxisAngle(e,n),this.quaternion.multiply(Sd),this}rotateOnWorldAxis(e,n){return Sd.setFromAxisAngle(e,n),this.quaternion.premultiply(Sd),this}rotateX(e){return this.rotateOnAxis(CN,e)}rotateY(e){return this.rotateOnAxis(RN,e)}rotateZ(e){return this.rotateOnAxis(PN,e)}translateOnAxis(e,n){return TN.copy(e).applyQuaternion(this.quaternion),this.position.add(TN.multiplyScalar(n)),this}translateX(e){return this.translateOnAxis(CN,e)}translateY(e){return this.translateOnAxis(RN,e)}translateZ(e){return this.translateOnAxis(PN,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(xo.copy(this.matrixWorld).invert())}lookAt(e,n,i){e.isVector3?g0.copy(e):g0.set(e,n,i);const r=this.parent;this.updateWorldMatrix(!0,!1),Jh.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?xo.lookAt(Jh,g0,this.up):xo.lookAt(g0,Jh,this.up),this.quaternion.setFromRotationMatrix(xo),r&&(xo.extractRotation(r.matrixWorld),Sd.setFromRotationMatrix(xo),this.quaternion.premultiply(Sd.invert()))}add(e){if(arguments.length>1){for(let n=0;n<arguments.length;n++)this.add(arguments[n]);return this}return e===this?(ai("Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(e.removeFromParent(),e.parent=this,this.children.push(e),e.dispatchEvent(DN),wd.child=e,this.dispatchEvent(wd),wd.child=null):ai("Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let i=0;i<arguments.length;i++)this.remove(arguments[i]);return this}const n=this.children.indexOf(e);return n!==-1&&(e.parent=null,this.children.splice(n,1),e.dispatchEvent(IY),BS.child=e,this.dispatchEvent(BS),BS.child=null),this}removeFromParent(){const e=this.parent;return e!==null&&e.remove(this),this}clear(){return this.remove(...this.children)}attach(e){return this.updateWorldMatrix(!0,!1),xo.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),xo.multiply(e.parent.matrixWorld)),e.applyMatrix4(xo),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(DN),wd.child=e,this.dispatchEvent(wd),wd.child=null,this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,n){if(this[e]===n)return this;for(let i=0,r=this.children.length;i<r;i++){const s=this.children[i].getObjectByProperty(e,n);if(s!==void 0)return s}}getObjectsByProperty(e,n,i=[]){this[e]===n&&i.push(this);const r=this.children;for(let a=0,s=r.length;a<s;a++)r[a].getObjectsByProperty(e,n,i);return i}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Jh,e,OY),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Jh,LY,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const n=this.matrixWorld.elements;return e.set(n[8],n[9],n[10]).normalize()}raycast(){}traverse(e){e(this);const n=this.children;for(let i=0,r=n.length;i<r;i++)n[i].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);const n=this.children;for(let i=0,r=n.length;i<r;i++)n[i].traverseVisible(e)}traverseAncestors(e){const n=this.parent;n!==null&&(e(n),n.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.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,e=!0);const n=this.children;for(let i=0,r=n.length;i<r;i++)n[i].updateMatrixWorld(e)}updateWorldMatrix(e,n){const i=this.parent;if(e===!0&&i!==null&&i.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),n===!0){const r=this.children;for(let a=0,s=r.length;a<s;a++)r[a].updateWorldMatrix(!1,!0)}}toJSON(e){const n=e===void 0||typeof e=="string",i={};n&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},i.metadata={version:4.7,type:"Object",generator:"Object3D.toJSON"});const r={};r.uuid=this.uuid,r.type=this.type,this.name!==""&&(r.name=this.name),this.castShadow===!0&&(r.castShadow=!0),this.receiveShadow===!0&&(r.receiveShadow=!0),this.visible===!1&&(r.visible=!1),this.frustumCulled===!1&&(r.frustumCulled=!1),this.renderOrder!==0&&(r.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),r.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(r.matrixAutoUpdate=!1),this.isInstancedMesh&&(r.type="InstancedMesh",r.count=this.count,r.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(r.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(r.type="BatchedMesh",r.perObjectFrustumCulled=this.perObjectFrustumCulled,r.sortObjects=this.sortObjects,r.drawRanges=this._drawRanges,r.reservedRanges=this._reservedRanges,r.geometryInfo=this._geometryInfo.map(l=>({...l,boundingBox:l.boundingBox?l.boundingBox.toJSON():void 0,boundingSphere:l.boundingSphere?l.boundingSphere.toJSON():void 0})),r.instanceInfo=this._instanceInfo.map(l=>({...l})),r.availableInstanceIds=this._availableInstanceIds.slice(),r.availableGeometryIds=this._availableGeometryIds.slice(),r.nextIndexStart=this._nextIndexStart,r.nextVertexStart=this._nextVertexStart,r.geometryCount=this._geometryCount,r.maxInstanceCount=this._maxInstanceCount,r.maxVertexCount=this._maxVertexCount,r.maxIndexCount=this._maxIndexCount,r.geometryInitialized=this._geometryInitialized,r.matricesTexture=this._matricesTexture.toJSON(e),r.indirectTexture=this._indirectTexture.toJSON(e),this._colorsTexture!==null&&(r.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(r.boundingSphere=this.boundingSphere.toJSON()),this.boundingBox!==null&&(r.boundingBox=this.boundingBox.toJSON()));function a(l,c){return l[c.uuid]===void 0&&(l[c.uuid]=c.toJSON(e)),c.uuid}if(this.isScene)this.background&&(this.background.isColor?r.background=this.background.toJSON():this.background.isTexture&&(r.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(r.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){r.geometry=a(e.geometries,this.geometry);const l=this.geometry.parameters;if(l!==void 0&&l.shapes!==void 0){const c=l.shapes;if(Array.isArray(c))for(let d=0,f=c.length;d<f;d++){const h=c[d];a(e.shapes,h)}else a(e.shapes,c)}}if(this.isSkinnedMesh&&(r.bindMode=this.bindMode,r.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(a(e.skeletons,this.skeleton),r.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){const l=[];for(let c=0,d=this.material.length;c<d;c++)l.push(a(e.materials,this.material[c]));r.material=l}else r.material=a(e.materials,this.material);if(this.children.length>0){r.children=[];for(let l=0;l<this.children.length;l++)r.children.push(this.children[l].toJSON(e).object)}if(this.animations.length>0){r.animations=[];for(let l=0;l<this.animations.length;l++){const c=this.animations[l];r.animations.push(a(e.animations,c))}}if(n){const l=s(e.geometries),c=s(e.materials),d=s(e.textures),f=s(e.images),h=s(e.shapes),g=s(e.skeletons),m=s(e.animations),b=s(e.nodes);l.length>0&&(i.geometries=l),c.length>0&&(i.materials=c),d.length>0&&(i.textures=d),f.length>0&&(i.images=f),h.length>0&&(i.shapes=h),g.length>0&&(i.skeletons=g),m.length>0&&(i.animations=m),b.length>0&&(i.nodes=b)}return i.object=r,i;function s(l){const c=[];for(const d in l){const f=l[d];delete f.metadata,c.push(f)}return c}}clone(e){return new this.constructor().copy(this,e)}copy(e,n=!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.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,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.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),n===!0)for(let i=0;i<e.children.length;i++){const r=e.children[i];this.add(r.clone())}return this}};_a.DEFAULT_UP=new Ve(0,1,0);_a.DEFAULT_MATRIX_AUTO_UPDATE=!0;_a.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;const ss=new Ve,yo=new Ve,jS=new Ve,bo=new Ve,Ed=new Ve,Md=new Ve,NN=new Ve,HS=new Ve,GS=new Ve,VS=new Ve,$S=new gi,WS=new gi,XS=new gi;let ep=class Qd{constructor(e=new Ve,n=new Ve,i=new Ve){this.a=e,this.b=n,this.c=i}static getNormal(e,n,i,r){r.subVectors(i,n),ss.subVectors(e,n),r.cross(ss);const a=r.lengthSq();return a>0?r.multiplyScalar(1/Math.sqrt(a)):r.set(0,0,0)}static getBarycoord(e,n,i,r,a){ss.subVectors(r,n),yo.subVectors(i,n),jS.subVectors(e,n);const s=ss.dot(ss),l=ss.dot(yo),c=ss.dot(jS),d=yo.dot(yo),f=yo.dot(jS),h=s*d-l*l;if(h===0)return a.set(0,0,0),null;const g=1/h,m=(d*c-l*f)*g,b=(s*f-l*c)*g;return a.set(1-m-b,b,m)}static containsPoint(e,n,i,r){return this.getBarycoord(e,n,i,r,bo)===null?!1:bo.x>=0&&bo.y>=0&&bo.x+bo.y<=1}static getInterpolation(e,n,i,r,a,s,l,c){return this.getBarycoord(e,n,i,r,bo)===null?(c.x=0,c.y=0,"z"in c&&(c.z=0),"w"in c&&(c.w=0),null):(c.setScalar(0),c.addScaledVector(a,bo.x),c.addScaledVector(s,bo.y),c.addScaledVector(l,bo.z),c)}static getInterpolatedAttribute(e,n,i,r,a,s){return $S.setScalar(0),WS.setScalar(0),XS.setScalar(0),$S.fromBufferAttribute(e,n),WS.fromBufferAttribute(e,i),XS.fromBufferAttribute(e,r),s.setScalar(0),s.addScaledVector($S,a.x),s.addScaledVector(WS,a.y),s.addScaledVector(XS,a.z),s}static isFrontFacing(e,n,i,r){return ss.subVectors(i,n),yo.subVectors(e,n),ss.cross(yo).dot(r)<0}set(e,n,i){return this.a.copy(e),this.b.copy(n),this.c.copy(i),this}setFromPointsAndIndices(e,n,i,r){return this.a.copy(e[n]),this.b.copy(e[i]),this.c.copy(e[r]),this}setFromAttributeAndIndices(e,n,i,r){return this.a.fromBufferAttribute(e,n),this.b.fromBufferAttribute(e,i),this.c.fromBufferAttribute(e,r),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 ss.subVectors(this.c,this.b),yo.subVectors(this.a,this.b),ss.cross(yo).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return Qd.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,n){return Qd.getBarycoord(e,this.a,this.b,this.c,n)}getInterpolation(e,n,i,r,a){return Qd.getInterpolation(e,this.a,this.b,this.c,n,i,r,a)}containsPoint(e){return Qd.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return Qd.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,n){const i=this.a,r=this.b,a=this.c;let s,l;Ed.subVectors(r,i),Md.subVectors(a,i),HS.subVectors(e,i);const c=Ed.dot(HS),d=Md.dot(HS);if(c<=0&&d<=0)return n.copy(i);GS.subVectors(e,r);const f=Ed.dot(GS),h=Md.dot(GS);if(f>=0&&h<=f)return n.copy(r);const g=c*h-f*d;if(g<=0&&c>=0&&f<=0)return s=c/(c-f),n.copy(i).addScaledVector(Ed,s);VS.subVectors(e,a);const m=Ed.dot(VS),b=Md.dot(VS);if(b>=0&&m<=b)return n.copy(a);const y=m*d-c*b;if(y<=0&&d>=0&&b<=0)return l=d/(d-b),n.copy(i).addScaledVector(Md,l);const x=f*b-m*h;if(x<=0&&h-f>=0&&m-b>=0)return NN.subVectors(a,r),l=(h-f)/(h-f+(m-b)),n.copy(r).addScaledVector(NN,l);const v=1/(x+y+g);return s=y*v,l=g*v,n.copy(i).addScaledVector(Ed,s).addScaledVector(Md,l)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}};const rB={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},Il={h:0,s:0,l:0},v0={h:0,s:0,l:0};function qS(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+(e-t)*6*n:n<1/2?e:n<2/3?t+(e-t)*6*(2/3-n):t}let nn=class{constructor(e,n,i){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,n,i)}set(e,n,i){if(n===void 0&&i===void 0){const r=e;r&&r.isColor?this.copy(r):typeof r=="number"?this.setHex(r):typeof r=="string"&&this.setStyle(r)}else this.setRGB(e,n,i);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,n=za){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,un.colorSpaceToWorking(this,n),this}setRGB(e,n,i,r=un.workingColorSpace){return this.r=e,this.g=n,this.b=i,un.colorSpaceToWorking(this,r),this}setHSL(e,n,i,r=un.workingColorSpace){if(e=_Y(e,1),n=Qt(n,0,1),i=Qt(i,0,1),n===0)this.r=this.g=this.b=i;else{const a=i<=.5?i*(1+n):i+n-i*n,s=2*i-a;this.r=qS(s,a,e+1/3),this.g=qS(s,a,e),this.b=qS(s,a,e-1/3)}return un.colorSpaceToWorking(this,r),this}setStyle(e,n=za){function i(a){a!==void 0&&parseFloat(a)<1&&It("Color: Alpha component of "+e+" will be ignored.")}let r;if(r=/^(\w+)\(([^\)]*)\)/.exec(e)){let a;const s=r[1],l=r[2];switch(s){case"rgb":case"rgba":if(a=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(l))return i(a[4]),this.setRGB(Math.min(255,parseInt(a[1],10))/255,Math.min(255,parseInt(a[2],10))/255,Math.min(255,parseInt(a[3],10))/255,n);if(a=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(l))return i(a[4]),this.setRGB(Math.min(100,parseInt(a[1],10))/100,Math.min(100,parseInt(a[2],10))/100,Math.min(100,parseInt(a[3],10))/100,n);break;case"hsl":case"hsla":if(a=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(l))return i(a[4]),this.setHSL(parseFloat(a[1])/360,parseFloat(a[2])/100,parseFloat(a[3])/100,n);break;default:It("Color: Unknown color model "+e)}}else if(r=/^\#([A-Fa-f\d]+)$/.exec(e)){const a=r[1],s=a.length;if(s===3)return this.setRGB(parseInt(a.charAt(0),16)/15,parseInt(a.charAt(1),16)/15,parseInt(a.charAt(2),16)/15,n);if(s===6)return this.setHex(parseInt(a,16),n);It("Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,n);return this}setColorName(e,n=za){const i=rB[e.toLowerCase()];return i!==void 0?this.setHex(i,n):It("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=Bo(e.r),this.g=Bo(e.g),this.b=Bo(e.b),this}copyLinearToSRGB(e){return this.r=lf(e.r),this.g=lf(e.g),this.b=lf(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=za){return un.workingToColorSpace(xr.copy(this),e),Math.round(Qt(xr.r*255,0,255))*65536+Math.round(Qt(xr.g*255,0,255))*256+Math.round(Qt(xr.b*255,0,255))}getHexString(e=za){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,n=un.workingColorSpace){un.workingToColorSpace(xr.copy(this),n);const i=xr.r,r=xr.g,a=xr.b,s=Math.max(i,r,a),l=Math.min(i,r,a);let c,d;const f=(l+s)/2;if(l===s)c=0,d=0;else{const h=s-l;switch(d=f<=.5?h/(s+l):h/(2-s-l),s){case i:c=(r-a)/h+(r<a?6:0);break;case r:c=(a-i)/h+2;break;case a:c=(i-r)/h+4;break}c/=6}return e.h=c,e.s=d,e.l=f,e}getRGB(e,n=un.workingColorSpace){return un.workingToColorSpace(xr.copy(this),n),e.r=xr.r,e.g=xr.g,e.b=xr.b,e}getStyle(e=za){un.workingToColorSpace(xr.copy(this),e);const n=xr.r,i=xr.g,r=xr.b;return e!==za?`color(${e} ${n.toFixed(3)} ${i.toFixed(3)} ${r.toFixed(3)})`:`rgb(${Math.round(n*255)},${Math.round(i*255)},${Math.round(r*255)})`}offsetHSL(e,n,i){return this.getHSL(Il),this.setHSL(Il.h+e,Il.s+n,Il.l+i)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,n){return this.r=e.r+n.r,this.g=e.g+n.g,this.b=e.b+n.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,n){return this.r+=(e.r-this.r)*n,this.g+=(e.g-this.g)*n,this.b+=(e.b-this.b)*n,this}lerpColors(e,n,i){return this.r=e.r+(n.r-e.r)*i,this.g=e.g+(n.g-e.g)*i,this.b=e.b+(n.b-e.b)*i,this}lerpHSL(e,n){this.getHSL(Il),e.getHSL(v0);const i=PS(Il.h,v0.h,n),r=PS(Il.s,v0.s,n),a=PS(Il.l,v0.l,n);return this.setHSL(i,r,a),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){const n=this.r,i=this.g,r=this.b,a=e.elements;return this.r=a[0]*n+a[3]*i+a[6]*r,this.g=a[1]*n+a[4]*i+a[7]*r,this.b=a[2]*n+a[5]*i+a[8]*r,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,n=0){return this.r=e[n],this.g=e[n+1],this.b=e[n+2],this}toArray(e=[],n=0){return e[n]=this.r,e[n+1]=this.g,e[n+2]=this.b,e}fromBufferAttribute(e,n){return this.r=e.getX(n),this.g=e.getY(n),this.b=e.getZ(n),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}};const xr=new nn;nn.NAMES=rB;let UY=0,jf=class extends Iu{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:UY++}),this.uuid=xm(),this.name="",this.type="Material",this.blending=of,this.side=oc,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=$E,this.blendDst=WE,this.blendEquation=Zc,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new nn(0,0,0),this.blendAlpha=0,this.depthFunc=vf,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=vN,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=gd,this.stencilZFail=gd,this.stencilZPass=gd,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.allowOverride=!0,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}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const n in e){const i=e[n];if(i===void 0){It(`Material: parameter '${n}' has value of undefined.`);continue}const r=this[n];if(r===void 0){It(`Material: '${n}' is not a property of THREE.${this.type}.`);continue}r&&r.isColor?r.set(i):r&&r.isVector3&&i&&i.isVector3?r.copy(i):this[n]=i}}toJSON(e){const n=e===void 0||typeof e=="string";n&&(e={textures:{},images:{}});const i={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};i.uuid=this.uuid,i.type=this.type,this.name!==""&&(i.name=this.name),this.color&&this.color.isColor&&(i.color=this.color.getHex()),this.roughness!==void 0&&(i.roughness=this.roughness),this.metalness!==void 0&&(i.metalness=this.metalness),this.sheen!==void 0&&(i.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(i.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(i.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(i.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(i.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(i.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(i.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(i.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(i.shininess=this.shininess),this.clearcoat!==void 0&&(i.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(i.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(i.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(i.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(i.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,i.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.sheenColorMap&&this.sheenColorMap.isTexture&&(i.sheenColorMap=this.sheenColorMap.toJSON(e).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(i.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(e).uuid),this.dispersion!==void 0&&(i.dispersion=this.dispersion),this.iridescence!==void 0&&(i.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(i.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(i.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(i.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(i.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(i.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(i.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(i.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(i.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(i.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(i.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(i.lightMap=this.lightMap.toJSON(e).uuid,i.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(i.aoMap=this.aoMap.toJSON(e).uuid,i.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(i.bumpMap=this.bumpMap.toJSON(e).uuid,i.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(i.normalMap=this.normalMap.toJSON(e).uuid,i.normalMapType=this.normalMapType,i.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(i.displacementMap=this.displacementMap.toJSON(e).uuid,i.displacementScale=this.displacementScale,i.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(i.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(i.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(i.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(i.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(i.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(i.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(i.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(i.combine=this.combine)),this.envMapRotation!==void 0&&(i.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(i.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(i.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(i.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(i.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(i.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(i.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(i.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(i.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(i.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(i.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(i.size=this.size),this.shadowSide!==null&&(i.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(i.sizeAttenuation=this.sizeAttenuation),this.blending!==of&&(i.blending=this.blending),this.side!==oc&&(i.side=this.side),this.vertexColors===!0&&(i.vertexColors=!0),this.opacity<1&&(i.opacity=this.opacity),this.transparent===!0&&(i.transparent=!0),this.blendSrc!==$E&&(i.blendSrc=this.blendSrc),this.blendDst!==WE&&(i.blendDst=this.blendDst),this.blendEquation!==Zc&&(i.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(i.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(i.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(i.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(i.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(i.blendAlpha=this.blendAlpha),this.depthFunc!==vf&&(i.depthFunc=this.depthFunc),this.depthTest===!1&&(i.depthTest=this.depthTest),this.depthWrite===!1&&(i.depthWrite=this.depthWrite),this.colorWrite===!1&&(i.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(i.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==vN&&(i.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(i.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(i.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==gd&&(i.stencilFail=this.stencilFail),this.stencilZFail!==gd&&(i.stencilZFail=this.stencilZFail),this.stencilZPass!==gd&&(i.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(i.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(i.rotation=this.rotation),this.polygonOffset===!0&&(i.polygonOffset=!0),this.polygonOffsetFactor!==0&&(i.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(i.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(i.linewidth=this.linewidth),this.dashSize!==void 0&&(i.dashSize=this.dashSize),this.gapSize!==void 0&&(i.gapSize=this.gapSize),this.scale!==void 0&&(i.scale=this.scale),this.dithering===!0&&(i.dithering=!0),this.alphaTest>0&&(i.alphaTest=this.alphaTest),this.alphaHash===!0&&(i.alphaHash=!0),this.alphaToCoverage===!0&&(i.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(i.premultipliedAlpha=!0),this.forceSinglePass===!0&&(i.forceSinglePass=!0),this.wireframe===!0&&(i.wireframe=!0),this.wireframeLinewidth>1&&(i.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(i.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(i.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(i.flatShading=!0),this.visible===!1&&(i.visible=!1),this.toneMapped===!1&&(i.toneMapped=!1),this.fog===!1&&(i.fog=!1),Object.keys(this.userData).length>0&&(i.userData=this.userData);function r(a){const s=[];for(const l in a){const c=a[l];delete c.metadata,s.push(c)}return s}if(n){const a=r(e.textures),s=r(e.images);a.length>0&&(i.textures=a),s.length>0&&(i.images=s)}return i}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.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,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 n=e.clippingPlanes;let i=null;if(n!==null){const r=n.length;i=new Array(r);for(let a=0;a!==r;++a)i[a]=n[a].clone()}return this.clippingPlanes=i,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.alphaHash=e.alphaHash,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++}},CT=class extends jf{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new nn(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.envMapRotation=new lc,this.combine=xT,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.envMapRotation.copy(e.envMapRotation),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 hi=new Ve,x0=new $t;let kY=0,Xa=class{constructor(e,n,i=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:kY++}),this.name="",this.array=e,this.itemSize=n,this.count=e!==void 0?e.length/n:0,this.normalized=i,this.usage=xN,this.updateRanges=[],this.gpuType=Lo,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,n){this.updateRanges.push({start:e,count:n})}clearUpdateRanges(){this.updateRanges.length=0}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.gpuType=e.gpuType,this}copyAt(e,n,i){e*=this.itemSize,i*=n.itemSize;for(let r=0,a=this.itemSize;r<a;r++)this.array[e+r]=n.array[i+r];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let n=0,i=this.count;n<i;n++)x0.fromBufferAttribute(this,n),x0.applyMatrix3(e),this.setXY(n,x0.x,x0.y);else if(this.itemSize===3)for(let n=0,i=this.count;n<i;n++)hi.fromBufferAttribute(this,n),hi.applyMatrix3(e),this.setXYZ(n,hi.x,hi.y,hi.z);return this}applyMatrix4(e){for(let n=0,i=this.count;n<i;n++)hi.fromBufferAttribute(this,n),hi.applyMatrix4(e),this.setXYZ(n,hi.x,hi.y,hi.z);return this}applyNormalMatrix(e){for(let n=0,i=this.count;n<i;n++)hi.fromBufferAttribute(this,n),hi.applyNormalMatrix(e),this.setXYZ(n,hi.x,hi.y,hi.z);return this}transformDirection(e){for(let n=0,i=this.count;n<i;n++)hi.fromBufferAttribute(this,n),hi.transformDirection(e),this.setXYZ(n,hi.x,hi.y,hi.z);return this}set(e,n=0){return this.array.set(e,n),this}getComponent(e,n){let i=this.array[e*this.itemSize+n];return this.normalized&&(i=Kh(i,this.array)),i}setComponent(e,n,i){return this.normalized&&(i=$r(i,this.array)),this.array[e*this.itemSize+n]=i,this}getX(e){let n=this.array[e*this.itemSize];return this.normalized&&(n=Kh(n,this.array)),n}setX(e,n){return this.normalized&&(n=$r(n,this.array)),this.array[e*this.itemSize]=n,this}getY(e){let n=this.array[e*this.itemSize+1];return this.normalized&&(n=Kh(n,this.array)),n}setY(e,n){return this.normalized&&(n=$r(n,this.array)),this.array[e*this.itemSize+1]=n,this}getZ(e){let n=this.array[e*this.itemSize+2];return this.normalized&&(n=Kh(n,this.array)),n}setZ(e,n){return this.normalized&&(n=$r(n,this.array)),this.array[e*this.itemSize+2]=n,this}getW(e){let n=this.array[e*this.itemSize+3];return this.normalized&&(n=Kh(n,this.array)),n}setW(e,n){return this.normalized&&(n=$r(n,this.array)),this.array[e*this.itemSize+3]=n,this}setXY(e,n,i){return e*=this.itemSize,this.normalized&&(n=$r(n,this.array),i=$r(i,this.array)),this.array[e+0]=n,this.array[e+1]=i,this}setXYZ(e,n,i,r){return e*=this.itemSize,this.normalized&&(n=$r(n,this.array),i=$r(i,this.array),r=$r(r,this.array)),this.array[e+0]=n,this.array[e+1]=i,this.array[e+2]=r,this}setXYZW(e,n,i,r,a){return e*=this.itemSize,this.normalized&&(n=$r(n,this.array),i=$r(i,this.array),r=$r(r,this.array),a=$r(a,this.array)),this.array[e+0]=n,this.array[e+1]=i,this.array[e+2]=r,this.array[e+3]=a,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!==xN&&(e.usage=this.usage),e}},aB=class extends Xa{constructor(e,n,i){super(new Uint16Array(e),n,i)}},sB=class extends Xa{constructor(e,n,i){super(new Uint32Array(e),n,i)}},vs=class extends Xa{constructor(e,n,i){super(new Float32Array(e),n,i)}},FY=0;const Na=new bi,YS=new _a,Ad=new Ve,da=new wu,tp=new wu,Vi=new Ve;let Ks=class oB extends Iu{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:FY++}),this.uuid=xm(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=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(Kz(e)?sB:aB)(e,1):this.index=e,this}setIndirect(e){return this.indirect=e,this}getIndirect(){return this.indirect}getAttribute(e){return this.attributes[e]}setAttribute(e,n){return this.attributes[e]=n,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,n,i=0){this.groups.push({start:e,count:n,materialIndex:i})}clearGroups(){this.groups=[]}setDrawRange(e,n){this.drawRange.start=e,this.drawRange.count=n}applyMatrix4(e){const n=this.attributes.position;n!==void 0&&(n.applyMatrix4(e),n.needsUpdate=!0);const i=this.attributes.normal;if(i!==void 0){const a=new Xt().getNormalMatrix(e);i.applyNormalMatrix(a),i.needsUpdate=!0}const r=this.attributes.tangent;return r!==void 0&&(r.transformDirection(e),r.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(e){return Na.makeRotationFromQuaternion(e),this.applyMatrix4(Na),this}rotateX(e){return Na.makeRotationX(e),this.applyMatrix4(Na),this}rotateY(e){return Na.makeRotationY(e),this.applyMatrix4(Na),this}rotateZ(e){return Na.makeRotationZ(e),this.applyMatrix4(Na),this}translate(e,n,i){return Na.makeTranslation(e,n,i),this.applyMatrix4(Na),this}scale(e,n,i){return Na.makeScale(e,n,i),this.applyMatrix4(Na),this}lookAt(e){return YS.lookAt(e),YS.updateMatrix(),this.applyMatrix4(YS.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Ad).negate(),this.translate(Ad.x,Ad.y,Ad.z),this}setFromPoints(e){const n=this.getAttribute("position");if(n===void 0){const i=[];for(let r=0,a=e.length;r<a;r++){const s=e[r];i.push(s.x,s.y,s.z||0)}this.setAttribute("position",new vs(i,3))}else{const i=Math.min(e.length,n.count);for(let r=0;r<i;r++){const a=e[r];n.setXYZ(r,a.x,a.y,a.z||0)}e.length>n.count&&It("BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),n.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new wu);const e=this.attributes.position,n=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){ai("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new Ve(-1/0,-1/0,-1/0),new Ve(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),n)for(let i=0,r=n.length;i<r;i++){const a=n[i];da.setFromBufferAttribute(a),this.morphTargetsRelative?(Vi.addVectors(this.boundingBox.min,da.min),this.boundingBox.expandByPoint(Vi),Vi.addVectors(this.boundingBox.max,da.max),this.boundingBox.expandByPoint(Vi)):(this.boundingBox.expandByPoint(da.min),this.boundingBox.expandByPoint(da.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&ai('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 hy);const e=this.attributes.position,n=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){ai("BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new Ve,1/0);return}if(e){const i=this.boundingSphere.center;if(da.setFromBufferAttribute(e),n)for(let a=0,s=n.length;a<s;a++){const l=n[a];tp.setFromBufferAttribute(l),this.morphTargetsRelative?(Vi.addVectors(da.min,tp.min),da.expandByPoint(Vi),Vi.addVectors(da.max,tp.max),da.expandByPoint(Vi)):(da.expandByPoint(tp.min),da.expandByPoint(tp.max))}da.getCenter(i);let r=0;for(let a=0,s=e.count;a<s;a++)Vi.fromBufferAttribute(e,a),r=Math.max(r,i.distanceToSquared(Vi));if(n)for(let a=0,s=n.length;a<s;a++){const l=n[a],c=this.morphTargetsRelative;for(let d=0,f=l.count;d<f;d++)Vi.fromBufferAttribute(l,d),c&&(Ad.fromBufferAttribute(e,d),Vi.add(Ad)),r=Math.max(r,i.distanceToSquared(Vi))}this.boundingSphere.radius=Math.sqrt(r),isNaN(this.boundingSphere.radius)&&ai('BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){const e=this.index,n=this.attributes;if(e===null||n.position===void 0||n.normal===void 0||n.uv===void 0){ai("BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}const i=n.position,r=n.normal,a=n.uv;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new Xa(new Float32Array(4*i.count),4));const s=this.getAttribute("tangent"),l=[],c=[];for(let F=0;F<i.count;F++)l[F]=new Ve,c[F]=new Ve;const d=new Ve,f=new Ve,h=new Ve,g=new $t,m=new $t,b=new $t,y=new Ve,x=new Ve;function v(F,P,L){d.fromBufferAttribute(i,F),f.fromBufferAttribute(i,P),h.fromBufferAttribute(i,L),g.fromBufferAttribute(a,F),m.fromBufferAttribute(a,P),b.fromBufferAttribute(a,L),f.sub(d),h.sub(d),m.sub(g),b.sub(g);const B=1/(m.x*b.y-b.x*m.y);isFinite(B)&&(y.copy(f).multiplyScalar(b.y).addScaledVector(h,-m.y).multiplyScalar(B),x.copy(h).multiplyScalar(m.x).addScaledVector(f,-b.x).multiplyScalar(B),l[F].add(y),l[P].add(y),l[L].add(y),c[F].add(x),c[P].add(x),c[L].add(x))}let w=this.groups;w.length===0&&(w=[{start:0,count:e.count}]);for(let F=0,P=w.length;F<P;++F){const L=w[F],B=L.start,U=L.count;for(let $=B,I=B+U;$<I;$+=3)v(e.getX($+0),e.getX($+1),e.getX($+2))}const S=new Ve,A=new Ve,R=new Ve,N=new Ve;function C(F){R.fromBufferAttribute(r,F),N.copy(R);const P=l[F];S.copy(P),S.sub(R.multiplyScalar(R.dot(P))).normalize(),A.crossVectors(N,P);const B=A.dot(c[F])<0?-1:1;s.setXYZW(F,S.x,S.y,S.z,B)}for(let F=0,P=w.length;F<P;++F){const L=w[F],B=L.start,U=L.count;for(let $=B,I=B+U;$<I;$+=3)C(e.getX($+0)),C(e.getX($+1)),C(e.getX($+2))}}computeVertexNormals(){const e=this.index,n=this.getAttribute("position");if(n!==void 0){let i=this.getAttribute("normal");if(i===void 0)i=new Xa(new Float32Array(n.count*3),3),this.setAttribute("normal",i);else for(let g=0,m=i.count;g<m;g++)i.setXYZ(g,0,0,0);const r=new Ve,a=new Ve,s=new Ve,l=new Ve,c=new Ve,d=new Ve,f=new Ve,h=new Ve;if(e)for(let g=0,m=e.count;g<m;g+=3){const b=e.getX(g+0),y=e.getX(g+1),x=e.getX(g+2);r.fromBufferAttribute(n,b),a.fromBufferAttribute(n,y),s.fromBufferAttribute(n,x),f.subVectors(s,a),h.subVectors(r,a),f.cross(h),l.fromBufferAttribute(i,b),c.fromBufferAttribute(i,y),d.fromBufferAttribute(i,x),l.add(f),c.add(f),d.add(f),i.setXYZ(b,l.x,l.y,l.z),i.setXYZ(y,c.x,c.y,c.z),i.setXYZ(x,d.x,d.y,d.z)}else for(let g=0,m=n.count;g<m;g+=3)r.fromBufferAttribute(n,g+0),a.fromBufferAttribute(n,g+1),s.fromBufferAttribute(n,g+2),f.subVectors(s,a),h.subVectors(r,a),f.cross(h),i.setXYZ(g+0,f.x,f.y,f.z),i.setXYZ(g+1,f.x,f.y,f.z),i.setXYZ(g+2,f.x,f.y,f.z);this.normalizeNormals(),i.needsUpdate=!0}}normalizeNormals(){const e=this.attributes.normal;for(let n=0,i=e.count;n<i;n++)Vi.fromBufferAttribute(e,n),Vi.normalize(),e.setXYZ(n,Vi.x,Vi.y,Vi.z)}toNonIndexed(){function e(l,c){const d=l.array,f=l.itemSize,h=l.normalized,g=new d.constructor(c.length*f);let m=0,b=0;for(let y=0,x=c.length;y<x;y++){l.isInterleavedBufferAttribute?m=c[y]*l.data.stride+l.offset:m=c[y]*f;for(let v=0;v<f;v++)g[b++]=d[m++]}return new Xa(g,f,h)}if(this.index===null)return It("BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const n=new oB,i=this.index.array,r=this.attributes;for(const l in r){const c=r[l],d=e(c,i);n.setAttribute(l,d)}const a=this.morphAttributes;for(const l in a){const c=[],d=a[l];for(let f=0,h=d.length;f<h;f++){const g=d[f],m=e(g,i);c.push(m)}n.morphAttributes[l]=c}n.morphTargetsRelative=this.morphTargetsRelative;const s=this.groups;for(let l=0,c=s.length;l<c;l++){const d=s[l];n.addGroup(d.start,d.count,d.materialIndex)}return n}toJSON(){const e={metadata:{version:4.7,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 n=this.index;n!==null&&(e.data.index={type:n.array.constructor.name,array:Array.prototype.slice.call(n.array)});const i=this.attributes;for(const c in i){const d=i[c];e.data.attributes[c]=d.toJSON(e.data)}const r={};let a=!1;for(const c in this.morphAttributes){const d=this.morphAttributes[c],f=[];for(let h=0,g=d.length;h<g;h++){const m=d[h];f.push(m.toJSON(e.data))}f.length>0&&(r[c]=f,a=!0)}a&&(e.data.morphAttributes=r,e.data.morphTargetsRelative=this.morphTargetsRelative);const s=this.groups;s.length>0&&(e.data.groups=JSON.parse(JSON.stringify(s)));const l=this.boundingSphere;return l!==null&&(e.data.boundingSphere=l.toJSON()),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 n={};this.name=e.name;const i=e.index;i!==null&&this.setIndex(i.clone());const r=e.attributes;for(const d in r){const f=r[d];this.setAttribute(d,f.clone(n))}const a=e.morphAttributes;for(const d in a){const f=[],h=a[d];for(let g=0,m=h.length;g<m;g++)f.push(h[g].clone(n));this.morphAttributes[d]=f}this.morphTargetsRelative=e.morphTargetsRelative;const s=e.groups;for(let d=0,f=s.length;d<f;d++){const h=s[d];this.addGroup(h.start,h.count,h.materialIndex)}const l=e.boundingBox;l!==null&&(this.boundingBox=l.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,this}dispose(){this.dispatchEvent({type:"dispose"})}};const ON=new bi,kc=new TT,y0=new hy,LN=new Ve,b0=new Ve,_0=new Ve,S0=new Ve,KS=new Ve,w0=new Ve,IN=new Ve,E0=new Ve;let Hs=class extends _a{constructor(e=new Ks,n=new CT){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=n,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.count=1,this.updateMorphTargets()}copy(e,n){return super.copy(e,n),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){const n=this.geometry.morphAttributes,i=Object.keys(n);if(i.length>0){const r=n[i[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let a=0,s=r.length;a<s;a++){const l=r[a].name||String(a);this.morphTargetInfluences.push(0),this.morphTargetDictionary[l]=a}}}}getVertexPosition(e,n){const i=this.geometry,r=i.attributes.position,a=i.morphAttributes.position,s=i.morphTargetsRelative;n.fromBufferAttribute(r,e);const l=this.morphTargetInfluences;if(a&&l){w0.set(0,0,0);for(let c=0,d=a.length;c<d;c++){const f=l[c],h=a[c];f!==0&&(KS.fromBufferAttribute(h,e),s?w0.addScaledVector(KS,f):w0.addScaledVector(KS.sub(n),f))}n.add(w0)}return n}raycast(e,n){const i=this.geometry,r=this.material,a=this.matrixWorld;r!==void 0&&(i.boundingSphere===null&&i.computeBoundingSphere(),y0.copy(i.boundingSphere),y0.applyMatrix4(a),kc.copy(e.ray).recast(e.near),!(y0.containsPoint(kc.origin)===!1&&(kc.intersectSphere(y0,LN)===null||kc.origin.distanceToSquared(LN)>(e.far-e.near)**2))&&(ON.copy(a).invert(),kc.copy(e.ray).applyMatrix4(ON),!(i.boundingBox!==null&&kc.intersectsBox(i.boundingBox)===!1)&&this._computeIntersections(e,n,kc)))}_computeIntersections(e,n,i){let r;const a=this.geometry,s=this.material,l=a.index,c=a.attributes.position,d=a.attributes.uv,f=a.attributes.uv1,h=a.attributes.normal,g=a.groups,m=a.drawRange;if(l!==null)if(Array.isArray(s))for(let b=0,y=g.length;b<y;b++){const x=g[b],v=s[x.materialIndex],w=Math.max(x.start,m.start),S=Math.min(l.count,Math.min(x.start+x.count,m.start+m.count));for(let A=w,R=S;A<R;A+=3){const N=l.getX(A),C=l.getX(A+1),F=l.getX(A+2);r=M0(this,v,e,i,d,f,h,N,C,F),r&&(r.faceIndex=Math.floor(A/3),r.face.materialIndex=x.materialIndex,n.push(r))}}else{const b=Math.max(0,m.start),y=Math.min(l.count,m.start+m.count);for(let x=b,v=y;x<v;x+=3){const w=l.getX(x),S=l.getX(x+1),A=l.getX(x+2);r=M0(this,s,e,i,d,f,h,w,S,A),r&&(r.faceIndex=Math.floor(x/3),n.push(r))}}else if(c!==void 0)if(Array.isArray(s))for(let b=0,y=g.length;b<y;b++){const x=g[b],v=s[x.materialIndex],w=Math.max(x.start,m.start),S=Math.min(c.count,Math.min(x.start+x.count,m.start+m.count));for(let A=w,R=S;A<R;A+=3){const N=A,C=A+1,F=A+2;r=M0(this,v,e,i,d,f,h,N,C,F),r&&(r.faceIndex=Math.floor(A/3),r.face.materialIndex=x.materialIndex,n.push(r))}}else{const b=Math.max(0,m.start),y=Math.min(c.count,m.start+m.count);for(let x=b,v=y;x<v;x+=3){const w=x,S=x+1,A=x+2;r=M0(this,s,e,i,d,f,h,w,S,A),r&&(r.faceIndex=Math.floor(x/3),n.push(r))}}}};function zY(t,e,n,i,r,a,s,l){let c;if(e.side===Kr?c=i.intersectTriangle(s,a,r,!0,l):c=i.intersectTriangle(r,a,s,e.side===oc,l),c===null)return null;E0.copy(l),E0.applyMatrix4(t.matrixWorld);const d=n.ray.origin.distanceTo(E0);return d<n.near||d>n.far?null:{distance:d,point:E0.clone(),object:t}}function M0(t,e,n,i,r,a,s,l,c,d){t.getVertexPosition(l,b0),t.getVertexPosition(c,_0),t.getVertexPosition(d,S0);const f=zY(t,e,n,i,b0,_0,S0,IN);if(f){const h=new Ve;ep.getBarycoord(IN,b0,_0,S0,h),r&&(f.uv=ep.getInterpolatedAttribute(r,l,c,d,h,new $t)),a&&(f.uv1=ep.getInterpolatedAttribute(a,l,c,d,h,new $t)),s&&(f.normal=ep.getInterpolatedAttribute(s,l,c,d,h,new Ve),f.normal.dot(i.direction)>0&&f.normal.multiplyScalar(-1));const g={a:l,b:c,c:d,normal:new Ve,materialIndex:0};ep.getNormal(b0,_0,S0,g.normal),f.face=g,f.barycoord=h}return f}let RT=class lB extends Ks{constructor(e=1,n=1,i=1,r=1,a=1,s=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:n,depth:i,widthSegments:r,heightSegments:a,depthSegments:s};const l=this;r=Math.floor(r),a=Math.floor(a),s=Math.floor(s);const c=[],d=[],f=[],h=[];let g=0,m=0;b("z","y","x",-1,-1,i,n,e,s,a,0),b("z","y","x",1,-1,i,n,-e,s,a,1),b("x","z","y",1,1,e,i,n,r,s,2),b("x","z","y",1,-1,e,i,-n,r,s,3),b("x","y","z",1,-1,e,n,i,r,a,4),b("x","y","z",-1,-1,e,n,-i,r,a,5),this.setIndex(c),this.setAttribute("position",new vs(d,3)),this.setAttribute("normal",new vs(f,3)),this.setAttribute("uv",new vs(h,2));function b(y,x,v,w,S,A,R,N,C,F,P){const L=A/C,B=R/F,U=A/2,$=R/2,I=N/2,W=C+1,X=F+1;let V=0,Y=0;const J=new Ve;for(let se=0;se<X;se++){const H=se*B-$;for(let q=0;q<W;q++){const re=q*L-U;J[y]=re*w,J[x]=H*S,J[v]=I,d.push(J.x,J.y,J.z),J[y]=0,J[x]=0,J[v]=N>0?1:-1,f.push(J.x,J.y,J.z),h.push(q/C),h.push(1-se/F),V+=1}}for(let se=0;se<F;se++)for(let H=0;H<C;H++){const q=g+H+W*se,re=g+H+W*(se+1),ce=g+(H+1)+W*(se+1),ye=g+(H+1)+W*se;c.push(q,re,ye),c.push(re,ce,ye),Y+=6}l.addGroup(m,Y,P),m+=Y,g+=V}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new lB(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}};function _f(t){const e={};for(const n in t){e[n]={};for(const i in t[n]){const r=t[n][i];r&&(r.isColor||r.isMatrix3||r.isMatrix4||r.isVector2||r.isVector3||r.isVector4||r.isTexture||r.isQuaternion)?r.isRenderTargetTexture?(It("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[n][i]=null):e[n][i]=r.clone():Array.isArray(r)?e[n][i]=r.slice():e[n][i]=r}}return e}function Pr(t){const e={};for(let n=0;n<t.length;n++){const i=_f(t[n]);for(const r in i)e[r]=i[r]}return e}function BY(t){const e=[];for(let n=0;n<t.length;n++)e.push(t[n].clone());return e}function cB(t){const e=t.getRenderTarget();return e===null?t.outputColorSpace:e.isXRRenderTarget===!0?e.texture.colorSpace:un.workingColorSpace}const jY={clone:_f,merge:Pr};var HY=`void main() {
  11. gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
  12. }`,GY=`void main() {
  13. gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
  14. }`;let $o=class extends jf{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=HY,this.fragmentShader=GY,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={clipCullDistance:!1,multiDraw:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[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=_f(e.uniforms),this.uniformsGroups=BY(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 n=super.toJSON(e);n.glslVersion=this.glslVersion,n.uniforms={};for(const r in this.uniforms){const s=this.uniforms[r].value;s&&s.isTexture?n.uniforms[r]={type:"t",value:s.toJSON(e).uuid}:s&&s.isColor?n.uniforms[r]={type:"c",value:s.getHex()}:s&&s.isVector2?n.uniforms[r]={type:"v2",value:s.toArray()}:s&&s.isVector3?n.uniforms[r]={type:"v3",value:s.toArray()}:s&&s.isVector4?n.uniforms[r]={type:"v4",value:s.toArray()}:s&&s.isMatrix3?n.uniforms[r]={type:"m3",value:s.toArray()}:s&&s.isMatrix4?n.uniforms[r]={type:"m4",value:s.toArray()}:n.uniforms[r]={value:s}}Object.keys(this.defines).length>0&&(n.defines=this.defines),n.vertexShader=this.vertexShader,n.fragmentShader=this.fragmentShader,n.lights=this.lights,n.clipping=this.clipping;const i={};for(const r in this.extensions)this.extensions[r]===!0&&(i[r]=!0);return Object.keys(i).length>0&&(n.extensions=i),n}},uB=class extends _a{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new bi,this.projectionMatrix=new bi,this.projectionMatrixInverse=new bi,this.coordinateSystem=Is,this._reversedDepth=!1}get reversedDepth(){return this._reversedDepth}copy(e,n){return super.copy(e,n),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,n){super.updateWorldMatrix(e,n),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}};const Ul=new Ve,UN=new $t,kN=new $t;let ja=class extends uB{constructor(e=50,n=1,i=.1,r=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=i,this.far=r,this.focus=10,this.aspect=n,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,n){return super.copy(e,n),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 n=.5*this.getFilmHeight()/e;this.fov=NM*2*Math.atan(n),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(Lv*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return NM*2*Math.atan(Math.tan(Lv*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(e,n,i){Ul.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(Ul.x,Ul.y).multiplyScalar(-e/Ul.z),Ul.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),i.set(Ul.x,Ul.y).multiplyScalar(-e/Ul.z)}getViewSize(e,n){return this.getViewBounds(e,UN,kN),n.subVectors(kN,UN)}setViewOffset(e,n,i,r,a,s){this.aspect=e/n,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=n,this.view.offsetX=i,this.view.offsetY=r,this.view.width=a,this.view.height=s,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let n=e*Math.tan(Lv*.5*this.fov)/this.zoom,i=2*n,r=this.aspect*i,a=-.5*r;const s=this.view;if(this.view!==null&&this.view.enabled){const c=s.fullWidth,d=s.fullHeight;a+=s.offsetX*r/c,n-=s.offsetY*i/d,r*=s.width/c,i*=s.height/d}const l=this.filmOffset;l!==0&&(a+=e*l/this.getFilmWidth()),this.projectionMatrix.makePerspective(a,a+r,n,n-i,e,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const n=super.toJSON(e);return n.object.fov=this.fov,n.object.zoom=this.zoom,n.object.near=this.near,n.object.far=this.far,n.object.focus=this.focus,n.object.aspect=this.aspect,this.view!==null&&(n.object.view=Object.assign({},this.view)),n.object.filmGauge=this.filmGauge,n.object.filmOffset=this.filmOffset,n}};const Td=-90,Cd=1;let VY=class extends _a{constructor(e,n,i){super(),this.type="CubeCamera",this.renderTarget=i,this.coordinateSystem=null,this.activeMipmapLevel=0;const r=new ja(Td,Cd,e,n);r.layers=this.layers,this.add(r);const a=new ja(Td,Cd,e,n);a.layers=this.layers,this.add(a);const s=new ja(Td,Cd,e,n);s.layers=this.layers,this.add(s);const l=new ja(Td,Cd,e,n);l.layers=this.layers,this.add(l);const c=new ja(Td,Cd,e,n);c.layers=this.layers,this.add(c);const d=new ja(Td,Cd,e,n);d.layers=this.layers,this.add(d)}updateCoordinateSystem(){const e=this.coordinateSystem,n=this.children.concat(),[i,r,a,s,l,c]=n;for(const d of n)this.remove(d);if(e===Is)i.up.set(0,1,0),i.lookAt(1,0,0),r.up.set(0,1,0),r.lookAt(-1,0,0),a.up.set(0,0,-1),a.lookAt(0,1,0),s.up.set(0,0,1),s.lookAt(0,-1,0),l.up.set(0,1,0),l.lookAt(0,0,1),c.up.set(0,1,0),c.lookAt(0,0,-1);else if(e===ex)i.up.set(0,-1,0),i.lookAt(-1,0,0),r.up.set(0,-1,0),r.lookAt(1,0,0),a.up.set(0,0,1),a.lookAt(0,1,0),s.up.set(0,0,-1),s.lookAt(0,-1,0),l.up.set(0,-1,0),l.lookAt(0,0,1),c.up.set(0,-1,0),c.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(const d of n)this.add(d),d.updateMatrixWorld()}update(e,n){this.parent===null&&this.updateMatrixWorld();const{renderTarget:i,activeMipmapLevel:r}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[a,s,l,c,d,f]=this.children,h=e.getRenderTarget(),g=e.getActiveCubeFace(),m=e.getActiveMipmapLevel(),b=e.xr.enabled;e.xr.enabled=!1;const y=i.texture.generateMipmaps;i.texture.generateMipmaps=!1,e.setRenderTarget(i,0,r),e.render(n,a),e.setRenderTarget(i,1,r),e.render(n,s),e.setRenderTarget(i,2,r),e.render(n,l),e.setRenderTarget(i,3,r),e.render(n,c),e.setRenderTarget(i,4,r),e.render(n,d),i.texture.generateMipmaps=y,e.setRenderTarget(i,5,r),e.render(n,f),e.setRenderTarget(h,g,m),e.xr.enabled=b,i.texture.needsPMREMUpdate=!0}},dB=class extends Ss{constructor(e=[],n=xf,i,r,a,s,l,c,d,f){super(e,n,i,r,a,s,l,c,d,f),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}},$Y=class extends Su{constructor(e=1,n={}){super(e,e,n),this.isWebGLCubeRenderTarget=!0;const i={width:e,height:e,depth:1},r=[i,i,i,i,i,i];this.texture=new dB(r),this._setTextureOptions(n),this.texture.isRenderTargetTexture=!0}fromEquirectangularTexture(e,n){this.texture.type=n.type,this.texture.colorSpace=n.colorSpace,this.texture.generateMipmaps=n.generateMipmaps,this.texture.minFilter=n.minFilter,this.texture.magFilter=n.magFilter;const i={uniforms:{tEquirect:{value:null}},vertexShader:`
  15. varying vec3 vWorldDirection;
  16. vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
  17. return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
  18. }
  19. void main() {
  20. vWorldDirection = transformDirection( position, modelMatrix );
  21. #include <begin_vertex>
  22. #include <project_vertex>
  23. }
  24. `,fragmentShader:`
  25. uniform sampler2D tEquirect;
  26. varying vec3 vWorldDirection;
  27. #include <common>
  28. void main() {
  29. vec3 direction = normalize( vWorldDirection );
  30. vec2 sampleUV = equirectUv( direction );
  31. gl_FragColor = texture2D( tEquirect, sampleUV );
  32. }
  33. `},r=new RT(5,5,5),a=new $o({name:"CubemapFromEquirect",uniforms:_f(i.uniforms),vertexShader:i.vertexShader,fragmentShader:i.fragmentShader,side:Kr,blending:zo});a.uniforms.tEquirect.value=n;const s=new Hs(r,a),l=n.minFilter;return n.minFilter===iu&&(n.minFilter=$a),new VY(1,10,this).update(e,s),n.minFilter=l,s.geometry.dispose(),s.material.dispose(),this}clear(e,n=!0,i=!0,r=!0){const a=e.getRenderTarget();for(let s=0;s<6;s++)e.setRenderTarget(this,s),e.clear(n,i,r);e.setRenderTarget(a)}},xp=class extends _a{constructor(){super(),this.isGroup=!0,this.type="Group"}};const WY={type:"move"};let ZS=class{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new xp,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 xp,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new Ve,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new Ve),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new xp,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new Ve,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new Ve),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 n=this._hand;if(n)for(const i of e.hand.values())this._getHandJoint(n,i)}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,n,i){let r=null,a=null,s=null;const l=this._targetRay,c=this._grip,d=this._hand;if(e&&n.session.visibilityState!=="visible-blurred"){if(d&&e.hand){s=!0;for(const y of e.hand.values()){const x=n.getJointPose(y,i),v=this._getHandJoint(d,y);x!==null&&(v.matrix.fromArray(x.transform.matrix),v.matrix.decompose(v.position,v.rotation,v.scale),v.matrixWorldNeedsUpdate=!0,v.jointRadius=x.radius),v.visible=x!==null}const f=d.joints["index-finger-tip"],h=d.joints["thumb-tip"],g=f.position.distanceTo(h.position),m=.02,b=.005;d.inputState.pinching&&g>m+b?(d.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!d.inputState.pinching&&g<=m-b&&(d.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else c!==null&&e.gripSpace&&(a=n.getPose(e.gripSpace,i),a!==null&&(c.matrix.fromArray(a.transform.matrix),c.matrix.decompose(c.position,c.rotation,c.scale),c.matrixWorldNeedsUpdate=!0,a.linearVelocity?(c.hasLinearVelocity=!0,c.linearVelocity.copy(a.linearVelocity)):c.hasLinearVelocity=!1,a.angularVelocity?(c.hasAngularVelocity=!0,c.angularVelocity.copy(a.angularVelocity)):c.hasAngularVelocity=!1));l!==null&&(r=n.getPose(e.targetRaySpace,i),r===null&&a!==null&&(r=a),r!==null&&(l.matrix.fromArray(r.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),l.matrixWorldNeedsUpdate=!0,r.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(r.linearVelocity)):l.hasLinearVelocity=!1,r.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(r.angularVelocity)):l.hasAngularVelocity=!1,this.dispatchEvent(WY)))}return l!==null&&(l.visible=r!==null),c!==null&&(c.visible=a!==null),d!==null&&(d.visible=s!==null),this}_getHandJoint(e,n){if(e.joints[n.jointName]===void 0){const i=new xp;i.matrixAutoUpdate=!1,i.visible=!1,e.joints[n.jointName]=i,e.add(i)}return e.joints[n.jointName]}},XY=class extends _a{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new lc,this.environmentIntensity=1,this.environmentRotation=new lc,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,n){return super.copy(e,n),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,this.backgroundRotation.copy(e.backgroundRotation),this.environmentIntensity=e.environmentIntensity,this.environmentRotation.copy(e.environmentRotation),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const n=super.toJSON(e);return this.fog!==null&&(n.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(n.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(n.object.backgroundIntensity=this.backgroundIntensity),n.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(n.object.environmentIntensity=this.environmentIntensity),n.object.environmentRotation=this.environmentRotation.toArray(),n}},qY=class extends Ss{constructor(e=null,n=1,i=1,r,a,s,l,c,d=xa,f=xa,h,g){super(null,s,l,c,d,f,r,a,h,g),this.isDataTexture=!0,this.image={data:e,width:n,height:i},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}};const QS=new Ve,YY=new Ve,KY=new Xt;let Vl=class{constructor(e=new Ve(1,0,0),n=0){this.isPlane=!0,this.normal=e,this.constant=n}set(e,n){return this.normal.copy(e),this.constant=n,this}setComponents(e,n,i,r){return this.normal.set(e,n,i),this.constant=r,this}setFromNormalAndCoplanarPoint(e,n){return this.normal.copy(e),this.constant=-n.dot(this.normal),this}setFromCoplanarPoints(e,n,i){const r=QS.subVectors(i,n).cross(YY.subVectors(e,n)).normalize();return this.setFromNormalAndCoplanarPoint(r,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,n){return n.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,n){const i=e.delta(QS),r=this.normal.dot(i);if(r===0)return this.distanceToPoint(e.start)===0?n.copy(e.start):null;const a=-(e.start.dot(this.normal)+this.constant)/r;return a<0||a>1?null:n.copy(e.start).addScaledVector(i,a)}intersectsLine(e){const n=this.distanceToPoint(e.start),i=this.distanceToPoint(e.end);return n<0&&i>0||i<0&&n>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,n){const i=n||KY.getNormalMatrix(e),r=this.coplanarPoint(QS).applyMatrix4(e),a=this.normal.applyMatrix3(i).normalize();return this.constant=-r.dot(a),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 Fc=new hy,ZY=new $t(.5,.5),A0=new Ve;let PT=class{constructor(e=new Vl,n=new Vl,i=new Vl,r=new Vl,a=new Vl,s=new Vl){this.planes=[e,n,i,r,a,s]}set(e,n,i,r,a,s){const l=this.planes;return l[0].copy(e),l[1].copy(n),l[2].copy(i),l[3].copy(r),l[4].copy(a),l[5].copy(s),this}copy(e){const n=this.planes;for(let i=0;i<6;i++)n[i].copy(e.planes[i]);return this}setFromProjectionMatrix(e,n=Is,i=!1){const r=this.planes,a=e.elements,s=a[0],l=a[1],c=a[2],d=a[3],f=a[4],h=a[5],g=a[6],m=a[7],b=a[8],y=a[9],x=a[10],v=a[11],w=a[12],S=a[13],A=a[14],R=a[15];if(r[0].setComponents(d-s,m-f,v-b,R-w).normalize(),r[1].setComponents(d+s,m+f,v+b,R+w).normalize(),r[2].setComponents(d+l,m+h,v+y,R+S).normalize(),r[3].setComponents(d-l,m-h,v-y,R-S).normalize(),i)r[4].setComponents(c,g,x,A).normalize(),r[5].setComponents(d-c,m-g,v-x,R-A).normalize();else if(r[4].setComponents(d-c,m-g,v-x,R-A).normalize(),n===Is)r[5].setComponents(d+c,m+g,v+x,R+A).normalize();else if(n===ex)r[5].setComponents(c,g,x,A).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+n);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),Fc.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const n=e.geometry;n.boundingSphere===null&&n.computeBoundingSphere(),Fc.copy(n.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(Fc)}intersectsSprite(e){Fc.center.set(0,0,0);const n=ZY.distanceTo(e.center);return Fc.radius=.7071067811865476+n,Fc.applyMatrix4(e.matrixWorld),this.intersectsSphere(Fc)}intersectsSphere(e){const n=this.planes,i=e.center,r=-e.radius;for(let a=0;a<6;a++)if(n[a].distanceToPoint(i)<r)return!1;return!0}intersectsBox(e){const n=this.planes;for(let i=0;i<6;i++){const r=n[i];if(A0.x=r.normal.x>0?e.max.x:e.min.x,A0.y=r.normal.y>0?e.max.y:e.min.y,A0.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(A0)<0)return!1}return!0}containsPoint(e){const n=this.planes;for(let i=0;i<6;i++)if(n[i].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}},fB=class extends jf{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new nn(16777215),this.map=null,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.map=e.map,this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}};const nx=new Ve,ix=new Ve,FN=new bi,np=new TT,T0=new hy,JS=new Ve,zN=new Ve;let QY=class extends _a{constructor(e=new Ks,n=new fB){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=n,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,n){return super.copy(e,n),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}computeLineDistances(){const e=this.geometry;if(e.index===null){const n=e.attributes.position,i=[0];for(let r=1,a=n.count;r<a;r++)nx.fromBufferAttribute(n,r-1),ix.fromBufferAttribute(n,r),i[r]=i[r-1],i[r]+=nx.distanceTo(ix);e.setAttribute("lineDistance",new vs(i,1))}else It("Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(e,n){const i=this.geometry,r=this.matrixWorld,a=e.params.Line.threshold,s=i.drawRange;if(i.boundingSphere===null&&i.computeBoundingSphere(),T0.copy(i.boundingSphere),T0.applyMatrix4(r),T0.radius+=a,e.ray.intersectsSphere(T0)===!1)return;FN.copy(r).invert(),np.copy(e.ray).applyMatrix4(FN);const l=a/((this.scale.x+this.scale.y+this.scale.z)/3),c=l*l,d=this.isLineSegments?2:1,f=i.index,g=i.attributes.position;if(f!==null){const m=Math.max(0,s.start),b=Math.min(f.count,s.start+s.count);for(let y=m,x=b-1;y<x;y+=d){const v=f.getX(y),w=f.getX(y+1),S=C0(this,e,np,c,v,w,y);S&&n.push(S)}if(this.isLineLoop){const y=f.getX(b-1),x=f.getX(m),v=C0(this,e,np,c,y,x,b-1);v&&n.push(v)}}else{const m=Math.max(0,s.start),b=Math.min(g.count,s.start+s.count);for(let y=m,x=b-1;y<x;y+=d){const v=C0(this,e,np,c,y,y+1,y);v&&n.push(v)}if(this.isLineLoop){const y=C0(this,e,np,c,b-1,m,b-1);y&&n.push(y)}}}updateMorphTargets(){const n=this.geometry.morphAttributes,i=Object.keys(n);if(i.length>0){const r=n[i[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let a=0,s=r.length;a<s;a++){const l=r[a].name||String(a);this.morphTargetInfluences.push(0),this.morphTargetDictionary[l]=a}}}}};function C0(t,e,n,i,r,a,s){const l=t.geometry.attributes.position;if(nx.fromBufferAttribute(l,r),ix.fromBufferAttribute(l,a),n.distanceSqToSegment(nx,ix,JS,zN)>i)return;JS.applyMatrix4(t.matrixWorld);const d=e.ray.origin.distanceTo(JS);if(!(d<e.near||d>e.far))return{distance:d,point:zN.clone().applyMatrix4(t.matrixWorld),index:s,face:null,faceIndex:null,barycoord:null,object:t}}const BN=new Ve,jN=new Ve;let JY=class extends QY{constructor(e,n){super(e,n),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const e=this.geometry;if(e.index===null){const n=e.attributes.position,i=[];for(let r=0,a=n.count;r<a;r+=2)BN.fromBufferAttribute(n,r),jN.fromBufferAttribute(n,r+1),i[r]=r===0?0:i[r-1],i[r+1]=i[r]+BN.distanceTo(jN);e.setAttribute("lineDistance",new vs(i,1))}else It("LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}},hB=class extends Ss{constructor(e,n,i=bu,r,a,s,l=xa,c=xa,d,f=jp,h=1){if(f!==jp&&f!==Hp)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");const g={width:e,height:n,depth:h};super(g,r,a,s,l,c,f,i,d),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.source=new AT(Object.assign({},e.image)),this.compareFunction=e.compareFunction,this}toJSON(e){const n=super.toJSON(e);return this.compareFunction!==null&&(n.compareFunction=this.compareFunction),n}};class pB extends Ss{constructor(e=null){super(),this.sourceTexture=e,this.isExternalTexture=!0}copy(e){return super.copy(e),this.sourceTexture=e.sourceTexture,this}}let DT=class mB extends Ks{constructor(e=1,n=1,i=1,r=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:n,widthSegments:i,heightSegments:r};const a=e/2,s=n/2,l=Math.floor(i),c=Math.floor(r),d=l+1,f=c+1,h=e/l,g=n/c,m=[],b=[],y=[],x=[];for(let v=0;v<f;v++){const w=v*g-s;for(let S=0;S<d;S++){const A=S*h-a;b.push(A,-w,0),y.push(0,0,1),x.push(S/l),x.push(1-v/c)}}for(let v=0;v<c;v++)for(let w=0;w<l;w++){const S=w+d*v,A=w+d*(v+1),R=w+1+d*(v+1),N=w+1+d*v;m.push(S,A,N),m.push(A,R,N)}this.setIndex(m),this.setAttribute("position",new vs(b,3)),this.setAttribute("normal",new vs(y,3)),this.setAttribute("uv",new vs(x,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new mB(e.width,e.height,e.widthSegments,e.heightSegments)}};class eK extends jf{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new nn(16777215),this.specular=new nn(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new nn(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=qz,this.normalScale=new $t(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new lc,this.combine=xT,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.envMapRotation.copy(e.envMapRotation),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}}let tK=class extends jf{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=cY,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}},nK=class extends jf{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",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.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}},gB=class extends _a{constructor(e,n=1){super(),this.isLight=!0,this.type="Light",this.color=new nn(e),this.intensity=n}dispose(){}copy(e,n){return super.copy(e,n),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){const n=super.toJSON(e);return n.object.color=this.color.getHex(),n.object.intensity=this.intensity,this.groundColor!==void 0&&(n.object.groundColor=this.groundColor.getHex()),this.distance!==void 0&&(n.object.distance=this.distance),this.angle!==void 0&&(n.object.angle=this.angle),this.decay!==void 0&&(n.object.decay=this.decay),this.penumbra!==void 0&&(n.object.penumbra=this.penumbra),this.shadow!==void 0&&(n.object.shadow=this.shadow.toJSON()),this.target!==void 0&&(n.object.target=this.target.uuid),n}};const e1=new bi,HN=new Ve,GN=new Ve;let iK=class{constructor(e){this.camera=e,this.intensity=1,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new $t(512,512),this.mapType=js,this.map=null,this.mapPass=null,this.matrix=new bi,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new PT,this._frameExtents=new $t(1,1),this._viewportCount=1,this._viewports=[new gi(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const n=this.camera,i=this.matrix;HN.setFromMatrixPosition(e.matrixWorld),n.position.copy(HN),GN.setFromMatrixPosition(e.target.matrixWorld),n.lookAt(GN),n.updateMatrixWorld(),e1.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(e1,n.coordinateSystem,n.reversedDepth),n.reversedDepth?i.set(.5,0,0,.5,0,.5,0,.5,0,0,1,0,0,0,0,1):i.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),i.multiply(e1)}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.intensity=e.intensity,this.bias=e.bias,this.radius=e.radius,this.autoUpdate=e.autoUpdate,this.needsUpdate=e.needsUpdate,this.normalBias=e.normalBias,this.blurSamples=e.blurSamples,this.mapSize.copy(e.mapSize),this}clone(){return new this.constructor().copy(this)}toJSON(){const e={};return this.intensity!==1&&(e.intensity=this.intensity),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}},vB=class extends uB{constructor(e=-1,n=1,i=1,r=-1,a=.1,s=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=n,this.top=i,this.bottom=r,this.near=a,this.far=s,this.updateProjectionMatrix()}copy(e,n){return super.copy(e,n),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,n,i,r,a,s){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=n,this.view.offsetX=i,this.view.offsetY=r,this.view.width=a,this.view.height=s,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=(this.right-this.left)/(2*this.zoom),n=(this.top-this.bottom)/(2*this.zoom),i=(this.right+this.left)/2,r=(this.top+this.bottom)/2;let a=i-e,s=i+e,l=r+n,c=r-n;if(this.view!==null&&this.view.enabled){const d=(this.right-this.left)/this.view.fullWidth/this.zoom,f=(this.top-this.bottom)/this.view.fullHeight/this.zoom;a+=d*this.view.offsetX,s=a+d*this.view.width,l-=f*this.view.offsetY,c=l-f*this.view.height}this.projectionMatrix.makeOrthographic(a,s,l,c,this.near,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const n=super.toJSON(e);return n.object.zoom=this.zoom,n.object.left=this.left,n.object.right=this.right,n.object.top=this.top,n.object.bottom=this.bottom,n.object.near=this.near,n.object.far=this.far,this.view!==null&&(n.object.view=Object.assign({},this.view)),n}};class rK extends iK{constructor(){super(new vB(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class VN extends gB{constructor(e,n){super(e,n),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(_a.DEFAULT_UP),this.updateMatrix(),this.target=new _a,this.shadow=new rK}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}let aK=class extends gB{constructor(e,n){super(e,n),this.isAmbientLight=!0,this.type="AmbientLight"}},sK=class extends ja{constructor(e=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=e}},$N=class{constructor(e=1,n=0,i=0){this.radius=e,this.phi=n,this.theta=i}set(e,n,i){return this.radius=e,this.phi=n,this.theta=i,this}copy(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this}makeSafe(){return this.phi=Qt(this.phi,1e-6,Math.PI-1e-6),this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,n,i){return this.radius=Math.sqrt(e*e+n*n+i*i),this.radius===0?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,i),this.phi=Math.acos(Qt(n/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}};class oK extends JY{constructor(e=10,n=10,i=4473924,r=8947848){i=new nn(i),r=new nn(r);const a=n/2,s=e/n,l=e/2,c=[],d=[];for(let g=0,m=0,b=-l;g<=n;g++,b+=s){c.push(-l,0,b,l,0,b),c.push(b,0,-l,b,0,l);const y=g===a?i:r;y.toArray(d,m),m+=3,y.toArray(d,m),m+=3,y.toArray(d,m),m+=3,y.toArray(d,m),m+=3}const f=new Ks;f.setAttribute("position",new vs(c,3)),f.setAttribute("color",new vs(d,3));const h=new fB({vertexColors:!0,toneMapped:!1});super(f,h),this.type="GridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}class lK extends Iu{constructor(e,n=null){super(),this.object=e,this.domElement=n,this.enabled=!0,this.state=-1,this.keys={},this.mouseButtons={LEFT:null,MIDDLE:null,RIGHT:null},this.touches={ONE:null,TWO:null}}connect(e){if(e===void 0){It("Controls: connect() now requires an element.");return}this.domElement!==null&&this.disconnect(),this.domElement=e}disconnect(){}dispose(){}update(){}}function WN(t,e,n,i){const r=cK(i);switch(n){case $z:return t*e;case Xz:return t*e/r.components*r.byteLength;case ST:return t*e/r.components*r.byteLength;case wT:return t*e*2/r.components*r.byteLength;case ET:return t*e*2/r.components*r.byteLength;case Wz:return t*e*3/r.components*r.byteLength;case ms:return t*e*4/r.components*r.byteLength;case MT:return t*e*4/r.components*r.byteLength;case Pv:case Dv:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*8;case Nv:case Ov:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*16;case aM:case oM:return Math.max(t,16)*Math.max(e,8)/4;case rM:case sM:return Math.max(t,8)*Math.max(e,8)/2;case lM:case cM:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*8;case uM:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*16;case dM:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*16;case fM:return Math.floor((t+4)/5)*Math.floor((e+3)/4)*16;case hM:return Math.floor((t+4)/5)*Math.floor((e+4)/5)*16;case pM:return Math.floor((t+5)/6)*Math.floor((e+4)/5)*16;case mM:return Math.floor((t+5)/6)*Math.floor((e+5)/6)*16;case gM:return Math.floor((t+7)/8)*Math.floor((e+4)/5)*16;case vM:return Math.floor((t+7)/8)*Math.floor((e+5)/6)*16;case xM:return Math.floor((t+7)/8)*Math.floor((e+7)/8)*16;case yM:return Math.floor((t+9)/10)*Math.floor((e+4)/5)*16;case bM:return Math.floor((t+9)/10)*Math.floor((e+5)/6)*16;case _M:return Math.floor((t+9)/10)*Math.floor((e+7)/8)*16;case SM:return Math.floor((t+9)/10)*Math.floor((e+9)/10)*16;case wM:return Math.floor((t+11)/12)*Math.floor((e+9)/10)*16;case EM:return Math.floor((t+11)/12)*Math.floor((e+11)/12)*16;case MM:case AM:case TM:return Math.ceil(t/4)*Math.ceil(e/4)*16;case CM:case RM:return Math.ceil(t/4)*Math.ceil(e/4)*8;case PM:case DM:return Math.ceil(t/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${n} format.`)}function cK(t){switch(t){case js:case jz:return{byteLength:1,components:1};case zp:case Hz:case Bf:return{byteLength:2,components:1};case bT:case _T:return{byteLength:2,components:4};case bu:case yT:case Lo:return{byteLength:4,components:1};case Gz:case Vz:return{byteLength:4,components:3}}throw new Error(`Unknown texture type ${t}.`)}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:vT}}));typeof window<"u"&&(window.__THREE__?It("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=vT);function xB(){let t=null,e=!1,n=null,i=null;function r(a,s){n(a,s),i=t.requestAnimationFrame(r)}return{start:function(){e!==!0&&n!==null&&(i=t.requestAnimationFrame(r),e=!0)},stop:function(){t.cancelAnimationFrame(i),e=!1},setAnimationLoop:function(a){n=a},setContext:function(a){t=a}}}function uK(t){const e=new WeakMap;function n(l,c){const d=l.array,f=l.usage,h=d.byteLength,g=t.createBuffer();t.bindBuffer(c,g),t.bufferData(c,d,f),l.onUploadCallback();let m;if(d instanceof Float32Array)m=t.FLOAT;else if(typeof Float16Array<"u"&&d instanceof Float16Array)m=t.HALF_FLOAT;else if(d instanceof Uint16Array)l.isFloat16BufferAttribute?m=t.HALF_FLOAT:m=t.UNSIGNED_SHORT;else if(d instanceof Int16Array)m=t.SHORT;else if(d instanceof Uint32Array)m=t.UNSIGNED_INT;else if(d instanceof Int32Array)m=t.INT;else if(d instanceof Int8Array)m=t.BYTE;else if(d instanceof Uint8Array)m=t.UNSIGNED_BYTE;else if(d instanceof Uint8ClampedArray)m=t.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+d);return{buffer:g,type:m,bytesPerElement:d.BYTES_PER_ELEMENT,version:l.version,size:h}}function i(l,c,d){const f=c.array,h=c.updateRanges;if(t.bindBuffer(d,l),h.length===0)t.bufferSubData(d,0,f);else{h.sort((m,b)=>m.start-b.start);let g=0;for(let m=1;m<h.length;m++){const b=h[g],y=h[m];y.start<=b.start+b.count+1?b.count=Math.max(b.count,y.start+y.count-b.start):(++g,h[g]=y)}h.length=g+1;for(let m=0,b=h.length;m<b;m++){const y=h[m];t.bufferSubData(d,y.start*f.BYTES_PER_ELEMENT,f,y.start,y.count)}c.clearUpdateRanges()}c.onUploadCallback()}function r(l){return l.isInterleavedBufferAttribute&&(l=l.data),e.get(l)}function a(l){l.isInterleavedBufferAttribute&&(l=l.data);const c=e.get(l);c&&(t.deleteBuffer(c.buffer),e.delete(l))}function s(l,c){if(l.isInterleavedBufferAttribute&&(l=l.data),l.isGLBufferAttribute){const f=e.get(l);(!f||f.version<l.version)&&e.set(l,{buffer:l.buffer,type:l.type,bytesPerElement:l.elementSize,version:l.version});return}const d=e.get(l);if(d===void 0)e.set(l,n(l,c));else if(d.version<l.version){if(d.size!==l.array.byteLength)throw new Error("THREE.WebGLAttributes: The size of the buffer attribute's array buffer does not match the original size. Resizing buffer attributes is not supported.");i(d.buffer,l,c),d.version=l.version}}return{get:r,remove:a,update:s}}var dK=`#ifdef USE_ALPHAHASH
  34. if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;
  35. #endif`,fK=`#ifdef USE_ALPHAHASH
  36. const float ALPHA_HASH_SCALE = 0.05;
  37. float hash2D( vec2 value ) {
  38. return fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );
  39. }
  40. float hash3D( vec3 value ) {
  41. return hash2D( vec2( hash2D( value.xy ), value.z ) );
  42. }
  43. float getAlphaHashThreshold( vec3 position ) {
  44. float maxDeriv = max(
  45. length( dFdx( position.xyz ) ),
  46. length( dFdy( position.xyz ) )
  47. );
  48. float pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv );
  49. vec2 pixScales = vec2(
  50. exp2( floor( log2( pixScale ) ) ),
  51. exp2( ceil( log2( pixScale ) ) )
  52. );
  53. vec2 alpha = vec2(
  54. hash3D( floor( pixScales.x * position.xyz ) ),
  55. hash3D( floor( pixScales.y * position.xyz ) )
  56. );
  57. float lerpFactor = fract( log2( pixScale ) );
  58. float x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y;
  59. float a = min( lerpFactor, 1.0 - lerpFactor );
  60. vec3 cases = vec3(
  61. x * x / ( 2.0 * a * ( 1.0 - a ) ),
  62. ( x - 0.5 * a ) / ( 1.0 - a ),
  63. 1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) )
  64. );
  65. float threshold = ( x < ( 1.0 - a ) )
  66. ? ( ( x < a ) ? cases.x : cases.y )
  67. : cases.z;
  68. return clamp( threshold , 1.0e-6, 1.0 );
  69. }
  70. #endif`,hK=`#ifdef USE_ALPHAMAP
  71. diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;
  72. #endif`,pK=`#ifdef USE_ALPHAMAP
  73. uniform sampler2D alphaMap;
  74. #endif`,mK=`#ifdef USE_ALPHATEST
  75. #ifdef ALPHA_TO_COVERAGE
  76. diffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a );
  77. if ( diffuseColor.a == 0.0 ) discard;
  78. #else
  79. if ( diffuseColor.a < alphaTest ) discard;
  80. #endif
  81. #endif`,gK=`#ifdef USE_ALPHATEST
  82. uniform float alphaTest;
  83. #endif`,vK=`#ifdef USE_AOMAP
  84. float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;
  85. reflectedLight.indirectDiffuse *= ambientOcclusion;
  86. #if defined( USE_CLEARCOAT )
  87. clearcoatSpecularIndirect *= ambientOcclusion;
  88. #endif
  89. #if defined( USE_SHEEN )
  90. sheenSpecularIndirect *= ambientOcclusion;
  91. #endif
  92. #if defined( USE_ENVMAP ) && defined( STANDARD )
  93. float dotNV = saturate( dot( geometryNormal, geometryViewDir ) );
  94. reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );
  95. #endif
  96. #endif`,xK=`#ifdef USE_AOMAP
  97. uniform sampler2D aoMap;
  98. uniform float aoMapIntensity;
  99. #endif`,yK=`#ifdef USE_BATCHING
  100. #if ! defined( GL_ANGLE_multi_draw )
  101. #define gl_DrawID _gl_DrawID
  102. uniform int _gl_DrawID;
  103. #endif
  104. uniform highp sampler2D batchingTexture;
  105. uniform highp usampler2D batchingIdTexture;
  106. mat4 getBatchingMatrix( const in float i ) {
  107. int size = textureSize( batchingTexture, 0 ).x;
  108. int j = int( i ) * 4;
  109. int x = j % size;
  110. int y = j / size;
  111. vec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 );
  112. vec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 );
  113. vec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 );
  114. vec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 );
  115. return mat4( v1, v2, v3, v4 );
  116. }
  117. float getIndirectIndex( const in int i ) {
  118. int size = textureSize( batchingIdTexture, 0 ).x;
  119. int x = i % size;
  120. int y = i / size;
  121. return float( texelFetch( batchingIdTexture, ivec2( x, y ), 0 ).r );
  122. }
  123. #endif
  124. #ifdef USE_BATCHING_COLOR
  125. uniform sampler2D batchingColorTexture;
  126. vec3 getBatchingColor( const in float i ) {
  127. int size = textureSize( batchingColorTexture, 0 ).x;
  128. int j = int( i );
  129. int x = j % size;
  130. int y = j / size;
  131. return texelFetch( batchingColorTexture, ivec2( x, y ), 0 ).rgb;
  132. }
  133. #endif`,bK=`#ifdef USE_BATCHING
  134. mat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) );
  135. #endif`,_K=`vec3 transformed = vec3( position );
  136. #ifdef USE_ALPHAHASH
  137. vPosition = vec3( position );
  138. #endif`,SK=`vec3 objectNormal = vec3( normal );
  139. #ifdef USE_TANGENT
  140. vec3 objectTangent = vec3( tangent.xyz );
  141. #endif`,wK=`float G_BlinnPhong_Implicit( ) {
  142. return 0.25;
  143. }
  144. float D_BlinnPhong( const in float shininess, const in float dotNH ) {
  145. return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );
  146. }
  147. vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {
  148. vec3 halfDir = normalize( lightDir + viewDir );
  149. float dotNH = saturate( dot( normal, halfDir ) );
  150. float dotVH = saturate( dot( viewDir, halfDir ) );
  151. vec3 F = F_Schlick( specularColor, 1.0, dotVH );
  152. float G = G_BlinnPhong_Implicit( );
  153. float D = D_BlinnPhong( shininess, dotNH );
  154. return F * ( G * D );
  155. } // validated`,EK=`#ifdef USE_IRIDESCENCE
  156. const mat3 XYZ_TO_REC709 = mat3(
  157. 3.2404542, -0.9692660, 0.0556434,
  158. -1.5371385, 1.8760108, -0.2040259,
  159. -0.4985314, 0.0415560, 1.0572252
  160. );
  161. vec3 Fresnel0ToIor( vec3 fresnel0 ) {
  162. vec3 sqrtF0 = sqrt( fresnel0 );
  163. return ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );
  164. }
  165. vec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {
  166. return pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );
  167. }
  168. float IorToFresnel0( float transmittedIor, float incidentIor ) {
  169. return pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));
  170. }
  171. vec3 evalSensitivity( float OPD, vec3 shift ) {
  172. float phase = 2.0 * PI * OPD * 1.0e-9;
  173. vec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );
  174. vec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );
  175. vec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );
  176. vec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );
  177. 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 ) );
  178. xyz /= 1.0685e-7;
  179. vec3 rgb = XYZ_TO_REC709 * xyz;
  180. return rgb;
  181. }
  182. vec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {
  183. vec3 I;
  184. float iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );
  185. float sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );
  186. float cosTheta2Sq = 1.0 - sinTheta2Sq;
  187. if ( cosTheta2Sq < 0.0 ) {
  188. return vec3( 1.0 );
  189. }
  190. float cosTheta2 = sqrt( cosTheta2Sq );
  191. float R0 = IorToFresnel0( iridescenceIOR, outsideIOR );
  192. float R12 = F_Schlick( R0, 1.0, cosTheta1 );
  193. float T121 = 1.0 - R12;
  194. float phi12 = 0.0;
  195. if ( iridescenceIOR < outsideIOR ) phi12 = PI;
  196. float phi21 = PI - phi12;
  197. vec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) ); vec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );
  198. vec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );
  199. vec3 phi23 = vec3( 0.0 );
  200. if ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;
  201. if ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;
  202. if ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;
  203. float OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;
  204. vec3 phi = vec3( phi21 ) + phi23;
  205. vec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );
  206. vec3 r123 = sqrt( R123 );
  207. vec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );
  208. vec3 C0 = R12 + Rs;
  209. I = C0;
  210. vec3 Cm = Rs - T121;
  211. for ( int m = 1; m <= 2; ++ m ) {
  212. Cm *= r123;
  213. vec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );
  214. I += Cm * Sm;
  215. }
  216. return max( I, vec3( 0.0 ) );
  217. }
  218. #endif`,MK=`#ifdef USE_BUMPMAP
  219. uniform sampler2D bumpMap;
  220. uniform float bumpScale;
  221. vec2 dHdxy_fwd() {
  222. vec2 dSTdx = dFdx( vBumpMapUv );
  223. vec2 dSTdy = dFdy( vBumpMapUv );
  224. float Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x;
  225. float dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll;
  226. float dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll;
  227. return vec2( dBx, dBy );
  228. }
  229. vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {
  230. vec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) );
  231. vec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) );
  232. vec3 vN = surf_norm;
  233. vec3 R1 = cross( vSigmaY, vN );
  234. vec3 R2 = cross( vN, vSigmaX );
  235. float fDet = dot( vSigmaX, R1 ) * faceDirection;
  236. vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );
  237. return normalize( abs( fDet ) * surf_norm - vGrad );
  238. }
  239. #endif`,AK=`#if NUM_CLIPPING_PLANES > 0
  240. vec4 plane;
  241. #ifdef ALPHA_TO_COVERAGE
  242. float distanceToPlane, distanceGradient;
  243. float clipOpacity = 1.0;
  244. #pragma unroll_loop_start
  245. for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {
  246. plane = clippingPlanes[ i ];
  247. distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;
  248. distanceGradient = fwidth( distanceToPlane ) / 2.0;
  249. clipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane );
  250. if ( clipOpacity == 0.0 ) discard;
  251. }
  252. #pragma unroll_loop_end
  253. #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES
  254. float unionClipOpacity = 1.0;
  255. #pragma unroll_loop_start
  256. for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {
  257. plane = clippingPlanes[ i ];
  258. distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;
  259. distanceGradient = fwidth( distanceToPlane ) / 2.0;
  260. unionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane );
  261. }
  262. #pragma unroll_loop_end
  263. clipOpacity *= 1.0 - unionClipOpacity;
  264. #endif
  265. diffuseColor.a *= clipOpacity;
  266. if ( diffuseColor.a == 0.0 ) discard;
  267. #else
  268. #pragma unroll_loop_start
  269. for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {
  270. plane = clippingPlanes[ i ];
  271. if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;
  272. }
  273. #pragma unroll_loop_end
  274. #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES
  275. bool clipped = true;
  276. #pragma unroll_loop_start
  277. for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {
  278. plane = clippingPlanes[ i ];
  279. clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;
  280. }
  281. #pragma unroll_loop_end
  282. if ( clipped ) discard;
  283. #endif
  284. #endif
  285. #endif`,TK=`#if NUM_CLIPPING_PLANES > 0
  286. varying vec3 vClipPosition;
  287. uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];
  288. #endif`,CK=`#if NUM_CLIPPING_PLANES > 0
  289. varying vec3 vClipPosition;
  290. #endif`,RK=`#if NUM_CLIPPING_PLANES > 0
  291. vClipPosition = - mvPosition.xyz;
  292. #endif`,PK=`#if defined( USE_COLOR_ALPHA )
  293. diffuseColor *= vColor;
  294. #elif defined( USE_COLOR )
  295. diffuseColor.rgb *= vColor;
  296. #endif`,DK=`#if defined( USE_COLOR_ALPHA )
  297. varying vec4 vColor;
  298. #elif defined( USE_COLOR )
  299. varying vec3 vColor;
  300. #endif`,NK=`#if defined( USE_COLOR_ALPHA )
  301. varying vec4 vColor;
  302. #elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
  303. varying vec3 vColor;
  304. #endif`,OK=`#if defined( USE_COLOR_ALPHA )
  305. vColor = vec4( 1.0 );
  306. #elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
  307. vColor = vec3( 1.0 );
  308. #endif
  309. #ifdef USE_COLOR
  310. vColor *= color;
  311. #endif
  312. #ifdef USE_INSTANCING_COLOR
  313. vColor.xyz *= instanceColor.xyz;
  314. #endif
  315. #ifdef USE_BATCHING_COLOR
  316. vec3 batchingColor = getBatchingColor( getIndirectIndex( gl_DrawID ) );
  317. vColor.xyz *= batchingColor.xyz;
  318. #endif`,LK=`#define PI 3.141592653589793
  319. #define PI2 6.283185307179586
  320. #define PI_HALF 1.5707963267948966
  321. #define RECIPROCAL_PI 0.3183098861837907
  322. #define RECIPROCAL_PI2 0.15915494309189535
  323. #define EPSILON 1e-6
  324. #ifndef saturate
  325. #define saturate( a ) clamp( a, 0.0, 1.0 )
  326. #endif
  327. #define whiteComplement( a ) ( 1.0 - saturate( a ) )
  328. float pow2( const in float x ) { return x*x; }
  329. vec3 pow2( const in vec3 x ) { return x*x; }
  330. float pow3( const in float x ) { return x*x*x; }
  331. float pow4( const in float x ) { float x2 = x*x; return x2*x2; }
  332. float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }
  333. float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }
  334. highp float rand( const in vec2 uv ) {
  335. const highp float a = 12.9898, b = 78.233, c = 43758.5453;
  336. highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );
  337. return fract( sin( sn ) * c );
  338. }
  339. #ifdef HIGH_PRECISION
  340. float precisionSafeLength( vec3 v ) { return length( v ); }
  341. #else
  342. float precisionSafeLength( vec3 v ) {
  343. float maxComponent = max3( abs( v ) );
  344. return length( v / maxComponent ) * maxComponent;
  345. }
  346. #endif
  347. struct IncidentLight {
  348. vec3 color;
  349. vec3 direction;
  350. bool visible;
  351. };
  352. struct ReflectedLight {
  353. vec3 directDiffuse;
  354. vec3 directSpecular;
  355. vec3 indirectDiffuse;
  356. vec3 indirectSpecular;
  357. };
  358. #ifdef USE_ALPHAHASH
  359. varying vec3 vPosition;
  360. #endif
  361. vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
  362. return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
  363. }
  364. vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {
  365. return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );
  366. }
  367. bool isPerspectiveMatrix( mat4 m ) {
  368. return m[ 2 ][ 3 ] == - 1.0;
  369. }
  370. vec2 equirectUv( in vec3 dir ) {
  371. float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;
  372. float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;
  373. return vec2( u, v );
  374. }
  375. vec3 BRDF_Lambert( const in vec3 diffuseColor ) {
  376. return RECIPROCAL_PI * diffuseColor;
  377. }
  378. vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {
  379. float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
  380. return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
  381. }
  382. float F_Schlick( const in float f0, const in float f90, const in float dotVH ) {
  383. float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
  384. return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
  385. } // validated`,IK=`#ifdef ENVMAP_TYPE_CUBE_UV
  386. #define cubeUV_minMipLevel 4.0
  387. #define cubeUV_minTileSize 16.0
  388. float getFace( vec3 direction ) {
  389. vec3 absDirection = abs( direction );
  390. float face = - 1.0;
  391. if ( absDirection.x > absDirection.z ) {
  392. if ( absDirection.x > absDirection.y )
  393. face = direction.x > 0.0 ? 0.0 : 3.0;
  394. else
  395. face = direction.y > 0.0 ? 1.0 : 4.0;
  396. } else {
  397. if ( absDirection.z > absDirection.y )
  398. face = direction.z > 0.0 ? 2.0 : 5.0;
  399. else
  400. face = direction.y > 0.0 ? 1.0 : 4.0;
  401. }
  402. return face;
  403. }
  404. vec2 getUV( vec3 direction, float face ) {
  405. vec2 uv;
  406. if ( face == 0.0 ) {
  407. uv = vec2( direction.z, direction.y ) / abs( direction.x );
  408. } else if ( face == 1.0 ) {
  409. uv = vec2( - direction.x, - direction.z ) / abs( direction.y );
  410. } else if ( face == 2.0 ) {
  411. uv = vec2( - direction.x, direction.y ) / abs( direction.z );
  412. } else if ( face == 3.0 ) {
  413. uv = vec2( - direction.z, direction.y ) / abs( direction.x );
  414. } else if ( face == 4.0 ) {
  415. uv = vec2( - direction.x, direction.z ) / abs( direction.y );
  416. } else {
  417. uv = vec2( direction.x, direction.y ) / abs( direction.z );
  418. }
  419. return 0.5 * ( uv + 1.0 );
  420. }
  421. vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {
  422. float face = getFace( direction );
  423. float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );
  424. mipInt = max( mipInt, cubeUV_minMipLevel );
  425. float faceSize = exp2( mipInt );
  426. highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;
  427. if ( face > 2.0 ) {
  428. uv.y += faceSize;
  429. face -= 3.0;
  430. }
  431. uv.x += face * faceSize;
  432. uv.x += filterInt * 3.0 * cubeUV_minTileSize;
  433. uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );
  434. uv.x *= CUBEUV_TEXEL_WIDTH;
  435. uv.y *= CUBEUV_TEXEL_HEIGHT;
  436. #ifdef texture2DGradEXT
  437. return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;
  438. #else
  439. return texture2D( envMap, uv ).rgb;
  440. #endif
  441. }
  442. #define cubeUV_r0 1.0
  443. #define cubeUV_m0 - 2.0
  444. #define cubeUV_r1 0.8
  445. #define cubeUV_m1 - 1.0
  446. #define cubeUV_r4 0.4
  447. #define cubeUV_m4 2.0
  448. #define cubeUV_r5 0.305
  449. #define cubeUV_m5 3.0
  450. #define cubeUV_r6 0.21
  451. #define cubeUV_m6 4.0
  452. float roughnessToMip( float roughness ) {
  453. float mip = 0.0;
  454. if ( roughness >= cubeUV_r1 ) {
  455. mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;
  456. } else if ( roughness >= cubeUV_r4 ) {
  457. mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;
  458. } else if ( roughness >= cubeUV_r5 ) {
  459. mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;
  460. } else if ( roughness >= cubeUV_r6 ) {
  461. mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;
  462. } else {
  463. mip = - 2.0 * log2( 1.16 * roughness ); }
  464. return mip;
  465. }
  466. vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {
  467. float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );
  468. float mipF = fract( mip );
  469. float mipInt = floor( mip );
  470. vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );
  471. if ( mipF == 0.0 ) {
  472. return vec4( color0, 1.0 );
  473. } else {
  474. vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );
  475. return vec4( mix( color0, color1, mipF ), 1.0 );
  476. }
  477. }
  478. #endif`,UK=`vec3 transformedNormal = objectNormal;
  479. #ifdef USE_TANGENT
  480. vec3 transformedTangent = objectTangent;
  481. #endif
  482. #ifdef USE_BATCHING
  483. mat3 bm = mat3( batchingMatrix );
  484. transformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) );
  485. transformedNormal = bm * transformedNormal;
  486. #ifdef USE_TANGENT
  487. transformedTangent = bm * transformedTangent;
  488. #endif
  489. #endif
  490. #ifdef USE_INSTANCING
  491. mat3 im = mat3( instanceMatrix );
  492. transformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) );
  493. transformedNormal = im * transformedNormal;
  494. #ifdef USE_TANGENT
  495. transformedTangent = im * transformedTangent;
  496. #endif
  497. #endif
  498. transformedNormal = normalMatrix * transformedNormal;
  499. #ifdef FLIP_SIDED
  500. transformedNormal = - transformedNormal;
  501. #endif
  502. #ifdef USE_TANGENT
  503. transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;
  504. #ifdef FLIP_SIDED
  505. transformedTangent = - transformedTangent;
  506. #endif
  507. #endif`,kK=`#ifdef USE_DISPLACEMENTMAP
  508. uniform sampler2D displacementMap;
  509. uniform float displacementScale;
  510. uniform float displacementBias;
  511. #endif`,FK=`#ifdef USE_DISPLACEMENTMAP
  512. transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );
  513. #endif`,zK=`#ifdef USE_EMISSIVEMAP
  514. vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );
  515. #ifdef DECODE_VIDEO_TEXTURE_EMISSIVE
  516. emissiveColor = sRGBTransferEOTF( emissiveColor );
  517. #endif
  518. totalEmissiveRadiance *= emissiveColor.rgb;
  519. #endif`,BK=`#ifdef USE_EMISSIVEMAP
  520. uniform sampler2D emissiveMap;
  521. #endif`,jK="gl_FragColor = linearToOutputTexel( gl_FragColor );",HK=`vec4 LinearTransferOETF( in vec4 value ) {
  522. return value;
  523. }
  524. vec4 sRGBTransferEOTF( in vec4 value ) {
  525. return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a );
  526. }
  527. vec4 sRGBTransferOETF( in vec4 value ) {
  528. 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 );
  529. }`,GK=`#ifdef USE_ENVMAP
  530. #ifdef ENV_WORLDPOS
  531. vec3 cameraToFrag;
  532. if ( isOrthographic ) {
  533. cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
  534. } else {
  535. cameraToFrag = normalize( vWorldPosition - cameraPosition );
  536. }
  537. vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
  538. #ifdef ENVMAP_MODE_REFLECTION
  539. vec3 reflectVec = reflect( cameraToFrag, worldNormal );
  540. #else
  541. vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );
  542. #endif
  543. #else
  544. vec3 reflectVec = vReflect;
  545. #endif
  546. #ifdef ENVMAP_TYPE_CUBE
  547. vec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );
  548. #else
  549. vec4 envColor = vec4( 0.0 );
  550. #endif
  551. #ifdef ENVMAP_BLENDING_MULTIPLY
  552. outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );
  553. #elif defined( ENVMAP_BLENDING_MIX )
  554. outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );
  555. #elif defined( ENVMAP_BLENDING_ADD )
  556. outgoingLight += envColor.xyz * specularStrength * reflectivity;
  557. #endif
  558. #endif`,VK=`#ifdef USE_ENVMAP
  559. uniform float envMapIntensity;
  560. uniform float flipEnvMap;
  561. uniform mat3 envMapRotation;
  562. #ifdef ENVMAP_TYPE_CUBE
  563. uniform samplerCube envMap;
  564. #else
  565. uniform sampler2D envMap;
  566. #endif
  567. #endif`,$K=`#ifdef USE_ENVMAP
  568. uniform float reflectivity;
  569. #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
  570. #define ENV_WORLDPOS
  571. #endif
  572. #ifdef ENV_WORLDPOS
  573. varying vec3 vWorldPosition;
  574. uniform float refractionRatio;
  575. #else
  576. varying vec3 vReflect;
  577. #endif
  578. #endif`,WK=`#ifdef USE_ENVMAP
  579. #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
  580. #define ENV_WORLDPOS
  581. #endif
  582. #ifdef ENV_WORLDPOS
  583. varying vec3 vWorldPosition;
  584. #else
  585. varying vec3 vReflect;
  586. uniform float refractionRatio;
  587. #endif
  588. #endif`,XK=`#ifdef USE_ENVMAP
  589. #ifdef ENV_WORLDPOS
  590. vWorldPosition = worldPosition.xyz;
  591. #else
  592. vec3 cameraToVertex;
  593. if ( isOrthographic ) {
  594. cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
  595. } else {
  596. cameraToVertex = normalize( worldPosition.xyz - cameraPosition );
  597. }
  598. vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
  599. #ifdef ENVMAP_MODE_REFLECTION
  600. vReflect = reflect( cameraToVertex, worldNormal );
  601. #else
  602. vReflect = refract( cameraToVertex, worldNormal, refractionRatio );
  603. #endif
  604. #endif
  605. #endif`,qK=`#ifdef USE_FOG
  606. vFogDepth = - mvPosition.z;
  607. #endif`,YK=`#ifdef USE_FOG
  608. varying float vFogDepth;
  609. #endif`,KK=`#ifdef USE_FOG
  610. #ifdef FOG_EXP2
  611. float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );
  612. #else
  613. float fogFactor = smoothstep( fogNear, fogFar, vFogDepth );
  614. #endif
  615. gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );
  616. #endif`,ZK=`#ifdef USE_FOG
  617. uniform vec3 fogColor;
  618. varying float vFogDepth;
  619. #ifdef FOG_EXP2
  620. uniform float fogDensity;
  621. #else
  622. uniform float fogNear;
  623. uniform float fogFar;
  624. #endif
  625. #endif`,QK=`#ifdef USE_GRADIENTMAP
  626. uniform sampler2D gradientMap;
  627. #endif
  628. vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {
  629. float dotNL = dot( normal, lightDirection );
  630. vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );
  631. #ifdef USE_GRADIENTMAP
  632. return vec3( texture2D( gradientMap, coord ).r );
  633. #else
  634. vec2 fw = fwidth( coord ) * 0.5;
  635. return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );
  636. #endif
  637. }`,JK=`#ifdef USE_LIGHTMAP
  638. uniform sampler2D lightMap;
  639. uniform float lightMapIntensity;
  640. #endif`,eZ=`LambertMaterial material;
  641. material.diffuseColor = diffuseColor.rgb;
  642. material.specularStrength = specularStrength;`,tZ=`varying vec3 vViewPosition;
  643. struct LambertMaterial {
  644. vec3 diffuseColor;
  645. float specularStrength;
  646. };
  647. void RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {
  648. float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
  649. vec3 irradiance = dotNL * directLight.color;
  650. reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
  651. }
  652. void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {
  653. reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
  654. }
  655. #define RE_Direct RE_Direct_Lambert
  656. #define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,nZ=`uniform bool receiveShadow;
  657. uniform vec3 ambientLightColor;
  658. #if defined( USE_LIGHT_PROBES )
  659. uniform vec3 lightProbe[ 9 ];
  660. #endif
  661. vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {
  662. float x = normal.x, y = normal.y, z = normal.z;
  663. vec3 result = shCoefficients[ 0 ] * 0.886227;
  664. result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;
  665. result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;
  666. result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;
  667. result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;
  668. result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;
  669. result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );
  670. result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;
  671. result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );
  672. return result;
  673. }
  674. vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {
  675. vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
  676. vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );
  677. return irradiance;
  678. }
  679. vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {
  680. vec3 irradiance = ambientLightColor;
  681. return irradiance;
  682. }
  683. float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {
  684. float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );
  685. if ( cutoffDistance > 0.0 ) {
  686. distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );
  687. }
  688. return distanceFalloff;
  689. }
  690. float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {
  691. return smoothstep( coneCosine, penumbraCosine, angleCosine );
  692. }
  693. #if NUM_DIR_LIGHTS > 0
  694. struct DirectionalLight {
  695. vec3 direction;
  696. vec3 color;
  697. };
  698. uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];
  699. void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) {
  700. light.color = directionalLight.color;
  701. light.direction = directionalLight.direction;
  702. light.visible = true;
  703. }
  704. #endif
  705. #if NUM_POINT_LIGHTS > 0
  706. struct PointLight {
  707. vec3 position;
  708. vec3 color;
  709. float distance;
  710. float decay;
  711. };
  712. uniform PointLight pointLights[ NUM_POINT_LIGHTS ];
  713. void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) {
  714. vec3 lVector = pointLight.position - geometryPosition;
  715. light.direction = normalize( lVector );
  716. float lightDistance = length( lVector );
  717. light.color = pointLight.color;
  718. light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );
  719. light.visible = ( light.color != vec3( 0.0 ) );
  720. }
  721. #endif
  722. #if NUM_SPOT_LIGHTS > 0
  723. struct SpotLight {
  724. vec3 position;
  725. vec3 direction;
  726. vec3 color;
  727. float distance;
  728. float decay;
  729. float coneCos;
  730. float penumbraCos;
  731. };
  732. uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];
  733. void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) {
  734. vec3 lVector = spotLight.position - geometryPosition;
  735. light.direction = normalize( lVector );
  736. float angleCos = dot( light.direction, spotLight.direction );
  737. float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );
  738. if ( spotAttenuation > 0.0 ) {
  739. float lightDistance = length( lVector );
  740. light.color = spotLight.color * spotAttenuation;
  741. light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );
  742. light.visible = ( light.color != vec3( 0.0 ) );
  743. } else {
  744. light.color = vec3( 0.0 );
  745. light.visible = false;
  746. }
  747. }
  748. #endif
  749. #if NUM_RECT_AREA_LIGHTS > 0
  750. struct RectAreaLight {
  751. vec3 color;
  752. vec3 position;
  753. vec3 halfWidth;
  754. vec3 halfHeight;
  755. };
  756. uniform sampler2D ltc_1; uniform sampler2D ltc_2;
  757. uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];
  758. #endif
  759. #if NUM_HEMI_LIGHTS > 0
  760. struct HemisphereLight {
  761. vec3 direction;
  762. vec3 skyColor;
  763. vec3 groundColor;
  764. };
  765. uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];
  766. vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {
  767. float dotNL = dot( normal, hemiLight.direction );
  768. float hemiDiffuseWeight = 0.5 * dotNL + 0.5;
  769. vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );
  770. return irradiance;
  771. }
  772. #endif`,iZ=`#ifdef USE_ENVMAP
  773. vec3 getIBLIrradiance( const in vec3 normal ) {
  774. #ifdef ENVMAP_TYPE_CUBE_UV
  775. vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
  776. vec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 );
  777. return PI * envMapColor.rgb * envMapIntensity;
  778. #else
  779. return vec3( 0.0 );
  780. #endif
  781. }
  782. vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {
  783. #ifdef ENVMAP_TYPE_CUBE_UV
  784. vec3 reflectVec = reflect( - viewDir, normal );
  785. reflectVec = normalize( mix( reflectVec, normal, pow4( roughness ) ) );
  786. reflectVec = inverseTransformDirection( reflectVec, viewMatrix );
  787. vec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness );
  788. return envMapColor.rgb * envMapIntensity;
  789. #else
  790. return vec3( 0.0 );
  791. #endif
  792. }
  793. #ifdef USE_ANISOTROPY
  794. vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {
  795. #ifdef ENVMAP_TYPE_CUBE_UV
  796. vec3 bentNormal = cross( bitangent, viewDir );
  797. bentNormal = normalize( cross( bentNormal, bitangent ) );
  798. bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );
  799. return getIBLRadiance( viewDir, bentNormal, roughness );
  800. #else
  801. return vec3( 0.0 );
  802. #endif
  803. }
  804. #endif
  805. #endif`,rZ=`ToonMaterial material;
  806. material.diffuseColor = diffuseColor.rgb;`,aZ=`varying vec3 vViewPosition;
  807. struct ToonMaterial {
  808. vec3 diffuseColor;
  809. };
  810. void RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {
  811. vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color;
  812. reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
  813. }
  814. void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {
  815. reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
  816. }
  817. #define RE_Direct RE_Direct_Toon
  818. #define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,sZ=`BlinnPhongMaterial material;
  819. material.diffuseColor = diffuseColor.rgb;
  820. material.specularColor = specular;
  821. material.specularShininess = shininess;
  822. material.specularStrength = specularStrength;`,oZ=`varying vec3 vViewPosition;
  823. struct BlinnPhongMaterial {
  824. vec3 diffuseColor;
  825. vec3 specularColor;
  826. float specularShininess;
  827. float specularStrength;
  828. };
  829. void RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {
  830. float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
  831. vec3 irradiance = dotNL * directLight.color;
  832. reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
  833. reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength;
  834. }
  835. void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {
  836. reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
  837. }
  838. #define RE_Direct RE_Direct_BlinnPhong
  839. #define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,lZ=`PhysicalMaterial material;
  840. material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );
  841. vec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );
  842. float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );
  843. material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;
  844. material.roughness = min( material.roughness, 1.0 );
  845. #ifdef IOR
  846. material.ior = ior;
  847. #ifdef USE_SPECULAR
  848. float specularIntensityFactor = specularIntensity;
  849. vec3 specularColorFactor = specularColor;
  850. #ifdef USE_SPECULAR_COLORMAP
  851. specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;
  852. #endif
  853. #ifdef USE_SPECULAR_INTENSITYMAP
  854. specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;
  855. #endif
  856. material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );
  857. #else
  858. float specularIntensityFactor = 1.0;
  859. vec3 specularColorFactor = vec3( 1.0 );
  860. material.specularF90 = 1.0;
  861. #endif
  862. material.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );
  863. #else
  864. material.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );
  865. material.specularF90 = 1.0;
  866. #endif
  867. #ifdef USE_CLEARCOAT
  868. material.clearcoat = clearcoat;
  869. material.clearcoatRoughness = clearcoatRoughness;
  870. material.clearcoatF0 = vec3( 0.04 );
  871. material.clearcoatF90 = 1.0;
  872. #ifdef USE_CLEARCOATMAP
  873. material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;
  874. #endif
  875. #ifdef USE_CLEARCOAT_ROUGHNESSMAP
  876. material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;
  877. #endif
  878. material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );
  879. material.clearcoatRoughness += geometryRoughness;
  880. material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );
  881. #endif
  882. #ifdef USE_DISPERSION
  883. material.dispersion = dispersion;
  884. #endif
  885. #ifdef USE_IRIDESCENCE
  886. material.iridescence = iridescence;
  887. material.iridescenceIOR = iridescenceIOR;
  888. #ifdef USE_IRIDESCENCEMAP
  889. material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;
  890. #endif
  891. #ifdef USE_IRIDESCENCE_THICKNESSMAP
  892. material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;
  893. #else
  894. material.iridescenceThickness = iridescenceThicknessMaximum;
  895. #endif
  896. #endif
  897. #ifdef USE_SHEEN
  898. material.sheenColor = sheenColor;
  899. #ifdef USE_SHEEN_COLORMAP
  900. material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;
  901. #endif
  902. material.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );
  903. #ifdef USE_SHEEN_ROUGHNESSMAP
  904. material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;
  905. #endif
  906. #endif
  907. #ifdef USE_ANISOTROPY
  908. #ifdef USE_ANISOTROPYMAP
  909. mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );
  910. vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;
  911. vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;
  912. #else
  913. vec2 anisotropyV = anisotropyVector;
  914. #endif
  915. material.anisotropy = length( anisotropyV );
  916. if( material.anisotropy == 0.0 ) {
  917. anisotropyV = vec2( 1.0, 0.0 );
  918. } else {
  919. anisotropyV /= material.anisotropy;
  920. material.anisotropy = saturate( material.anisotropy );
  921. }
  922. material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );
  923. material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;
  924. material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;
  925. #endif`,cZ=`uniform sampler2D dfgLUT;
  926. struct PhysicalMaterial {
  927. vec3 diffuseColor;
  928. float roughness;
  929. vec3 specularColor;
  930. float specularF90;
  931. float dispersion;
  932. #ifdef USE_CLEARCOAT
  933. float clearcoat;
  934. float clearcoatRoughness;
  935. vec3 clearcoatF0;
  936. float clearcoatF90;
  937. #endif
  938. #ifdef USE_IRIDESCENCE
  939. float iridescence;
  940. float iridescenceIOR;
  941. float iridescenceThickness;
  942. vec3 iridescenceFresnel;
  943. vec3 iridescenceF0;
  944. #endif
  945. #ifdef USE_SHEEN
  946. vec3 sheenColor;
  947. float sheenRoughness;
  948. #endif
  949. #ifdef IOR
  950. float ior;
  951. #endif
  952. #ifdef USE_TRANSMISSION
  953. float transmission;
  954. float transmissionAlpha;
  955. float thickness;
  956. float attenuationDistance;
  957. vec3 attenuationColor;
  958. #endif
  959. #ifdef USE_ANISOTROPY
  960. float anisotropy;
  961. float alphaT;
  962. vec3 anisotropyT;
  963. vec3 anisotropyB;
  964. #endif
  965. };
  966. vec3 clearcoatSpecularDirect = vec3( 0.0 );
  967. vec3 clearcoatSpecularIndirect = vec3( 0.0 );
  968. vec3 sheenSpecularDirect = vec3( 0.0 );
  969. vec3 sheenSpecularIndirect = vec3(0.0 );
  970. vec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {
  971. float x = clamp( 1.0 - dotVH, 0.0, 1.0 );
  972. float x2 = x * x;
  973. float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );
  974. return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );
  975. }
  976. float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {
  977. float a2 = pow2( alpha );
  978. float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );
  979. float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );
  980. return 0.5 / max( gv + gl, EPSILON );
  981. }
  982. float D_GGX( const in float alpha, const in float dotNH ) {
  983. float a2 = pow2( alpha );
  984. float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;
  985. return RECIPROCAL_PI * a2 / pow2( denom );
  986. }
  987. #ifdef USE_ANISOTROPY
  988. float V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) {
  989. float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );
  990. float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );
  991. float v = 0.5 / ( gv + gl );
  992. return saturate(v);
  993. }
  994. float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {
  995. float a2 = alphaT * alphaB;
  996. highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );
  997. highp float v2 = dot( v, v );
  998. float w2 = a2 / v2;
  999. return RECIPROCAL_PI * a2 * pow2 ( w2 );
  1000. }
  1001. #endif
  1002. #ifdef USE_CLEARCOAT
  1003. vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {
  1004. vec3 f0 = material.clearcoatF0;
  1005. float f90 = material.clearcoatF90;
  1006. float roughness = material.clearcoatRoughness;
  1007. float alpha = pow2( roughness );
  1008. vec3 halfDir = normalize( lightDir + viewDir );
  1009. float dotNL = saturate( dot( normal, lightDir ) );
  1010. float dotNV = saturate( dot( normal, viewDir ) );
  1011. float dotNH = saturate( dot( normal, halfDir ) );
  1012. float dotVH = saturate( dot( viewDir, halfDir ) );
  1013. vec3 F = F_Schlick( f0, f90, dotVH );
  1014. float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );
  1015. float D = D_GGX( alpha, dotNH );
  1016. return F * ( V * D );
  1017. }
  1018. #endif
  1019. vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {
  1020. vec3 f0 = material.specularColor;
  1021. float f90 = material.specularF90;
  1022. float roughness = material.roughness;
  1023. float alpha = pow2( roughness );
  1024. vec3 halfDir = normalize( lightDir + viewDir );
  1025. float dotNL = saturate( dot( normal, lightDir ) );
  1026. float dotNV = saturate( dot( normal, viewDir ) );
  1027. float dotNH = saturate( dot( normal, halfDir ) );
  1028. float dotVH = saturate( dot( viewDir, halfDir ) );
  1029. vec3 F = F_Schlick( f0, f90, dotVH );
  1030. #ifdef USE_IRIDESCENCE
  1031. F = mix( F, material.iridescenceFresnel, material.iridescence );
  1032. #endif
  1033. #ifdef USE_ANISOTROPY
  1034. float dotTL = dot( material.anisotropyT, lightDir );
  1035. float dotTV = dot( material.anisotropyT, viewDir );
  1036. float dotTH = dot( material.anisotropyT, halfDir );
  1037. float dotBL = dot( material.anisotropyB, lightDir );
  1038. float dotBV = dot( material.anisotropyB, viewDir );
  1039. float dotBH = dot( material.anisotropyB, halfDir );
  1040. float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );
  1041. float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );
  1042. #else
  1043. float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );
  1044. float D = D_GGX( alpha, dotNH );
  1045. #endif
  1046. return F * ( V * D );
  1047. }
  1048. vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {
  1049. const float LUT_SIZE = 64.0;
  1050. const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;
  1051. const float LUT_BIAS = 0.5 / LUT_SIZE;
  1052. float dotNV = saturate( dot( N, V ) );
  1053. vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );
  1054. uv = uv * LUT_SCALE + LUT_BIAS;
  1055. return uv;
  1056. }
  1057. float LTC_ClippedSphereFormFactor( const in vec3 f ) {
  1058. float l = length( f );
  1059. return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );
  1060. }
  1061. vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {
  1062. float x = dot( v1, v2 );
  1063. float y = abs( x );
  1064. float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;
  1065. float b = 3.4175940 + ( 4.1616724 + y ) * y;
  1066. float v = a / b;
  1067. float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;
  1068. return cross( v1, v2 ) * theta_sintheta;
  1069. }
  1070. vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {
  1071. vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];
  1072. vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];
  1073. vec3 lightNormal = cross( v1, v2 );
  1074. if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );
  1075. vec3 T1, T2;
  1076. T1 = normalize( V - N * dot( V, N ) );
  1077. T2 = - cross( N, T1 );
  1078. mat3 mat = mInv * transpose( mat3( T1, T2, N ) );
  1079. vec3 coords[ 4 ];
  1080. coords[ 0 ] = mat * ( rectCoords[ 0 ] - P );
  1081. coords[ 1 ] = mat * ( rectCoords[ 1 ] - P );
  1082. coords[ 2 ] = mat * ( rectCoords[ 2 ] - P );
  1083. coords[ 3 ] = mat * ( rectCoords[ 3 ] - P );
  1084. coords[ 0 ] = normalize( coords[ 0 ] );
  1085. coords[ 1 ] = normalize( coords[ 1 ] );
  1086. coords[ 2 ] = normalize( coords[ 2 ] );
  1087. coords[ 3 ] = normalize( coords[ 3 ] );
  1088. vec3 vectorFormFactor = vec3( 0.0 );
  1089. vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );
  1090. vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );
  1091. vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );
  1092. vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );
  1093. float result = LTC_ClippedSphereFormFactor( vectorFormFactor );
  1094. return vec3( result );
  1095. }
  1096. #if defined( USE_SHEEN )
  1097. float D_Charlie( float roughness, float dotNH ) {
  1098. float alpha = pow2( roughness );
  1099. float invAlpha = 1.0 / alpha;
  1100. float cos2h = dotNH * dotNH;
  1101. float sin2h = max( 1.0 - cos2h, 0.0078125 );
  1102. return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );
  1103. }
  1104. float V_Neubelt( float dotNV, float dotNL ) {
  1105. return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );
  1106. }
  1107. vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {
  1108. vec3 halfDir = normalize( lightDir + viewDir );
  1109. float dotNL = saturate( dot( normal, lightDir ) );
  1110. float dotNV = saturate( dot( normal, viewDir ) );
  1111. float dotNH = saturate( dot( normal, halfDir ) );
  1112. float D = D_Charlie( sheenRoughness, dotNH );
  1113. float V = V_Neubelt( dotNV, dotNL );
  1114. return sheenColor * ( D * V );
  1115. }
  1116. #endif
  1117. float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {
  1118. float dotNV = saturate( dot( normal, viewDir ) );
  1119. float r2 = roughness * roughness;
  1120. float a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;
  1121. float b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;
  1122. float DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );
  1123. return saturate( DG * RECIPROCAL_PI );
  1124. }
  1125. vec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {
  1126. float dotNV = saturate( dot( normal, viewDir ) );
  1127. vec2 uv = vec2( roughness, dotNV );
  1128. return texture2D( dfgLUT, uv ).rg;
  1129. }
  1130. vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {
  1131. vec2 fab = DFGApprox( normal, viewDir, roughness );
  1132. return specularColor * fab.x + specularF90 * fab.y;
  1133. }
  1134. #ifdef USE_IRIDESCENCE
  1135. 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 ) {
  1136. #else
  1137. 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 ) {
  1138. #endif
  1139. vec2 fab = DFGApprox( normal, viewDir, roughness );
  1140. #ifdef USE_IRIDESCENCE
  1141. vec3 Fr = mix( specularColor, iridescenceF0, iridescence );
  1142. #else
  1143. vec3 Fr = specularColor;
  1144. #endif
  1145. vec3 FssEss = Fr * fab.x + specularF90 * fab.y;
  1146. float Ess = fab.x + fab.y;
  1147. float Ems = 1.0 - Ess;
  1148. vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );
  1149. singleScatter += FssEss;
  1150. multiScatter += Fms * Ems;
  1151. }
  1152. vec3 BRDF_GGX_Multiscatter( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {
  1153. vec3 singleScatter = BRDF_GGX( lightDir, viewDir, normal, material );
  1154. float dotNL = saturate( dot( normal, lightDir ) );
  1155. float dotNV = saturate( dot( normal, viewDir ) );
  1156. vec2 dfgV = DFGApprox( vec3(0.0, 0.0, 1.0), vec3(sqrt(1.0 - dotNV * dotNV), 0.0, dotNV), material.roughness );
  1157. vec2 dfgL = DFGApprox( vec3(0.0, 0.0, 1.0), vec3(sqrt(1.0 - dotNL * dotNL), 0.0, dotNL), material.roughness );
  1158. vec3 FssEss_V = material.specularColor * dfgV.x + material.specularF90 * dfgV.y;
  1159. vec3 FssEss_L = material.specularColor * dfgL.x + material.specularF90 * dfgL.y;
  1160. float Ess_V = dfgV.x + dfgV.y;
  1161. float Ess_L = dfgL.x + dfgL.y;
  1162. float Ems_V = 1.0 - Ess_V;
  1163. float Ems_L = 1.0 - Ess_L;
  1164. vec3 Favg = material.specularColor + ( 1.0 - material.specularColor ) * 0.047619;
  1165. vec3 Fms = FssEss_V * FssEss_L * Favg / ( 1.0 - Ems_V * Ems_L * Favg * Favg + EPSILON );
  1166. float compensationFactor = Ems_V * Ems_L;
  1167. vec3 multiScatter = Fms * compensationFactor;
  1168. return singleScatter + multiScatter;
  1169. }
  1170. #if NUM_RECT_AREA_LIGHTS > 0
  1171. void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
  1172. vec3 normal = geometryNormal;
  1173. vec3 viewDir = geometryViewDir;
  1174. vec3 position = geometryPosition;
  1175. vec3 lightPos = rectAreaLight.position;
  1176. vec3 halfWidth = rectAreaLight.halfWidth;
  1177. vec3 halfHeight = rectAreaLight.halfHeight;
  1178. vec3 lightColor = rectAreaLight.color;
  1179. float roughness = material.roughness;
  1180. vec3 rectCoords[ 4 ];
  1181. rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight;
  1182. rectCoords[ 2 ] = lightPos - halfWidth + halfHeight;
  1183. rectCoords[ 3 ] = lightPos + halfWidth + halfHeight;
  1184. vec2 uv = LTC_Uv( normal, viewDir, roughness );
  1185. vec4 t1 = texture2D( ltc_1, uv );
  1186. vec4 t2 = texture2D( ltc_2, uv );
  1187. mat3 mInv = mat3(
  1188. vec3( t1.x, 0, t1.y ),
  1189. vec3( 0, 1, 0 ),
  1190. vec3( t1.z, 0, t1.w )
  1191. );
  1192. vec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );
  1193. reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );
  1194. reflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );
  1195. }
  1196. #endif
  1197. void RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
  1198. float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
  1199. vec3 irradiance = dotNL * directLight.color;
  1200. #ifdef USE_CLEARCOAT
  1201. float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );
  1202. vec3 ccIrradiance = dotNLcc * directLight.color;
  1203. clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );
  1204. #endif
  1205. #ifdef USE_SHEEN
  1206. sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );
  1207. #endif
  1208. reflectedLight.directSpecular += irradiance * BRDF_GGX_Multiscatter( directLight.direction, geometryViewDir, geometryNormal, material );
  1209. reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
  1210. }
  1211. void RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
  1212. reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
  1213. }
  1214. void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {
  1215. #ifdef USE_CLEARCOAT
  1216. clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );
  1217. #endif
  1218. #ifdef USE_SHEEN
  1219. sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );
  1220. #endif
  1221. vec3 singleScattering = vec3( 0.0 );
  1222. vec3 multiScattering = vec3( 0.0 );
  1223. vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;
  1224. #ifdef USE_IRIDESCENCE
  1225. computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );
  1226. #else
  1227. computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );
  1228. #endif
  1229. vec3 totalScattering = singleScattering + multiScattering;
  1230. vec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );
  1231. reflectedLight.indirectSpecular += radiance * singleScattering;
  1232. reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;
  1233. reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;
  1234. }
  1235. #define RE_Direct RE_Direct_Physical
  1236. #define RE_Direct_RectArea RE_Direct_RectArea_Physical
  1237. #define RE_IndirectDiffuse RE_IndirectDiffuse_Physical
  1238. #define RE_IndirectSpecular RE_IndirectSpecular_Physical
  1239. float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {
  1240. return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );
  1241. }`,uZ=`
  1242. vec3 geometryPosition = - vViewPosition;
  1243. vec3 geometryNormal = normal;
  1244. vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );
  1245. vec3 geometryClearcoatNormal = vec3( 0.0 );
  1246. #ifdef USE_CLEARCOAT
  1247. geometryClearcoatNormal = clearcoatNormal;
  1248. #endif
  1249. #ifdef USE_IRIDESCENCE
  1250. float dotNVi = saturate( dot( normal, geometryViewDir ) );
  1251. if ( material.iridescenceThickness == 0.0 ) {
  1252. material.iridescence = 0.0;
  1253. } else {
  1254. material.iridescence = saturate( material.iridescence );
  1255. }
  1256. if ( material.iridescence > 0.0 ) {
  1257. material.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );
  1258. material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );
  1259. }
  1260. #endif
  1261. IncidentLight directLight;
  1262. #if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )
  1263. PointLight pointLight;
  1264. #if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0
  1265. PointLightShadow pointLightShadow;
  1266. #endif
  1267. #pragma unroll_loop_start
  1268. for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {
  1269. pointLight = pointLights[ i ];
  1270. getPointLightInfo( pointLight, geometryPosition, directLight );
  1271. #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )
  1272. pointLightShadow = pointLightShadows[ i ];
  1273. directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;
  1274. #endif
  1275. RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
  1276. }
  1277. #pragma unroll_loop_end
  1278. #endif
  1279. #if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )
  1280. SpotLight spotLight;
  1281. vec4 spotColor;
  1282. vec3 spotLightCoord;
  1283. bool inSpotLightMap;
  1284. #if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0
  1285. SpotLightShadow spotLightShadow;
  1286. #endif
  1287. #pragma unroll_loop_start
  1288. for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {
  1289. spotLight = spotLights[ i ];
  1290. getSpotLightInfo( spotLight, geometryPosition, directLight );
  1291. #if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )
  1292. #define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX
  1293. #elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
  1294. #define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS
  1295. #else
  1296. #define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )
  1297. #endif
  1298. #if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )
  1299. spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;
  1300. inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );
  1301. spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );
  1302. directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;
  1303. #endif
  1304. #undef SPOT_LIGHT_MAP_INDEX
  1305. #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
  1306. spotLightShadow = spotLightShadows[ i ];
  1307. directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
  1308. #endif
  1309. RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
  1310. }
  1311. #pragma unroll_loop_end
  1312. #endif
  1313. #if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )
  1314. DirectionalLight directionalLight;
  1315. #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0
  1316. DirectionalLightShadow directionalLightShadow;
  1317. #endif
  1318. #pragma unroll_loop_start
  1319. for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {
  1320. directionalLight = directionalLights[ i ];
  1321. getDirectionalLightInfo( directionalLight, directLight );
  1322. #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )
  1323. directionalLightShadow = directionalLightShadows[ i ];
  1324. directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
  1325. #endif
  1326. RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
  1327. }
  1328. #pragma unroll_loop_end
  1329. #endif
  1330. #if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )
  1331. RectAreaLight rectAreaLight;
  1332. #pragma unroll_loop_start
  1333. for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {
  1334. rectAreaLight = rectAreaLights[ i ];
  1335. RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
  1336. }
  1337. #pragma unroll_loop_end
  1338. #endif
  1339. #if defined( RE_IndirectDiffuse )
  1340. vec3 iblIrradiance = vec3( 0.0 );
  1341. vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );
  1342. #if defined( USE_LIGHT_PROBES )
  1343. irradiance += getLightProbeIrradiance( lightProbe, geometryNormal );
  1344. #endif
  1345. #if ( NUM_HEMI_LIGHTS > 0 )
  1346. #pragma unroll_loop_start
  1347. for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {
  1348. irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );
  1349. }
  1350. #pragma unroll_loop_end
  1351. #endif
  1352. #endif
  1353. #if defined( RE_IndirectSpecular )
  1354. vec3 radiance = vec3( 0.0 );
  1355. vec3 clearcoatRadiance = vec3( 0.0 );
  1356. #endif`,dZ=`#if defined( RE_IndirectDiffuse )
  1357. #ifdef USE_LIGHTMAP
  1358. vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
  1359. vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;
  1360. irradiance += lightMapIrradiance;
  1361. #endif
  1362. #if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )
  1363. iblIrradiance += getIBLIrradiance( geometryNormal );
  1364. #endif
  1365. #endif
  1366. #if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )
  1367. #ifdef USE_ANISOTROPY
  1368. radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );
  1369. #else
  1370. radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );
  1371. #endif
  1372. #ifdef USE_CLEARCOAT
  1373. clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );
  1374. #endif
  1375. #endif`,fZ=`#if defined( RE_IndirectDiffuse )
  1376. RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
  1377. #endif
  1378. #if defined( RE_IndirectSpecular )
  1379. RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
  1380. #endif`,hZ=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )
  1381. gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;
  1382. #endif`,pZ=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )
  1383. uniform float logDepthBufFC;
  1384. varying float vFragDepth;
  1385. varying float vIsPerspective;
  1386. #endif`,mZ=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER
  1387. varying float vFragDepth;
  1388. varying float vIsPerspective;
  1389. #endif`,gZ=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER
  1390. vFragDepth = 1.0 + gl_Position.w;
  1391. vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );
  1392. #endif`,vZ=`#ifdef USE_MAP
  1393. vec4 sampledDiffuseColor = texture2D( map, vMapUv );
  1394. #ifdef DECODE_VIDEO_TEXTURE
  1395. sampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor );
  1396. #endif
  1397. diffuseColor *= sampledDiffuseColor;
  1398. #endif`,xZ=`#ifdef USE_MAP
  1399. uniform sampler2D map;
  1400. #endif`,yZ=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
  1401. #if defined( USE_POINTS_UV )
  1402. vec2 uv = vUv;
  1403. #else
  1404. vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;
  1405. #endif
  1406. #endif
  1407. #ifdef USE_MAP
  1408. diffuseColor *= texture2D( map, uv );
  1409. #endif
  1410. #ifdef USE_ALPHAMAP
  1411. diffuseColor.a *= texture2D( alphaMap, uv ).g;
  1412. #endif`,bZ=`#if defined( USE_POINTS_UV )
  1413. varying vec2 vUv;
  1414. #else
  1415. #if defined( USE_MAP ) || defined( USE_ALPHAMAP )
  1416. uniform mat3 uvTransform;
  1417. #endif
  1418. #endif
  1419. #ifdef USE_MAP
  1420. uniform sampler2D map;
  1421. #endif
  1422. #ifdef USE_ALPHAMAP
  1423. uniform sampler2D alphaMap;
  1424. #endif`,_Z=`float metalnessFactor = metalness;
  1425. #ifdef USE_METALNESSMAP
  1426. vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );
  1427. metalnessFactor *= texelMetalness.b;
  1428. #endif`,SZ=`#ifdef USE_METALNESSMAP
  1429. uniform sampler2D metalnessMap;
  1430. #endif`,wZ=`#ifdef USE_INSTANCING_MORPH
  1431. float morphTargetInfluences[ MORPHTARGETS_COUNT ];
  1432. float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;
  1433. for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
  1434. morphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;
  1435. }
  1436. #endif`,EZ=`#if defined( USE_MORPHCOLORS )
  1437. vColor *= morphTargetBaseInfluence;
  1438. for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
  1439. #if defined( USE_COLOR_ALPHA )
  1440. if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];
  1441. #elif defined( USE_COLOR )
  1442. if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];
  1443. #endif
  1444. }
  1445. #endif`,MZ=`#ifdef USE_MORPHNORMALS
  1446. objectNormal *= morphTargetBaseInfluence;
  1447. for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
  1448. if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];
  1449. }
  1450. #endif`,AZ=`#ifdef USE_MORPHTARGETS
  1451. #ifndef USE_INSTANCING_MORPH
  1452. uniform float morphTargetBaseInfluence;
  1453. uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];
  1454. #endif
  1455. uniform sampler2DArray morphTargetsTexture;
  1456. uniform ivec2 morphTargetsTextureSize;
  1457. vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {
  1458. int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;
  1459. int y = texelIndex / morphTargetsTextureSize.x;
  1460. int x = texelIndex - y * morphTargetsTextureSize.x;
  1461. ivec3 morphUV = ivec3( x, y, morphTargetIndex );
  1462. return texelFetch( morphTargetsTexture, morphUV, 0 );
  1463. }
  1464. #endif`,TZ=`#ifdef USE_MORPHTARGETS
  1465. transformed *= morphTargetBaseInfluence;
  1466. for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
  1467. if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];
  1468. }
  1469. #endif`,CZ=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;
  1470. #ifdef FLAT_SHADED
  1471. vec3 fdx = dFdx( vViewPosition );
  1472. vec3 fdy = dFdy( vViewPosition );
  1473. vec3 normal = normalize( cross( fdx, fdy ) );
  1474. #else
  1475. vec3 normal = normalize( vNormal );
  1476. #ifdef DOUBLE_SIDED
  1477. normal *= faceDirection;
  1478. #endif
  1479. #endif
  1480. #if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )
  1481. #ifdef USE_TANGENT
  1482. mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );
  1483. #else
  1484. mat3 tbn = getTangentFrame( - vViewPosition, normal,
  1485. #if defined( USE_NORMALMAP )
  1486. vNormalMapUv
  1487. #elif defined( USE_CLEARCOAT_NORMALMAP )
  1488. vClearcoatNormalMapUv
  1489. #else
  1490. vUv
  1491. #endif
  1492. );
  1493. #endif
  1494. #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )
  1495. tbn[0] *= faceDirection;
  1496. tbn[1] *= faceDirection;
  1497. #endif
  1498. #endif
  1499. #ifdef USE_CLEARCOAT_NORMALMAP
  1500. #ifdef USE_TANGENT
  1501. mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );
  1502. #else
  1503. mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );
  1504. #endif
  1505. #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )
  1506. tbn2[0] *= faceDirection;
  1507. tbn2[1] *= faceDirection;
  1508. #endif
  1509. #endif
  1510. vec3 nonPerturbedNormal = normal;`,RZ=`#ifdef USE_NORMALMAP_OBJECTSPACE
  1511. normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;
  1512. #ifdef FLIP_SIDED
  1513. normal = - normal;
  1514. #endif
  1515. #ifdef DOUBLE_SIDED
  1516. normal = normal * faceDirection;
  1517. #endif
  1518. normal = normalize( normalMatrix * normal );
  1519. #elif defined( USE_NORMALMAP_TANGENTSPACE )
  1520. vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;
  1521. mapN.xy *= normalScale;
  1522. normal = normalize( tbn * mapN );
  1523. #elif defined( USE_BUMPMAP )
  1524. normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );
  1525. #endif`,PZ=`#ifndef FLAT_SHADED
  1526. varying vec3 vNormal;
  1527. #ifdef USE_TANGENT
  1528. varying vec3 vTangent;
  1529. varying vec3 vBitangent;
  1530. #endif
  1531. #endif`,DZ=`#ifndef FLAT_SHADED
  1532. varying vec3 vNormal;
  1533. #ifdef USE_TANGENT
  1534. varying vec3 vTangent;
  1535. varying vec3 vBitangent;
  1536. #endif
  1537. #endif`,NZ=`#ifndef FLAT_SHADED
  1538. vNormal = normalize( transformedNormal );
  1539. #ifdef USE_TANGENT
  1540. vTangent = normalize( transformedTangent );
  1541. vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );
  1542. #endif
  1543. #endif`,OZ=`#ifdef USE_NORMALMAP
  1544. uniform sampler2D normalMap;
  1545. uniform vec2 normalScale;
  1546. #endif
  1547. #ifdef USE_NORMALMAP_OBJECTSPACE
  1548. uniform mat3 normalMatrix;
  1549. #endif
  1550. #if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )
  1551. mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {
  1552. vec3 q0 = dFdx( eye_pos.xyz );
  1553. vec3 q1 = dFdy( eye_pos.xyz );
  1554. vec2 st0 = dFdx( uv.st );
  1555. vec2 st1 = dFdy( uv.st );
  1556. vec3 N = surf_norm;
  1557. vec3 q1perp = cross( q1, N );
  1558. vec3 q0perp = cross( N, q0 );
  1559. vec3 T = q1perp * st0.x + q0perp * st1.x;
  1560. vec3 B = q1perp * st0.y + q0perp * st1.y;
  1561. float det = max( dot( T, T ), dot( B, B ) );
  1562. float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );
  1563. return mat3( T * scale, B * scale, N );
  1564. }
  1565. #endif`,LZ=`#ifdef USE_CLEARCOAT
  1566. vec3 clearcoatNormal = nonPerturbedNormal;
  1567. #endif`,IZ=`#ifdef USE_CLEARCOAT_NORMALMAP
  1568. vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;
  1569. clearcoatMapN.xy *= clearcoatNormalScale;
  1570. clearcoatNormal = normalize( tbn2 * clearcoatMapN );
  1571. #endif`,UZ=`#ifdef USE_CLEARCOATMAP
  1572. uniform sampler2D clearcoatMap;
  1573. #endif
  1574. #ifdef USE_CLEARCOAT_NORMALMAP
  1575. uniform sampler2D clearcoatNormalMap;
  1576. uniform vec2 clearcoatNormalScale;
  1577. #endif
  1578. #ifdef USE_CLEARCOAT_ROUGHNESSMAP
  1579. uniform sampler2D clearcoatRoughnessMap;
  1580. #endif`,kZ=`#ifdef USE_IRIDESCENCEMAP
  1581. uniform sampler2D iridescenceMap;
  1582. #endif
  1583. #ifdef USE_IRIDESCENCE_THICKNESSMAP
  1584. uniform sampler2D iridescenceThicknessMap;
  1585. #endif`,FZ=`#ifdef OPAQUE
  1586. diffuseColor.a = 1.0;
  1587. #endif
  1588. #ifdef USE_TRANSMISSION
  1589. diffuseColor.a *= material.transmissionAlpha;
  1590. #endif
  1591. gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,zZ=`vec3 packNormalToRGB( const in vec3 normal ) {
  1592. return normalize( normal ) * 0.5 + 0.5;
  1593. }
  1594. vec3 unpackRGBToNormal( const in vec3 rgb ) {
  1595. return 2.0 * rgb.xyz - 1.0;
  1596. }
  1597. const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;const float ShiftRight8 = 1. / 256.;
  1598. const float Inv255 = 1. / 255.;
  1599. const vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 );
  1600. const vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g );
  1601. const vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b );
  1602. const vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a );
  1603. vec4 packDepthToRGBA( const in float v ) {
  1604. if( v <= 0.0 )
  1605. return vec4( 0., 0., 0., 0. );
  1606. if( v >= 1.0 )
  1607. return vec4( 1., 1., 1., 1. );
  1608. float vuf;
  1609. float af = modf( v * PackFactors.a, vuf );
  1610. float bf = modf( vuf * ShiftRight8, vuf );
  1611. float gf = modf( vuf * ShiftRight8, vuf );
  1612. return vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af );
  1613. }
  1614. vec3 packDepthToRGB( const in float v ) {
  1615. if( v <= 0.0 )
  1616. return vec3( 0., 0., 0. );
  1617. if( v >= 1.0 )
  1618. return vec3( 1., 1., 1. );
  1619. float vuf;
  1620. float bf = modf( v * PackFactors.b, vuf );
  1621. float gf = modf( vuf * ShiftRight8, vuf );
  1622. return vec3( vuf * Inv255, gf * PackUpscale, bf );
  1623. }
  1624. vec2 packDepthToRG( const in float v ) {
  1625. if( v <= 0.0 )
  1626. return vec2( 0., 0. );
  1627. if( v >= 1.0 )
  1628. return vec2( 1., 1. );
  1629. float vuf;
  1630. float gf = modf( v * 256., vuf );
  1631. return vec2( vuf * Inv255, gf );
  1632. }
  1633. float unpackRGBAToDepth( const in vec4 v ) {
  1634. return dot( v, UnpackFactors4 );
  1635. }
  1636. float unpackRGBToDepth( const in vec3 v ) {
  1637. return dot( v, UnpackFactors3 );
  1638. }
  1639. float unpackRGToDepth( const in vec2 v ) {
  1640. return v.r * UnpackFactors2.r + v.g * UnpackFactors2.g;
  1641. }
  1642. vec4 pack2HalfToRGBA( const in vec2 v ) {
  1643. vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );
  1644. return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );
  1645. }
  1646. vec2 unpackRGBATo2Half( const in vec4 v ) {
  1647. return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );
  1648. }
  1649. float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {
  1650. return ( viewZ + near ) / ( near - far );
  1651. }
  1652. float orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) {
  1653. return depth * ( near - far ) - near;
  1654. }
  1655. float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {
  1656. return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );
  1657. }
  1658. float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {
  1659. return ( near * far ) / ( ( far - near ) * depth - far );
  1660. }`,BZ=`#ifdef PREMULTIPLIED_ALPHA
  1661. gl_FragColor.rgb *= gl_FragColor.a;
  1662. #endif`,jZ=`vec4 mvPosition = vec4( transformed, 1.0 );
  1663. #ifdef USE_BATCHING
  1664. mvPosition = batchingMatrix * mvPosition;
  1665. #endif
  1666. #ifdef USE_INSTANCING
  1667. mvPosition = instanceMatrix * mvPosition;
  1668. #endif
  1669. mvPosition = modelViewMatrix * mvPosition;
  1670. gl_Position = projectionMatrix * mvPosition;`,HZ=`#ifdef DITHERING
  1671. gl_FragColor.rgb = dithering( gl_FragColor.rgb );
  1672. #endif`,GZ=`#ifdef DITHERING
  1673. vec3 dithering( vec3 color ) {
  1674. float grid_position = rand( gl_FragCoord.xy );
  1675. vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );
  1676. dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );
  1677. return color + dither_shift_RGB;
  1678. }
  1679. #endif`,VZ=`float roughnessFactor = roughness;
  1680. #ifdef USE_ROUGHNESSMAP
  1681. vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );
  1682. roughnessFactor *= texelRoughness.g;
  1683. #endif`,$Z=`#ifdef USE_ROUGHNESSMAP
  1684. uniform sampler2D roughnessMap;
  1685. #endif`,WZ=`#if NUM_SPOT_LIGHT_COORDS > 0
  1686. varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
  1687. #endif
  1688. #if NUM_SPOT_LIGHT_MAPS > 0
  1689. uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];
  1690. #endif
  1691. #ifdef USE_SHADOWMAP
  1692. #if NUM_DIR_LIGHT_SHADOWS > 0
  1693. uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];
  1694. varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
  1695. struct DirectionalLightShadow {
  1696. float shadowIntensity;
  1697. float shadowBias;
  1698. float shadowNormalBias;
  1699. float shadowRadius;
  1700. vec2 shadowMapSize;
  1701. };
  1702. uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
  1703. #endif
  1704. #if NUM_SPOT_LIGHT_SHADOWS > 0
  1705. uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];
  1706. struct SpotLightShadow {
  1707. float shadowIntensity;
  1708. float shadowBias;
  1709. float shadowNormalBias;
  1710. float shadowRadius;
  1711. vec2 shadowMapSize;
  1712. };
  1713. uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
  1714. #endif
  1715. #if NUM_POINT_LIGHT_SHADOWS > 0
  1716. uniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];
  1717. varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
  1718. struct PointLightShadow {
  1719. float shadowIntensity;
  1720. float shadowBias;
  1721. float shadowNormalBias;
  1722. float shadowRadius;
  1723. vec2 shadowMapSize;
  1724. float shadowCameraNear;
  1725. float shadowCameraFar;
  1726. };
  1727. uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
  1728. #endif
  1729. float texture2DCompare( sampler2D depths, vec2 uv, float compare ) {
  1730. float depth = unpackRGBAToDepth( texture2D( depths, uv ) );
  1731. #ifdef USE_REVERSED_DEPTH_BUFFER
  1732. return step( depth, compare );
  1733. #else
  1734. return step( compare, depth );
  1735. #endif
  1736. }
  1737. vec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {
  1738. return unpackRGBATo2Half( texture2D( shadow, uv ) );
  1739. }
  1740. float VSMShadow( sampler2D shadow, vec2 uv, float compare ) {
  1741. float occlusion = 1.0;
  1742. vec2 distribution = texture2DDistribution( shadow, uv );
  1743. #ifdef USE_REVERSED_DEPTH_BUFFER
  1744. float hard_shadow = step( distribution.x, compare );
  1745. #else
  1746. float hard_shadow = step( compare, distribution.x );
  1747. #endif
  1748. if ( hard_shadow != 1.0 ) {
  1749. float distance = compare - distribution.x;
  1750. float variance = max( 0.00000, distribution.y * distribution.y );
  1751. 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 );
  1752. }
  1753. return occlusion;
  1754. }
  1755. float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {
  1756. float shadow = 1.0;
  1757. shadowCoord.xyz /= shadowCoord.w;
  1758. shadowCoord.z += shadowBias;
  1759. bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;
  1760. bool frustumTest = inFrustum && shadowCoord.z <= 1.0;
  1761. if ( frustumTest ) {
  1762. #if defined( SHADOWMAP_TYPE_PCF )
  1763. vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
  1764. float dx0 = - texelSize.x * shadowRadius;
  1765. float dy0 = - texelSize.y * shadowRadius;
  1766. float dx1 = + texelSize.x * shadowRadius;
  1767. float dy1 = + texelSize.y * shadowRadius;
  1768. float dx2 = dx0 / 2.0;
  1769. float dy2 = dy0 / 2.0;
  1770. float dx3 = dx1 / 2.0;
  1771. float dy3 = dy1 / 2.0;
  1772. shadow = (
  1773. texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +
  1774. texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +
  1775. texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +
  1776. texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +
  1777. texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +
  1778. texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +
  1779. texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +
  1780. texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +
  1781. texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +
  1782. texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +
  1783. texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +
  1784. texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +
  1785. texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +
  1786. texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +
  1787. texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +
  1788. texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +
  1789. texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )
  1790. ) * ( 1.0 / 17.0 );
  1791. #elif defined( SHADOWMAP_TYPE_PCF_SOFT )
  1792. vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
  1793. float dx = texelSize.x;
  1794. float dy = texelSize.y;
  1795. vec2 uv = shadowCoord.xy;
  1796. vec2 f = fract( uv * shadowMapSize + 0.5 );
  1797. uv -= f * texelSize;
  1798. shadow = (
  1799. texture2DCompare( shadowMap, uv, shadowCoord.z ) +
  1800. texture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +
  1801. texture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +
  1802. texture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +
  1803. mix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ),
  1804. texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),
  1805. f.x ) +
  1806. mix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ),
  1807. texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),
  1808. f.x ) +
  1809. mix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ),
  1810. texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),
  1811. f.y ) +
  1812. mix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ),
  1813. texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),
  1814. f.y ) +
  1815. mix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ),
  1816. texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),
  1817. f.x ),
  1818. mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ),
  1819. texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),
  1820. f.x ),
  1821. f.y )
  1822. ) * ( 1.0 / 9.0 );
  1823. #elif defined( SHADOWMAP_TYPE_VSM )
  1824. shadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );
  1825. #else
  1826. shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );
  1827. #endif
  1828. }
  1829. return mix( 1.0, shadow, shadowIntensity );
  1830. }
  1831. vec2 cubeToUV( vec3 v, float texelSizeY ) {
  1832. vec3 absV = abs( v );
  1833. float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );
  1834. absV *= scaleToCube;
  1835. v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );
  1836. vec2 planar = v.xy;
  1837. float almostATexel = 1.5 * texelSizeY;
  1838. float almostOne = 1.0 - almostATexel;
  1839. if ( absV.z >= almostOne ) {
  1840. if ( v.z > 0.0 )
  1841. planar.x = 4.0 - v.x;
  1842. } else if ( absV.x >= almostOne ) {
  1843. float signX = sign( v.x );
  1844. planar.x = v.z * signX + 2.0 * signX;
  1845. } else if ( absV.y >= almostOne ) {
  1846. float signY = sign( v.y );
  1847. planar.x = v.x + 2.0 * signY + 2.0;
  1848. planar.y = v.z * signY - 2.0;
  1849. }
  1850. return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );
  1851. }
  1852. float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {
  1853. float shadow = 1.0;
  1854. vec3 lightToPosition = shadowCoord.xyz;
  1855. float lightToPositionLength = length( lightToPosition );
  1856. if ( lightToPositionLength - shadowCameraFar <= 0.0 && lightToPositionLength - shadowCameraNear >= 0.0 ) {
  1857. float dp = ( lightToPositionLength - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear ); dp += shadowBias;
  1858. vec3 bd3D = normalize( lightToPosition );
  1859. vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );
  1860. #if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )
  1861. vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;
  1862. shadow = (
  1863. texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +
  1864. texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +
  1865. texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +
  1866. texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +
  1867. texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +
  1868. texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +
  1869. texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +
  1870. texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +
  1871. texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )
  1872. ) * ( 1.0 / 9.0 );
  1873. #else
  1874. shadow = texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );
  1875. #endif
  1876. }
  1877. return mix( 1.0, shadow, shadowIntensity );
  1878. }
  1879. #endif`,XZ=`#if NUM_SPOT_LIGHT_COORDS > 0
  1880. uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];
  1881. varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
  1882. #endif
  1883. #ifdef USE_SHADOWMAP
  1884. #if NUM_DIR_LIGHT_SHADOWS > 0
  1885. uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];
  1886. varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
  1887. struct DirectionalLightShadow {
  1888. float shadowIntensity;
  1889. float shadowBias;
  1890. float shadowNormalBias;
  1891. float shadowRadius;
  1892. vec2 shadowMapSize;
  1893. };
  1894. uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
  1895. #endif
  1896. #if NUM_SPOT_LIGHT_SHADOWS > 0
  1897. struct SpotLightShadow {
  1898. float shadowIntensity;
  1899. float shadowBias;
  1900. float shadowNormalBias;
  1901. float shadowRadius;
  1902. vec2 shadowMapSize;
  1903. };
  1904. uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
  1905. #endif
  1906. #if NUM_POINT_LIGHT_SHADOWS > 0
  1907. uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];
  1908. varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
  1909. struct PointLightShadow {
  1910. float shadowIntensity;
  1911. float shadowBias;
  1912. float shadowNormalBias;
  1913. float shadowRadius;
  1914. vec2 shadowMapSize;
  1915. float shadowCameraNear;
  1916. float shadowCameraFar;
  1917. };
  1918. uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
  1919. #endif
  1920. #endif`,qZ=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )
  1921. vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
  1922. vec4 shadowWorldPosition;
  1923. #endif
  1924. #if defined( USE_SHADOWMAP )
  1925. #if NUM_DIR_LIGHT_SHADOWS > 0
  1926. #pragma unroll_loop_start
  1927. for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
  1928. shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );
  1929. vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;
  1930. }
  1931. #pragma unroll_loop_end
  1932. #endif
  1933. #if NUM_POINT_LIGHT_SHADOWS > 0
  1934. #pragma unroll_loop_start
  1935. for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
  1936. shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );
  1937. vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;
  1938. }
  1939. #pragma unroll_loop_end
  1940. #endif
  1941. #endif
  1942. #if NUM_SPOT_LIGHT_COORDS > 0
  1943. #pragma unroll_loop_start
  1944. for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {
  1945. shadowWorldPosition = worldPosition;
  1946. #if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
  1947. shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;
  1948. #endif
  1949. vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;
  1950. }
  1951. #pragma unroll_loop_end
  1952. #endif`,YZ=`float getShadowMask() {
  1953. float shadow = 1.0;
  1954. #ifdef USE_SHADOWMAP
  1955. #if NUM_DIR_LIGHT_SHADOWS > 0
  1956. DirectionalLightShadow directionalLight;
  1957. #pragma unroll_loop_start
  1958. for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
  1959. directionalLight = directionalLightShadows[ i ];
  1960. shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
  1961. }
  1962. #pragma unroll_loop_end
  1963. #endif
  1964. #if NUM_SPOT_LIGHT_SHADOWS > 0
  1965. SpotLightShadow spotLight;
  1966. #pragma unroll_loop_start
  1967. for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {
  1968. spotLight = spotLightShadows[ i ];
  1969. shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
  1970. }
  1971. #pragma unroll_loop_end
  1972. #endif
  1973. #if NUM_POINT_LIGHT_SHADOWS > 0
  1974. PointLightShadow pointLight;
  1975. #pragma unroll_loop_start
  1976. for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
  1977. pointLight = pointLightShadows[ i ];
  1978. shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;
  1979. }
  1980. #pragma unroll_loop_end
  1981. #endif
  1982. #endif
  1983. return shadow;
  1984. }`,KZ=`#ifdef USE_SKINNING
  1985. mat4 boneMatX = getBoneMatrix( skinIndex.x );
  1986. mat4 boneMatY = getBoneMatrix( skinIndex.y );
  1987. mat4 boneMatZ = getBoneMatrix( skinIndex.z );
  1988. mat4 boneMatW = getBoneMatrix( skinIndex.w );
  1989. #endif`,ZZ=`#ifdef USE_SKINNING
  1990. uniform mat4 bindMatrix;
  1991. uniform mat4 bindMatrixInverse;
  1992. uniform highp sampler2D boneTexture;
  1993. mat4 getBoneMatrix( const in float i ) {
  1994. int size = textureSize( boneTexture, 0 ).x;
  1995. int j = int( i ) * 4;
  1996. int x = j % size;
  1997. int y = j / size;
  1998. vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 );
  1999. vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 );
  2000. vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 );
  2001. vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );
  2002. return mat4( v1, v2, v3, v4 );
  2003. }
  2004. #endif`,QZ=`#ifdef USE_SKINNING
  2005. vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );
  2006. vec4 skinned = vec4( 0.0 );
  2007. skinned += boneMatX * skinVertex * skinWeight.x;
  2008. skinned += boneMatY * skinVertex * skinWeight.y;
  2009. skinned += boneMatZ * skinVertex * skinWeight.z;
  2010. skinned += boneMatW * skinVertex * skinWeight.w;
  2011. transformed = ( bindMatrixInverse * skinned ).xyz;
  2012. #endif`,JZ=`#ifdef USE_SKINNING
  2013. mat4 skinMatrix = mat4( 0.0 );
  2014. skinMatrix += skinWeight.x * boneMatX;
  2015. skinMatrix += skinWeight.y * boneMatY;
  2016. skinMatrix += skinWeight.z * boneMatZ;
  2017. skinMatrix += skinWeight.w * boneMatW;
  2018. skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;
  2019. objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;
  2020. #ifdef USE_TANGENT
  2021. objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;
  2022. #endif
  2023. #endif`,eQ=`float specularStrength;
  2024. #ifdef USE_SPECULARMAP
  2025. vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );
  2026. specularStrength = texelSpecular.r;
  2027. #else
  2028. specularStrength = 1.0;
  2029. #endif`,tQ=`#ifdef USE_SPECULARMAP
  2030. uniform sampler2D specularMap;
  2031. #endif`,nQ=`#if defined( TONE_MAPPING )
  2032. gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );
  2033. #endif`,iQ=`#ifndef saturate
  2034. #define saturate( a ) clamp( a, 0.0, 1.0 )
  2035. #endif
  2036. uniform float toneMappingExposure;
  2037. vec3 LinearToneMapping( vec3 color ) {
  2038. return saturate( toneMappingExposure * color );
  2039. }
  2040. vec3 ReinhardToneMapping( vec3 color ) {
  2041. color *= toneMappingExposure;
  2042. return saturate( color / ( vec3( 1.0 ) + color ) );
  2043. }
  2044. vec3 CineonToneMapping( vec3 color ) {
  2045. color *= toneMappingExposure;
  2046. color = max( vec3( 0.0 ), color - 0.004 );
  2047. return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );
  2048. }
  2049. vec3 RRTAndODTFit( vec3 v ) {
  2050. vec3 a = v * ( v + 0.0245786 ) - 0.000090537;
  2051. vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;
  2052. return a / b;
  2053. }
  2054. vec3 ACESFilmicToneMapping( vec3 color ) {
  2055. const mat3 ACESInputMat = mat3(
  2056. vec3( 0.59719, 0.07600, 0.02840 ), vec3( 0.35458, 0.90834, 0.13383 ),
  2057. vec3( 0.04823, 0.01566, 0.83777 )
  2058. );
  2059. const mat3 ACESOutputMat = mat3(
  2060. vec3( 1.60475, -0.10208, -0.00327 ), vec3( -0.53108, 1.10813, -0.07276 ),
  2061. vec3( -0.07367, -0.00605, 1.07602 )
  2062. );
  2063. color *= toneMappingExposure / 0.6;
  2064. color = ACESInputMat * color;
  2065. color = RRTAndODTFit( color );
  2066. color = ACESOutputMat * color;
  2067. return saturate( color );
  2068. }
  2069. const mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3(
  2070. vec3( 1.6605, - 0.1246, - 0.0182 ),
  2071. vec3( - 0.5876, 1.1329, - 0.1006 ),
  2072. vec3( - 0.0728, - 0.0083, 1.1187 )
  2073. );
  2074. const mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3(
  2075. vec3( 0.6274, 0.0691, 0.0164 ),
  2076. vec3( 0.3293, 0.9195, 0.0880 ),
  2077. vec3( 0.0433, 0.0113, 0.8956 )
  2078. );
  2079. vec3 agxDefaultContrastApprox( vec3 x ) {
  2080. vec3 x2 = x * x;
  2081. vec3 x4 = x2 * x2;
  2082. return + 15.5 * x4 * x2
  2083. - 40.14 * x4 * x
  2084. + 31.96 * x4
  2085. - 6.868 * x2 * x
  2086. + 0.4298 * x2
  2087. + 0.1191 * x
  2088. - 0.00232;
  2089. }
  2090. vec3 AgXToneMapping( vec3 color ) {
  2091. const mat3 AgXInsetMatrix = mat3(
  2092. vec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ),
  2093. vec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ),
  2094. vec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 )
  2095. );
  2096. const mat3 AgXOutsetMatrix = mat3(
  2097. vec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ),
  2098. vec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ),
  2099. vec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 )
  2100. );
  2101. const float AgxMinEv = - 12.47393; const float AgxMaxEv = 4.026069;
  2102. color *= toneMappingExposure;
  2103. color = LINEAR_SRGB_TO_LINEAR_REC2020 * color;
  2104. color = AgXInsetMatrix * color;
  2105. color = max( color, 1e-10 ); color = log2( color );
  2106. color = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv );
  2107. color = clamp( color, 0.0, 1.0 );
  2108. color = agxDefaultContrastApprox( color );
  2109. color = AgXOutsetMatrix * color;
  2110. color = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) );
  2111. color = LINEAR_REC2020_TO_LINEAR_SRGB * color;
  2112. color = clamp( color, 0.0, 1.0 );
  2113. return color;
  2114. }
  2115. vec3 NeutralToneMapping( vec3 color ) {
  2116. const float StartCompression = 0.8 - 0.04;
  2117. const float Desaturation = 0.15;
  2118. color *= toneMappingExposure;
  2119. float x = min( color.r, min( color.g, color.b ) );
  2120. float offset = x < 0.08 ? x - 6.25 * x * x : 0.04;
  2121. color -= offset;
  2122. float peak = max( color.r, max( color.g, color.b ) );
  2123. if ( peak < StartCompression ) return color;
  2124. float d = 1. - StartCompression;
  2125. float newPeak = 1. - d * d / ( peak + d - StartCompression );
  2126. color *= newPeak / peak;
  2127. float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. );
  2128. return mix( color, vec3( newPeak ), g );
  2129. }
  2130. vec3 CustomToneMapping( vec3 color ) { return color; }`,rQ=`#ifdef USE_TRANSMISSION
  2131. material.transmission = transmission;
  2132. material.transmissionAlpha = 1.0;
  2133. material.thickness = thickness;
  2134. material.attenuationDistance = attenuationDistance;
  2135. material.attenuationColor = attenuationColor;
  2136. #ifdef USE_TRANSMISSIONMAP
  2137. material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;
  2138. #endif
  2139. #ifdef USE_THICKNESSMAP
  2140. material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;
  2141. #endif
  2142. vec3 pos = vWorldPosition;
  2143. vec3 v = normalize( cameraPosition - pos );
  2144. vec3 n = inverseTransformDirection( normal, viewMatrix );
  2145. vec4 transmitted = getIBLVolumeRefraction(
  2146. n, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,
  2147. pos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness,
  2148. material.attenuationColor, material.attenuationDistance );
  2149. material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );
  2150. totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );
  2151. #endif`,aQ=`#ifdef USE_TRANSMISSION
  2152. uniform float transmission;
  2153. uniform float thickness;
  2154. uniform float attenuationDistance;
  2155. uniform vec3 attenuationColor;
  2156. #ifdef USE_TRANSMISSIONMAP
  2157. uniform sampler2D transmissionMap;
  2158. #endif
  2159. #ifdef USE_THICKNESSMAP
  2160. uniform sampler2D thicknessMap;
  2161. #endif
  2162. uniform vec2 transmissionSamplerSize;
  2163. uniform sampler2D transmissionSamplerMap;
  2164. uniform mat4 modelMatrix;
  2165. uniform mat4 projectionMatrix;
  2166. varying vec3 vWorldPosition;
  2167. float w0( float a ) {
  2168. return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );
  2169. }
  2170. float w1( float a ) {
  2171. return ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 );
  2172. }
  2173. float w2( float a ){
  2174. return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );
  2175. }
  2176. float w3( float a ) {
  2177. return ( 1.0 / 6.0 ) * ( a * a * a );
  2178. }
  2179. float g0( float a ) {
  2180. return w0( a ) + w1( a );
  2181. }
  2182. float g1( float a ) {
  2183. return w2( a ) + w3( a );
  2184. }
  2185. float h0( float a ) {
  2186. return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );
  2187. }
  2188. float h1( float a ) {
  2189. return 1.0 + w3( a ) / ( w2( a ) + w3( a ) );
  2190. }
  2191. vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {
  2192. uv = uv * texelSize.zw + 0.5;
  2193. vec2 iuv = floor( uv );
  2194. vec2 fuv = fract( uv );
  2195. float g0x = g0( fuv.x );
  2196. float g1x = g1( fuv.x );
  2197. float h0x = h0( fuv.x );
  2198. float h1x = h1( fuv.x );
  2199. float h0y = h0( fuv.y );
  2200. float h1y = h1( fuv.y );
  2201. vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;
  2202. vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;
  2203. vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;
  2204. vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;
  2205. return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +
  2206. g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );
  2207. }
  2208. vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {
  2209. vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );
  2210. vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );
  2211. vec2 fLodSizeInv = 1.0 / fLodSize;
  2212. vec2 cLodSizeInv = 1.0 / cLodSize;
  2213. vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );
  2214. vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );
  2215. return mix( fSample, cSample, fract( lod ) );
  2216. }
  2217. vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {
  2218. vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );
  2219. vec3 modelScale;
  2220. modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );
  2221. modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );
  2222. modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );
  2223. return normalize( refractionVector ) * thickness * modelScale;
  2224. }
  2225. float applyIorToRoughness( const in float roughness, const in float ior ) {
  2226. return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );
  2227. }
  2228. vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {
  2229. float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );
  2230. return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );
  2231. }
  2232. vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {
  2233. if ( isinf( attenuationDistance ) ) {
  2234. return vec3( 1.0 );
  2235. } else {
  2236. vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;
  2237. vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); return transmittance;
  2238. }
  2239. }
  2240. vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,
  2241. const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,
  2242. const in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness,
  2243. const in vec3 attenuationColor, const in float attenuationDistance ) {
  2244. vec4 transmittedLight;
  2245. vec3 transmittance;
  2246. #ifdef USE_DISPERSION
  2247. float halfSpread = ( ior - 1.0 ) * 0.025 * dispersion;
  2248. vec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread );
  2249. for ( int i = 0; i < 3; i ++ ) {
  2250. vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix );
  2251. vec3 refractedRayExit = position + transmissionRay;
  2252. vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );
  2253. vec2 refractionCoords = ndcPos.xy / ndcPos.w;
  2254. refractionCoords += 1.0;
  2255. refractionCoords /= 2.0;
  2256. vec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] );
  2257. transmittedLight[ i ] = transmissionSample[ i ];
  2258. transmittedLight.a += transmissionSample.a;
  2259. transmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ];
  2260. }
  2261. transmittedLight.a /= 3.0;
  2262. #else
  2263. vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );
  2264. vec3 refractedRayExit = position + transmissionRay;
  2265. vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );
  2266. vec2 refractionCoords = ndcPos.xy / ndcPos.w;
  2267. refractionCoords += 1.0;
  2268. refractionCoords /= 2.0;
  2269. transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );
  2270. transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );
  2271. #endif
  2272. vec3 attenuatedColor = transmittance * transmittedLight.rgb;
  2273. vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );
  2274. float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;
  2275. return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );
  2276. }
  2277. #endif`,sQ=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
  2278. varying vec2 vUv;
  2279. #endif
  2280. #ifdef USE_MAP
  2281. varying vec2 vMapUv;
  2282. #endif
  2283. #ifdef USE_ALPHAMAP
  2284. varying vec2 vAlphaMapUv;
  2285. #endif
  2286. #ifdef USE_LIGHTMAP
  2287. varying vec2 vLightMapUv;
  2288. #endif
  2289. #ifdef USE_AOMAP
  2290. varying vec2 vAoMapUv;
  2291. #endif
  2292. #ifdef USE_BUMPMAP
  2293. varying vec2 vBumpMapUv;
  2294. #endif
  2295. #ifdef USE_NORMALMAP
  2296. varying vec2 vNormalMapUv;
  2297. #endif
  2298. #ifdef USE_EMISSIVEMAP
  2299. varying vec2 vEmissiveMapUv;
  2300. #endif
  2301. #ifdef USE_METALNESSMAP
  2302. varying vec2 vMetalnessMapUv;
  2303. #endif
  2304. #ifdef USE_ROUGHNESSMAP
  2305. varying vec2 vRoughnessMapUv;
  2306. #endif
  2307. #ifdef USE_ANISOTROPYMAP
  2308. varying vec2 vAnisotropyMapUv;
  2309. #endif
  2310. #ifdef USE_CLEARCOATMAP
  2311. varying vec2 vClearcoatMapUv;
  2312. #endif
  2313. #ifdef USE_CLEARCOAT_NORMALMAP
  2314. varying vec2 vClearcoatNormalMapUv;
  2315. #endif
  2316. #ifdef USE_CLEARCOAT_ROUGHNESSMAP
  2317. varying vec2 vClearcoatRoughnessMapUv;
  2318. #endif
  2319. #ifdef USE_IRIDESCENCEMAP
  2320. varying vec2 vIridescenceMapUv;
  2321. #endif
  2322. #ifdef USE_IRIDESCENCE_THICKNESSMAP
  2323. varying vec2 vIridescenceThicknessMapUv;
  2324. #endif
  2325. #ifdef USE_SHEEN_COLORMAP
  2326. varying vec2 vSheenColorMapUv;
  2327. #endif
  2328. #ifdef USE_SHEEN_ROUGHNESSMAP
  2329. varying vec2 vSheenRoughnessMapUv;
  2330. #endif
  2331. #ifdef USE_SPECULARMAP
  2332. varying vec2 vSpecularMapUv;
  2333. #endif
  2334. #ifdef USE_SPECULAR_COLORMAP
  2335. varying vec2 vSpecularColorMapUv;
  2336. #endif
  2337. #ifdef USE_SPECULAR_INTENSITYMAP
  2338. varying vec2 vSpecularIntensityMapUv;
  2339. #endif
  2340. #ifdef USE_TRANSMISSIONMAP
  2341. uniform mat3 transmissionMapTransform;
  2342. varying vec2 vTransmissionMapUv;
  2343. #endif
  2344. #ifdef USE_THICKNESSMAP
  2345. uniform mat3 thicknessMapTransform;
  2346. varying vec2 vThicknessMapUv;
  2347. #endif`,oQ=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
  2348. varying vec2 vUv;
  2349. #endif
  2350. #ifdef USE_MAP
  2351. uniform mat3 mapTransform;
  2352. varying vec2 vMapUv;
  2353. #endif
  2354. #ifdef USE_ALPHAMAP
  2355. uniform mat3 alphaMapTransform;
  2356. varying vec2 vAlphaMapUv;
  2357. #endif
  2358. #ifdef USE_LIGHTMAP
  2359. uniform mat3 lightMapTransform;
  2360. varying vec2 vLightMapUv;
  2361. #endif
  2362. #ifdef USE_AOMAP
  2363. uniform mat3 aoMapTransform;
  2364. varying vec2 vAoMapUv;
  2365. #endif
  2366. #ifdef USE_BUMPMAP
  2367. uniform mat3 bumpMapTransform;
  2368. varying vec2 vBumpMapUv;
  2369. #endif
  2370. #ifdef USE_NORMALMAP
  2371. uniform mat3 normalMapTransform;
  2372. varying vec2 vNormalMapUv;
  2373. #endif
  2374. #ifdef USE_DISPLACEMENTMAP
  2375. uniform mat3 displacementMapTransform;
  2376. varying vec2 vDisplacementMapUv;
  2377. #endif
  2378. #ifdef USE_EMISSIVEMAP
  2379. uniform mat3 emissiveMapTransform;
  2380. varying vec2 vEmissiveMapUv;
  2381. #endif
  2382. #ifdef USE_METALNESSMAP
  2383. uniform mat3 metalnessMapTransform;
  2384. varying vec2 vMetalnessMapUv;
  2385. #endif
  2386. #ifdef USE_ROUGHNESSMAP
  2387. uniform mat3 roughnessMapTransform;
  2388. varying vec2 vRoughnessMapUv;
  2389. #endif
  2390. #ifdef USE_ANISOTROPYMAP
  2391. uniform mat3 anisotropyMapTransform;
  2392. varying vec2 vAnisotropyMapUv;
  2393. #endif
  2394. #ifdef USE_CLEARCOATMAP
  2395. uniform mat3 clearcoatMapTransform;
  2396. varying vec2 vClearcoatMapUv;
  2397. #endif
  2398. #ifdef USE_CLEARCOAT_NORMALMAP
  2399. uniform mat3 clearcoatNormalMapTransform;
  2400. varying vec2 vClearcoatNormalMapUv;
  2401. #endif
  2402. #ifdef USE_CLEARCOAT_ROUGHNESSMAP
  2403. uniform mat3 clearcoatRoughnessMapTransform;
  2404. varying vec2 vClearcoatRoughnessMapUv;
  2405. #endif
  2406. #ifdef USE_SHEEN_COLORMAP
  2407. uniform mat3 sheenColorMapTransform;
  2408. varying vec2 vSheenColorMapUv;
  2409. #endif
  2410. #ifdef USE_SHEEN_ROUGHNESSMAP
  2411. uniform mat3 sheenRoughnessMapTransform;
  2412. varying vec2 vSheenRoughnessMapUv;
  2413. #endif
  2414. #ifdef USE_IRIDESCENCEMAP
  2415. uniform mat3 iridescenceMapTransform;
  2416. varying vec2 vIridescenceMapUv;
  2417. #endif
  2418. #ifdef USE_IRIDESCENCE_THICKNESSMAP
  2419. uniform mat3 iridescenceThicknessMapTransform;
  2420. varying vec2 vIridescenceThicknessMapUv;
  2421. #endif
  2422. #ifdef USE_SPECULARMAP
  2423. uniform mat3 specularMapTransform;
  2424. varying vec2 vSpecularMapUv;
  2425. #endif
  2426. #ifdef USE_SPECULAR_COLORMAP
  2427. uniform mat3 specularColorMapTransform;
  2428. varying vec2 vSpecularColorMapUv;
  2429. #endif
  2430. #ifdef USE_SPECULAR_INTENSITYMAP
  2431. uniform mat3 specularIntensityMapTransform;
  2432. varying vec2 vSpecularIntensityMapUv;
  2433. #endif
  2434. #ifdef USE_TRANSMISSIONMAP
  2435. uniform mat3 transmissionMapTransform;
  2436. varying vec2 vTransmissionMapUv;
  2437. #endif
  2438. #ifdef USE_THICKNESSMAP
  2439. uniform mat3 thicknessMapTransform;
  2440. varying vec2 vThicknessMapUv;
  2441. #endif`,lQ=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
  2442. vUv = vec3( uv, 1 ).xy;
  2443. #endif
  2444. #ifdef USE_MAP
  2445. vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;
  2446. #endif
  2447. #ifdef USE_ALPHAMAP
  2448. vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;
  2449. #endif
  2450. #ifdef USE_LIGHTMAP
  2451. vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;
  2452. #endif
  2453. #ifdef USE_AOMAP
  2454. vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;
  2455. #endif
  2456. #ifdef USE_BUMPMAP
  2457. vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;
  2458. #endif
  2459. #ifdef USE_NORMALMAP
  2460. vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;
  2461. #endif
  2462. #ifdef USE_DISPLACEMENTMAP
  2463. vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;
  2464. #endif
  2465. #ifdef USE_EMISSIVEMAP
  2466. vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;
  2467. #endif
  2468. #ifdef USE_METALNESSMAP
  2469. vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;
  2470. #endif
  2471. #ifdef USE_ROUGHNESSMAP
  2472. vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;
  2473. #endif
  2474. #ifdef USE_ANISOTROPYMAP
  2475. vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;
  2476. #endif
  2477. #ifdef USE_CLEARCOATMAP
  2478. vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;
  2479. #endif
  2480. #ifdef USE_CLEARCOAT_NORMALMAP
  2481. vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;
  2482. #endif
  2483. #ifdef USE_CLEARCOAT_ROUGHNESSMAP
  2484. vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;
  2485. #endif
  2486. #ifdef USE_IRIDESCENCEMAP
  2487. vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;
  2488. #endif
  2489. #ifdef USE_IRIDESCENCE_THICKNESSMAP
  2490. vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;
  2491. #endif
  2492. #ifdef USE_SHEEN_COLORMAP
  2493. vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;
  2494. #endif
  2495. #ifdef USE_SHEEN_ROUGHNESSMAP
  2496. vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;
  2497. #endif
  2498. #ifdef USE_SPECULARMAP
  2499. vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;
  2500. #endif
  2501. #ifdef USE_SPECULAR_COLORMAP
  2502. vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;
  2503. #endif
  2504. #ifdef USE_SPECULAR_INTENSITYMAP
  2505. vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;
  2506. #endif
  2507. #ifdef USE_TRANSMISSIONMAP
  2508. vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;
  2509. #endif
  2510. #ifdef USE_THICKNESSMAP
  2511. vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;
  2512. #endif`,cQ=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0
  2513. vec4 worldPosition = vec4( transformed, 1.0 );
  2514. #ifdef USE_BATCHING
  2515. worldPosition = batchingMatrix * worldPosition;
  2516. #endif
  2517. #ifdef USE_INSTANCING
  2518. worldPosition = instanceMatrix * worldPosition;
  2519. #endif
  2520. worldPosition = modelMatrix * worldPosition;
  2521. #endif`;const uQ=`varying vec2 vUv;
  2522. uniform mat3 uvTransform;
  2523. void main() {
  2524. vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
  2525. gl_Position = vec4( position.xy, 1.0, 1.0 );
  2526. }`,dQ=`uniform sampler2D t2D;
  2527. uniform float backgroundIntensity;
  2528. varying vec2 vUv;
  2529. void main() {
  2530. vec4 texColor = texture2D( t2D, vUv );
  2531. #ifdef DECODE_VIDEO_TEXTURE
  2532. 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 );
  2533. #endif
  2534. texColor.rgb *= backgroundIntensity;
  2535. gl_FragColor = texColor;
  2536. #include <tonemapping_fragment>
  2537. #include <colorspace_fragment>
  2538. }`,fQ=`varying vec3 vWorldDirection;
  2539. #include <common>
  2540. void main() {
  2541. vWorldDirection = transformDirection( position, modelMatrix );
  2542. #include <begin_vertex>
  2543. #include <project_vertex>
  2544. gl_Position.z = gl_Position.w;
  2545. }`,hQ=`#ifdef ENVMAP_TYPE_CUBE
  2546. uniform samplerCube envMap;
  2547. #elif defined( ENVMAP_TYPE_CUBE_UV )
  2548. uniform sampler2D envMap;
  2549. #endif
  2550. uniform float flipEnvMap;
  2551. uniform float backgroundBlurriness;
  2552. uniform float backgroundIntensity;
  2553. uniform mat3 backgroundRotation;
  2554. varying vec3 vWorldDirection;
  2555. #include <cube_uv_reflection_fragment>
  2556. void main() {
  2557. #ifdef ENVMAP_TYPE_CUBE
  2558. vec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );
  2559. #elif defined( ENVMAP_TYPE_CUBE_UV )
  2560. vec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness );
  2561. #else
  2562. vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );
  2563. #endif
  2564. texColor.rgb *= backgroundIntensity;
  2565. gl_FragColor = texColor;
  2566. #include <tonemapping_fragment>
  2567. #include <colorspace_fragment>
  2568. }`,pQ=`varying vec3 vWorldDirection;
  2569. #include <common>
  2570. void main() {
  2571. vWorldDirection = transformDirection( position, modelMatrix );
  2572. #include <begin_vertex>
  2573. #include <project_vertex>
  2574. gl_Position.z = gl_Position.w;
  2575. }`,mQ=`uniform samplerCube tCube;
  2576. uniform float tFlip;
  2577. uniform float opacity;
  2578. varying vec3 vWorldDirection;
  2579. void main() {
  2580. vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );
  2581. gl_FragColor = texColor;
  2582. gl_FragColor.a *= opacity;
  2583. #include <tonemapping_fragment>
  2584. #include <colorspace_fragment>
  2585. }`,gQ=`#include <common>
  2586. #include <batching_pars_vertex>
  2587. #include <uv_pars_vertex>
  2588. #include <displacementmap_pars_vertex>
  2589. #include <morphtarget_pars_vertex>
  2590. #include <skinning_pars_vertex>
  2591. #include <logdepthbuf_pars_vertex>
  2592. #include <clipping_planes_pars_vertex>
  2593. varying vec2 vHighPrecisionZW;
  2594. void main() {
  2595. #include <uv_vertex>
  2596. #include <batching_vertex>
  2597. #include <skinbase_vertex>
  2598. #include <morphinstance_vertex>
  2599. #ifdef USE_DISPLACEMENTMAP
  2600. #include <beginnormal_vertex>
  2601. #include <morphnormal_vertex>
  2602. #include <skinnormal_vertex>
  2603. #endif
  2604. #include <begin_vertex>
  2605. #include <morphtarget_vertex>
  2606. #include <skinning_vertex>
  2607. #include <displacementmap_vertex>
  2608. #include <project_vertex>
  2609. #include <logdepthbuf_vertex>
  2610. #include <clipping_planes_vertex>
  2611. vHighPrecisionZW = gl_Position.zw;
  2612. }`,vQ=`#if DEPTH_PACKING == 3200
  2613. uniform float opacity;
  2614. #endif
  2615. #include <common>
  2616. #include <packing>
  2617. #include <uv_pars_fragment>
  2618. #include <map_pars_fragment>
  2619. #include <alphamap_pars_fragment>
  2620. #include <alphatest_pars_fragment>
  2621. #include <alphahash_pars_fragment>
  2622. #include <logdepthbuf_pars_fragment>
  2623. #include <clipping_planes_pars_fragment>
  2624. varying vec2 vHighPrecisionZW;
  2625. void main() {
  2626. vec4 diffuseColor = vec4( 1.0 );
  2627. #include <clipping_planes_fragment>
  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 <alphahash_fragment>
  2635. #include <logdepthbuf_fragment>
  2636. #ifdef USE_REVERSED_DEPTH_BUFFER
  2637. float fragCoordZ = vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ];
  2638. #else
  2639. float fragCoordZ = 0.5 * vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ] + 0.5;
  2640. #endif
  2641. #if DEPTH_PACKING == 3200
  2642. gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );
  2643. #elif DEPTH_PACKING == 3201
  2644. gl_FragColor = packDepthToRGBA( fragCoordZ );
  2645. #elif DEPTH_PACKING == 3202
  2646. gl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 );
  2647. #elif DEPTH_PACKING == 3203
  2648. gl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 );
  2649. #endif
  2650. }`,xQ=`#define DISTANCE
  2651. varying vec3 vWorldPosition;
  2652. #include <common>
  2653. #include <batching_pars_vertex>
  2654. #include <uv_pars_vertex>
  2655. #include <displacementmap_pars_vertex>
  2656. #include <morphtarget_pars_vertex>
  2657. #include <skinning_pars_vertex>
  2658. #include <clipping_planes_pars_vertex>
  2659. void main() {
  2660. #include <uv_vertex>
  2661. #include <batching_vertex>
  2662. #include <skinbase_vertex>
  2663. #include <morphinstance_vertex>
  2664. #ifdef USE_DISPLACEMENTMAP
  2665. #include <beginnormal_vertex>
  2666. #include <morphnormal_vertex>
  2667. #include <skinnormal_vertex>
  2668. #endif
  2669. #include <begin_vertex>
  2670. #include <morphtarget_vertex>
  2671. #include <skinning_vertex>
  2672. #include <displacementmap_vertex>
  2673. #include <project_vertex>
  2674. #include <worldpos_vertex>
  2675. #include <clipping_planes_vertex>
  2676. vWorldPosition = worldPosition.xyz;
  2677. }`,yQ=`#define DISTANCE
  2678. uniform vec3 referencePosition;
  2679. uniform float nearDistance;
  2680. uniform float farDistance;
  2681. varying vec3 vWorldPosition;
  2682. #include <common>
  2683. #include <packing>
  2684. #include <uv_pars_fragment>
  2685. #include <map_pars_fragment>
  2686. #include <alphamap_pars_fragment>
  2687. #include <alphatest_pars_fragment>
  2688. #include <alphahash_pars_fragment>
  2689. #include <clipping_planes_pars_fragment>
  2690. void main () {
  2691. vec4 diffuseColor = vec4( 1.0 );
  2692. #include <clipping_planes_fragment>
  2693. #include <map_fragment>
  2694. #include <alphamap_fragment>
  2695. #include <alphatest_fragment>
  2696. #include <alphahash_fragment>
  2697. float dist = length( vWorldPosition - referencePosition );
  2698. dist = ( dist - nearDistance ) / ( farDistance - nearDistance );
  2699. dist = saturate( dist );
  2700. gl_FragColor = packDepthToRGBA( dist );
  2701. }`,bQ=`varying vec3 vWorldDirection;
  2702. #include <common>
  2703. void main() {
  2704. vWorldDirection = transformDirection( position, modelMatrix );
  2705. #include <begin_vertex>
  2706. #include <project_vertex>
  2707. }`,_Q=`uniform sampler2D tEquirect;
  2708. varying vec3 vWorldDirection;
  2709. #include <common>
  2710. void main() {
  2711. vec3 direction = normalize( vWorldDirection );
  2712. vec2 sampleUV = equirectUv( direction );
  2713. gl_FragColor = texture2D( tEquirect, sampleUV );
  2714. #include <tonemapping_fragment>
  2715. #include <colorspace_fragment>
  2716. }`,SQ=`uniform float scale;
  2717. attribute float lineDistance;
  2718. varying float vLineDistance;
  2719. #include <common>
  2720. #include <uv_pars_vertex>
  2721. #include <color_pars_vertex>
  2722. #include <fog_pars_vertex>
  2723. #include <morphtarget_pars_vertex>
  2724. #include <logdepthbuf_pars_vertex>
  2725. #include <clipping_planes_pars_vertex>
  2726. void main() {
  2727. vLineDistance = scale * lineDistance;
  2728. #include <uv_vertex>
  2729. #include <color_vertex>
  2730. #include <morphinstance_vertex>
  2731. #include <morphcolor_vertex>
  2732. #include <begin_vertex>
  2733. #include <morphtarget_vertex>
  2734. #include <project_vertex>
  2735. #include <logdepthbuf_vertex>
  2736. #include <clipping_planes_vertex>
  2737. #include <fog_vertex>
  2738. }`,wQ=`uniform vec3 diffuse;
  2739. uniform float opacity;
  2740. uniform float dashSize;
  2741. uniform float totalSize;
  2742. varying float vLineDistance;
  2743. #include <common>
  2744. #include <color_pars_fragment>
  2745. #include <uv_pars_fragment>
  2746. #include <map_pars_fragment>
  2747. #include <fog_pars_fragment>
  2748. #include <logdepthbuf_pars_fragment>
  2749. #include <clipping_planes_pars_fragment>
  2750. void main() {
  2751. vec4 diffuseColor = vec4( diffuse, opacity );
  2752. #include <clipping_planes_fragment>
  2753. if ( mod( vLineDistance, totalSize ) > dashSize ) {
  2754. discard;
  2755. }
  2756. vec3 outgoingLight = vec3( 0.0 );
  2757. #include <logdepthbuf_fragment>
  2758. #include <map_fragment>
  2759. #include <color_fragment>
  2760. outgoingLight = diffuseColor.rgb;
  2761. #include <opaque_fragment>
  2762. #include <tonemapping_fragment>
  2763. #include <colorspace_fragment>
  2764. #include <fog_fragment>
  2765. #include <premultiplied_alpha_fragment>
  2766. }`,EQ=`#include <common>
  2767. #include <batching_pars_vertex>
  2768. #include <uv_pars_vertex>
  2769. #include <envmap_pars_vertex>
  2770. #include <color_pars_vertex>
  2771. #include <fog_pars_vertex>
  2772. #include <morphtarget_pars_vertex>
  2773. #include <skinning_pars_vertex>
  2774. #include <logdepthbuf_pars_vertex>
  2775. #include <clipping_planes_pars_vertex>
  2776. void main() {
  2777. #include <uv_vertex>
  2778. #include <color_vertex>
  2779. #include <morphinstance_vertex>
  2780. #include <morphcolor_vertex>
  2781. #include <batching_vertex>
  2782. #if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )
  2783. #include <beginnormal_vertex>
  2784. #include <morphnormal_vertex>
  2785. #include <skinbase_vertex>
  2786. #include <skinnormal_vertex>
  2787. #include <defaultnormal_vertex>
  2788. #endif
  2789. #include <begin_vertex>
  2790. #include <morphtarget_vertex>
  2791. #include <skinning_vertex>
  2792. #include <project_vertex>
  2793. #include <logdepthbuf_vertex>
  2794. #include <clipping_planes_vertex>
  2795. #include <worldpos_vertex>
  2796. #include <envmap_vertex>
  2797. #include <fog_vertex>
  2798. }`,MQ=`uniform vec3 diffuse;
  2799. uniform float opacity;
  2800. #ifndef FLAT_SHADED
  2801. varying vec3 vNormal;
  2802. #endif
  2803. #include <common>
  2804. #include <dithering_pars_fragment>
  2805. #include <color_pars_fragment>
  2806. #include <uv_pars_fragment>
  2807. #include <map_pars_fragment>
  2808. #include <alphamap_pars_fragment>
  2809. #include <alphatest_pars_fragment>
  2810. #include <alphahash_pars_fragment>
  2811. #include <aomap_pars_fragment>
  2812. #include <lightmap_pars_fragment>
  2813. #include <envmap_common_pars_fragment>
  2814. #include <envmap_pars_fragment>
  2815. #include <fog_pars_fragment>
  2816. #include <specularmap_pars_fragment>
  2817. #include <logdepthbuf_pars_fragment>
  2818. #include <clipping_planes_pars_fragment>
  2819. void main() {
  2820. vec4 diffuseColor = vec4( diffuse, opacity );
  2821. #include <clipping_planes_fragment>
  2822. #include <logdepthbuf_fragment>
  2823. #include <map_fragment>
  2824. #include <color_fragment>
  2825. #include <alphamap_fragment>
  2826. #include <alphatest_fragment>
  2827. #include <alphahash_fragment>
  2828. #include <specularmap_fragment>
  2829. ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
  2830. #ifdef USE_LIGHTMAP
  2831. vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
  2832. reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;
  2833. #else
  2834. reflectedLight.indirectDiffuse += vec3( 1.0 );
  2835. #endif
  2836. #include <aomap_fragment>
  2837. reflectedLight.indirectDiffuse *= diffuseColor.rgb;
  2838. vec3 outgoingLight = reflectedLight.indirectDiffuse;
  2839. #include <envmap_fragment>
  2840. #include <opaque_fragment>
  2841. #include <tonemapping_fragment>
  2842. #include <colorspace_fragment>
  2843. #include <fog_fragment>
  2844. #include <premultiplied_alpha_fragment>
  2845. #include <dithering_fragment>
  2846. }`,AQ=`#define LAMBERT
  2847. varying vec3 vViewPosition;
  2848. #include <common>
  2849. #include <batching_pars_vertex>
  2850. #include <uv_pars_vertex>
  2851. #include <displacementmap_pars_vertex>
  2852. #include <envmap_pars_vertex>
  2853. #include <color_pars_vertex>
  2854. #include <fog_pars_vertex>
  2855. #include <normal_pars_vertex>
  2856. #include <morphtarget_pars_vertex>
  2857. #include <skinning_pars_vertex>
  2858. #include <shadowmap_pars_vertex>
  2859. #include <logdepthbuf_pars_vertex>
  2860. #include <clipping_planes_pars_vertex>
  2861. void main() {
  2862. #include <uv_vertex>
  2863. #include <color_vertex>
  2864. #include <morphinstance_vertex>
  2865. #include <morphcolor_vertex>
  2866. #include <batching_vertex>
  2867. #include <beginnormal_vertex>
  2868. #include <morphnormal_vertex>
  2869. #include <skinbase_vertex>
  2870. #include <skinnormal_vertex>
  2871. #include <defaultnormal_vertex>
  2872. #include <normal_vertex>
  2873. #include <begin_vertex>
  2874. #include <morphtarget_vertex>
  2875. #include <skinning_vertex>
  2876. #include <displacementmap_vertex>
  2877. #include <project_vertex>
  2878. #include <logdepthbuf_vertex>
  2879. #include <clipping_planes_vertex>
  2880. vViewPosition = - mvPosition.xyz;
  2881. #include <worldpos_vertex>
  2882. #include <envmap_vertex>
  2883. #include <shadowmap_vertex>
  2884. #include <fog_vertex>
  2885. }`,TQ=`#define LAMBERT
  2886. uniform vec3 diffuse;
  2887. uniform vec3 emissive;
  2888. uniform float opacity;
  2889. #include <common>
  2890. #include <packing>
  2891. #include <dithering_pars_fragment>
  2892. #include <color_pars_fragment>
  2893. #include <uv_pars_fragment>
  2894. #include <map_pars_fragment>
  2895. #include <alphamap_pars_fragment>
  2896. #include <alphatest_pars_fragment>
  2897. #include <alphahash_pars_fragment>
  2898. #include <aomap_pars_fragment>
  2899. #include <lightmap_pars_fragment>
  2900. #include <emissivemap_pars_fragment>
  2901. #include <envmap_common_pars_fragment>
  2902. #include <envmap_pars_fragment>
  2903. #include <fog_pars_fragment>
  2904. #include <bsdfs>
  2905. #include <lights_pars_begin>
  2906. #include <normal_pars_fragment>
  2907. #include <lights_lambert_pars_fragment>
  2908. #include <shadowmap_pars_fragment>
  2909. #include <bumpmap_pars_fragment>
  2910. #include <normalmap_pars_fragment>
  2911. #include <specularmap_pars_fragment>
  2912. #include <logdepthbuf_pars_fragment>
  2913. #include <clipping_planes_pars_fragment>
  2914. void main() {
  2915. vec4 diffuseColor = vec4( diffuse, opacity );
  2916. #include <clipping_planes_fragment>
  2917. ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
  2918. vec3 totalEmissiveRadiance = emissive;
  2919. #include <logdepthbuf_fragment>
  2920. #include <map_fragment>
  2921. #include <color_fragment>
  2922. #include <alphamap_fragment>
  2923. #include <alphatest_fragment>
  2924. #include <alphahash_fragment>
  2925. #include <specularmap_fragment>
  2926. #include <normal_fragment_begin>
  2927. #include <normal_fragment_maps>
  2928. #include <emissivemap_fragment>
  2929. #include <lights_lambert_fragment>
  2930. #include <lights_fragment_begin>
  2931. #include <lights_fragment_maps>
  2932. #include <lights_fragment_end>
  2933. #include <aomap_fragment>
  2934. vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
  2935. #include <envmap_fragment>
  2936. #include <opaque_fragment>
  2937. #include <tonemapping_fragment>
  2938. #include <colorspace_fragment>
  2939. #include <fog_fragment>
  2940. #include <premultiplied_alpha_fragment>
  2941. #include <dithering_fragment>
  2942. }`,CQ=`#define MATCAP
  2943. varying vec3 vViewPosition;
  2944. #include <common>
  2945. #include <batching_pars_vertex>
  2946. #include <uv_pars_vertex>
  2947. #include <color_pars_vertex>
  2948. #include <displacementmap_pars_vertex>
  2949. #include <fog_pars_vertex>
  2950. #include <normal_pars_vertex>
  2951. #include <morphtarget_pars_vertex>
  2952. #include <skinning_pars_vertex>
  2953. #include <logdepthbuf_pars_vertex>
  2954. #include <clipping_planes_pars_vertex>
  2955. void main() {
  2956. #include <uv_vertex>
  2957. #include <color_vertex>
  2958. #include <morphinstance_vertex>
  2959. #include <morphcolor_vertex>
  2960. #include <batching_vertex>
  2961. #include <beginnormal_vertex>
  2962. #include <morphnormal_vertex>
  2963. #include <skinbase_vertex>
  2964. #include <skinnormal_vertex>
  2965. #include <defaultnormal_vertex>
  2966. #include <normal_vertex>
  2967. #include <begin_vertex>
  2968. #include <morphtarget_vertex>
  2969. #include <skinning_vertex>
  2970. #include <displacementmap_vertex>
  2971. #include <project_vertex>
  2972. #include <logdepthbuf_vertex>
  2973. #include <clipping_planes_vertex>
  2974. #include <fog_vertex>
  2975. vViewPosition = - mvPosition.xyz;
  2976. }`,RQ=`#define MATCAP
  2977. uniform vec3 diffuse;
  2978. uniform float opacity;
  2979. uniform sampler2D matcap;
  2980. varying vec3 vViewPosition;
  2981. #include <common>
  2982. #include <dithering_pars_fragment>
  2983. #include <color_pars_fragment>
  2984. #include <uv_pars_fragment>
  2985. #include <map_pars_fragment>
  2986. #include <alphamap_pars_fragment>
  2987. #include <alphatest_pars_fragment>
  2988. #include <alphahash_pars_fragment>
  2989. #include <fog_pars_fragment>
  2990. #include <normal_pars_fragment>
  2991. #include <bumpmap_pars_fragment>
  2992. #include <normalmap_pars_fragment>
  2993. #include <logdepthbuf_pars_fragment>
  2994. #include <clipping_planes_pars_fragment>
  2995. void main() {
  2996. vec4 diffuseColor = vec4( diffuse, opacity );
  2997. #include <clipping_planes_fragment>
  2998. #include <logdepthbuf_fragment>
  2999. #include <map_fragment>
  3000. #include <color_fragment>
  3001. #include <alphamap_fragment>
  3002. #include <alphatest_fragment>
  3003. #include <alphahash_fragment>
  3004. #include <normal_fragment_begin>
  3005. #include <normal_fragment_maps>
  3006. vec3 viewDir = normalize( vViewPosition );
  3007. vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );
  3008. vec3 y = cross( viewDir, x );
  3009. vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;
  3010. #ifdef USE_MATCAP
  3011. vec4 matcapColor = texture2D( matcap, uv );
  3012. #else
  3013. vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );
  3014. #endif
  3015. vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;
  3016. #include <opaque_fragment>
  3017. #include <tonemapping_fragment>
  3018. #include <colorspace_fragment>
  3019. #include <fog_fragment>
  3020. #include <premultiplied_alpha_fragment>
  3021. #include <dithering_fragment>
  3022. }`,PQ=`#define NORMAL
  3023. #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
  3024. varying vec3 vViewPosition;
  3025. #endif
  3026. #include <common>
  3027. #include <batching_pars_vertex>
  3028. #include <uv_pars_vertex>
  3029. #include <displacementmap_pars_vertex>
  3030. #include <normal_pars_vertex>
  3031. #include <morphtarget_pars_vertex>
  3032. #include <skinning_pars_vertex>
  3033. #include <logdepthbuf_pars_vertex>
  3034. #include <clipping_planes_pars_vertex>
  3035. void main() {
  3036. #include <uv_vertex>
  3037. #include <batching_vertex>
  3038. #include <beginnormal_vertex>
  3039. #include <morphinstance_vertex>
  3040. #include <morphnormal_vertex>
  3041. #include <skinbase_vertex>
  3042. #include <skinnormal_vertex>
  3043. #include <defaultnormal_vertex>
  3044. #include <normal_vertex>
  3045. #include <begin_vertex>
  3046. #include <morphtarget_vertex>
  3047. #include <skinning_vertex>
  3048. #include <displacementmap_vertex>
  3049. #include <project_vertex>
  3050. #include <logdepthbuf_vertex>
  3051. #include <clipping_planes_vertex>
  3052. #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
  3053. vViewPosition = - mvPosition.xyz;
  3054. #endif
  3055. }`,DQ=`#define NORMAL
  3056. uniform float opacity;
  3057. #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
  3058. varying vec3 vViewPosition;
  3059. #endif
  3060. #include <packing>
  3061. #include <uv_pars_fragment>
  3062. #include <normal_pars_fragment>
  3063. #include <bumpmap_pars_fragment>
  3064. #include <normalmap_pars_fragment>
  3065. #include <logdepthbuf_pars_fragment>
  3066. #include <clipping_planes_pars_fragment>
  3067. void main() {
  3068. vec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity );
  3069. #include <clipping_planes_fragment>
  3070. #include <logdepthbuf_fragment>
  3071. #include <normal_fragment_begin>
  3072. #include <normal_fragment_maps>
  3073. gl_FragColor = vec4( packNormalToRGB( normal ), diffuseColor.a );
  3074. #ifdef OPAQUE
  3075. gl_FragColor.a = 1.0;
  3076. #endif
  3077. }`,NQ=`#define PHONG
  3078. varying vec3 vViewPosition;
  3079. #include <common>
  3080. #include <batching_pars_vertex>
  3081. #include <uv_pars_vertex>
  3082. #include <displacementmap_pars_vertex>
  3083. #include <envmap_pars_vertex>
  3084. #include <color_pars_vertex>
  3085. #include <fog_pars_vertex>
  3086. #include <normal_pars_vertex>
  3087. #include <morphtarget_pars_vertex>
  3088. #include <skinning_pars_vertex>
  3089. #include <shadowmap_pars_vertex>
  3090. #include <logdepthbuf_pars_vertex>
  3091. #include <clipping_planes_pars_vertex>
  3092. void main() {
  3093. #include <uv_vertex>
  3094. #include <color_vertex>
  3095. #include <morphcolor_vertex>
  3096. #include <batching_vertex>
  3097. #include <beginnormal_vertex>
  3098. #include <morphinstance_vertex>
  3099. #include <morphnormal_vertex>
  3100. #include <skinbase_vertex>
  3101. #include <skinnormal_vertex>
  3102. #include <defaultnormal_vertex>
  3103. #include <normal_vertex>
  3104. #include <begin_vertex>
  3105. #include <morphtarget_vertex>
  3106. #include <skinning_vertex>
  3107. #include <displacementmap_vertex>
  3108. #include <project_vertex>
  3109. #include <logdepthbuf_vertex>
  3110. #include <clipping_planes_vertex>
  3111. vViewPosition = - mvPosition.xyz;
  3112. #include <worldpos_vertex>
  3113. #include <envmap_vertex>
  3114. #include <shadowmap_vertex>
  3115. #include <fog_vertex>
  3116. }`,OQ=`#define PHONG
  3117. uniform vec3 diffuse;
  3118. uniform vec3 emissive;
  3119. uniform vec3 specular;
  3120. uniform float shininess;
  3121. uniform float opacity;
  3122. #include <common>
  3123. #include <packing>
  3124. #include <dithering_pars_fragment>
  3125. #include <color_pars_fragment>
  3126. #include <uv_pars_fragment>
  3127. #include <map_pars_fragment>
  3128. #include <alphamap_pars_fragment>
  3129. #include <alphatest_pars_fragment>
  3130. #include <alphahash_pars_fragment>
  3131. #include <aomap_pars_fragment>
  3132. #include <lightmap_pars_fragment>
  3133. #include <emissivemap_pars_fragment>
  3134. #include <envmap_common_pars_fragment>
  3135. #include <envmap_pars_fragment>
  3136. #include <fog_pars_fragment>
  3137. #include <bsdfs>
  3138. #include <lights_pars_begin>
  3139. #include <normal_pars_fragment>
  3140. #include <lights_phong_pars_fragment>
  3141. #include <shadowmap_pars_fragment>
  3142. #include <bumpmap_pars_fragment>
  3143. #include <normalmap_pars_fragment>
  3144. #include <specularmap_pars_fragment>
  3145. #include <logdepthbuf_pars_fragment>
  3146. #include <clipping_planes_pars_fragment>
  3147. void main() {
  3148. vec4 diffuseColor = vec4( diffuse, opacity );
  3149. #include <clipping_planes_fragment>
  3150. ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
  3151. vec3 totalEmissiveRadiance = emissive;
  3152. #include <logdepthbuf_fragment>
  3153. #include <map_fragment>
  3154. #include <color_fragment>
  3155. #include <alphamap_fragment>
  3156. #include <alphatest_fragment>
  3157. #include <alphahash_fragment>
  3158. #include <specularmap_fragment>
  3159. #include <normal_fragment_begin>
  3160. #include <normal_fragment_maps>
  3161. #include <emissivemap_fragment>
  3162. #include <lights_phong_fragment>
  3163. #include <lights_fragment_begin>
  3164. #include <lights_fragment_maps>
  3165. #include <lights_fragment_end>
  3166. #include <aomap_fragment>
  3167. vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;
  3168. #include <envmap_fragment>
  3169. #include <opaque_fragment>
  3170. #include <tonemapping_fragment>
  3171. #include <colorspace_fragment>
  3172. #include <fog_fragment>
  3173. #include <premultiplied_alpha_fragment>
  3174. #include <dithering_fragment>
  3175. }`,LQ=`#define STANDARD
  3176. varying vec3 vViewPosition;
  3177. #ifdef USE_TRANSMISSION
  3178. varying vec3 vWorldPosition;
  3179. #endif
  3180. #include <common>
  3181. #include <batching_pars_vertex>
  3182. #include <uv_pars_vertex>
  3183. #include <displacementmap_pars_vertex>
  3184. #include <color_pars_vertex>
  3185. #include <fog_pars_vertex>
  3186. #include <normal_pars_vertex>
  3187. #include <morphtarget_pars_vertex>
  3188. #include <skinning_pars_vertex>
  3189. #include <shadowmap_pars_vertex>
  3190. #include <logdepthbuf_pars_vertex>
  3191. #include <clipping_planes_pars_vertex>
  3192. void main() {
  3193. #include <uv_vertex>
  3194. #include <color_vertex>
  3195. #include <morphinstance_vertex>
  3196. #include <morphcolor_vertex>
  3197. #include <batching_vertex>
  3198. #include <beginnormal_vertex>
  3199. #include <morphnormal_vertex>
  3200. #include <skinbase_vertex>
  3201. #include <skinnormal_vertex>
  3202. #include <defaultnormal_vertex>
  3203. #include <normal_vertex>
  3204. #include <begin_vertex>
  3205. #include <morphtarget_vertex>
  3206. #include <skinning_vertex>
  3207. #include <displacementmap_vertex>
  3208. #include <project_vertex>
  3209. #include <logdepthbuf_vertex>
  3210. #include <clipping_planes_vertex>
  3211. vViewPosition = - mvPosition.xyz;
  3212. #include <worldpos_vertex>
  3213. #include <shadowmap_vertex>
  3214. #include <fog_vertex>
  3215. #ifdef USE_TRANSMISSION
  3216. vWorldPosition = worldPosition.xyz;
  3217. #endif
  3218. }`,IQ=`#define STANDARD
  3219. #ifdef PHYSICAL
  3220. #define IOR
  3221. #define USE_SPECULAR
  3222. #endif
  3223. uniform vec3 diffuse;
  3224. uniform vec3 emissive;
  3225. uniform float roughness;
  3226. uniform float metalness;
  3227. uniform float opacity;
  3228. #ifdef IOR
  3229. uniform float ior;
  3230. #endif
  3231. #ifdef USE_SPECULAR
  3232. uniform float specularIntensity;
  3233. uniform vec3 specularColor;
  3234. #ifdef USE_SPECULAR_COLORMAP
  3235. uniform sampler2D specularColorMap;
  3236. #endif
  3237. #ifdef USE_SPECULAR_INTENSITYMAP
  3238. uniform sampler2D specularIntensityMap;
  3239. #endif
  3240. #endif
  3241. #ifdef USE_CLEARCOAT
  3242. uniform float clearcoat;
  3243. uniform float clearcoatRoughness;
  3244. #endif
  3245. #ifdef USE_DISPERSION
  3246. uniform float dispersion;
  3247. #endif
  3248. #ifdef USE_IRIDESCENCE
  3249. uniform float iridescence;
  3250. uniform float iridescenceIOR;
  3251. uniform float iridescenceThicknessMinimum;
  3252. uniform float iridescenceThicknessMaximum;
  3253. #endif
  3254. #ifdef USE_SHEEN
  3255. uniform vec3 sheenColor;
  3256. uniform float sheenRoughness;
  3257. #ifdef USE_SHEEN_COLORMAP
  3258. uniform sampler2D sheenColorMap;
  3259. #endif
  3260. #ifdef USE_SHEEN_ROUGHNESSMAP
  3261. uniform sampler2D sheenRoughnessMap;
  3262. #endif
  3263. #endif
  3264. #ifdef USE_ANISOTROPY
  3265. uniform vec2 anisotropyVector;
  3266. #ifdef USE_ANISOTROPYMAP
  3267. uniform sampler2D anisotropyMap;
  3268. #endif
  3269. #endif
  3270. varying vec3 vViewPosition;
  3271. #include <common>
  3272. #include <packing>
  3273. #include <dithering_pars_fragment>
  3274. #include <color_pars_fragment>
  3275. #include <uv_pars_fragment>
  3276. #include <map_pars_fragment>
  3277. #include <alphamap_pars_fragment>
  3278. #include <alphatest_pars_fragment>
  3279. #include <alphahash_pars_fragment>
  3280. #include <aomap_pars_fragment>
  3281. #include <lightmap_pars_fragment>
  3282. #include <emissivemap_pars_fragment>
  3283. #include <iridescence_fragment>
  3284. #include <cube_uv_reflection_fragment>
  3285. #include <envmap_common_pars_fragment>
  3286. #include <envmap_physical_pars_fragment>
  3287. #include <fog_pars_fragment>
  3288. #include <lights_pars_begin>
  3289. #include <normal_pars_fragment>
  3290. #include <lights_physical_pars_fragment>
  3291. #include <transmission_pars_fragment>
  3292. #include <shadowmap_pars_fragment>
  3293. #include <bumpmap_pars_fragment>
  3294. #include <normalmap_pars_fragment>
  3295. #include <clearcoat_pars_fragment>
  3296. #include <iridescence_pars_fragment>
  3297. #include <roughnessmap_pars_fragment>
  3298. #include <metalnessmap_pars_fragment>
  3299. #include <logdepthbuf_pars_fragment>
  3300. #include <clipping_planes_pars_fragment>
  3301. void main() {
  3302. vec4 diffuseColor = vec4( diffuse, opacity );
  3303. #include <clipping_planes_fragment>
  3304. ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
  3305. vec3 totalEmissiveRadiance = emissive;
  3306. #include <logdepthbuf_fragment>
  3307. #include <map_fragment>
  3308. #include <color_fragment>
  3309. #include <alphamap_fragment>
  3310. #include <alphatest_fragment>
  3311. #include <alphahash_fragment>
  3312. #include <roughnessmap_fragment>
  3313. #include <metalnessmap_fragment>
  3314. #include <normal_fragment_begin>
  3315. #include <normal_fragment_maps>
  3316. #include <clearcoat_normal_fragment_begin>
  3317. #include <clearcoat_normal_fragment_maps>
  3318. #include <emissivemap_fragment>
  3319. #include <lights_physical_fragment>
  3320. #include <lights_fragment_begin>
  3321. #include <lights_fragment_maps>
  3322. #include <lights_fragment_end>
  3323. #include <aomap_fragment>
  3324. vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;
  3325. vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;
  3326. #include <transmission_fragment>
  3327. vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;
  3328. #ifdef USE_SHEEN
  3329. float sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );
  3330. outgoingLight = outgoingLight * sheenEnergyComp + sheenSpecularDirect + sheenSpecularIndirect;
  3331. #endif
  3332. #ifdef USE_CLEARCOAT
  3333. float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );
  3334. vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );
  3335. outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat;
  3336. #endif
  3337. #include <opaque_fragment>
  3338. #include <tonemapping_fragment>
  3339. #include <colorspace_fragment>
  3340. #include <fog_fragment>
  3341. #include <premultiplied_alpha_fragment>
  3342. #include <dithering_fragment>
  3343. }`,UQ=`#define TOON
  3344. varying vec3 vViewPosition;
  3345. #include <common>
  3346. #include <batching_pars_vertex>
  3347. #include <uv_pars_vertex>
  3348. #include <displacementmap_pars_vertex>
  3349. #include <color_pars_vertex>
  3350. #include <fog_pars_vertex>
  3351. #include <normal_pars_vertex>
  3352. #include <morphtarget_pars_vertex>
  3353. #include <skinning_pars_vertex>
  3354. #include <shadowmap_pars_vertex>
  3355. #include <logdepthbuf_pars_vertex>
  3356. #include <clipping_planes_pars_vertex>
  3357. void main() {
  3358. #include <uv_vertex>
  3359. #include <color_vertex>
  3360. #include <morphinstance_vertex>
  3361. #include <morphcolor_vertex>
  3362. #include <batching_vertex>
  3363. #include <beginnormal_vertex>
  3364. #include <morphnormal_vertex>
  3365. #include <skinbase_vertex>
  3366. #include <skinnormal_vertex>
  3367. #include <defaultnormal_vertex>
  3368. #include <normal_vertex>
  3369. #include <begin_vertex>
  3370. #include <morphtarget_vertex>
  3371. #include <skinning_vertex>
  3372. #include <displacementmap_vertex>
  3373. #include <project_vertex>
  3374. #include <logdepthbuf_vertex>
  3375. #include <clipping_planes_vertex>
  3376. vViewPosition = - mvPosition.xyz;
  3377. #include <worldpos_vertex>
  3378. #include <shadowmap_vertex>
  3379. #include <fog_vertex>
  3380. }`,kQ=`#define TOON
  3381. uniform vec3 diffuse;
  3382. uniform vec3 emissive;
  3383. uniform float opacity;
  3384. #include <common>
  3385. #include <packing>
  3386. #include <dithering_pars_fragment>
  3387. #include <color_pars_fragment>
  3388. #include <uv_pars_fragment>
  3389. #include <map_pars_fragment>
  3390. #include <alphamap_pars_fragment>
  3391. #include <alphatest_pars_fragment>
  3392. #include <alphahash_pars_fragment>
  3393. #include <aomap_pars_fragment>
  3394. #include <lightmap_pars_fragment>
  3395. #include <emissivemap_pars_fragment>
  3396. #include <gradientmap_pars_fragment>
  3397. #include <fog_pars_fragment>
  3398. #include <bsdfs>
  3399. #include <lights_pars_begin>
  3400. #include <normal_pars_fragment>
  3401. #include <lights_toon_pars_fragment>
  3402. #include <shadowmap_pars_fragment>
  3403. #include <bumpmap_pars_fragment>
  3404. #include <normalmap_pars_fragment>
  3405. #include <logdepthbuf_pars_fragment>
  3406. #include <clipping_planes_pars_fragment>
  3407. void main() {
  3408. vec4 diffuseColor = vec4( diffuse, opacity );
  3409. #include <clipping_planes_fragment>
  3410. ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
  3411. vec3 totalEmissiveRadiance = emissive;
  3412. #include <logdepthbuf_fragment>
  3413. #include <map_fragment>
  3414. #include <color_fragment>
  3415. #include <alphamap_fragment>
  3416. #include <alphatest_fragment>
  3417. #include <alphahash_fragment>
  3418. #include <normal_fragment_begin>
  3419. #include <normal_fragment_maps>
  3420. #include <emissivemap_fragment>
  3421. #include <lights_toon_fragment>
  3422. #include <lights_fragment_begin>
  3423. #include <lights_fragment_maps>
  3424. #include <lights_fragment_end>
  3425. #include <aomap_fragment>
  3426. vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
  3427. #include <opaque_fragment>
  3428. #include <tonemapping_fragment>
  3429. #include <colorspace_fragment>
  3430. #include <fog_fragment>
  3431. #include <premultiplied_alpha_fragment>
  3432. #include <dithering_fragment>
  3433. }`,FQ=`uniform float size;
  3434. uniform float scale;
  3435. #include <common>
  3436. #include <color_pars_vertex>
  3437. #include <fog_pars_vertex>
  3438. #include <morphtarget_pars_vertex>
  3439. #include <logdepthbuf_pars_vertex>
  3440. #include <clipping_planes_pars_vertex>
  3441. #ifdef USE_POINTS_UV
  3442. varying vec2 vUv;
  3443. uniform mat3 uvTransform;
  3444. #endif
  3445. void main() {
  3446. #ifdef USE_POINTS_UV
  3447. vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
  3448. #endif
  3449. #include <color_vertex>
  3450. #include <morphinstance_vertex>
  3451. #include <morphcolor_vertex>
  3452. #include <begin_vertex>
  3453. #include <morphtarget_vertex>
  3454. #include <project_vertex>
  3455. gl_PointSize = size;
  3456. #ifdef USE_SIZEATTENUATION
  3457. bool isPerspective = isPerspectiveMatrix( projectionMatrix );
  3458. if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );
  3459. #endif
  3460. #include <logdepthbuf_vertex>
  3461. #include <clipping_planes_vertex>
  3462. #include <worldpos_vertex>
  3463. #include <fog_vertex>
  3464. }`,zQ=`uniform vec3 diffuse;
  3465. uniform float opacity;
  3466. #include <common>
  3467. #include <color_pars_fragment>
  3468. #include <map_particle_pars_fragment>
  3469. #include <alphatest_pars_fragment>
  3470. #include <alphahash_pars_fragment>
  3471. #include <fog_pars_fragment>
  3472. #include <logdepthbuf_pars_fragment>
  3473. #include <clipping_planes_pars_fragment>
  3474. void main() {
  3475. vec4 diffuseColor = vec4( diffuse, opacity );
  3476. #include <clipping_planes_fragment>
  3477. vec3 outgoingLight = vec3( 0.0 );
  3478. #include <logdepthbuf_fragment>
  3479. #include <map_particle_fragment>
  3480. #include <color_fragment>
  3481. #include <alphatest_fragment>
  3482. #include <alphahash_fragment>
  3483. outgoingLight = diffuseColor.rgb;
  3484. #include <opaque_fragment>
  3485. #include <tonemapping_fragment>
  3486. #include <colorspace_fragment>
  3487. #include <fog_fragment>
  3488. #include <premultiplied_alpha_fragment>
  3489. }`,BQ=`#include <common>
  3490. #include <batching_pars_vertex>
  3491. #include <fog_pars_vertex>
  3492. #include <morphtarget_pars_vertex>
  3493. #include <skinning_pars_vertex>
  3494. #include <logdepthbuf_pars_vertex>
  3495. #include <shadowmap_pars_vertex>
  3496. void main() {
  3497. #include <batching_vertex>
  3498. #include <beginnormal_vertex>
  3499. #include <morphinstance_vertex>
  3500. #include <morphnormal_vertex>
  3501. #include <skinbase_vertex>
  3502. #include <skinnormal_vertex>
  3503. #include <defaultnormal_vertex>
  3504. #include <begin_vertex>
  3505. #include <morphtarget_vertex>
  3506. #include <skinning_vertex>
  3507. #include <project_vertex>
  3508. #include <logdepthbuf_vertex>
  3509. #include <worldpos_vertex>
  3510. #include <shadowmap_vertex>
  3511. #include <fog_vertex>
  3512. }`,jQ=`uniform vec3 color;
  3513. uniform float opacity;
  3514. #include <common>
  3515. #include <packing>
  3516. #include <fog_pars_fragment>
  3517. #include <bsdfs>
  3518. #include <lights_pars_begin>
  3519. #include <logdepthbuf_pars_fragment>
  3520. #include <shadowmap_pars_fragment>
  3521. #include <shadowmask_pars_fragment>
  3522. void main() {
  3523. #include <logdepthbuf_fragment>
  3524. gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );
  3525. #include <tonemapping_fragment>
  3526. #include <colorspace_fragment>
  3527. #include <fog_fragment>
  3528. }`,HQ=`uniform float rotation;
  3529. uniform vec2 center;
  3530. #include <common>
  3531. #include <uv_pars_vertex>
  3532. #include <fog_pars_vertex>
  3533. #include <logdepthbuf_pars_vertex>
  3534. #include <clipping_planes_pars_vertex>
  3535. void main() {
  3536. #include <uv_vertex>
  3537. vec4 mvPosition = modelViewMatrix[ 3 ];
  3538. vec2 scale = vec2( length( modelMatrix[ 0 ].xyz ), length( modelMatrix[ 1 ].xyz ) );
  3539. #ifndef USE_SIZEATTENUATION
  3540. bool isPerspective = isPerspectiveMatrix( projectionMatrix );
  3541. if ( isPerspective ) scale *= - mvPosition.z;
  3542. #endif
  3543. vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;
  3544. vec2 rotatedPosition;
  3545. rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;
  3546. rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;
  3547. mvPosition.xy += rotatedPosition;
  3548. gl_Position = projectionMatrix * mvPosition;
  3549. #include <logdepthbuf_vertex>
  3550. #include <clipping_planes_vertex>
  3551. #include <fog_vertex>
  3552. }`,GQ=`uniform vec3 diffuse;
  3553. uniform float opacity;
  3554. #include <common>
  3555. #include <uv_pars_fragment>
  3556. #include <map_pars_fragment>
  3557. #include <alphamap_pars_fragment>
  3558. #include <alphatest_pars_fragment>
  3559. #include <alphahash_pars_fragment>
  3560. #include <fog_pars_fragment>
  3561. #include <logdepthbuf_pars_fragment>
  3562. #include <clipping_planes_pars_fragment>
  3563. void main() {
  3564. vec4 diffuseColor = vec4( diffuse, opacity );
  3565. #include <clipping_planes_fragment>
  3566. vec3 outgoingLight = vec3( 0.0 );
  3567. #include <logdepthbuf_fragment>
  3568. #include <map_fragment>
  3569. #include <alphamap_fragment>
  3570. #include <alphatest_fragment>
  3571. #include <alphahash_fragment>
  3572. outgoingLight = diffuseColor.rgb;
  3573. #include <opaque_fragment>
  3574. #include <tonemapping_fragment>
  3575. #include <colorspace_fragment>
  3576. #include <fog_fragment>
  3577. }`,Gt={alphahash_fragment:dK,alphahash_pars_fragment:fK,alphamap_fragment:hK,alphamap_pars_fragment:pK,alphatest_fragment:mK,alphatest_pars_fragment:gK,aomap_fragment:vK,aomap_pars_fragment:xK,batching_pars_vertex:yK,batching_vertex:bK,begin_vertex:_K,beginnormal_vertex:SK,bsdfs:wK,iridescence_fragment:EK,bumpmap_pars_fragment:MK,clipping_planes_fragment:AK,clipping_planes_pars_fragment:TK,clipping_planes_pars_vertex:CK,clipping_planes_vertex:RK,color_fragment:PK,color_pars_fragment:DK,color_pars_vertex:NK,color_vertex:OK,common:LK,cube_uv_reflection_fragment:IK,defaultnormal_vertex:UK,displacementmap_pars_vertex:kK,displacementmap_vertex:FK,emissivemap_fragment:zK,emissivemap_pars_fragment:BK,colorspace_fragment:jK,colorspace_pars_fragment:HK,envmap_fragment:GK,envmap_common_pars_fragment:VK,envmap_pars_fragment:$K,envmap_pars_vertex:WK,envmap_physical_pars_fragment:iZ,envmap_vertex:XK,fog_vertex:qK,fog_pars_vertex:YK,fog_fragment:KK,fog_pars_fragment:ZK,gradientmap_pars_fragment:QK,lightmap_pars_fragment:JK,lights_lambert_fragment:eZ,lights_lambert_pars_fragment:tZ,lights_pars_begin:nZ,lights_toon_fragment:rZ,lights_toon_pars_fragment:aZ,lights_phong_fragment:sZ,lights_phong_pars_fragment:oZ,lights_physical_fragment:lZ,lights_physical_pars_fragment:cZ,lights_fragment_begin:uZ,lights_fragment_maps:dZ,lights_fragment_end:fZ,logdepthbuf_fragment:hZ,logdepthbuf_pars_fragment:pZ,logdepthbuf_pars_vertex:mZ,logdepthbuf_vertex:gZ,map_fragment:vZ,map_pars_fragment:xZ,map_particle_fragment:yZ,map_particle_pars_fragment:bZ,metalnessmap_fragment:_Z,metalnessmap_pars_fragment:SZ,morphinstance_vertex:wZ,morphcolor_vertex:EZ,morphnormal_vertex:MZ,morphtarget_pars_vertex:AZ,morphtarget_vertex:TZ,normal_fragment_begin:CZ,normal_fragment_maps:RZ,normal_pars_fragment:PZ,normal_pars_vertex:DZ,normal_vertex:NZ,normalmap_pars_fragment:OZ,clearcoat_normal_fragment_begin:LZ,clearcoat_normal_fragment_maps:IZ,clearcoat_pars_fragment:UZ,iridescence_pars_fragment:kZ,opaque_fragment:FZ,packing:zZ,premultiplied_alpha_fragment:BZ,project_vertex:jZ,dithering_fragment:HZ,dithering_pars_fragment:GZ,roughnessmap_fragment:VZ,roughnessmap_pars_fragment:$Z,shadowmap_pars_fragment:WZ,shadowmap_pars_vertex:XZ,shadowmap_vertex:qZ,shadowmask_pars_fragment:YZ,skinbase_vertex:KZ,skinning_pars_vertex:ZZ,skinning_vertex:QZ,skinnormal_vertex:JZ,specularmap_fragment:eQ,specularmap_pars_fragment:tQ,tonemapping_fragment:nQ,tonemapping_pars_fragment:iQ,transmission_fragment:rQ,transmission_pars_fragment:aQ,uv_pars_fragment:sQ,uv_pars_vertex:oQ,uv_vertex:lQ,worldpos_vertex:cQ,background_vert:uQ,background_frag:dQ,backgroundCube_vert:fQ,backgroundCube_frag:hQ,cube_vert:pQ,cube_frag:mQ,depth_vert:gQ,depth_frag:vQ,distanceRGBA_vert:xQ,distanceRGBA_frag:yQ,equirect_vert:bQ,equirect_frag:_Q,linedashed_vert:SQ,linedashed_frag:wQ,meshbasic_vert:EQ,meshbasic_frag:MQ,meshlambert_vert:AQ,meshlambert_frag:TQ,meshmatcap_vert:CQ,meshmatcap_frag:RQ,meshnormal_vert:PQ,meshnormal_frag:DQ,meshphong_vert:NQ,meshphong_frag:OQ,meshphysical_vert:LQ,meshphysical_frag:IQ,meshtoon_vert:UQ,meshtoon_frag:kQ,points_vert:FQ,points_frag:zQ,shadow_vert:BQ,shadow_frag:jQ,sprite_vert:HQ,sprite_frag:GQ},vt={common:{diffuse:{value:new nn(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Xt},alphaMap:{value:null},alphaMapTransform:{value:new Xt},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Xt}},envmap:{envMap:{value:null},envMapRotation:{value:new Xt},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98},dfgLUT:{value:null}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new Xt}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Xt}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Xt},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Xt},normalScale:{value:new $t(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Xt},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new Xt}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new Xt}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new Xt}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new nn(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,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 nn(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new Xt},alphaTest:{value:0},uvTransform:{value:new Xt}},sprite:{diffuse:{value:new nn(16777215)},opacity:{value:1},center:{value:new $t(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new Xt},alphaMap:{value:null},alphaMapTransform:{value:new Xt},alphaTest:{value:0}}},Ns={basic:{uniforms:Pr([vt.common,vt.specularmap,vt.envmap,vt.aomap,vt.lightmap,vt.fog]),vertexShader:Gt.meshbasic_vert,fragmentShader:Gt.meshbasic_frag},lambert:{uniforms:Pr([vt.common,vt.specularmap,vt.envmap,vt.aomap,vt.lightmap,vt.emissivemap,vt.bumpmap,vt.normalmap,vt.displacementmap,vt.fog,vt.lights,{emissive:{value:new nn(0)}}]),vertexShader:Gt.meshlambert_vert,fragmentShader:Gt.meshlambert_frag},phong:{uniforms:Pr([vt.common,vt.specularmap,vt.envmap,vt.aomap,vt.lightmap,vt.emissivemap,vt.bumpmap,vt.normalmap,vt.displacementmap,vt.fog,vt.lights,{emissive:{value:new nn(0)},specular:{value:new nn(1118481)},shininess:{value:30}}]),vertexShader:Gt.meshphong_vert,fragmentShader:Gt.meshphong_frag},standard:{uniforms:Pr([vt.common,vt.envmap,vt.aomap,vt.lightmap,vt.emissivemap,vt.bumpmap,vt.normalmap,vt.displacementmap,vt.roughnessmap,vt.metalnessmap,vt.fog,vt.lights,{emissive:{value:new nn(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Gt.meshphysical_vert,fragmentShader:Gt.meshphysical_frag},toon:{uniforms:Pr([vt.common,vt.aomap,vt.lightmap,vt.emissivemap,vt.bumpmap,vt.normalmap,vt.displacementmap,vt.gradientmap,vt.fog,vt.lights,{emissive:{value:new nn(0)}}]),vertexShader:Gt.meshtoon_vert,fragmentShader:Gt.meshtoon_frag},matcap:{uniforms:Pr([vt.common,vt.bumpmap,vt.normalmap,vt.displacementmap,vt.fog,{matcap:{value:null}}]),vertexShader:Gt.meshmatcap_vert,fragmentShader:Gt.meshmatcap_frag},points:{uniforms:Pr([vt.points,vt.fog]),vertexShader:Gt.points_vert,fragmentShader:Gt.points_frag},dashed:{uniforms:Pr([vt.common,vt.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Gt.linedashed_vert,fragmentShader:Gt.linedashed_frag},depth:{uniforms:Pr([vt.common,vt.displacementmap]),vertexShader:Gt.depth_vert,fragmentShader:Gt.depth_frag},normal:{uniforms:Pr([vt.common,vt.bumpmap,vt.normalmap,vt.displacementmap,{opacity:{value:1}}]),vertexShader:Gt.meshnormal_vert,fragmentShader:Gt.meshnormal_frag},sprite:{uniforms:Pr([vt.sprite,vt.fog]),vertexShader:Gt.sprite_vert,fragmentShader:Gt.sprite_frag},background:{uniforms:{uvTransform:{value:new Xt},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Gt.background_vert,fragmentShader:Gt.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new Xt}},vertexShader:Gt.backgroundCube_vert,fragmentShader:Gt.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Gt.cube_vert,fragmentShader:Gt.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Gt.equirect_vert,fragmentShader:Gt.equirect_frag},distanceRGBA:{uniforms:Pr([vt.common,vt.displacementmap,{referencePosition:{value:new Ve},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Gt.distanceRGBA_vert,fragmentShader:Gt.distanceRGBA_frag},shadow:{uniforms:Pr([vt.lights,vt.fog,{color:{value:new nn(0)},opacity:{value:1}}]),vertexShader:Gt.shadow_vert,fragmentShader:Gt.shadow_frag}};Ns.physical={uniforms:Pr([Ns.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new Xt},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new Xt},clearcoatNormalScale:{value:new $t(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new Xt},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new Xt},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new Xt},sheen:{value:0},sheenColor:{value:new nn(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new Xt},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new Xt},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new Xt},transmissionSamplerSize:{value:new $t},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Xt},attenuationDistance:{value:0},attenuationColor:{value:new nn(0)},specularColor:{value:new nn(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new Xt},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new Xt},anisotropyVector:{value:new $t},anisotropyMap:{value:null},anisotropyMapTransform:{value:new Xt}}]),vertexShader:Gt.meshphysical_vert,fragmentShader:Gt.meshphysical_frag};const R0={r:0,b:0,g:0},zc=new lc,VQ=new bi;function $Q(t,e,n,i,r,a,s){const l=new nn(0);let c=a===!0?0:1,d,f,h=null,g=0,m=null;function b(S){let A=S.isScene===!0?S.background:null;return A&&A.isTexture&&(A=(S.backgroundBlurriness>0?n:e).get(A)),A}function y(S){let A=!1;const R=b(S);R===null?v(l,c):R&&R.isColor&&(v(R,1),A=!0);const N=t.xr.getEnvironmentBlendMode();N==="additive"?i.buffers.color.setClear(0,0,0,1,s):N==="alpha-blend"&&i.buffers.color.setClear(0,0,0,0,s),(t.autoClear||A)&&(i.buffers.depth.setTest(!0),i.buffers.depth.setMask(!0),i.buffers.color.setMask(!0),t.clear(t.autoClearColor,t.autoClearDepth,t.autoClearStencil))}function x(S,A){const R=b(A);R&&(R.isCubeTexture||R.mapping===fy)?(f===void 0&&(f=new Hs(new RT(1,1,1),new $o({name:"BackgroundCubeMaterial",uniforms:_f(Ns.backgroundCube.uniforms),vertexShader:Ns.backgroundCube.vertexShader,fragmentShader:Ns.backgroundCube.fragmentShader,side:Kr,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),f.geometry.deleteAttribute("normal"),f.geometry.deleteAttribute("uv"),f.onBeforeRender=function(N,C,F){this.matrixWorld.copyPosition(F.matrixWorld)},Object.defineProperty(f.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),r.update(f)),zc.copy(A.backgroundRotation),zc.x*=-1,zc.y*=-1,zc.z*=-1,R.isCubeTexture&&R.isRenderTargetTexture===!1&&(zc.y*=-1,zc.z*=-1),f.material.uniforms.envMap.value=R,f.material.uniforms.flipEnvMap.value=R.isCubeTexture&&R.isRenderTargetTexture===!1?-1:1,f.material.uniforms.backgroundBlurriness.value=A.backgroundBlurriness,f.material.uniforms.backgroundIntensity.value=A.backgroundIntensity,f.material.uniforms.backgroundRotation.value.setFromMatrix4(VQ.makeRotationFromEuler(zc)),f.material.toneMapped=un.getTransfer(R.colorSpace)!==En,(h!==R||g!==R.version||m!==t.toneMapping)&&(f.material.needsUpdate=!0,h=R,g=R.version,m=t.toneMapping),f.layers.enableAll(),S.unshift(f,f.geometry,f.material,0,0,null)):R&&R.isTexture&&(d===void 0&&(d=new Hs(new DT(2,2),new $o({name:"BackgroundMaterial",uniforms:_f(Ns.background.uniforms),vertexShader:Ns.background.vertexShader,fragmentShader:Ns.background.fragmentShader,side:oc,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),d.geometry.deleteAttribute("normal"),Object.defineProperty(d.material,"map",{get:function(){return this.uniforms.t2D.value}}),r.update(d)),d.material.uniforms.t2D.value=R,d.material.uniforms.backgroundIntensity.value=A.backgroundIntensity,d.material.toneMapped=un.getTransfer(R.colorSpace)!==En,R.matrixAutoUpdate===!0&&R.updateMatrix(),d.material.uniforms.uvTransform.value.copy(R.matrix),(h!==R||g!==R.version||m!==t.toneMapping)&&(d.material.needsUpdate=!0,h=R,g=R.version,m=t.toneMapping),d.layers.enableAll(),S.unshift(d,d.geometry,d.material,0,0,null))}function v(S,A){S.getRGB(R0,cB(t)),i.buffers.color.setClear(R0.r,R0.g,R0.b,A,s)}function w(){f!==void 0&&(f.geometry.dispose(),f.material.dispose(),f=void 0),d!==void 0&&(d.geometry.dispose(),d.material.dispose(),d=void 0)}return{getClearColor:function(){return l},setClearColor:function(S,A=1){l.set(S),c=A,v(l,c)},getClearAlpha:function(){return c},setClearAlpha:function(S){c=S,v(l,c)},render:y,addToRenderList:x,dispose:w}}function WQ(t,e){const n=t.getParameter(t.MAX_VERTEX_ATTRIBS),i={},r=g(null);let a=r,s=!1;function l(L,B,U,$,I){let W=!1;const X=h($,U,B);a!==X&&(a=X,d(a.object)),W=m(L,$,U,I),W&&b(L,$,U,I),I!==null&&e.update(I,t.ELEMENT_ARRAY_BUFFER),(W||s)&&(s=!1,A(L,B,U,$),I!==null&&t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,e.get(I).buffer))}function c(){return t.createVertexArray()}function d(L){return t.bindVertexArray(L)}function f(L){return t.deleteVertexArray(L)}function h(L,B,U){const $=U.wireframe===!0;let I=i[L.id];I===void 0&&(I={},i[L.id]=I);let W=I[B.id];W===void 0&&(W={},I[B.id]=W);let X=W[$];return X===void 0&&(X=g(c()),W[$]=X),X}function g(L){const B=[],U=[],$=[];for(let I=0;I<n;I++)B[I]=0,U[I]=0,$[I]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:B,enabledAttributes:U,attributeDivisors:$,object:L,attributes:{},index:null}}function m(L,B,U,$){const I=a.attributes,W=B.attributes;let X=0;const V=U.getAttributes();for(const Y in V)if(V[Y].location>=0){const se=I[Y];let H=W[Y];if(H===void 0&&(Y==="instanceMatrix"&&L.instanceMatrix&&(H=L.instanceMatrix),Y==="instanceColor"&&L.instanceColor&&(H=L.instanceColor)),se===void 0||se.attribute!==H||H&&se.data!==H.data)return!0;X++}return a.attributesNum!==X||a.index!==$}function b(L,B,U,$){const I={},W=B.attributes;let X=0;const V=U.getAttributes();for(const Y in V)if(V[Y].location>=0){let se=W[Y];se===void 0&&(Y==="instanceMatrix"&&L.instanceMatrix&&(se=L.instanceMatrix),Y==="instanceColor"&&L.instanceColor&&(se=L.instanceColor));const H={};H.attribute=se,se&&se.data&&(H.data=se.data),I[Y]=H,X++}a.attributes=I,a.attributesNum=X,a.index=$}function y(){const L=a.newAttributes;for(let B=0,U=L.length;B<U;B++)L[B]=0}function x(L){v(L,0)}function v(L,B){const U=a.newAttributes,$=a.enabledAttributes,I=a.attributeDivisors;U[L]=1,$[L]===0&&(t.enableVertexAttribArray(L),$[L]=1),I[L]!==B&&(t.vertexAttribDivisor(L,B),I[L]=B)}function w(){const L=a.newAttributes,B=a.enabledAttributes;for(let U=0,$=B.length;U<$;U++)B[U]!==L[U]&&(t.disableVertexAttribArray(U),B[U]=0)}function S(L,B,U,$,I,W,X){X===!0?t.vertexAttribIPointer(L,B,U,I,W):t.vertexAttribPointer(L,B,U,$,I,W)}function A(L,B,U,$){y();const I=$.attributes,W=U.getAttributes(),X=B.defaultAttributeValues;for(const V in W){const Y=W[V];if(Y.location>=0){let J=I[V];if(J===void 0&&(V==="instanceMatrix"&&L.instanceMatrix&&(J=L.instanceMatrix),V==="instanceColor"&&L.instanceColor&&(J=L.instanceColor)),J!==void 0){const se=J.normalized,H=J.itemSize,q=e.get(J);if(q===void 0)continue;const re=q.buffer,ce=q.type,ye=q.bytesPerElement,me=ce===t.INT||ce===t.UNSIGNED_INT||J.gpuType===yT;if(J.isInterleavedBufferAttribute){const be=J.data,Ne=be.stride,he=J.offset;if(be.isInstancedInterleavedBuffer){for(let Ae=0;Ae<Y.locationSize;Ae++)v(Y.location+Ae,be.meshPerAttribute);L.isInstancedMesh!==!0&&$._maxInstanceCount===void 0&&($._maxInstanceCount=be.meshPerAttribute*be.count)}else for(let Ae=0;Ae<Y.locationSize;Ae++)x(Y.location+Ae);t.bindBuffer(t.ARRAY_BUFFER,re);for(let Ae=0;Ae<Y.locationSize;Ae++)S(Y.location+Ae,H/Y.locationSize,ce,se,Ne*ye,(he+H/Y.locationSize*Ae)*ye,me)}else{if(J.isInstancedBufferAttribute){for(let be=0;be<Y.locationSize;be++)v(Y.location+be,J.meshPerAttribute);L.isInstancedMesh!==!0&&$._maxInstanceCount===void 0&&($._maxInstanceCount=J.meshPerAttribute*J.count)}else for(let be=0;be<Y.locationSize;be++)x(Y.location+be);t.bindBuffer(t.ARRAY_BUFFER,re);for(let be=0;be<Y.locationSize;be++)S(Y.location+be,H/Y.locationSize,ce,se,H*ye,H/Y.locationSize*be*ye,me)}}else if(X!==void 0){const se=X[V];if(se!==void 0)switch(se.length){case 2:t.vertexAttrib2fv(Y.location,se);break;case 3:t.vertexAttrib3fv(Y.location,se);break;case 4:t.vertexAttrib4fv(Y.location,se);break;default:t.vertexAttrib1fv(Y.location,se)}}}}w()}function R(){F();for(const L in i){const B=i[L];for(const U in B){const $=B[U];for(const I in $)f($[I].object),delete $[I];delete B[U]}delete i[L]}}function N(L){if(i[L.id]===void 0)return;const B=i[L.id];for(const U in B){const $=B[U];for(const I in $)f($[I].object),delete $[I];delete B[U]}delete i[L.id]}function C(L){for(const B in i){const U=i[B];if(U[L.id]===void 0)continue;const $=U[L.id];for(const I in $)f($[I].object),delete $[I];delete U[L.id]}}function F(){P(),s=!0,a!==r&&(a=r,d(a.object))}function P(){r.geometry=null,r.program=null,r.wireframe=!1}return{setup:l,reset:F,resetDefaultState:P,dispose:R,releaseStatesOfGeometry:N,releaseStatesOfProgram:C,initAttributes:y,enableAttribute:x,disableUnusedAttributes:w}}function XQ(t,e,n){let i;function r(d){i=d}function a(d,f){t.drawArrays(i,d,f),n.update(f,i,1)}function s(d,f,h){h!==0&&(t.drawArraysInstanced(i,d,f,h),n.update(f,i,h))}function l(d,f,h){if(h===0)return;e.get("WEBGL_multi_draw").multiDrawArraysWEBGL(i,d,0,f,0,h);let m=0;for(let b=0;b<h;b++)m+=f[b];n.update(m,i,1)}function c(d,f,h,g){if(h===0)return;const m=e.get("WEBGL_multi_draw");if(m===null)for(let b=0;b<d.length;b++)s(d[b],f[b],g[b]);else{m.multiDrawArraysInstancedWEBGL(i,d,0,f,0,g,0,h);let b=0;for(let y=0;y<h;y++)b+=f[y]*g[y];n.update(b,i,1)}}this.setMode=r,this.render=a,this.renderInstances=s,this.renderMultiDraw=l,this.renderMultiDrawInstances=c}function qQ(t,e,n,i){let r;function a(){if(r!==void 0)return r;if(e.has("EXT_texture_filter_anisotropic")===!0){const C=e.get("EXT_texture_filter_anisotropic");r=t.getParameter(C.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else r=0;return r}function s(C){return!(C!==ms&&i.convert(C)!==t.getParameter(t.IMPLEMENTATION_COLOR_READ_FORMAT))}function l(C){const F=C===Bf&&(e.has("EXT_color_buffer_half_float")||e.has("EXT_color_buffer_float"));return!(C!==js&&i.convert(C)!==t.getParameter(t.IMPLEMENTATION_COLOR_READ_TYPE)&&C!==Lo&&!F)}function c(C){if(C==="highp"){if(t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.HIGH_FLOAT).precision>0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.HIGH_FLOAT).precision>0)return"highp";C="mediump"}return C==="mediump"&&t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.MEDIUM_FLOAT).precision>0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let d=n.precision!==void 0?n.precision:"highp";const f=c(d);f!==d&&(It("WebGLRenderer:",d,"not supported, using",f,"instead."),d=f);const h=n.logarithmicDepthBuffer===!0,g=n.reversedDepthBuffer===!0&&e.has("EXT_clip_control"),m=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),b=t.getParameter(t.MAX_VERTEX_TEXTURE_IMAGE_UNITS),y=t.getParameter(t.MAX_TEXTURE_SIZE),x=t.getParameter(t.MAX_CUBE_MAP_TEXTURE_SIZE),v=t.getParameter(t.MAX_VERTEX_ATTRIBS),w=t.getParameter(t.MAX_VERTEX_UNIFORM_VECTORS),S=t.getParameter(t.MAX_VARYING_VECTORS),A=t.getParameter(t.MAX_FRAGMENT_UNIFORM_VECTORS),R=b>0,N=t.getParameter(t.MAX_SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:a,getMaxPrecision:c,textureFormatReadable:s,textureTypeReadable:l,precision:d,logarithmicDepthBuffer:h,reversedDepthBuffer:g,maxTextures:m,maxVertexTextures:b,maxTextureSize:y,maxCubemapSize:x,maxAttributes:v,maxVertexUniforms:w,maxVaryings:S,maxFragmentUniforms:A,vertexTextures:R,maxSamples:N}}function YQ(t){const e=this;let n=null,i=0,r=!1,a=!1;const s=new Vl,l=new Xt,c={value:null,needsUpdate:!1};this.uniform=c,this.numPlanes=0,this.numIntersection=0,this.init=function(h,g){const m=h.length!==0||g||i!==0||r;return r=g,i=h.length,m},this.beginShadows=function(){a=!0,f(null)},this.endShadows=function(){a=!1},this.setGlobalState=function(h,g){n=f(h,g,0)},this.setState=function(h,g,m){const b=h.clippingPlanes,y=h.clipIntersection,x=h.clipShadows,v=t.get(h);if(!r||b===null||b.length===0||a&&!x)a?f(null):d();else{const w=a?0:i,S=w*4;let A=v.clippingState||null;c.value=A,A=f(b,g,S,m);for(let R=0;R!==S;++R)A[R]=n[R];v.clippingState=A,this.numIntersection=y?this.numPlanes:0,this.numPlanes+=w}};function d(){c.value!==n&&(c.value=n,c.needsUpdate=i>0),e.numPlanes=i,e.numIntersection=0}function f(h,g,m,b){const y=h!==null?h.length:0;let x=null;if(y!==0){if(x=c.value,b!==!0||x===null){const v=m+y*4,w=g.matrixWorldInverse;l.getNormalMatrix(w),(x===null||x.length<v)&&(x=new Float32Array(v));for(let S=0,A=m;S!==y;++S,A+=4)s.copy(h[S]).applyMatrix4(w,l),s.normal.toArray(x,A),x[A+3]=s.constant}c.value=x,c.needsUpdate=!0}return e.numPlanes=y,e.numIntersection=0,x}}function KQ(t){let e=new WeakMap;function n(s,l){return l===eM?s.mapping=xf:l===tM&&(s.mapping=yf),s}function i(s){if(s&&s.isTexture){const l=s.mapping;if(l===eM||l===tM)if(e.has(s)){const c=e.get(s).texture;return n(c,s.mapping)}else{const c=s.image;if(c&&c.height>0){const d=new $Y(c.height);return d.fromEquirectangularTexture(t,s),e.set(s,d),s.addEventListener("dispose",r),n(d.texture,s.mapping)}else return null}}return s}function r(s){const l=s.target;l.removeEventListener("dispose",r);const c=e.get(l);c!==void 0&&(e.delete(l),c.dispose())}function a(){e=new WeakMap}return{get:i,dispose:a}}const Ql=4,XN=[.125,.215,.35,.446,.526,.582],Qc=20,ZQ=256,ip=new vB,qN=new nn;let t1=null,n1=0,i1=0,r1=!1;const QQ=new Ve;let YN=class{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._sizeLods=[],this._sigmas=[],this._lodMeshes=[],this._backgroundBox=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._blurMaterial=null,this._ggxMaterial=null}fromScene(e,n=0,i=.1,r=100,a={}){const{size:s=256,position:l=QQ}=a;t1=this._renderer.getRenderTarget(),n1=this._renderer.getActiveCubeFace(),i1=this._renderer.getActiveMipmapLevel(),r1=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(s);const c=this._allocateTargets();return c.depthBuffer=!0,this._sceneToCubeUV(e,i,r,c,l),n>0&&this._blur(c,0,0,n),this._applyPMREM(c),this._cleanup(c),c}fromEquirectangular(e,n=null){return this._fromTexture(e,n)}fromCubemap(e,n=null){return this._fromTexture(e,n)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=QN(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=ZN(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose(),this._backgroundBox!==null&&(this._backgroundBox.geometry.dispose(),this._backgroundBox.material.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._ggxMaterial!==null&&this._ggxMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodMeshes.length;e++)this._lodMeshes[e].geometry.dispose()}_cleanup(e){this._renderer.setRenderTarget(t1,n1,i1),this._renderer.xr.enabled=r1,e.scissorTest=!1,Rd(e,0,0,e.width,e.height)}_fromTexture(e,n){e.mapping===xf||e.mapping===yf?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),t1=this._renderer.getRenderTarget(),n1=this._renderer.getActiveCubeFace(),i1=this._renderer.getActiveMipmapLevel(),r1=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;const i=n||this._allocateTargets();return this._textureToCubeUV(e,i),this._applyPMREM(i),this._cleanup(i),i}_allocateTargets(){const e=3*Math.max(this._cubeSize,112),n=4*this._cubeSize,i={magFilter:$a,minFilter:$a,generateMipmaps:!1,type:Bf,format:ms,colorSpace:bf,depthBuffer:!1},r=KN(e,n,i);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==n){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=KN(e,n,i);const{_lodMax:a}=this;({lodMeshes:this._lodMeshes,sizeLods:this._sizeLods,sigmas:this._sigmas}=JQ(a)),this._blurMaterial=tJ(a,e,n),this._ggxMaterial=eJ(a,e,n)}return r}_compileMaterial(e){const n=new Hs(new Ks,e);this._renderer.compile(n,ip)}_sceneToCubeUV(e,n,i,r,a){const c=new ja(90,1,n,i),d=[1,-1,1,1,1,1],f=[1,1,1,-1,-1,-1],h=this._renderer,g=h.autoClear,m=h.toneMapping;h.getClearColor(qN),h.toneMapping=nc,h.autoClear=!1,h.state.buffers.depth.getReversed()&&(h.setRenderTarget(r),h.clearDepth(),h.setRenderTarget(null)),this._backgroundBox===null&&(this._backgroundBox=new Hs(new RT,new CT({name:"PMREM.Background",side:Kr,depthWrite:!1,depthTest:!1})));const y=this._backgroundBox,x=y.material;let v=!1;const w=e.background;w?w.isColor&&(x.color.copy(w),e.background=null,v=!0):(x.color.copy(qN),v=!0);for(let S=0;S<6;S++){const A=S%3;A===0?(c.up.set(0,d[S],0),c.position.set(a.x,a.y,a.z),c.lookAt(a.x+f[S],a.y,a.z)):A===1?(c.up.set(0,0,d[S]),c.position.set(a.x,a.y,a.z),c.lookAt(a.x,a.y+f[S],a.z)):(c.up.set(0,d[S],0),c.position.set(a.x,a.y,a.z),c.lookAt(a.x,a.y,a.z+f[S]));const R=this._cubeSize;Rd(r,A*R,S>2?R:0,R,R),h.setRenderTarget(r),v&&h.render(y,c),h.render(e,c)}h.toneMapping=m,h.autoClear=g,e.background=w}_textureToCubeUV(e,n){const i=this._renderer,r=e.mapping===xf||e.mapping===yf;r?(this._cubemapMaterial===null&&(this._cubemapMaterial=QN()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=ZN());const a=r?this._cubemapMaterial:this._equirectMaterial,s=this._lodMeshes[0];s.material=a;const l=a.uniforms;l.envMap.value=e;const c=this._cubeSize;Rd(n,0,0,3*c,2*c),i.setRenderTarget(n),i.render(s,ip)}_applyPMREM(e){const n=this._renderer,i=n.autoClear;n.autoClear=!1;const r=this._lodMeshes.length;for(let a=1;a<r;a++)this._applyGGXFilter(e,a-1,a);n.autoClear=i}_applyGGXFilter(e,n,i){const r=this._renderer,a=this._pingPongRenderTarget,s=this._ggxMaterial,l=this._lodMeshes[i];l.material=s;const c=s.uniforms,d=i/(this._lodMeshes.length-1),f=n/(this._lodMeshes.length-1),h=Math.sqrt(d*d-f*f),g=.05+d*.95,m=h*g,{_lodMax:b}=this,y=this._sizeLods[i],x=3*y*(i>b-Ql?i-b+Ql:0),v=4*(this._cubeSize-y);c.envMap.value=e.texture,c.roughness.value=m,c.mipInt.value=b-n,Rd(a,x,v,3*y,2*y),r.setRenderTarget(a),r.render(l,ip),c.envMap.value=a.texture,c.roughness.value=0,c.mipInt.value=b-i,Rd(e,x,v,3*y,2*y),r.setRenderTarget(e),r.render(l,ip)}_blur(e,n,i,r,a){const s=this._pingPongRenderTarget;this._halfBlur(e,s,n,i,r,"latitudinal",a),this._halfBlur(s,e,i,i,r,"longitudinal",a)}_halfBlur(e,n,i,r,a,s,l){const c=this._renderer,d=this._blurMaterial;s!=="latitudinal"&&s!=="longitudinal"&&ai("blur direction must be either latitudinal or longitudinal!");const f=3,h=this._lodMeshes[r];h.material=d;const g=d.uniforms,m=this._sizeLods[i]-1,b=isFinite(a)?Math.PI/(2*m):2*Math.PI/(2*Qc-1),y=a/b,x=isFinite(a)?1+Math.floor(f*y):Qc;x>Qc&&It(`sigmaRadians, ${a}, is too large and will clip, as it requested ${x} samples when the maximum is set to ${Qc}`);const v=[];let w=0;for(let C=0;C<Qc;++C){const F=C/y,P=Math.exp(-F*F/2);v.push(P),C===0?w+=P:C<x&&(w+=2*P)}for(let C=0;C<v.length;C++)v[C]=v[C]/w;g.envMap.value=e.texture,g.samples.value=x,g.weights.value=v,g.latitudinal.value=s==="latitudinal",l&&(g.poleAxis.value=l);const{_lodMax:S}=this;g.dTheta.value=b,g.mipInt.value=S-i;const A=this._sizeLods[r],R=3*A*(r>S-Ql?r-S+Ql:0),N=4*(this._cubeSize-A);Rd(n,R,N,3*A,2*A),c.setRenderTarget(n),c.render(h,ip)}};function JQ(t){const e=[],n=[],i=[];let r=t;const a=t-Ql+1+XN.length;for(let s=0;s<a;s++){const l=Math.pow(2,r);e.push(l);let c=1/l;s>t-Ql?c=XN[s-t+Ql-1]:s===0&&(c=0),n.push(c);const d=1/(l-2),f=-d,h=1+d,g=[f,f,h,f,h,h,f,f,h,h,f,h],m=6,b=6,y=3,x=2,v=1,w=new Float32Array(y*b*m),S=new Float32Array(x*b*m),A=new Float32Array(v*b*m);for(let N=0;N<m;N++){const C=N%3*2/3-1,F=N>2?0:-1,P=[C,F,0,C+2/3,F,0,C+2/3,F+1,0,C,F,0,C+2/3,F+1,0,C,F+1,0];w.set(P,y*b*N),S.set(g,x*b*N);const L=[N,N,N,N,N,N];A.set(L,v*b*N)}const R=new Ks;R.setAttribute("position",new Xa(w,y)),R.setAttribute("uv",new Xa(S,x)),R.setAttribute("faceIndex",new Xa(A,v)),i.push(new Hs(R,null)),r>Ql&&r--}return{lodMeshes:i,sizeLods:e,sigmas:n}}function KN(t,e,n){const i=new Su(t,e,n);return i.texture.mapping=fy,i.texture.name="PMREM.cubeUv",i.scissorTest=!0,i}function Rd(t,e,n,i,r){t.viewport.set(e,n,i,r),t.scissor.set(e,n,i,r)}function eJ(t,e,n){return new $o({name:"PMREMGGXConvolution",defines:{GGX_SAMPLES:ZQ,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/n,CUBEUV_MAX_MIP:`${t}.0`},uniforms:{envMap:{value:null},roughness:{value:0},mipInt:{value:0}},vertexShader:py(),fragmentShader:`
  3578. precision highp float;
  3579. precision highp int;
  3580. varying vec3 vOutputDirection;
  3581. uniform sampler2D envMap;
  3582. uniform float roughness;
  3583. uniform float mipInt;
  3584. #define ENVMAP_TYPE_CUBE_UV
  3585. #include <cube_uv_reflection_fragment>
  3586. #define PI 3.14159265359
  3587. // Van der Corput radical inverse
  3588. float radicalInverse_VdC(uint bits) {
  3589. bits = (bits << 16u) | (bits >> 16u);
  3590. bits = ((bits & 0x55555555u) << 1u) | ((bits & 0xAAAAAAAAu) >> 1u);
  3591. bits = ((bits & 0x33333333u) << 2u) | ((bits & 0xCCCCCCCCu) >> 2u);
  3592. bits = ((bits & 0x0F0F0F0Fu) << 4u) | ((bits & 0xF0F0F0F0u) >> 4u);
  3593. bits = ((bits & 0x00FF00FFu) << 8u) | ((bits & 0xFF00FF00u) >> 8u);
  3594. return float(bits) * 2.3283064365386963e-10; // / 0x100000000
  3595. }
  3596. // Hammersley sequence
  3597. vec2 hammersley(uint i, uint N) {
  3598. return vec2(float(i) / float(N), radicalInverse_VdC(i));
  3599. }
  3600. // GGX VNDF importance sampling (Eric Heitz 2018)
  3601. // "Sampling the GGX Distribution of Visible Normals"
  3602. // https://jcgt.org/published/0007/04/01/
  3603. vec3 importanceSampleGGX_VNDF(vec2 Xi, vec3 V, float roughness) {
  3604. float alpha = roughness * roughness;
  3605. // Section 3.2: Transform view direction to hemisphere configuration
  3606. vec3 Vh = normalize(vec3(alpha * V.x, alpha * V.y, V.z));
  3607. // Section 4.1: Orthonormal basis
  3608. float lensq = Vh.x * Vh.x + Vh.y * Vh.y;
  3609. vec3 T1 = lensq > 0.0 ? vec3(-Vh.y, Vh.x, 0.0) / sqrt(lensq) : vec3(1.0, 0.0, 0.0);
  3610. vec3 T2 = cross(Vh, T1);
  3611. // Section 4.2: Parameterization of projected area
  3612. float r = sqrt(Xi.x);
  3613. float phi = 2.0 * PI * Xi.y;
  3614. float t1 = r * cos(phi);
  3615. float t2 = r * sin(phi);
  3616. float s = 0.5 * (1.0 + Vh.z);
  3617. t2 = (1.0 - s) * sqrt(1.0 - t1 * t1) + s * t2;
  3618. // Section 4.3: Reprojection onto hemisphere
  3619. vec3 Nh = t1 * T1 + t2 * T2 + sqrt(max(0.0, 1.0 - t1 * t1 - t2 * t2)) * Vh;
  3620. // Section 3.4: Transform back to ellipsoid configuration
  3621. return normalize(vec3(alpha * Nh.x, alpha * Nh.y, max(0.0, Nh.z)));
  3622. }
  3623. void main() {
  3624. vec3 N = normalize(vOutputDirection);
  3625. vec3 V = N; // Assume view direction equals normal for pre-filtering
  3626. vec3 prefilteredColor = vec3(0.0);
  3627. float totalWeight = 0.0;
  3628. // For very low roughness, just sample the environment directly
  3629. if (roughness < 0.001) {
  3630. gl_FragColor = vec4(bilinearCubeUV(envMap, N, mipInt), 1.0);
  3631. return;
  3632. }
  3633. // Tangent space basis for VNDF sampling
  3634. vec3 up = abs(N.z) < 0.999 ? vec3(0.0, 0.0, 1.0) : vec3(1.0, 0.0, 0.0);
  3635. vec3 tangent = normalize(cross(up, N));
  3636. vec3 bitangent = cross(N, tangent);
  3637. for(uint i = 0u; i < uint(GGX_SAMPLES); i++) {
  3638. vec2 Xi = hammersley(i, uint(GGX_SAMPLES));
  3639. // For PMREM, V = N, so in tangent space V is always (0, 0, 1)
  3640. vec3 H_tangent = importanceSampleGGX_VNDF(Xi, vec3(0.0, 0.0, 1.0), roughness);
  3641. // Transform H back to world space
  3642. vec3 H = normalize(tangent * H_tangent.x + bitangent * H_tangent.y + N * H_tangent.z);
  3643. vec3 L = normalize(2.0 * dot(V, H) * H - V);
  3644. float NdotL = max(dot(N, L), 0.0);
  3645. if(NdotL > 0.0) {
  3646. // Sample environment at fixed mip level
  3647. // VNDF importance sampling handles the distribution filtering
  3648. vec3 sampleColor = bilinearCubeUV(envMap, L, mipInt);
  3649. // Weight by NdotL for the split-sum approximation
  3650. // VNDF PDF naturally accounts for the visible microfacet distribution
  3651. prefilteredColor += sampleColor * NdotL;
  3652. totalWeight += NdotL;
  3653. }
  3654. }
  3655. if (totalWeight > 0.0) {
  3656. prefilteredColor = prefilteredColor / totalWeight;
  3657. }
  3658. gl_FragColor = vec4(prefilteredColor, 1.0);
  3659. }
  3660. `,blending:zo,depthTest:!1,depthWrite:!1})}function tJ(t,e,n){const i=new Float32Array(Qc),r=new Ve(0,1,0);return new $o({name:"SphericalGaussianBlur",defines:{n:Qc,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/n,CUBEUV_MAX_MIP:`${t}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:i},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:r}},vertexShader:py(),fragmentShader:`
  3661. precision mediump float;
  3662. precision mediump int;
  3663. varying vec3 vOutputDirection;
  3664. uniform sampler2D envMap;
  3665. uniform int samples;
  3666. uniform float weights[ n ];
  3667. uniform bool latitudinal;
  3668. uniform float dTheta;
  3669. uniform float mipInt;
  3670. uniform vec3 poleAxis;
  3671. #define ENVMAP_TYPE_CUBE_UV
  3672. #include <cube_uv_reflection_fragment>
  3673. vec3 getSample( float theta, vec3 axis ) {
  3674. float cosTheta = cos( theta );
  3675. // Rodrigues' axis-angle rotation
  3676. vec3 sampleDirection = vOutputDirection * cosTheta
  3677. + cross( axis, vOutputDirection ) * sin( theta )
  3678. + axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );
  3679. return bilinearCubeUV( envMap, sampleDirection, mipInt );
  3680. }
  3681. void main() {
  3682. vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );
  3683. if ( all( equal( axis, vec3( 0.0 ) ) ) ) {
  3684. axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );
  3685. }
  3686. axis = normalize( axis );
  3687. gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );
  3688. gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );
  3689. for ( int i = 1; i < n; i++ ) {
  3690. if ( i >= samples ) {
  3691. break;
  3692. }
  3693. float theta = dTheta * float( i );
  3694. gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );
  3695. gl_FragColor.rgb += weights[ i ] * getSample( theta, axis );
  3696. }
  3697. }
  3698. `,blending:zo,depthTest:!1,depthWrite:!1})}function ZN(){return new $o({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:py(),fragmentShader:`
  3699. precision mediump float;
  3700. precision mediump int;
  3701. varying vec3 vOutputDirection;
  3702. uniform sampler2D envMap;
  3703. #include <common>
  3704. void main() {
  3705. vec3 outputDirection = normalize( vOutputDirection );
  3706. vec2 uv = equirectUv( outputDirection );
  3707. gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );
  3708. }
  3709. `,blending:zo,depthTest:!1,depthWrite:!1})}function QN(){return new $o({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:py(),fragmentShader:`
  3710. precision mediump float;
  3711. precision mediump int;
  3712. uniform float flipEnvMap;
  3713. varying vec3 vOutputDirection;
  3714. uniform samplerCube envMap;
  3715. void main() {
  3716. gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );
  3717. }
  3718. `,blending:zo,depthTest:!1,depthWrite:!1})}function py(){return`
  3719. precision mediump float;
  3720. precision mediump int;
  3721. attribute float faceIndex;
  3722. varying vec3 vOutputDirection;
  3723. // RH coordinate system; PMREM face-indexing convention
  3724. vec3 getDirection( vec2 uv, float face ) {
  3725. uv = 2.0 * uv - 1.0;
  3726. vec3 direction = vec3( uv, 1.0 );
  3727. if ( face == 0.0 ) {
  3728. direction = direction.zyx; // ( 1, v, u ) pos x
  3729. } else if ( face == 1.0 ) {
  3730. direction = direction.xzy;
  3731. direction.xz *= -1.0; // ( -u, 1, -v ) pos y
  3732. } else if ( face == 2.0 ) {
  3733. direction.x *= -1.0; // ( -u, v, 1 ) pos z
  3734. } else if ( face == 3.0 ) {
  3735. direction = direction.zyx;
  3736. direction.xz *= -1.0; // ( -1, v, -u ) neg x
  3737. } else if ( face == 4.0 ) {
  3738. direction = direction.xzy;
  3739. direction.xy *= -1.0; // ( -u, -1, v ) neg y
  3740. } else if ( face == 5.0 ) {
  3741. direction.z *= -1.0; // ( u, v, -1 ) neg z
  3742. }
  3743. return direction;
  3744. }
  3745. void main() {
  3746. vOutputDirection = getDirection( uv, faceIndex );
  3747. gl_Position = vec4( position, 1.0 );
  3748. }
  3749. `}function nJ(t){let e=new WeakMap,n=null;function i(l){if(l&&l.isTexture){const c=l.mapping,d=c===eM||c===tM,f=c===xf||c===yf;if(d||f){let h=e.get(l);const g=h!==void 0?h.texture.pmremVersion:0;if(l.isRenderTargetTexture&&l.pmremVersion!==g)return n===null&&(n=new YN(t)),h=d?n.fromEquirectangular(l,h):n.fromCubemap(l,h),h.texture.pmremVersion=l.pmremVersion,e.set(l,h),h.texture;if(h!==void 0)return h.texture;{const m=l.image;return d&&m&&m.height>0||f&&m&&r(m)?(n===null&&(n=new YN(t)),h=d?n.fromEquirectangular(l):n.fromCubemap(l),h.texture.pmremVersion=l.pmremVersion,e.set(l,h),l.addEventListener("dispose",a),h.texture):null}}}return l}function r(l){let c=0;const d=6;for(let f=0;f<d;f++)l[f]!==void 0&&c++;return c===d}function a(l){const c=l.target;c.removeEventListener("dispose",a);const d=e.get(c);d!==void 0&&(e.delete(c),d.dispose())}function s(){e=new WeakMap,n!==null&&(n.dispose(),n=null)}return{get:i,dispose:s}}function iJ(t){const e={};function n(i){if(e[i]!==void 0)return e[i];const r=t.getExtension(i);return e[i]=r,r}return{has:function(i){return n(i)!==null},init:function(){n("EXT_color_buffer_float"),n("WEBGL_clip_cull_distance"),n("OES_texture_float_linear"),n("EXT_color_buffer_half_float"),n("WEBGL_multisampled_render_to_texture"),n("WEBGL_render_shared_exponent")},get:function(i){const r=n(i);return r===null&&Gp("WebGLRenderer: "+i+" extension not supported."),r}}}function rJ(t,e,n,i){const r={},a=new WeakMap;function s(h){const g=h.target;g.index!==null&&e.remove(g.index);for(const b in g.attributes)e.remove(g.attributes[b]);g.removeEventListener("dispose",s),delete r[g.id];const m=a.get(g);m&&(e.remove(m),a.delete(g)),i.releaseStatesOfGeometry(g),g.isInstancedBufferGeometry===!0&&delete g._maxInstanceCount,n.memory.geometries--}function l(h,g){return r[g.id]===!0||(g.addEventListener("dispose",s),r[g.id]=!0,n.memory.geometries++),g}function c(h){const g=h.attributes;for(const m in g)e.update(g[m],t.ARRAY_BUFFER)}function d(h){const g=[],m=h.index,b=h.attributes.position;let y=0;if(m!==null){const w=m.array;y=m.version;for(let S=0,A=w.length;S<A;S+=3){const R=w[S+0],N=w[S+1],C=w[S+2];g.push(R,N,N,C,C,R)}}else if(b!==void 0){const w=b.array;y=b.version;for(let S=0,A=w.length/3-1;S<A;S+=3){const R=S+0,N=S+1,C=S+2;g.push(R,N,N,C,C,R)}}else return;const x=new(Kz(g)?sB:aB)(g,1);x.version=y;const v=a.get(h);v&&e.remove(v),a.set(h,x)}function f(h){const g=a.get(h);if(g){const m=h.index;m!==null&&g.version<m.version&&d(h)}else d(h);return a.get(h)}return{get:l,update:c,getWireframeAttribute:f}}function aJ(t,e,n){let i;function r(g){i=g}let a,s;function l(g){a=g.type,s=g.bytesPerElement}function c(g,m){t.drawElements(i,m,a,g*s),n.update(m,i,1)}function d(g,m,b){b!==0&&(t.drawElementsInstanced(i,m,a,g*s,b),n.update(m,i,b))}function f(g,m,b){if(b===0)return;e.get("WEBGL_multi_draw").multiDrawElementsWEBGL(i,m,0,a,g,0,b);let x=0;for(let v=0;v<b;v++)x+=m[v];n.update(x,i,1)}function h(g,m,b,y){if(b===0)return;const x=e.get("WEBGL_multi_draw");if(x===null)for(let v=0;v<g.length;v++)d(g[v]/s,m[v],y[v]);else{x.multiDrawElementsInstancedWEBGL(i,m,0,a,g,0,y,0,b);let v=0;for(let w=0;w<b;w++)v+=m[w]*y[w];n.update(v,i,1)}}this.setMode=r,this.setIndex=l,this.render=c,this.renderInstances=d,this.renderMultiDraw=f,this.renderMultiDrawInstances=h}function sJ(t){const e={geometries:0,textures:0},n={frame:0,calls:0,triangles:0,points:0,lines:0};function i(a,s,l){switch(n.calls++,s){case t.TRIANGLES:n.triangles+=l*(a/3);break;case t.LINES:n.lines+=l*(a/2);break;case t.LINE_STRIP:n.lines+=l*(a-1);break;case t.LINE_LOOP:n.lines+=l*a;break;case t.POINTS:n.points+=l*a;break;default:ai("WebGLInfo: Unknown draw mode:",s);break}}function r(){n.calls=0,n.triangles=0,n.points=0,n.lines=0}return{memory:e,render:n,programs:null,autoReset:!0,reset:r,update:i}}function oJ(t,e,n){const i=new WeakMap,r=new gi;function a(s,l,c){const d=s.morphTargetInfluences,f=l.morphAttributes.position||l.morphAttributes.normal||l.morphAttributes.color,h=f!==void 0?f.length:0;let g=i.get(l);if(g===void 0||g.count!==h){let L=function(){F.dispose(),i.delete(l),l.removeEventListener("dispose",L)};var m=L;g!==void 0&&g.texture.dispose();const b=l.morphAttributes.position!==void 0,y=l.morphAttributes.normal!==void 0,x=l.morphAttributes.color!==void 0,v=l.morphAttributes.position||[],w=l.morphAttributes.normal||[],S=l.morphAttributes.color||[];let A=0;b===!0&&(A=1),y===!0&&(A=2),x===!0&&(A=3);let R=l.attributes.position.count*A,N=1;R>e.maxTextureSize&&(N=Math.ceil(R/e.maxTextureSize),R=e.maxTextureSize);const C=new Float32Array(R*N*4*h),F=new tB(C,R,N,h);F.type=Lo,F.needsUpdate=!0;const P=A*4;for(let B=0;B<h;B++){const U=v[B],$=w[B],I=S[B],W=R*N*4*B;for(let X=0;X<U.count;X++){const V=X*P;b===!0&&(r.fromBufferAttribute(U,X),C[W+V+0]=r.x,C[W+V+1]=r.y,C[W+V+2]=r.z,C[W+V+3]=0),y===!0&&(r.fromBufferAttribute($,X),C[W+V+4]=r.x,C[W+V+5]=r.y,C[W+V+6]=r.z,C[W+V+7]=0),x===!0&&(r.fromBufferAttribute(I,X),C[W+V+8]=r.x,C[W+V+9]=r.y,C[W+V+10]=r.z,C[W+V+11]=I.itemSize===4?r.w:1)}}g={count:h,texture:F,size:new $t(R,N)},i.set(l,g),l.addEventListener("dispose",L)}if(s.isInstancedMesh===!0&&s.morphTexture!==null)c.getUniforms().setValue(t,"morphTexture",s.morphTexture,n);else{let b=0;for(let x=0;x<d.length;x++)b+=d[x];const y=l.morphTargetsRelative?1:1-b;c.getUniforms().setValue(t,"morphTargetBaseInfluence",y),c.getUniforms().setValue(t,"morphTargetInfluences",d)}c.getUniforms().setValue(t,"morphTargetsTexture",g.texture,n),c.getUniforms().setValue(t,"morphTargetsTextureSize",g.size)}return{update:a}}function lJ(t,e,n,i){let r=new WeakMap;function a(c){const d=i.render.frame,f=c.geometry,h=e.get(c,f);if(r.get(h)!==d&&(e.update(h),r.set(h,d)),c.isInstancedMesh&&(c.hasEventListener("dispose",l)===!1&&c.addEventListener("dispose",l),r.get(c)!==d&&(n.update(c.instanceMatrix,t.ARRAY_BUFFER),c.instanceColor!==null&&n.update(c.instanceColor,t.ARRAY_BUFFER),r.set(c,d))),c.isSkinnedMesh){const g=c.skeleton;r.get(g)!==d&&(g.update(),r.set(g,d))}return h}function s(){r=new WeakMap}function l(c){const d=c.target;d.removeEventListener("dispose",l),n.remove(d.instanceMatrix),d.instanceColor!==null&&n.remove(d.instanceColor)}return{update:a,dispose:s}}const yB=new Ss,JN=new hB(1,1),bB=new tB,_B=new CY,SB=new dB,eO=[],tO=[],nO=new Float32Array(16),iO=new Float32Array(9),rO=new Float32Array(4);function Hf(t,e,n){const i=t[0];if(i<=0||i>0)return t;const r=e*n;let a=eO[r];if(a===void 0&&(a=new Float32Array(r),eO[r]=a),e!==0){i.toArray(a,0);for(let s=1,l=0;s!==e;++s)l+=n,t[s].toArray(a,l)}return a}function Di(t,e){if(t.length!==e.length)return!1;for(let n=0,i=t.length;n<i;n++)if(t[n]!==e[n])return!1;return!0}function Ni(t,e){for(let n=0,i=e.length;n<i;n++)t[n]=e[n]}function my(t,e){let n=tO[e];n===void 0&&(n=new Int32Array(e),tO[e]=n);for(let i=0;i!==e;++i)n[i]=t.allocateTextureUnit();return n}function cJ(t,e){const n=this.cache;n[0]!==e&&(t.uniform1f(this.addr,e),n[0]=e)}function uJ(t,e){const n=this.cache;if(e.x!==void 0)(n[0]!==e.x||n[1]!==e.y)&&(t.uniform2f(this.addr,e.x,e.y),n[0]=e.x,n[1]=e.y);else{if(Di(n,e))return;t.uniform2fv(this.addr,e),Ni(n,e)}}function dJ(t,e){const n=this.cache;if(e.x!==void 0)(n[0]!==e.x||n[1]!==e.y||n[2]!==e.z)&&(t.uniform3f(this.addr,e.x,e.y,e.z),n[0]=e.x,n[1]=e.y,n[2]=e.z);else if(e.r!==void 0)(n[0]!==e.r||n[1]!==e.g||n[2]!==e.b)&&(t.uniform3f(this.addr,e.r,e.g,e.b),n[0]=e.r,n[1]=e.g,n[2]=e.b);else{if(Di(n,e))return;t.uniform3fv(this.addr,e),Ni(n,e)}}function fJ(t,e){const n=this.cache;if(e.x!==void 0)(n[0]!==e.x||n[1]!==e.y||n[2]!==e.z||n[3]!==e.w)&&(t.uniform4f(this.addr,e.x,e.y,e.z,e.w),n[0]=e.x,n[1]=e.y,n[2]=e.z,n[3]=e.w);else{if(Di(n,e))return;t.uniform4fv(this.addr,e),Ni(n,e)}}function hJ(t,e){const n=this.cache,i=e.elements;if(i===void 0){if(Di(n,e))return;t.uniformMatrix2fv(this.addr,!1,e),Ni(n,e)}else{if(Di(n,i))return;rO.set(i),t.uniformMatrix2fv(this.addr,!1,rO),Ni(n,i)}}function pJ(t,e){const n=this.cache,i=e.elements;if(i===void 0){if(Di(n,e))return;t.uniformMatrix3fv(this.addr,!1,e),Ni(n,e)}else{if(Di(n,i))return;iO.set(i),t.uniformMatrix3fv(this.addr,!1,iO),Ni(n,i)}}function mJ(t,e){const n=this.cache,i=e.elements;if(i===void 0){if(Di(n,e))return;t.uniformMatrix4fv(this.addr,!1,e),Ni(n,e)}else{if(Di(n,i))return;nO.set(i),t.uniformMatrix4fv(this.addr,!1,nO),Ni(n,i)}}function gJ(t,e){const n=this.cache;n[0]!==e&&(t.uniform1i(this.addr,e),n[0]=e)}function vJ(t,e){const n=this.cache;if(e.x!==void 0)(n[0]!==e.x||n[1]!==e.y)&&(t.uniform2i(this.addr,e.x,e.y),n[0]=e.x,n[1]=e.y);else{if(Di(n,e))return;t.uniform2iv(this.addr,e),Ni(n,e)}}function xJ(t,e){const n=this.cache;if(e.x!==void 0)(n[0]!==e.x||n[1]!==e.y||n[2]!==e.z)&&(t.uniform3i(this.addr,e.x,e.y,e.z),n[0]=e.x,n[1]=e.y,n[2]=e.z);else{if(Di(n,e))return;t.uniform3iv(this.addr,e),Ni(n,e)}}function yJ(t,e){const n=this.cache;if(e.x!==void 0)(n[0]!==e.x||n[1]!==e.y||n[2]!==e.z||n[3]!==e.w)&&(t.uniform4i(this.addr,e.x,e.y,e.z,e.w),n[0]=e.x,n[1]=e.y,n[2]=e.z,n[3]=e.w);else{if(Di(n,e))return;t.uniform4iv(this.addr,e),Ni(n,e)}}function bJ(t,e){const n=this.cache;n[0]!==e&&(t.uniform1ui(this.addr,e),n[0]=e)}function _J(t,e){const n=this.cache;if(e.x!==void 0)(n[0]!==e.x||n[1]!==e.y)&&(t.uniform2ui(this.addr,e.x,e.y),n[0]=e.x,n[1]=e.y);else{if(Di(n,e))return;t.uniform2uiv(this.addr,e),Ni(n,e)}}function SJ(t,e){const n=this.cache;if(e.x!==void 0)(n[0]!==e.x||n[1]!==e.y||n[2]!==e.z)&&(t.uniform3ui(this.addr,e.x,e.y,e.z),n[0]=e.x,n[1]=e.y,n[2]=e.z);else{if(Di(n,e))return;t.uniform3uiv(this.addr,e),Ni(n,e)}}function wJ(t,e){const n=this.cache;if(e.x!==void 0)(n[0]!==e.x||n[1]!==e.y||n[2]!==e.z||n[3]!==e.w)&&(t.uniform4ui(this.addr,e.x,e.y,e.z,e.w),n[0]=e.x,n[1]=e.y,n[2]=e.z,n[3]=e.w);else{if(Di(n,e))return;t.uniform4uiv(this.addr,e),Ni(n,e)}}function EJ(t,e,n){const i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(t.uniform1i(this.addr,r),i[0]=r);let a;this.type===t.SAMPLER_2D_SHADOW?(JN.compareFunction=Yz,a=JN):a=yB,n.setTexture2D(e||a,r)}function MJ(t,e,n){const i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(t.uniform1i(this.addr,r),i[0]=r),n.setTexture3D(e||_B,r)}function AJ(t,e,n){const i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(t.uniform1i(this.addr,r),i[0]=r),n.setTextureCube(e||SB,r)}function TJ(t,e,n){const i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(t.uniform1i(this.addr,r),i[0]=r),n.setTexture2DArray(e||bB,r)}function CJ(t){switch(t){case 5126:return cJ;case 35664:return uJ;case 35665:return dJ;case 35666:return fJ;case 35674:return hJ;case 35675:return pJ;case 35676:return mJ;case 5124:case 35670:return gJ;case 35667:case 35671:return vJ;case 35668:case 35672:return xJ;case 35669:case 35673:return yJ;case 5125:return bJ;case 36294:return _J;case 36295:return SJ;case 36296:return wJ;case 35678:case 36198:case 36298:case 36306:case 35682:return EJ;case 35679:case 36299:case 36307:return MJ;case 35680:case 36300:case 36308:case 36293:return AJ;case 36289:case 36303:case 36311:case 36292:return TJ}}function RJ(t,e){t.uniform1fv(this.addr,e)}function PJ(t,e){const n=Hf(e,this.size,2);t.uniform2fv(this.addr,n)}function DJ(t,e){const n=Hf(e,this.size,3);t.uniform3fv(this.addr,n)}function NJ(t,e){const n=Hf(e,this.size,4);t.uniform4fv(this.addr,n)}function OJ(t,e){const n=Hf(e,this.size,4);t.uniformMatrix2fv(this.addr,!1,n)}function LJ(t,e){const n=Hf(e,this.size,9);t.uniformMatrix3fv(this.addr,!1,n)}function IJ(t,e){const n=Hf(e,this.size,16);t.uniformMatrix4fv(this.addr,!1,n)}function UJ(t,e){t.uniform1iv(this.addr,e)}function kJ(t,e){t.uniform2iv(this.addr,e)}function FJ(t,e){t.uniform3iv(this.addr,e)}function zJ(t,e){t.uniform4iv(this.addr,e)}function BJ(t,e){t.uniform1uiv(this.addr,e)}function jJ(t,e){t.uniform2uiv(this.addr,e)}function HJ(t,e){t.uniform3uiv(this.addr,e)}function GJ(t,e){t.uniform4uiv(this.addr,e)}function VJ(t,e,n){const i=this.cache,r=e.length,a=my(n,r);Di(i,a)||(t.uniform1iv(this.addr,a),Ni(i,a));for(let s=0;s!==r;++s)n.setTexture2D(e[s]||yB,a[s])}function $J(t,e,n){const i=this.cache,r=e.length,a=my(n,r);Di(i,a)||(t.uniform1iv(this.addr,a),Ni(i,a));for(let s=0;s!==r;++s)n.setTexture3D(e[s]||_B,a[s])}function WJ(t,e,n){const i=this.cache,r=e.length,a=my(n,r);Di(i,a)||(t.uniform1iv(this.addr,a),Ni(i,a));for(let s=0;s!==r;++s)n.setTextureCube(e[s]||SB,a[s])}function XJ(t,e,n){const i=this.cache,r=e.length,a=my(n,r);Di(i,a)||(t.uniform1iv(this.addr,a),Ni(i,a));for(let s=0;s!==r;++s)n.setTexture2DArray(e[s]||bB,a[s])}function qJ(t){switch(t){case 5126:return RJ;case 35664:return PJ;case 35665:return DJ;case 35666:return NJ;case 35674:return OJ;case 35675:return LJ;case 35676:return IJ;case 5124:case 35670:return UJ;case 35667:case 35671:return kJ;case 35668:case 35672:return FJ;case 35669:case 35673:return zJ;case 5125:return BJ;case 36294:return jJ;case 36295:return HJ;case 36296:return GJ;case 35678:case 36198:case 36298:case 36306:case 35682:return VJ;case 35679:case 36299:case 36307:return $J;case 35680:case 36300:case 36308:case 36293:return WJ;case 36289:case 36303:case 36311:case 36292:return XJ}}let YJ=class{constructor(e,n,i){this.id=e,this.addr=i,this.cache=[],this.type=n.type,this.setValue=CJ(n.type)}},KJ=class{constructor(e,n,i){this.id=e,this.addr=i,this.cache=[],this.type=n.type,this.size=n.size,this.setValue=qJ(n.type)}},ZJ=class{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,n,i){const r=this.seq;for(let a=0,s=r.length;a!==s;++a){const l=r[a];l.setValue(e,n[l.id],i)}}};const a1=/(\w+)(\])?(\[|\.)?/g;function aO(t,e){t.seq.push(e),t.map[e.id]=e}function QJ(t,e,n){const i=t.name,r=i.length;for(a1.lastIndex=0;;){const a=a1.exec(i),s=a1.lastIndex;let l=a[1];const c=a[2]==="]",d=a[3];if(c&&(l=l|0),d===void 0||d==="["&&s+2===r){aO(n,d===void 0?new YJ(l,t,e):new KJ(l,t,e));break}else{let h=n.map[l];h===void 0&&(h=new ZJ(l),aO(n,h)),n=h}}}let kv=class{constructor(e,n){this.seq=[],this.map={};const i=e.getProgramParameter(n,e.ACTIVE_UNIFORMS);for(let r=0;r<i;++r){const a=e.getActiveUniform(n,r),s=e.getUniformLocation(n,a.name);QJ(a,s,this)}}setValue(e,n,i,r){const a=this.map[n];a!==void 0&&a.setValue(e,i,r)}setOptional(e,n,i){const r=n[i];r!==void 0&&this.setValue(e,i,r)}static upload(e,n,i,r){for(let a=0,s=n.length;a!==s;++a){const l=n[a],c=i[l.id];c.needsUpdate!==!1&&l.setValue(e,c.value,r)}}static seqWithValue(e,n){const i=[];for(let r=0,a=e.length;r!==a;++r){const s=e[r];s.id in n&&i.push(s)}return i}};function sO(t,e,n){const i=t.createShader(e);return t.shaderSource(i,n),t.compileShader(i),i}const JJ=37297;let eee=0;function tee(t,e){const n=t.split(`
  3750. `),i=[],r=Math.max(e-6,0),a=Math.min(e+6,n.length);for(let s=r;s<a;s++){const l=s+1;i.push(`${l===e?">":" "} ${l}: ${n[s]}`)}return i.join(`
  3751. `)}const oO=new Xt;function nee(t){un._getMatrix(oO,un.workingColorSpace,t);const e=`mat3( ${oO.elements.map(n=>n.toFixed(4))} )`;switch(un.getTransfer(t)){case Jv:return[e,"LinearTransferOETF"];case En:return[e,"sRGBTransferOETF"];default:return It("WebGLProgram: Unsupported color space: ",t),[e,"LinearTransferOETF"]}}function lO(t,e,n){const i=t.getShaderParameter(e,t.COMPILE_STATUS),a=(t.getShaderInfoLog(e)||"").trim();if(i&&a==="")return"";const s=/ERROR: 0:(\d+)/.exec(a);if(s){const l=parseInt(s[1]);return n.toUpperCase()+`
  3752. `+a+`
  3753. `+tee(t.getShaderSource(e),l)}else return a}function iee(t,e){const n=nee(e);return[`vec4 ${t}( vec4 value ) {`,` return ${n[1]}( vec4( value.rgb * ${n[0]}, value.a ) );`,"}"].join(`
  3754. `)}function ree(t,e){let n;switch(e){case tY:n="Linear";break;case nY:n="Reinhard";break;case iY:n="Cineon";break;case rY:n="ACESFilmic";break;case sY:n="AgX";break;case oY:n="Neutral";break;case aY:n="Custom";break;default:It("WebGLProgram: Unsupported toneMapping:",e),n="Linear"}return"vec3 "+t+"( vec3 color ) { return "+n+"ToneMapping( color ); }"}const P0=new Ve;function aee(){un.getLuminanceCoefficients(P0);const t=P0.x.toFixed(4),e=P0.y.toFixed(4),n=P0.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",` const vec3 weights = vec3( ${t}, ${e}, ${n} );`," return dot( weights, rgb );","}"].join(`
  3755. `)}function see(t){return[t.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",t.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(yp).join(`
  3756. `)}function oee(t){const e=[];for(const n in t){const i=t[n];i!==!1&&e.push("#define "+n+" "+i)}return e.join(`
  3757. `)}function lee(t,e){const n={},i=t.getProgramParameter(e,t.ACTIVE_ATTRIBUTES);for(let r=0;r<i;r++){const a=t.getActiveAttrib(e,r),s=a.name;let l=1;a.type===t.FLOAT_MAT2&&(l=2),a.type===t.FLOAT_MAT3&&(l=3),a.type===t.FLOAT_MAT4&&(l=4),n[s]={type:a.type,location:t.getAttribLocation(e,s),locationSize:l}}return n}function yp(t){return t!==""}function cO(t,e){const n=e.numSpotLightShadows+e.numSpotLightMaps-e.numSpotLightShadowsWithMaps;return t.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,n).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 uO(t,e){return t.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const cee=/^[ \t]*#include +<([\w\d./]+)>/gm;function LM(t){return t.replace(cee,dee)}const uee=new Map;function dee(t,e){let n=Gt[e];if(n===void 0){const i=uee.get(e);if(i!==void 0)n=Gt[i],It('WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,i);else throw new Error("Can not resolve #include <"+e+">")}return LM(n)}const fee=/#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 dO(t){return t.replace(fee,hee)}function hee(t,e,n,i){let r="";for(let a=parseInt(e);a<parseInt(n);a++)r+=i.replace(/\[\s*i\s*\]/g,"[ "+a+" ]").replace(/UNROLLED_LOOP_INDEX/g,a);return r}function fO(t){let e=`precision ${t.precision} float;
  3758. precision ${t.precision} int;
  3759. precision ${t.precision} sampler2D;
  3760. precision ${t.precision} samplerCube;
  3761. precision ${t.precision} sampler3D;
  3762. precision ${t.precision} sampler2DArray;
  3763. precision ${t.precision} sampler2DShadow;
  3764. precision ${t.precision} samplerCubeShadow;
  3765. precision ${t.precision} sampler2DArrayShadow;
  3766. precision ${t.precision} isampler2D;
  3767. precision ${t.precision} isampler3D;
  3768. precision ${t.precision} isamplerCube;
  3769. precision ${t.precision} isampler2DArray;
  3770. precision ${t.precision} usampler2D;
  3771. precision ${t.precision} usampler3D;
  3772. precision ${t.precision} usamplerCube;
  3773. precision ${t.precision} usampler2DArray;
  3774. `;return t.precision==="highp"?e+=`
  3775. #define HIGH_PRECISION`:t.precision==="mediump"?e+=`
  3776. #define MEDIUM_PRECISION`:t.precision==="lowp"&&(e+=`
  3777. #define LOW_PRECISION`),e}function pee(t){let e="SHADOWMAP_TYPE_BASIC";return t.shadowMapType===zz?e="SHADOWMAP_TYPE_PCF":t.shadowMapType===Lq?e="SHADOWMAP_TYPE_PCF_SOFT":t.shadowMapType===To&&(e="SHADOWMAP_TYPE_VSM"),e}function mee(t){let e="ENVMAP_TYPE_CUBE";if(t.envMap)switch(t.envMapMode){case xf:case yf:e="ENVMAP_TYPE_CUBE";break;case fy:e="ENVMAP_TYPE_CUBE_UV";break}return e}function gee(t){let e="ENVMAP_MODE_REFLECTION";if(t.envMap)switch(t.envMapMode){case yf:e="ENVMAP_MODE_REFRACTION";break}return e}function vee(t){let e="ENVMAP_BLENDING_NONE";if(t.envMap)switch(t.combine){case xT:e="ENVMAP_BLENDING_MULTIPLY";break;case Jq:e="ENVMAP_BLENDING_MIX";break;case eY:e="ENVMAP_BLENDING_ADD";break}return e}function xee(t){const e=t.envMapCubeUVHeight;if(e===null)return null;const n=Math.log2(e)-2,i=1/e;return{texelWidth:1/(3*Math.max(Math.pow(2,n),112)),texelHeight:i,maxMip:n}}function yee(t,e,n,i){const r=t.getContext(),a=n.defines;let s=n.vertexShader,l=n.fragmentShader;const c=pee(n),d=mee(n),f=gee(n),h=vee(n),g=xee(n),m=see(n),b=oee(a),y=r.createProgram();let x,v,w=n.glslVersion?"#version "+n.glslVersion+`
  3778. `:"";n.isRawShaderMaterial?(x=["#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,b].filter(yp).join(`
  3779. `),x.length>0&&(x+=`
  3780. `),v=["#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,b].filter(yp).join(`
  3781. `),v.length>0&&(v+=`
  3782. `)):(x=[fO(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,b,n.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",n.batching?"#define USE_BATCHING":"",n.batchingColor?"#define USE_BATCHING_COLOR":"",n.instancing?"#define USE_INSTANCING":"",n.instancingColor?"#define USE_INSTANCING_COLOR":"",n.instancingMorph?"#define USE_INSTANCING_MORPH":"",n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+f:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",n.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",n.displacementMap?"#define USE_DISPLACEMENTMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.anisotropy?"#define USE_ANISOTROPY":"",n.anisotropyMap?"#define USE_ANISOTROPYMAP":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",n.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaHash?"#define USE_ALPHAHASH":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",n.mapUv?"#define MAP_UV "+n.mapUv:"",n.alphaMapUv?"#define ALPHAMAP_UV "+n.alphaMapUv:"",n.lightMapUv?"#define LIGHTMAP_UV "+n.lightMapUv:"",n.aoMapUv?"#define AOMAP_UV "+n.aoMapUv:"",n.emissiveMapUv?"#define EMISSIVEMAP_UV "+n.emissiveMapUv:"",n.bumpMapUv?"#define BUMPMAP_UV "+n.bumpMapUv:"",n.normalMapUv?"#define NORMALMAP_UV "+n.normalMapUv:"",n.displacementMapUv?"#define DISPLACEMENTMAP_UV "+n.displacementMapUv:"",n.metalnessMapUv?"#define METALNESSMAP_UV "+n.metalnessMapUv:"",n.roughnessMapUv?"#define ROUGHNESSMAP_UV "+n.roughnessMapUv:"",n.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+n.anisotropyMapUv:"",n.clearcoatMapUv?"#define CLEARCOATMAP_UV "+n.clearcoatMapUv:"",n.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+n.clearcoatNormalMapUv:"",n.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+n.clearcoatRoughnessMapUv:"",n.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+n.iridescenceMapUv:"",n.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+n.iridescenceThicknessMapUv:"",n.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+n.sheenColorMapUv:"",n.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+n.sheenRoughnessMapUv:"",n.specularMapUv?"#define SPECULARMAP_UV "+n.specularMapUv:"",n.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+n.specularColorMapUv:"",n.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+n.specularIntensityMapUv:"",n.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+n.transmissionMapUv:"",n.thicknessMapUv?"#define THICKNESSMAP_UV "+n.thicknessMapUv:"",n.vertexTangents&&n.flatShading===!1?"#define USE_TANGENT":"",n.vertexColors?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUv1s?"#define USE_UV1":"",n.vertexUv2s?"#define USE_UV2":"",n.vertexUv3s?"#define USE_UV3":"",n.pointsUvs?"#define USE_POINTS_UV":"",n.flatShading?"#define FLAT_SHADED":"",n.skinning?"#define USE_SKINNING":"",n.morphTargets?"#define USE_MORPHTARGETS":"",n.morphNormals&&n.flatShading===!1?"#define USE_MORPHNORMALS":"",n.morphColors?"#define USE_MORPHCOLORS":"",n.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+n.morphTextureStride:"",n.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+n.morphTargetsCount:"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+c:"",n.sizeAttenuation?"#define USE_SIZEATTENUATION":"",n.numLightProbes>0?"#define USE_LIGHT_PROBES":"",n.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",n.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","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","#ifdef USE_INSTANCING_MORPH"," uniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1"," attribute vec2 uv1;","#endif","#ifdef USE_UV2"," attribute vec2 uv2;","#endif","#ifdef USE_UV3"," attribute vec2 uv3;","#endif","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )"," attribute vec4 color;","#elif defined( USE_COLOR )"," attribute vec3 color;","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif",`
  3783. `].filter(yp).join(`
  3784. `),v=[fO(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,b,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",n.map?"#define USE_MAP":"",n.matcap?"#define USE_MATCAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+d:"",n.envMap?"#define "+f:"",n.envMap?"#define "+h:"",g?"#define CUBEUV_TEXEL_WIDTH "+g.texelWidth:"",g?"#define CUBEUV_TEXEL_HEIGHT "+g.texelHeight:"",g?"#define CUBEUV_MAX_MIP "+g.maxMip+".0":"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",n.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.anisotropy?"#define USE_ANISOTROPY":"",n.anisotropyMap?"#define USE_ANISOTROPYMAP":"",n.clearcoat?"#define USE_CLEARCOAT":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.dispersion?"#define USE_DISPERSION":"",n.iridescence?"#define USE_IRIDESCENCE":"",n.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",n.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaTest?"#define USE_ALPHATEST":"",n.alphaHash?"#define USE_ALPHAHASH":"",n.sheen?"#define USE_SHEEN":"",n.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.vertexTangents&&n.flatShading===!1?"#define USE_TANGENT":"",n.vertexColors||n.instancingColor||n.batchingColor?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUv1s?"#define USE_UV1":"",n.vertexUv2s?"#define USE_UV2":"",n.vertexUv3s?"#define USE_UV3":"",n.pointsUvs?"#define USE_POINTS_UV":"",n.gradientMap?"#define USE_GRADIENTMAP":"",n.flatShading?"#define FLAT_SHADED":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+c:"",n.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",n.numLightProbes>0?"#define USE_LIGHT_PROBES":"",n.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",n.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",n.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",n.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",n.toneMapping!==nc?"#define TONE_MAPPING":"",n.toneMapping!==nc?Gt.tonemapping_pars_fragment:"",n.toneMapping!==nc?ree("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",n.opaque?"#define OPAQUE":"",Gt.colorspace_pars_fragment,iee("linearToOutputTexel",n.outputColorSpace),aee(),n.useDepthPacking?"#define DEPTH_PACKING "+n.depthPacking:"",`
  3785. `].filter(yp).join(`
  3786. `)),s=LM(s),s=cO(s,n),s=uO(s,n),l=LM(l),l=cO(l,n),l=uO(l,n),s=dO(s),l=dO(l),n.isRawShaderMaterial!==!0&&(w=`#version 300 es
  3787. `,x=[m,"#define attribute in","#define varying out","#define texture2D texture"].join(`
  3788. `)+`
  3789. `+x,v=["#define varying in",n.glslVersion===yN?"":"layout(location = 0) out highp vec4 pc_fragColor;",n.glslVersion===yN?"":"#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(`
  3790. `)+`
  3791. `+v);const S=w+x+s,A=w+v+l,R=sO(r,r.VERTEX_SHADER,S),N=sO(r,r.FRAGMENT_SHADER,A);r.attachShader(y,R),r.attachShader(y,N),n.index0AttributeName!==void 0?r.bindAttribLocation(y,0,n.index0AttributeName):n.morphTargets===!0&&r.bindAttribLocation(y,0,"position"),r.linkProgram(y);function C(B){if(t.debug.checkShaderErrors){const U=r.getProgramInfoLog(y)||"",$=r.getShaderInfoLog(R)||"",I=r.getShaderInfoLog(N)||"",W=U.trim(),X=$.trim(),V=I.trim();let Y=!0,J=!0;if(r.getProgramParameter(y,r.LINK_STATUS)===!1)if(Y=!1,typeof t.debug.onShaderError=="function")t.debug.onShaderError(r,y,R,N);else{const se=lO(r,R,"vertex"),H=lO(r,N,"fragment");ai("THREE.WebGLProgram: Shader Error "+r.getError()+" - VALIDATE_STATUS "+r.getProgramParameter(y,r.VALIDATE_STATUS)+`
  3792. Material Name: `+B.name+`
  3793. Material Type: `+B.type+`
  3794. Program Info Log: `+W+`
  3795. `+se+`
  3796. `+H)}else W!==""?It("WebGLProgram: Program Info Log:",W):(X===""||V==="")&&(J=!1);J&&(B.diagnostics={runnable:Y,programLog:W,vertexShader:{log:X,prefix:x},fragmentShader:{log:V,prefix:v}})}r.deleteShader(R),r.deleteShader(N),F=new kv(r,y),P=lee(r,y)}let F;this.getUniforms=function(){return F===void 0&&C(this),F};let P;this.getAttributes=function(){return P===void 0&&C(this),P};let L=n.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return L===!1&&(L=r.getProgramParameter(y,JJ)),L},this.destroy=function(){i.releaseStatesOfProgram(this),r.deleteProgram(y),this.program=void 0},this.type=n.shaderType,this.name=n.shaderName,this.id=eee++,this.cacheKey=e,this.usedTimes=1,this.program=y,this.vertexShader=R,this.fragmentShader=N,this}let bee=0,_ee=class{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const n=e.vertexShader,i=e.fragmentShader,r=this._getShaderStage(n),a=this._getShaderStage(i),s=this._getShaderCacheForMaterial(e);return s.has(r)===!1&&(s.add(r),r.usedTimes++),s.has(a)===!1&&(s.add(a),a.usedTimes++),this}remove(e){const n=this.materialCache.get(e);for(const i of n)i.usedTimes--,i.usedTimes===0&&this.shaderCache.delete(i.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 n=this.materialCache;let i=n.get(e);return i===void 0&&(i=new Set,n.set(e,i)),i}_getShaderStage(e){const n=this.shaderCache;let i=n.get(e);return i===void 0&&(i=new See(e),n.set(e,i)),i}},See=class{constructor(e){this.id=bee++,this.code=e,this.usedTimes=0}};function wee(t,e,n,i,r,a,s){const l=new iB,c=new _ee,d=new Set,f=[],h=r.logarithmicDepthBuffer,g=r.vertexTextures;let m=r.precision;const b={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(P){return d.add(P),P===0?"uv":`uv${P}`}function x(P,L,B,U,$){const I=U.fog,W=$.geometry,X=P.isMeshStandardMaterial?U.environment:null,V=(P.isMeshStandardMaterial?n:e).get(P.envMap||X),Y=V&&V.mapping===fy?V.image.height:null,J=b[P.type];P.precision!==null&&(m=r.getMaxPrecision(P.precision),m!==P.precision&&It("WebGLProgram.getParameters:",P.precision,"not supported, using",m,"instead."));const se=W.morphAttributes.position||W.morphAttributes.normal||W.morphAttributes.color,H=se!==void 0?se.length:0;let q=0;W.morphAttributes.position!==void 0&&(q=1),W.morphAttributes.normal!==void 0&&(q=2),W.morphAttributes.color!==void 0&&(q=3);let re,ce,ye,me;if(J){const wt=Ns[J];re=wt.vertexShader,ce=wt.fragmentShader}else re=P.vertexShader,ce=P.fragmentShader,c.update(P),ye=c.getVertexShaderID(P),me=c.getFragmentShaderID(P);const be=t.getRenderTarget(),Ne=t.state.buffers.depth.getReversed(),he=$.isInstancedMesh===!0,Ae=$.isBatchedMesh===!0,Be=!!P.map,le=!!P.matcap,lt=!!V,z=!!P.aoMap,G=!!P.lightMap,ne=!!P.bumpMap,Q=!!P.normalMap,ee=!!P.displacementMap,ae=!!P.emissiveMap,ie=!!P.metalnessMap,we=!!P.roughnessMap,ve=P.anisotropy>0,k=P.clearcoat>0,O=P.dispersion>0,K=P.iridescence>0,pe=P.sheen>0,xe=P.transmission>0,fe=ve&&!!P.anisotropyMap,Ke=k&&!!P.clearcoatMap,Ie=k&&!!P.clearcoatNormalMap,$e=k&&!!P.clearcoatRoughnessMap,rt=K&&!!P.iridescenceMap,ke=K&&!!P.iridescenceThicknessMap,De=pe&&!!P.sheenColorMap,ct=pe&&!!P.sheenRoughnessMap,et=!!P.specularMap,Je=!!P.specularColorMap,st=!!P.specularIntensityMap,ue=xe&&!!P.transmissionMap,tt=xe&&!!P.thicknessMap,de=!!P.gradientMap,Le=!!P.alphaMap,Me=P.alphaTest>0,ge=!!P.alphaHash,je=!!P.extensions;let at=nc;P.toneMapped&&(be===null||be.isXRRenderTarget===!0)&&(at=t.toneMapping);const mt={shaderID:J,shaderType:P.type,shaderName:P.name,vertexShader:re,fragmentShader:ce,defines:P.defines,customVertexShaderID:ye,customFragmentShaderID:me,isRawShaderMaterial:P.isRawShaderMaterial===!0,glslVersion:P.glslVersion,precision:m,batching:Ae,batchingColor:Ae&&$._colorsTexture!==null,instancing:he,instancingColor:he&&$.instanceColor!==null,instancingMorph:he&&$.morphTexture!==null,supportsVertexTextures:g,outputColorSpace:be===null?t.outputColorSpace:be.isXRRenderTarget===!0?be.texture.colorSpace:bf,alphaToCoverage:!!P.alphaToCoverage,map:Be,matcap:le,envMap:lt,envMapMode:lt&&V.mapping,envMapCubeUVHeight:Y,aoMap:z,lightMap:G,bumpMap:ne,normalMap:Q,displacementMap:g&&ee,emissiveMap:ae,normalMapObjectSpace:Q&&P.normalMapType===dY,normalMapTangentSpace:Q&&P.normalMapType===qz,metalnessMap:ie,roughnessMap:we,anisotropy:ve,anisotropyMap:fe,clearcoat:k,clearcoatMap:Ke,clearcoatNormalMap:Ie,clearcoatRoughnessMap:$e,dispersion:O,iridescence:K,iridescenceMap:rt,iridescenceThicknessMap:ke,sheen:pe,sheenColorMap:De,sheenRoughnessMap:ct,specularMap:et,specularColorMap:Je,specularIntensityMap:st,transmission:xe,transmissionMap:ue,thicknessMap:tt,gradientMap:de,opaque:P.transparent===!1&&P.blending===of&&P.alphaToCoverage===!1,alphaMap:Le,alphaTest:Me,alphaHash:ge,combine:P.combine,mapUv:Be&&y(P.map.channel),aoMapUv:z&&y(P.aoMap.channel),lightMapUv:G&&y(P.lightMap.channel),bumpMapUv:ne&&y(P.bumpMap.channel),normalMapUv:Q&&y(P.normalMap.channel),displacementMapUv:ee&&y(P.displacementMap.channel),emissiveMapUv:ae&&y(P.emissiveMap.channel),metalnessMapUv:ie&&y(P.metalnessMap.channel),roughnessMapUv:we&&y(P.roughnessMap.channel),anisotropyMapUv:fe&&y(P.anisotropyMap.channel),clearcoatMapUv:Ke&&y(P.clearcoatMap.channel),clearcoatNormalMapUv:Ie&&y(P.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:$e&&y(P.clearcoatRoughnessMap.channel),iridescenceMapUv:rt&&y(P.iridescenceMap.channel),iridescenceThicknessMapUv:ke&&y(P.iridescenceThicknessMap.channel),sheenColorMapUv:De&&y(P.sheenColorMap.channel),sheenRoughnessMapUv:ct&&y(P.sheenRoughnessMap.channel),specularMapUv:et&&y(P.specularMap.channel),specularColorMapUv:Je&&y(P.specularColorMap.channel),specularIntensityMapUv:st&&y(P.specularIntensityMap.channel),transmissionMapUv:ue&&y(P.transmissionMap.channel),thicknessMapUv:tt&&y(P.thicknessMap.channel),alphaMapUv:Le&&y(P.alphaMap.channel),vertexTangents:!!W.attributes.tangent&&(Q||ve),vertexColors:P.vertexColors,vertexAlphas:P.vertexColors===!0&&!!W.attributes.color&&W.attributes.color.itemSize===4,pointsUvs:$.isPoints===!0&&!!W.attributes.uv&&(Be||Le),fog:!!I,useFog:P.fog===!0,fogExp2:!!I&&I.isFogExp2,flatShading:P.flatShading===!0&&P.wireframe===!1,sizeAttenuation:P.sizeAttenuation===!0,logarithmicDepthBuffer:h,reversedDepthBuffer:Ne,skinning:$.isSkinnedMesh===!0,morphTargets:W.morphAttributes.position!==void 0,morphNormals:W.morphAttributes.normal!==void 0,morphColors:W.morphAttributes.color!==void 0,morphTargetsCount:H,morphTextureStride:q,numDirLights:L.directional.length,numPointLights:L.point.length,numSpotLights:L.spot.length,numSpotLightMaps:L.spotLightMap.length,numRectAreaLights:L.rectArea.length,numHemiLights:L.hemi.length,numDirLightShadows:L.directionalShadowMap.length,numPointLightShadows:L.pointShadowMap.length,numSpotLightShadows:L.spotShadowMap.length,numSpotLightShadowsWithMaps:L.numSpotLightShadowsWithMaps,numLightProbes:L.numLightProbes,numClippingPlanes:s.numPlanes,numClipIntersection:s.numIntersection,dithering:P.dithering,shadowMapEnabled:t.shadowMap.enabled&&B.length>0,shadowMapType:t.shadowMap.type,toneMapping:at,decodeVideoTexture:Be&&P.map.isVideoTexture===!0&&un.getTransfer(P.map.colorSpace)===En,decodeVideoTextureEmissive:ae&&P.emissiveMap.isVideoTexture===!0&&un.getTransfer(P.emissiveMap.colorSpace)===En,premultipliedAlpha:P.premultipliedAlpha,doubleSided:P.side===Os,flipSided:P.side===Kr,useDepthPacking:P.depthPacking>=0,depthPacking:P.depthPacking||0,index0AttributeName:P.index0AttributeName,extensionClipCullDistance:je&&P.extensions.clipCullDistance===!0&&i.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(je&&P.extensions.multiDraw===!0||Ae)&&i.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:i.has("KHR_parallel_shader_compile"),customProgramCacheKey:P.customProgramCacheKey()};return mt.vertexUv1s=d.has(1),mt.vertexUv2s=d.has(2),mt.vertexUv3s=d.has(3),d.clear(),mt}function v(P){const L=[];if(P.shaderID?L.push(P.shaderID):(L.push(P.customVertexShaderID),L.push(P.customFragmentShaderID)),P.defines!==void 0)for(const B in P.defines)L.push(B),L.push(P.defines[B]);return P.isRawShaderMaterial===!1&&(w(L,P),S(L,P),L.push(t.outputColorSpace)),L.push(P.customProgramCacheKey),L.join()}function w(P,L){P.push(L.precision),P.push(L.outputColorSpace),P.push(L.envMapMode),P.push(L.envMapCubeUVHeight),P.push(L.mapUv),P.push(L.alphaMapUv),P.push(L.lightMapUv),P.push(L.aoMapUv),P.push(L.bumpMapUv),P.push(L.normalMapUv),P.push(L.displacementMapUv),P.push(L.emissiveMapUv),P.push(L.metalnessMapUv),P.push(L.roughnessMapUv),P.push(L.anisotropyMapUv),P.push(L.clearcoatMapUv),P.push(L.clearcoatNormalMapUv),P.push(L.clearcoatRoughnessMapUv),P.push(L.iridescenceMapUv),P.push(L.iridescenceThicknessMapUv),P.push(L.sheenColorMapUv),P.push(L.sheenRoughnessMapUv),P.push(L.specularMapUv),P.push(L.specularColorMapUv),P.push(L.specularIntensityMapUv),P.push(L.transmissionMapUv),P.push(L.thicknessMapUv),P.push(L.combine),P.push(L.fogExp2),P.push(L.sizeAttenuation),P.push(L.morphTargetsCount),P.push(L.morphAttributeCount),P.push(L.numDirLights),P.push(L.numPointLights),P.push(L.numSpotLights),P.push(L.numSpotLightMaps),P.push(L.numHemiLights),P.push(L.numRectAreaLights),P.push(L.numDirLightShadows),P.push(L.numPointLightShadows),P.push(L.numSpotLightShadows),P.push(L.numSpotLightShadowsWithMaps),P.push(L.numLightProbes),P.push(L.shadowMapType),P.push(L.toneMapping),P.push(L.numClippingPlanes),P.push(L.numClipIntersection),P.push(L.depthPacking)}function S(P,L){l.disableAll(),L.supportsVertexTextures&&l.enable(0),L.instancing&&l.enable(1),L.instancingColor&&l.enable(2),L.instancingMorph&&l.enable(3),L.matcap&&l.enable(4),L.envMap&&l.enable(5),L.normalMapObjectSpace&&l.enable(6),L.normalMapTangentSpace&&l.enable(7),L.clearcoat&&l.enable(8),L.iridescence&&l.enable(9),L.alphaTest&&l.enable(10),L.vertexColors&&l.enable(11),L.vertexAlphas&&l.enable(12),L.vertexUv1s&&l.enable(13),L.vertexUv2s&&l.enable(14),L.vertexUv3s&&l.enable(15),L.vertexTangents&&l.enable(16),L.anisotropy&&l.enable(17),L.alphaHash&&l.enable(18),L.batching&&l.enable(19),L.dispersion&&l.enable(20),L.batchingColor&&l.enable(21),L.gradientMap&&l.enable(22),P.push(l.mask),l.disableAll(),L.fog&&l.enable(0),L.useFog&&l.enable(1),L.flatShading&&l.enable(2),L.logarithmicDepthBuffer&&l.enable(3),L.reversedDepthBuffer&&l.enable(4),L.skinning&&l.enable(5),L.morphTargets&&l.enable(6),L.morphNormals&&l.enable(7),L.morphColors&&l.enable(8),L.premultipliedAlpha&&l.enable(9),L.shadowMapEnabled&&l.enable(10),L.doubleSided&&l.enable(11),L.flipSided&&l.enable(12),L.useDepthPacking&&l.enable(13),L.dithering&&l.enable(14),L.transmission&&l.enable(15),L.sheen&&l.enable(16),L.opaque&&l.enable(17),L.pointsUvs&&l.enable(18),L.decodeVideoTexture&&l.enable(19),L.decodeVideoTextureEmissive&&l.enable(20),L.alphaToCoverage&&l.enable(21),P.push(l.mask)}function A(P){const L=b[P.type];let B;if(L){const U=Ns[L];B=jY.clone(U.uniforms)}else B=P.uniforms;return B}function R(P,L){let B;for(let U=0,$=f.length;U<$;U++){const I=f[U];if(I.cacheKey===L){B=I,++B.usedTimes;break}}return B===void 0&&(B=new yee(t,L,P,a),f.push(B)),B}function N(P){if(--P.usedTimes===0){const L=f.indexOf(P);f[L]=f[f.length-1],f.pop(),P.destroy()}}function C(P){c.remove(P)}function F(){c.dispose()}return{getParameters:x,getProgramCacheKey:v,getUniforms:A,acquireProgram:R,releaseProgram:N,releaseShaderCache:C,programs:f,dispose:F}}function Eee(){let t=new WeakMap;function e(s){return t.has(s)}function n(s){let l=t.get(s);return l===void 0&&(l={},t.set(s,l)),l}function i(s){t.delete(s)}function r(s,l,c){t.get(s)[l]=c}function a(){t=new WeakMap}return{has:e,get:n,remove:i,update:r,dispose:a}}function Mee(t,e){return t.groupOrder!==e.groupOrder?t.groupOrder-e.groupOrder:t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.material.id!==e.material.id?t.material.id-e.material.id:t.z!==e.z?t.z-e.z:t.id-e.id}function hO(t,e){return t.groupOrder!==e.groupOrder?t.groupOrder-e.groupOrder:t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.z!==e.z?e.z-t.z:t.id-e.id}function pO(){const t=[];let e=0;const n=[],i=[],r=[];function a(){e=0,n.length=0,i.length=0,r.length=0}function s(h,g,m,b,y,x){let v=t[e];return v===void 0?(v={id:h.id,object:h,geometry:g,material:m,groupOrder:b,renderOrder:h.renderOrder,z:y,group:x},t[e]=v):(v.id=h.id,v.object=h,v.geometry=g,v.material=m,v.groupOrder=b,v.renderOrder=h.renderOrder,v.z=y,v.group=x),e++,v}function l(h,g,m,b,y,x){const v=s(h,g,m,b,y,x);m.transmission>0?i.push(v):m.transparent===!0?r.push(v):n.push(v)}function c(h,g,m,b,y,x){const v=s(h,g,m,b,y,x);m.transmission>0?i.unshift(v):m.transparent===!0?r.unshift(v):n.unshift(v)}function d(h,g){n.length>1&&n.sort(h||Mee),i.length>1&&i.sort(g||hO),r.length>1&&r.sort(g||hO)}function f(){for(let h=e,g=t.length;h<g;h++){const m=t[h];if(m.id===null)break;m.id=null,m.object=null,m.geometry=null,m.material=null,m.group=null}}return{opaque:n,transmissive:i,transparent:r,init:a,push:l,unshift:c,finish:f,sort:d}}function Aee(){let t=new WeakMap;function e(i,r){const a=t.get(i);let s;return a===void 0?(s=new pO,t.set(i,[s])):r>=a.length?(s=new pO,a.push(s)):s=a[r],s}function n(){t=new WeakMap}return{get:e,dispose:n}}function Tee(){const t={};return{get:function(e){if(t[e.id]!==void 0)return t[e.id];let n;switch(e.type){case"DirectionalLight":n={direction:new Ve,color:new nn};break;case"SpotLight":n={position:new Ve,direction:new Ve,color:new nn,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new Ve,color:new nn,distance:0,decay:0};break;case"HemisphereLight":n={direction:new Ve,skyColor:new nn,groundColor:new nn};break;case"RectAreaLight":n={color:new nn,position:new Ve,halfWidth:new Ve,halfHeight:new Ve};break}return t[e.id]=n,n}}}function Cee(){const t={};return{get:function(e){if(t[e.id]!==void 0)return t[e.id];let n;switch(e.type){case"DirectionalLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new $t};break;case"SpotLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new $t};break;case"PointLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new $t,shadowCameraNear:1,shadowCameraFar:1e3};break}return t[e.id]=n,n}}}let Ree=0;function Pee(t,e){return(e.castShadow?2:0)-(t.castShadow?2:0)+(e.map?1:0)-(t.map?1:0)}function Dee(t){const e=new Tee,n=Cee(),i={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-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,numLightProbes:0};for(let d=0;d<9;d++)i.probe.push(new Ve);const r=new Ve,a=new bi,s=new bi;function l(d){let f=0,h=0,g=0;for(let P=0;P<9;P++)i.probe[P].set(0,0,0);let m=0,b=0,y=0,x=0,v=0,w=0,S=0,A=0,R=0,N=0,C=0;d.sort(Pee);for(let P=0,L=d.length;P<L;P++){const B=d[P],U=B.color,$=B.intensity,I=B.distance,W=B.shadow&&B.shadow.map?B.shadow.map.texture:null;if(B.isAmbientLight)f+=U.r*$,h+=U.g*$,g+=U.b*$;else if(B.isLightProbe){for(let X=0;X<9;X++)i.probe[X].addScaledVector(B.sh.coefficients[X],$);C++}else if(B.isDirectionalLight){const X=e.get(B);if(X.color.copy(B.color).multiplyScalar(B.intensity),B.castShadow){const V=B.shadow,Y=n.get(B);Y.shadowIntensity=V.intensity,Y.shadowBias=V.bias,Y.shadowNormalBias=V.normalBias,Y.shadowRadius=V.radius,Y.shadowMapSize=V.mapSize,i.directionalShadow[m]=Y,i.directionalShadowMap[m]=W,i.directionalShadowMatrix[m]=B.shadow.matrix,w++}i.directional[m]=X,m++}else if(B.isSpotLight){const X=e.get(B);X.position.setFromMatrixPosition(B.matrixWorld),X.color.copy(U).multiplyScalar($),X.distance=I,X.coneCos=Math.cos(B.angle),X.penumbraCos=Math.cos(B.angle*(1-B.penumbra)),X.decay=B.decay,i.spot[y]=X;const V=B.shadow;if(B.map&&(i.spotLightMap[R]=B.map,R++,V.updateMatrices(B),B.castShadow&&N++),i.spotLightMatrix[y]=V.matrix,B.castShadow){const Y=n.get(B);Y.shadowIntensity=V.intensity,Y.shadowBias=V.bias,Y.shadowNormalBias=V.normalBias,Y.shadowRadius=V.radius,Y.shadowMapSize=V.mapSize,i.spotShadow[y]=Y,i.spotShadowMap[y]=W,A++}y++}else if(B.isRectAreaLight){const X=e.get(B);X.color.copy(U).multiplyScalar($),X.halfWidth.set(B.width*.5,0,0),X.halfHeight.set(0,B.height*.5,0),i.rectArea[x]=X,x++}else if(B.isPointLight){const X=e.get(B);if(X.color.copy(B.color).multiplyScalar(B.intensity),X.distance=B.distance,X.decay=B.decay,B.castShadow){const V=B.shadow,Y=n.get(B);Y.shadowIntensity=V.intensity,Y.shadowBias=V.bias,Y.shadowNormalBias=V.normalBias,Y.shadowRadius=V.radius,Y.shadowMapSize=V.mapSize,Y.shadowCameraNear=V.camera.near,Y.shadowCameraFar=V.camera.far,i.pointShadow[b]=Y,i.pointShadowMap[b]=W,i.pointShadowMatrix[b]=B.shadow.matrix,S++}i.point[b]=X,b++}else if(B.isHemisphereLight){const X=e.get(B);X.skyColor.copy(B.color).multiplyScalar($),X.groundColor.copy(B.groundColor).multiplyScalar($),i.hemi[v]=X,v++}}x>0&&(t.has("OES_texture_float_linear")===!0?(i.rectAreaLTC1=vt.LTC_FLOAT_1,i.rectAreaLTC2=vt.LTC_FLOAT_2):(i.rectAreaLTC1=vt.LTC_HALF_1,i.rectAreaLTC2=vt.LTC_HALF_2)),i.ambient[0]=f,i.ambient[1]=h,i.ambient[2]=g;const F=i.hash;(F.directionalLength!==m||F.pointLength!==b||F.spotLength!==y||F.rectAreaLength!==x||F.hemiLength!==v||F.numDirectionalShadows!==w||F.numPointShadows!==S||F.numSpotShadows!==A||F.numSpotMaps!==R||F.numLightProbes!==C)&&(i.directional.length=m,i.spot.length=y,i.rectArea.length=x,i.point.length=b,i.hemi.length=v,i.directionalShadow.length=w,i.directionalShadowMap.length=w,i.pointShadow.length=S,i.pointShadowMap.length=S,i.spotShadow.length=A,i.spotShadowMap.length=A,i.directionalShadowMatrix.length=w,i.pointShadowMatrix.length=S,i.spotLightMatrix.length=A+R-N,i.spotLightMap.length=R,i.numSpotLightShadowsWithMaps=N,i.numLightProbes=C,F.directionalLength=m,F.pointLength=b,F.spotLength=y,F.rectAreaLength=x,F.hemiLength=v,F.numDirectionalShadows=w,F.numPointShadows=S,F.numSpotShadows=A,F.numSpotMaps=R,F.numLightProbes=C,i.version=Ree++)}function c(d,f){let h=0,g=0,m=0,b=0,y=0;const x=f.matrixWorldInverse;for(let v=0,w=d.length;v<w;v++){const S=d[v];if(S.isDirectionalLight){const A=i.directional[h];A.direction.setFromMatrixPosition(S.matrixWorld),r.setFromMatrixPosition(S.target.matrixWorld),A.direction.sub(r),A.direction.transformDirection(x),h++}else if(S.isSpotLight){const A=i.spot[m];A.position.setFromMatrixPosition(S.matrixWorld),A.position.applyMatrix4(x),A.direction.setFromMatrixPosition(S.matrixWorld),r.setFromMatrixPosition(S.target.matrixWorld),A.direction.sub(r),A.direction.transformDirection(x),m++}else if(S.isRectAreaLight){const A=i.rectArea[b];A.position.setFromMatrixPosition(S.matrixWorld),A.position.applyMatrix4(x),s.identity(),a.copy(S.matrixWorld),a.premultiply(x),s.extractRotation(a),A.halfWidth.set(S.width*.5,0,0),A.halfHeight.set(0,S.height*.5,0),A.halfWidth.applyMatrix4(s),A.halfHeight.applyMatrix4(s),b++}else if(S.isPointLight){const A=i.point[g];A.position.setFromMatrixPosition(S.matrixWorld),A.position.applyMatrix4(x),g++}else if(S.isHemisphereLight){const A=i.hemi[y];A.direction.setFromMatrixPosition(S.matrixWorld),A.direction.transformDirection(x),y++}}}return{setup:l,setupView:c,state:i}}function mO(t){const e=new Dee(t),n=[],i=[];function r(f){d.camera=f,n.length=0,i.length=0}function a(f){n.push(f)}function s(f){i.push(f)}function l(){e.setup(n)}function c(f){e.setupView(n,f)}const d={lightsArray:n,shadowsArray:i,camera:null,lights:e,transmissionRenderTarget:{}};return{init:r,state:d,setupLights:l,setupLightsView:c,pushLight:a,pushShadow:s}}function Nee(t){let e=new WeakMap;function n(r,a=0){const s=e.get(r);let l;return s===void 0?(l=new mO(t),e.set(r,[l])):a>=s.length?(l=new mO(t),s.push(l)):l=s[a],l}function i(){e=new WeakMap}return{get:n,dispose:i}}const Oee=`void main() {
  3797. gl_Position = vec4( position, 1.0 );
  3798. }`,Lee=`uniform sampler2D shadow_pass;
  3799. uniform vec2 resolution;
  3800. uniform float radius;
  3801. #include <packing>
  3802. void main() {
  3803. const float samples = float( VSM_SAMPLES );
  3804. float mean = 0.0;
  3805. float squared_mean = 0.0;
  3806. float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );
  3807. float uvStart = samples <= 1.0 ? 0.0 : - 1.0;
  3808. for ( float i = 0.0; i < samples; i ++ ) {
  3809. float uvOffset = uvStart + i * uvStride;
  3810. #ifdef HORIZONTAL_PASS
  3811. vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) );
  3812. mean += distribution.x;
  3813. squared_mean += distribution.y * distribution.y + distribution.x * distribution.x;
  3814. #else
  3815. float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) );
  3816. mean += depth;
  3817. squared_mean += depth * depth;
  3818. #endif
  3819. }
  3820. mean = mean / samples;
  3821. squared_mean = squared_mean / samples;
  3822. float std_dev = sqrt( squared_mean - mean * mean );
  3823. gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );
  3824. }`;function Iee(t,e,n){let i=new PT;const r=new $t,a=new $t,s=new gi,l=new tK({depthPacking:uY}),c=new nK,d={},f=n.maxTextureSize,h={[oc]:Kr,[Kr]:oc,[Os]:Os},g=new $o({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new $t},radius:{value:4}},vertexShader:Oee,fragmentShader:Lee}),m=g.clone();m.defines.HORIZONTAL_PASS=1;const b=new Ks;b.setAttribute("position",new Xa(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const y=new Hs(b,g),x=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=zz;let v=this.type;this.render=function(N,C,F){if(x.enabled===!1||x.autoUpdate===!1&&x.needsUpdate===!1||N.length===0)return;const P=t.getRenderTarget(),L=t.getActiveCubeFace(),B=t.getActiveMipmapLevel(),U=t.state;U.setBlending(zo),U.buffers.depth.getReversed()===!0?U.buffers.color.setClear(0,0,0,0):U.buffers.color.setClear(1,1,1,1),U.buffers.depth.setTest(!0),U.setScissorTest(!1);const $=v!==To&&this.type===To,I=v===To&&this.type!==To;for(let W=0,X=N.length;W<X;W++){const V=N[W],Y=V.shadow;if(Y===void 0){It("WebGLShadowMap:",V,"has no shadow.");continue}if(Y.autoUpdate===!1&&Y.needsUpdate===!1)continue;r.copy(Y.mapSize);const J=Y.getFrameExtents();if(r.multiply(J),a.copy(Y.mapSize),(r.x>f||r.y>f)&&(r.x>f&&(a.x=Math.floor(f/J.x),r.x=a.x*J.x,Y.mapSize.x=a.x),r.y>f&&(a.y=Math.floor(f/J.y),r.y=a.y*J.y,Y.mapSize.y=a.y)),Y.map===null||$===!0||I===!0){const H=this.type!==To?{minFilter:xa,magFilter:xa}:{};Y.map!==null&&Y.map.dispose(),Y.map=new Su(r.x,r.y,H),Y.map.texture.name=V.name+".shadowMap",Y.camera.updateProjectionMatrix()}t.setRenderTarget(Y.map),t.clear();const se=Y.getViewportCount();for(let H=0;H<se;H++){const q=Y.getViewport(H);s.set(a.x*q.x,a.y*q.y,a.x*q.z,a.y*q.w),U.viewport(s),Y.updateMatrices(V,H),i=Y.getFrustum(),A(C,F,Y.camera,V,this.type)}Y.isPointLightShadow!==!0&&this.type===To&&w(Y,F),Y.needsUpdate=!1}v=this.type,x.needsUpdate=!1,t.setRenderTarget(P,L,B)};function w(N,C){const F=e.update(y);g.defines.VSM_SAMPLES!==N.blurSamples&&(g.defines.VSM_SAMPLES=N.blurSamples,m.defines.VSM_SAMPLES=N.blurSamples,g.needsUpdate=!0,m.needsUpdate=!0),N.mapPass===null&&(N.mapPass=new Su(r.x,r.y)),g.uniforms.shadow_pass.value=N.map.texture,g.uniforms.resolution.value=N.mapSize,g.uniforms.radius.value=N.radius,t.setRenderTarget(N.mapPass),t.clear(),t.renderBufferDirect(C,null,F,g,y,null),m.uniforms.shadow_pass.value=N.mapPass.texture,m.uniforms.resolution.value=N.mapSize,m.uniforms.radius.value=N.radius,t.setRenderTarget(N.map),t.clear(),t.renderBufferDirect(C,null,F,m,y,null)}function S(N,C,F,P){let L=null;const B=F.isPointLight===!0?N.customDistanceMaterial:N.customDepthMaterial;if(B!==void 0)L=B;else if(L=F.isPointLight===!0?c:l,t.localClippingEnabled&&C.clipShadows===!0&&Array.isArray(C.clippingPlanes)&&C.clippingPlanes.length!==0||C.displacementMap&&C.displacementScale!==0||C.alphaMap&&C.alphaTest>0||C.map&&C.alphaTest>0||C.alphaToCoverage===!0){const U=L.uuid,$=C.uuid;let I=d[U];I===void 0&&(I={},d[U]=I);let W=I[$];W===void 0&&(W=L.clone(),I[$]=W,C.addEventListener("dispose",R)),L=W}if(L.visible=C.visible,L.wireframe=C.wireframe,P===To?L.side=C.shadowSide!==null?C.shadowSide:C.side:L.side=C.shadowSide!==null?C.shadowSide:h[C.side],L.alphaMap=C.alphaMap,L.alphaTest=C.alphaToCoverage===!0?.5:C.alphaTest,L.map=C.map,L.clipShadows=C.clipShadows,L.clippingPlanes=C.clippingPlanes,L.clipIntersection=C.clipIntersection,L.displacementMap=C.displacementMap,L.displacementScale=C.displacementScale,L.displacementBias=C.displacementBias,L.wireframeLinewidth=C.wireframeLinewidth,L.linewidth=C.linewidth,F.isPointLight===!0&&L.isMeshDistanceMaterial===!0){const U=t.properties.get(L);U.light=F}return L}function A(N,C,F,P,L){if(N.visible===!1)return;if(N.layers.test(C.layers)&&(N.isMesh||N.isLine||N.isPoints)&&(N.castShadow||N.receiveShadow&&L===To)&&(!N.frustumCulled||i.intersectsObject(N))){N.modelViewMatrix.multiplyMatrices(F.matrixWorldInverse,N.matrixWorld);const $=e.update(N),I=N.material;if(Array.isArray(I)){const W=$.groups;for(let X=0,V=W.length;X<V;X++){const Y=W[X],J=I[Y.materialIndex];if(J&&J.visible){const se=S(N,J,P,L);N.onBeforeShadow(t,N,C,F,$,se,Y),t.renderBufferDirect(F,null,$,se,N,Y),N.onAfterShadow(t,N,C,F,$,se,Y)}}}else if(I.visible){const W=S(N,I,P,L);N.onBeforeShadow(t,N,C,F,$,W,null),t.renderBufferDirect(F,null,$,W,N,null),N.onAfterShadow(t,N,C,F,$,W,null)}}const U=N.children;for(let $=0,I=U.length;$<I;$++)A(U[$],C,F,P,L)}function R(N){N.target.removeEventListener("dispose",R);for(const F in d){const P=d[F],L=N.target.uuid;L in P&&(P[L].dispose(),delete P[L])}}}const Uee={[XE]:qE,[YE]:QE,[KE]:JE,[vf]:ZE,[qE]:XE,[QE]:YE,[JE]:KE,[ZE]:vf};function kee(t,e){function n(){let ue=!1;const tt=new gi;let de=null;const Le=new gi(0,0,0,0);return{setMask:function(Me){de!==Me&&!ue&&(t.colorMask(Me,Me,Me,Me),de=Me)},setLocked:function(Me){ue=Me},setClear:function(Me,ge,je,at,mt){mt===!0&&(Me*=at,ge*=at,je*=at),tt.set(Me,ge,je,at),Le.equals(tt)===!1&&(t.clearColor(Me,ge,je,at),Le.copy(tt))},reset:function(){ue=!1,de=null,Le.set(-1,0,0,0)}}}function i(){let ue=!1,tt=!1,de=null,Le=null,Me=null;return{setReversed:function(ge){if(tt!==ge){const je=e.get("EXT_clip_control");ge?je.clipControlEXT(je.LOWER_LEFT_EXT,je.ZERO_TO_ONE_EXT):je.clipControlEXT(je.LOWER_LEFT_EXT,je.NEGATIVE_ONE_TO_ONE_EXT),tt=ge;const at=Me;Me=null,this.setClear(at)}},getReversed:function(){return tt},setTest:function(ge){ge?be(t.DEPTH_TEST):Ne(t.DEPTH_TEST)},setMask:function(ge){de!==ge&&!ue&&(t.depthMask(ge),de=ge)},setFunc:function(ge){if(tt&&(ge=Uee[ge]),Le!==ge){switch(ge){case XE:t.depthFunc(t.NEVER);break;case qE:t.depthFunc(t.ALWAYS);break;case YE:t.depthFunc(t.LESS);break;case vf:t.depthFunc(t.LEQUAL);break;case KE:t.depthFunc(t.EQUAL);break;case ZE:t.depthFunc(t.GEQUAL);break;case QE:t.depthFunc(t.GREATER);break;case JE:t.depthFunc(t.NOTEQUAL);break;default:t.depthFunc(t.LEQUAL)}Le=ge}},setLocked:function(ge){ue=ge},setClear:function(ge){Me!==ge&&(tt&&(ge=1-ge),t.clearDepth(ge),Me=ge)},reset:function(){ue=!1,de=null,Le=null,Me=null,tt=!1}}}function r(){let ue=!1,tt=null,de=null,Le=null,Me=null,ge=null,je=null,at=null,mt=null;return{setTest:function(wt){ue||(wt?be(t.STENCIL_TEST):Ne(t.STENCIL_TEST))},setMask:function(wt){tt!==wt&&!ue&&(t.stencilMask(wt),tt=wt)},setFunc:function(wt,Wt,Ct){(de!==wt||Le!==Wt||Me!==Ct)&&(t.stencilFunc(wt,Wt,Ct),de=wt,Le=Wt,Me=Ct)},setOp:function(wt,Wt,Ct){(ge!==wt||je!==Wt||at!==Ct)&&(t.stencilOp(wt,Wt,Ct),ge=wt,je=Wt,at=Ct)},setLocked:function(wt){ue=wt},setClear:function(wt){mt!==wt&&(t.clearStencil(wt),mt=wt)},reset:function(){ue=!1,tt=null,de=null,Le=null,Me=null,ge=null,je=null,at=null,mt=null}}}const a=new n,s=new i,l=new r,c=new WeakMap,d=new WeakMap;let f={},h={},g=new WeakMap,m=[],b=null,y=!1,x=null,v=null,w=null,S=null,A=null,R=null,N=null,C=new nn(0,0,0),F=0,P=!1,L=null,B=null,U=null,$=null,I=null;const W=t.getParameter(t.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let X=!1,V=0;const Y=t.getParameter(t.VERSION);Y.indexOf("WebGL")!==-1?(V=parseFloat(/^WebGL (\d)/.exec(Y)[1]),X=V>=1):Y.indexOf("OpenGL ES")!==-1&&(V=parseFloat(/^OpenGL ES (\d)/.exec(Y)[1]),X=V>=2);let J=null,se={};const H=t.getParameter(t.SCISSOR_BOX),q=t.getParameter(t.VIEWPORT),re=new gi().fromArray(H),ce=new gi().fromArray(q);function ye(ue,tt,de,Le){const Me=new Uint8Array(4),ge=t.createTexture();t.bindTexture(ue,ge),t.texParameteri(ue,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(ue,t.TEXTURE_MAG_FILTER,t.NEAREST);for(let je=0;je<de;je++)ue===t.TEXTURE_3D||ue===t.TEXTURE_2D_ARRAY?t.texImage3D(tt,0,t.RGBA,1,1,Le,0,t.RGBA,t.UNSIGNED_BYTE,Me):t.texImage2D(tt+je,0,t.RGBA,1,1,0,t.RGBA,t.UNSIGNED_BYTE,Me);return ge}const me={};me[t.TEXTURE_2D]=ye(t.TEXTURE_2D,t.TEXTURE_2D,1),me[t.TEXTURE_CUBE_MAP]=ye(t.TEXTURE_CUBE_MAP,t.TEXTURE_CUBE_MAP_POSITIVE_X,6),me[t.TEXTURE_2D_ARRAY]=ye(t.TEXTURE_2D_ARRAY,t.TEXTURE_2D_ARRAY,1,1),me[t.TEXTURE_3D]=ye(t.TEXTURE_3D,t.TEXTURE_3D,1,1),a.setClear(0,0,0,1),s.setClear(1),l.setClear(0),be(t.DEPTH_TEST),s.setFunc(vf),ne(!1),Q(hN),be(t.CULL_FACE),z(zo);function be(ue){f[ue]!==!0&&(t.enable(ue),f[ue]=!0)}function Ne(ue){f[ue]!==!1&&(t.disable(ue),f[ue]=!1)}function he(ue,tt){return h[ue]!==tt?(t.bindFramebuffer(ue,tt),h[ue]=tt,ue===t.DRAW_FRAMEBUFFER&&(h[t.FRAMEBUFFER]=tt),ue===t.FRAMEBUFFER&&(h[t.DRAW_FRAMEBUFFER]=tt),!0):!1}function Ae(ue,tt){let de=m,Le=!1;if(ue){de=g.get(tt),de===void 0&&(de=[],g.set(tt,de));const Me=ue.textures;if(de.length!==Me.length||de[0]!==t.COLOR_ATTACHMENT0){for(let ge=0,je=Me.length;ge<je;ge++)de[ge]=t.COLOR_ATTACHMENT0+ge;de.length=Me.length,Le=!0}}else de[0]!==t.BACK&&(de[0]=t.BACK,Le=!0);Le&&t.drawBuffers(de)}function Be(ue){return b!==ue?(t.useProgram(ue),b=ue,!0):!1}const le={[Zc]:t.FUNC_ADD,[Uq]:t.FUNC_SUBTRACT,[kq]:t.FUNC_REVERSE_SUBTRACT};le[Fq]=t.MIN,le[zq]=t.MAX;const lt={[Bq]:t.ZERO,[jq]:t.ONE,[Hq]:t.SRC_COLOR,[$E]:t.SRC_ALPHA,[qq]:t.SRC_ALPHA_SATURATE,[Wq]:t.DST_COLOR,[Vq]:t.DST_ALPHA,[Gq]:t.ONE_MINUS_SRC_COLOR,[WE]:t.ONE_MINUS_SRC_ALPHA,[Xq]:t.ONE_MINUS_DST_COLOR,[$q]:t.ONE_MINUS_DST_ALPHA,[Yq]:t.CONSTANT_COLOR,[Kq]:t.ONE_MINUS_CONSTANT_COLOR,[Zq]:t.CONSTANT_ALPHA,[Qq]:t.ONE_MINUS_CONSTANT_ALPHA};function z(ue,tt,de,Le,Me,ge,je,at,mt,wt){if(ue===zo){y===!0&&(Ne(t.BLEND),y=!1);return}if(y===!1&&(be(t.BLEND),y=!0),ue!==Iq){if(ue!==x||wt!==P){if((v!==Zc||A!==Zc)&&(t.blendEquation(t.FUNC_ADD),v=Zc,A=Zc),wt)switch(ue){case of:t.blendFuncSeparate(t.ONE,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA);break;case pN:t.blendFunc(t.ONE,t.ONE);break;case mN:t.blendFuncSeparate(t.ZERO,t.ONE_MINUS_SRC_COLOR,t.ZERO,t.ONE);break;case gN:t.blendFuncSeparate(t.DST_COLOR,t.ONE_MINUS_SRC_ALPHA,t.ZERO,t.ONE);break;default:ai("WebGLState: Invalid blending: ",ue);break}else switch(ue){case of:t.blendFuncSeparate(t.SRC_ALPHA,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA);break;case pN:t.blendFuncSeparate(t.SRC_ALPHA,t.ONE,t.ONE,t.ONE);break;case mN:ai("WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true");break;case gN:ai("WebGLState: MultiplyBlending requires material.premultipliedAlpha = true");break;default:ai("WebGLState: Invalid blending: ",ue);break}w=null,S=null,R=null,N=null,C.set(0,0,0),F=0,x=ue,P=wt}return}Me=Me||tt,ge=ge||de,je=je||Le,(tt!==v||Me!==A)&&(t.blendEquationSeparate(le[tt],le[Me]),v=tt,A=Me),(de!==w||Le!==S||ge!==R||je!==N)&&(t.blendFuncSeparate(lt[de],lt[Le],lt[ge],lt[je]),w=de,S=Le,R=ge,N=je),(at.equals(C)===!1||mt!==F)&&(t.blendColor(at.r,at.g,at.b,mt),C.copy(at),F=mt),x=ue,P=!1}function G(ue,tt){ue.side===Os?Ne(t.CULL_FACE):be(t.CULL_FACE);let de=ue.side===Kr;tt&&(de=!de),ne(de),ue.blending===of&&ue.transparent===!1?z(zo):z(ue.blending,ue.blendEquation,ue.blendSrc,ue.blendDst,ue.blendEquationAlpha,ue.blendSrcAlpha,ue.blendDstAlpha,ue.blendColor,ue.blendAlpha,ue.premultipliedAlpha),s.setFunc(ue.depthFunc),s.setTest(ue.depthTest),s.setMask(ue.depthWrite),a.setMask(ue.colorWrite);const Le=ue.stencilWrite;l.setTest(Le),Le&&(l.setMask(ue.stencilWriteMask),l.setFunc(ue.stencilFunc,ue.stencilRef,ue.stencilFuncMask),l.setOp(ue.stencilFail,ue.stencilZFail,ue.stencilZPass)),ae(ue.polygonOffset,ue.polygonOffsetFactor,ue.polygonOffsetUnits),ue.alphaToCoverage===!0?be(t.SAMPLE_ALPHA_TO_COVERAGE):Ne(t.SAMPLE_ALPHA_TO_COVERAGE)}function ne(ue){L!==ue&&(ue?t.frontFace(t.CW):t.frontFace(t.CCW),L=ue)}function Q(ue){ue!==Nq?(be(t.CULL_FACE),ue!==B&&(ue===hN?t.cullFace(t.BACK):ue===Oq?t.cullFace(t.FRONT):t.cullFace(t.FRONT_AND_BACK))):Ne(t.CULL_FACE),B=ue}function ee(ue){ue!==U&&(X&&t.lineWidth(ue),U=ue)}function ae(ue,tt,de){ue?(be(t.POLYGON_OFFSET_FILL),($!==tt||I!==de)&&(t.polygonOffset(tt,de),$=tt,I=de)):Ne(t.POLYGON_OFFSET_FILL)}function ie(ue){ue?be(t.SCISSOR_TEST):Ne(t.SCISSOR_TEST)}function we(ue){ue===void 0&&(ue=t.TEXTURE0+W-1),J!==ue&&(t.activeTexture(ue),J=ue)}function ve(ue,tt,de){de===void 0&&(J===null?de=t.TEXTURE0+W-1:de=J);let Le=se[de];Le===void 0&&(Le={type:void 0,texture:void 0},se[de]=Le),(Le.type!==ue||Le.texture!==tt)&&(J!==de&&(t.activeTexture(de),J=de),t.bindTexture(ue,tt||me[ue]),Le.type=ue,Le.texture=tt)}function k(){const ue=se[J];ue!==void 0&&ue.type!==void 0&&(t.bindTexture(ue.type,null),ue.type=void 0,ue.texture=void 0)}function O(){try{t.compressedTexImage2D(...arguments)}catch(ue){ue("WebGLState:",ue)}}function K(){try{t.compressedTexImage3D(...arguments)}catch(ue){ue("WebGLState:",ue)}}function pe(){try{t.texSubImage2D(...arguments)}catch(ue){ue("WebGLState:",ue)}}function xe(){try{t.texSubImage3D(...arguments)}catch(ue){ue("WebGLState:",ue)}}function fe(){try{t.compressedTexSubImage2D(...arguments)}catch(ue){ue("WebGLState:",ue)}}function Ke(){try{t.compressedTexSubImage3D(...arguments)}catch(ue){ue("WebGLState:",ue)}}function Ie(){try{t.texStorage2D(...arguments)}catch(ue){ue("WebGLState:",ue)}}function $e(){try{t.texStorage3D(...arguments)}catch(ue){ue("WebGLState:",ue)}}function rt(){try{t.texImage2D(...arguments)}catch(ue){ue("WebGLState:",ue)}}function ke(){try{t.texImage3D(...arguments)}catch(ue){ue("WebGLState:",ue)}}function De(ue){re.equals(ue)===!1&&(t.scissor(ue.x,ue.y,ue.z,ue.w),re.copy(ue))}function ct(ue){ce.equals(ue)===!1&&(t.viewport(ue.x,ue.y,ue.z,ue.w),ce.copy(ue))}function et(ue,tt){let de=d.get(tt);de===void 0&&(de=new WeakMap,d.set(tt,de));let Le=de.get(ue);Le===void 0&&(Le=t.getUniformBlockIndex(tt,ue.name),de.set(ue,Le))}function Je(ue,tt){const Le=d.get(tt).get(ue);c.get(tt)!==Le&&(t.uniformBlockBinding(tt,Le,ue.__bindingPointIndex),c.set(tt,Le))}function st(){t.disable(t.BLEND),t.disable(t.CULL_FACE),t.disable(t.DEPTH_TEST),t.disable(t.POLYGON_OFFSET_FILL),t.disable(t.SCISSOR_TEST),t.disable(t.STENCIL_TEST),t.disable(t.SAMPLE_ALPHA_TO_COVERAGE),t.blendEquation(t.FUNC_ADD),t.blendFunc(t.ONE,t.ZERO),t.blendFuncSeparate(t.ONE,t.ZERO,t.ONE,t.ZERO),t.blendColor(0,0,0,0),t.colorMask(!0,!0,!0,!0),t.clearColor(0,0,0,0),t.depthMask(!0),t.depthFunc(t.LESS),s.setReversed(!1),t.clearDepth(1),t.stencilMask(4294967295),t.stencilFunc(t.ALWAYS,0,4294967295),t.stencilOp(t.KEEP,t.KEEP,t.KEEP),t.clearStencil(0),t.cullFace(t.BACK),t.frontFace(t.CCW),t.polygonOffset(0,0),t.activeTexture(t.TEXTURE0),t.bindFramebuffer(t.FRAMEBUFFER,null),t.bindFramebuffer(t.DRAW_FRAMEBUFFER,null),t.bindFramebuffer(t.READ_FRAMEBUFFER,null),t.useProgram(null),t.lineWidth(1),t.scissor(0,0,t.canvas.width,t.canvas.height),t.viewport(0,0,t.canvas.width,t.canvas.height),f={},J=null,se={},h={},g=new WeakMap,m=[],b=null,y=!1,x=null,v=null,w=null,S=null,A=null,R=null,N=null,C=new nn(0,0,0),F=0,P=!1,L=null,B=null,U=null,$=null,I=null,re.set(0,0,t.canvas.width,t.canvas.height),ce.set(0,0,t.canvas.width,t.canvas.height),a.reset(),s.reset(),l.reset()}return{buffers:{color:a,depth:s,stencil:l},enable:be,disable:Ne,bindFramebuffer:he,drawBuffers:Ae,useProgram:Be,setBlending:z,setMaterial:G,setFlipSided:ne,setCullFace:Q,setLineWidth:ee,setPolygonOffset:ae,setScissorTest:ie,activeTexture:we,bindTexture:ve,unbindTexture:k,compressedTexImage2D:O,compressedTexImage3D:K,texImage2D:rt,texImage3D:ke,updateUBOMapping:et,uniformBlockBinding:Je,texStorage2D:Ie,texStorage3D:$e,texSubImage2D:pe,texSubImage3D:xe,compressedTexSubImage2D:fe,compressedTexSubImage3D:Ke,scissor:De,viewport:ct,reset:st}}function Fee(t,e,n,i,r,a,s){const l=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,c=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),d=new $t,f=new WeakMap;let h;const g=new WeakMap;let m=!1;try{m=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function b(k,O){return m?new OffscreenCanvas(k,O):tx("canvas")}function y(k,O,K){let pe=1;const xe=ve(k);if((xe.width>K||xe.height>K)&&(pe=K/Math.max(xe.width,xe.height)),pe<1)if(typeof HTMLImageElement<"u"&&k instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&k instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&k instanceof ImageBitmap||typeof VideoFrame<"u"&&k instanceof VideoFrame){const fe=Math.floor(pe*xe.width),Ke=Math.floor(pe*xe.height);h===void 0&&(h=b(fe,Ke));const Ie=O?b(fe,Ke):h;return Ie.width=fe,Ie.height=Ke,Ie.getContext("2d").drawImage(k,0,0,fe,Ke),It("WebGLRenderer: Texture has been resized from ("+xe.width+"x"+xe.height+") to ("+fe+"x"+Ke+")."),Ie}else return"data"in k&&It("WebGLRenderer: Image in DataTexture is too big ("+xe.width+"x"+xe.height+")."),k;return k}function x(k){return k.generateMipmaps}function v(k){t.generateMipmap(k)}function w(k){return k.isWebGLCubeRenderTarget?t.TEXTURE_CUBE_MAP:k.isWebGL3DRenderTarget?t.TEXTURE_3D:k.isWebGLArrayRenderTarget||k.isCompressedArrayTexture?t.TEXTURE_2D_ARRAY:t.TEXTURE_2D}function S(k,O,K,pe,xe=!1){if(k!==null){if(t[k]!==void 0)return t[k];It("WebGLRenderer: Attempt to use non-existing WebGL internal format '"+k+"'")}let fe=O;if(O===t.RED&&(K===t.FLOAT&&(fe=t.R32F),K===t.HALF_FLOAT&&(fe=t.R16F),K===t.UNSIGNED_BYTE&&(fe=t.R8)),O===t.RED_INTEGER&&(K===t.UNSIGNED_BYTE&&(fe=t.R8UI),K===t.UNSIGNED_SHORT&&(fe=t.R16UI),K===t.UNSIGNED_INT&&(fe=t.R32UI),K===t.BYTE&&(fe=t.R8I),K===t.SHORT&&(fe=t.R16I),K===t.INT&&(fe=t.R32I)),O===t.RG&&(K===t.FLOAT&&(fe=t.RG32F),K===t.HALF_FLOAT&&(fe=t.RG16F),K===t.UNSIGNED_BYTE&&(fe=t.RG8)),O===t.RG_INTEGER&&(K===t.UNSIGNED_BYTE&&(fe=t.RG8UI),K===t.UNSIGNED_SHORT&&(fe=t.RG16UI),K===t.UNSIGNED_INT&&(fe=t.RG32UI),K===t.BYTE&&(fe=t.RG8I),K===t.SHORT&&(fe=t.RG16I),K===t.INT&&(fe=t.RG32I)),O===t.RGB_INTEGER&&(K===t.UNSIGNED_BYTE&&(fe=t.RGB8UI),K===t.UNSIGNED_SHORT&&(fe=t.RGB16UI),K===t.UNSIGNED_INT&&(fe=t.RGB32UI),K===t.BYTE&&(fe=t.RGB8I),K===t.SHORT&&(fe=t.RGB16I),K===t.INT&&(fe=t.RGB32I)),O===t.RGBA_INTEGER&&(K===t.UNSIGNED_BYTE&&(fe=t.RGBA8UI),K===t.UNSIGNED_SHORT&&(fe=t.RGBA16UI),K===t.UNSIGNED_INT&&(fe=t.RGBA32UI),K===t.BYTE&&(fe=t.RGBA8I),K===t.SHORT&&(fe=t.RGBA16I),K===t.INT&&(fe=t.RGBA32I)),O===t.RGB&&(K===t.UNSIGNED_INT_5_9_9_9_REV&&(fe=t.RGB9_E5),K===t.UNSIGNED_INT_10F_11F_11F_REV&&(fe=t.R11F_G11F_B10F)),O===t.RGBA){const Ke=xe?Jv:un.getTransfer(pe);K===t.FLOAT&&(fe=t.RGBA32F),K===t.HALF_FLOAT&&(fe=t.RGBA16F),K===t.UNSIGNED_BYTE&&(fe=Ke===En?t.SRGB8_ALPHA8:t.RGBA8),K===t.UNSIGNED_SHORT_4_4_4_4&&(fe=t.RGBA4),K===t.UNSIGNED_SHORT_5_5_5_1&&(fe=t.RGB5_A1)}return(fe===t.R16F||fe===t.R32F||fe===t.RG16F||fe===t.RG32F||fe===t.RGBA16F||fe===t.RGBA32F)&&e.get("EXT_color_buffer_float"),fe}function A(k,O){let K;return k?O===null||O===bu||O===Bp?K=t.DEPTH24_STENCIL8:O===Lo?K=t.DEPTH32F_STENCIL8:O===zp&&(K=t.DEPTH24_STENCIL8,It("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):O===null||O===bu||O===Bp?K=t.DEPTH_COMPONENT24:O===Lo?K=t.DEPTH_COMPONENT32F:O===zp&&(K=t.DEPTH_COMPONENT16),K}function R(k,O){return x(k)===!0||k.isFramebufferTexture&&k.minFilter!==xa&&k.minFilter!==$a?Math.log2(Math.max(O.width,O.height))+1:k.mipmaps!==void 0&&k.mipmaps.length>0?k.mipmaps.length:k.isCompressedTexture&&Array.isArray(k.image)?O.mipmaps.length:1}function N(k){const O=k.target;O.removeEventListener("dispose",N),F(O),O.isVideoTexture&&f.delete(O)}function C(k){const O=k.target;O.removeEventListener("dispose",C),L(O)}function F(k){const O=i.get(k);if(O.__webglInit===void 0)return;const K=k.source,pe=g.get(K);if(pe){const xe=pe[O.__cacheKey];xe.usedTimes--,xe.usedTimes===0&&P(k),Object.keys(pe).length===0&&g.delete(K)}i.remove(k)}function P(k){const O=i.get(k);t.deleteTexture(O.__webglTexture);const K=k.source,pe=g.get(K);delete pe[O.__cacheKey],s.memory.textures--}function L(k){const O=i.get(k);if(k.depthTexture&&(k.depthTexture.dispose(),i.remove(k.depthTexture)),k.isWebGLCubeRenderTarget)for(let pe=0;pe<6;pe++){if(Array.isArray(O.__webglFramebuffer[pe]))for(let xe=0;xe<O.__webglFramebuffer[pe].length;xe++)t.deleteFramebuffer(O.__webglFramebuffer[pe][xe]);else t.deleteFramebuffer(O.__webglFramebuffer[pe]);O.__webglDepthbuffer&&t.deleteRenderbuffer(O.__webglDepthbuffer[pe])}else{if(Array.isArray(O.__webglFramebuffer))for(let pe=0;pe<O.__webglFramebuffer.length;pe++)t.deleteFramebuffer(O.__webglFramebuffer[pe]);else t.deleteFramebuffer(O.__webglFramebuffer);if(O.__webglDepthbuffer&&t.deleteRenderbuffer(O.__webglDepthbuffer),O.__webglMultisampledFramebuffer&&t.deleteFramebuffer(O.__webglMultisampledFramebuffer),O.__webglColorRenderbuffer)for(let pe=0;pe<O.__webglColorRenderbuffer.length;pe++)O.__webglColorRenderbuffer[pe]&&t.deleteRenderbuffer(O.__webglColorRenderbuffer[pe]);O.__webglDepthRenderbuffer&&t.deleteRenderbuffer(O.__webglDepthRenderbuffer)}const K=k.textures;for(let pe=0,xe=K.length;pe<xe;pe++){const fe=i.get(K[pe]);fe.__webglTexture&&(t.deleteTexture(fe.__webglTexture),s.memory.textures--),i.remove(K[pe])}i.remove(k)}let B=0;function U(){B=0}function $(){const k=B;return k>=r.maxTextures&&It("WebGLTextures: Trying to use "+k+" texture units while this GPU supports only "+r.maxTextures),B+=1,k}function I(k){const O=[];return O.push(k.wrapS),O.push(k.wrapT),O.push(k.wrapR||0),O.push(k.magFilter),O.push(k.minFilter),O.push(k.anisotropy),O.push(k.internalFormat),O.push(k.format),O.push(k.type),O.push(k.generateMipmaps),O.push(k.premultiplyAlpha),O.push(k.flipY),O.push(k.unpackAlignment),O.push(k.colorSpace),O.join()}function W(k,O){const K=i.get(k);if(k.isVideoTexture&&ie(k),k.isRenderTargetTexture===!1&&k.isExternalTexture!==!0&&k.version>0&&K.__version!==k.version){const pe=k.image;if(pe===null)It("WebGLRenderer: Texture marked for update but no image data found.");else if(pe.complete===!1)It("WebGLRenderer: Texture marked for update but image is incomplete");else{me(K,k,O);return}}else k.isExternalTexture&&(K.__webglTexture=k.sourceTexture?k.sourceTexture:null);n.bindTexture(t.TEXTURE_2D,K.__webglTexture,t.TEXTURE0+O)}function X(k,O){const K=i.get(k);if(k.isRenderTargetTexture===!1&&k.version>0&&K.__version!==k.version){me(K,k,O);return}else k.isExternalTexture&&(K.__webglTexture=k.sourceTexture?k.sourceTexture:null);n.bindTexture(t.TEXTURE_2D_ARRAY,K.__webglTexture,t.TEXTURE0+O)}function V(k,O){const K=i.get(k);if(k.isRenderTargetTexture===!1&&k.version>0&&K.__version!==k.version){me(K,k,O);return}n.bindTexture(t.TEXTURE_3D,K.__webglTexture,t.TEXTURE0+O)}function Y(k,O){const K=i.get(k);if(k.version>0&&K.__version!==k.version){be(K,k,O);return}n.bindTexture(t.TEXTURE_CUBE_MAP,K.__webglTexture,t.TEXTURE0+O)}const J={[nM]:t.REPEAT,[Oo]:t.CLAMP_TO_EDGE,[iM]:t.MIRRORED_REPEAT},se={[xa]:t.NEAREST,[lY]:t.NEAREST_MIPMAP_NEAREST,[c0]:t.NEAREST_MIPMAP_LINEAR,[$a]:t.LINEAR,[RS]:t.LINEAR_MIPMAP_NEAREST,[iu]:t.LINEAR_MIPMAP_LINEAR},H={[fY]:t.NEVER,[xY]:t.ALWAYS,[hY]:t.LESS,[Yz]:t.LEQUAL,[pY]:t.EQUAL,[vY]:t.GEQUAL,[mY]:t.GREATER,[gY]:t.NOTEQUAL};function q(k,O){if(O.type===Lo&&e.has("OES_texture_float_linear")===!1&&(O.magFilter===$a||O.magFilter===RS||O.magFilter===c0||O.magFilter===iu||O.minFilter===$a||O.minFilter===RS||O.minFilter===c0||O.minFilter===iu)&&It("WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),t.texParameteri(k,t.TEXTURE_WRAP_S,J[O.wrapS]),t.texParameteri(k,t.TEXTURE_WRAP_T,J[O.wrapT]),(k===t.TEXTURE_3D||k===t.TEXTURE_2D_ARRAY)&&t.texParameteri(k,t.TEXTURE_WRAP_R,J[O.wrapR]),t.texParameteri(k,t.TEXTURE_MAG_FILTER,se[O.magFilter]),t.texParameteri(k,t.TEXTURE_MIN_FILTER,se[O.minFilter]),O.compareFunction&&(t.texParameteri(k,t.TEXTURE_COMPARE_MODE,t.COMPARE_REF_TO_TEXTURE),t.texParameteri(k,t.TEXTURE_COMPARE_FUNC,H[O.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(O.magFilter===xa||O.minFilter!==c0&&O.minFilter!==iu||O.type===Lo&&e.has("OES_texture_float_linear")===!1)return;if(O.anisotropy>1||i.get(O).__currentAnisotropy){const K=e.get("EXT_texture_filter_anisotropic");t.texParameterf(k,K.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(O.anisotropy,r.getMaxAnisotropy())),i.get(O).__currentAnisotropy=O.anisotropy}}}function re(k,O){let K=!1;k.__webglInit===void 0&&(k.__webglInit=!0,O.addEventListener("dispose",N));const pe=O.source;let xe=g.get(pe);xe===void 0&&(xe={},g.set(pe,xe));const fe=I(O);if(fe!==k.__cacheKey){xe[fe]===void 0&&(xe[fe]={texture:t.createTexture(),usedTimes:0},s.memory.textures++,K=!0),xe[fe].usedTimes++;const Ke=xe[k.__cacheKey];Ke!==void 0&&(xe[k.__cacheKey].usedTimes--,Ke.usedTimes===0&&P(O)),k.__cacheKey=fe,k.__webglTexture=xe[fe].texture}return K}function ce(k,O,K){return Math.floor(Math.floor(k/K)/O)}function ye(k,O,K,pe){const fe=k.updateRanges;if(fe.length===0)n.texSubImage2D(t.TEXTURE_2D,0,0,0,O.width,O.height,K,pe,O.data);else{fe.sort((ke,De)=>ke.start-De.start);let Ke=0;for(let ke=1;ke<fe.length;ke++){const De=fe[Ke],ct=fe[ke],et=De.start+De.count,Je=ce(ct.start,O.width,4),st=ce(De.start,O.width,4);ct.start<=et+1&&Je===st&&ce(ct.start+ct.count-1,O.width,4)===Je?De.count=Math.max(De.count,ct.start+ct.count-De.start):(++Ke,fe[Ke]=ct)}fe.length=Ke+1;const Ie=t.getParameter(t.UNPACK_ROW_LENGTH),$e=t.getParameter(t.UNPACK_SKIP_PIXELS),rt=t.getParameter(t.UNPACK_SKIP_ROWS);t.pixelStorei(t.UNPACK_ROW_LENGTH,O.width);for(let ke=0,De=fe.length;ke<De;ke++){const ct=fe[ke],et=Math.floor(ct.start/4),Je=Math.ceil(ct.count/4),st=et%O.width,ue=Math.floor(et/O.width),tt=Je,de=1;t.pixelStorei(t.UNPACK_SKIP_PIXELS,st),t.pixelStorei(t.UNPACK_SKIP_ROWS,ue),n.texSubImage2D(t.TEXTURE_2D,0,st,ue,tt,de,K,pe,O.data)}k.clearUpdateRanges(),t.pixelStorei(t.UNPACK_ROW_LENGTH,Ie),t.pixelStorei(t.UNPACK_SKIP_PIXELS,$e),t.pixelStorei(t.UNPACK_SKIP_ROWS,rt)}}function me(k,O,K){let pe=t.TEXTURE_2D;(O.isDataArrayTexture||O.isCompressedArrayTexture)&&(pe=t.TEXTURE_2D_ARRAY),O.isData3DTexture&&(pe=t.TEXTURE_3D);const xe=re(k,O),fe=O.source;n.bindTexture(pe,k.__webglTexture,t.TEXTURE0+K);const Ke=i.get(fe);if(fe.version!==Ke.__version||xe===!0){n.activeTexture(t.TEXTURE0+K);const Ie=un.getPrimaries(un.workingColorSpace),$e=O.colorSpace===Yl?null:un.getPrimaries(O.colorSpace),rt=O.colorSpace===Yl||Ie===$e?t.NONE:t.BROWSER_DEFAULT_WEBGL;t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,O.flipY),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,O.premultiplyAlpha),t.pixelStorei(t.UNPACK_ALIGNMENT,O.unpackAlignment),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,rt);let ke=y(O.image,!1,r.maxTextureSize);ke=we(O,ke);const De=a.convert(O.format,O.colorSpace),ct=a.convert(O.type);let et=S(O.internalFormat,De,ct,O.colorSpace,O.isVideoTexture);q(pe,O);let Je;const st=O.mipmaps,ue=O.isVideoTexture!==!0,tt=Ke.__version===void 0||xe===!0,de=fe.dataReady,Le=R(O,ke);if(O.isDepthTexture)et=A(O.format===Hp,O.type),tt&&(ue?n.texStorage2D(t.TEXTURE_2D,1,et,ke.width,ke.height):n.texImage2D(t.TEXTURE_2D,0,et,ke.width,ke.height,0,De,ct,null));else if(O.isDataTexture)if(st.length>0){ue&&tt&&n.texStorage2D(t.TEXTURE_2D,Le,et,st[0].width,st[0].height);for(let Me=0,ge=st.length;Me<ge;Me++)Je=st[Me],ue?de&&n.texSubImage2D(t.TEXTURE_2D,Me,0,0,Je.width,Je.height,De,ct,Je.data):n.texImage2D(t.TEXTURE_2D,Me,et,Je.width,Je.height,0,De,ct,Je.data);O.generateMipmaps=!1}else ue?(tt&&n.texStorage2D(t.TEXTURE_2D,Le,et,ke.width,ke.height),de&&ye(O,ke,De,ct)):n.texImage2D(t.TEXTURE_2D,0,et,ke.width,ke.height,0,De,ct,ke.data);else if(O.isCompressedTexture)if(O.isCompressedArrayTexture){ue&&tt&&n.texStorage3D(t.TEXTURE_2D_ARRAY,Le,et,st[0].width,st[0].height,ke.depth);for(let Me=0,ge=st.length;Me<ge;Me++)if(Je=st[Me],O.format!==ms)if(De!==null)if(ue){if(de)if(O.layerUpdates.size>0){const je=WN(Je.width,Je.height,O.format,O.type);for(const at of O.layerUpdates){const mt=Je.data.subarray(at*je/Je.data.BYTES_PER_ELEMENT,(at+1)*je/Je.data.BYTES_PER_ELEMENT);n.compressedTexSubImage3D(t.TEXTURE_2D_ARRAY,Me,0,0,at,Je.width,Je.height,1,De,mt)}O.clearLayerUpdates()}else n.compressedTexSubImage3D(t.TEXTURE_2D_ARRAY,Me,0,0,0,Je.width,Je.height,ke.depth,De,Je.data)}else n.compressedTexImage3D(t.TEXTURE_2D_ARRAY,Me,et,Je.width,Je.height,ke.depth,0,Je.data,0,0);else It("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else ue?de&&n.texSubImage3D(t.TEXTURE_2D_ARRAY,Me,0,0,0,Je.width,Je.height,ke.depth,De,ct,Je.data):n.texImage3D(t.TEXTURE_2D_ARRAY,Me,et,Je.width,Je.height,ke.depth,0,De,ct,Je.data)}else{ue&&tt&&n.texStorage2D(t.TEXTURE_2D,Le,et,st[0].width,st[0].height);for(let Me=0,ge=st.length;Me<ge;Me++)Je=st[Me],O.format!==ms?De!==null?ue?de&&n.compressedTexSubImage2D(t.TEXTURE_2D,Me,0,0,Je.width,Je.height,De,Je.data):n.compressedTexImage2D(t.TEXTURE_2D,Me,et,Je.width,Je.height,0,Je.data):It("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):ue?de&&n.texSubImage2D(t.TEXTURE_2D,Me,0,0,Je.width,Je.height,De,ct,Je.data):n.texImage2D(t.TEXTURE_2D,Me,et,Je.width,Je.height,0,De,ct,Je.data)}else if(O.isDataArrayTexture)if(ue){if(tt&&n.texStorage3D(t.TEXTURE_2D_ARRAY,Le,et,ke.width,ke.height,ke.depth),de)if(O.layerUpdates.size>0){const Me=WN(ke.width,ke.height,O.format,O.type);for(const ge of O.layerUpdates){const je=ke.data.subarray(ge*Me/ke.data.BYTES_PER_ELEMENT,(ge+1)*Me/ke.data.BYTES_PER_ELEMENT);n.texSubImage3D(t.TEXTURE_2D_ARRAY,0,0,0,ge,ke.width,ke.height,1,De,ct,je)}O.clearLayerUpdates()}else n.texSubImage3D(t.TEXTURE_2D_ARRAY,0,0,0,0,ke.width,ke.height,ke.depth,De,ct,ke.data)}else n.texImage3D(t.TEXTURE_2D_ARRAY,0,et,ke.width,ke.height,ke.depth,0,De,ct,ke.data);else if(O.isData3DTexture)ue?(tt&&n.texStorage3D(t.TEXTURE_3D,Le,et,ke.width,ke.height,ke.depth),de&&n.texSubImage3D(t.TEXTURE_3D,0,0,0,0,ke.width,ke.height,ke.depth,De,ct,ke.data)):n.texImage3D(t.TEXTURE_3D,0,et,ke.width,ke.height,ke.depth,0,De,ct,ke.data);else if(O.isFramebufferTexture){if(tt)if(ue)n.texStorage2D(t.TEXTURE_2D,Le,et,ke.width,ke.height);else{let Me=ke.width,ge=ke.height;for(let je=0;je<Le;je++)n.texImage2D(t.TEXTURE_2D,je,et,Me,ge,0,De,ct,null),Me>>=1,ge>>=1}}else if(st.length>0){if(ue&&tt){const Me=ve(st[0]);n.texStorage2D(t.TEXTURE_2D,Le,et,Me.width,Me.height)}for(let Me=0,ge=st.length;Me<ge;Me++)Je=st[Me],ue?de&&n.texSubImage2D(t.TEXTURE_2D,Me,0,0,De,ct,Je):n.texImage2D(t.TEXTURE_2D,Me,et,De,ct,Je);O.generateMipmaps=!1}else if(ue){if(tt){const Me=ve(ke);n.texStorage2D(t.TEXTURE_2D,Le,et,Me.width,Me.height)}de&&n.texSubImage2D(t.TEXTURE_2D,0,0,0,De,ct,ke)}else n.texImage2D(t.TEXTURE_2D,0,et,De,ct,ke);x(O)&&v(pe),Ke.__version=fe.version,O.onUpdate&&O.onUpdate(O)}k.__version=O.version}function be(k,O,K){if(O.image.length!==6)return;const pe=re(k,O),xe=O.source;n.bindTexture(t.TEXTURE_CUBE_MAP,k.__webglTexture,t.TEXTURE0+K);const fe=i.get(xe);if(xe.version!==fe.__version||pe===!0){n.activeTexture(t.TEXTURE0+K);const Ke=un.getPrimaries(un.workingColorSpace),Ie=O.colorSpace===Yl?null:un.getPrimaries(O.colorSpace),$e=O.colorSpace===Yl||Ke===Ie?t.NONE:t.BROWSER_DEFAULT_WEBGL;t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,O.flipY),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,O.premultiplyAlpha),t.pixelStorei(t.UNPACK_ALIGNMENT,O.unpackAlignment),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,$e);const rt=O.isCompressedTexture||O.image[0].isCompressedTexture,ke=O.image[0]&&O.image[0].isDataTexture,De=[];for(let ge=0;ge<6;ge++)!rt&&!ke?De[ge]=y(O.image[ge],!0,r.maxCubemapSize):De[ge]=ke?O.image[ge].image:O.image[ge],De[ge]=we(O,De[ge]);const ct=De[0],et=a.convert(O.format,O.colorSpace),Je=a.convert(O.type),st=S(O.internalFormat,et,Je,O.colorSpace),ue=O.isVideoTexture!==!0,tt=fe.__version===void 0||pe===!0,de=xe.dataReady;let Le=R(O,ct);q(t.TEXTURE_CUBE_MAP,O);let Me;if(rt){ue&&tt&&n.texStorage2D(t.TEXTURE_CUBE_MAP,Le,st,ct.width,ct.height);for(let ge=0;ge<6;ge++){Me=De[ge].mipmaps;for(let je=0;je<Me.length;je++){const at=Me[je];O.format!==ms?et!==null?ue?de&&n.compressedTexSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+ge,je,0,0,at.width,at.height,et,at.data):n.compressedTexImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+ge,je,st,at.width,at.height,0,at.data):It("WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):ue?de&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+ge,je,0,0,at.width,at.height,et,Je,at.data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+ge,je,st,at.width,at.height,0,et,Je,at.data)}}}else{if(Me=O.mipmaps,ue&&tt){Me.length>0&&Le++;const ge=ve(De[0]);n.texStorage2D(t.TEXTURE_CUBE_MAP,Le,st,ge.width,ge.height)}for(let ge=0;ge<6;ge++)if(ke){ue?de&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+ge,0,0,0,De[ge].width,De[ge].height,et,Je,De[ge].data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+ge,0,st,De[ge].width,De[ge].height,0,et,Je,De[ge].data);for(let je=0;je<Me.length;je++){const mt=Me[je].image[ge].image;ue?de&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+ge,je+1,0,0,mt.width,mt.height,et,Je,mt.data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+ge,je+1,st,mt.width,mt.height,0,et,Je,mt.data)}}else{ue?de&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+ge,0,0,0,et,Je,De[ge]):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+ge,0,st,et,Je,De[ge]);for(let je=0;je<Me.length;je++){const at=Me[je];ue?de&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+ge,je+1,0,0,et,Je,at.image[ge]):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+ge,je+1,st,et,Je,at.image[ge])}}}x(O)&&v(t.TEXTURE_CUBE_MAP),fe.__version=xe.version,O.onUpdate&&O.onUpdate(O)}k.__version=O.version}function Ne(k,O,K,pe,xe,fe){const Ke=a.convert(K.format,K.colorSpace),Ie=a.convert(K.type),$e=S(K.internalFormat,Ke,Ie,K.colorSpace),rt=i.get(O),ke=i.get(K);if(ke.__renderTarget=O,!rt.__hasExternalTextures){const De=Math.max(1,O.width>>fe),ct=Math.max(1,O.height>>fe);xe===t.TEXTURE_3D||xe===t.TEXTURE_2D_ARRAY?n.texImage3D(xe,fe,$e,De,ct,O.depth,0,Ke,Ie,null):n.texImage2D(xe,fe,$e,De,ct,0,Ke,Ie,null)}n.bindFramebuffer(t.FRAMEBUFFER,k),ae(O)?l.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,pe,xe,ke.__webglTexture,0,ee(O)):(xe===t.TEXTURE_2D||xe>=t.TEXTURE_CUBE_MAP_POSITIVE_X&&xe<=t.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&t.framebufferTexture2D(t.FRAMEBUFFER,pe,xe,ke.__webglTexture,fe),n.bindFramebuffer(t.FRAMEBUFFER,null)}function he(k,O,K){if(t.bindRenderbuffer(t.RENDERBUFFER,k),O.depthBuffer){const pe=O.depthTexture,xe=pe&&pe.isDepthTexture?pe.type:null,fe=A(O.stencilBuffer,xe),Ke=O.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,Ie=ee(O);ae(O)?l.renderbufferStorageMultisampleEXT(t.RENDERBUFFER,Ie,fe,O.width,O.height):K?t.renderbufferStorageMultisample(t.RENDERBUFFER,Ie,fe,O.width,O.height):t.renderbufferStorage(t.RENDERBUFFER,fe,O.width,O.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,Ke,t.RENDERBUFFER,k)}else{const pe=O.textures;for(let xe=0;xe<pe.length;xe++){const fe=pe[xe],Ke=a.convert(fe.format,fe.colorSpace),Ie=a.convert(fe.type),$e=S(fe.internalFormat,Ke,Ie,fe.colorSpace),rt=ee(O);K&&ae(O)===!1?t.renderbufferStorageMultisample(t.RENDERBUFFER,rt,$e,O.width,O.height):ae(O)?l.renderbufferStorageMultisampleEXT(t.RENDERBUFFER,rt,$e,O.width,O.height):t.renderbufferStorage(t.RENDERBUFFER,$e,O.width,O.height)}}t.bindRenderbuffer(t.RENDERBUFFER,null)}function Ae(k,O){if(O&&O.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(n.bindFramebuffer(t.FRAMEBUFFER,k),!(O.depthTexture&&O.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");const pe=i.get(O.depthTexture);pe.__renderTarget=O,(!pe.__webglTexture||O.depthTexture.image.width!==O.width||O.depthTexture.image.height!==O.height)&&(O.depthTexture.image.width=O.width,O.depthTexture.image.height=O.height,O.depthTexture.needsUpdate=!0),W(O.depthTexture,0);const xe=pe.__webglTexture,fe=ee(O);if(O.depthTexture.format===jp)ae(O)?l.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.TEXTURE_2D,xe,0,fe):t.framebufferTexture2D(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.TEXTURE_2D,xe,0);else if(O.depthTexture.format===Hp)ae(O)?l.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.TEXTURE_2D,xe,0,fe):t.framebufferTexture2D(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.TEXTURE_2D,xe,0);else throw new Error("Unknown depthTexture format")}function Be(k){const O=i.get(k),K=k.isWebGLCubeRenderTarget===!0;if(O.__boundDepthTexture!==k.depthTexture){const pe=k.depthTexture;if(O.__depthDisposeCallback&&O.__depthDisposeCallback(),pe){const xe=()=>{delete O.__boundDepthTexture,delete O.__depthDisposeCallback,pe.removeEventListener("dispose",xe)};pe.addEventListener("dispose",xe),O.__depthDisposeCallback=xe}O.__boundDepthTexture=pe}if(k.depthTexture&&!O.__autoAllocateDepthBuffer){if(K)throw new Error("target.depthTexture not supported in Cube render targets");const pe=k.texture.mipmaps;pe&&pe.length>0?Ae(O.__webglFramebuffer[0],k):Ae(O.__webglFramebuffer,k)}else if(K){O.__webglDepthbuffer=[];for(let pe=0;pe<6;pe++)if(n.bindFramebuffer(t.FRAMEBUFFER,O.__webglFramebuffer[pe]),O.__webglDepthbuffer[pe]===void 0)O.__webglDepthbuffer[pe]=t.createRenderbuffer(),he(O.__webglDepthbuffer[pe],k,!1);else{const xe=k.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,fe=O.__webglDepthbuffer[pe];t.bindRenderbuffer(t.RENDERBUFFER,fe),t.framebufferRenderbuffer(t.FRAMEBUFFER,xe,t.RENDERBUFFER,fe)}}else{const pe=k.texture.mipmaps;if(pe&&pe.length>0?n.bindFramebuffer(t.FRAMEBUFFER,O.__webglFramebuffer[0]):n.bindFramebuffer(t.FRAMEBUFFER,O.__webglFramebuffer),O.__webglDepthbuffer===void 0)O.__webglDepthbuffer=t.createRenderbuffer(),he(O.__webglDepthbuffer,k,!1);else{const xe=k.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,fe=O.__webglDepthbuffer;t.bindRenderbuffer(t.RENDERBUFFER,fe),t.framebufferRenderbuffer(t.FRAMEBUFFER,xe,t.RENDERBUFFER,fe)}}n.bindFramebuffer(t.FRAMEBUFFER,null)}function le(k,O,K){const pe=i.get(k);O!==void 0&&Ne(pe.__webglFramebuffer,k,k.texture,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,0),K!==void 0&&Be(k)}function lt(k){const O=k.texture,K=i.get(k),pe=i.get(O);k.addEventListener("dispose",C);const xe=k.textures,fe=k.isWebGLCubeRenderTarget===!0,Ke=xe.length>1;if(Ke||(pe.__webglTexture===void 0&&(pe.__webglTexture=t.createTexture()),pe.__version=O.version,s.memory.textures++),fe){K.__webglFramebuffer=[];for(let Ie=0;Ie<6;Ie++)if(O.mipmaps&&O.mipmaps.length>0){K.__webglFramebuffer[Ie]=[];for(let $e=0;$e<O.mipmaps.length;$e++)K.__webglFramebuffer[Ie][$e]=t.createFramebuffer()}else K.__webglFramebuffer[Ie]=t.createFramebuffer()}else{if(O.mipmaps&&O.mipmaps.length>0){K.__webglFramebuffer=[];for(let Ie=0;Ie<O.mipmaps.length;Ie++)K.__webglFramebuffer[Ie]=t.createFramebuffer()}else K.__webglFramebuffer=t.createFramebuffer();if(Ke)for(let Ie=0,$e=xe.length;Ie<$e;Ie++){const rt=i.get(xe[Ie]);rt.__webglTexture===void 0&&(rt.__webglTexture=t.createTexture(),s.memory.textures++)}if(k.samples>0&&ae(k)===!1){K.__webglMultisampledFramebuffer=t.createFramebuffer(),K.__webglColorRenderbuffer=[],n.bindFramebuffer(t.FRAMEBUFFER,K.__webglMultisampledFramebuffer);for(let Ie=0;Ie<xe.length;Ie++){const $e=xe[Ie];K.__webglColorRenderbuffer[Ie]=t.createRenderbuffer(),t.bindRenderbuffer(t.RENDERBUFFER,K.__webglColorRenderbuffer[Ie]);const rt=a.convert($e.format,$e.colorSpace),ke=a.convert($e.type),De=S($e.internalFormat,rt,ke,$e.colorSpace,k.isXRRenderTarget===!0),ct=ee(k);t.renderbufferStorageMultisample(t.RENDERBUFFER,ct,De,k.width,k.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+Ie,t.RENDERBUFFER,K.__webglColorRenderbuffer[Ie])}t.bindRenderbuffer(t.RENDERBUFFER,null),k.depthBuffer&&(K.__webglDepthRenderbuffer=t.createRenderbuffer(),he(K.__webglDepthRenderbuffer,k,!0)),n.bindFramebuffer(t.FRAMEBUFFER,null)}}if(fe){n.bindTexture(t.TEXTURE_CUBE_MAP,pe.__webglTexture),q(t.TEXTURE_CUBE_MAP,O);for(let Ie=0;Ie<6;Ie++)if(O.mipmaps&&O.mipmaps.length>0)for(let $e=0;$e<O.mipmaps.length;$e++)Ne(K.__webglFramebuffer[Ie][$e],k,O,t.COLOR_ATTACHMENT0,t.TEXTURE_CUBE_MAP_POSITIVE_X+Ie,$e);else Ne(K.__webglFramebuffer[Ie],k,O,t.COLOR_ATTACHMENT0,t.TEXTURE_CUBE_MAP_POSITIVE_X+Ie,0);x(O)&&v(t.TEXTURE_CUBE_MAP),n.unbindTexture()}else if(Ke){for(let Ie=0,$e=xe.length;Ie<$e;Ie++){const rt=xe[Ie],ke=i.get(rt);let De=t.TEXTURE_2D;(k.isWebGL3DRenderTarget||k.isWebGLArrayRenderTarget)&&(De=k.isWebGL3DRenderTarget?t.TEXTURE_3D:t.TEXTURE_2D_ARRAY),n.bindTexture(De,ke.__webglTexture),q(De,rt),Ne(K.__webglFramebuffer,k,rt,t.COLOR_ATTACHMENT0+Ie,De,0),x(rt)&&v(De)}n.unbindTexture()}else{let Ie=t.TEXTURE_2D;if((k.isWebGL3DRenderTarget||k.isWebGLArrayRenderTarget)&&(Ie=k.isWebGL3DRenderTarget?t.TEXTURE_3D:t.TEXTURE_2D_ARRAY),n.bindTexture(Ie,pe.__webglTexture),q(Ie,O),O.mipmaps&&O.mipmaps.length>0)for(let $e=0;$e<O.mipmaps.length;$e++)Ne(K.__webglFramebuffer[$e],k,O,t.COLOR_ATTACHMENT0,Ie,$e);else Ne(K.__webglFramebuffer,k,O,t.COLOR_ATTACHMENT0,Ie,0);x(O)&&v(Ie),n.unbindTexture()}k.depthBuffer&&Be(k)}function z(k){const O=k.textures;for(let K=0,pe=O.length;K<pe;K++){const xe=O[K];if(x(xe)){const fe=w(k),Ke=i.get(xe).__webglTexture;n.bindTexture(fe,Ke),v(fe),n.unbindTexture()}}}const G=[],ne=[];function Q(k){if(k.samples>0){if(ae(k)===!1){const O=k.textures,K=k.width,pe=k.height;let xe=t.COLOR_BUFFER_BIT;const fe=k.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,Ke=i.get(k),Ie=O.length>1;if(Ie)for(let rt=0;rt<O.length;rt++)n.bindFramebuffer(t.FRAMEBUFFER,Ke.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+rt,t.RENDERBUFFER,null),n.bindFramebuffer(t.FRAMEBUFFER,Ke.__webglFramebuffer),t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0+rt,t.TEXTURE_2D,null,0);n.bindFramebuffer(t.READ_FRAMEBUFFER,Ke.__webglMultisampledFramebuffer);const $e=k.texture.mipmaps;$e&&$e.length>0?n.bindFramebuffer(t.DRAW_FRAMEBUFFER,Ke.__webglFramebuffer[0]):n.bindFramebuffer(t.DRAW_FRAMEBUFFER,Ke.__webglFramebuffer);for(let rt=0;rt<O.length;rt++){if(k.resolveDepthBuffer&&(k.depthBuffer&&(xe|=t.DEPTH_BUFFER_BIT),k.stencilBuffer&&k.resolveStencilBuffer&&(xe|=t.STENCIL_BUFFER_BIT)),Ie){t.framebufferRenderbuffer(t.READ_FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.RENDERBUFFER,Ke.__webglColorRenderbuffer[rt]);const ke=i.get(O[rt]).__webglTexture;t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,ke,0)}t.blitFramebuffer(0,0,K,pe,0,0,K,pe,xe,t.NEAREST),c===!0&&(G.length=0,ne.length=0,G.push(t.COLOR_ATTACHMENT0+rt),k.depthBuffer&&k.resolveDepthBuffer===!1&&(G.push(fe),ne.push(fe),t.invalidateFramebuffer(t.DRAW_FRAMEBUFFER,ne)),t.invalidateFramebuffer(t.READ_FRAMEBUFFER,G))}if(n.bindFramebuffer(t.READ_FRAMEBUFFER,null),n.bindFramebuffer(t.DRAW_FRAMEBUFFER,null),Ie)for(let rt=0;rt<O.length;rt++){n.bindFramebuffer(t.FRAMEBUFFER,Ke.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+rt,t.RENDERBUFFER,Ke.__webglColorRenderbuffer[rt]);const ke=i.get(O[rt]).__webglTexture;n.bindFramebuffer(t.FRAMEBUFFER,Ke.__webglFramebuffer),t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0+rt,t.TEXTURE_2D,ke,0)}n.bindFramebuffer(t.DRAW_FRAMEBUFFER,Ke.__webglMultisampledFramebuffer)}else if(k.depthBuffer&&k.resolveDepthBuffer===!1&&c){const O=k.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT;t.invalidateFramebuffer(t.DRAW_FRAMEBUFFER,[O])}}}function ee(k){return Math.min(r.maxSamples,k.samples)}function ae(k){const O=i.get(k);return k.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&O.__useRenderToTexture!==!1}function ie(k){const O=s.render.frame;f.get(k)!==O&&(f.set(k,O),k.update())}function we(k,O){const K=k.colorSpace,pe=k.format,xe=k.type;return k.isCompressedTexture===!0||k.isVideoTexture===!0||K!==bf&&K!==Yl&&(un.getTransfer(K)===En?(pe!==ms||xe!==js)&&It("WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):ai("WebGLTextures: Unsupported texture color space:",K)),O}function ve(k){return typeof HTMLImageElement<"u"&&k instanceof HTMLImageElement?(d.width=k.naturalWidth||k.width,d.height=k.naturalHeight||k.height):typeof VideoFrame<"u"&&k instanceof VideoFrame?(d.width=k.displayWidth,d.height=k.displayHeight):(d.width=k.width,d.height=k.height),d}this.allocateTextureUnit=$,this.resetTextureUnits=U,this.setTexture2D=W,this.setTexture2DArray=X,this.setTexture3D=V,this.setTextureCube=Y,this.rebindTextures=le,this.setupRenderTarget=lt,this.updateRenderTargetMipmap=z,this.updateMultisampleRenderTarget=Q,this.setupDepthRenderbuffer=Be,this.setupFrameBufferTexture=Ne,this.useMultisampledRTT=ae}function zee(t,e){function n(i,r=Yl){let a;const s=un.getTransfer(r);if(i===js)return t.UNSIGNED_BYTE;if(i===bT)return t.UNSIGNED_SHORT_4_4_4_4;if(i===_T)return t.UNSIGNED_SHORT_5_5_5_1;if(i===Gz)return t.UNSIGNED_INT_5_9_9_9_REV;if(i===Vz)return t.UNSIGNED_INT_10F_11F_11F_REV;if(i===jz)return t.BYTE;if(i===Hz)return t.SHORT;if(i===zp)return t.UNSIGNED_SHORT;if(i===yT)return t.INT;if(i===bu)return t.UNSIGNED_INT;if(i===Lo)return t.FLOAT;if(i===Bf)return t.HALF_FLOAT;if(i===$z)return t.ALPHA;if(i===Wz)return t.RGB;if(i===ms)return t.RGBA;if(i===jp)return t.DEPTH_COMPONENT;if(i===Hp)return t.DEPTH_STENCIL;if(i===Xz)return t.RED;if(i===ST)return t.RED_INTEGER;if(i===wT)return t.RG;if(i===ET)return t.RG_INTEGER;if(i===MT)return t.RGBA_INTEGER;if(i===Pv||i===Dv||i===Nv||i===Ov)if(s===En)if(a=e.get("WEBGL_compressed_texture_s3tc_srgb"),a!==null){if(i===Pv)return a.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(i===Dv)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(i===Nv)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(i===Ov)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(a=e.get("WEBGL_compressed_texture_s3tc"),a!==null){if(i===Pv)return a.COMPRESSED_RGB_S3TC_DXT1_EXT;if(i===Dv)return a.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(i===Nv)return a.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(i===Ov)return a.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(i===rM||i===aM||i===sM||i===oM)if(a=e.get("WEBGL_compressed_texture_pvrtc"),a!==null){if(i===rM)return a.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(i===aM)return a.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(i===sM)return a.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(i===oM)return a.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(i===lM||i===cM||i===uM)if(a=e.get("WEBGL_compressed_texture_etc"),a!==null){if(i===lM||i===cM)return s===En?a.COMPRESSED_SRGB8_ETC2:a.COMPRESSED_RGB8_ETC2;if(i===uM)return s===En?a.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:a.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(i===dM||i===fM||i===hM||i===pM||i===mM||i===gM||i===vM||i===xM||i===yM||i===bM||i===_M||i===SM||i===wM||i===EM)if(a=e.get("WEBGL_compressed_texture_astc"),a!==null){if(i===dM)return s===En?a.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:a.COMPRESSED_RGBA_ASTC_4x4_KHR;if(i===fM)return s===En?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:a.COMPRESSED_RGBA_ASTC_5x4_KHR;if(i===hM)return s===En?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:a.COMPRESSED_RGBA_ASTC_5x5_KHR;if(i===pM)return s===En?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:a.COMPRESSED_RGBA_ASTC_6x5_KHR;if(i===mM)return s===En?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:a.COMPRESSED_RGBA_ASTC_6x6_KHR;if(i===gM)return s===En?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:a.COMPRESSED_RGBA_ASTC_8x5_KHR;if(i===vM)return s===En?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:a.COMPRESSED_RGBA_ASTC_8x6_KHR;if(i===xM)return s===En?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:a.COMPRESSED_RGBA_ASTC_8x8_KHR;if(i===yM)return s===En?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:a.COMPRESSED_RGBA_ASTC_10x5_KHR;if(i===bM)return s===En?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:a.COMPRESSED_RGBA_ASTC_10x6_KHR;if(i===_M)return s===En?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:a.COMPRESSED_RGBA_ASTC_10x8_KHR;if(i===SM)return s===En?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:a.COMPRESSED_RGBA_ASTC_10x10_KHR;if(i===wM)return s===En?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:a.COMPRESSED_RGBA_ASTC_12x10_KHR;if(i===EM)return s===En?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:a.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(i===MM||i===AM||i===TM)if(a=e.get("EXT_texture_compression_bptc"),a!==null){if(i===MM)return s===En?a.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:a.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(i===AM)return a.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(i===TM)return a.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(i===CM||i===RM||i===PM||i===DM)if(a=e.get("EXT_texture_compression_rgtc"),a!==null){if(i===CM)return a.COMPRESSED_RED_RGTC1_EXT;if(i===RM)return a.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(i===PM)return a.COMPRESSED_RED_GREEN_RGTC2_EXT;if(i===DM)return a.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return i===Bp?t.UNSIGNED_INT_24_8:t[i]!==void 0?t[i]:null}return{convert:n}}const Bee=`
  3825. void main() {
  3826. gl_Position = vec4( position, 1.0 );
  3827. }`,jee=`
  3828. uniform sampler2DArray depthColor;
  3829. uniform float depthWidth;
  3830. uniform float depthHeight;
  3831. void main() {
  3832. vec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight );
  3833. if ( coord.x >= 1.0 ) {
  3834. gl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r;
  3835. } else {
  3836. gl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r;
  3837. }
  3838. }`;class Hee{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,n){if(this.texture===null){const i=new pB(e.texture);(e.depthNear!==n.depthNear||e.depthFar!==n.depthFar)&&(this.depthNear=e.depthNear,this.depthFar=e.depthFar),this.texture=i}}getMesh(e){if(this.texture!==null&&this.mesh===null){const n=e.cameras[0].viewport,i=new $o({vertexShader:Bee,fragmentShader:jee,uniforms:{depthColor:{value:this.texture},depthWidth:{value:n.z},depthHeight:{value:n.w}}});this.mesh=new Hs(new DT(20,20),i)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}let Gee=class extends Iu{constructor(e,n){super();const i=this;let r=null,a=1,s=null,l="local-floor",c=1,d=null,f=null,h=null,g=null,m=null,b=null;const y=typeof XRWebGLBinding<"u",x=new Hee,v={},w=n.getContextAttributes();let S=null,A=null;const R=[],N=[],C=new $t;let F=null;const P=new ja;P.viewport=new gi;const L=new ja;L.viewport=new gi;const B=[P,L],U=new sK;let $=null,I=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(me){let be=R[me];return be===void 0&&(be=new ZS,R[me]=be),be.getTargetRaySpace()},this.getControllerGrip=function(me){let be=R[me];return be===void 0&&(be=new ZS,R[me]=be),be.getGripSpace()},this.getHand=function(me){let be=R[me];return be===void 0&&(be=new ZS,R[me]=be),be.getHandSpace()};function W(me){const be=N.indexOf(me.inputSource);if(be===-1)return;const Ne=R[be];Ne!==void 0&&(Ne.update(me.inputSource,me.frame,d||s),Ne.dispatchEvent({type:me.type,data:me.inputSource}))}function X(){r.removeEventListener("select",W),r.removeEventListener("selectstart",W),r.removeEventListener("selectend",W),r.removeEventListener("squeeze",W),r.removeEventListener("squeezestart",W),r.removeEventListener("squeezeend",W),r.removeEventListener("end",X),r.removeEventListener("inputsourceschange",V);for(let me=0;me<R.length;me++){const be=N[me];be!==null&&(N[me]=null,R[me].disconnect(be))}$=null,I=null,x.reset();for(const me in v)delete v[me];e.setRenderTarget(S),m=null,g=null,h=null,r=null,A=null,ye.stop(),i.isPresenting=!1,e.setPixelRatio(F),e.setSize(C.width,C.height,!1),i.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(me){a=me,i.isPresenting===!0&&It("WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(me){l=me,i.isPresenting===!0&&It("WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return d||s},this.setReferenceSpace=function(me){d=me},this.getBaseLayer=function(){return g!==null?g:m},this.getBinding=function(){return h===null&&y&&(h=new XRWebGLBinding(r,n)),h},this.getFrame=function(){return b},this.getSession=function(){return r},this.setSession=async function(me){if(r=me,r!==null){if(S=e.getRenderTarget(),r.addEventListener("select",W),r.addEventListener("selectstart",W),r.addEventListener("selectend",W),r.addEventListener("squeeze",W),r.addEventListener("squeezestart",W),r.addEventListener("squeezeend",W),r.addEventListener("end",X),r.addEventListener("inputsourceschange",V),w.xrCompatible!==!0&&await n.makeXRCompatible(),F=e.getPixelRatio(),e.getSize(C),y&&"createProjectionLayer"in XRWebGLBinding.prototype){let Ne=null,he=null,Ae=null;w.depth&&(Ae=w.stencil?n.DEPTH24_STENCIL8:n.DEPTH_COMPONENT24,Ne=w.stencil?Hp:jp,he=w.stencil?Bp:bu);const Be={colorFormat:n.RGBA8,depthFormat:Ae,scaleFactor:a};h=this.getBinding(),g=h.createProjectionLayer(Be),r.updateRenderState({layers:[g]}),e.setPixelRatio(1),e.setSize(g.textureWidth,g.textureHeight,!1),A=new Su(g.textureWidth,g.textureHeight,{format:ms,type:js,depthTexture:new hB(g.textureWidth,g.textureHeight,he,void 0,void 0,void 0,void 0,void 0,void 0,Ne),stencilBuffer:w.stencil,colorSpace:e.outputColorSpace,samples:w.antialias?4:0,resolveDepthBuffer:g.ignoreDepthValues===!1,resolveStencilBuffer:g.ignoreDepthValues===!1})}else{const Ne={antialias:w.antialias,alpha:!0,depth:w.depth,stencil:w.stencil,framebufferScaleFactor:a};m=new XRWebGLLayer(r,n,Ne),r.updateRenderState({baseLayer:m}),e.setPixelRatio(1),e.setSize(m.framebufferWidth,m.framebufferHeight,!1),A=new Su(m.framebufferWidth,m.framebufferHeight,{format:ms,type:js,colorSpace:e.outputColorSpace,stencilBuffer:w.stencil,resolveDepthBuffer:m.ignoreDepthValues===!1,resolveStencilBuffer:m.ignoreDepthValues===!1})}A.isXRRenderTarget=!0,this.setFoveation(c),d=null,s=await r.requestReferenceSpace(l),ye.setContext(r),ye.start(),i.isPresenting=!0,i.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(r!==null)return r.environmentBlendMode},this.getDepthTexture=function(){return x.getDepthTexture()};function V(me){for(let be=0;be<me.removed.length;be++){const Ne=me.removed[be],he=N.indexOf(Ne);he>=0&&(N[he]=null,R[he].disconnect(Ne))}for(let be=0;be<me.added.length;be++){const Ne=me.added[be];let he=N.indexOf(Ne);if(he===-1){for(let Be=0;Be<R.length;Be++)if(Be>=N.length){N.push(Ne),he=Be;break}else if(N[Be]===null){N[Be]=Ne,he=Be;break}if(he===-1)break}const Ae=R[he];Ae&&Ae.connect(Ne)}}const Y=new Ve,J=new Ve;function se(me,be,Ne){Y.setFromMatrixPosition(be.matrixWorld),J.setFromMatrixPosition(Ne.matrixWorld);const he=Y.distanceTo(J),Ae=be.projectionMatrix.elements,Be=Ne.projectionMatrix.elements,le=Ae[14]/(Ae[10]-1),lt=Ae[14]/(Ae[10]+1),z=(Ae[9]+1)/Ae[5],G=(Ae[9]-1)/Ae[5],ne=(Ae[8]-1)/Ae[0],Q=(Be[8]+1)/Be[0],ee=le*ne,ae=le*Q,ie=he/(-ne+Q),we=ie*-ne;if(be.matrixWorld.decompose(me.position,me.quaternion,me.scale),me.translateX(we),me.translateZ(ie),me.matrixWorld.compose(me.position,me.quaternion,me.scale),me.matrixWorldInverse.copy(me.matrixWorld).invert(),Ae[10]===-1)me.projectionMatrix.copy(be.projectionMatrix),me.projectionMatrixInverse.copy(be.projectionMatrixInverse);else{const ve=le+ie,k=lt+ie,O=ee-we,K=ae+(he-we),pe=z*lt/k*ve,xe=G*lt/k*ve;me.projectionMatrix.makePerspective(O,K,pe,xe,ve,k),me.projectionMatrixInverse.copy(me.projectionMatrix).invert()}}function H(me,be){be===null?me.matrixWorld.copy(me.matrix):me.matrixWorld.multiplyMatrices(be.matrixWorld,me.matrix),me.matrixWorldInverse.copy(me.matrixWorld).invert()}this.updateCamera=function(me){if(r===null)return;let be=me.near,Ne=me.far;x.texture!==null&&(x.depthNear>0&&(be=x.depthNear),x.depthFar>0&&(Ne=x.depthFar)),U.near=L.near=P.near=be,U.far=L.far=P.far=Ne,($!==U.near||I!==U.far)&&(r.updateRenderState({depthNear:U.near,depthFar:U.far}),$=U.near,I=U.far),U.layers.mask=me.layers.mask|6,P.layers.mask=U.layers.mask&3,L.layers.mask=U.layers.mask&5;const he=me.parent,Ae=U.cameras;H(U,he);for(let Be=0;Be<Ae.length;Be++)H(Ae[Be],he);Ae.length===2?se(U,P,L):U.projectionMatrix.copy(P.projectionMatrix),q(me,U,he)};function q(me,be,Ne){Ne===null?me.matrix.copy(be.matrixWorld):(me.matrix.copy(Ne.matrixWorld),me.matrix.invert(),me.matrix.multiply(be.matrixWorld)),me.matrix.decompose(me.position,me.quaternion,me.scale),me.updateMatrixWorld(!0),me.projectionMatrix.copy(be.projectionMatrix),me.projectionMatrixInverse.copy(be.projectionMatrixInverse),me.isPerspectiveCamera&&(me.fov=NM*2*Math.atan(1/me.projectionMatrix.elements[5]),me.zoom=1)}this.getCamera=function(){return U},this.getFoveation=function(){if(!(g===null&&m===null))return c},this.setFoveation=function(me){c=me,g!==null&&(g.fixedFoveation=me),m!==null&&m.fixedFoveation!==void 0&&(m.fixedFoveation=me)},this.hasDepthSensing=function(){return x.texture!==null},this.getDepthSensingMesh=function(){return x.getMesh(U)},this.getCameraTexture=function(me){return v[me]};let re=null;function ce(me,be){if(f=be.getViewerPose(d||s),b=be,f!==null){const Ne=f.views;m!==null&&(e.setRenderTargetFramebuffer(A,m.framebuffer),e.setRenderTarget(A));let he=!1;Ne.length!==U.cameras.length&&(U.cameras.length=0,he=!0);for(let lt=0;lt<Ne.length;lt++){const z=Ne[lt];let G=null;if(m!==null)G=m.getViewport(z);else{const Q=h.getViewSubImage(g,z);G=Q.viewport,lt===0&&(e.setRenderTargetTextures(A,Q.colorTexture,Q.depthStencilTexture),e.setRenderTarget(A))}let ne=B[lt];ne===void 0&&(ne=new ja,ne.layers.enable(lt),ne.viewport=new gi,B[lt]=ne),ne.matrix.fromArray(z.transform.matrix),ne.matrix.decompose(ne.position,ne.quaternion,ne.scale),ne.projectionMatrix.fromArray(z.projectionMatrix),ne.projectionMatrixInverse.copy(ne.projectionMatrix).invert(),ne.viewport.set(G.x,G.y,G.width,G.height),lt===0&&(U.matrix.copy(ne.matrix),U.matrix.decompose(U.position,U.quaternion,U.scale)),he===!0&&U.cameras.push(ne)}const Ae=r.enabledFeatures;if(Ae&&Ae.includes("depth-sensing")&&r.depthUsage=="gpu-optimized"&&y){h=i.getBinding();const lt=h.getDepthInformation(Ne[0]);lt&&lt.isValid&&lt.texture&&x.init(lt,r.renderState)}if(Ae&&Ae.includes("camera-access")&&y){e.state.unbindTexture(),h=i.getBinding();for(let lt=0;lt<Ne.length;lt++){const z=Ne[lt].camera;if(z){let G=v[z];G||(G=new pB,v[z]=G);const ne=h.getCameraImage(z);G.sourceTexture=ne}}}}for(let Ne=0;Ne<R.length;Ne++){const he=N[Ne],Ae=R[Ne];he!==null&&Ae!==void 0&&Ae.update(he,be,d||s)}re&&re(me,be),be.detectedPlanes&&i.dispatchEvent({type:"planesdetected",data:be}),b=null}const ye=new xB;ye.setAnimationLoop(ce),this.setAnimationLoop=function(me){re=me},this.dispose=function(){}}};const Bc=new lc,Vee=new bi;function $ee(t,e){function n(x,v){x.matrixAutoUpdate===!0&&x.updateMatrix(),v.value.copy(x.matrix)}function i(x,v){v.color.getRGB(x.fogColor.value,cB(t)),v.isFog?(x.fogNear.value=v.near,x.fogFar.value=v.far):v.isFogExp2&&(x.fogDensity.value=v.density)}function r(x,v,w,S,A){v.isMeshBasicMaterial||v.isMeshLambertMaterial?a(x,v):v.isMeshToonMaterial?(a(x,v),h(x,v)):v.isMeshPhongMaterial?(a(x,v),f(x,v)):v.isMeshStandardMaterial?(a(x,v),g(x,v),v.isMeshPhysicalMaterial&&m(x,v,A)):v.isMeshMatcapMaterial?(a(x,v),b(x,v)):v.isMeshDepthMaterial?a(x,v):v.isMeshDistanceMaterial?(a(x,v),y(x,v)):v.isMeshNormalMaterial?a(x,v):v.isLineBasicMaterial?(s(x,v),v.isLineDashedMaterial&&l(x,v)):v.isPointsMaterial?c(x,v,w,S):v.isSpriteMaterial?d(x,v):v.isShadowMaterial?(x.color.value.copy(v.color),x.opacity.value=v.opacity):v.isShaderMaterial&&(v.uniformsNeedUpdate=!1)}function a(x,v){x.opacity.value=v.opacity,v.color&&x.diffuse.value.copy(v.color),v.emissive&&x.emissive.value.copy(v.emissive).multiplyScalar(v.emissiveIntensity),v.map&&(x.map.value=v.map,n(v.map,x.mapTransform)),v.alphaMap&&(x.alphaMap.value=v.alphaMap,n(v.alphaMap,x.alphaMapTransform)),v.bumpMap&&(x.bumpMap.value=v.bumpMap,n(v.bumpMap,x.bumpMapTransform),x.bumpScale.value=v.bumpScale,v.side===Kr&&(x.bumpScale.value*=-1)),v.normalMap&&(x.normalMap.value=v.normalMap,n(v.normalMap,x.normalMapTransform),x.normalScale.value.copy(v.normalScale),v.side===Kr&&x.normalScale.value.negate()),v.displacementMap&&(x.displacementMap.value=v.displacementMap,n(v.displacementMap,x.displacementMapTransform),x.displacementScale.value=v.displacementScale,x.displacementBias.value=v.displacementBias),v.emissiveMap&&(x.emissiveMap.value=v.emissiveMap,n(v.emissiveMap,x.emissiveMapTransform)),v.specularMap&&(x.specularMap.value=v.specularMap,n(v.specularMap,x.specularMapTransform)),v.alphaTest>0&&(x.alphaTest.value=v.alphaTest);const w=e.get(v),S=w.envMap,A=w.envMapRotation;S&&(x.envMap.value=S,Bc.copy(A),Bc.x*=-1,Bc.y*=-1,Bc.z*=-1,S.isCubeTexture&&S.isRenderTargetTexture===!1&&(Bc.y*=-1,Bc.z*=-1),x.envMapRotation.value.setFromMatrix4(Vee.makeRotationFromEuler(Bc)),x.flipEnvMap.value=S.isCubeTexture&&S.isRenderTargetTexture===!1?-1:1,x.reflectivity.value=v.reflectivity,x.ior.value=v.ior,x.refractionRatio.value=v.refractionRatio),v.lightMap&&(x.lightMap.value=v.lightMap,x.lightMapIntensity.value=v.lightMapIntensity,n(v.lightMap,x.lightMapTransform)),v.aoMap&&(x.aoMap.value=v.aoMap,x.aoMapIntensity.value=v.aoMapIntensity,n(v.aoMap,x.aoMapTransform))}function s(x,v){x.diffuse.value.copy(v.color),x.opacity.value=v.opacity,v.map&&(x.map.value=v.map,n(v.map,x.mapTransform))}function l(x,v){x.dashSize.value=v.dashSize,x.totalSize.value=v.dashSize+v.gapSize,x.scale.value=v.scale}function c(x,v,w,S){x.diffuse.value.copy(v.color),x.opacity.value=v.opacity,x.size.value=v.size*w,x.scale.value=S*.5,v.map&&(x.map.value=v.map,n(v.map,x.uvTransform)),v.alphaMap&&(x.alphaMap.value=v.alphaMap,n(v.alphaMap,x.alphaMapTransform)),v.alphaTest>0&&(x.alphaTest.value=v.alphaTest)}function d(x,v){x.diffuse.value.copy(v.color),x.opacity.value=v.opacity,x.rotation.value=v.rotation,v.map&&(x.map.value=v.map,n(v.map,x.mapTransform)),v.alphaMap&&(x.alphaMap.value=v.alphaMap,n(v.alphaMap,x.alphaMapTransform)),v.alphaTest>0&&(x.alphaTest.value=v.alphaTest)}function f(x,v){x.specular.value.copy(v.specular),x.shininess.value=Math.max(v.shininess,1e-4)}function h(x,v){v.gradientMap&&(x.gradientMap.value=v.gradientMap)}function g(x,v){x.metalness.value=v.metalness,v.metalnessMap&&(x.metalnessMap.value=v.metalnessMap,n(v.metalnessMap,x.metalnessMapTransform)),x.roughness.value=v.roughness,v.roughnessMap&&(x.roughnessMap.value=v.roughnessMap,n(v.roughnessMap,x.roughnessMapTransform)),v.envMap&&(x.envMapIntensity.value=v.envMapIntensity)}function m(x,v,w){x.ior.value=v.ior,v.sheen>0&&(x.sheenColor.value.copy(v.sheenColor).multiplyScalar(v.sheen),x.sheenRoughness.value=v.sheenRoughness,v.sheenColorMap&&(x.sheenColorMap.value=v.sheenColorMap,n(v.sheenColorMap,x.sheenColorMapTransform)),v.sheenRoughnessMap&&(x.sheenRoughnessMap.value=v.sheenRoughnessMap,n(v.sheenRoughnessMap,x.sheenRoughnessMapTransform))),v.clearcoat>0&&(x.clearcoat.value=v.clearcoat,x.clearcoatRoughness.value=v.clearcoatRoughness,v.clearcoatMap&&(x.clearcoatMap.value=v.clearcoatMap,n(v.clearcoatMap,x.clearcoatMapTransform)),v.clearcoatRoughnessMap&&(x.clearcoatRoughnessMap.value=v.clearcoatRoughnessMap,n(v.clearcoatRoughnessMap,x.clearcoatRoughnessMapTransform)),v.clearcoatNormalMap&&(x.clearcoatNormalMap.value=v.clearcoatNormalMap,n(v.clearcoatNormalMap,x.clearcoatNormalMapTransform),x.clearcoatNormalScale.value.copy(v.clearcoatNormalScale),v.side===Kr&&x.clearcoatNormalScale.value.negate())),v.dispersion>0&&(x.dispersion.value=v.dispersion),v.iridescence>0&&(x.iridescence.value=v.iridescence,x.iridescenceIOR.value=v.iridescenceIOR,x.iridescenceThicknessMinimum.value=v.iridescenceThicknessRange[0],x.iridescenceThicknessMaximum.value=v.iridescenceThicknessRange[1],v.iridescenceMap&&(x.iridescenceMap.value=v.iridescenceMap,n(v.iridescenceMap,x.iridescenceMapTransform)),v.iridescenceThicknessMap&&(x.iridescenceThicknessMap.value=v.iridescenceThicknessMap,n(v.iridescenceThicknessMap,x.iridescenceThicknessMapTransform))),v.transmission>0&&(x.transmission.value=v.transmission,x.transmissionSamplerMap.value=w.texture,x.transmissionSamplerSize.value.set(w.width,w.height),v.transmissionMap&&(x.transmissionMap.value=v.transmissionMap,n(v.transmissionMap,x.transmissionMapTransform)),x.thickness.value=v.thickness,v.thicknessMap&&(x.thicknessMap.value=v.thicknessMap,n(v.thicknessMap,x.thicknessMapTransform)),x.attenuationDistance.value=v.attenuationDistance,x.attenuationColor.value.copy(v.attenuationColor)),v.anisotropy>0&&(x.anisotropyVector.value.set(v.anisotropy*Math.cos(v.anisotropyRotation),v.anisotropy*Math.sin(v.anisotropyRotation)),v.anisotropyMap&&(x.anisotropyMap.value=v.anisotropyMap,n(v.anisotropyMap,x.anisotropyMapTransform))),x.specularIntensity.value=v.specularIntensity,x.specularColor.value.copy(v.specularColor),v.specularColorMap&&(x.specularColorMap.value=v.specularColorMap,n(v.specularColorMap,x.specularColorMapTransform)),v.specularIntensityMap&&(x.specularIntensityMap.value=v.specularIntensityMap,n(v.specularIntensityMap,x.specularIntensityMapTransform))}function b(x,v){v.matcap&&(x.matcap.value=v.matcap)}function y(x,v){const w=e.get(v).light;x.referencePosition.value.setFromMatrixPosition(w.matrixWorld),x.nearDistance.value=w.shadow.camera.near,x.farDistance.value=w.shadow.camera.far}return{refreshFogUniforms:i,refreshMaterialUniforms:r}}function Wee(t,e,n,i){let r={},a={},s=[];const l=t.getParameter(t.MAX_UNIFORM_BUFFER_BINDINGS);function c(w,S){const A=S.program;i.uniformBlockBinding(w,A)}function d(w,S){let A=r[w.id];A===void 0&&(b(w),A=f(w),r[w.id]=A,w.addEventListener("dispose",x));const R=S.program;i.updateUBOMapping(w,R);const N=e.render.frame;a[w.id]!==N&&(g(w),a[w.id]=N)}function f(w){const S=h();w.__bindingPointIndex=S;const A=t.createBuffer(),R=w.__size,N=w.usage;return t.bindBuffer(t.UNIFORM_BUFFER,A),t.bufferData(t.UNIFORM_BUFFER,R,N),t.bindBuffer(t.UNIFORM_BUFFER,null),t.bindBufferBase(t.UNIFORM_BUFFER,S,A),A}function h(){for(let w=0;w<l;w++)if(s.indexOf(w)===-1)return s.push(w),w;return ai("WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function g(w){const S=r[w.id],A=w.uniforms,R=w.__cache;t.bindBuffer(t.UNIFORM_BUFFER,S);for(let N=0,C=A.length;N<C;N++){const F=Array.isArray(A[N])?A[N]:[A[N]];for(let P=0,L=F.length;P<L;P++){const B=F[P];if(m(B,N,P,R)===!0){const U=B.__offset,$=Array.isArray(B.value)?B.value:[B.value];let I=0;for(let W=0;W<$.length;W++){const X=$[W],V=y(X);typeof X=="number"||typeof X=="boolean"?(B.__data[0]=X,t.bufferSubData(t.UNIFORM_BUFFER,U+I,B.__data)):X.isMatrix3?(B.__data[0]=X.elements[0],B.__data[1]=X.elements[1],B.__data[2]=X.elements[2],B.__data[3]=0,B.__data[4]=X.elements[3],B.__data[5]=X.elements[4],B.__data[6]=X.elements[5],B.__data[7]=0,B.__data[8]=X.elements[6],B.__data[9]=X.elements[7],B.__data[10]=X.elements[8],B.__data[11]=0):(X.toArray(B.__data,I),I+=V.storage/Float32Array.BYTES_PER_ELEMENT)}t.bufferSubData(t.UNIFORM_BUFFER,U,B.__data)}}}t.bindBuffer(t.UNIFORM_BUFFER,null)}function m(w,S,A,R){const N=w.value,C=S+"_"+A;if(R[C]===void 0)return typeof N=="number"||typeof N=="boolean"?R[C]=N:R[C]=N.clone(),!0;{const F=R[C];if(typeof N=="number"||typeof N=="boolean"){if(F!==N)return R[C]=N,!0}else if(F.equals(N)===!1)return F.copy(N),!0}return!1}function b(w){const S=w.uniforms;let A=0;const R=16;for(let C=0,F=S.length;C<F;C++){const P=Array.isArray(S[C])?S[C]:[S[C]];for(let L=0,B=P.length;L<B;L++){const U=P[L],$=Array.isArray(U.value)?U.value:[U.value];for(let I=0,W=$.length;I<W;I++){const X=$[I],V=y(X),Y=A%R,J=Y%V.boundary,se=Y+J;A+=J,se!==0&&R-se<V.storage&&(A+=R-se),U.__data=new Float32Array(V.storage/Float32Array.BYTES_PER_ELEMENT),U.__offset=A,A+=V.storage}}}const N=A%R;return N>0&&(A+=R-N),w.__size=A,w.__cache={},this}function y(w){const S={boundary:0,storage:0};return typeof w=="number"||typeof w=="boolean"?(S.boundary=4,S.storage=4):w.isVector2?(S.boundary=8,S.storage=8):w.isVector3||w.isColor?(S.boundary=16,S.storage=12):w.isVector4?(S.boundary=16,S.storage=16):w.isMatrix3?(S.boundary=48,S.storage=48):w.isMatrix4?(S.boundary=64,S.storage=64):w.isTexture?It("WebGLRenderer: Texture samplers can not be part of an uniforms group."):It("WebGLRenderer: Unsupported uniform value type.",w),S}function x(w){const S=w.target;S.removeEventListener("dispose",x);const A=s.indexOf(S.__bindingPointIndex);s.splice(A,1),t.deleteBuffer(r[S.id]),delete r[S.id],delete a[S.id]}function v(){for(const w in r)t.deleteBuffer(r[w]);s=[],r={},a={}}return{bind:c,update:d,dispose:v}}const Xee=new Uint16Array([11481,15204,11534,15171,11808,15015,12385,14843,12894,14716,13396,14600,13693,14483,13976,14366,14237,14171,14405,13961,14511,13770,14605,13598,14687,13444,14760,13305,14822,13066,14876,12857,14923,12675,14963,12517,14997,12379,15025,12230,15049,12023,15070,11843,15086,11687,15100,11551,15111,11433,15120,11330,15127,11217,15132,11060,15135,10922,15138,10801,15139,10695,15139,10600,13012,14923,13020,14917,13064,14886,13176,14800,13349,14666,13513,14526,13724,14398,13960,14230,14200,14020,14383,13827,14488,13651,14583,13491,14667,13348,14740,13132,14803,12908,14856,12713,14901,12542,14938,12394,14968,12241,14992,12017,15010,11822,15024,11654,15034,11507,15041,11380,15044,11269,15044,11081,15042,10913,15037,10764,15031,10635,15023,10520,15014,10419,15003,10330,13657,14676,13658,14673,13670,14660,13698,14622,13750,14547,13834,14442,13956,14317,14112,14093,14291,13889,14407,13704,14499,13538,14586,13389,14664,13201,14733,12966,14792,12758,14842,12577,14882,12418,14915,12272,14940,12033,14959,11826,14972,11646,14980,11490,14983,11355,14983,11212,14979,11008,14971,10830,14961,10675,14950,10540,14936,10420,14923,10315,14909,10204,14894,10041,14089,14460,14090,14459,14096,14452,14112,14431,14141,14388,14186,14305,14252,14130,14341,13941,14399,13756,14467,13585,14539,13430,14610,13272,14677,13026,14737,12808,14790,12617,14833,12449,14869,12303,14896,12065,14916,11845,14929,11655,14937,11490,14939,11347,14936,11184,14930,10970,14921,10783,14912,10621,14900,10480,14885,10356,14867,10247,14848,10062,14827,9894,14805,9745,14400,14208,14400,14206,14402,14198,14406,14174,14415,14122,14427,14035,14444,13913,14469,13767,14504,13613,14548,13463,14598,13324,14651,13082,14704,12858,14752,12658,14795,12483,14831,12330,14860,12106,14881,11875,14895,11675,14903,11501,14905,11351,14903,11178,14900,10953,14892,10757,14880,10589,14865,10442,14847,10313,14827,10162,14805,9965,14782,9792,14757,9642,14731,9507,14562,13883,14562,13883,14563,13877,14566,13862,14570,13830,14576,13773,14584,13689,14595,13582,14613,13461,14637,13336,14668,13120,14704,12897,14741,12695,14776,12516,14808,12358,14835,12150,14856,11910,14870,11701,14878,11519,14882,11361,14884,11187,14880,10951,14871,10748,14858,10572,14842,10418,14823,10286,14801,10099,14777,9897,14751,9722,14725,9567,14696,9430,14666,9309,14702,13604,14702,13604,14702,13600,14703,13591,14705,13570,14707,13533,14709,13477,14712,13400,14718,13305,14727,13106,14743,12907,14762,12716,14784,12539,14807,12380,14827,12190,14844,11943,14855,11727,14863,11539,14870,11376,14871,11204,14868,10960,14858,10748,14845,10565,14829,10406,14809,10269,14786,10058,14761,9852,14734,9671,14705,9512,14674,9374,14641,9253,14608,9076,14821,13366,14821,13365,14821,13364,14821,13358,14821,13344,14821,13320,14819,13252,14817,13145,14815,13011,14814,12858,14817,12698,14823,12539,14832,12389,14841,12214,14850,11968,14856,11750,14861,11558,14866,11390,14867,11226,14862,10972,14853,10754,14840,10565,14823,10401,14803,10259,14780,10032,14754,9820,14725,9635,14694,9473,14661,9333,14627,9203,14593,8988,14557,8798,14923,13014,14922,13014,14922,13012,14922,13004,14920,12987,14919,12957,14915,12907,14909,12834,14902,12738,14894,12623,14888,12498,14883,12370,14880,12203,14878,11970,14875,11759,14873,11569,14874,11401,14872,11243,14865,10986,14855,10762,14842,10568,14825,10401,14804,10255,14781,10017,14754,9799,14725,9611,14692,9445,14658,9301,14623,9139,14587,8920,14548,8729,14509,8562,15008,12672,15008,12672,15008,12671,15007,12667,15005,12656,15001,12637,14997,12605,14989,12556,14978,12490,14966,12407,14953,12313,14940,12136,14927,11934,14914,11742,14903,11563,14896,11401,14889,11247,14879,10992,14866,10767,14851,10570,14833,10400,14812,10252,14789,10007,14761,9784,14731,9592,14698,9424,14663,9279,14627,9088,14588,8868,14548,8676,14508,8508,14467,8360,15080,12386,15080,12386,15079,12385,15078,12383,15076,12378,15072,12367,15066,12347,15057,12315,15045,12253,15030,12138,15012,11998,14993,11845,14972,11685,14951,11530,14935,11383,14920,11228,14904,10981,14887,10762,14870,10567,14850,10397,14827,10248,14803,9997,14774,9771,14743,9578,14710,9407,14674,9259,14637,9048,14596,8826,14555,8632,14514,8464,14471,8317,14427,8182,15139,12008,15139,12008,15138,12008,15137,12007,15135,12003,15130,11990,15124,11969,15115,11929,15102,11872,15086,11794,15064,11693,15041,11581,15013,11459,14987,11336,14966,11170,14944,10944,14921,10738,14898,10552,14875,10387,14850,10239,14824,9983,14794,9758,14762,9563,14728,9392,14692,9244,14653,9014,14611,8791,14569,8597,14526,8427,14481,8281,14436,8110,14391,7885,15188,11617,15188,11617,15187,11617,15186,11618,15183,11617,15179,11612,15173,11601,15163,11581,15150,11546,15133,11495,15110,11427,15083,11346,15051,11246,15024,11057,14996,10868,14967,10687,14938,10517,14911,10362,14882,10206,14853,9956,14821,9737,14787,9543,14752,9375,14715,9228,14675,8980,14632,8760,14589,8565,14544,8395,14498,8248,14451,8049,14404,7824,14357,7630,15228,11298,15228,11298,15227,11299,15226,11301,15223,11303,15219,11302,15213,11299,15204,11290,15191,11271,15174,11217,15150,11129,15119,11015,15087,10886,15057,10744,15024,10599,14990,10455,14957,10318,14924,10143,14891,9911,14856,9701,14820,9516,14782,9352,14744,9200,14703,8946,14659,8725,14615,8533,14568,8366,14521,8220,14472,7992,14423,7770,14374,7578,14315,7408,15260,10819,15260,10819,15259,10822,15258,10826,15256,10832,15251,10836,15246,10841,15237,10838,15225,10821,15207,10788,15183,10734,15151,10660,15120,10571,15087,10469,15049,10359,15012,10249,14974,10041,14937,9837,14900,9647,14860,9475,14820,9320,14779,9147,14736,8902,14691,8688,14646,8499,14598,8335,14549,8189,14499,7940,14448,7720,14397,7529,14347,7363,14256,7218,15285,10410,15285,10411,15285,10413,15284,10418,15282,10425,15278,10434,15272,10442,15264,10449,15252,10445,15235,10433,15210,10403,15179,10358,15149,10301,15113,10218,15073,10059,15033,9894,14991,9726,14951,9565,14909,9413,14865,9273,14822,9073,14777,8845,14730,8641,14682,8459,14633,8300,14583,8129,14531,7883,14479,7670,14426,7482,14373,7321,14305,7176,14201,6939,15305,9939,15305,9940,15305,9945,15304,9955,15302,9967,15298,9989,15293,10010,15286,10033,15274,10044,15258,10045,15233,10022,15205,9975,15174,9903,15136,9808,15095,9697,15053,9578,15009,9451,14965,9327,14918,9198,14871,8973,14825,8766,14775,8579,14725,8408,14675,8259,14622,8058,14569,7821,14515,7615,14460,7435,14405,7276,14350,7108,14256,6866,14149,6653,15321,9444,15321,9445,15321,9448,15320,9458,15317,9470,15314,9490,15310,9515,15302,9540,15292,9562,15276,9579,15251,9577,15226,9559,15195,9519,15156,9463,15116,9389,15071,9304,15025,9208,14978,9023,14927,8838,14878,8661,14827,8496,14774,8344,14722,8206,14667,7973,14612,7749,14556,7555,14499,7382,14443,7229,14385,7025,14322,6791,14210,6588,14100,6409,15333,8920,15333,8921,15332,8927,15332,8943,15329,8965,15326,9002,15322,9048,15316,9106,15307,9162,15291,9204,15267,9221,15244,9221,15212,9196,15175,9134,15133,9043,15088,8930,15040,8801,14990,8665,14938,8526,14886,8391,14830,8261,14775,8087,14719,7866,14661,7664,14603,7482,14544,7322,14485,7178,14426,6936,14367,6713,14281,6517,14166,6348,14054,6198,15341,8360,15341,8361,15341,8366,15341,8379,15339,8399,15336,8431,15332,8473,15326,8527,15318,8585,15302,8632,15281,8670,15258,8690,15227,8690,15191,8664,15149,8612,15104,8543,15055,8456,15001,8360,14948,8259,14892,8122,14834,7923,14776,7734,14716,7558,14656,7397,14595,7250,14534,7070,14472,6835,14410,6628,14350,6443,14243,6283,14125,6135,14010,5889,15348,7715,15348,7717,15348,7725,15347,7745,15345,7780,15343,7836,15339,7905,15334,8e3,15326,8103,15310,8193,15293,8239,15270,8270,15240,8287,15204,8283,15163,8260,15118,8223,15067,8143,15014,8014,14958,7873,14899,7723,14839,7573,14778,7430,14715,7293,14652,7164,14588,6931,14524,6720,14460,6531,14396,6362,14330,6210,14207,6015,14086,5781,13969,5576,15352,7114,15352,7116,15352,7128,15352,7159,15350,7195,15348,7237,15345,7299,15340,7374,15332,7457,15317,7544,15301,7633,15280,7703,15251,7754,15216,7775,15176,7767,15131,7733,15079,7670,15026,7588,14967,7492,14906,7387,14844,7278,14779,7171,14714,6965,14648,6770,14581,6587,14515,6420,14448,6269,14382,6123,14299,5881,14172,5665,14049,5477,13929,5310,15355,6329,15355,6330,15355,6339,15355,6362,15353,6410,15351,6472,15349,6572,15344,6688,15337,6835,15323,6985,15309,7142,15287,7220,15260,7277,15226,7310,15188,7326,15142,7318,15090,7285,15036,7239,14976,7177,14914,7045,14849,6892,14782,6736,14714,6581,14645,6433,14576,6293,14506,6164,14438,5946,14369,5733,14270,5540,14140,5369,14014,5216,13892,5043,15357,5483,15357,5484,15357,5496,15357,5528,15356,5597,15354,5692,15351,5835,15347,6011,15339,6195,15328,6317,15314,6446,15293,6566,15268,6668,15235,6746,15197,6796,15152,6811,15101,6790,15046,6748,14985,6673,14921,6583,14854,6479,14785,6371,14714,6259,14643,6149,14571,5946,14499,5750,14428,5567,14358,5401,14242,5250,14109,5111,13980,4870,13856,4657,15359,4555,15359,4557,15358,4573,15358,4633,15357,4715,15355,4841,15353,5061,15349,5216,15342,5391,15331,5577,15318,5770,15299,5967,15274,6150,15243,6223,15206,6280,15161,6310,15111,6317,15055,6300,14994,6262,14928,6208,14860,6141,14788,5994,14715,5838,14641,5684,14566,5529,14492,5384,14418,5247,14346,5121,14216,4892,14079,4682,13948,4496,13822,4330,15359,3498,15359,3501,15359,3520,15359,3598,15358,3719,15356,3860,15355,4137,15351,4305,15344,4563,15334,4809,15321,5116,15303,5273,15280,5418,15250,5547,15214,5653,15170,5722,15120,5761,15064,5763,15002,5733,14935,5673,14865,5597,14792,5504,14716,5400,14640,5294,14563,5185,14486,5041,14410,4841,14335,4655,14191,4482,14051,4325,13918,4183,13790,4012,15360,2282,15360,2285,15360,2306,15360,2401,15359,2547,15357,2748,15355,3103,15352,3349,15345,3675,15336,4020,15324,4272,15307,4496,15285,4716,15255,4908,15220,5086,15178,5170,15128,5214,15072,5234,15010,5231,14943,5206,14871,5166,14796,5102,14718,4971,14639,4833,14559,4687,14480,4541,14402,4401,14315,4268,14167,4142,14025,3958,13888,3747,13759,3556,15360,923,15360,925,15360,946,15360,1052,15359,1214,15357,1494,15356,1892,15352,2274,15346,2663,15338,3099,15326,3393,15309,3679,15288,3980,15260,4183,15226,4325,15185,4437,15136,4517,15080,4570,15018,4591,14950,4581,14877,4545,14800,4485,14720,4411,14638,4325,14556,4231,14475,4136,14395,3988,14297,3803,14145,3628,13999,3465,13861,3314,13729,3177,15360,263,15360,264,15360,272,15360,325,15359,407,15358,548,15356,780,15352,1144,15347,1580,15339,2099,15328,2425,15312,2795,15292,3133,15264,3329,15232,3517,15191,3689,15143,3819,15088,3923,15025,3978,14956,3999,14882,3979,14804,3931,14722,3855,14639,3756,14554,3645,14470,3529,14388,3409,14279,3289,14124,3173,13975,3055,13834,2848,13701,2658,15360,49,15360,49,15360,52,15360,75,15359,111,15358,201,15356,283,15353,519,15348,726,15340,1045,15329,1415,15314,1795,15295,2173,15269,2410,15237,2649,15197,2866,15150,3054,15095,3140,15032,3196,14963,3228,14888,3236,14808,3224,14725,3191,14639,3146,14553,3088,14466,2976,14382,2836,14262,2692,14103,2549,13952,2409,13808,2278,13674,2154,15360,4,15360,4,15360,4,15360,13,15359,33,15358,59,15357,112,15353,199,15348,302,15341,456,15331,628,15316,827,15297,1082,15272,1332,15241,1601,15202,1851,15156,2069,15101,2172,15039,2256,14970,2314,14894,2348,14813,2358,14728,2344,14640,2311,14551,2263,14463,2203,14376,2133,14247,2059,14084,1915,13930,1761,13784,1609,13648,1464,15360,0,15360,0,15360,0,15360,3,15359,18,15358,26,15357,53,15354,80,15348,97,15341,165,15332,238,15318,326,15299,427,15275,529,15245,654,15207,771,15161,885,15108,994,15046,1089,14976,1170,14900,1229,14817,1266,14731,1284,14641,1282,14550,1260,14460,1223,14370,1174,14232,1116,14066,1050,13909,981,13761,910,13623,839]);let _o=null;function qee(){return _o===null&&(_o=new qY(Xee,32,32,wT,Bf),_o.minFilter=$a,_o.magFilter=$a,_o.wrapS=Oo,_o.wrapT=Oo,_o.generateMipmaps=!1,_o.needsUpdate=!0),_o}let Yee=class{constructor(e={}){const{canvas:n=yY(),context:i=null,depth:r=!0,stencil:a=!1,alpha:s=!1,antialias:l=!1,premultipliedAlpha:c=!0,preserveDrawingBuffer:d=!1,powerPreference:f="default",failIfMajorPerformanceCaveat:h=!1,reversedDepthBuffer:g=!1}=e;this.isWebGLRenderer=!0;let m;if(i!==null){if(typeof WebGLRenderingContext<"u"&&i instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");m=i.getContextAttributes().alpha}else m=s;const b=new Set([MT,ET,ST]),y=new Set([js,bu,zp,Bp,bT,_T]),x=new Uint32Array(4),v=new Int32Array(4);let w=null,S=null;const A=[],R=[];this.domElement=n,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.toneMapping=nc,this.toneMappingExposure=1,this.transmissionResolutionScale=1;const N=this;let C=!1;this._outputColorSpace=za;let F=0,P=0,L=null,B=-1,U=null;const $=new gi,I=new gi;let W=null;const X=new nn(0);let V=0,Y=n.width,J=n.height,se=1,H=null,q=null;const re=new gi(0,0,Y,J),ce=new gi(0,0,Y,J);let ye=!1;const me=new PT;let be=!1,Ne=!1;const he=new bi,Ae=new Ve,Be=new gi,le={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let lt=!1;function z(){return L===null?se:1}let G=i;function ne(Z,_e){return n.getContext(Z,_e)}try{const Z={alpha:!0,depth:r,stencil:a,antialias:l,premultipliedAlpha:c,preserveDrawingBuffer:d,powerPreference:f,failIfMajorPerformanceCaveat:h};if("setAttribute"in n&&n.setAttribute("data-engine",`three.js r${vT}`),n.addEventListener("webglcontextlost",Me,!1),n.addEventListener("webglcontextrestored",ge,!1),n.addEventListener("webglcontextcreationerror",je,!1),G===null){const _e="webgl2";if(G=ne(_e,Z),G===null)throw ne(_e)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(Z){throw Z("WebGLRenderer: "+Z.message),Z}let Q,ee,ae,ie,we,ve,k,O,K,pe,xe,fe,Ke,Ie,$e,rt,ke,De,ct,et,Je,st,ue,tt;function de(){Q=new iJ(G),Q.init(),st=new zee(G,Q),ee=new qQ(G,Q,e,st),ae=new kee(G,Q),ee.reversedDepthBuffer&&g&&ae.buffers.depth.setReversed(!0),ie=new sJ(G),we=new Eee,ve=new Fee(G,Q,ae,we,ee,st,ie),k=new KQ(N),O=new nJ(N),K=new uK(G),ue=new WQ(G,K),pe=new rJ(G,K,ie,ue),xe=new lJ(G,pe,K,ie),ct=new oJ(G,ee,ve),rt=new YQ(we),fe=new wee(N,k,O,Q,ee,ue,rt),Ke=new $ee(N,we),Ie=new Aee,$e=new Nee(Q),De=new $Q(N,k,O,ae,xe,m,c),ke=new Iee(N,xe,ee),tt=new Wee(G,ie,ee,ae),et=new XQ(G,Q,ie),Je=new aJ(G,Q,ie),ie.programs=fe.programs,N.capabilities=ee,N.extensions=Q,N.properties=we,N.renderLists=Ie,N.shadowMap=ke,N.state=ae,N.info=ie}de();const Le=new Gee(N,G);this.xr=Le,this.getContext=function(){return G},this.getContextAttributes=function(){return G.getContextAttributes()},this.forceContextLoss=function(){const Z=Q.get("WEBGL_lose_context");Z&&Z.loseContext()},this.forceContextRestore=function(){const Z=Q.get("WEBGL_lose_context");Z&&Z.restoreContext()},this.getPixelRatio=function(){return se},this.setPixelRatio=function(Z){Z!==void 0&&(se=Z,this.setSize(Y,J,!1))},this.getSize=function(Z){return Z.set(Y,J)},this.setSize=function(Z,_e,Pe=!0){if(Le.isPresenting){It("WebGLRenderer: Can't change size while VR device is presenting.");return}Y=Z,J=_e,n.width=Math.floor(Z*se),n.height=Math.floor(_e*se),Pe===!0&&(n.style.width=Z+"px",n.style.height=_e+"px"),this.setViewport(0,0,Z,_e)},this.getDrawingBufferSize=function(Z){return Z.set(Y*se,J*se).floor()},this.setDrawingBufferSize=function(Z,_e,Pe){Y=Z,J=_e,se=Pe,n.width=Math.floor(Z*Pe),n.height=Math.floor(_e*Pe),this.setViewport(0,0,Z,_e)},this.getCurrentViewport=function(Z){return Z.copy($)},this.getViewport=function(Z){return Z.copy(re)},this.setViewport=function(Z,_e,Pe,Re){Z.isVector4?re.set(Z.x,Z.y,Z.z,Z.w):re.set(Z,_e,Pe,Re),ae.viewport($.copy(re).multiplyScalar(se).round())},this.getScissor=function(Z){return Z.copy(ce)},this.setScissor=function(Z,_e,Pe,Re){Z.isVector4?ce.set(Z.x,Z.y,Z.z,Z.w):ce.set(Z,_e,Pe,Re),ae.scissor(I.copy(ce).multiplyScalar(se).round())},this.getScissorTest=function(){return ye},this.setScissorTest=function(Z){ae.setScissorTest(ye=Z)},this.setOpaqueSort=function(Z){H=Z},this.setTransparentSort=function(Z){q=Z},this.getClearColor=function(Z){return Z.copy(De.getClearColor())},this.setClearColor=function(){De.setClearColor(...arguments)},this.getClearAlpha=function(){return De.getClearAlpha()},this.setClearAlpha=function(){De.setClearAlpha(...arguments)},this.clear=function(Z=!0,_e=!0,Pe=!0){let Re=0;if(Z){let Ee=!1;if(L!==null){const Ze=L.texture.format;Ee=b.has(Ze)}if(Ee){const Ze=L.texture.type,ot=y.has(Ze),ft=De.getClearColor(),dt=De.getClearAlpha(),Et=ft.r,xt=ft.g,ut=ft.b;ot?(x[0]=Et,x[1]=xt,x[2]=ut,x[3]=dt,G.clearBufferuiv(G.COLOR,0,x)):(v[0]=Et,v[1]=xt,v[2]=ut,v[3]=dt,G.clearBufferiv(G.COLOR,0,v))}else Re|=G.COLOR_BUFFER_BIT}_e&&(Re|=G.DEPTH_BUFFER_BIT),Pe&&(Re|=G.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),G.clear(Re)},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(){n.removeEventListener("webglcontextlost",Me,!1),n.removeEventListener("webglcontextrestored",ge,!1),n.removeEventListener("webglcontextcreationerror",je,!1),De.dispose(),Ie.dispose(),$e.dispose(),we.dispose(),k.dispose(),O.dispose(),xe.dispose(),ue.dispose(),tt.dispose(),fe.dispose(),Le.dispose(),Le.removeEventListener("sessionstart",Rn),Le.removeEventListener("sessionend",zi),wi.stop()};function Me(Z){Z.preventDefault(),_N("WebGLRenderer: Context Lost."),C=!0}function ge(){_N("WebGLRenderer: Context Restored."),C=!1;const Z=ie.autoReset,_e=ke.enabled,Pe=ke.autoUpdate,Re=ke.needsUpdate,Ee=ke.type;de(),ie.autoReset=Z,ke.enabled=_e,ke.autoUpdate=Pe,ke.needsUpdate=Re,ke.type=Ee}function je(Z){ai("WebGLRenderer: A WebGL context could not be created. Reason: ",Z.statusMessage)}function at(Z){const _e=Z.target;_e.removeEventListener("dispose",at),mt(_e)}function mt(Z){wt(Z),we.remove(Z)}function wt(Z){const _e=we.get(Z).programs;_e!==void 0&&(_e.forEach(function(Pe){fe.releaseProgram(Pe)}),Z.isShaderMaterial&&fe.releaseShaderCache(Z))}this.renderBufferDirect=function(Z,_e,Pe,Re,Ee,Ze){_e===null&&(_e=le);const ot=Ee.isMesh&&Ee.matrixWorld.determinant()<0,ft=oe(Z,_e,Pe,Re,Ee);ae.setMaterial(Re,ot);let dt=Pe.index,Et=1;if(Re.wireframe===!0){if(dt=pe.getWireframeAttribute(Pe),dt===void 0)return;Et=2}const xt=Pe.drawRange,ut=Pe.attributes.position;let Lt=xt.start*Et,Pt=(xt.start+xt.count)*Et;Ze!==null&&(Lt=Math.max(Lt,Ze.start*Et),Pt=Math.min(Pt,(Ze.start+Ze.count)*Et)),dt!==null?(Lt=Math.max(Lt,0),Pt=Math.min(Pt,dt.count)):ut!=null&&(Lt=Math.max(Lt,0),Pt=Math.min(Pt,ut.count));const Ht=Pt-Lt;if(Ht<0||Ht===1/0)return;ue.setup(Ee,Re,ft,Pe,dt);let qt,Jt=et;if(dt!==null&&(qt=K.get(dt),Jt=Je,Jt.setIndex(qt)),Ee.isMesh)Re.wireframe===!0?(ae.setLineWidth(Re.wireframeLinewidth*z()),Jt.setMode(G.LINES)):Jt.setMode(G.TRIANGLES);else if(Ee.isLine){let Rt=Re.linewidth;Rt===void 0&&(Rt=1),ae.setLineWidth(Rt*z()),Ee.isLineSegments?Jt.setMode(G.LINES):Ee.isLineLoop?Jt.setMode(G.LINE_LOOP):Jt.setMode(G.LINE_STRIP)}else Ee.isPoints?Jt.setMode(G.POINTS):Ee.isSprite&&Jt.setMode(G.TRIANGLES);if(Ee.isBatchedMesh)if(Ee._multiDrawInstances!==null)Gp("WebGLRenderer: renderMultiDrawInstances has been deprecated and will be removed in r184. Append to renderMultiDraw arguments and use indirection."),Jt.renderMultiDrawInstances(Ee._multiDrawStarts,Ee._multiDrawCounts,Ee._multiDrawCount,Ee._multiDrawInstances);else if(Q.get("WEBGL_multi_draw"))Jt.renderMultiDraw(Ee._multiDrawStarts,Ee._multiDrawCounts,Ee._multiDrawCount);else{const Rt=Ee._multiDrawStarts,kt=Ee._multiDrawCounts,zt=Ee._multiDrawCount,Kn=dt?K.get(dt).bytesPerElement:1,ti=we.get(Re).currentProgram.getUniforms();for(let pn=0;pn<zt;pn++)ti.setValue(G,"_gl_DrawID",pn),Jt.render(Rt[pn]/Kn,kt[pn])}else if(Ee.isInstancedMesh)Jt.renderInstances(Lt,Ht,Ee.count);else if(Pe.isInstancedBufferGeometry){const Rt=Pe._maxInstanceCount!==void 0?Pe._maxInstanceCount:1/0,kt=Math.min(Pe.instanceCount,Rt);Jt.renderInstances(Lt,Ht,kt)}else Jt.render(Lt,Ht)};function Wt(Z,_e,Pe){Z.transparent===!0&&Z.side===Os&&Z.forceSinglePass===!1?(Z.side=Kr,Z.needsUpdate=!0,ei(Z,_e,Pe),Z.side=oc,Z.needsUpdate=!0,ei(Z,_e,Pe),Z.side=Os):ei(Z,_e,Pe)}this.compile=function(Z,_e,Pe=null){Pe===null&&(Pe=Z),S=$e.get(Pe),S.init(_e),R.push(S),Pe.traverseVisible(function(Ee){Ee.isLight&&Ee.layers.test(_e.layers)&&(S.pushLight(Ee),Ee.castShadow&&S.pushShadow(Ee))}),Z!==Pe&&Z.traverseVisible(function(Ee){Ee.isLight&&Ee.layers.test(_e.layers)&&(S.pushLight(Ee),Ee.castShadow&&S.pushShadow(Ee))}),S.setupLights();const Re=new Set;return Z.traverse(function(Ee){if(!(Ee.isMesh||Ee.isPoints||Ee.isLine||Ee.isSprite))return;const Ze=Ee.material;if(Ze)if(Array.isArray(Ze))for(let ot=0;ot<Ze.length;ot++){const ft=Ze[ot];Wt(ft,Pe,Ee),Re.add(ft)}else Wt(Ze,Pe,Ee),Re.add(Ze)}),S=R.pop(),Re},this.compileAsync=function(Z,_e,Pe=null){const Re=this.compile(Z,_e,Pe);return new Promise(Ee=>{function Ze(){if(Re.forEach(function(ot){we.get(ot).currentProgram.isReady()&&Re.delete(ot)}),Re.size===0){Ee(Z);return}setTimeout(Ze,10)}Q.get("KHR_parallel_shader_compile")!==null?Ze():setTimeout(Ze,10)})};let Ct=null;function mn(Z){Ct&&Ct(Z)}function Rn(){wi.stop()}function zi(){wi.start()}const wi=new xB;wi.setAnimationLoop(mn),typeof self<"u"&&wi.setContext(self),this.setAnimationLoop=function(Z){Ct=Z,Le.setAnimationLoop(Z),Z===null?wi.stop():wi.start()},Le.addEventListener("sessionstart",Rn),Le.addEventListener("sessionend",zi),this.render=function(Z,_e){if(_e!==void 0&&_e.isCamera!==!0){ai("WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(C===!0)return;if(Z.matrixWorldAutoUpdate===!0&&Z.updateMatrixWorld(),_e.parent===null&&_e.matrixWorldAutoUpdate===!0&&_e.updateMatrixWorld(),Le.enabled===!0&&Le.isPresenting===!0&&(Le.cameraAutoUpdate===!0&&Le.updateCamera(_e),_e=Le.getCamera()),Z.isScene===!0&&Z.onBeforeRender(N,Z,_e,L),S=$e.get(Z,R.length),S.init(_e),R.push(S),he.multiplyMatrices(_e.projectionMatrix,_e.matrixWorldInverse),me.setFromProjectionMatrix(he,Is,_e.reversedDepth),Ne=this.localClippingEnabled,be=rt.init(this.clippingPlanes,Ne),w=Ie.get(Z,A.length),w.init(),A.push(w),Le.enabled===!0&&Le.isPresenting===!0){const Ze=N.xr.getDepthSensingMesh();Ze!==null&&Bi(Ze,_e,-1/0,N.sortObjects)}Bi(Z,_e,0,N.sortObjects),w.finish(),N.sortObjects===!0&&w.sort(H,q),lt=Le.enabled===!1||Le.isPresenting===!1||Le.hasDepthSensing()===!1,lt&&De.addToRenderList(w,Z),this.info.render.frame++,be===!0&&rt.beginShadows();const Pe=S.state.shadowsArray;ke.render(Pe,Z,_e),be===!0&&rt.endShadows(),this.info.autoReset===!0&&this.info.reset();const Re=w.opaque,Ee=w.transmissive;if(S.setupLights(),_e.isArrayCamera){const Ze=_e.cameras;if(Ee.length>0)for(let ot=0,ft=Ze.length;ot<ft;ot++){const dt=Ze[ot];mr(Re,Ee,Z,dt)}lt&&De.render(Z);for(let ot=0,ft=Ze.length;ot<ft;ot++){const dt=Ze[ot];tr(w,Z,dt,dt.viewport)}}else Ee.length>0&&mr(Re,Ee,Z,_e),lt&&De.render(Z),tr(w,Z,_e);L!==null&&P===0&&(ve.updateMultisampleRenderTarget(L),ve.updateRenderTargetMipmap(L)),Z.isScene===!0&&Z.onAfterRender(N,Z,_e),ue.resetDefaultState(),B=-1,U=null,R.pop(),R.length>0?(S=R[R.length-1],be===!0&&rt.setGlobalState(N.clippingPlanes,S.state.camera)):S=null,A.pop(),A.length>0?w=A[A.length-1]:w=null};function Bi(Z,_e,Pe,Re){if(Z.visible===!1)return;if(Z.layers.test(_e.layers)){if(Z.isGroup)Pe=Z.renderOrder;else if(Z.isLOD)Z.autoUpdate===!0&&Z.update(_e);else if(Z.isLight)S.pushLight(Z),Z.castShadow&&S.pushShadow(Z);else if(Z.isSprite){if(!Z.frustumCulled||me.intersectsSprite(Z)){Re&&Be.setFromMatrixPosition(Z.matrixWorld).applyMatrix4(he);const ot=xe.update(Z),ft=Z.material;ft.visible&&w.push(Z,ot,ft,Pe,Be.z,null)}}else if((Z.isMesh||Z.isLine||Z.isPoints)&&(!Z.frustumCulled||me.intersectsObject(Z))){const ot=xe.update(Z),ft=Z.material;if(Re&&(Z.boundingSphere!==void 0?(Z.boundingSphere===null&&Z.computeBoundingSphere(),Be.copy(Z.boundingSphere.center)):(ot.boundingSphere===null&&ot.computeBoundingSphere(),Be.copy(ot.boundingSphere.center)),Be.applyMatrix4(Z.matrixWorld).applyMatrix4(he)),Array.isArray(ft)){const dt=ot.groups;for(let Et=0,xt=dt.length;Et<xt;Et++){const ut=dt[Et],Lt=ft[ut.materialIndex];Lt&&Lt.visible&&w.push(Z,ot,Lt,Pe,Be.z,ut)}}else ft.visible&&w.push(Z,ot,ft,Pe,Be.z,null)}}const Ze=Z.children;for(let ot=0,ft=Ze.length;ot<ft;ot++)Bi(Ze[ot],_e,Pe,Re)}function tr(Z,_e,Pe,Re){const{opaque:Ee,transmissive:Ze,transparent:ot}=Z;S.setupLightsView(Pe),be===!0&&rt.setGlobalState(N.clippingPlanes,Pe),Re&&ae.viewport($.copy(Re)),Ee.length>0&&li(Ee,_e,Pe),Ze.length>0&&li(Ze,_e,Pe),ot.length>0&&li(ot,_e,Pe),ae.buffers.depth.setTest(!0),ae.buffers.depth.setMask(!0),ae.buffers.color.setMask(!0),ae.setPolygonOffset(!1)}function mr(Z,_e,Pe,Re){if((Pe.isScene===!0?Pe.overrideMaterial:null)!==null)return;S.state.transmissionRenderTarget[Re.id]===void 0&&(S.state.transmissionRenderTarget[Re.id]=new Su(1,1,{generateMipmaps:!0,type:Q.has("EXT_color_buffer_half_float")||Q.has("EXT_color_buffer_float")?Bf:js,minFilter:iu,samples:4,stencilBuffer:a,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:un.workingColorSpace}));const Ze=S.state.transmissionRenderTarget[Re.id],ot=Re.viewport||$;Ze.setSize(ot.z*N.transmissionResolutionScale,ot.w*N.transmissionResolutionScale);const ft=N.getRenderTarget(),dt=N.getActiveCubeFace(),Et=N.getActiveMipmapLevel();N.setRenderTarget(Ze),N.getClearColor(X),V=N.getClearAlpha(),V<1&&N.setClearColor(16777215,.5),N.clear(),lt&&De.render(Pe);const xt=N.toneMapping;N.toneMapping=nc;const ut=Re.viewport;if(Re.viewport!==void 0&&(Re.viewport=void 0),S.setupLightsView(Re),be===!0&&rt.setGlobalState(N.clippingPlanes,Re),li(Z,Pe,Re),ve.updateMultisampleRenderTarget(Ze),ve.updateRenderTargetMipmap(Ze),Q.has("WEBGL_multisampled_render_to_texture")===!1){let Lt=!1;for(let Pt=0,Ht=_e.length;Pt<Ht;Pt++){const qt=_e[Pt],{object:Jt,geometry:Rt,material:kt,group:zt}=qt;if(kt.side===Os&&Jt.layers.test(Re.layers)){const Kn=kt.side;kt.side=Kr,kt.needsUpdate=!0,Wn(Jt,Pe,Re,Rt,kt,zt),kt.side=Kn,kt.needsUpdate=!0,Lt=!0}}Lt===!0&&(ve.updateMultisampleRenderTarget(Ze),ve.updateRenderTargetMipmap(Ze))}N.setRenderTarget(ft,dt,Et),N.setClearColor(X,V),ut!==void 0&&(Re.viewport=ut),N.toneMapping=xt}function li(Z,_e,Pe){const Re=_e.isScene===!0?_e.overrideMaterial:null;for(let Ee=0,Ze=Z.length;Ee<Ze;Ee++){const ot=Z[Ee],{object:ft,geometry:dt,group:Et}=ot;let xt=ot.material;xt.allowOverride===!0&&Re!==null&&(xt=Re),ft.layers.test(Pe.layers)&&Wn(ft,_e,Pe,dt,xt,Et)}}function Wn(Z,_e,Pe,Re,Ee,Ze){Z.onBeforeRender(N,_e,Pe,Re,Ee,Ze),Z.modelViewMatrix.multiplyMatrices(Pe.matrixWorldInverse,Z.matrixWorld),Z.normalMatrix.getNormalMatrix(Z.modelViewMatrix),Ee.onBeforeRender(N,_e,Pe,Re,Z,Ze),Ee.transparent===!0&&Ee.side===Os&&Ee.forceSinglePass===!1?(Ee.side=Kr,Ee.needsUpdate=!0,N.renderBufferDirect(Pe,_e,Re,Ee,Z,Ze),Ee.side=oc,Ee.needsUpdate=!0,N.renderBufferDirect(Pe,_e,Re,Ee,Z,Ze),Ee.side=Os):N.renderBufferDirect(Pe,_e,Re,Ee,Z,Ze),Z.onAfterRender(N,_e,Pe,Re,Ee,Ze)}function ei(Z,_e,Pe){_e.isScene!==!0&&(_e=le);const Re=we.get(Z),Ee=S.state.lights,Ze=S.state.shadowsArray,ot=Ee.state.version,ft=fe.getParameters(Z,Ee.state,Ze,_e,Pe),dt=fe.getProgramCacheKey(ft);let Et=Re.programs;Re.environment=Z.isMeshStandardMaterial?_e.environment:null,Re.fog=_e.fog,Re.envMap=(Z.isMeshStandardMaterial?O:k).get(Z.envMap||Re.environment),Re.envMapRotation=Re.environment!==null&&Z.envMap===null?_e.environmentRotation:Z.envMapRotation,Et===void 0&&(Z.addEventListener("dispose",at),Et=new Map,Re.programs=Et);let xt=Et.get(dt);if(xt!==void 0){if(Re.currentProgram===xt&&Re.lightsStateVersion===ot)return ol(Z,ft),xt}else ft.uniforms=fe.getUniforms(Z),Z.onBeforeCompile(ft,N),xt=fe.acquireProgram(ft,dt),Et.set(dt,xt),Re.uniforms=ft.uniforms;const ut=Re.uniforms;return(!Z.isShaderMaterial&&!Z.isRawShaderMaterial||Z.clipping===!0)&&(ut.clippingPlanes=rt.uniform),ol(Z,ft),Re.needsLights=Xe(Z),Re.lightsStateVersion=ot,Re.needsLights&&(ut.ambientLightColor.value=Ee.state.ambient,ut.lightProbe.value=Ee.state.probe,ut.directionalLights.value=Ee.state.directional,ut.directionalLightShadows.value=Ee.state.directionalShadow,ut.spotLights.value=Ee.state.spot,ut.spotLightShadows.value=Ee.state.spotShadow,ut.rectAreaLights.value=Ee.state.rectArea,ut.ltc_1.value=Ee.state.rectAreaLTC1,ut.ltc_2.value=Ee.state.rectAreaLTC2,ut.pointLights.value=Ee.state.point,ut.pointLightShadows.value=Ee.state.pointShadow,ut.hemisphereLights.value=Ee.state.hemi,ut.directionalShadowMap.value=Ee.state.directionalShadowMap,ut.directionalShadowMatrix.value=Ee.state.directionalShadowMatrix,ut.spotShadowMap.value=Ee.state.spotShadowMap,ut.spotLightMatrix.value=Ee.state.spotLightMatrix,ut.spotLightMap.value=Ee.state.spotLightMap,ut.pointShadowMap.value=Ee.state.pointShadowMap,ut.pointShadowMatrix.value=Ee.state.pointShadowMatrix),Re.currentProgram=xt,Re.uniformsList=null,xt}function Ja(Z){if(Z.uniformsList===null){const _e=Z.currentProgram.getUniforms();Z.uniformsList=kv.seqWithValue(_e.seq,Z.uniforms)}return Z.uniformsList}function ol(Z,_e){const Pe=we.get(Z);Pe.outputColorSpace=_e.outputColorSpace,Pe.batching=_e.batching,Pe.batchingColor=_e.batchingColor,Pe.instancing=_e.instancing,Pe.instancingColor=_e.instancingColor,Pe.instancingMorph=_e.instancingMorph,Pe.skinning=_e.skinning,Pe.morphTargets=_e.morphTargets,Pe.morphNormals=_e.morphNormals,Pe.morphColors=_e.morphColors,Pe.morphTargetsCount=_e.morphTargetsCount,Pe.numClippingPlanes=_e.numClippingPlanes,Pe.numIntersection=_e.numClipIntersection,Pe.vertexAlphas=_e.vertexAlphas,Pe.vertexTangents=_e.vertexTangents,Pe.toneMapping=_e.toneMapping}function oe(Z,_e,Pe,Re,Ee){_e.isScene!==!0&&(_e=le),ve.resetTextureUnits();const Ze=_e.fog,ot=Re.isMeshStandardMaterial?_e.environment:null,ft=L===null?N.outputColorSpace:L.isXRRenderTarget===!0?L.texture.colorSpace:bf,dt=(Re.isMeshStandardMaterial?O:k).get(Re.envMap||ot),Et=Re.vertexColors===!0&&!!Pe.attributes.color&&Pe.attributes.color.itemSize===4,xt=!!Pe.attributes.tangent&&(!!Re.normalMap||Re.anisotropy>0),ut=!!Pe.morphAttributes.position,Lt=!!Pe.morphAttributes.normal,Pt=!!Pe.morphAttributes.color;let Ht=nc;Re.toneMapped&&(L===null||L.isXRRenderTarget===!0)&&(Ht=N.toneMapping);const qt=Pe.morphAttributes.position||Pe.morphAttributes.normal||Pe.morphAttributes.color,Jt=qt!==void 0?qt.length:0,Rt=we.get(Re),kt=S.state.lights;if(be===!0&&(Ne===!0||Z!==U)){const Hi=Z===U&&Re.id===B;rt.setState(Re,Z,Hi)}let zt=!1;Re.version===Rt.__version?(Rt.needsLights&&Rt.lightsStateVersion!==kt.state.version||Rt.outputColorSpace!==ft||Ee.isBatchedMesh&&Rt.batching===!1||!Ee.isBatchedMesh&&Rt.batching===!0||Ee.isBatchedMesh&&Rt.batchingColor===!0&&Ee.colorTexture===null||Ee.isBatchedMesh&&Rt.batchingColor===!1&&Ee.colorTexture!==null||Ee.isInstancedMesh&&Rt.instancing===!1||!Ee.isInstancedMesh&&Rt.instancing===!0||Ee.isSkinnedMesh&&Rt.skinning===!1||!Ee.isSkinnedMesh&&Rt.skinning===!0||Ee.isInstancedMesh&&Rt.instancingColor===!0&&Ee.instanceColor===null||Ee.isInstancedMesh&&Rt.instancingColor===!1&&Ee.instanceColor!==null||Ee.isInstancedMesh&&Rt.instancingMorph===!0&&Ee.morphTexture===null||Ee.isInstancedMesh&&Rt.instancingMorph===!1&&Ee.morphTexture!==null||Rt.envMap!==dt||Re.fog===!0&&Rt.fog!==Ze||Rt.numClippingPlanes!==void 0&&(Rt.numClippingPlanes!==rt.numPlanes||Rt.numIntersection!==rt.numIntersection)||Rt.vertexAlphas!==Et||Rt.vertexTangents!==xt||Rt.morphTargets!==ut||Rt.morphNormals!==Lt||Rt.morphColors!==Pt||Rt.toneMapping!==Ht||Rt.morphTargetsCount!==Jt)&&(zt=!0):(zt=!0,Rt.__version=Re.version);let Kn=Rt.currentProgram;zt===!0&&(Kn=ei(Re,_e,Ee));let ti=!1,pn=!1,es=!1;const gn=Kn.getUniforms(),ji=Rt.uniforms;if(ae.useProgram(Kn.program)&&(ti=!0,pn=!0,es=!0),Re.id!==B&&(B=Re.id,pn=!0),ti||U!==Z){ae.buffers.depth.getReversed()&&Z.reversedDepth!==!0&&(Z._reversedDepth=!0,Z.updateProjectionMatrix()),gn.setValue(G,"projectionMatrix",Z.projectionMatrix),gn.setValue(G,"viewMatrix",Z.matrixWorldInverse);const nr=gn.map.cameraPosition;nr!==void 0&&nr.setValue(G,Ae.setFromMatrixPosition(Z.matrixWorld)),ee.logarithmicDepthBuffer&&gn.setValue(G,"logDepthBufFC",2/(Math.log(Z.far+1)/Math.LN2)),(Re.isMeshPhongMaterial||Re.isMeshToonMaterial||Re.isMeshLambertMaterial||Re.isMeshBasicMaterial||Re.isMeshStandardMaterial||Re.isShaderMaterial)&&gn.setValue(G,"isOrthographic",Z.isOrthographicCamera===!0),U!==Z&&(U=Z,pn=!0,es=!0)}if(Ee.isSkinnedMesh){gn.setOptional(G,Ee,"bindMatrix"),gn.setOptional(G,Ee,"bindMatrixInverse");const Hi=Ee.skeleton;Hi&&(Hi.boneTexture===null&&Hi.computeBoneTexture(),gn.setValue(G,"boneTexture",Hi.boneTexture,ve))}Ee.isBatchedMesh&&(gn.setOptional(G,Ee,"batchingTexture"),gn.setValue(G,"batchingTexture",Ee._matricesTexture,ve),gn.setOptional(G,Ee,"batchingIdTexture"),gn.setValue(G,"batchingIdTexture",Ee._indirectTexture,ve),gn.setOptional(G,Ee,"batchingColorTexture"),Ee._colorsTexture!==null&&gn.setValue(G,"batchingColorTexture",Ee._colorsTexture,ve));const Ei=Pe.morphAttributes;if((Ei.position!==void 0||Ei.normal!==void 0||Ei.color!==void 0)&&ct.update(Ee,Pe,Kn),(pn||Rt.receiveShadow!==Ee.receiveShadow)&&(Rt.receiveShadow=Ee.receiveShadow,gn.setValue(G,"receiveShadow",Ee.receiveShadow)),Re.isMeshGouraudMaterial&&Re.envMap!==null&&(ji.envMap.value=dt,ji.flipEnvMap.value=dt.isCubeTexture&&dt.isRenderTargetTexture===!1?-1:1),Re.isMeshStandardMaterial&&Re.envMap===null&&_e.environment!==null&&(ji.envMapIntensity.value=_e.environmentIntensity),ji.dfgLUT!==void 0&&(ji.dfgLUT.value=qee()),pn&&(gn.setValue(G,"toneMappingExposure",N.toneMappingExposure),Rt.needsLights&&Ue(ji,es),Ze&&Re.fog===!0&&Ke.refreshFogUniforms(ji,Ze),Ke.refreshMaterialUniforms(ji,Re,se,J,S.state.transmissionRenderTarget[Z.id]),kv.upload(G,Ja(Rt),ji,ve)),Re.isShaderMaterial&&Re.uniformsNeedUpdate===!0&&(kv.upload(G,Ja(Rt),ji,ve),Re.uniformsNeedUpdate=!1),Re.isSpriteMaterial&&gn.setValue(G,"center",Ee.center),gn.setValue(G,"modelViewMatrix",Ee.modelViewMatrix),gn.setValue(G,"normalMatrix",Ee.normalMatrix),gn.setValue(G,"modelMatrix",Ee.matrixWorld),Re.isShaderMaterial||Re.isRawShaderMaterial){const Hi=Re.uniformsGroups;for(let nr=0,Es=Hi.length;nr<Es;nr++){const Zs=Hi[nr];tt.update(Zs,Kn),tt.bind(Zs,Kn)}}return Kn}function Ue(Z,_e){Z.ambientLightColor.needsUpdate=_e,Z.lightProbe.needsUpdate=_e,Z.directionalLights.needsUpdate=_e,Z.directionalLightShadows.needsUpdate=_e,Z.pointLights.needsUpdate=_e,Z.pointLightShadows.needsUpdate=_e,Z.spotLights.needsUpdate=_e,Z.spotLightShadows.needsUpdate=_e,Z.rectAreaLights.needsUpdate=_e,Z.hemisphereLights.needsUpdate=_e}function Xe(Z){return Z.isMeshLambertMaterial||Z.isMeshToonMaterial||Z.isMeshPhongMaterial||Z.isMeshStandardMaterial||Z.isShadowMaterial||Z.isShaderMaterial&&Z.lights===!0}this.getActiveCubeFace=function(){return F},this.getActiveMipmapLevel=function(){return P},this.getRenderTarget=function(){return L},this.setRenderTargetTextures=function(Z,_e,Pe){const Re=we.get(Z);Re.__autoAllocateDepthBuffer=Z.resolveDepthBuffer===!1,Re.__autoAllocateDepthBuffer===!1&&(Re.__useRenderToTexture=!1),we.get(Z.texture).__webglTexture=_e,we.get(Z.depthTexture).__webglTexture=Re.__autoAllocateDepthBuffer?void 0:Pe,Re.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(Z,_e){const Pe=we.get(Z);Pe.__webglFramebuffer=_e,Pe.__useDefaultFramebuffer=_e===void 0};const qe=G.createFramebuffer();this.setRenderTarget=function(Z,_e=0,Pe=0){L=Z,F=_e,P=Pe;let Re=!0,Ee=null,Ze=!1,ot=!1;if(Z){const dt=we.get(Z);if(dt.__useDefaultFramebuffer!==void 0)ae.bindFramebuffer(G.FRAMEBUFFER,null),Re=!1;else if(dt.__webglFramebuffer===void 0)ve.setupRenderTarget(Z);else if(dt.__hasExternalTextures)ve.rebindTextures(Z,we.get(Z.texture).__webglTexture,we.get(Z.depthTexture).__webglTexture);else if(Z.depthBuffer){const ut=Z.depthTexture;if(dt.__boundDepthTexture!==ut){if(ut!==null&&we.has(ut)&&(Z.width!==ut.image.width||Z.height!==ut.image.height))throw new Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");ve.setupDepthRenderbuffer(Z)}}const Et=Z.texture;(Et.isData3DTexture||Et.isDataArrayTexture||Et.isCompressedArrayTexture)&&(ot=!0);const xt=we.get(Z).__webglFramebuffer;Z.isWebGLCubeRenderTarget?(Array.isArray(xt[_e])?Ee=xt[_e][Pe]:Ee=xt[_e],Ze=!0):Z.samples>0&&ve.useMultisampledRTT(Z)===!1?Ee=we.get(Z).__webglMultisampledFramebuffer:Array.isArray(xt)?Ee=xt[Pe]:Ee=xt,$.copy(Z.viewport),I.copy(Z.scissor),W=Z.scissorTest}else $.copy(re).multiplyScalar(se).floor(),I.copy(ce).multiplyScalar(se).floor(),W=ye;if(Pe!==0&&(Ee=qe),ae.bindFramebuffer(G.FRAMEBUFFER,Ee)&&Re&&ae.drawBuffers(Z,Ee),ae.viewport($),ae.scissor(I),ae.setScissorTest(W),Ze){const dt=we.get(Z.texture);G.framebufferTexture2D(G.FRAMEBUFFER,G.COLOR_ATTACHMENT0,G.TEXTURE_CUBE_MAP_POSITIVE_X+_e,dt.__webglTexture,Pe)}else if(ot){const dt=_e;for(let Et=0;Et<Z.textures.length;Et++){const xt=we.get(Z.textures[Et]);G.framebufferTextureLayer(G.FRAMEBUFFER,G.COLOR_ATTACHMENT0+Et,xt.__webglTexture,Pe,dt)}}else if(Z!==null&&Pe!==0){const dt=we.get(Z.texture);G.framebufferTexture2D(G.FRAMEBUFFER,G.COLOR_ATTACHMENT0,G.TEXTURE_2D,dt.__webglTexture,Pe)}B=-1},this.readRenderTargetPixels=function(Z,_e,Pe,Re,Ee,Ze,ot,ft=0){if(!(Z&&Z.isWebGLRenderTarget)){ai("WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let dt=we.get(Z).__webglFramebuffer;if(Z.isWebGLCubeRenderTarget&&ot!==void 0&&(dt=dt[ot]),dt){ae.bindFramebuffer(G.FRAMEBUFFER,dt);try{const Et=Z.textures[ft],xt=Et.format,ut=Et.type;if(!ee.textureFormatReadable(xt)){ai("WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!ee.textureTypeReadable(ut)){ai("WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}_e>=0&&_e<=Z.width-Re&&Pe>=0&&Pe<=Z.height-Ee&&(Z.textures.length>1&&G.readBuffer(G.COLOR_ATTACHMENT0+ft),G.readPixels(_e,Pe,Re,Ee,st.convert(xt),st.convert(ut),Ze))}finally{const Et=L!==null?we.get(L).__webglFramebuffer:null;ae.bindFramebuffer(G.FRAMEBUFFER,Et)}}},this.readRenderTargetPixelsAsync=async function(Z,_e,Pe,Re,Ee,Ze,ot,ft=0){if(!(Z&&Z.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let dt=we.get(Z).__webglFramebuffer;if(Z.isWebGLCubeRenderTarget&&ot!==void 0&&(dt=dt[ot]),dt)if(_e>=0&&_e<=Z.width-Re&&Pe>=0&&Pe<=Z.height-Ee){ae.bindFramebuffer(G.FRAMEBUFFER,dt);const Et=Z.textures[ft],xt=Et.format,ut=Et.type;if(!ee.textureFormatReadable(xt))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!ee.textureTypeReadable(ut))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");const Lt=G.createBuffer();G.bindBuffer(G.PIXEL_PACK_BUFFER,Lt),G.bufferData(G.PIXEL_PACK_BUFFER,Ze.byteLength,G.STREAM_READ),Z.textures.length>1&&G.readBuffer(G.COLOR_ATTACHMENT0+ft),G.readPixels(_e,Pe,Re,Ee,st.convert(xt),st.convert(ut),0);const Pt=L!==null?we.get(L).__webglFramebuffer:null;ae.bindFramebuffer(G.FRAMEBUFFER,Pt);const Ht=G.fenceSync(G.SYNC_GPU_COMMANDS_COMPLETE,0);return G.flush(),await bY(G,Ht,4),G.bindBuffer(G.PIXEL_PACK_BUFFER,Lt),G.getBufferSubData(G.PIXEL_PACK_BUFFER,0,Ze),G.deleteBuffer(Lt),G.deleteSync(Ht),Ze}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(Z,_e=null,Pe=0){const Re=Math.pow(2,-Pe),Ee=Math.floor(Z.image.width*Re),Ze=Math.floor(Z.image.height*Re),ot=_e!==null?_e.x:0,ft=_e!==null?_e.y:0;ve.setTexture2D(Z,0),G.copyTexSubImage2D(G.TEXTURE_2D,Pe,0,0,ot,ft,Ee,Ze),ae.unbindTexture()};const We=G.createFramebuffer(),gt=G.createFramebuffer();this.copyTextureToTexture=function(Z,_e,Pe=null,Re=null,Ee=0,Ze=null){Ze===null&&(Ee!==0?(Gp("WebGLRenderer: copyTextureToTexture function signature has changed to support src and dst mipmap levels."),Ze=Ee,Ee=0):Ze=0);let ot,ft,dt,Et,xt,ut,Lt,Pt,Ht;const qt=Z.isCompressedTexture?Z.mipmaps[Ze]:Z.image;if(Pe!==null)ot=Pe.max.x-Pe.min.x,ft=Pe.max.y-Pe.min.y,dt=Pe.isBox3?Pe.max.z-Pe.min.z:1,Et=Pe.min.x,xt=Pe.min.y,ut=Pe.isBox3?Pe.min.z:0;else{const Ei=Math.pow(2,-Ee);ot=Math.floor(qt.width*Ei),ft=Math.floor(qt.height*Ei),Z.isDataArrayTexture?dt=qt.depth:Z.isData3DTexture?dt=Math.floor(qt.depth*Ei):dt=1,Et=0,xt=0,ut=0}Re!==null?(Lt=Re.x,Pt=Re.y,Ht=Re.z):(Lt=0,Pt=0,Ht=0);const Jt=st.convert(_e.format),Rt=st.convert(_e.type);let kt;_e.isData3DTexture?(ve.setTexture3D(_e,0),kt=G.TEXTURE_3D):_e.isDataArrayTexture||_e.isCompressedArrayTexture?(ve.setTexture2DArray(_e,0),kt=G.TEXTURE_2D_ARRAY):(ve.setTexture2D(_e,0),kt=G.TEXTURE_2D),G.pixelStorei(G.UNPACK_FLIP_Y_WEBGL,_e.flipY),G.pixelStorei(G.UNPACK_PREMULTIPLY_ALPHA_WEBGL,_e.premultiplyAlpha),G.pixelStorei(G.UNPACK_ALIGNMENT,_e.unpackAlignment);const zt=G.getParameter(G.UNPACK_ROW_LENGTH),Kn=G.getParameter(G.UNPACK_IMAGE_HEIGHT),ti=G.getParameter(G.UNPACK_SKIP_PIXELS),pn=G.getParameter(G.UNPACK_SKIP_ROWS),es=G.getParameter(G.UNPACK_SKIP_IMAGES);G.pixelStorei(G.UNPACK_ROW_LENGTH,qt.width),G.pixelStorei(G.UNPACK_IMAGE_HEIGHT,qt.height),G.pixelStorei(G.UNPACK_SKIP_PIXELS,Et),G.pixelStorei(G.UNPACK_SKIP_ROWS,xt),G.pixelStorei(G.UNPACK_SKIP_IMAGES,ut);const gn=Z.isDataArrayTexture||Z.isData3DTexture,ji=_e.isDataArrayTexture||_e.isData3DTexture;if(Z.isDepthTexture){const Ei=we.get(Z),Hi=we.get(_e),nr=we.get(Ei.__renderTarget),Es=we.get(Hi.__renderTarget);ae.bindFramebuffer(G.READ_FRAMEBUFFER,nr.__webglFramebuffer),ae.bindFramebuffer(G.DRAW_FRAMEBUFFER,Es.__webglFramebuffer);for(let Zs=0;Zs<dt;Zs++)gn&&(G.framebufferTextureLayer(G.READ_FRAMEBUFFER,G.COLOR_ATTACHMENT0,we.get(Z).__webglTexture,Ee,ut+Zs),G.framebufferTextureLayer(G.DRAW_FRAMEBUFFER,G.COLOR_ATTACHMENT0,we.get(_e).__webglTexture,Ze,Ht+Zs)),G.blitFramebuffer(Et,xt,ot,ft,Lt,Pt,ot,ft,G.DEPTH_BUFFER_BIT,G.NEAREST);ae.bindFramebuffer(G.READ_FRAMEBUFFER,null),ae.bindFramebuffer(G.DRAW_FRAMEBUFFER,null)}else if(Ee!==0||Z.isRenderTargetTexture||we.has(Z)){const Ei=we.get(Z),Hi=we.get(_e);ae.bindFramebuffer(G.READ_FRAMEBUFFER,We),ae.bindFramebuffer(G.DRAW_FRAMEBUFFER,gt);for(let nr=0;nr<dt;nr++)gn?G.framebufferTextureLayer(G.READ_FRAMEBUFFER,G.COLOR_ATTACHMENT0,Ei.__webglTexture,Ee,ut+nr):G.framebufferTexture2D(G.READ_FRAMEBUFFER,G.COLOR_ATTACHMENT0,G.TEXTURE_2D,Ei.__webglTexture,Ee),ji?G.framebufferTextureLayer(G.DRAW_FRAMEBUFFER,G.COLOR_ATTACHMENT0,Hi.__webglTexture,Ze,Ht+nr):G.framebufferTexture2D(G.DRAW_FRAMEBUFFER,G.COLOR_ATTACHMENT0,G.TEXTURE_2D,Hi.__webglTexture,Ze),Ee!==0?G.blitFramebuffer(Et,xt,ot,ft,Lt,Pt,ot,ft,G.COLOR_BUFFER_BIT,G.NEAREST):ji?G.copyTexSubImage3D(kt,Ze,Lt,Pt,Ht+nr,Et,xt,ot,ft):G.copyTexSubImage2D(kt,Ze,Lt,Pt,Et,xt,ot,ft);ae.bindFramebuffer(G.READ_FRAMEBUFFER,null),ae.bindFramebuffer(G.DRAW_FRAMEBUFFER,null)}else ji?Z.isDataTexture||Z.isData3DTexture?G.texSubImage3D(kt,Ze,Lt,Pt,Ht,ot,ft,dt,Jt,Rt,qt.data):_e.isCompressedArrayTexture?G.compressedTexSubImage3D(kt,Ze,Lt,Pt,Ht,ot,ft,dt,Jt,qt.data):G.texSubImage3D(kt,Ze,Lt,Pt,Ht,ot,ft,dt,Jt,Rt,qt):Z.isDataTexture?G.texSubImage2D(G.TEXTURE_2D,Ze,Lt,Pt,ot,ft,Jt,Rt,qt.data):Z.isCompressedTexture?G.compressedTexSubImage2D(G.TEXTURE_2D,Ze,Lt,Pt,qt.width,qt.height,Jt,qt.data):G.texSubImage2D(G.TEXTURE_2D,Ze,Lt,Pt,ot,ft,Jt,Rt,qt);G.pixelStorei(G.UNPACK_ROW_LENGTH,zt),G.pixelStorei(G.UNPACK_IMAGE_HEIGHT,Kn),G.pixelStorei(G.UNPACK_SKIP_PIXELS,ti),G.pixelStorei(G.UNPACK_SKIP_ROWS,pn),G.pixelStorei(G.UNPACK_SKIP_IMAGES,es),Ze===0&&_e.generateMipmaps&&G.generateMipmap(kt),ae.unbindTexture()},this.initRenderTarget=function(Z){we.get(Z).__webglFramebuffer===void 0&&ve.setupRenderTarget(Z)},this.initTexture=function(Z){Z.isCubeTexture?ve.setTextureCube(Z,0):Z.isData3DTexture?ve.setTexture3D(Z,0):Z.isDataArrayTexture||Z.isCompressedArrayTexture?ve.setTexture2DArray(Z,0):ve.setTexture2D(Z,0),ae.unbindTexture()},this.resetState=function(){F=0,P=0,L=null,ae.reset(),ue.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return Is}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const n=this.getContext();n.drawingBufferColorSpace=un._getDrawingBufferColorSpace(e),n.unpackColorSpace=un._getUnpackColorSpace()}};const gO={type:"change"},NT={type:"start"},wB={type:"end"},D0=new TT,vO=new Vl,Kee=Math.cos(70*SY.DEG2RAD),Ai=new Ve,Wr=2*Math.PI,Tn={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6},s1=1e-6;class Zee extends lK{constructor(e,n=null){super(e,n),this.state=Tn.NONE,this.target=new Ve,this.cursor=new Ve,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minTargetRadius=0,this.maxTargetRadius=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.keyRotateSpeed=1,this.enablePan=!0,this.panSpeed=1,this.screenSpacePanning=!0,this.keyPanSpeed=7,this.zoomToCursor=!1,this.autoRotate=!1,this.autoRotateSpeed=2,this.keys={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"},this.mouseButtons={LEFT:sf.ROTATE,MIDDLE:sf.DOLLY,RIGHT:sf.PAN},this.touches={ONE:ef.ROTATE,TWO:ef.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this._domElementKeyEvents=null,this._lastPosition=new Ve,this._lastQuaternion=new _u,this._lastTargetPosition=new Ve,this._quat=new _u().setFromUnitVectors(e.up,new Ve(0,1,0)),this._quatInverse=this._quat.clone().invert(),this._spherical=new $N,this._sphericalDelta=new $N,this._scale=1,this._panOffset=new Ve,this._rotateStart=new $t,this._rotateEnd=new $t,this._rotateDelta=new $t,this._panStart=new $t,this._panEnd=new $t,this._panDelta=new $t,this._dollyStart=new $t,this._dollyEnd=new $t,this._dollyDelta=new $t,this._dollyDirection=new Ve,this._mouse=new $t,this._performCursorZoom=!1,this._pointers=[],this._pointerPositions={},this._controlActive=!1,this._onPointerMove=Jee.bind(this),this._onPointerDown=Qee.bind(this),this._onPointerUp=ete.bind(this),this._onContextMenu=ote.bind(this),this._onMouseWheel=ite.bind(this),this._onKeyDown=rte.bind(this),this._onTouchStart=ate.bind(this),this._onTouchMove=ste.bind(this),this._onMouseDown=tte.bind(this),this._onMouseMove=nte.bind(this),this._interceptControlDown=lte.bind(this),this._interceptControlUp=cte.bind(this),this.domElement!==null&&this.connect(this.domElement),this.update()}connect(e){super.connect(e),this.domElement.addEventListener("pointerdown",this._onPointerDown),this.domElement.addEventListener("pointercancel",this._onPointerUp),this.domElement.addEventListener("contextmenu",this._onContextMenu),this.domElement.addEventListener("wheel",this._onMouseWheel,{passive:!1}),this.domElement.getRootNode().addEventListener("keydown",this._interceptControlDown,{passive:!0,capture:!0}),this.domElement.style.touchAction="none"}disconnect(){this.domElement.removeEventListener("pointerdown",this._onPointerDown),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.domElement.removeEventListener("pointerup",this._onPointerUp),this.domElement.removeEventListener("pointercancel",this._onPointerUp),this.domElement.removeEventListener("wheel",this._onMouseWheel),this.domElement.removeEventListener("contextmenu",this._onContextMenu),this.stopListenToKeyEvents(),this.domElement.getRootNode().removeEventListener("keydown",this._interceptControlDown,{capture:!0}),this.domElement.style.touchAction="auto"}dispose(){this.disconnect()}getPolarAngle(){return this._spherical.phi}getAzimuthalAngle(){return this._spherical.theta}getDistance(){return this.object.position.distanceTo(this.target)}listenToKeyEvents(e){e.addEventListener("keydown",this._onKeyDown),this._domElementKeyEvents=e}stopListenToKeyEvents(){this._domElementKeyEvents!==null&&(this._domElementKeyEvents.removeEventListener("keydown",this._onKeyDown),this._domElementKeyEvents=null)}saveState(){this.target0.copy(this.target),this.position0.copy(this.object.position),this.zoom0=this.object.zoom}reset(){this.target.copy(this.target0),this.object.position.copy(this.position0),this.object.zoom=this.zoom0,this.object.updateProjectionMatrix(),this.dispatchEvent(gO),this.update(),this.state=Tn.NONE}update(e=null){const n=this.object.position;Ai.copy(n).sub(this.target),Ai.applyQuaternion(this._quat),this._spherical.setFromVector3(Ai),this.autoRotate&&this.state===Tn.NONE&&this._rotateLeft(this._getAutoRotationAngle(e)),this.enableDamping?(this._spherical.theta+=this._sphericalDelta.theta*this.dampingFactor,this._spherical.phi+=this._sphericalDelta.phi*this.dampingFactor):(this._spherical.theta+=this._sphericalDelta.theta,this._spherical.phi+=this._sphericalDelta.phi);let i=this.minAzimuthAngle,r=this.maxAzimuthAngle;isFinite(i)&&isFinite(r)&&(i<-Math.PI?i+=Wr:i>Math.PI&&(i-=Wr),r<-Math.PI?r+=Wr:r>Math.PI&&(r-=Wr),i<=r?this._spherical.theta=Math.max(i,Math.min(r,this._spherical.theta)):this._spherical.theta=this._spherical.theta>(i+r)/2?Math.max(i,this._spherical.theta):Math.min(r,this._spherical.theta)),this._spherical.phi=Math.max(this.minPolarAngle,Math.min(this.maxPolarAngle,this._spherical.phi)),this._spherical.makeSafe(),this.enableDamping===!0?this.target.addScaledVector(this._panOffset,this.dampingFactor):this.target.add(this._panOffset),this.target.sub(this.cursor),this.target.clampLength(this.minTargetRadius,this.maxTargetRadius),this.target.add(this.cursor);let a=!1;if(this.zoomToCursor&&this._performCursorZoom||this.object.isOrthographicCamera)this._spherical.radius=this._clampDistance(this._spherical.radius);else{const s=this._spherical.radius;this._spherical.radius=this._clampDistance(this._spherical.radius*this._scale),a=s!=this._spherical.radius}if(Ai.setFromSpherical(this._spherical),Ai.applyQuaternion(this._quatInverse),n.copy(this.target).add(Ai),this.object.lookAt(this.target),this.enableDamping===!0?(this._sphericalDelta.theta*=1-this.dampingFactor,this._sphericalDelta.phi*=1-this.dampingFactor,this._panOffset.multiplyScalar(1-this.dampingFactor)):(this._sphericalDelta.set(0,0,0),this._panOffset.set(0,0,0)),this.zoomToCursor&&this._performCursorZoom){let s=null;if(this.object.isPerspectiveCamera){const l=Ai.length();s=this._clampDistance(l*this._scale);const c=l-s;this.object.position.addScaledVector(this._dollyDirection,c),this.object.updateMatrixWorld(),a=!!c}else if(this.object.isOrthographicCamera){const l=new Ve(this._mouse.x,this._mouse.y,0);l.unproject(this.object);const c=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),this.object.updateProjectionMatrix(),a=c!==this.object.zoom;const d=new Ve(this._mouse.x,this._mouse.y,0);d.unproject(this.object),this.object.position.sub(d).add(l),this.object.updateMatrixWorld(),s=Ai.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),this.zoomToCursor=!1;s!==null&&(this.screenSpacePanning?this.target.set(0,0,-1).transformDirection(this.object.matrix).multiplyScalar(s).add(this.object.position):(D0.origin.copy(this.object.position),D0.direction.set(0,0,-1).transformDirection(this.object.matrix),Math.abs(this.object.up.dot(D0.direction))<Kee?this.object.lookAt(this.target):(vO.setFromNormalAndCoplanarPoint(this.object.up,this.target),D0.intersectPlane(vO,this.target))))}else if(this.object.isOrthographicCamera){const s=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),s!==this.object.zoom&&(this.object.updateProjectionMatrix(),a=!0)}return this._scale=1,this._performCursorZoom=!1,a||this._lastPosition.distanceToSquared(this.object.position)>s1||8*(1-this._lastQuaternion.dot(this.object.quaternion))>s1||this._lastTargetPosition.distanceToSquared(this.target)>s1?(this.dispatchEvent(gO),this._lastPosition.copy(this.object.position),this._lastQuaternion.copy(this.object.quaternion),this._lastTargetPosition.copy(this.target),!0):!1}_getAutoRotationAngle(e){return e!==null?Wr/60*this.autoRotateSpeed*e:Wr/60/60*this.autoRotateSpeed}_getZoomScale(e){const n=Math.abs(e*.01);return Math.pow(.95,this.zoomSpeed*n)}_rotateLeft(e){this._sphericalDelta.theta-=e}_rotateUp(e){this._sphericalDelta.phi-=e}_panLeft(e,n){Ai.setFromMatrixColumn(n,0),Ai.multiplyScalar(-e),this._panOffset.add(Ai)}_panUp(e,n){this.screenSpacePanning===!0?Ai.setFromMatrixColumn(n,1):(Ai.setFromMatrixColumn(n,0),Ai.crossVectors(this.object.up,Ai)),Ai.multiplyScalar(e),this._panOffset.add(Ai)}_pan(e,n){const i=this.domElement;if(this.object.isPerspectiveCamera){const r=this.object.position;Ai.copy(r).sub(this.target);let a=Ai.length();a*=Math.tan(this.object.fov/2*Math.PI/180),this._panLeft(2*e*a/i.clientHeight,this.object.matrix),this._panUp(2*n*a/i.clientHeight,this.object.matrix)}else this.object.isOrthographicCamera?(this._panLeft(e*(this.object.right-this.object.left)/this.object.zoom/i.clientWidth,this.object.matrix),this._panUp(n*(this.object.top-this.object.bottom)/this.object.zoom/i.clientHeight,this.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),this.enablePan=!1)}_dollyOut(e){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale/=e:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}_dollyIn(e){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale*=e:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}_updateZoomParameters(e,n){if(!this.zoomToCursor)return;this._performCursorZoom=!0;const i=this.domElement.getBoundingClientRect(),r=e-i.left,a=n-i.top,s=i.width,l=i.height;this._mouse.x=r/s*2-1,this._mouse.y=-(a/l)*2+1,this._dollyDirection.set(this._mouse.x,this._mouse.y,1).unproject(this.object).sub(this.object.position).normalize()}_clampDistance(e){return Math.max(this.minDistance,Math.min(this.maxDistance,e))}_handleMouseDownRotate(e){this._rotateStart.set(e.clientX,e.clientY)}_handleMouseDownDolly(e){this._updateZoomParameters(e.clientX,e.clientX),this._dollyStart.set(e.clientX,e.clientY)}_handleMouseDownPan(e){this._panStart.set(e.clientX,e.clientY)}_handleMouseMoveRotate(e){this._rotateEnd.set(e.clientX,e.clientY),this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);const n=this.domElement;this._rotateLeft(Wr*this._rotateDelta.x/n.clientHeight),this._rotateUp(Wr*this._rotateDelta.y/n.clientHeight),this._rotateStart.copy(this._rotateEnd),this.update()}_handleMouseMoveDolly(e){this._dollyEnd.set(e.clientX,e.clientY),this._dollyDelta.subVectors(this._dollyEnd,this._dollyStart),this._dollyDelta.y>0?this._dollyOut(this._getZoomScale(this._dollyDelta.y)):this._dollyDelta.y<0&&this._dollyIn(this._getZoomScale(this._dollyDelta.y)),this._dollyStart.copy(this._dollyEnd),this.update()}_handleMouseMovePan(e){this._panEnd.set(e.clientX,e.clientY),this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd),this.update()}_handleMouseWheel(e){this._updateZoomParameters(e.clientX,e.clientY),e.deltaY<0?this._dollyIn(this._getZoomScale(e.deltaY)):e.deltaY>0&&this._dollyOut(this._getZoomScale(e.deltaY)),this.update()}_handleKeyDown(e){let n=!1;switch(e.code){case this.keys.UP:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateUp(Wr*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,this.keyPanSpeed),n=!0;break;case this.keys.BOTTOM:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateUp(-Wr*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,-this.keyPanSpeed),n=!0;break;case this.keys.LEFT:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateLeft(Wr*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(this.keyPanSpeed,0),n=!0;break;case this.keys.RIGHT:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateLeft(-Wr*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(-this.keyPanSpeed,0),n=!0;break}n&&(e.preventDefault(),this.update())}_handleTouchStartRotate(e){if(this._pointers.length===1)this._rotateStart.set(e.pageX,e.pageY);else{const n=this._getSecondPointerPosition(e),i=.5*(e.pageX+n.x),r=.5*(e.pageY+n.y);this._rotateStart.set(i,r)}}_handleTouchStartPan(e){if(this._pointers.length===1)this._panStart.set(e.pageX,e.pageY);else{const n=this._getSecondPointerPosition(e),i=.5*(e.pageX+n.x),r=.5*(e.pageY+n.y);this._panStart.set(i,r)}}_handleTouchStartDolly(e){const n=this._getSecondPointerPosition(e),i=e.pageX-n.x,r=e.pageY-n.y,a=Math.sqrt(i*i+r*r);this._dollyStart.set(0,a)}_handleTouchStartDollyPan(e){this.enableZoom&&this._handleTouchStartDolly(e),this.enablePan&&this._handleTouchStartPan(e)}_handleTouchStartDollyRotate(e){this.enableZoom&&this._handleTouchStartDolly(e),this.enableRotate&&this._handleTouchStartRotate(e)}_handleTouchMoveRotate(e){if(this._pointers.length==1)this._rotateEnd.set(e.pageX,e.pageY);else{const i=this._getSecondPointerPosition(e),r=.5*(e.pageX+i.x),a=.5*(e.pageY+i.y);this._rotateEnd.set(r,a)}this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);const n=this.domElement;this._rotateLeft(Wr*this._rotateDelta.x/n.clientHeight),this._rotateUp(Wr*this._rotateDelta.y/n.clientHeight),this._rotateStart.copy(this._rotateEnd)}_handleTouchMovePan(e){if(this._pointers.length===1)this._panEnd.set(e.pageX,e.pageY);else{const n=this._getSecondPointerPosition(e),i=.5*(e.pageX+n.x),r=.5*(e.pageY+n.y);this._panEnd.set(i,r)}this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd)}_handleTouchMoveDolly(e){const n=this._getSecondPointerPosition(e),i=e.pageX-n.x,r=e.pageY-n.y,a=Math.sqrt(i*i+r*r);this._dollyEnd.set(0,a),this._dollyDelta.set(0,Math.pow(this._dollyEnd.y/this._dollyStart.y,this.zoomSpeed)),this._dollyOut(this._dollyDelta.y),this._dollyStart.copy(this._dollyEnd);const s=(e.pageX+n.x)*.5,l=(e.pageY+n.y)*.5;this._updateZoomParameters(s,l)}_handleTouchMoveDollyPan(e){this.enableZoom&&this._handleTouchMoveDolly(e),this.enablePan&&this._handleTouchMovePan(e)}_handleTouchMoveDollyRotate(e){this.enableZoom&&this._handleTouchMoveDolly(e),this.enableRotate&&this._handleTouchMoveRotate(e)}_addPointer(e){this._pointers.push(e.pointerId)}_removePointer(e){delete this._pointerPositions[e.pointerId];for(let n=0;n<this._pointers.length;n++)if(this._pointers[n]==e.pointerId){this._pointers.splice(n,1);return}}_isTrackingPointer(e){for(let n=0;n<this._pointers.length;n++)if(this._pointers[n]==e.pointerId)return!0;return!1}_trackPointer(e){let n=this._pointerPositions[e.pointerId];n===void 0&&(n=new $t,this._pointerPositions[e.pointerId]=n),n.set(e.pageX,e.pageY)}_getSecondPointerPosition(e){const n=e.pointerId===this._pointers[0]?this._pointers[1]:this._pointers[0];return this._pointerPositions[n]}_customWheelEvent(e){const n=e.deltaMode,i={clientX:e.clientX,clientY:e.clientY,deltaY:e.deltaY};switch(n){case 1:i.deltaY*=16;break;case 2:i.deltaY*=100;break}return e.ctrlKey&&!this._controlActive&&(i.deltaY*=10),i}}function Qee(t){this.enabled!==!1&&(this._pointers.length===0&&(this.domElement.setPointerCapture(t.pointerId),this.domElement.addEventListener("pointermove",this._onPointerMove),this.domElement.addEventListener("pointerup",this._onPointerUp)),!this._isTrackingPointer(t)&&(this._addPointer(t),t.pointerType==="touch"?this._onTouchStart(t):this._onMouseDown(t)))}function Jee(t){this.enabled!==!1&&(t.pointerType==="touch"?this._onTouchMove(t):this._onMouseMove(t))}function ete(t){switch(this._removePointer(t),this._pointers.length){case 0:this.domElement.releasePointerCapture(t.pointerId),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.domElement.removeEventListener("pointerup",this._onPointerUp),this.dispatchEvent(wB),this.state=Tn.NONE;break;case 1:const e=this._pointers[0],n=this._pointerPositions[e];this._onTouchStart({pointerId:e,pageX:n.x,pageY:n.y});break}}function tte(t){let e;switch(t.button){case 0:e=this.mouseButtons.LEFT;break;case 1:e=this.mouseButtons.MIDDLE;break;case 2:e=this.mouseButtons.RIGHT;break;default:e=-1}switch(e){case sf.DOLLY:if(this.enableZoom===!1)return;this._handleMouseDownDolly(t),this.state=Tn.DOLLY;break;case sf.ROTATE:if(t.ctrlKey||t.metaKey||t.shiftKey){if(this.enablePan===!1)return;this._handleMouseDownPan(t),this.state=Tn.PAN}else{if(this.enableRotate===!1)return;this._handleMouseDownRotate(t),this.state=Tn.ROTATE}break;case sf.PAN:if(t.ctrlKey||t.metaKey||t.shiftKey){if(this.enableRotate===!1)return;this._handleMouseDownRotate(t),this.state=Tn.ROTATE}else{if(this.enablePan===!1)return;this._handleMouseDownPan(t),this.state=Tn.PAN}break;default:this.state=Tn.NONE}this.state!==Tn.NONE&&this.dispatchEvent(NT)}function nte(t){switch(this.state){case Tn.ROTATE:if(this.enableRotate===!1)return;this._handleMouseMoveRotate(t);break;case Tn.DOLLY:if(this.enableZoom===!1)return;this._handleMouseMoveDolly(t);break;case Tn.PAN:if(this.enablePan===!1)return;this._handleMouseMovePan(t);break}}function ite(t){this.enabled===!1||this.enableZoom===!1||this.state!==Tn.NONE||(t.preventDefault(),this.dispatchEvent(NT),this._handleMouseWheel(this._customWheelEvent(t)),this.dispatchEvent(wB))}function rte(t){this.enabled!==!1&&this._handleKeyDown(t)}function ate(t){switch(this._trackPointer(t),this._pointers.length){case 1:switch(this.touches.ONE){case ef.ROTATE:if(this.enableRotate===!1)return;this._handleTouchStartRotate(t),this.state=Tn.TOUCH_ROTATE;break;case ef.PAN:if(this.enablePan===!1)return;this._handleTouchStartPan(t),this.state=Tn.TOUCH_PAN;break;default:this.state=Tn.NONE}break;case 2:switch(this.touches.TWO){case ef.DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchStartDollyPan(t),this.state=Tn.TOUCH_DOLLY_PAN;break;case ef.DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchStartDollyRotate(t),this.state=Tn.TOUCH_DOLLY_ROTATE;break;default:this.state=Tn.NONE}break;default:this.state=Tn.NONE}this.state!==Tn.NONE&&this.dispatchEvent(NT)}function ste(t){switch(this._trackPointer(t),this.state){case Tn.TOUCH_ROTATE:if(this.enableRotate===!1)return;this._handleTouchMoveRotate(t),this.update();break;case Tn.TOUCH_PAN:if(this.enablePan===!1)return;this._handleTouchMovePan(t),this.update();break;case Tn.TOUCH_DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchMoveDollyPan(t),this.update();break;case Tn.TOUCH_DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchMoveDollyRotate(t),this.update();break;default:this.state=Tn.NONE}}function ote(t){this.enabled!==!1&&t.preventDefault()}function lte(t){t.key==="Control"&&(this._controlActive=!0,this.domElement.getRootNode().addEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}function cte(t){t.key==="Control"&&(this._controlActive=!1,this.domElement.getRootNode().removeEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}function ute(t,e=!1){const n=t[0].index!==null,i=new Set(Object.keys(t[0].attributes)),r=new Set(Object.keys(t[0].morphAttributes)),a={},s={},l=t[0].morphTargetsRelative,c=new Ks;let d=0;for(let f=0;f<t.length;++f){const h=t[f];let g=0;if(n!==(h.index!==null))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+f+". All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them."),null;for(const m in h.attributes){if(!i.has(m))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+f+'. All geometries must have compatible attributes; make sure "'+m+'" attribute exists among all geometries, or in none of them.'),null;a[m]===void 0&&(a[m]=[]),a[m].push(h.attributes[m]),g++}if(g!==i.size)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+f+". Make sure all geometries have the same number of attributes."),null;if(l!==h.morphTargetsRelative)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+f+". .morphTargetsRelative must be consistent throughout all geometries."),null;for(const m in h.morphAttributes){if(!r.has(m))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+f+". .morphAttributes must be consistent throughout all geometries."),null;s[m]===void 0&&(s[m]=[]),s[m].push(h.morphAttributes[m])}if(e){let m;if(n)m=h.index.count;else if(h.attributes.position!==void 0)m=h.attributes.position.count;else return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+f+". The geometry must have either an index or a position attribute"),null;c.addGroup(d,m,f),d+=m}}if(n){let f=0;const h=[];for(let g=0;g<t.length;++g){const m=t[g].index;for(let b=0;b<m.count;++b)h.push(m.getX(b)+f);f+=t[g].attributes.position.count}c.setIndex(h)}for(const f in a){const h=xO(a[f]);if(!h)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+f+" attribute."),null;c.setAttribute(f,h)}for(const f in s){const h=s[f][0].length;if(h===0)break;c.morphAttributes=c.morphAttributes||{},c.morphAttributes[f]=[];for(let g=0;g<h;++g){const m=[];for(let y=0;y<s[f].length;++y)m.push(s[f][y][g]);const b=xO(m);if(!b)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+f+" morphAttribute."),null;c.morphAttributes[f].push(b)}}return c}function xO(t){let e,n,i,r=-1,a=0;for(let d=0;d<t.length;++d){const f=t[d];if(e===void 0&&(e=f.array.constructor),e!==f.array.constructor)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.array must be of consistent array types across matching attributes."),null;if(n===void 0&&(n=f.itemSize),n!==f.itemSize)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes."),null;if(i===void 0&&(i=f.normalized),i!==f.normalized)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes."),null;if(r===-1&&(r=f.gpuType),r!==f.gpuType)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.gpuType must be consistent across matching attributes."),null;a+=f.count*n}const s=new e(a),l=new Xa(s,n,i);let c=0;for(let d=0;d<t.length;++d){const f=t[d];if(f.isInterleavedBufferAttribute){const h=c/n;for(let g=0,m=f.count;g<m;g++)for(let b=0;b<n;b++){const y=f.getComponent(g,b);l.setComponent(g+h,b,y)}}else s.set(f.array,c);c+=f.count*n}return r!==void 0&&(l.gpuType=r),l}function N0(t){throw new Error('Could not dynamically require "'+t+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var o1={exports:{}};var yO;function dte(){return yO||(yO=1,(function(t,e){(function(n){t.exports=n()})(function(){return(function n(i,r,a){function s(d,f){if(!r[d]){if(!i[d]){var h=typeof N0=="function"&&N0;if(!f&&h)return h(d,!0);if(l)return l(d,!0);var g=new Error("Cannot find module '"+d+"'");throw g.code="MODULE_NOT_FOUND",g}var m=r[d]={exports:{}};i[d][0].call(m.exports,function(b){var y=i[d][1][b];return s(y||b)},m,m.exports,n,i,r,a)}return r[d].exports}for(var l=typeof N0=="function"&&N0,c=0;c<a.length;c++)s(a[c]);return s})({1:[function(n,i,r){var a=n("./utils"),s=n("./support"),l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";r.encode=function(c){for(var d,f,h,g,m,b,y,x=[],v=0,w=c.length,S=w,A=a.getTypeOf(c)!=="string";v<c.length;)S=w-v,h=A?(d=c[v++],f=v<w?c[v++]:0,v<w?c[v++]:0):(d=c.charCodeAt(v++),f=v<w?c.charCodeAt(v++):0,v<w?c.charCodeAt(v++):0),g=d>>2,m=(3&d)<<4|f>>4,b=1<S?(15&f)<<2|h>>6:64,y=2<S?63&h:64,x.push(l.charAt(g)+l.charAt(m)+l.charAt(b)+l.charAt(y));return x.join("")},r.decode=function(c){var d,f,h,g,m,b,y=0,x=0,v="data:";if(c.substr(0,v.length)===v)throw new Error("Invalid base64 input, it looks like a data url.");var w,S=3*(c=c.replace(/[^A-Za-z0-9+/=]/g,"")).length/4;if(c.charAt(c.length-1)===l.charAt(64)&&S--,c.charAt(c.length-2)===l.charAt(64)&&S--,S%1!=0)throw new Error("Invalid base64 input, bad content length.");for(w=s.uint8array?new Uint8Array(0|S):new Array(0|S);y<c.length;)d=l.indexOf(c.charAt(y++))<<2|(g=l.indexOf(c.charAt(y++)))>>4,f=(15&g)<<4|(m=l.indexOf(c.charAt(y++)))>>2,h=(3&m)<<6|(b=l.indexOf(c.charAt(y++))),w[x++]=d,m!==64&&(w[x++]=f),b!==64&&(w[x++]=h);return w}},{"./support":30,"./utils":32}],2:[function(n,i,r){var a=n("./external"),s=n("./stream/DataWorker"),l=n("./stream/Crc32Probe"),c=n("./stream/DataLengthProbe");function d(f,h,g,m,b){this.compressedSize=f,this.uncompressedSize=h,this.crc32=g,this.compression=m,this.compressedContent=b}d.prototype={getContentWorker:function(){var f=new s(a.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new c("data_length")),h=this;return f.on("end",function(){if(this.streamInfo.data_length!==h.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),f},getCompressedWorker:function(){return new s(a.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},d.createWorkerFrom=function(f,h,g){return f.pipe(new l).pipe(new c("uncompressedSize")).pipe(h.compressWorker(g)).pipe(new c("compressedSize")).withStreamInfo("compression",h)},i.exports=d},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(n,i,r){var a=n("./stream/GenericWorker");r.STORE={magic:"\0\0",compressWorker:function(){return new a("STORE compression")},uncompressWorker:function(){return new a("STORE decompression")}},r.DEFLATE=n("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(n,i,r){var a=n("./utils"),s=(function(){for(var l,c=[],d=0;d<256;d++){l=d;for(var f=0;f<8;f++)l=1&l?3988292384^l>>>1:l>>>1;c[d]=l}return c})();i.exports=function(l,c){return l!==void 0&&l.length?a.getTypeOf(l)!=="string"?(function(d,f,h,g){var m=s,b=g+h;d^=-1;for(var y=g;y<b;y++)d=d>>>8^m[255&(d^f[y])];return-1^d})(0|c,l,l.length,0):(function(d,f,h,g){var m=s,b=g+h;d^=-1;for(var y=g;y<b;y++)d=d>>>8^m[255&(d^f.charCodeAt(y))];return-1^d})(0|c,l,l.length,0):0}},{"./utils":32}],5:[function(n,i,r){r.base64=!1,r.binary=!1,r.dir=!1,r.createFolders=!0,r.date=null,r.compression=null,r.compressionOptions=null,r.comment=null,r.unixPermissions=null,r.dosPermissions=null},{}],6:[function(n,i,r){var a=null;a=typeof Promise<"u"?Promise:n("lie"),i.exports={Promise:a}},{lie:37}],7:[function(n,i,r){var a=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",s=n("pako"),l=n("./utils"),c=n("./stream/GenericWorker"),d=a?"uint8array":"array";function f(h,g){c.call(this,"FlateWorker/"+h),this._pako=null,this._pakoAction=h,this._pakoOptions=g,this.meta={}}r.magic="\b\0",l.inherits(f,c),f.prototype.processChunk=function(h){this.meta=h.meta,this._pako===null&&this._createPako(),this._pako.push(l.transformTo(d,h.data),!1)},f.prototype.flush=function(){c.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},f.prototype.cleanUp=function(){c.prototype.cleanUp.call(this),this._pako=null},f.prototype._createPako=function(){this._pako=new s[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var h=this;this._pako.onData=function(g){h.push({data:g,meta:h.meta})}},r.compressWorker=function(h){return new f("Deflate",h)},r.uncompressWorker=function(){return new f("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(n,i,r){function a(m,b){var y,x="";for(y=0;y<b;y++)x+=String.fromCharCode(255&m),m>>>=8;return x}function s(m,b,y,x,v,w){var S,A,R=m.file,N=m.compression,C=w!==d.utf8encode,F=l.transformTo("string",w(R.name)),P=l.transformTo("string",d.utf8encode(R.name)),L=R.comment,B=l.transformTo("string",w(L)),U=l.transformTo("string",d.utf8encode(L)),$=P.length!==R.name.length,I=U.length!==L.length,W="",X="",V="",Y=R.dir,J=R.date,se={crc32:0,compressedSize:0,uncompressedSize:0};b&&!y||(se.crc32=m.crc32,se.compressedSize=m.compressedSize,se.uncompressedSize=m.uncompressedSize);var H=0;b&&(H|=8),C||!$&&!I||(H|=2048);var q=0,re=0;Y&&(q|=16),v==="UNIX"?(re=798,q|=(function(ye,me){var be=ye;return ye||(be=me?16893:33204),(65535&be)<<16})(R.unixPermissions,Y)):(re=20,q|=(function(ye){return 63&(ye||0)})(R.dosPermissions)),S=J.getUTCHours(),S<<=6,S|=J.getUTCMinutes(),S<<=5,S|=J.getUTCSeconds()/2,A=J.getUTCFullYear()-1980,A<<=4,A|=J.getUTCMonth()+1,A<<=5,A|=J.getUTCDate(),$&&(X=a(1,1)+a(f(F),4)+P,W+="up"+a(X.length,2)+X),I&&(V=a(1,1)+a(f(B),4)+U,W+="uc"+a(V.length,2)+V);var ce="";return ce+=`
  3839. \0`,ce+=a(H,2),ce+=N.magic,ce+=a(S,2),ce+=a(A,2),ce+=a(se.crc32,4),ce+=a(se.compressedSize,4),ce+=a(se.uncompressedSize,4),ce+=a(F.length,2),ce+=a(W.length,2),{fileRecord:h.LOCAL_FILE_HEADER+ce+F+W,dirRecord:h.CENTRAL_FILE_HEADER+a(re,2)+ce+a(B.length,2)+"\0\0\0\0"+a(q,4)+a(x,4)+F+W+B}}var l=n("../utils"),c=n("../stream/GenericWorker"),d=n("../utf8"),f=n("../crc32"),h=n("../signature");function g(m,b,y,x){c.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=b,this.zipPlatform=y,this.encodeFileName=x,this.streamFiles=m,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}l.inherits(g,c),g.prototype.push=function(m){var b=m.meta.percent||0,y=this.entriesCount,x=this._sources.length;this.accumulate?this.contentBuffer.push(m):(this.bytesWritten+=m.data.length,c.prototype.push.call(this,{data:m.data,meta:{currentFile:this.currentFile,percent:y?(b+100*(y-x-1))/y:100}}))},g.prototype.openedSource=function(m){this.currentSourceOffset=this.bytesWritten,this.currentFile=m.file.name;var b=this.streamFiles&&!m.file.dir;if(b){var y=s(m,b,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:y.fileRecord,meta:{percent:0}})}else this.accumulate=!0},g.prototype.closedSource=function(m){this.accumulate=!1;var b=this.streamFiles&&!m.file.dir,y=s(m,b,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(y.dirRecord),b)this.push({data:(function(x){return h.DATA_DESCRIPTOR+a(x.crc32,4)+a(x.compressedSize,4)+a(x.uncompressedSize,4)})(m),meta:{percent:100}});else for(this.push({data:y.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},g.prototype.flush=function(){for(var m=this.bytesWritten,b=0;b<this.dirRecords.length;b++)this.push({data:this.dirRecords[b],meta:{percent:100}});var y=this.bytesWritten-m,x=(function(v,w,S,A,R){var N=l.transformTo("string",R(A));return h.CENTRAL_DIRECTORY_END+"\0\0\0\0"+a(v,2)+a(v,2)+a(w,4)+a(S,4)+a(N.length,2)+N})(this.dirRecords.length,y,m,this.zipComment,this.encodeFileName);this.push({data:x,meta:{percent:100}})},g.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()},g.prototype.registerPrevious=function(m){this._sources.push(m);var b=this;return m.on("data",function(y){b.processChunk(y)}),m.on("end",function(){b.closedSource(b.previous.streamInfo),b._sources.length?b.prepareNextSource():b.end()}),m.on("error",function(y){b.error(y)}),this},g.prototype.resume=function(){return!!c.prototype.resume.call(this)&&(!this.previous&&this._sources.length?(this.prepareNextSource(),!0):this.previous||this._sources.length||this.generatedError?void 0:(this.end(),!0))},g.prototype.error=function(m){var b=this._sources;if(!c.prototype.error.call(this,m))return!1;for(var y=0;y<b.length;y++)try{b[y].error(m)}catch{}return!0},g.prototype.lock=function(){c.prototype.lock.call(this);for(var m=this._sources,b=0;b<m.length;b++)m[b].lock()},i.exports=g},{"../crc32":4,"../signature":23,"../stream/GenericWorker":28,"../utf8":31,"../utils":32}],9:[function(n,i,r){var a=n("../compressions"),s=n("./ZipFileWorker");r.generateWorker=function(l,c,d){var f=new s(c.streamFiles,d,c.platform,c.encodeFileName),h=0;try{l.forEach(function(g,m){h++;var b=(function(w,S){var A=w||S,R=a[A];if(!R)throw new Error(A+" is not a valid compression method !");return R})(m.options.compression,c.compression),y=m.options.compressionOptions||c.compressionOptions||{},x=m.dir,v=m.date;m._compressWorker(b,y).withStreamInfo("file",{name:g,dir:x,date:v,comment:m.comment||"",unixPermissions:m.unixPermissions,dosPermissions:m.dosPermissions}).pipe(f)}),f.entriesCount=h}catch(g){f.error(g)}return f}},{"../compressions":3,"./ZipFileWorker":8}],10:[function(n,i,r){function a(){if(!(this instanceof a))return new a;if(arguments.length)throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");this.files=Object.create(null),this.comment=null,this.root="",this.clone=function(){var s=new a;for(var l in this)typeof this[l]!="function"&&(s[l]=this[l]);return s}}(a.prototype=n("./object")).loadAsync=n("./load"),a.support=n("./support"),a.defaults=n("./defaults"),a.version="3.10.1",a.loadAsync=function(s,l){return new a().loadAsync(s,l)},a.external=n("./external"),i.exports=a},{"./defaults":5,"./external":6,"./load":11,"./object":15,"./support":30}],11:[function(n,i,r){var a=n("./utils"),s=n("./external"),l=n("./utf8"),c=n("./zipEntries"),d=n("./stream/Crc32Probe"),f=n("./nodejsUtils");function h(g){return new s.Promise(function(m,b){var y=g.decompressed.getContentWorker().pipe(new d);y.on("error",function(x){b(x)}).on("end",function(){y.streamInfo.crc32!==g.decompressed.crc32?b(new Error("Corrupted zip : CRC32 mismatch")):m()}).resume()})}i.exports=function(g,m){var b=this;return m=a.extend(m||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:l.utf8decode}),f.isNode&&f.isStream(g)?s.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):a.prepareContent("the loaded zip file",g,!0,m.optimizedBinaryString,m.base64).then(function(y){var x=new c(m);return x.load(y),x}).then(function(y){var x=[s.Promise.resolve(y)],v=y.files;if(m.checkCRC32)for(var w=0;w<v.length;w++)x.push(h(v[w]));return s.Promise.all(x)}).then(function(y){for(var x=y.shift(),v=x.files,w=0;w<v.length;w++){var S=v[w],A=S.fileNameStr,R=a.resolve(S.fileNameStr);b.file(R,S.decompressed,{binary:!0,optimizedBinaryString:!0,date:S.date,dir:S.dir,comment:S.fileCommentStr.length?S.fileCommentStr:null,unixPermissions:S.unixPermissions,dosPermissions:S.dosPermissions,createFolders:m.createFolders}),S.dir||(b.file(R).unsafeOriginalName=A)}return x.zipComment.length&&(b.comment=x.zipComment),b})}},{"./external":6,"./nodejsUtils":14,"./stream/Crc32Probe":25,"./utf8":31,"./utils":32,"./zipEntries":33}],12:[function(n,i,r){var a=n("../utils"),s=n("../stream/GenericWorker");function l(c,d){s.call(this,"Nodejs stream input adapter for "+c),this._upstreamEnded=!1,this._bindStream(d)}a.inherits(l,s),l.prototype._bindStream=function(c){var d=this;(this._stream=c).pause(),c.on("data",function(f){d.push({data:f,meta:{percent:0}})}).on("error",function(f){d.isPaused?this.generatedError=f:d.error(f)}).on("end",function(){d.isPaused?d._upstreamEnded=!0:d.end()})},l.prototype.pause=function(){return!!s.prototype.pause.call(this)&&(this._stream.pause(),!0)},l.prototype.resume=function(){return!!s.prototype.resume.call(this)&&(this._upstreamEnded?this.end():this._stream.resume(),!0)},i.exports=l},{"../stream/GenericWorker":28,"../utils":32}],13:[function(n,i,r){var a=n("readable-stream").Readable;function s(l,c,d){a.call(this,c),this._helper=l;var f=this;l.on("data",function(h,g){f.push(h)||f._helper.pause(),d&&d(g)}).on("error",function(h){f.emit("error",h)}).on("end",function(){f.push(null)})}n("../utils").inherits(s,a),s.prototype._read=function(){this._helper.resume()},i.exports=s},{"../utils":32,"readable-stream":16}],14:[function(n,i,r){i.exports={isNode:typeof Buffer<"u",newBufferFrom:function(a,s){if(Buffer.from&&Buffer.from!==Uint8Array.from)return Buffer.from(a,s);if(typeof a=="number")throw new Error('The "data" argument must not be a number');return new Buffer(a,s)},allocBuffer:function(a){if(Buffer.alloc)return Buffer.alloc(a);var s=new Buffer(a);return s.fill(0),s},isBuffer:function(a){return Buffer.isBuffer(a)},isStream:function(a){return a&&typeof a.on=="function"&&typeof a.pause=="function"&&typeof a.resume=="function"}}},{}],15:[function(n,i,r){function a(R,N,C){var F,P=l.getTypeOf(N),L=l.extend(C||{},f);L.date=L.date||new Date,L.compression!==null&&(L.compression=L.compression.toUpperCase()),typeof L.unixPermissions=="string"&&(L.unixPermissions=parseInt(L.unixPermissions,8)),L.unixPermissions&&16384&L.unixPermissions&&(L.dir=!0),L.dosPermissions&&16&L.dosPermissions&&(L.dir=!0),L.dir&&(R=v(R)),L.createFolders&&(F=x(R))&&w.call(this,F,!0);var B=P==="string"&&L.binary===!1&&L.base64===!1;C&&C.binary!==void 0||(L.binary=!B),(N instanceof h&&N.uncompressedSize===0||L.dir||!N||N.length===0)&&(L.base64=!1,L.binary=!0,N="",L.compression="STORE",P="string");var U=null;U=N instanceof h||N instanceof c?N:b.isNode&&b.isStream(N)?new y(R,N):l.prepareContent(R,N,L.binary,L.optimizedBinaryString,L.base64);var $=new g(R,U,L);this.files[R]=$}var s=n("./utf8"),l=n("./utils"),c=n("./stream/GenericWorker"),d=n("./stream/StreamHelper"),f=n("./defaults"),h=n("./compressedObject"),g=n("./zipObject"),m=n("./generate"),b=n("./nodejsUtils"),y=n("./nodejs/NodejsStreamInputAdapter"),x=function(R){R.slice(-1)==="/"&&(R=R.substring(0,R.length-1));var N=R.lastIndexOf("/");return 0<N?R.substring(0,N):""},v=function(R){return R.slice(-1)!=="/"&&(R+="/"),R},w=function(R,N){return N=N!==void 0?N:f.createFolders,R=v(R),this.files[R]||a.call(this,R,null,{dir:!0,createFolders:N}),this.files[R]};function S(R){return Object.prototype.toString.call(R)==="[object RegExp]"}var A={load:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(R){var N,C,F;for(N in this.files)F=this.files[N],(C=N.slice(this.root.length,N.length))&&N.slice(0,this.root.length)===this.root&&R(C,F)},filter:function(R){var N=[];return this.forEach(function(C,F){R(C,F)&&N.push(F)}),N},file:function(R,N,C){if(arguments.length!==1)return R=this.root+R,a.call(this,R,N,C),this;if(S(R)){var F=R;return this.filter(function(L,B){return!B.dir&&F.test(L)})}var P=this.files[this.root+R];return P&&!P.dir?P:null},folder:function(R){if(!R)return this;if(S(R))return this.filter(function(P,L){return L.dir&&R.test(P)});var N=this.root+R,C=w.call(this,N),F=this.clone();return F.root=C.name,F},remove:function(R){R=this.root+R;var N=this.files[R];if(N||(R.slice(-1)!=="/"&&(R+="/"),N=this.files[R]),N&&!N.dir)delete this.files[R];else for(var C=this.filter(function(P,L){return L.name.slice(0,R.length)===R}),F=0;F<C.length;F++)delete this.files[C[F].name];return this},generate:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function(R){var N,C={};try{if((C=l.extend(R||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:s.utf8encode})).type=C.type.toLowerCase(),C.compression=C.compression.toUpperCase(),C.type==="binarystring"&&(C.type="string"),!C.type)throw new Error("No output type specified.");l.checkSupport(C.type),C.platform!=="darwin"&&C.platform!=="freebsd"&&C.platform!=="linux"&&C.platform!=="sunos"||(C.platform="UNIX"),C.platform==="win32"&&(C.platform="DOS");var F=C.comment||this.comment||"";N=m.generateWorker(this,C,F)}catch(P){(N=new c("error")).error(P)}return new d(N,C.type||"string",C.mimeType)},generateAsync:function(R,N){return this.generateInternalStream(R).accumulate(N)},generateNodeStream:function(R,N){return(R=R||{}).type||(R.type="nodebuffer"),this.generateInternalStream(R).toNodejsStream(N)}};i.exports=A},{"./compressedObject":2,"./defaults":5,"./generate":9,"./nodejs/NodejsStreamInputAdapter":12,"./nodejsUtils":14,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31,"./utils":32,"./zipObject":35}],16:[function(n,i,r){i.exports=n("stream")},{stream:void 0}],17:[function(n,i,r){var a=n("./DataReader");function s(l){a.call(this,l);for(var c=0;c<this.data.length;c++)l[c]=255&l[c]}n("../utils").inherits(s,a),s.prototype.byteAt=function(l){return this.data[this.zero+l]},s.prototype.lastIndexOfSignature=function(l){for(var c=l.charCodeAt(0),d=l.charCodeAt(1),f=l.charCodeAt(2),h=l.charCodeAt(3),g=this.length-4;0<=g;--g)if(this.data[g]===c&&this.data[g+1]===d&&this.data[g+2]===f&&this.data[g+3]===h)return g-this.zero;return-1},s.prototype.readAndCheckSignature=function(l){var c=l.charCodeAt(0),d=l.charCodeAt(1),f=l.charCodeAt(2),h=l.charCodeAt(3),g=this.readData(4);return c===g[0]&&d===g[1]&&f===g[2]&&h===g[3]},s.prototype.readData=function(l){if(this.checkOffset(l),l===0)return[];var c=this.data.slice(this.zero+this.index,this.zero+this.index+l);return this.index+=l,c},i.exports=s},{"../utils":32,"./DataReader":18}],18:[function(n,i,r){var a=n("../utils");function s(l){this.data=l,this.length=l.length,this.index=0,this.zero=0}s.prototype={checkOffset:function(l){this.checkIndex(this.index+l)},checkIndex:function(l){if(this.length<this.zero+l||l<0)throw new Error("End of data reached (data length = "+this.length+", asked index = "+l+"). Corrupted zip ?")},setIndex:function(l){this.checkIndex(l),this.index=l},skip:function(l){this.setIndex(this.index+l)},byteAt:function(){},readInt:function(l){var c,d=0;for(this.checkOffset(l),c=this.index+l-1;c>=this.index;c--)d=(d<<8)+this.byteAt(c);return this.index+=l,d},readString:function(l){return a.transformTo("string",this.readData(l))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var l=this.readInt(4);return new Date(Date.UTC(1980+(l>>25&127),(l>>21&15)-1,l>>16&31,l>>11&31,l>>5&63,(31&l)<<1))}},i.exports=s},{"../utils":32}],19:[function(n,i,r){var a=n("./Uint8ArrayReader");function s(l){a.call(this,l)}n("../utils").inherits(s,a),s.prototype.readData=function(l){this.checkOffset(l);var c=this.data.slice(this.zero+this.index,this.zero+this.index+l);return this.index+=l,c},i.exports=s},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(n,i,r){var a=n("./DataReader");function s(l){a.call(this,l)}n("../utils").inherits(s,a),s.prototype.byteAt=function(l){return this.data.charCodeAt(this.zero+l)},s.prototype.lastIndexOfSignature=function(l){return this.data.lastIndexOf(l)-this.zero},s.prototype.readAndCheckSignature=function(l){return l===this.readData(4)},s.prototype.readData=function(l){this.checkOffset(l);var c=this.data.slice(this.zero+this.index,this.zero+this.index+l);return this.index+=l,c},i.exports=s},{"../utils":32,"./DataReader":18}],21:[function(n,i,r){var a=n("./ArrayReader");function s(l){a.call(this,l)}n("../utils").inherits(s,a),s.prototype.readData=function(l){if(this.checkOffset(l),l===0)return new Uint8Array(0);var c=this.data.subarray(this.zero+this.index,this.zero+this.index+l);return this.index+=l,c},i.exports=s},{"../utils":32,"./ArrayReader":17}],22:[function(n,i,r){var a=n("../utils"),s=n("../support"),l=n("./ArrayReader"),c=n("./StringReader"),d=n("./NodeBufferReader"),f=n("./Uint8ArrayReader");i.exports=function(h){var g=a.getTypeOf(h);return a.checkSupport(g),g!=="string"||s.uint8array?g==="nodebuffer"?new d(h):s.uint8array?new f(a.transformTo("uint8array",h)):new l(a.transformTo("array",h)):new c(h)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(n,i,r){r.LOCAL_FILE_HEADER="PK",r.CENTRAL_FILE_HEADER="PK",r.CENTRAL_DIRECTORY_END="PK",r.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",r.ZIP64_CENTRAL_DIRECTORY_END="PK",r.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(n,i,r){var a=n("./GenericWorker"),s=n("../utils");function l(c){a.call(this,"ConvertWorker to "+c),this.destType=c}s.inherits(l,a),l.prototype.processChunk=function(c){this.push({data:s.transformTo(this.destType,c.data),meta:c.meta})},i.exports=l},{"../utils":32,"./GenericWorker":28}],25:[function(n,i,r){var a=n("./GenericWorker"),s=n("../crc32");function l(){a.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}n("../utils").inherits(l,a),l.prototype.processChunk=function(c){this.streamInfo.crc32=s(c.data,this.streamInfo.crc32||0),this.push(c)},i.exports=l},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(n,i,r){var a=n("../utils"),s=n("./GenericWorker");function l(c){s.call(this,"DataLengthProbe for "+c),this.propName=c,this.withStreamInfo(c,0)}a.inherits(l,s),l.prototype.processChunk=function(c){if(c){var d=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=d+c.data.length}s.prototype.processChunk.call(this,c)},i.exports=l},{"../utils":32,"./GenericWorker":28}],27:[function(n,i,r){var a=n("../utils"),s=n("./GenericWorker");function l(c){s.call(this,"DataWorker");var d=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,c.then(function(f){d.dataIsReady=!0,d.data=f,d.max=f&&f.length||0,d.type=a.getTypeOf(f),d.isPaused||d._tickAndRepeat()},function(f){d.error(f)})}a.inherits(l,s),l.prototype.cleanUp=function(){s.prototype.cleanUp.call(this),this.data=null},l.prototype.resume=function(){return!!s.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,a.delay(this._tickAndRepeat,[],this)),!0)},l.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(a.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},l.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var c=null,d=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":c=this.data.substring(this.index,d);break;case"uint8array":c=this.data.subarray(this.index,d);break;case"array":case"nodebuffer":c=this.data.slice(this.index,d)}return this.index=d,this.push({data:c,meta:{percent:this.max?this.index/this.max*100:0}})},i.exports=l},{"../utils":32,"./GenericWorker":28}],28:[function(n,i,r){function a(s){this.name=s||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}a.prototype={push:function(s){this.emit("data",s)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(s){this.emit("error",s)}return!0},error:function(s){return!this.isFinished&&(this.isPaused?this.generatedError=s:(this.isFinished=!0,this.emit("error",s),this.previous&&this.previous.error(s),this.cleanUp()),!0)},on:function(s,l){return this._listeners[s].push(l),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(s,l){if(this._listeners[s])for(var c=0;c<this._listeners[s].length;c++)this._listeners[s][c].call(this,l)},pipe:function(s){return s.registerPrevious(this)},registerPrevious:function(s){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.streamInfo=s.streamInfo,this.mergeStreamInfo(),this.previous=s;var l=this;return s.on("data",function(c){l.processChunk(c)}),s.on("end",function(){l.end()}),s.on("error",function(c){l.error(c)}),this},pause:function(){return!this.isPaused&&!this.isFinished&&(this.isPaused=!0,this.previous&&this.previous.pause(),!0)},resume:function(){if(!this.isPaused||this.isFinished)return!1;var s=this.isPaused=!1;return this.generatedError&&(this.error(this.generatedError),s=!0),this.previous&&this.previous.resume(),!s},flush:function(){},processChunk:function(s){this.push(s)},withStreamInfo:function(s,l){return this.extraStreamInfo[s]=l,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var s in this.extraStreamInfo)Object.prototype.hasOwnProperty.call(this.extraStreamInfo,s)&&(this.streamInfo[s]=this.extraStreamInfo[s])},lock:function(){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.isLocked=!0,this.previous&&this.previous.lock()},toString:function(){var s="Worker "+this.name;return this.previous?this.previous+" -> "+s:s}},i.exports=a},{}],29:[function(n,i,r){var a=n("../utils"),s=n("./ConvertWorker"),l=n("./GenericWorker"),c=n("../base64"),d=n("../support"),f=n("../external"),h=null;if(d.nodestream)try{h=n("../nodejs/NodejsStreamOutputAdapter")}catch{}function g(b,y){return new f.Promise(function(x,v){var w=[],S=b._internalType,A=b._outputType,R=b._mimeType;b.on("data",function(N,C){w.push(N),y&&y(C)}).on("error",function(N){w=[],v(N)}).on("end",function(){try{var N=(function(C,F,P){switch(C){case"blob":return a.newBlob(a.transformTo("arraybuffer",F),P);case"base64":return c.encode(F);default:return a.transformTo(C,F)}})(A,(function(C,F){var P,L=0,B=null,U=0;for(P=0;P<F.length;P++)U+=F[P].length;switch(C){case"string":return F.join("");case"array":return Array.prototype.concat.apply([],F);case"uint8array":for(B=new Uint8Array(U),P=0;P<F.length;P++)B.set(F[P],L),L+=F[P].length;return B;case"nodebuffer":return Buffer.concat(F);default:throw new Error("concat : unsupported type '"+C+"'")}})(S,w),R);x(N)}catch(C){v(C)}w=[]}).resume()})}function m(b,y,x){var v=y;switch(y){case"blob":case"arraybuffer":v="uint8array";break;case"base64":v="string"}try{this._internalType=v,this._outputType=y,this._mimeType=x,a.checkSupport(v),this._worker=b.pipe(new s(v)),b.lock()}catch(w){this._worker=new l("error"),this._worker.error(w)}}m.prototype={accumulate:function(b){return g(this,b)},on:function(b,y){var x=this;return b==="data"?this._worker.on(b,function(v){y.call(x,v.data,v.meta)}):this._worker.on(b,function(){a.delay(y,arguments,x)}),this},resume:function(){return a.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(b){if(a.checkSupport("nodestream"),this._outputType!=="nodebuffer")throw new Error(this._outputType+" is not supported by this method");return new h(this,{objectMode:this._outputType!=="nodebuffer"},b)}},i.exports=m},{"../base64":1,"../external":6,"../nodejs/NodejsStreamOutputAdapter":13,"../support":30,"../utils":32,"./ConvertWorker":24,"./GenericWorker":28}],30:[function(n,i,r){if(r.base64=!0,r.array=!0,r.string=!0,r.arraybuffer=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u",r.nodebuffer=typeof Buffer<"u",r.uint8array=typeof Uint8Array<"u",typeof ArrayBuffer>"u")r.blob=!1;else{var a=new ArrayBuffer(0);try{r.blob=new Blob([a],{type:"application/zip"}).size===0}catch{try{var s=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);s.append(a),r.blob=s.getBlob("application/zip").size===0}catch{r.blob=!1}}}try{r.nodestream=!!n("readable-stream").Readable}catch{r.nodestream=!1}},{"readable-stream":16}],31:[function(n,i,r){for(var a=n("./utils"),s=n("./support"),l=n("./nodejsUtils"),c=n("./stream/GenericWorker"),d=new Array(256),f=0;f<256;f++)d[f]=252<=f?6:248<=f?5:240<=f?4:224<=f?3:192<=f?2:1;d[254]=d[254]=1;function h(){c.call(this,"utf-8 decode"),this.leftOver=null}function g(){c.call(this,"utf-8 encode")}r.utf8encode=function(m){return s.nodebuffer?l.newBufferFrom(m,"utf-8"):(function(b){var y,x,v,w,S,A=b.length,R=0;for(w=0;w<A;w++)(64512&(x=b.charCodeAt(w)))==55296&&w+1<A&&(64512&(v=b.charCodeAt(w+1)))==56320&&(x=65536+(x-55296<<10)+(v-56320),w++),R+=x<128?1:x<2048?2:x<65536?3:4;for(y=s.uint8array?new Uint8Array(R):new Array(R),w=S=0;S<R;w++)(64512&(x=b.charCodeAt(w)))==55296&&w+1<A&&(64512&(v=b.charCodeAt(w+1)))==56320&&(x=65536+(x-55296<<10)+(v-56320),w++),x<128?y[S++]=x:(x<2048?y[S++]=192|x>>>6:(x<65536?y[S++]=224|x>>>12:(y[S++]=240|x>>>18,y[S++]=128|x>>>12&63),y[S++]=128|x>>>6&63),y[S++]=128|63&x);return y})(m)},r.utf8decode=function(m){return s.nodebuffer?a.transformTo("nodebuffer",m).toString("utf-8"):(function(b){var y,x,v,w,S=b.length,A=new Array(2*S);for(y=x=0;y<S;)if((v=b[y++])<128)A[x++]=v;else if(4<(w=d[v]))A[x++]=65533,y+=w-1;else{for(v&=w===2?31:w===3?15:7;1<w&&y<S;)v=v<<6|63&b[y++],w--;1<w?A[x++]=65533:v<65536?A[x++]=v:(v-=65536,A[x++]=55296|v>>10&1023,A[x++]=56320|1023&v)}return A.length!==x&&(A.subarray?A=A.subarray(0,x):A.length=x),a.applyFromCharCode(A)})(m=a.transformTo(s.uint8array?"uint8array":"array",m))},a.inherits(h,c),h.prototype.processChunk=function(m){var b=a.transformTo(s.uint8array?"uint8array":"array",m.data);if(this.leftOver&&this.leftOver.length){if(s.uint8array){var y=b;(b=new Uint8Array(y.length+this.leftOver.length)).set(this.leftOver,0),b.set(y,this.leftOver.length)}else b=this.leftOver.concat(b);this.leftOver=null}var x=(function(w,S){var A;for((S=S||w.length)>w.length&&(S=w.length),A=S-1;0<=A&&(192&w[A])==128;)A--;return A<0||A===0?S:A+d[w[A]]>S?A:S})(b),v=b;x!==b.length&&(s.uint8array?(v=b.subarray(0,x),this.leftOver=b.subarray(x,b.length)):(v=b.slice(0,x),this.leftOver=b.slice(x,b.length))),this.push({data:r.utf8decode(v),meta:m.meta})},h.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:r.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},r.Utf8DecodeWorker=h,a.inherits(g,c),g.prototype.processChunk=function(m){this.push({data:r.utf8encode(m.data),meta:m.meta})},r.Utf8EncodeWorker=g},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(n,i,r){var a=n("./support"),s=n("./base64"),l=n("./nodejsUtils"),c=n("./external");function d(y){return y}function f(y,x){for(var v=0;v<y.length;++v)x[v]=255&y.charCodeAt(v);return x}n("setimmediate"),r.newBlob=function(y,x){r.checkSupport("blob");try{return new Blob([y],{type:x})}catch{try{var v=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);return v.append(y),v.getBlob(x)}catch{throw new Error("Bug : can't construct the Blob.")}}};var h={stringifyByChunk:function(y,x,v){var w=[],S=0,A=y.length;if(A<=v)return String.fromCharCode.apply(null,y);for(;S<A;)x==="array"||x==="nodebuffer"?w.push(String.fromCharCode.apply(null,y.slice(S,Math.min(S+v,A)))):w.push(String.fromCharCode.apply(null,y.subarray(S,Math.min(S+v,A)))),S+=v;return w.join("")},stringifyByChar:function(y){for(var x="",v=0;v<y.length;v++)x+=String.fromCharCode(y[v]);return x},applyCanBeUsed:{uint8array:(function(){try{return a.uint8array&&String.fromCharCode.apply(null,new Uint8Array(1)).length===1}catch{return!1}})(),nodebuffer:(function(){try{return a.nodebuffer&&String.fromCharCode.apply(null,l.allocBuffer(1)).length===1}catch{return!1}})()}};function g(y){var x=65536,v=r.getTypeOf(y),w=!0;if(v==="uint8array"?w=h.applyCanBeUsed.uint8array:v==="nodebuffer"&&(w=h.applyCanBeUsed.nodebuffer),w)for(;1<x;)try{return h.stringifyByChunk(y,v,x)}catch{x=Math.floor(x/2)}return h.stringifyByChar(y)}function m(y,x){for(var v=0;v<y.length;v++)x[v]=y[v];return x}r.applyFromCharCode=g;var b={};b.string={string:d,array:function(y){return f(y,new Array(y.length))},arraybuffer:function(y){return b.string.uint8array(y).buffer},uint8array:function(y){return f(y,new Uint8Array(y.length))},nodebuffer:function(y){return f(y,l.allocBuffer(y.length))}},b.array={string:g,array:d,arraybuffer:function(y){return new Uint8Array(y).buffer},uint8array:function(y){return new Uint8Array(y)},nodebuffer:function(y){return l.newBufferFrom(y)}},b.arraybuffer={string:function(y){return g(new Uint8Array(y))},array:function(y){return m(new Uint8Array(y),new Array(y.byteLength))},arraybuffer:d,uint8array:function(y){return new Uint8Array(y)},nodebuffer:function(y){return l.newBufferFrom(new Uint8Array(y))}},b.uint8array={string:g,array:function(y){return m(y,new Array(y.length))},arraybuffer:function(y){return y.buffer},uint8array:d,nodebuffer:function(y){return l.newBufferFrom(y)}},b.nodebuffer={string:g,array:function(y){return m(y,new Array(y.length))},arraybuffer:function(y){return b.nodebuffer.uint8array(y).buffer},uint8array:function(y){return m(y,new Uint8Array(y.length))},nodebuffer:d},r.transformTo=function(y,x){if(x=x||"",!y)return x;r.checkSupport(y);var v=r.getTypeOf(x);return b[v][y](x)},r.resolve=function(y){for(var x=y.split("/"),v=[],w=0;w<x.length;w++){var S=x[w];S==="."||S===""&&w!==0&&w!==x.length-1||(S===".."?v.pop():v.push(S))}return v.join("/")},r.getTypeOf=function(y){return typeof y=="string"?"string":Object.prototype.toString.call(y)==="[object Array]"?"array":a.nodebuffer&&l.isBuffer(y)?"nodebuffer":a.uint8array&&y instanceof Uint8Array?"uint8array":a.arraybuffer&&y instanceof ArrayBuffer?"arraybuffer":void 0},r.checkSupport=function(y){if(!a[y.toLowerCase()])throw new Error(y+" is not supported by this platform")},r.MAX_VALUE_16BITS=65535,r.MAX_VALUE_32BITS=-1,r.pretty=function(y){var x,v,w="";for(v=0;v<(y||"").length;v++)w+="\\x"+((x=y.charCodeAt(v))<16?"0":"")+x.toString(16).toUpperCase();return w},r.delay=function(y,x,v){setImmediate(function(){y.apply(v||null,x||[])})},r.inherits=function(y,x){function v(){}v.prototype=x.prototype,y.prototype=new v},r.extend=function(){var y,x,v={};for(y=0;y<arguments.length;y++)for(x in arguments[y])Object.prototype.hasOwnProperty.call(arguments[y],x)&&v[x]===void 0&&(v[x]=arguments[y][x]);return v},r.prepareContent=function(y,x,v,w,S){return c.Promise.resolve(x).then(function(A){return a.blob&&(A instanceof Blob||["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(A))!==-1)&&typeof FileReader<"u"?new c.Promise(function(R,N){var C=new FileReader;C.onload=function(F){R(F.target.result)},C.onerror=function(F){N(F.target.error)},C.readAsArrayBuffer(A)}):A}).then(function(A){var R=r.getTypeOf(A);return R?(R==="arraybuffer"?A=r.transformTo("uint8array",A):R==="string"&&(S?A=s.decode(A):v&&w!==!0&&(A=(function(N){return f(N,a.uint8array?new Uint8Array(N.length):new Array(N.length))})(A))),A):c.Promise.reject(new Error("Can't read the data of '"+y+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))})}},{"./base64":1,"./external":6,"./nodejsUtils":14,"./support":30,setimmediate:54}],33:[function(n,i,r){var a=n("./reader/readerFor"),s=n("./utils"),l=n("./signature"),c=n("./zipEntry"),d=n("./support");function f(h){this.files=[],this.loadOptions=h}f.prototype={checkSignature:function(h){if(!this.reader.readAndCheckSignature(h)){this.reader.index-=4;var g=this.reader.readString(4);throw new Error("Corrupted zip or bug: unexpected signature ("+s.pretty(g)+", expected "+s.pretty(h)+")")}},isSignature:function(h,g){var m=this.reader.index;this.reader.setIndex(h);var b=this.reader.readString(4)===g;return this.reader.setIndex(m),b},readBlockEndOfCentral:function(){this.diskNumber=this.reader.readInt(2),this.diskWithCentralDirStart=this.reader.readInt(2),this.centralDirRecordsOnThisDisk=this.reader.readInt(2),this.centralDirRecords=this.reader.readInt(2),this.centralDirSize=this.reader.readInt(4),this.centralDirOffset=this.reader.readInt(4),this.zipCommentLength=this.reader.readInt(2);var h=this.reader.readData(this.zipCommentLength),g=d.uint8array?"uint8array":"array",m=s.transformTo(g,h);this.zipComment=this.loadOptions.decodeFileName(m)},readBlockZip64EndOfCentral:function(){this.zip64EndOfCentralSize=this.reader.readInt(8),this.reader.skip(4),this.diskNumber=this.reader.readInt(4),this.diskWithCentralDirStart=this.reader.readInt(4),this.centralDirRecordsOnThisDisk=this.reader.readInt(8),this.centralDirRecords=this.reader.readInt(8),this.centralDirSize=this.reader.readInt(8),this.centralDirOffset=this.reader.readInt(8),this.zip64ExtensibleData={};for(var h,g,m,b=this.zip64EndOfCentralSize-44;0<b;)h=this.reader.readInt(2),g=this.reader.readInt(4),m=this.reader.readData(g),this.zip64ExtensibleData[h]={id:h,length:g,value:m}},readBlockZip64EndOfCentralLocator:function(){if(this.diskWithZip64CentralDirStart=this.reader.readInt(4),this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8),this.disksCount=this.reader.readInt(4),1<this.disksCount)throw new Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var h,g;for(h=0;h<this.files.length;h++)g=this.files[h],this.reader.setIndex(g.localHeaderOffset),this.checkSignature(l.LOCAL_FILE_HEADER),g.readLocalPart(this.reader),g.handleUTF8(),g.processAttributes()},readCentralDir:function(){var h;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(l.CENTRAL_FILE_HEADER);)(h=new c({zip64:this.zip64},this.loadOptions)).readCentralPart(this.reader),this.files.push(h);if(this.centralDirRecords!==this.files.length&&this.centralDirRecords!==0&&this.files.length===0)throw new Error("Corrupted zip or bug: expected "+this.centralDirRecords+" records in central dir, got "+this.files.length)},readEndOfCentral:function(){var h=this.reader.lastIndexOfSignature(l.CENTRAL_DIRECTORY_END);if(h<0)throw this.isSignature(0,l.LOCAL_FILE_HEADER)?new Error("Corrupted zip: can't find end of central directory"):new Error("Can't find end of central directory : is this a zip file ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html");this.reader.setIndex(h);var g=h;if(this.checkSignature(l.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===s.MAX_VALUE_16BITS||this.diskWithCentralDirStart===s.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===s.MAX_VALUE_16BITS||this.centralDirRecords===s.MAX_VALUE_16BITS||this.centralDirSize===s.MAX_VALUE_32BITS||this.centralDirOffset===s.MAX_VALUE_32BITS){if(this.zip64=!0,(h=this.reader.lastIndexOfSignature(l.ZIP64_CENTRAL_DIRECTORY_LOCATOR))<0)throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex(h),this.checkSignature(l.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,l.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(l.ZIP64_CENTRAL_DIRECTORY_END),this.relativeOffsetEndOfZip64CentralDir<0))throw new Error("Corrupted zip: can't find the ZIP64 end of central directory");this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir),this.checkSignature(l.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var m=this.centralDirOffset+this.centralDirSize;this.zip64&&(m+=20,m+=12+this.zip64EndOfCentralSize);var b=g-m;if(0<b)this.isSignature(g,l.CENTRAL_FILE_HEADER)||(this.reader.zero=b);else if(b<0)throw new Error("Corrupted zip: missing "+Math.abs(b)+" bytes.")},prepareReader:function(h){this.reader=a(h)},load:function(h){this.prepareReader(h),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}},i.exports=f},{"./reader/readerFor":22,"./signature":23,"./support":30,"./utils":32,"./zipEntry":34}],34:[function(n,i,r){var a=n("./reader/readerFor"),s=n("./utils"),l=n("./compressedObject"),c=n("./crc32"),d=n("./utf8"),f=n("./compressions"),h=n("./support");function g(m,b){this.options=m,this.loadOptions=b}g.prototype={isEncrypted:function(){return(1&this.bitFlag)==1},useUTF8:function(){return(2048&this.bitFlag)==2048},readLocalPart:function(m){var b,y;if(m.skip(22),this.fileNameLength=m.readInt(2),y=m.readInt(2),this.fileName=m.readData(this.fileNameLength),m.skip(y),this.compressedSize===-1||this.uncompressedSize===-1)throw new Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)");if((b=(function(x){for(var v in f)if(Object.prototype.hasOwnProperty.call(f,v)&&f[v].magic===x)return f[v];return null})(this.compressionMethod))===null)throw new Error("Corrupted zip : compression "+s.pretty(this.compressionMethod)+" unknown (inner file : "+s.transformTo("string",this.fileName)+")");this.decompressed=new l(this.compressedSize,this.uncompressedSize,this.crc32,b,m.readData(this.compressedSize))},readCentralPart:function(m){this.versionMadeBy=m.readInt(2),m.skip(2),this.bitFlag=m.readInt(2),this.compressionMethod=m.readString(2),this.date=m.readDate(),this.crc32=m.readInt(4),this.compressedSize=m.readInt(4),this.uncompressedSize=m.readInt(4);var b=m.readInt(2);if(this.extraFieldsLength=m.readInt(2),this.fileCommentLength=m.readInt(2),this.diskNumberStart=m.readInt(2),this.internalFileAttributes=m.readInt(2),this.externalFileAttributes=m.readInt(4),this.localHeaderOffset=m.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");m.skip(b),this.readExtraFields(m),this.parseZIP64ExtraField(m),this.fileComment=m.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var m=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),m==0&&(this.dosPermissions=63&this.externalFileAttributes),m==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var m=a(this.extraFields[1].value);this.uncompressedSize===s.MAX_VALUE_32BITS&&(this.uncompressedSize=m.readInt(8)),this.compressedSize===s.MAX_VALUE_32BITS&&(this.compressedSize=m.readInt(8)),this.localHeaderOffset===s.MAX_VALUE_32BITS&&(this.localHeaderOffset=m.readInt(8)),this.diskNumberStart===s.MAX_VALUE_32BITS&&(this.diskNumberStart=m.readInt(4))}},readExtraFields:function(m){var b,y,x,v=m.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});m.index+4<v;)b=m.readInt(2),y=m.readInt(2),x=m.readData(y),this.extraFields[b]={id:b,length:y,value:x};m.setIndex(v)},handleUTF8:function(){var m=h.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=d.utf8decode(this.fileName),this.fileCommentStr=d.utf8decode(this.fileComment);else{var b=this.findExtraFieldUnicodePath();if(b!==null)this.fileNameStr=b;else{var y=s.transformTo(m,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(y)}var x=this.findExtraFieldUnicodeComment();if(x!==null)this.fileCommentStr=x;else{var v=s.transformTo(m,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(v)}}},findExtraFieldUnicodePath:function(){var m=this.extraFields[28789];if(m){var b=a(m.value);return b.readInt(1)!==1||c(this.fileName)!==b.readInt(4)?null:d.utf8decode(b.readData(m.length-5))}return null},findExtraFieldUnicodeComment:function(){var m=this.extraFields[25461];if(m){var b=a(m.value);return b.readInt(1)!==1||c(this.fileComment)!==b.readInt(4)?null:d.utf8decode(b.readData(m.length-5))}return null}},i.exports=g},{"./compressedObject":2,"./compressions":3,"./crc32":4,"./reader/readerFor":22,"./support":30,"./utf8":31,"./utils":32}],35:[function(n,i,r){function a(b,y,x){this.name=b,this.dir=x.dir,this.date=x.date,this.comment=x.comment,this.unixPermissions=x.unixPermissions,this.dosPermissions=x.dosPermissions,this._data=y,this._dataBinary=x.binary,this.options={compression:x.compression,compressionOptions:x.compressionOptions}}var s=n("./stream/StreamHelper"),l=n("./stream/DataWorker"),c=n("./utf8"),d=n("./compressedObject"),f=n("./stream/GenericWorker");a.prototype={internalStream:function(b){var y=null,x="string";try{if(!b)throw new Error("No output type specified.");var v=(x=b.toLowerCase())==="string"||x==="text";x!=="binarystring"&&x!=="text"||(x="string"),y=this._decompressWorker();var w=!this._dataBinary;w&&!v&&(y=y.pipe(new c.Utf8EncodeWorker)),!w&&v&&(y=y.pipe(new c.Utf8DecodeWorker))}catch(S){(y=new f("error")).error(S)}return new s(y,x,"")},async:function(b,y){return this.internalStream(b).accumulate(y)},nodeStream:function(b,y){return this.internalStream(b||"nodebuffer").toNodejsStream(y)},_compressWorker:function(b,y){if(this._data instanceof d&&this._data.compression.magic===b.magic)return this._data.getCompressedWorker();var x=this._decompressWorker();return this._dataBinary||(x=x.pipe(new c.Utf8EncodeWorker)),d.createWorkerFrom(x,b,y)},_decompressWorker:function(){return this._data instanceof d?this._data.getContentWorker():this._data instanceof f?this._data:new l(this._data)}};for(var h=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],g=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},m=0;m<h.length;m++)a.prototype[h[m]]=g;i.exports=a},{"./compressedObject":2,"./stream/DataWorker":27,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31}],36:[function(n,i,r){(function(a){var s,l,c=a.MutationObserver||a.WebKitMutationObserver;if(c){var d=0,f=new c(b),h=a.document.createTextNode("");f.observe(h,{characterData:!0}),s=function(){h.data=d=++d%2}}else if(a.setImmediate||a.MessageChannel===void 0)s="document"in a&&"onreadystatechange"in a.document.createElement("script")?function(){var y=a.document.createElement("script");y.onreadystatechange=function(){b(),y.onreadystatechange=null,y.parentNode.removeChild(y),y=null},a.document.documentElement.appendChild(y)}:function(){setTimeout(b,0)};else{var g=new a.MessageChannel;g.port1.onmessage=b,s=function(){g.port2.postMessage(0)}}var m=[];function b(){var y,x;l=!0;for(var v=m.length;v;){for(x=m,m=[],y=-1;++y<v;)x[y]();v=m.length}l=!1}i.exports=function(y){m.push(y)!==1||l||s()}}).call(this,typeof s0<"u"?s0:typeof self<"u"?self:typeof window<"u"?window:{})},{}],37:[function(n,i,r){var a=n("immediate");function s(){}var l={},c=["REJECTED"],d=["FULFILLED"],f=["PENDING"];function h(v){if(typeof v!="function")throw new TypeError("resolver must be a function");this.state=f,this.queue=[],this.outcome=void 0,v!==s&&y(this,v)}function g(v,w,S){this.promise=v,typeof w=="function"&&(this.onFulfilled=w,this.callFulfilled=this.otherCallFulfilled),typeof S=="function"&&(this.onRejected=S,this.callRejected=this.otherCallRejected)}function m(v,w,S){a(function(){var A;try{A=w(S)}catch(R){return l.reject(v,R)}A===v?l.reject(v,new TypeError("Cannot resolve promise with itself")):l.resolve(v,A)})}function b(v){var w=v&&v.then;if(v&&(typeof v=="object"||typeof v=="function")&&typeof w=="function")return function(){w.apply(v,arguments)}}function y(v,w){var S=!1;function A(C){S||(S=!0,l.reject(v,C))}function R(C){S||(S=!0,l.resolve(v,C))}var N=x(function(){w(R,A)});N.status==="error"&&A(N.value)}function x(v,w){var S={};try{S.value=v(w),S.status="success"}catch(A){S.status="error",S.value=A}return S}(i.exports=h).prototype.finally=function(v){if(typeof v!="function")return this;var w=this.constructor;return this.then(function(S){return w.resolve(v()).then(function(){return S})},function(S){return w.resolve(v()).then(function(){throw S})})},h.prototype.catch=function(v){return this.then(null,v)},h.prototype.then=function(v,w){if(typeof v!="function"&&this.state===d||typeof w!="function"&&this.state===c)return this;var S=new this.constructor(s);return this.state!==f?m(S,this.state===d?v:w,this.outcome):this.queue.push(new g(S,v,w)),S},g.prototype.callFulfilled=function(v){l.resolve(this.promise,v)},g.prototype.otherCallFulfilled=function(v){m(this.promise,this.onFulfilled,v)},g.prototype.callRejected=function(v){l.reject(this.promise,v)},g.prototype.otherCallRejected=function(v){m(this.promise,this.onRejected,v)},l.resolve=function(v,w){var S=x(b,w);if(S.status==="error")return l.reject(v,S.value);var A=S.value;if(A)y(v,A);else{v.state=d,v.outcome=w;for(var R=-1,N=v.queue.length;++R<N;)v.queue[R].callFulfilled(w)}return v},l.reject=function(v,w){v.state=c,v.outcome=w;for(var S=-1,A=v.queue.length;++S<A;)v.queue[S].callRejected(w);return v},h.resolve=function(v){return v instanceof this?v:l.resolve(new this(s),v)},h.reject=function(v){var w=new this(s);return l.reject(w,v)},h.all=function(v){var w=this;if(Object.prototype.toString.call(v)!=="[object Array]")return this.reject(new TypeError("must be an array"));var S=v.length,A=!1;if(!S)return this.resolve([]);for(var R=new Array(S),N=0,C=-1,F=new this(s);++C<S;)P(v[C],C);return F;function P(L,B){w.resolve(L).then(function(U){R[B]=U,++N!==S||A||(A=!0,l.resolve(F,R))},function(U){A||(A=!0,l.reject(F,U))})}},h.race=function(v){var w=this;if(Object.prototype.toString.call(v)!=="[object Array]")return this.reject(new TypeError("must be an array"));var S=v.length,A=!1;if(!S)return this.resolve([]);for(var R=-1,N=new this(s);++R<S;)C=v[R],w.resolve(C).then(function(F){A||(A=!0,l.resolve(N,F))},function(F){A||(A=!0,l.reject(N,F))});var C;return N}},{immediate:36}],38:[function(n,i,r){var a={};(0,n("./lib/utils/common").assign)(a,n("./lib/deflate"),n("./lib/inflate"),n("./lib/zlib/constants")),i.exports=a},{"./lib/deflate":39,"./lib/inflate":40,"./lib/utils/common":41,"./lib/zlib/constants":44}],39:[function(n,i,r){var a=n("./zlib/deflate"),s=n("./utils/common"),l=n("./utils/strings"),c=n("./zlib/messages"),d=n("./zlib/zstream"),f=Object.prototype.toString,h=0,g=-1,m=0,b=8;function y(v){if(!(this instanceof y))return new y(v);this.options=s.assign({level:g,method:b,chunkSize:16384,windowBits:15,memLevel:8,strategy:m,to:""},v||{});var w=this.options;w.raw&&0<w.windowBits?w.windowBits=-w.windowBits:w.gzip&&0<w.windowBits&&w.windowBits<16&&(w.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new d,this.strm.avail_out=0;var S=a.deflateInit2(this.strm,w.level,w.method,w.windowBits,w.memLevel,w.strategy);if(S!==h)throw new Error(c[S]);if(w.header&&a.deflateSetHeader(this.strm,w.header),w.dictionary){var A;if(A=typeof w.dictionary=="string"?l.string2buf(w.dictionary):f.call(w.dictionary)==="[object ArrayBuffer]"?new Uint8Array(w.dictionary):w.dictionary,(S=a.deflateSetDictionary(this.strm,A))!==h)throw new Error(c[S]);this._dict_set=!0}}function x(v,w){var S=new y(w);if(S.push(v,!0),S.err)throw S.msg||c[S.err];return S.result}y.prototype.push=function(v,w){var S,A,R=this.strm,N=this.options.chunkSize;if(this.ended)return!1;A=w===~~w?w:w===!0?4:0,typeof v=="string"?R.input=l.string2buf(v):f.call(v)==="[object ArrayBuffer]"?R.input=new Uint8Array(v):R.input=v,R.next_in=0,R.avail_in=R.input.length;do{if(R.avail_out===0&&(R.output=new s.Buf8(N),R.next_out=0,R.avail_out=N),(S=a.deflate(R,A))!==1&&S!==h)return this.onEnd(S),!(this.ended=!0);R.avail_out!==0&&(R.avail_in!==0||A!==4&&A!==2)||(this.options.to==="string"?this.onData(l.buf2binstring(s.shrinkBuf(R.output,R.next_out))):this.onData(s.shrinkBuf(R.output,R.next_out)))}while((0<R.avail_in||R.avail_out===0)&&S!==1);return A===4?(S=a.deflateEnd(this.strm),this.onEnd(S),this.ended=!0,S===h):A!==2||(this.onEnd(h),!(R.avail_out=0))},y.prototype.onData=function(v){this.chunks.push(v)},y.prototype.onEnd=function(v){v===h&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=s.flattenChunks(this.chunks)),this.chunks=[],this.err=v,this.msg=this.strm.msg},r.Deflate=y,r.deflate=x,r.deflateRaw=function(v,w){return(w=w||{}).raw=!0,x(v,w)},r.gzip=function(v,w){return(w=w||{}).gzip=!0,x(v,w)}},{"./utils/common":41,"./utils/strings":42,"./zlib/deflate":46,"./zlib/messages":51,"./zlib/zstream":53}],40:[function(n,i,r){var a=n("./zlib/inflate"),s=n("./utils/common"),l=n("./utils/strings"),c=n("./zlib/constants"),d=n("./zlib/messages"),f=n("./zlib/zstream"),h=n("./zlib/gzheader"),g=Object.prototype.toString;function m(y){if(!(this instanceof m))return new m(y);this.options=s.assign({chunkSize:16384,windowBits:0,to:""},y||{});var x=this.options;x.raw&&0<=x.windowBits&&x.windowBits<16&&(x.windowBits=-x.windowBits,x.windowBits===0&&(x.windowBits=-15)),!(0<=x.windowBits&&x.windowBits<16)||y&&y.windowBits||(x.windowBits+=32),15<x.windowBits&&x.windowBits<48&&(15&x.windowBits)==0&&(x.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new f,this.strm.avail_out=0;var v=a.inflateInit2(this.strm,x.windowBits);if(v!==c.Z_OK)throw new Error(d[v]);this.header=new h,a.inflateGetHeader(this.strm,this.header)}function b(y,x){var v=new m(x);if(v.push(y,!0),v.err)throw v.msg||d[v.err];return v.result}m.prototype.push=function(y,x){var v,w,S,A,R,N,C=this.strm,F=this.options.chunkSize,P=this.options.dictionary,L=!1;if(this.ended)return!1;w=x===~~x?x:x===!0?c.Z_FINISH:c.Z_NO_FLUSH,typeof y=="string"?C.input=l.binstring2buf(y):g.call(y)==="[object ArrayBuffer]"?C.input=new Uint8Array(y):C.input=y,C.next_in=0,C.avail_in=C.input.length;do{if(C.avail_out===0&&(C.output=new s.Buf8(F),C.next_out=0,C.avail_out=F),(v=a.inflate(C,c.Z_NO_FLUSH))===c.Z_NEED_DICT&&P&&(N=typeof P=="string"?l.string2buf(P):g.call(P)==="[object ArrayBuffer]"?new Uint8Array(P):P,v=a.inflateSetDictionary(this.strm,N)),v===c.Z_BUF_ERROR&&L===!0&&(v=c.Z_OK,L=!1),v!==c.Z_STREAM_END&&v!==c.Z_OK)return this.onEnd(v),!(this.ended=!0);C.next_out&&(C.avail_out!==0&&v!==c.Z_STREAM_END&&(C.avail_in!==0||w!==c.Z_FINISH&&w!==c.Z_SYNC_FLUSH)||(this.options.to==="string"?(S=l.utf8border(C.output,C.next_out),A=C.next_out-S,R=l.buf2string(C.output,S),C.next_out=A,C.avail_out=F-A,A&&s.arraySet(C.output,C.output,S,A,0),this.onData(R)):this.onData(s.shrinkBuf(C.output,C.next_out)))),C.avail_in===0&&C.avail_out===0&&(L=!0)}while((0<C.avail_in||C.avail_out===0)&&v!==c.Z_STREAM_END);return v===c.Z_STREAM_END&&(w=c.Z_FINISH),w===c.Z_FINISH?(v=a.inflateEnd(this.strm),this.onEnd(v),this.ended=!0,v===c.Z_OK):w!==c.Z_SYNC_FLUSH||(this.onEnd(c.Z_OK),!(C.avail_out=0))},m.prototype.onData=function(y){this.chunks.push(y)},m.prototype.onEnd=function(y){y===c.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=s.flattenChunks(this.chunks)),this.chunks=[],this.err=y,this.msg=this.strm.msg},r.Inflate=m,r.inflate=b,r.inflateRaw=function(y,x){return(x=x||{}).raw=!0,b(y,x)},r.ungzip=b},{"./utils/common":41,"./utils/strings":42,"./zlib/constants":44,"./zlib/gzheader":47,"./zlib/inflate":49,"./zlib/messages":51,"./zlib/zstream":53}],41:[function(n,i,r){var a=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";r.assign=function(c){for(var d=Array.prototype.slice.call(arguments,1);d.length;){var f=d.shift();if(f){if(typeof f!="object")throw new TypeError(f+"must be non-object");for(var h in f)f.hasOwnProperty(h)&&(c[h]=f[h])}}return c},r.shrinkBuf=function(c,d){return c.length===d?c:c.subarray?c.subarray(0,d):(c.length=d,c)};var s={arraySet:function(c,d,f,h,g){if(d.subarray&&c.subarray)c.set(d.subarray(f,f+h),g);else for(var m=0;m<h;m++)c[g+m]=d[f+m]},flattenChunks:function(c){var d,f,h,g,m,b;for(d=h=0,f=c.length;d<f;d++)h+=c[d].length;for(b=new Uint8Array(h),d=g=0,f=c.length;d<f;d++)m=c[d],b.set(m,g),g+=m.length;return b}},l={arraySet:function(c,d,f,h,g){for(var m=0;m<h;m++)c[g+m]=d[f+m]},flattenChunks:function(c){return[].concat.apply([],c)}};r.setTyped=function(c){c?(r.Buf8=Uint8Array,r.Buf16=Uint16Array,r.Buf32=Int32Array,r.assign(r,s)):(r.Buf8=Array,r.Buf16=Array,r.Buf32=Array,r.assign(r,l))},r.setTyped(a)},{}],42:[function(n,i,r){var a=n("./common"),s=!0,l=!0;try{String.fromCharCode.apply(null,[0])}catch{s=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{l=!1}for(var c=new a.Buf8(256),d=0;d<256;d++)c[d]=252<=d?6:248<=d?5:240<=d?4:224<=d?3:192<=d?2:1;function f(h,g){if(g<65537&&(h.subarray&&l||!h.subarray&&s))return String.fromCharCode.apply(null,a.shrinkBuf(h,g));for(var m="",b=0;b<g;b++)m+=String.fromCharCode(h[b]);return m}c[254]=c[254]=1,r.string2buf=function(h){var g,m,b,y,x,v=h.length,w=0;for(y=0;y<v;y++)(64512&(m=h.charCodeAt(y)))==55296&&y+1<v&&(64512&(b=h.charCodeAt(y+1)))==56320&&(m=65536+(m-55296<<10)+(b-56320),y++),w+=m<128?1:m<2048?2:m<65536?3:4;for(g=new a.Buf8(w),y=x=0;x<w;y++)(64512&(m=h.charCodeAt(y)))==55296&&y+1<v&&(64512&(b=h.charCodeAt(y+1)))==56320&&(m=65536+(m-55296<<10)+(b-56320),y++),m<128?g[x++]=m:(m<2048?g[x++]=192|m>>>6:(m<65536?g[x++]=224|m>>>12:(g[x++]=240|m>>>18,g[x++]=128|m>>>12&63),g[x++]=128|m>>>6&63),g[x++]=128|63&m);return g},r.buf2binstring=function(h){return f(h,h.length)},r.binstring2buf=function(h){for(var g=new a.Buf8(h.length),m=0,b=g.length;m<b;m++)g[m]=h.charCodeAt(m);return g},r.buf2string=function(h,g){var m,b,y,x,v=g||h.length,w=new Array(2*v);for(m=b=0;m<v;)if((y=h[m++])<128)w[b++]=y;else if(4<(x=c[y]))w[b++]=65533,m+=x-1;else{for(y&=x===2?31:x===3?15:7;1<x&&m<v;)y=y<<6|63&h[m++],x--;1<x?w[b++]=65533:y<65536?w[b++]=y:(y-=65536,w[b++]=55296|y>>10&1023,w[b++]=56320|1023&y)}return f(w,b)},r.utf8border=function(h,g){var m;for((g=g||h.length)>h.length&&(g=h.length),m=g-1;0<=m&&(192&h[m])==128;)m--;return m<0||m===0?g:m+c[h[m]]>g?m:g}},{"./common":41}],43:[function(n,i,r){i.exports=function(a,s,l,c){for(var d=65535&a|0,f=a>>>16&65535|0,h=0;l!==0;){for(l-=h=2e3<l?2e3:l;f=f+(d=d+s[c++]|0)|0,--h;);d%=65521,f%=65521}return d|f<<16|0}},{}],44:[function(n,i,r){i.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},{}],45:[function(n,i,r){var a=(function(){for(var s,l=[],c=0;c<256;c++){s=c;for(var d=0;d<8;d++)s=1&s?3988292384^s>>>1:s>>>1;l[c]=s}return l})();i.exports=function(s,l,c,d){var f=a,h=d+c;s^=-1;for(var g=d;g<h;g++)s=s>>>8^f[255&(s^l[g])];return-1^s}},{}],46:[function(n,i,r){var a,s=n("../utils/common"),l=n("./trees"),c=n("./adler32"),d=n("./crc32"),f=n("./messages"),h=0,g=4,m=0,b=-2,y=-1,x=4,v=2,w=8,S=9,A=286,R=30,N=19,C=2*A+1,F=15,P=3,L=258,B=L+P+1,U=42,$=113,I=1,W=2,X=3,V=4;function Y(z,G){return z.msg=f[G],G}function J(z){return(z<<1)-(4<z?9:0)}function se(z){for(var G=z.length;0<=--G;)z[G]=0}function H(z){var G=z.state,ne=G.pending;ne>z.avail_out&&(ne=z.avail_out),ne!==0&&(s.arraySet(z.output,G.pending_buf,G.pending_out,ne,z.next_out),z.next_out+=ne,G.pending_out+=ne,z.total_out+=ne,z.avail_out-=ne,G.pending-=ne,G.pending===0&&(G.pending_out=0))}function q(z,G){l._tr_flush_block(z,0<=z.block_start?z.block_start:-1,z.strstart-z.block_start,G),z.block_start=z.strstart,H(z.strm)}function re(z,G){z.pending_buf[z.pending++]=G}function ce(z,G){z.pending_buf[z.pending++]=G>>>8&255,z.pending_buf[z.pending++]=255&G}function ye(z,G){var ne,Q,ee=z.max_chain_length,ae=z.strstart,ie=z.prev_length,we=z.nice_match,ve=z.strstart>z.w_size-B?z.strstart-(z.w_size-B):0,k=z.window,O=z.w_mask,K=z.prev,pe=z.strstart+L,xe=k[ae+ie-1],fe=k[ae+ie];z.prev_length>=z.good_match&&(ee>>=2),we>z.lookahead&&(we=z.lookahead);do if(k[(ne=G)+ie]===fe&&k[ne+ie-1]===xe&&k[ne]===k[ae]&&k[++ne]===k[ae+1]){ae+=2,ne++;do;while(k[++ae]===k[++ne]&&k[++ae]===k[++ne]&&k[++ae]===k[++ne]&&k[++ae]===k[++ne]&&k[++ae]===k[++ne]&&k[++ae]===k[++ne]&&k[++ae]===k[++ne]&&k[++ae]===k[++ne]&&ae<pe);if(Q=L-(pe-ae),ae=pe-L,ie<Q){if(z.match_start=G,we<=(ie=Q))break;xe=k[ae+ie-1],fe=k[ae+ie]}}while((G=K[G&O])>ve&&--ee!=0);return ie<=z.lookahead?ie:z.lookahead}function me(z){var G,ne,Q,ee,ae,ie,we,ve,k,O,K=z.w_size;do{if(ee=z.window_size-z.lookahead-z.strstart,z.strstart>=K+(K-B)){for(s.arraySet(z.window,z.window,K,K,0),z.match_start-=K,z.strstart-=K,z.block_start-=K,G=ne=z.hash_size;Q=z.head[--G],z.head[G]=K<=Q?Q-K:0,--ne;);for(G=ne=K;Q=z.prev[--G],z.prev[G]=K<=Q?Q-K:0,--ne;);ee+=K}if(z.strm.avail_in===0)break;if(ie=z.strm,we=z.window,ve=z.strstart+z.lookahead,k=ee,O=void 0,O=ie.avail_in,k<O&&(O=k),ne=O===0?0:(ie.avail_in-=O,s.arraySet(we,ie.input,ie.next_in,O,ve),ie.state.wrap===1?ie.adler=c(ie.adler,we,O,ve):ie.state.wrap===2&&(ie.adler=d(ie.adler,we,O,ve)),ie.next_in+=O,ie.total_in+=O,O),z.lookahead+=ne,z.lookahead+z.insert>=P)for(ae=z.strstart-z.insert,z.ins_h=z.window[ae],z.ins_h=(z.ins_h<<z.hash_shift^z.window[ae+1])&z.hash_mask;z.insert&&(z.ins_h=(z.ins_h<<z.hash_shift^z.window[ae+P-1])&z.hash_mask,z.prev[ae&z.w_mask]=z.head[z.ins_h],z.head[z.ins_h]=ae,ae++,z.insert--,!(z.lookahead+z.insert<P)););}while(z.lookahead<B&&z.strm.avail_in!==0)}function be(z,G){for(var ne,Q;;){if(z.lookahead<B){if(me(z),z.lookahead<B&&G===h)return I;if(z.lookahead===0)break}if(ne=0,z.lookahead>=P&&(z.ins_h=(z.ins_h<<z.hash_shift^z.window[z.strstart+P-1])&z.hash_mask,ne=z.prev[z.strstart&z.w_mask]=z.head[z.ins_h],z.head[z.ins_h]=z.strstart),ne!==0&&z.strstart-ne<=z.w_size-B&&(z.match_length=ye(z,ne)),z.match_length>=P)if(Q=l._tr_tally(z,z.strstart-z.match_start,z.match_length-P),z.lookahead-=z.match_length,z.match_length<=z.max_lazy_match&&z.lookahead>=P){for(z.match_length--;z.strstart++,z.ins_h=(z.ins_h<<z.hash_shift^z.window[z.strstart+P-1])&z.hash_mask,ne=z.prev[z.strstart&z.w_mask]=z.head[z.ins_h],z.head[z.ins_h]=z.strstart,--z.match_length!=0;);z.strstart++}else z.strstart+=z.match_length,z.match_length=0,z.ins_h=z.window[z.strstart],z.ins_h=(z.ins_h<<z.hash_shift^z.window[z.strstart+1])&z.hash_mask;else Q=l._tr_tally(z,0,z.window[z.strstart]),z.lookahead--,z.strstart++;if(Q&&(q(z,!1),z.strm.avail_out===0))return I}return z.insert=z.strstart<P-1?z.strstart:P-1,G===g?(q(z,!0),z.strm.avail_out===0?X:V):z.last_lit&&(q(z,!1),z.strm.avail_out===0)?I:W}function Ne(z,G){for(var ne,Q,ee;;){if(z.lookahead<B){if(me(z),z.lookahead<B&&G===h)return I;if(z.lookahead===0)break}if(ne=0,z.lookahead>=P&&(z.ins_h=(z.ins_h<<z.hash_shift^z.window[z.strstart+P-1])&z.hash_mask,ne=z.prev[z.strstart&z.w_mask]=z.head[z.ins_h],z.head[z.ins_h]=z.strstart),z.prev_length=z.match_length,z.prev_match=z.match_start,z.match_length=P-1,ne!==0&&z.prev_length<z.max_lazy_match&&z.strstart-ne<=z.w_size-B&&(z.match_length=ye(z,ne),z.match_length<=5&&(z.strategy===1||z.match_length===P&&4096<z.strstart-z.match_start)&&(z.match_length=P-1)),z.prev_length>=P&&z.match_length<=z.prev_length){for(ee=z.strstart+z.lookahead-P,Q=l._tr_tally(z,z.strstart-1-z.prev_match,z.prev_length-P),z.lookahead-=z.prev_length-1,z.prev_length-=2;++z.strstart<=ee&&(z.ins_h=(z.ins_h<<z.hash_shift^z.window[z.strstart+P-1])&z.hash_mask,ne=z.prev[z.strstart&z.w_mask]=z.head[z.ins_h],z.head[z.ins_h]=z.strstart),--z.prev_length!=0;);if(z.match_available=0,z.match_length=P-1,z.strstart++,Q&&(q(z,!1),z.strm.avail_out===0))return I}else if(z.match_available){if((Q=l._tr_tally(z,0,z.window[z.strstart-1]))&&q(z,!1),z.strstart++,z.lookahead--,z.strm.avail_out===0)return I}else z.match_available=1,z.strstart++,z.lookahead--}return z.match_available&&(Q=l._tr_tally(z,0,z.window[z.strstart-1]),z.match_available=0),z.insert=z.strstart<P-1?z.strstart:P-1,G===g?(q(z,!0),z.strm.avail_out===0?X:V):z.last_lit&&(q(z,!1),z.strm.avail_out===0)?I:W}function he(z,G,ne,Q,ee){this.good_length=z,this.max_lazy=G,this.nice_length=ne,this.max_chain=Q,this.func=ee}function Ae(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=w,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new s.Buf16(2*C),this.dyn_dtree=new s.Buf16(2*(2*R+1)),this.bl_tree=new s.Buf16(2*(2*N+1)),se(this.dyn_ltree),se(this.dyn_dtree),se(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new s.Buf16(F+1),this.heap=new s.Buf16(2*A+1),se(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new s.Buf16(2*A+1),se(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function Be(z){var G;return z&&z.state?(z.total_in=z.total_out=0,z.data_type=v,(G=z.state).pending=0,G.pending_out=0,G.wrap<0&&(G.wrap=-G.wrap),G.status=G.wrap?U:$,z.adler=G.wrap===2?0:1,G.last_flush=h,l._tr_init(G),m):Y(z,b)}function le(z){var G=Be(z);return G===m&&(function(ne){ne.window_size=2*ne.w_size,se(ne.head),ne.max_lazy_match=a[ne.level].max_lazy,ne.good_match=a[ne.level].good_length,ne.nice_match=a[ne.level].nice_length,ne.max_chain_length=a[ne.level].max_chain,ne.strstart=0,ne.block_start=0,ne.lookahead=0,ne.insert=0,ne.match_length=ne.prev_length=P-1,ne.match_available=0,ne.ins_h=0})(z.state),G}function lt(z,G,ne,Q,ee,ae){if(!z)return b;var ie=1;if(G===y&&(G=6),Q<0?(ie=0,Q=-Q):15<Q&&(ie=2,Q-=16),ee<1||S<ee||ne!==w||Q<8||15<Q||G<0||9<G||ae<0||x<ae)return Y(z,b);Q===8&&(Q=9);var we=new Ae;return(z.state=we).strm=z,we.wrap=ie,we.gzhead=null,we.w_bits=Q,we.w_size=1<<we.w_bits,we.w_mask=we.w_size-1,we.hash_bits=ee+7,we.hash_size=1<<we.hash_bits,we.hash_mask=we.hash_size-1,we.hash_shift=~~((we.hash_bits+P-1)/P),we.window=new s.Buf8(2*we.w_size),we.head=new s.Buf16(we.hash_size),we.prev=new s.Buf16(we.w_size),we.lit_bufsize=1<<ee+6,we.pending_buf_size=4*we.lit_bufsize,we.pending_buf=new s.Buf8(we.pending_buf_size),we.d_buf=1*we.lit_bufsize,we.l_buf=3*we.lit_bufsize,we.level=G,we.strategy=ae,we.method=ne,le(z)}a=[new he(0,0,0,0,function(z,G){var ne=65535;for(ne>z.pending_buf_size-5&&(ne=z.pending_buf_size-5);;){if(z.lookahead<=1){if(me(z),z.lookahead===0&&G===h)return I;if(z.lookahead===0)break}z.strstart+=z.lookahead,z.lookahead=0;var Q=z.block_start+ne;if((z.strstart===0||z.strstart>=Q)&&(z.lookahead=z.strstart-Q,z.strstart=Q,q(z,!1),z.strm.avail_out===0)||z.strstart-z.block_start>=z.w_size-B&&(q(z,!1),z.strm.avail_out===0))return I}return z.insert=0,G===g?(q(z,!0),z.strm.avail_out===0?X:V):(z.strstart>z.block_start&&(q(z,!1),z.strm.avail_out),I)}),new he(4,4,8,4,be),new he(4,5,16,8,be),new he(4,6,32,32,be),new he(4,4,16,16,Ne),new he(8,16,32,32,Ne),new he(8,16,128,128,Ne),new he(8,32,128,256,Ne),new he(32,128,258,1024,Ne),new he(32,258,258,4096,Ne)],r.deflateInit=function(z,G){return lt(z,G,w,15,8,0)},r.deflateInit2=lt,r.deflateReset=le,r.deflateResetKeep=Be,r.deflateSetHeader=function(z,G){return z&&z.state?z.state.wrap!==2?b:(z.state.gzhead=G,m):b},r.deflate=function(z,G){var ne,Q,ee,ae;if(!z||!z.state||5<G||G<0)return z?Y(z,b):b;if(Q=z.state,!z.output||!z.input&&z.avail_in!==0||Q.status===666&&G!==g)return Y(z,z.avail_out===0?-5:b);if(Q.strm=z,ne=Q.last_flush,Q.last_flush=G,Q.status===U)if(Q.wrap===2)z.adler=0,re(Q,31),re(Q,139),re(Q,8),Q.gzhead?(re(Q,(Q.gzhead.text?1:0)+(Q.gzhead.hcrc?2:0)+(Q.gzhead.extra?4:0)+(Q.gzhead.name?8:0)+(Q.gzhead.comment?16:0)),re(Q,255&Q.gzhead.time),re(Q,Q.gzhead.time>>8&255),re(Q,Q.gzhead.time>>16&255),re(Q,Q.gzhead.time>>24&255),re(Q,Q.level===9?2:2<=Q.strategy||Q.level<2?4:0),re(Q,255&Q.gzhead.os),Q.gzhead.extra&&Q.gzhead.extra.length&&(re(Q,255&Q.gzhead.extra.length),re(Q,Q.gzhead.extra.length>>8&255)),Q.gzhead.hcrc&&(z.adler=d(z.adler,Q.pending_buf,Q.pending,0)),Q.gzindex=0,Q.status=69):(re(Q,0),re(Q,0),re(Q,0),re(Q,0),re(Q,0),re(Q,Q.level===9?2:2<=Q.strategy||Q.level<2?4:0),re(Q,3),Q.status=$);else{var ie=w+(Q.w_bits-8<<4)<<8;ie|=(2<=Q.strategy||Q.level<2?0:Q.level<6?1:Q.level===6?2:3)<<6,Q.strstart!==0&&(ie|=32),ie+=31-ie%31,Q.status=$,ce(Q,ie),Q.strstart!==0&&(ce(Q,z.adler>>>16),ce(Q,65535&z.adler)),z.adler=1}if(Q.status===69)if(Q.gzhead.extra){for(ee=Q.pending;Q.gzindex<(65535&Q.gzhead.extra.length)&&(Q.pending!==Q.pending_buf_size||(Q.gzhead.hcrc&&Q.pending>ee&&(z.adler=d(z.adler,Q.pending_buf,Q.pending-ee,ee)),H(z),ee=Q.pending,Q.pending!==Q.pending_buf_size));)re(Q,255&Q.gzhead.extra[Q.gzindex]),Q.gzindex++;Q.gzhead.hcrc&&Q.pending>ee&&(z.adler=d(z.adler,Q.pending_buf,Q.pending-ee,ee)),Q.gzindex===Q.gzhead.extra.length&&(Q.gzindex=0,Q.status=73)}else Q.status=73;if(Q.status===73)if(Q.gzhead.name){ee=Q.pending;do{if(Q.pending===Q.pending_buf_size&&(Q.gzhead.hcrc&&Q.pending>ee&&(z.adler=d(z.adler,Q.pending_buf,Q.pending-ee,ee)),H(z),ee=Q.pending,Q.pending===Q.pending_buf_size)){ae=1;break}ae=Q.gzindex<Q.gzhead.name.length?255&Q.gzhead.name.charCodeAt(Q.gzindex++):0,re(Q,ae)}while(ae!==0);Q.gzhead.hcrc&&Q.pending>ee&&(z.adler=d(z.adler,Q.pending_buf,Q.pending-ee,ee)),ae===0&&(Q.gzindex=0,Q.status=91)}else Q.status=91;if(Q.status===91)if(Q.gzhead.comment){ee=Q.pending;do{if(Q.pending===Q.pending_buf_size&&(Q.gzhead.hcrc&&Q.pending>ee&&(z.adler=d(z.adler,Q.pending_buf,Q.pending-ee,ee)),H(z),ee=Q.pending,Q.pending===Q.pending_buf_size)){ae=1;break}ae=Q.gzindex<Q.gzhead.comment.length?255&Q.gzhead.comment.charCodeAt(Q.gzindex++):0,re(Q,ae)}while(ae!==0);Q.gzhead.hcrc&&Q.pending>ee&&(z.adler=d(z.adler,Q.pending_buf,Q.pending-ee,ee)),ae===0&&(Q.status=103)}else Q.status=103;if(Q.status===103&&(Q.gzhead.hcrc?(Q.pending+2>Q.pending_buf_size&&H(z),Q.pending+2<=Q.pending_buf_size&&(re(Q,255&z.adler),re(Q,z.adler>>8&255),z.adler=0,Q.status=$)):Q.status=$),Q.pending!==0){if(H(z),z.avail_out===0)return Q.last_flush=-1,m}else if(z.avail_in===0&&J(G)<=J(ne)&&G!==g)return Y(z,-5);if(Q.status===666&&z.avail_in!==0)return Y(z,-5);if(z.avail_in!==0||Q.lookahead!==0||G!==h&&Q.status!==666){var we=Q.strategy===2?(function(ve,k){for(var O;;){if(ve.lookahead===0&&(me(ve),ve.lookahead===0)){if(k===h)return I;break}if(ve.match_length=0,O=l._tr_tally(ve,0,ve.window[ve.strstart]),ve.lookahead--,ve.strstart++,O&&(q(ve,!1),ve.strm.avail_out===0))return I}return ve.insert=0,k===g?(q(ve,!0),ve.strm.avail_out===0?X:V):ve.last_lit&&(q(ve,!1),ve.strm.avail_out===0)?I:W})(Q,G):Q.strategy===3?(function(ve,k){for(var O,K,pe,xe,fe=ve.window;;){if(ve.lookahead<=L){if(me(ve),ve.lookahead<=L&&k===h)return I;if(ve.lookahead===0)break}if(ve.match_length=0,ve.lookahead>=P&&0<ve.strstart&&(K=fe[pe=ve.strstart-1])===fe[++pe]&&K===fe[++pe]&&K===fe[++pe]){xe=ve.strstart+L;do;while(K===fe[++pe]&&K===fe[++pe]&&K===fe[++pe]&&K===fe[++pe]&&K===fe[++pe]&&K===fe[++pe]&&K===fe[++pe]&&K===fe[++pe]&&pe<xe);ve.match_length=L-(xe-pe),ve.match_length>ve.lookahead&&(ve.match_length=ve.lookahead)}if(ve.match_length>=P?(O=l._tr_tally(ve,1,ve.match_length-P),ve.lookahead-=ve.match_length,ve.strstart+=ve.match_length,ve.match_length=0):(O=l._tr_tally(ve,0,ve.window[ve.strstart]),ve.lookahead--,ve.strstart++),O&&(q(ve,!1),ve.strm.avail_out===0))return I}return ve.insert=0,k===g?(q(ve,!0),ve.strm.avail_out===0?X:V):ve.last_lit&&(q(ve,!1),ve.strm.avail_out===0)?I:W})(Q,G):a[Q.level].func(Q,G);if(we!==X&&we!==V||(Q.status=666),we===I||we===X)return z.avail_out===0&&(Q.last_flush=-1),m;if(we===W&&(G===1?l._tr_align(Q):G!==5&&(l._tr_stored_block(Q,0,0,!1),G===3&&(se(Q.head),Q.lookahead===0&&(Q.strstart=0,Q.block_start=0,Q.insert=0))),H(z),z.avail_out===0))return Q.last_flush=-1,m}return G!==g?m:Q.wrap<=0?1:(Q.wrap===2?(re(Q,255&z.adler),re(Q,z.adler>>8&255),re(Q,z.adler>>16&255),re(Q,z.adler>>24&255),re(Q,255&z.total_in),re(Q,z.total_in>>8&255),re(Q,z.total_in>>16&255),re(Q,z.total_in>>24&255)):(ce(Q,z.adler>>>16),ce(Q,65535&z.adler)),H(z),0<Q.wrap&&(Q.wrap=-Q.wrap),Q.pending!==0?m:1)},r.deflateEnd=function(z){var G;return z&&z.state?(G=z.state.status)!==U&&G!==69&&G!==73&&G!==91&&G!==103&&G!==$&&G!==666?Y(z,b):(z.state=null,G===$?Y(z,-3):m):b},r.deflateSetDictionary=function(z,G){var ne,Q,ee,ae,ie,we,ve,k,O=G.length;if(!z||!z.state||(ae=(ne=z.state).wrap)===2||ae===1&&ne.status!==U||ne.lookahead)return b;for(ae===1&&(z.adler=c(z.adler,G,O,0)),ne.wrap=0,O>=ne.w_size&&(ae===0&&(se(ne.head),ne.strstart=0,ne.block_start=0,ne.insert=0),k=new s.Buf8(ne.w_size),s.arraySet(k,G,O-ne.w_size,ne.w_size,0),G=k,O=ne.w_size),ie=z.avail_in,we=z.next_in,ve=z.input,z.avail_in=O,z.next_in=0,z.input=G,me(ne);ne.lookahead>=P;){for(Q=ne.strstart,ee=ne.lookahead-(P-1);ne.ins_h=(ne.ins_h<<ne.hash_shift^ne.window[Q+P-1])&ne.hash_mask,ne.prev[Q&ne.w_mask]=ne.head[ne.ins_h],ne.head[ne.ins_h]=Q,Q++,--ee;);ne.strstart=Q,ne.lookahead=P-1,me(ne)}return ne.strstart+=ne.lookahead,ne.block_start=ne.strstart,ne.insert=ne.lookahead,ne.lookahead=0,ne.match_length=ne.prev_length=P-1,ne.match_available=0,z.next_in=we,z.input=ve,z.avail_in=ie,ne.wrap=ae,m},r.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./messages":51,"./trees":52}],47:[function(n,i,r){i.exports=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}},{}],48:[function(n,i,r){i.exports=function(a,s){var l,c,d,f,h,g,m,b,y,x,v,w,S,A,R,N,C,F,P,L,B,U,$,I,W;l=a.state,c=a.next_in,I=a.input,d=c+(a.avail_in-5),f=a.next_out,W=a.output,h=f-(s-a.avail_out),g=f+(a.avail_out-257),m=l.dmax,b=l.wsize,y=l.whave,x=l.wnext,v=l.window,w=l.hold,S=l.bits,A=l.lencode,R=l.distcode,N=(1<<l.lenbits)-1,C=(1<<l.distbits)-1;e:do{S<15&&(w+=I[c++]<<S,S+=8,w+=I[c++]<<S,S+=8),F=A[w&N];t:for(;;){if(w>>>=P=F>>>24,S-=P,(P=F>>>16&255)===0)W[f++]=65535&F;else{if(!(16&P)){if((64&P)==0){F=A[(65535&F)+(w&(1<<P)-1)];continue t}if(32&P){l.mode=12;break e}a.msg="invalid literal/length code",l.mode=30;break e}L=65535&F,(P&=15)&&(S<P&&(w+=I[c++]<<S,S+=8),L+=w&(1<<P)-1,w>>>=P,S-=P),S<15&&(w+=I[c++]<<S,S+=8,w+=I[c++]<<S,S+=8),F=R[w&C];n:for(;;){if(w>>>=P=F>>>24,S-=P,!(16&(P=F>>>16&255))){if((64&P)==0){F=R[(65535&F)+(w&(1<<P)-1)];continue n}a.msg="invalid distance code",l.mode=30;break e}if(B=65535&F,S<(P&=15)&&(w+=I[c++]<<S,(S+=8)<P&&(w+=I[c++]<<S,S+=8)),m<(B+=w&(1<<P)-1)){a.msg="invalid distance too far back",l.mode=30;break e}if(w>>>=P,S-=P,(P=f-h)<B){if(y<(P=B-P)&&l.sane){a.msg="invalid distance too far back",l.mode=30;break e}if($=v,(U=0)===x){if(U+=b-P,P<L){for(L-=P;W[f++]=v[U++],--P;);U=f-B,$=W}}else if(x<P){if(U+=b+x-P,(P-=x)<L){for(L-=P;W[f++]=v[U++],--P;);if(U=0,x<L){for(L-=P=x;W[f++]=v[U++],--P;);U=f-B,$=W}}}else if(U+=x-P,P<L){for(L-=P;W[f++]=v[U++],--P;);U=f-B,$=W}for(;2<L;)W[f++]=$[U++],W[f++]=$[U++],W[f++]=$[U++],L-=3;L&&(W[f++]=$[U++],1<L&&(W[f++]=$[U++]))}else{for(U=f-B;W[f++]=W[U++],W[f++]=W[U++],W[f++]=W[U++],2<(L-=3););L&&(W[f++]=W[U++],1<L&&(W[f++]=W[U++]))}break}}break}}while(c<d&&f<g);c-=L=S>>3,w&=(1<<(S-=L<<3))-1,a.next_in=c,a.next_out=f,a.avail_in=c<d?d-c+5:5-(c-d),a.avail_out=f<g?g-f+257:257-(f-g),l.hold=w,l.bits=S}},{}],49:[function(n,i,r){var a=n("../utils/common"),s=n("./adler32"),l=n("./crc32"),c=n("./inffast"),d=n("./inftrees"),f=1,h=2,g=0,m=-2,b=1,y=852,x=592;function v(U){return(U>>>24&255)+(U>>>8&65280)+((65280&U)<<8)+((255&U)<<24)}function w(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new a.Buf16(320),this.work=new a.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function S(U){var $;return U&&U.state?($=U.state,U.total_in=U.total_out=$.total=0,U.msg="",$.wrap&&(U.adler=1&$.wrap),$.mode=b,$.last=0,$.havedict=0,$.dmax=32768,$.head=null,$.hold=0,$.bits=0,$.lencode=$.lendyn=new a.Buf32(y),$.distcode=$.distdyn=new a.Buf32(x),$.sane=1,$.back=-1,g):m}function A(U){var $;return U&&U.state?(($=U.state).wsize=0,$.whave=0,$.wnext=0,S(U)):m}function R(U,$){var I,W;return U&&U.state?(W=U.state,$<0?(I=0,$=-$):(I=1+($>>4),$<48&&($&=15)),$&&($<8||15<$)?m:(W.window!==null&&W.wbits!==$&&(W.window=null),W.wrap=I,W.wbits=$,A(U))):m}function N(U,$){var I,W;return U?(W=new w,(U.state=W).window=null,(I=R(U,$))!==g&&(U.state=null),I):m}var C,F,P=!0;function L(U){if(P){var $;for(C=new a.Buf32(512),F=new a.Buf32(32),$=0;$<144;)U.lens[$++]=8;for(;$<256;)U.lens[$++]=9;for(;$<280;)U.lens[$++]=7;for(;$<288;)U.lens[$++]=8;for(d(f,U.lens,0,288,C,0,U.work,{bits:9}),$=0;$<32;)U.lens[$++]=5;d(h,U.lens,0,32,F,0,U.work,{bits:5}),P=!1}U.lencode=C,U.lenbits=9,U.distcode=F,U.distbits=5}function B(U,$,I,W){var X,V=U.state;return V.window===null&&(V.wsize=1<<V.wbits,V.wnext=0,V.whave=0,V.window=new a.Buf8(V.wsize)),W>=V.wsize?(a.arraySet(V.window,$,I-V.wsize,V.wsize,0),V.wnext=0,V.whave=V.wsize):(W<(X=V.wsize-V.wnext)&&(X=W),a.arraySet(V.window,$,I-W,X,V.wnext),(W-=X)?(a.arraySet(V.window,$,I-W,W,0),V.wnext=W,V.whave=V.wsize):(V.wnext+=X,V.wnext===V.wsize&&(V.wnext=0),V.whave<V.wsize&&(V.whave+=X))),0}r.inflateReset=A,r.inflateReset2=R,r.inflateResetKeep=S,r.inflateInit=function(U){return N(U,15)},r.inflateInit2=N,r.inflate=function(U,$){var I,W,X,V,Y,J,se,H,q,re,ce,ye,me,be,Ne,he,Ae,Be,le,lt,z,G,ne,Q,ee=0,ae=new a.Buf8(4),ie=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!U||!U.state||!U.output||!U.input&&U.avail_in!==0)return m;(I=U.state).mode===12&&(I.mode=13),Y=U.next_out,X=U.output,se=U.avail_out,V=U.next_in,W=U.input,J=U.avail_in,H=I.hold,q=I.bits,re=J,ce=se,G=g;e:for(;;)switch(I.mode){case b:if(I.wrap===0){I.mode=13;break}for(;q<16;){if(J===0)break e;J--,H+=W[V++]<<q,q+=8}if(2&I.wrap&&H===35615){ae[I.check=0]=255&H,ae[1]=H>>>8&255,I.check=l(I.check,ae,2,0),q=H=0,I.mode=2;break}if(I.flags=0,I.head&&(I.head.done=!1),!(1&I.wrap)||(((255&H)<<8)+(H>>8))%31){U.msg="incorrect header check",I.mode=30;break}if((15&H)!=8){U.msg="unknown compression method",I.mode=30;break}if(q-=4,z=8+(15&(H>>>=4)),I.wbits===0)I.wbits=z;else if(z>I.wbits){U.msg="invalid window size",I.mode=30;break}I.dmax=1<<z,U.adler=I.check=1,I.mode=512&H?10:12,q=H=0;break;case 2:for(;q<16;){if(J===0)break e;J--,H+=W[V++]<<q,q+=8}if(I.flags=H,(255&I.flags)!=8){U.msg="unknown compression method",I.mode=30;break}if(57344&I.flags){U.msg="unknown header flags set",I.mode=30;break}I.head&&(I.head.text=H>>8&1),512&I.flags&&(ae[0]=255&H,ae[1]=H>>>8&255,I.check=l(I.check,ae,2,0)),q=H=0,I.mode=3;case 3:for(;q<32;){if(J===0)break e;J--,H+=W[V++]<<q,q+=8}I.head&&(I.head.time=H),512&I.flags&&(ae[0]=255&H,ae[1]=H>>>8&255,ae[2]=H>>>16&255,ae[3]=H>>>24&255,I.check=l(I.check,ae,4,0)),q=H=0,I.mode=4;case 4:for(;q<16;){if(J===0)break e;J--,H+=W[V++]<<q,q+=8}I.head&&(I.head.xflags=255&H,I.head.os=H>>8),512&I.flags&&(ae[0]=255&H,ae[1]=H>>>8&255,I.check=l(I.check,ae,2,0)),q=H=0,I.mode=5;case 5:if(1024&I.flags){for(;q<16;){if(J===0)break e;J--,H+=W[V++]<<q,q+=8}I.length=H,I.head&&(I.head.extra_len=H),512&I.flags&&(ae[0]=255&H,ae[1]=H>>>8&255,I.check=l(I.check,ae,2,0)),q=H=0}else I.head&&(I.head.extra=null);I.mode=6;case 6:if(1024&I.flags&&(J<(ye=I.length)&&(ye=J),ye&&(I.head&&(z=I.head.extra_len-I.length,I.head.extra||(I.head.extra=new Array(I.head.extra_len)),a.arraySet(I.head.extra,W,V,ye,z)),512&I.flags&&(I.check=l(I.check,W,ye,V)),J-=ye,V+=ye,I.length-=ye),I.length))break e;I.length=0,I.mode=7;case 7:if(2048&I.flags){if(J===0)break e;for(ye=0;z=W[V+ye++],I.head&&z&&I.length<65536&&(I.head.name+=String.fromCharCode(z)),z&&ye<J;);if(512&I.flags&&(I.check=l(I.check,W,ye,V)),J-=ye,V+=ye,z)break e}else I.head&&(I.head.name=null);I.length=0,I.mode=8;case 8:if(4096&I.flags){if(J===0)break e;for(ye=0;z=W[V+ye++],I.head&&z&&I.length<65536&&(I.head.comment+=String.fromCharCode(z)),z&&ye<J;);if(512&I.flags&&(I.check=l(I.check,W,ye,V)),J-=ye,V+=ye,z)break e}else I.head&&(I.head.comment=null);I.mode=9;case 9:if(512&I.flags){for(;q<16;){if(J===0)break e;J--,H+=W[V++]<<q,q+=8}if(H!==(65535&I.check)){U.msg="header crc mismatch",I.mode=30;break}q=H=0}I.head&&(I.head.hcrc=I.flags>>9&1,I.head.done=!0),U.adler=I.check=0,I.mode=12;break;case 10:for(;q<32;){if(J===0)break e;J--,H+=W[V++]<<q,q+=8}U.adler=I.check=v(H),q=H=0,I.mode=11;case 11:if(I.havedict===0)return U.next_out=Y,U.avail_out=se,U.next_in=V,U.avail_in=J,I.hold=H,I.bits=q,2;U.adler=I.check=1,I.mode=12;case 12:if($===5||$===6)break e;case 13:if(I.last){H>>>=7&q,q-=7&q,I.mode=27;break}for(;q<3;){if(J===0)break e;J--,H+=W[V++]<<q,q+=8}switch(I.last=1&H,q-=1,3&(H>>>=1)){case 0:I.mode=14;break;case 1:if(L(I),I.mode=20,$!==6)break;H>>>=2,q-=2;break e;case 2:I.mode=17;break;case 3:U.msg="invalid block type",I.mode=30}H>>>=2,q-=2;break;case 14:for(H>>>=7&q,q-=7&q;q<32;){if(J===0)break e;J--,H+=W[V++]<<q,q+=8}if((65535&H)!=(H>>>16^65535)){U.msg="invalid stored block lengths",I.mode=30;break}if(I.length=65535&H,q=H=0,I.mode=15,$===6)break e;case 15:I.mode=16;case 16:if(ye=I.length){if(J<ye&&(ye=J),se<ye&&(ye=se),ye===0)break e;a.arraySet(X,W,V,ye,Y),J-=ye,V+=ye,se-=ye,Y+=ye,I.length-=ye;break}I.mode=12;break;case 17:for(;q<14;){if(J===0)break e;J--,H+=W[V++]<<q,q+=8}if(I.nlen=257+(31&H),H>>>=5,q-=5,I.ndist=1+(31&H),H>>>=5,q-=5,I.ncode=4+(15&H),H>>>=4,q-=4,286<I.nlen||30<I.ndist){U.msg="too many length or distance symbols",I.mode=30;break}I.have=0,I.mode=18;case 18:for(;I.have<I.ncode;){for(;q<3;){if(J===0)break e;J--,H+=W[V++]<<q,q+=8}I.lens[ie[I.have++]]=7&H,H>>>=3,q-=3}for(;I.have<19;)I.lens[ie[I.have++]]=0;if(I.lencode=I.lendyn,I.lenbits=7,ne={bits:I.lenbits},G=d(0,I.lens,0,19,I.lencode,0,I.work,ne),I.lenbits=ne.bits,G){U.msg="invalid code lengths set",I.mode=30;break}I.have=0,I.mode=19;case 19:for(;I.have<I.nlen+I.ndist;){for(;he=(ee=I.lencode[H&(1<<I.lenbits)-1])>>>16&255,Ae=65535&ee,!((Ne=ee>>>24)<=q);){if(J===0)break e;J--,H+=W[V++]<<q,q+=8}if(Ae<16)H>>>=Ne,q-=Ne,I.lens[I.have++]=Ae;else{if(Ae===16){for(Q=Ne+2;q<Q;){if(J===0)break e;J--,H+=W[V++]<<q,q+=8}if(H>>>=Ne,q-=Ne,I.have===0){U.msg="invalid bit length repeat",I.mode=30;break}z=I.lens[I.have-1],ye=3+(3&H),H>>>=2,q-=2}else if(Ae===17){for(Q=Ne+3;q<Q;){if(J===0)break e;J--,H+=W[V++]<<q,q+=8}q-=Ne,z=0,ye=3+(7&(H>>>=Ne)),H>>>=3,q-=3}else{for(Q=Ne+7;q<Q;){if(J===0)break e;J--,H+=W[V++]<<q,q+=8}q-=Ne,z=0,ye=11+(127&(H>>>=Ne)),H>>>=7,q-=7}if(I.have+ye>I.nlen+I.ndist){U.msg="invalid bit length repeat",I.mode=30;break}for(;ye--;)I.lens[I.have++]=z}}if(I.mode===30)break;if(I.lens[256]===0){U.msg="invalid code -- missing end-of-block",I.mode=30;break}if(I.lenbits=9,ne={bits:I.lenbits},G=d(f,I.lens,0,I.nlen,I.lencode,0,I.work,ne),I.lenbits=ne.bits,G){U.msg="invalid literal/lengths set",I.mode=30;break}if(I.distbits=6,I.distcode=I.distdyn,ne={bits:I.distbits},G=d(h,I.lens,I.nlen,I.ndist,I.distcode,0,I.work,ne),I.distbits=ne.bits,G){U.msg="invalid distances set",I.mode=30;break}if(I.mode=20,$===6)break e;case 20:I.mode=21;case 21:if(6<=J&&258<=se){U.next_out=Y,U.avail_out=se,U.next_in=V,U.avail_in=J,I.hold=H,I.bits=q,c(U,ce),Y=U.next_out,X=U.output,se=U.avail_out,V=U.next_in,W=U.input,J=U.avail_in,H=I.hold,q=I.bits,I.mode===12&&(I.back=-1);break}for(I.back=0;he=(ee=I.lencode[H&(1<<I.lenbits)-1])>>>16&255,Ae=65535&ee,!((Ne=ee>>>24)<=q);){if(J===0)break e;J--,H+=W[V++]<<q,q+=8}if(he&&(240&he)==0){for(Be=Ne,le=he,lt=Ae;he=(ee=I.lencode[lt+((H&(1<<Be+le)-1)>>Be)])>>>16&255,Ae=65535&ee,!(Be+(Ne=ee>>>24)<=q);){if(J===0)break e;J--,H+=W[V++]<<q,q+=8}H>>>=Be,q-=Be,I.back+=Be}if(H>>>=Ne,q-=Ne,I.back+=Ne,I.length=Ae,he===0){I.mode=26;break}if(32&he){I.back=-1,I.mode=12;break}if(64&he){U.msg="invalid literal/length code",I.mode=30;break}I.extra=15&he,I.mode=22;case 22:if(I.extra){for(Q=I.extra;q<Q;){if(J===0)break e;J--,H+=W[V++]<<q,q+=8}I.length+=H&(1<<I.extra)-1,H>>>=I.extra,q-=I.extra,I.back+=I.extra}I.was=I.length,I.mode=23;case 23:for(;he=(ee=I.distcode[H&(1<<I.distbits)-1])>>>16&255,Ae=65535&ee,!((Ne=ee>>>24)<=q);){if(J===0)break e;J--,H+=W[V++]<<q,q+=8}if((240&he)==0){for(Be=Ne,le=he,lt=Ae;he=(ee=I.distcode[lt+((H&(1<<Be+le)-1)>>Be)])>>>16&255,Ae=65535&ee,!(Be+(Ne=ee>>>24)<=q);){if(J===0)break e;J--,H+=W[V++]<<q,q+=8}H>>>=Be,q-=Be,I.back+=Be}if(H>>>=Ne,q-=Ne,I.back+=Ne,64&he){U.msg="invalid distance code",I.mode=30;break}I.offset=Ae,I.extra=15&he,I.mode=24;case 24:if(I.extra){for(Q=I.extra;q<Q;){if(J===0)break e;J--,H+=W[V++]<<q,q+=8}I.offset+=H&(1<<I.extra)-1,H>>>=I.extra,q-=I.extra,I.back+=I.extra}if(I.offset>I.dmax){U.msg="invalid distance too far back",I.mode=30;break}I.mode=25;case 25:if(se===0)break e;if(ye=ce-se,I.offset>ye){if((ye=I.offset-ye)>I.whave&&I.sane){U.msg="invalid distance too far back",I.mode=30;break}me=ye>I.wnext?(ye-=I.wnext,I.wsize-ye):I.wnext-ye,ye>I.length&&(ye=I.length),be=I.window}else be=X,me=Y-I.offset,ye=I.length;for(se<ye&&(ye=se),se-=ye,I.length-=ye;X[Y++]=be[me++],--ye;);I.length===0&&(I.mode=21);break;case 26:if(se===0)break e;X[Y++]=I.length,se--,I.mode=21;break;case 27:if(I.wrap){for(;q<32;){if(J===0)break e;J--,H|=W[V++]<<q,q+=8}if(ce-=se,U.total_out+=ce,I.total+=ce,ce&&(U.adler=I.check=I.flags?l(I.check,X,ce,Y-ce):s(I.check,X,ce,Y-ce)),ce=se,(I.flags?H:v(H))!==I.check){U.msg="incorrect data check",I.mode=30;break}q=H=0}I.mode=28;case 28:if(I.wrap&&I.flags){for(;q<32;){if(J===0)break e;J--,H+=W[V++]<<q,q+=8}if(H!==(4294967295&I.total)){U.msg="incorrect length check",I.mode=30;break}q=H=0}I.mode=29;case 29:G=1;break e;case 30:G=-3;break e;case 31:return-4;case 32:default:return m}return U.next_out=Y,U.avail_out=se,U.next_in=V,U.avail_in=J,I.hold=H,I.bits=q,(I.wsize||ce!==U.avail_out&&I.mode<30&&(I.mode<27||$!==4))&&B(U,U.output,U.next_out,ce-U.avail_out)?(I.mode=31,-4):(re-=U.avail_in,ce-=U.avail_out,U.total_in+=re,U.total_out+=ce,I.total+=ce,I.wrap&&ce&&(U.adler=I.check=I.flags?l(I.check,X,ce,U.next_out-ce):s(I.check,X,ce,U.next_out-ce)),U.data_type=I.bits+(I.last?64:0)+(I.mode===12?128:0)+(I.mode===20||I.mode===15?256:0),(re==0&&ce===0||$===4)&&G===g&&(G=-5),G)},r.inflateEnd=function(U){if(!U||!U.state)return m;var $=U.state;return $.window&&($.window=null),U.state=null,g},r.inflateGetHeader=function(U,$){var I;return U&&U.state?(2&(I=U.state).wrap)==0?m:((I.head=$).done=!1,g):m},r.inflateSetDictionary=function(U,$){var I,W=$.length;return U&&U.state?(I=U.state).wrap!==0&&I.mode!==11?m:I.mode===11&&s(1,$,W,0)!==I.check?-3:B(U,$,W,W)?(I.mode=31,-4):(I.havedict=1,g):m},r.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./inffast":48,"./inftrees":50}],50:[function(n,i,r){var a=n("../utils/common"),s=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],l=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],c=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],d=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];i.exports=function(f,h,g,m,b,y,x,v){var w,S,A,R,N,C,F,P,L,B=v.bits,U=0,$=0,I=0,W=0,X=0,V=0,Y=0,J=0,se=0,H=0,q=null,re=0,ce=new a.Buf16(16),ye=new a.Buf16(16),me=null,be=0;for(U=0;U<=15;U++)ce[U]=0;for($=0;$<m;$++)ce[h[g+$]]++;for(X=B,W=15;1<=W&&ce[W]===0;W--);if(W<X&&(X=W),W===0)return b[y++]=20971520,b[y++]=20971520,v.bits=1,0;for(I=1;I<W&&ce[I]===0;I++);for(X<I&&(X=I),U=J=1;U<=15;U++)if(J<<=1,(J-=ce[U])<0)return-1;if(0<J&&(f===0||W!==1))return-1;for(ye[1]=0,U=1;U<15;U++)ye[U+1]=ye[U]+ce[U];for($=0;$<m;$++)h[g+$]!==0&&(x[ye[h[g+$]]++]=$);if(C=f===0?(q=me=x,19):f===1?(q=s,re-=257,me=l,be-=257,256):(q=c,me=d,-1),U=I,N=y,Y=$=H=0,A=-1,R=(se=1<<(V=X))-1,f===1&&852<se||f===2&&592<se)return 1;for(;;){for(F=U-Y,L=x[$]<C?(P=0,x[$]):x[$]>C?(P=me[be+x[$]],q[re+x[$]]):(P=96,0),w=1<<U-Y,I=S=1<<V;b[N+(H>>Y)+(S-=w)]=F<<24|P<<16|L|0,S!==0;);for(w=1<<U-1;H&w;)w>>=1;if(w!==0?(H&=w-1,H+=w):H=0,$++,--ce[U]==0){if(U===W)break;U=h[g+x[$]]}if(X<U&&(H&R)!==A){for(Y===0&&(Y=X),N+=I,J=1<<(V=U-Y);V+Y<W&&!((J-=ce[V+Y])<=0);)V++,J<<=1;if(se+=1<<V,f===1&&852<se||f===2&&592<se)return 1;b[A=H&R]=X<<24|V<<16|N-y|0}}return H!==0&&(b[N+H]=U-Y<<24|64<<16|0),v.bits=X,0}},{"../utils/common":41}],51:[function(n,i,r){i.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},{}],52:[function(n,i,r){var a=n("../utils/common"),s=0,l=1;function c(ee){for(var ae=ee.length;0<=--ae;)ee[ae]=0}var d=0,f=29,h=256,g=h+1+f,m=30,b=19,y=2*g+1,x=15,v=16,w=7,S=256,A=16,R=17,N=18,C=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],F=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],P=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],L=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],B=new Array(2*(g+2));c(B);var U=new Array(2*m);c(U);var $=new Array(512);c($);var I=new Array(256);c(I);var W=new Array(f);c(W);var X,V,Y,J=new Array(m);function se(ee,ae,ie,we,ve){this.static_tree=ee,this.extra_bits=ae,this.extra_base=ie,this.elems=we,this.max_length=ve,this.has_stree=ee&&ee.length}function H(ee,ae){this.dyn_tree=ee,this.max_code=0,this.stat_desc=ae}function q(ee){return ee<256?$[ee]:$[256+(ee>>>7)]}function re(ee,ae){ee.pending_buf[ee.pending++]=255&ae,ee.pending_buf[ee.pending++]=ae>>>8&255}function ce(ee,ae,ie){ee.bi_valid>v-ie?(ee.bi_buf|=ae<<ee.bi_valid&65535,re(ee,ee.bi_buf),ee.bi_buf=ae>>v-ee.bi_valid,ee.bi_valid+=ie-v):(ee.bi_buf|=ae<<ee.bi_valid&65535,ee.bi_valid+=ie)}function ye(ee,ae,ie){ce(ee,ie[2*ae],ie[2*ae+1])}function me(ee,ae){for(var ie=0;ie|=1&ee,ee>>>=1,ie<<=1,0<--ae;);return ie>>>1}function be(ee,ae,ie){var we,ve,k=new Array(x+1),O=0;for(we=1;we<=x;we++)k[we]=O=O+ie[we-1]<<1;for(ve=0;ve<=ae;ve++){var K=ee[2*ve+1];K!==0&&(ee[2*ve]=me(k[K]++,K))}}function Ne(ee){var ae;for(ae=0;ae<g;ae++)ee.dyn_ltree[2*ae]=0;for(ae=0;ae<m;ae++)ee.dyn_dtree[2*ae]=0;for(ae=0;ae<b;ae++)ee.bl_tree[2*ae]=0;ee.dyn_ltree[2*S]=1,ee.opt_len=ee.static_len=0,ee.last_lit=ee.matches=0}function he(ee){8<ee.bi_valid?re(ee,ee.bi_buf):0<ee.bi_valid&&(ee.pending_buf[ee.pending++]=ee.bi_buf),ee.bi_buf=0,ee.bi_valid=0}function Ae(ee,ae,ie,we){var ve=2*ae,k=2*ie;return ee[ve]<ee[k]||ee[ve]===ee[k]&&we[ae]<=we[ie]}function Be(ee,ae,ie){for(var we=ee.heap[ie],ve=ie<<1;ve<=ee.heap_len&&(ve<ee.heap_len&&Ae(ae,ee.heap[ve+1],ee.heap[ve],ee.depth)&&ve++,!Ae(ae,we,ee.heap[ve],ee.depth));)ee.heap[ie]=ee.heap[ve],ie=ve,ve<<=1;ee.heap[ie]=we}function le(ee,ae,ie){var we,ve,k,O,K=0;if(ee.last_lit!==0)for(;we=ee.pending_buf[ee.d_buf+2*K]<<8|ee.pending_buf[ee.d_buf+2*K+1],ve=ee.pending_buf[ee.l_buf+K],K++,we===0?ye(ee,ve,ae):(ye(ee,(k=I[ve])+h+1,ae),(O=C[k])!==0&&ce(ee,ve-=W[k],O),ye(ee,k=q(--we),ie),(O=F[k])!==0&&ce(ee,we-=J[k],O)),K<ee.last_lit;);ye(ee,S,ae)}function lt(ee,ae){var ie,we,ve,k=ae.dyn_tree,O=ae.stat_desc.static_tree,K=ae.stat_desc.has_stree,pe=ae.stat_desc.elems,xe=-1;for(ee.heap_len=0,ee.heap_max=y,ie=0;ie<pe;ie++)k[2*ie]!==0?(ee.heap[++ee.heap_len]=xe=ie,ee.depth[ie]=0):k[2*ie+1]=0;for(;ee.heap_len<2;)k[2*(ve=ee.heap[++ee.heap_len]=xe<2?++xe:0)]=1,ee.depth[ve]=0,ee.opt_len--,K&&(ee.static_len-=O[2*ve+1]);for(ae.max_code=xe,ie=ee.heap_len>>1;1<=ie;ie--)Be(ee,k,ie);for(ve=pe;ie=ee.heap[1],ee.heap[1]=ee.heap[ee.heap_len--],Be(ee,k,1),we=ee.heap[1],ee.heap[--ee.heap_max]=ie,ee.heap[--ee.heap_max]=we,k[2*ve]=k[2*ie]+k[2*we],ee.depth[ve]=(ee.depth[ie]>=ee.depth[we]?ee.depth[ie]:ee.depth[we])+1,k[2*ie+1]=k[2*we+1]=ve,ee.heap[1]=ve++,Be(ee,k,1),2<=ee.heap_len;);ee.heap[--ee.heap_max]=ee.heap[1],(function(fe,Ke){var Ie,$e,rt,ke,De,ct,et=Ke.dyn_tree,Je=Ke.max_code,st=Ke.stat_desc.static_tree,ue=Ke.stat_desc.has_stree,tt=Ke.stat_desc.extra_bits,de=Ke.stat_desc.extra_base,Le=Ke.stat_desc.max_length,Me=0;for(ke=0;ke<=x;ke++)fe.bl_count[ke]=0;for(et[2*fe.heap[fe.heap_max]+1]=0,Ie=fe.heap_max+1;Ie<y;Ie++)Le<(ke=et[2*et[2*($e=fe.heap[Ie])+1]+1]+1)&&(ke=Le,Me++),et[2*$e+1]=ke,Je<$e||(fe.bl_count[ke]++,De=0,de<=$e&&(De=tt[$e-de]),ct=et[2*$e],fe.opt_len+=ct*(ke+De),ue&&(fe.static_len+=ct*(st[2*$e+1]+De)));if(Me!==0){do{for(ke=Le-1;fe.bl_count[ke]===0;)ke--;fe.bl_count[ke]--,fe.bl_count[ke+1]+=2,fe.bl_count[Le]--,Me-=2}while(0<Me);for(ke=Le;ke!==0;ke--)for($e=fe.bl_count[ke];$e!==0;)Je<(rt=fe.heap[--Ie])||(et[2*rt+1]!==ke&&(fe.opt_len+=(ke-et[2*rt+1])*et[2*rt],et[2*rt+1]=ke),$e--)}})(ee,ae),be(k,xe,ee.bl_count)}function z(ee,ae,ie){var we,ve,k=-1,O=ae[1],K=0,pe=7,xe=4;for(O===0&&(pe=138,xe=3),ae[2*(ie+1)+1]=65535,we=0;we<=ie;we++)ve=O,O=ae[2*(we+1)+1],++K<pe&&ve===O||(K<xe?ee.bl_tree[2*ve]+=K:ve!==0?(ve!==k&&ee.bl_tree[2*ve]++,ee.bl_tree[2*A]++):K<=10?ee.bl_tree[2*R]++:ee.bl_tree[2*N]++,k=ve,xe=(K=0)===O?(pe=138,3):ve===O?(pe=6,3):(pe=7,4))}function G(ee,ae,ie){var we,ve,k=-1,O=ae[1],K=0,pe=7,xe=4;for(O===0&&(pe=138,xe=3),we=0;we<=ie;we++)if(ve=O,O=ae[2*(we+1)+1],!(++K<pe&&ve===O)){if(K<xe)for(;ye(ee,ve,ee.bl_tree),--K!=0;);else ve!==0?(ve!==k&&(ye(ee,ve,ee.bl_tree),K--),ye(ee,A,ee.bl_tree),ce(ee,K-3,2)):K<=10?(ye(ee,R,ee.bl_tree),ce(ee,K-3,3)):(ye(ee,N,ee.bl_tree),ce(ee,K-11,7));k=ve,xe=(K=0)===O?(pe=138,3):ve===O?(pe=6,3):(pe=7,4)}}c(J);var ne=!1;function Q(ee,ae,ie,we){ce(ee,(d<<1)+(we?1:0),3),(function(ve,k,O,K){he(ve),re(ve,O),re(ve,~O),a.arraySet(ve.pending_buf,ve.window,k,O,ve.pending),ve.pending+=O})(ee,ae,ie)}r._tr_init=function(ee){ne||((function(){var ae,ie,we,ve,k,O=new Array(x+1);for(ve=we=0;ve<f-1;ve++)for(W[ve]=we,ae=0;ae<1<<C[ve];ae++)I[we++]=ve;for(I[we-1]=ve,ve=k=0;ve<16;ve++)for(J[ve]=k,ae=0;ae<1<<F[ve];ae++)$[k++]=ve;for(k>>=7;ve<m;ve++)for(J[ve]=k<<7,ae=0;ae<1<<F[ve]-7;ae++)$[256+k++]=ve;for(ie=0;ie<=x;ie++)O[ie]=0;for(ae=0;ae<=143;)B[2*ae+1]=8,ae++,O[8]++;for(;ae<=255;)B[2*ae+1]=9,ae++,O[9]++;for(;ae<=279;)B[2*ae+1]=7,ae++,O[7]++;for(;ae<=287;)B[2*ae+1]=8,ae++,O[8]++;for(be(B,g+1,O),ae=0;ae<m;ae++)U[2*ae+1]=5,U[2*ae]=me(ae,5);X=new se(B,C,h+1,g,x),V=new se(U,F,0,m,x),Y=new se(new Array(0),P,0,b,w)})(),ne=!0),ee.l_desc=new H(ee.dyn_ltree,X),ee.d_desc=new H(ee.dyn_dtree,V),ee.bl_desc=new H(ee.bl_tree,Y),ee.bi_buf=0,ee.bi_valid=0,Ne(ee)},r._tr_stored_block=Q,r._tr_flush_block=function(ee,ae,ie,we){var ve,k,O=0;0<ee.level?(ee.strm.data_type===2&&(ee.strm.data_type=(function(K){var pe,xe=4093624447;for(pe=0;pe<=31;pe++,xe>>>=1)if(1&xe&&K.dyn_ltree[2*pe]!==0)return s;if(K.dyn_ltree[18]!==0||K.dyn_ltree[20]!==0||K.dyn_ltree[26]!==0)return l;for(pe=32;pe<h;pe++)if(K.dyn_ltree[2*pe]!==0)return l;return s})(ee)),lt(ee,ee.l_desc),lt(ee,ee.d_desc),O=(function(K){var pe;for(z(K,K.dyn_ltree,K.l_desc.max_code),z(K,K.dyn_dtree,K.d_desc.max_code),lt(K,K.bl_desc),pe=b-1;3<=pe&&K.bl_tree[2*L[pe]+1]===0;pe--);return K.opt_len+=3*(pe+1)+5+5+4,pe})(ee),ve=ee.opt_len+3+7>>>3,(k=ee.static_len+3+7>>>3)<=ve&&(ve=k)):ve=k=ie+5,ie+4<=ve&&ae!==-1?Q(ee,ae,ie,we):ee.strategy===4||k===ve?(ce(ee,2+(we?1:0),3),le(ee,B,U)):(ce(ee,4+(we?1:0),3),(function(K,pe,xe,fe){var Ke;for(ce(K,pe-257,5),ce(K,xe-1,5),ce(K,fe-4,4),Ke=0;Ke<fe;Ke++)ce(K,K.bl_tree[2*L[Ke]+1],3);G(K,K.dyn_ltree,pe-1),G(K,K.dyn_dtree,xe-1)})(ee,ee.l_desc.max_code+1,ee.d_desc.max_code+1,O+1),le(ee,ee.dyn_ltree,ee.dyn_dtree)),Ne(ee),we&&he(ee)},r._tr_tally=function(ee,ae,ie){return ee.pending_buf[ee.d_buf+2*ee.last_lit]=ae>>>8&255,ee.pending_buf[ee.d_buf+2*ee.last_lit+1]=255&ae,ee.pending_buf[ee.l_buf+ee.last_lit]=255&ie,ee.last_lit++,ae===0?ee.dyn_ltree[2*ie]++:(ee.matches++,ae--,ee.dyn_ltree[2*(I[ie]+h+1)]++,ee.dyn_dtree[2*q(ae)]++),ee.last_lit===ee.lit_bufsize-1},r._tr_align=function(ee){ce(ee,2,3),ye(ee,S,B),(function(ae){ae.bi_valid===16?(re(ae,ae.bi_buf),ae.bi_buf=0,ae.bi_valid=0):8<=ae.bi_valid&&(ae.pending_buf[ae.pending++]=255&ae.bi_buf,ae.bi_buf>>=8,ae.bi_valid-=8)})(ee)}},{"../utils/common":41}],53:[function(n,i,r){i.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(n,i,r){(function(a){(function(s,l){if(!s.setImmediate){var c,d,f,h,g=1,m={},b=!1,y=s.document,x=Object.getPrototypeOf&&Object.getPrototypeOf(s);x=x&&x.setTimeout?x:s,c={}.toString.call(s.process)==="[object process]"?function(A){process.nextTick(function(){w(A)})}:(function(){if(s.postMessage&&!s.importScripts){var A=!0,R=s.onmessage;return s.onmessage=function(){A=!1},s.postMessage("","*"),s.onmessage=R,A}})()?(h="setImmediate$"+Math.random()+"$",s.addEventListener?s.addEventListener("message",S,!1):s.attachEvent("onmessage",S),function(A){s.postMessage(h+A,"*")}):s.MessageChannel?((f=new MessageChannel).port1.onmessage=function(A){w(A.data)},function(A){f.port2.postMessage(A)}):y&&"onreadystatechange"in y.createElement("script")?(d=y.documentElement,function(A){var R=y.createElement("script");R.onreadystatechange=function(){w(A),R.onreadystatechange=null,d.removeChild(R),R=null},d.appendChild(R)}):function(A){setTimeout(w,0,A)},x.setImmediate=function(A){typeof A!="function"&&(A=new Function(""+A));for(var R=new Array(arguments.length-1),N=0;N<R.length;N++)R[N]=arguments[N+1];var C={callback:A,args:R};return m[g]=C,c(g),g++},x.clearImmediate=v}function v(A){delete m[A]}function w(A){if(b)setTimeout(w,0,A);else{var R=m[A];if(R){b=!0;try{(function(N){var C=N.callback,F=N.args;switch(F.length){case 0:C();break;case 1:C(F[0]);break;case 2:C(F[0],F[1]);break;case 3:C(F[0],F[1],F[2]);break;default:C.apply(l,F)}})(R)}finally{v(A),b=!1}}}}function S(A){A.source===s&&typeof A.data=="string"&&A.data.indexOf(h)===0&&w(+A.data.slice(h.length))}})(typeof self>"u"?a===void 0?this:a:self)}).call(this,typeof s0<"u"?s0:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})(o1)),o1.exports}var fte=dte();const hte=Xs(fte);function pte(t){const e=new bi;if(!t)return e;const n=t.trim().split(/\s+/).map(parseFloat);return n.length>=12&&e.set(n[0],n[1],n[2],n[9],n[3],n[4],n[5],n[10],n[6],n[7],n[8],n[11],0,0,0,1),e}const bO=pte;async function _O(t){const e=[],n=t.getElementsByTagName("mesh");for(let i=0;i<n.length;i++){const r=n[i],a=[],s=[],l=r.getElementsByTagName("vertex");for(let d=0;d<l.length;d++){const f=l[d];a.push(parseFloat(f.getAttribute("x")||"0"),parseFloat(f.getAttribute("y")||"0"),parseFloat(f.getAttribute("z")||"0"))}const c=r.getElementsByTagName("triangle");for(let d=0;d<c.length;d++){const f=c[d];s.push(parseInt(f.getAttribute("v1")||"0"),parseInt(f.getAttribute("v2")||"0"),parseInt(f.getAttribute("v3")||"0"))}a.length>0&&s.length>0&&e.push({vertices:a,triangles:s})}return e}async function mte(t){const e=await hte.loadAsync(t),n=new Map,i=[],r=new DOMParser;async function a(f){const h=f.startsWith("/")?f.slice(1):f,g=e.files[h];if(!g)return null;const m=await g.async("string");return r.parseFromString(m,"application/xml")}const s=Object.keys(e.files).find(f=>f==="3D/3dmodel.model"||f.endsWith("/3dmodel.model"));if(!s){const f=Object.keys(e.files).find(h=>h.endsWith(".model"));if(f){const h=await a(f);if(h){const g=await _O(h);g.length>0&&n.set("1",{id:"1",meshes:g})}}return{objects:n,buildItems:i}}const l=await a(s);if(!l)return{objects:n,buildItems:i};const c=l.getElementsByTagName("object");for(let f=0;f<c.length;f++){const h=c[f],g=h.getAttribute("id");if(!g)continue;const m=[],b=h.getElementsByTagName("mesh");for(let x=0;x<b.length;x++){const v=b[x],w=[],S=[],A=v.getElementsByTagName("vertex");for(let N=0;N<A.length;N++){const C=A[N];w.push(parseFloat(C.getAttribute("x")||"0"),parseFloat(C.getAttribute("y")||"0"),parseFloat(C.getAttribute("z")||"0"))}const R=v.getElementsByTagName("triangle");for(let N=0;N<R.length;N++){const C=R[N];S.push(parseInt(C.getAttribute("v1")||"0"),parseInt(C.getAttribute("v2")||"0"),parseInt(C.getAttribute("v3")||"0"))}w.length>0&&S.length>0&&m.push({vertices:w,triangles:S})}const y=h.getElementsByTagName("component");for(let x=0;x<y.length;x++){const v=y[x],w=v.getAttribute("p:path")||v.getAttributeNS("http://schemas.microsoft.com/3dmanufacturing/production/2015/06","path");if(w){const S=await a(w);if(S){const A=await _O(S),R=v.getAttribute("transform"),N=bO(R);for(const C of A)if(R){const F=[];for(let P=0;P<C.vertices.length;P+=3){const L=new Ve(C.vertices[P],C.vertices[P+1],C.vertices[P+2]);L.applyMatrix4(N),F.push(L.x,L.y,L.z)}m.push({vertices:F,triangles:C.triangles})}else m.push(C)}}}m.length>0&&n.set(g,{id:g,meshes:m})}const d=l.getElementsByTagName("build");if(d.length>0){const f=d[0].getElementsByTagName("item");for(let h=0;h<f.length;h++){const g=f[h],m=g.getAttribute("objectid");if(!m)continue;const b=bO(g.getAttribute("transform"));i.push({objectId:m,transform:b})}}return{objects:n,buildItems:i}}function SO(t){const e=new Ks,n=new Float32Array(t.vertices.length);for(let i=0;i<t.vertices.length;i+=3)n[i]=t.vertices[i],n[i+1]=t.vertices[i+2],n[i+2]=t.vertices[i+1];return e.setAttribute("position",new Xa(n,3)),e.setIndex(t.triangles),e.computeVertexNormals(),e}function gte({url:t,buildVolume:e={x:256,y:256,z:256},className:n=""}){const i=T.useRef(null),r=T.useRef(null),a=T.useRef(null),s=T.useRef(null),l=T.useRef(null),[c,d]=T.useState(!0),[f,h]=T.useState(null);T.useEffect(()=>{if(!i.current)return;const b=i.current,y=b.clientWidth,x=b.clientHeight,v=new XY;v.background=new nn(1710618),a.current=v;const w=new ja(45,y/x,.1,1e4);w.position.set(150,150,150),s.current=w;const S=new Yee({antialias:!0});S.setSize(y,x),S.setPixelRatio(window.devicePixelRatio),b.appendChild(S.domElement),r.current=S;const A=new Zee(w,S.domElement);A.enableDamping=!0,A.dampingFactor=.05,l.current=A;const R=new aK(16777215,.6);v.add(R);const N=new VN(16777215,.8);N.position.set(100,100,100),v.add(N);const C=new VN(16777215,.4);C.position.set(-100,50,-100),v.add(C);const F=Math.max(e.x,e.y),P=Math.ceil(F/16),L=new oK(F,P,4473924,3355443);v.add(L);const B=new DT(e.x,e.y),U=new CT({color:44610,transparent:!0,opacity:.15,side:Os}),$=new Hs(B,U);$.rotation.x=-Math.PI/2,$.position.y=-.5,v.add($);let I;const W=()=>{I=requestAnimationFrame(W),A.update(),S.render(v,w)};W(),fetch(t).then(V=>{if(!V.ok)throw new Error("Failed to load file");return V.arrayBuffer()}).then(mte).then(({objects:V,buildItems:Y})=>{if(V.size===0)throw new Error("No meshes found in 3MF file");const J=new eK({color:44610,shininess:30,flatShading:!1}),se=new xp,H=[];if(Y.length>0)for(const he of Y){const Ae=V.get(he.objectId);if(Ae)for(const Be of Ae.meshes){const le=[];for(let z=0;z<Be.vertices.length;z+=3){const G=new Ve(Be.vertices[z],Be.vertices[z+1],Be.vertices[z+2]);G.applyMatrix4(he.transform),le.push(G.x,G.y,G.z)}const lt=SO({vertices:le,triangles:Be.triangles});H.push(lt)}}else for(const he of V.values())for(const Ae of he.meshes){const Be=SO(Ae);H.push(Be)}if(H.length>0){const he=H.length===1?H[0]:ute(H,!1);if(he){const Ae=new Hs(he,J);se.add(Ae)}if(H.length>1)for(const Ae of H)Ae.dispose()}const q=new wu().setFromObject(se),re=q.getCenter(new Ve);se.position.y=-q.min.y,Y.length===0&&(se.position.x=-re.x,se.position.z=-re.z),v.add(se);const ce=new wu().setFromObject(se),ye=ce.getCenter(new Ve),me=ce.getSize(new Ve),Ne=Math.max(me.x,me.y,me.z)*1.8;w.position.set(ye.x+Ne*.7,ye.y+Ne*.5,ye.z+Ne*.7),A.target.copy(ye),A.update(),d(!1)}).catch(V=>{h(V.message),d(!1)});const X=()=>{if(!b)return;const V=b.clientWidth,Y=b.clientHeight;w.aspect=V/Y,w.updateProjectionMatrix(),S.setSize(V,Y)};return window.addEventListener("resize",X),()=>{window.removeEventListener("resize",X),cancelAnimationFrame(I),A.dispose(),S.dispose(),b.removeChild(S.domElement)}},[t,e]);const g=()=>{s.current&&l.current&&(s.current.position.set(150,150,150),l.current.target.set(0,50,0),l.current.update())},m=b=>{s.current&&s.current.position.multiplyScalar(b)};return E.jsxs("div",{className:`relative ${n}`,children:[E.jsx("div",{ref:i,className:"w-full h-full min-h-[400px]"}),c&&E.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-bambu-dark/80",children:E.jsx(pr,{className:"w-8 h-8 text-bambu-green animate-spin"})}),f&&E.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-bambu-dark/80",children:E.jsx("p",{className:"text-red-400",children:f})}),!c&&!f&&E.jsxs("div",{className:"absolute bottom-4 right-4 flex gap-2",children:[E.jsx(At,{variant:"secondary",size:"sm",onClick:()=>m(.8),children:E.jsx(dq,{className:"w-4 h-4"})}),E.jsx(At,{variant:"secondary",size:"sm",onClick:()=>m(1.25),children:E.jsx(hq,{className:"w-4 h-4"})}),E.jsx(At,{variant:"secondary",size:"sm",onClick:g,children:E.jsx(gT,{className:"w-4 h-4"})})]})]})}const gy="159",Pd={ROTATE:0,DOLLY:1,PAN:2},Dd={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},vte=0,wO=1,xte=2,EB=1,yte=2,Co=3,cc=0,Zr=1,Po=2,ic=0,cf=1,EO=2,MO=3,AO=4,bte=5,Jc=100,_te=101,Ste=102,TO=103,CO=104,wte=200,Ete=201,Mte=202,Ate=203,IM=204,UM=205,Tte=206,Cte=207,Rte=208,Pte=209,Dte=210,Nte=211,Ote=212,Lte=213,Ite=214,Ute=0,kte=1,Fte=2,rx=3,zte=4,Bte=5,jte=6,Hte=7,OT=0,Gte=1,Vte=2,rc=0,$te=1,Wte=2,Xte=3,qte=4,Yte=5,MB=300,Sf=301,wf=302,kM=303,FM=304,vy=306,zM=1e3,ds=1001,BM=1002,dr=1003,RO=1004,l1=1005,Ha=1006,Kte=1007,Vp=1008,ac=1009,Zte=1010,Qte=1011,LT=1012,AB=1013,Jl=1014,Io=1015,$p=1016,TB=1017,CB=1018,lu=1020,Jte=1021,Ga=1023,ene=1024,tne=1025,cu=1026,Ef=1027,nne=1028,RB=1029,ine=1030,PB=1031,DB=1033,c1=33776,u1=33777,d1=33778,f1=33779,PO=35840,DO=35841,NO=35842,OO=35843,NB=36196,LO=37492,IO=37496,UO=37808,kO=37809,FO=37810,zO=37811,BO=37812,jO=37813,HO=37814,GO=37815,VO=37816,$O=37817,WO=37818,XO=37819,qO=37820,YO=37821,h1=36492,KO=36494,ZO=36495,rne=36283,QO=36284,JO=36285,eL=36286,OB=3e3,uu=3001,ane=3200,sne=3201,LB=0,one=1,Va="",fr="srgb",Wo="srgb-linear",IT="display-p3",xy="display-p3-linear",ax="linear",Fn="srgb",sx="rec709",ox="p3",Nd=7680,tL=519,lne=512,cne=513,une=514,IB=515,dne=516,fne=517,hne=518,pne=519,jM=35044,nL="300 es",HM=1035,Us=2e3,Wp=2001;class Uu{addEventListener(e,n){this._listeners===void 0&&(this._listeners={});const i=this._listeners;i[e]===void 0&&(i[e]=[]),i[e].indexOf(n)===-1&&i[e].push(n)}hasEventListener(e,n){if(this._listeners===void 0)return!1;const i=this._listeners;return i[e]!==void 0&&i[e].indexOf(n)!==-1}removeEventListener(e,n){if(this._listeners===void 0)return;const r=this._listeners[e];if(r!==void 0){const a=r.indexOf(n);a!==-1&&r.splice(a,1)}}dispatchEvent(e){if(this._listeners===void 0)return;const i=this._listeners[e.type];if(i!==void 0){e.target=this;const r=i.slice(0);for(let a=0,s=r.length;a<s;a++)r[a].call(this,e);e.target=null}}}const yr=["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 iL=1234567;const Mp=Math.PI/180,Xp=180/Math.PI;function jo(){const t=Math.random()*4294967295|0,e=Math.random()*4294967295|0,n=Math.random()*4294967295|0,i=Math.random()*4294967295|0;return(yr[t&255]+yr[t>>8&255]+yr[t>>16&255]+yr[t>>24&255]+"-"+yr[e&255]+yr[e>>8&255]+"-"+yr[e>>16&15|64]+yr[e>>24&255]+"-"+yr[n&63|128]+yr[n>>8&255]+"-"+yr[n>>16&255]+yr[n>>24&255]+yr[i&255]+yr[i>>8&255]+yr[i>>16&255]+yr[i>>24&255]).toLowerCase()}function hr(t,e,n){return Math.max(e,Math.min(n,t))}function UT(t,e){return(t%e+e)%e}function mne(t,e,n,i,r){return i+(t-e)*(r-i)/(n-e)}function gne(t,e,n){return t!==e?(n-t)/(e-t):0}function Ap(t,e,n){return(1-n)*t+n*e}function vne(t,e,n,i){return Ap(t,e,1-Math.exp(-n*i))}function xne(t,e=1){return e-Math.abs(UT(t,e*2)-e)}function yne(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e),t*t*(3-2*t))}function bne(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e),t*t*t*(t*(t*6-15)+10))}function _ne(t,e){return t+Math.floor(Math.random()*(e-t+1))}function Sne(t,e){return t+Math.random()*(e-t)}function wne(t){return t*(.5-Math.random())}function Ene(t){t!==void 0&&(iL=t);let e=iL+=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 Mne(t){return t*Mp}function Ane(t){return t*Xp}function GM(t){return(t&t-1)===0&&t!==0}function Tne(t){return Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))}function lx(t){return Math.pow(2,Math.floor(Math.log(t)/Math.LN2))}function Cne(t,e,n,i,r){const a=Math.cos,s=Math.sin,l=a(n/2),c=s(n/2),d=a((e+i)/2),f=s((e+i)/2),h=a((e-i)/2),g=s((e-i)/2),m=a((i-e)/2),b=s((i-e)/2);switch(r){case"XYX":t.set(l*f,c*h,c*g,l*d);break;case"YZY":t.set(c*g,l*f,c*h,l*d);break;case"ZXZ":t.set(c*h,c*g,l*f,l*d);break;case"XZX":t.set(l*f,c*b,c*m,l*d);break;case"YXY":t.set(c*m,l*f,c*b,l*d);break;case"ZYZ":t.set(c*b,c*m,l*f,l*d);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}}function Ls(t,e){switch(e.constructor){case Float32Array:return t;case Uint32Array:return t/4294967295;case Uint16Array:return t/65535;case Uint8Array:return t/255;case Int32Array:return Math.max(t/2147483647,-1);case Int16Array:return Math.max(t/32767,-1);case Int8Array:return Math.max(t/127,-1);default:throw new Error("Invalid component type.")}}function Mn(t,e){switch(e.constructor){case Float32Array:return t;case Uint32Array:return Math.round(t*4294967295);case Uint16Array:return Math.round(t*65535);case Uint8Array:return Math.round(t*255);case Int32Array:return Math.round(t*2147483647);case Int16Array:return Math.round(t*32767);case Int8Array:return Math.round(t*127);default:throw new Error("Invalid component type.")}}const UB={DEG2RAD:Mp,RAD2DEG:Xp,generateUUID:jo,clamp:hr,euclideanModulo:UT,mapLinear:mne,inverseLerp:gne,lerp:Ap,damp:vne,pingpong:xne,smoothstep:yne,smootherstep:bne,randInt:_ne,randFloat:Sne,randFloatSpread:wne,seededRandom:Ene,degToRad:Mne,radToDeg:Ane,isPowerOfTwo:GM,ceilPowerOfTwo:Tne,floorPowerOfTwo:lx,setQuaternionFromProperEuler:Cne,normalize:Mn,denormalize:Ls};class Ut{constructor(e=0,n=0){Ut.prototype.isVector2=!0,this.x=e,this.y=n}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,n){return this.x=e,this.y=n,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,n){switch(e){case 0:this.x=n;break;case 1:this.y=n;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,n){return this.x=e.x+n.x,this.y=e.y+n.y,this}addScaledVector(e,n){return this.x+=e.x*n,this.y+=e.y*n,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,n){return this.x=e.x-n.x,this.y=e.y-n.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 n=this.x,i=this.y,r=e.elements;return this.x=r[0]*n+r[3]*i+r[6],this.y=r[1]*n+r[4]*i+r[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,n){return this.x=Math.max(e.x,Math.min(n.x,this.x)),this.y=Math.max(e.y,Math.min(n.y,this.y)),this}clampScalar(e,n){return this.x=Math.max(e,Math.min(n,this.x)),this.y=Math.max(e,Math.min(n,this.y)),this}clampLength(e,n){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(n,i)))}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=Math.trunc(this.x),this.y=Math.trunc(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}angleTo(e){const n=Math.sqrt(this.lengthSq()*e.lengthSq());if(n===0)return Math.PI/2;const i=this.dot(e)/n;return Math.acos(hr(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const n=this.x-e.x,i=this.y-e.y;return n*n+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,n){return this.x+=(e.x-this.x)*n,this.y+=(e.y-this.y)*n,this}lerpVectors(e,n,i){return this.x=e.x+(n.x-e.x)*i,this.y=e.y+(n.y-e.y)*i,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,n=0){return this.x=e[n],this.y=e[n+1],this}toArray(e=[],n=0){return e[n]=this.x,e[n+1]=this.y,e}fromBufferAttribute(e,n){return this.x=e.getX(n),this.y=e.getY(n),this}rotateAround(e,n){const i=Math.cos(n),r=Math.sin(n),a=this.x-e.x,s=this.y-e.y;return this.x=a*i-s*r+e.x,this.y=a*r+s*i+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class Yt{constructor(e,n,i,r,a,s,l,c,d){Yt.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,n,i,r,a,s,l,c,d)}set(e,n,i,r,a,s,l,c,d){const f=this.elements;return f[0]=e,f[1]=r,f[2]=l,f[3]=n,f[4]=a,f[5]=c,f[6]=i,f[7]=s,f[8]=d,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const n=this.elements,i=e.elements;return n[0]=i[0],n[1]=i[1],n[2]=i[2],n[3]=i[3],n[4]=i[4],n[5]=i[5],n[6]=i[6],n[7]=i[7],n[8]=i[8],this}extractBasis(e,n,i){return e.setFromMatrix3Column(this,0),n.setFromMatrix3Column(this,1),i.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const n=e.elements;return this.set(n[0],n[4],n[8],n[1],n[5],n[9],n[2],n[6],n[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,n){const i=e.elements,r=n.elements,a=this.elements,s=i[0],l=i[3],c=i[6],d=i[1],f=i[4],h=i[7],g=i[2],m=i[5],b=i[8],y=r[0],x=r[3],v=r[6],w=r[1],S=r[4],A=r[7],R=r[2],N=r[5],C=r[8];return a[0]=s*y+l*w+c*R,a[3]=s*x+l*S+c*N,a[6]=s*v+l*A+c*C,a[1]=d*y+f*w+h*R,a[4]=d*x+f*S+h*N,a[7]=d*v+f*A+h*C,a[2]=g*y+m*w+b*R,a[5]=g*x+m*S+b*N,a[8]=g*v+m*A+b*C,this}multiplyScalar(e){const n=this.elements;return n[0]*=e,n[3]*=e,n[6]*=e,n[1]*=e,n[4]*=e,n[7]*=e,n[2]*=e,n[5]*=e,n[8]*=e,this}determinant(){const e=this.elements,n=e[0],i=e[1],r=e[2],a=e[3],s=e[4],l=e[5],c=e[6],d=e[7],f=e[8];return n*s*f-n*l*d-i*a*f+i*l*c+r*a*d-r*s*c}invert(){const e=this.elements,n=e[0],i=e[1],r=e[2],a=e[3],s=e[4],l=e[5],c=e[6],d=e[7],f=e[8],h=f*s-l*d,g=l*c-f*a,m=d*a-s*c,b=n*h+i*g+r*m;if(b===0)return this.set(0,0,0,0,0,0,0,0,0);const y=1/b;return e[0]=h*y,e[1]=(r*d-f*i)*y,e[2]=(l*i-r*s)*y,e[3]=g*y,e[4]=(f*n-r*c)*y,e[5]=(r*a-l*n)*y,e[6]=m*y,e[7]=(i*c-d*n)*y,e[8]=(s*n-i*a)*y,this}transpose(){let e;const n=this.elements;return e=n[1],n[1]=n[3],n[3]=e,e=n[2],n[2]=n[6],n[6]=e,e=n[5],n[5]=n[7],n[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const n=this.elements;return e[0]=n[0],e[1]=n[3],e[2]=n[6],e[3]=n[1],e[4]=n[4],e[5]=n[7],e[6]=n[2],e[7]=n[5],e[8]=n[8],this}setUvTransform(e,n,i,r,a,s,l){const c=Math.cos(a),d=Math.sin(a);return this.set(i*c,i*d,-i*(c*s+d*l)+s+e,-r*d,r*c,-r*(-d*s+c*l)+l+n,0,0,1),this}scale(e,n){return this.premultiply(p1.makeScale(e,n)),this}rotate(e){return this.premultiply(p1.makeRotation(-e)),this}translate(e,n){return this.premultiply(p1.makeTranslation(e,n)),this}makeTranslation(e,n){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,n,0,0,1),this}makeRotation(e){const n=Math.cos(e),i=Math.sin(e);return this.set(n,-i,0,i,n,0,0,0,1),this}makeScale(e,n){return this.set(e,0,0,0,n,0,0,0,1),this}equals(e){const n=this.elements,i=e.elements;for(let r=0;r<9;r++)if(n[r]!==i[r])return!1;return!0}fromArray(e,n=0){for(let i=0;i<9;i++)this.elements[i]=e[i+n];return this}toArray(e=[],n=0){const i=this.elements;return e[n]=i[0],e[n+1]=i[1],e[n+2]=i[2],e[n+3]=i[3],e[n+4]=i[4],e[n+5]=i[5],e[n+6]=i[6],e[n+7]=i[7],e[n+8]=i[8],e}clone(){return new this.constructor().fromArray(this.elements)}}const p1=new Yt;function kB(t){for(let e=t.length-1;e>=0;--e)if(t[e]>=65535)return!0;return!1}function cx(t){return document.createElementNS("http://www.w3.org/1999/xhtml",t)}function Rne(){const t=cx("canvas");return t.style.display="block",t}const rL={};function Tp(t){t in rL||(rL[t]=!0,console.warn(t))}const aL=new Yt().set(.8224621,.177538,0,.0331941,.9668058,0,.0170827,.0723974,.9105199),sL=new Yt().set(1.2249401,-.2249404,0,-.0420569,1.0420571,0,-.0196376,-.0786361,1.0982735),O0={[Wo]:{transfer:ax,primaries:sx,toReference:t=>t,fromReference:t=>t},[fr]:{transfer:Fn,primaries:sx,toReference:t=>t.convertSRGBToLinear(),fromReference:t=>t.convertLinearToSRGB()},[xy]:{transfer:ax,primaries:ox,toReference:t=>t.applyMatrix3(sL),fromReference:t=>t.applyMatrix3(aL)},[IT]:{transfer:Fn,primaries:ox,toReference:t=>t.convertSRGBToLinear().applyMatrix3(sL),fromReference:t=>t.applyMatrix3(aL).convertLinearToSRGB()}},Pne=new Set([Wo,xy]),An={enabled:!0,_workingColorSpace:Wo,get legacyMode(){return console.warn("THREE.ColorManagement: .legacyMode=false renamed to .enabled=true in r150."),!this.enabled},set legacyMode(t){console.warn("THREE.ColorManagement: .legacyMode=false renamed to .enabled=true in r150."),this.enabled=!t},get workingColorSpace(){return this._workingColorSpace},set workingColorSpace(t){if(!Pne.has(t))throw new Error(`Unsupported working color space, "${t}".`);this._workingColorSpace=t},convert:function(t,e,n){if(this.enabled===!1||e===n||!e||!n)return t;const i=O0[e].toReference,r=O0[n].fromReference;return r(i(t))},fromWorkingColorSpace:function(t,e){return this.convert(t,this._workingColorSpace,e)},toWorkingColorSpace:function(t,e){return this.convert(t,e,this._workingColorSpace)},getPrimaries:function(t){return O0[t].primaries},getTransfer:function(t){return t===Va?ax:O0[t].transfer}};function uf(t){return t<.04045?t*.0773993808:Math.pow(t*.9478672986+.0521327014,2.4)}function m1(t){return t<.0031308?t*12.92:1.055*Math.pow(t,.41666)-.055}let Od;class FB{static getDataURL(e){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let n;if(e instanceof HTMLCanvasElement)n=e;else{Od===void 0&&(Od=cx("canvas")),Od.width=e.width,Od.height=e.height;const i=Od.getContext("2d");e instanceof ImageData?i.putImageData(e,0,0):i.drawImage(e,0,0,e.width,e.height),n=Od}return n.width>2048||n.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",e),n.toDataURL("image/jpeg",.6)):n.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 n=cx("canvas");n.width=e.width,n.height=e.height;const i=n.getContext("2d");i.drawImage(e,0,0,e.width,e.height);const r=i.getImageData(0,0,e.width,e.height),a=r.data;for(let s=0;s<a.length;s++)a[s]=uf(a[s]/255)*255;return i.putImageData(r,0,0),n}else if(e.data){const n=e.data.slice(0);for(let i=0;i<n.length;i++)n instanceof Uint8Array||n instanceof Uint8ClampedArray?n[i]=Math.floor(uf(n[i]/255)*255):n[i]=uf(n[i]);return{data:n,width:e.width,height:e.height}}else return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}}let Dne=0;class zB{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:Dne++}),this.uuid=jo(),this.data=e,this.version=0}set needsUpdate(e){e===!0&&this.version++}toJSON(e){const n=e===void 0||typeof e=="string";if(!n&&e.images[this.uuid]!==void 0)return e.images[this.uuid];const i={uuid:this.uuid,url:""},r=this.data;if(r!==null){let a;if(Array.isArray(r)){a=[];for(let s=0,l=r.length;s<l;s++)r[s].isDataTexture?a.push(g1(r[s].image)):a.push(g1(r[s]))}else a=g1(r);i.url=a}return n||(e.images[this.uuid]=i),i}}function g1(t){return typeof HTMLImageElement<"u"&&t instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&t instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&t instanceof ImageBitmap?FB.getDataURL(t):t.data?{data:Array.from(t.data),width:t.width,height:t.height,type:t.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}let Nne=0;class Qr extends Uu{constructor(e=Qr.DEFAULT_IMAGE,n=Qr.DEFAULT_MAPPING,i=ds,r=ds,a=Ha,s=Vp,l=Ga,c=ac,d=Qr.DEFAULT_ANISOTROPY,f=Va){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:Nne++}),this.uuid=jo(),this.name="",this.source=new zB(e),this.mipmaps=[],this.mapping=n,this.channel=0,this.wrapS=i,this.wrapT=r,this.magFilter=a,this.minFilter=s,this.anisotropy=d,this.format=l,this.internalFormat=null,this.type=c,this.offset=new Ut(0,0),this.repeat=new Ut(1,1),this.center=new Ut(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Yt,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,typeof f=="string"?this.colorSpace=f:(Tp("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace=f===uu?fr:Va),this.userData={},this.version=0,this.onUpdate=null,this.isRenderTargetTexture=!1,this.needsPMREMUpdate=!1}get image(){return this.source.data}set image(e=null){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.channel=e.channel,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.colorSpace=e.colorSpace,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}toJSON(e){const n=e===void 0||typeof e=="string";if(!n&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];const i={metadata:{version:4.6,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,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,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,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&&(i.userData=this.userData),n||(e.textures[this.uuid]=i),i}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==MB)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case zM:e.x=e.x-Math.floor(e.x);break;case ds:e.x=e.x<0?0:1;break;case BM: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 zM:e.y=e.y-Math.floor(e.y);break;case ds:e.y=e.y<0?0:1;break;case BM: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)}get encoding(){return Tp("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace===fr?uu:OB}set encoding(e){Tp("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace=e===uu?fr:Va}}Qr.DEFAULT_IMAGE=null;Qr.DEFAULT_MAPPING=MB;Qr.DEFAULT_ANISOTROPY=1;class Cn{constructor(e=0,n=0,i=0,r=1){Cn.prototype.isVector4=!0,this.x=e,this.y=n,this.z=i,this.w=r}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,n,i,r){return this.x=e,this.y=n,this.z=i,this.w=r,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,n){switch(e){case 0:this.x=n;break;case 1:this.y=n;break;case 2:this.z=n;break;case 3:this.w=n;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,n){return this.x=e.x+n.x,this.y=e.y+n.y,this.z=e.z+n.z,this.w=e.w+n.w,this}addScaledVector(e,n){return this.x+=e.x*n,this.y+=e.y*n,this.z+=e.z*n,this.w+=e.w*n,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,n){return this.x=e.x-n.x,this.y=e.y-n.y,this.z=e.z-n.z,this.w=e.w-n.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 n=this.x,i=this.y,r=this.z,a=this.w,s=e.elements;return this.x=s[0]*n+s[4]*i+s[8]*r+s[12]*a,this.y=s[1]*n+s[5]*i+s[9]*r+s[13]*a,this.z=s[2]*n+s[6]*i+s[10]*r+s[14]*a,this.w=s[3]*n+s[7]*i+s[11]*r+s[15]*a,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const n=Math.sqrt(1-e.w*e.w);return n<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/n,this.y=e.y/n,this.z=e.z/n),this}setAxisAngleFromRotationMatrix(e){let n,i,r,a;const c=e.elements,d=c[0],f=c[4],h=c[8],g=c[1],m=c[5],b=c[9],y=c[2],x=c[6],v=c[10];if(Math.abs(f-g)<.01&&Math.abs(h-y)<.01&&Math.abs(b-x)<.01){if(Math.abs(f+g)<.1&&Math.abs(h+y)<.1&&Math.abs(b+x)<.1&&Math.abs(d+m+v-3)<.1)return this.set(1,0,0,0),this;n=Math.PI;const S=(d+1)/2,A=(m+1)/2,R=(v+1)/2,N=(f+g)/4,C=(h+y)/4,F=(b+x)/4;return S>A&&S>R?S<.01?(i=0,r=.707106781,a=.707106781):(i=Math.sqrt(S),r=N/i,a=C/i):A>R?A<.01?(i=.707106781,r=0,a=.707106781):(r=Math.sqrt(A),i=N/r,a=F/r):R<.01?(i=.707106781,r=.707106781,a=0):(a=Math.sqrt(R),i=C/a,r=F/a),this.set(i,r,a,n),this}let w=Math.sqrt((x-b)*(x-b)+(h-y)*(h-y)+(g-f)*(g-f));return Math.abs(w)<.001&&(w=1),this.x=(x-b)/w,this.y=(h-y)/w,this.z=(g-f)/w,this.w=Math.acos((d+m+v-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,n){return this.x=Math.max(e.x,Math.min(n.x,this.x)),this.y=Math.max(e.y,Math.min(n.y,this.y)),this.z=Math.max(e.z,Math.min(n.z,this.z)),this.w=Math.max(e.w,Math.min(n.w,this.w)),this}clampScalar(e,n){return this.x=Math.max(e,Math.min(n,this.x)),this.y=Math.max(e,Math.min(n,this.y)),this.z=Math.max(e,Math.min(n,this.z)),this.w=Math.max(e,Math.min(n,this.w)),this}clampLength(e,n){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(n,i)))}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=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(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,n){return this.x+=(e.x-this.x)*n,this.y+=(e.y-this.y)*n,this.z+=(e.z-this.z)*n,this.w+=(e.w-this.w)*n,this}lerpVectors(e,n,i){return this.x=e.x+(n.x-e.x)*i,this.y=e.y+(n.y-e.y)*i,this.z=e.z+(n.z-e.z)*i,this.w=e.w+(n.w-e.w)*i,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,n=0){return this.x=e[n],this.y=e[n+1],this.z=e[n+2],this.w=e[n+3],this}toArray(e=[],n=0){return e[n]=this.x,e[n+1]=this.y,e[n+2]=this.z,e[n+3]=this.w,e}fromBufferAttribute(e,n){return this.x=e.getX(n),this.y=e.getY(n),this.z=e.getZ(n),this.w=e.getW(n),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 One extends Uu{constructor(e=1,n=1,i={}){super(),this.isRenderTarget=!0,this.width=e,this.height=n,this.depth=1,this.scissor=new Cn(0,0,e,n),this.scissorTest=!1,this.viewport=new Cn(0,0,e,n);const r={width:e,height:n,depth:1};i.encoding!==void 0&&(Tp("THREE.WebGLRenderTarget: option.encoding has been replaced by option.colorSpace."),i.colorSpace=i.encoding===uu?fr:Va),i=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:Ha,depthBuffer:!0,stencilBuffer:!1,depthTexture:null,samples:0},i),this.texture=new Qr(r,i.mapping,i.wrapS,i.wrapT,i.magFilter,i.minFilter,i.format,i.type,i.anisotropy,i.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.flipY=!1,this.texture.generateMipmaps=i.generateMipmaps,this.texture.internalFormat=i.internalFormat,this.depthBuffer=i.depthBuffer,this.stencilBuffer=i.stencilBuffer,this.depthTexture=i.depthTexture,this.samples=i.samples}setSize(e,n,i=1){(this.width!==e||this.height!==n||this.depth!==i)&&(this.width=e,this.height=n,this.depth=i,this.texture.image.width=e,this.texture.image.height=n,this.texture.image.depth=i,this.dispose()),this.viewport.set(0,0,e,n),this.scissor.set(0,0,e,n)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.texture=e.texture.clone(),this.texture.isRenderTargetTexture=!0;const n=Object.assign({},e.texture.image);return this.texture.source=new zB(n),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 Eu extends One{constructor(e=1,n=1,i={}){super(e,n,i),this.isWebGLRenderTarget=!0}}class BB extends Qr{constructor(e=null,n=1,i=1,r=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:n,height:i,depth:r},this.magFilter=dr,this.minFilter=dr,this.wrapR=ds,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class Lne extends Qr{constructor(e=null,n=1,i=1,r=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:n,height:i,depth:r},this.magFilter=dr,this.minFilter=dr,this.wrapR=ds,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class Mu{constructor(e=0,n=0,i=0,r=1){this.isQuaternion=!0,this._x=e,this._y=n,this._z=i,this._w=r}static slerpFlat(e,n,i,r,a,s,l){let c=i[r+0],d=i[r+1],f=i[r+2],h=i[r+3];const g=a[s+0],m=a[s+1],b=a[s+2],y=a[s+3];if(l===0){e[n+0]=c,e[n+1]=d,e[n+2]=f,e[n+3]=h;return}if(l===1){e[n+0]=g,e[n+1]=m,e[n+2]=b,e[n+3]=y;return}if(h!==y||c!==g||d!==m||f!==b){let x=1-l;const v=c*g+d*m+f*b+h*y,w=v>=0?1:-1,S=1-v*v;if(S>Number.EPSILON){const R=Math.sqrt(S),N=Math.atan2(R,v*w);x=Math.sin(x*N)/R,l=Math.sin(l*N)/R}const A=l*w;if(c=c*x+g*A,d=d*x+m*A,f=f*x+b*A,h=h*x+y*A,x===1-l){const R=1/Math.sqrt(c*c+d*d+f*f+h*h);c*=R,d*=R,f*=R,h*=R}}e[n]=c,e[n+1]=d,e[n+2]=f,e[n+3]=h}static multiplyQuaternionsFlat(e,n,i,r,a,s){const l=i[r],c=i[r+1],d=i[r+2],f=i[r+3],h=a[s],g=a[s+1],m=a[s+2],b=a[s+3];return e[n]=l*b+f*h+c*m-d*g,e[n+1]=c*b+f*g+d*h-l*m,e[n+2]=d*b+f*m+l*g-c*h,e[n+3]=f*b-l*h-c*g-d*m,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,n,i,r){return this._x=e,this._y=n,this._z=i,this._w=r,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,n){const i=e._x,r=e._y,a=e._z,s=e._order,l=Math.cos,c=Math.sin,d=l(i/2),f=l(r/2),h=l(a/2),g=c(i/2),m=c(r/2),b=c(a/2);switch(s){case"XYZ":this._x=g*f*h+d*m*b,this._y=d*m*h-g*f*b,this._z=d*f*b+g*m*h,this._w=d*f*h-g*m*b;break;case"YXZ":this._x=g*f*h+d*m*b,this._y=d*m*h-g*f*b,this._z=d*f*b-g*m*h,this._w=d*f*h+g*m*b;break;case"ZXY":this._x=g*f*h-d*m*b,this._y=d*m*h+g*f*b,this._z=d*f*b+g*m*h,this._w=d*f*h-g*m*b;break;case"ZYX":this._x=g*f*h-d*m*b,this._y=d*m*h+g*f*b,this._z=d*f*b-g*m*h,this._w=d*f*h+g*m*b;break;case"YZX":this._x=g*f*h+d*m*b,this._y=d*m*h+g*f*b,this._z=d*f*b-g*m*h,this._w=d*f*h-g*m*b;break;case"XZY":this._x=g*f*h-d*m*b,this._y=d*m*h-g*f*b,this._z=d*f*b+g*m*h,this._w=d*f*h+g*m*b;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+s)}return n!==!1&&this._onChangeCallback(),this}setFromAxisAngle(e,n){const i=n/2,r=Math.sin(i);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(i),this._onChangeCallback(),this}setFromRotationMatrix(e){const n=e.elements,i=n[0],r=n[4],a=n[8],s=n[1],l=n[5],c=n[9],d=n[2],f=n[6],h=n[10],g=i+l+h;if(g>0){const m=.5/Math.sqrt(g+1);this._w=.25/m,this._x=(f-c)*m,this._y=(a-d)*m,this._z=(s-r)*m}else if(i>l&&i>h){const m=2*Math.sqrt(1+i-l-h);this._w=(f-c)/m,this._x=.25*m,this._y=(r+s)/m,this._z=(a+d)/m}else if(l>h){const m=2*Math.sqrt(1+l-i-h);this._w=(a-d)/m,this._x=(r+s)/m,this._y=.25*m,this._z=(c+f)/m}else{const m=2*Math.sqrt(1+h-i-l);this._w=(s-r)/m,this._x=(a+d)/m,this._y=(c+f)/m,this._z=.25*m}return this._onChangeCallback(),this}setFromUnitVectors(e,n){let i=e.dot(n)+1;return i<Number.EPSILON?(i=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=i):(this._x=0,this._y=-e.z,this._z=e.y,this._w=i)):(this._x=e.y*n.z-e.z*n.y,this._y=e.z*n.x-e.x*n.z,this._z=e.x*n.y-e.y*n.x,this._w=i),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(hr(this.dot(e),-1,1)))}rotateTowards(e,n){const i=this.angleTo(e);if(i===0)return this;const r=Math.min(1,n/i);return this.slerp(e,r),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,n){const i=e._x,r=e._y,a=e._z,s=e._w,l=n._x,c=n._y,d=n._z,f=n._w;return this._x=i*f+s*l+r*d-a*c,this._y=r*f+s*c+a*l-i*d,this._z=a*f+s*d+i*c-r*l,this._w=s*f-i*l-r*c-a*d,this._onChangeCallback(),this}slerp(e,n){if(n===0)return this;if(n===1)return this.copy(e);const i=this._x,r=this._y,a=this._z,s=this._w;let l=s*e._w+i*e._x+r*e._y+a*e._z;if(l<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,l=-l):this.copy(e),l>=1)return this._w=s,this._x=i,this._y=r,this._z=a,this;const c=1-l*l;if(c<=Number.EPSILON){const m=1-n;return this._w=m*s+n*this._w,this._x=m*i+n*this._x,this._y=m*r+n*this._y,this._z=m*a+n*this._z,this.normalize(),this._onChangeCallback(),this}const d=Math.sqrt(c),f=Math.atan2(d,l),h=Math.sin((1-n)*f)/d,g=Math.sin(n*f)/d;return this._w=s*h+this._w*g,this._x=i*h+this._x*g,this._y=r*h+this._y*g,this._z=a*h+this._z*g,this._onChangeCallback(),this}slerpQuaternions(e,n,i){return this.copy(e).slerp(n,i)}random(){const e=Math.random(),n=Math.sqrt(1-e),i=Math.sqrt(e),r=2*Math.PI*Math.random(),a=2*Math.PI*Math.random();return this.set(n*Math.cos(r),i*Math.sin(a),i*Math.cos(a),n*Math.sin(r))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,n=0){return this._x=e[n],this._y=e[n+1],this._z=e[n+2],this._w=e[n+3],this._onChangeCallback(),this}toArray(e=[],n=0){return e[n]=this._x,e[n+1]=this._y,e[n+2]=this._z,e[n+3]=this._w,e}fromBufferAttribute(e,n){return this._x=e.getX(n),this._y=e.getY(n),this._z=e.getZ(n),this._w=e.getW(n),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class Ce{constructor(e=0,n=0,i=0){Ce.prototype.isVector3=!0,this.x=e,this.y=n,this.z=i}set(e,n,i){return i===void 0&&(i=this.z),this.x=e,this.y=n,this.z=i,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,n){switch(e){case 0:this.x=n;break;case 1:this.y=n;break;case 2:this.z=n;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,n){return this.x=e.x+n.x,this.y=e.y+n.y,this.z=e.z+n.z,this}addScaledVector(e,n){return this.x+=e.x*n,this.y+=e.y*n,this.z+=e.z*n,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,n){return this.x=e.x-n.x,this.y=e.y-n.y,this.z=e.z-n.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,n){return this.x=e.x*n.x,this.y=e.y*n.y,this.z=e.z*n.z,this}applyEuler(e){return this.applyQuaternion(oL.setFromEuler(e))}applyAxisAngle(e,n){return this.applyQuaternion(oL.setFromAxisAngle(e,n))}applyMatrix3(e){const n=this.x,i=this.y,r=this.z,a=e.elements;return this.x=a[0]*n+a[3]*i+a[6]*r,this.y=a[1]*n+a[4]*i+a[7]*r,this.z=a[2]*n+a[5]*i+a[8]*r,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const n=this.x,i=this.y,r=this.z,a=e.elements,s=1/(a[3]*n+a[7]*i+a[11]*r+a[15]);return this.x=(a[0]*n+a[4]*i+a[8]*r+a[12])*s,this.y=(a[1]*n+a[5]*i+a[9]*r+a[13])*s,this.z=(a[2]*n+a[6]*i+a[10]*r+a[14])*s,this}applyQuaternion(e){const n=this.x,i=this.y,r=this.z,a=e.x,s=e.y,l=e.z,c=e.w,d=2*(s*r-l*i),f=2*(l*n-a*r),h=2*(a*i-s*n);return this.x=n+c*d+s*h-l*f,this.y=i+c*f+l*d-a*h,this.z=r+c*h+a*f-s*d,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const n=this.x,i=this.y,r=this.z,a=e.elements;return this.x=a[0]*n+a[4]*i+a[8]*r,this.y=a[1]*n+a[5]*i+a[9]*r,this.z=a[2]*n+a[6]*i+a[10]*r,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,n){return this.x=Math.max(e.x,Math.min(n.x,this.x)),this.y=Math.max(e.y,Math.min(n.y,this.y)),this.z=Math.max(e.z,Math.min(n.z,this.z)),this}clampScalar(e,n){return this.x=Math.max(e,Math.min(n,this.x)),this.y=Math.max(e,Math.min(n,this.y)),this.z=Math.max(e,Math.min(n,this.z)),this}clampLength(e,n){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(n,i)))}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=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(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,n){return this.x+=(e.x-this.x)*n,this.y+=(e.y-this.y)*n,this.z+=(e.z-this.z)*n,this}lerpVectors(e,n,i){return this.x=e.x+(n.x-e.x)*i,this.y=e.y+(n.y-e.y)*i,this.z=e.z+(n.z-e.z)*i,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,n){const i=e.x,r=e.y,a=e.z,s=n.x,l=n.y,c=n.z;return this.x=r*c-a*l,this.y=a*s-i*c,this.z=i*l-r*s,this}projectOnVector(e){const n=e.lengthSq();if(n===0)return this.set(0,0,0);const i=e.dot(this)/n;return this.copy(e).multiplyScalar(i)}projectOnPlane(e){return v1.copy(this).projectOnVector(e),this.sub(v1)}reflect(e){return this.sub(v1.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const n=Math.sqrt(this.lengthSq()*e.lengthSq());if(n===0)return Math.PI/2;const i=this.dot(e)/n;return Math.acos(hr(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const n=this.x-e.x,i=this.y-e.y,r=this.z-e.z;return n*n+i*i+r*r}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,n,i){const r=Math.sin(n)*e;return this.x=r*Math.sin(i),this.y=Math.cos(n)*e,this.z=r*Math.cos(i),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,n,i){return this.x=e*Math.sin(n),this.y=i,this.z=e*Math.cos(n),this}setFromMatrixPosition(e){const n=e.elements;return this.x=n[12],this.y=n[13],this.z=n[14],this}setFromMatrixScale(e){const n=this.setFromMatrixColumn(e,0).length(),i=this.setFromMatrixColumn(e,1).length(),r=this.setFromMatrixColumn(e,2).length();return this.x=n,this.y=i,this.z=r,this}setFromMatrixColumn(e,n){return this.fromArray(e.elements,n*4)}setFromMatrix3Column(e,n){return this.fromArray(e.elements,n*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,n=0){return this.x=e[n],this.y=e[n+1],this.z=e[n+2],this}toArray(e=[],n=0){return e[n]=this.x,e[n+1]=this.y,e[n+2]=this.z,e}fromBufferAttribute(e,n){return this.x=e.getX(n),this.y=e.getY(n),this.z=e.getZ(n),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=(Math.random()-.5)*2,n=Math.random()*Math.PI*2,i=Math.sqrt(1-e**2);return this.x=i*Math.cos(n),this.y=i*Math.sin(n),this.z=e,this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const v1=new Ce,oL=new Mu;class qa{constructor(e=new Ce(1/0,1/0,1/0),n=new Ce(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=n}set(e,n){return this.min.copy(e),this.max.copy(n),this}setFromArray(e){this.makeEmpty();for(let n=0,i=e.length;n<i;n+=3)this.expandByPoint(os.fromArray(e,n));return this}setFromBufferAttribute(e){this.makeEmpty();for(let n=0,i=e.count;n<i;n++)this.expandByPoint(os.fromBufferAttribute(e,n));return this}setFromPoints(e){this.makeEmpty();for(let n=0,i=e.length;n<i;n++)this.expandByPoint(e[n]);return this}setFromCenterAndSize(e,n){const i=os.copy(n).multiplyScalar(.5);return this.min.copy(e).sub(i),this.max.copy(e).add(i),this}setFromObject(e,n=!1){return this.makeEmpty(),this.expandByObject(e,n)}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,n=!1){e.updateWorldMatrix(!1,!1);const i=e.geometry;if(i!==void 0){const a=i.getAttribute("position");if(n===!0&&a!==void 0&&e.isInstancedMesh!==!0)for(let s=0,l=a.count;s<l;s++)e.isMesh===!0?e.getVertexPosition(s,os):os.fromBufferAttribute(a,s),os.applyMatrix4(e.matrixWorld),this.expandByPoint(os);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),L0.copy(e.boundingBox)):(i.boundingBox===null&&i.computeBoundingBox(),L0.copy(i.boundingBox)),L0.applyMatrix4(e.matrixWorld),this.union(L0)}const r=e.children;for(let a=0,s=r.length;a<s;a++)this.expandByObject(r[a],n);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,n){return n.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,os),os.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let n,i;return e.normal.x>0?(n=e.normal.x*this.min.x,i=e.normal.x*this.max.x):(n=e.normal.x*this.max.x,i=e.normal.x*this.min.x),e.normal.y>0?(n+=e.normal.y*this.min.y,i+=e.normal.y*this.max.y):(n+=e.normal.y*this.max.y,i+=e.normal.y*this.min.y),e.normal.z>0?(n+=e.normal.z*this.min.z,i+=e.normal.z*this.max.z):(n+=e.normal.z*this.max.z,i+=e.normal.z*this.min.z),n<=-e.constant&&i>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(rp),I0.subVectors(this.max,rp),Ld.subVectors(e.a,rp),Id.subVectors(e.b,rp),Ud.subVectors(e.c,rp),kl.subVectors(Id,Ld),Fl.subVectors(Ud,Id),jc.subVectors(Ld,Ud);let n=[0,-kl.z,kl.y,0,-Fl.z,Fl.y,0,-jc.z,jc.y,kl.z,0,-kl.x,Fl.z,0,-Fl.x,jc.z,0,-jc.x,-kl.y,kl.x,0,-Fl.y,Fl.x,0,-jc.y,jc.x,0];return!x1(n,Ld,Id,Ud,I0)||(n=[1,0,0,0,1,0,0,0,1],!x1(n,Ld,Id,Ud,I0))?!1:(U0.crossVectors(kl,Fl),n=[U0.x,U0.y,U0.z],x1(n,Ld,Id,Ud,I0))}clampPoint(e,n){return n.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,os).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(os).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:(So[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),So[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),So[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),So[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),So[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),So[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),So[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),So[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(So),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 So=[new Ce,new Ce,new Ce,new Ce,new Ce,new Ce,new Ce,new Ce],os=new Ce,L0=new qa,Ld=new Ce,Id=new Ce,Ud=new Ce,kl=new Ce,Fl=new Ce,jc=new Ce,rp=new Ce,I0=new Ce,U0=new Ce,Hc=new Ce;function x1(t,e,n,i,r){for(let a=0,s=t.length-3;a<=s;a+=3){Hc.fromArray(t,a);const l=r.x*Math.abs(Hc.x)+r.y*Math.abs(Hc.y)+r.z*Math.abs(Hc.z),c=e.dot(Hc),d=n.dot(Hc),f=i.dot(Hc);if(Math.max(-Math.max(c,d,f),Math.min(c,d,f))>l)return!1}return!0}const Ine=new qa,ap=new Ce,y1=new Ce;class Fs{constructor(e=new Ce,n=-1){this.center=e,this.radius=n}set(e,n){return this.center.copy(e),this.radius=n,this}setFromPoints(e,n){const i=this.center;n!==void 0?i.copy(n):Ine.setFromPoints(e).getCenter(i);let r=0;for(let a=0,s=e.length;a<s;a++)r=Math.max(r,i.distanceToSquared(e[a]));return this.radius=Math.sqrt(r),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 n=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=n*n}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,n){const i=this.center.distanceToSquared(e);return n.copy(e),i>this.radius*this.radius&&(n.sub(this.center).normalize(),n.multiplyScalar(this.radius).add(this.center)),n}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;ap.subVectors(e,this.center);const n=ap.lengthSq();if(n>this.radius*this.radius){const i=Math.sqrt(n),r=(i-this.radius)*.5;this.center.addScaledVector(ap,r/i),this.radius+=r}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):(y1.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(ap.copy(e.center).add(y1)),this.expandByPoint(ap.copy(e.center).sub(y1))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}}const wo=new Ce,b1=new Ce,k0=new Ce,zl=new Ce,_1=new Ce,F0=new Ce,S1=new Ce;class kT{constructor(e=new Ce,n=new Ce(0,0,-1)){this.origin=e,this.direction=n}set(e,n){return this.origin.copy(e),this.direction.copy(n),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,n){return n.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,wo)),this}closestPointToPoint(e,n){n.subVectors(e,this.origin);const i=n.dot(this.direction);return i<0?n.copy(this.origin):n.copy(this.origin).addScaledVector(this.direction,i)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const n=wo.subVectors(e,this.origin).dot(this.direction);return n<0?this.origin.distanceToSquared(e):(wo.copy(this.origin).addScaledVector(this.direction,n),wo.distanceToSquared(e))}distanceSqToSegment(e,n,i,r){b1.copy(e).add(n).multiplyScalar(.5),k0.copy(n).sub(e).normalize(),zl.copy(this.origin).sub(b1);const a=e.distanceTo(n)*.5,s=-this.direction.dot(k0),l=zl.dot(this.direction),c=-zl.dot(k0),d=zl.lengthSq(),f=Math.abs(1-s*s);let h,g,m,b;if(f>0)if(h=s*c-l,g=s*l-c,b=a*f,h>=0)if(g>=-b)if(g<=b){const y=1/f;h*=y,g*=y,m=h*(h+s*g+2*l)+g*(s*h+g+2*c)+d}else g=a,h=Math.max(0,-(s*g+l)),m=-h*h+g*(g+2*c)+d;else g=-a,h=Math.max(0,-(s*g+l)),m=-h*h+g*(g+2*c)+d;else g<=-b?(h=Math.max(0,-(-s*a+l)),g=h>0?-a:Math.min(Math.max(-a,-c),a),m=-h*h+g*(g+2*c)+d):g<=b?(h=0,g=Math.min(Math.max(-a,-c),a),m=g*(g+2*c)+d):(h=Math.max(0,-(s*a+l)),g=h>0?a:Math.min(Math.max(-a,-c),a),m=-h*h+g*(g+2*c)+d);else g=s>0?-a:a,h=Math.max(0,-(s*g+l)),m=-h*h+g*(g+2*c)+d;return i&&i.copy(this.origin).addScaledVector(this.direction,h),r&&r.copy(b1).addScaledVector(k0,g),m}intersectSphere(e,n){wo.subVectors(e.center,this.origin);const i=wo.dot(this.direction),r=wo.dot(wo)-i*i,a=e.radius*e.radius;if(r>a)return null;const s=Math.sqrt(a-r),l=i-s,c=i+s;return c<0?null:l<0?this.at(c,n):this.at(l,n)}intersectsSphere(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const n=e.normal.dot(this.direction);if(n===0)return e.distanceToPoint(this.origin)===0?0:null;const i=-(this.origin.dot(e.normal)+e.constant)/n;return i>=0?i:null}intersectPlane(e,n){const i=this.distanceToPlane(e);return i===null?null:this.at(i,n)}intersectsPlane(e){const n=e.distanceToPoint(this.origin);return n===0||e.normal.dot(this.direction)*n<0}intersectBox(e,n){let i,r,a,s,l,c;const d=1/this.direction.x,f=1/this.direction.y,h=1/this.direction.z,g=this.origin;return d>=0?(i=(e.min.x-g.x)*d,r=(e.max.x-g.x)*d):(i=(e.max.x-g.x)*d,r=(e.min.x-g.x)*d),f>=0?(a=(e.min.y-g.y)*f,s=(e.max.y-g.y)*f):(a=(e.max.y-g.y)*f,s=(e.min.y-g.y)*f),i>s||a>r||((a>i||isNaN(i))&&(i=a),(s<r||isNaN(r))&&(r=s),h>=0?(l=(e.min.z-g.z)*h,c=(e.max.z-g.z)*h):(l=(e.max.z-g.z)*h,c=(e.min.z-g.z)*h),i>c||l>r)||((l>i||i!==i)&&(i=l),(c<r||r!==r)&&(r=c),r<0)?null:this.at(i>=0?i:r,n)}intersectsBox(e){return this.intersectBox(e,wo)!==null}intersectTriangle(e,n,i,r,a){_1.subVectors(n,e),F0.subVectors(i,e),S1.crossVectors(_1,F0);let s=this.direction.dot(S1),l;if(s>0){if(r)return null;l=1}else if(s<0)l=-1,s=-s;else return null;zl.subVectors(this.origin,e);const c=l*this.direction.dot(F0.crossVectors(zl,F0));if(c<0)return null;const d=l*this.direction.dot(_1.cross(zl));if(d<0||c+d>s)return null;const f=-l*zl.dot(S1);return f<0?null:this.at(f/s,a)}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 Ln{constructor(e,n,i,r,a,s,l,c,d,f,h,g,m,b,y,x){Ln.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,n,i,r,a,s,l,c,d,f,h,g,m,b,y,x)}set(e,n,i,r,a,s,l,c,d,f,h,g,m,b,y,x){const v=this.elements;return v[0]=e,v[4]=n,v[8]=i,v[12]=r,v[1]=a,v[5]=s,v[9]=l,v[13]=c,v[2]=d,v[6]=f,v[10]=h,v[14]=g,v[3]=m,v[7]=b,v[11]=y,v[15]=x,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 Ln().fromArray(this.elements)}copy(e){const n=this.elements,i=e.elements;return n[0]=i[0],n[1]=i[1],n[2]=i[2],n[3]=i[3],n[4]=i[4],n[5]=i[5],n[6]=i[6],n[7]=i[7],n[8]=i[8],n[9]=i[9],n[10]=i[10],n[11]=i[11],n[12]=i[12],n[13]=i[13],n[14]=i[14],n[15]=i[15],this}copyPosition(e){const n=this.elements,i=e.elements;return n[12]=i[12],n[13]=i[13],n[14]=i[14],this}setFromMatrix3(e){const n=e.elements;return this.set(n[0],n[3],n[6],0,n[1],n[4],n[7],0,n[2],n[5],n[8],0,0,0,0,1),this}extractBasis(e,n,i){return e.setFromMatrixColumn(this,0),n.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this}makeBasis(e,n,i){return this.set(e.x,n.x,i.x,0,e.y,n.y,i.y,0,e.z,n.z,i.z,0,0,0,0,1),this}extractRotation(e){const n=this.elements,i=e.elements,r=1/kd.setFromMatrixColumn(e,0).length(),a=1/kd.setFromMatrixColumn(e,1).length(),s=1/kd.setFromMatrixColumn(e,2).length();return n[0]=i[0]*r,n[1]=i[1]*r,n[2]=i[2]*r,n[3]=0,n[4]=i[4]*a,n[5]=i[5]*a,n[6]=i[6]*a,n[7]=0,n[8]=i[8]*s,n[9]=i[9]*s,n[10]=i[10]*s,n[11]=0,n[12]=0,n[13]=0,n[14]=0,n[15]=1,this}makeRotationFromEuler(e){const n=this.elements,i=e.x,r=e.y,a=e.z,s=Math.cos(i),l=Math.sin(i),c=Math.cos(r),d=Math.sin(r),f=Math.cos(a),h=Math.sin(a);if(e.order==="XYZ"){const g=s*f,m=s*h,b=l*f,y=l*h;n[0]=c*f,n[4]=-c*h,n[8]=d,n[1]=m+b*d,n[5]=g-y*d,n[9]=-l*c,n[2]=y-g*d,n[6]=b+m*d,n[10]=s*c}else if(e.order==="YXZ"){const g=c*f,m=c*h,b=d*f,y=d*h;n[0]=g+y*l,n[4]=b*l-m,n[8]=s*d,n[1]=s*h,n[5]=s*f,n[9]=-l,n[2]=m*l-b,n[6]=y+g*l,n[10]=s*c}else if(e.order==="ZXY"){const g=c*f,m=c*h,b=d*f,y=d*h;n[0]=g-y*l,n[4]=-s*h,n[8]=b+m*l,n[1]=m+b*l,n[5]=s*f,n[9]=y-g*l,n[2]=-s*d,n[6]=l,n[10]=s*c}else if(e.order==="ZYX"){const g=s*f,m=s*h,b=l*f,y=l*h;n[0]=c*f,n[4]=b*d-m,n[8]=g*d+y,n[1]=c*h,n[5]=y*d+g,n[9]=m*d-b,n[2]=-d,n[6]=l*c,n[10]=s*c}else if(e.order==="YZX"){const g=s*c,m=s*d,b=l*c,y=l*d;n[0]=c*f,n[4]=y-g*h,n[8]=b*h+m,n[1]=h,n[5]=s*f,n[9]=-l*f,n[2]=-d*f,n[6]=m*h+b,n[10]=g-y*h}else if(e.order==="XZY"){const g=s*c,m=s*d,b=l*c,y=l*d;n[0]=c*f,n[4]=-h,n[8]=d*f,n[1]=g*h+y,n[5]=s*f,n[9]=m*h-b,n[2]=b*h-m,n[6]=l*f,n[10]=y*h+g}return n[3]=0,n[7]=0,n[11]=0,n[12]=0,n[13]=0,n[14]=0,n[15]=1,this}makeRotationFromQuaternion(e){return this.compose(Une,e,kne)}lookAt(e,n,i){const r=this.elements;return fa.subVectors(e,n),fa.lengthSq()===0&&(fa.z=1),fa.normalize(),Bl.crossVectors(i,fa),Bl.lengthSq()===0&&(Math.abs(i.z)===1?fa.x+=1e-4:fa.z+=1e-4,fa.normalize(),Bl.crossVectors(i,fa)),Bl.normalize(),z0.crossVectors(fa,Bl),r[0]=Bl.x,r[4]=z0.x,r[8]=fa.x,r[1]=Bl.y,r[5]=z0.y,r[9]=fa.y,r[2]=Bl.z,r[6]=z0.z,r[10]=fa.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,n){const i=e.elements,r=n.elements,a=this.elements,s=i[0],l=i[4],c=i[8],d=i[12],f=i[1],h=i[5],g=i[9],m=i[13],b=i[2],y=i[6],x=i[10],v=i[14],w=i[3],S=i[7],A=i[11],R=i[15],N=r[0],C=r[4],F=r[8],P=r[12],L=r[1],B=r[5],U=r[9],$=r[13],I=r[2],W=r[6],X=r[10],V=r[14],Y=r[3],J=r[7],se=r[11],H=r[15];return a[0]=s*N+l*L+c*I+d*Y,a[4]=s*C+l*B+c*W+d*J,a[8]=s*F+l*U+c*X+d*se,a[12]=s*P+l*$+c*V+d*H,a[1]=f*N+h*L+g*I+m*Y,a[5]=f*C+h*B+g*W+m*J,a[9]=f*F+h*U+g*X+m*se,a[13]=f*P+h*$+g*V+m*H,a[2]=b*N+y*L+x*I+v*Y,a[6]=b*C+y*B+x*W+v*J,a[10]=b*F+y*U+x*X+v*se,a[14]=b*P+y*$+x*V+v*H,a[3]=w*N+S*L+A*I+R*Y,a[7]=w*C+S*B+A*W+R*J,a[11]=w*F+S*U+A*X+R*se,a[15]=w*P+S*$+A*V+R*H,this}multiplyScalar(e){const n=this.elements;return n[0]*=e,n[4]*=e,n[8]*=e,n[12]*=e,n[1]*=e,n[5]*=e,n[9]*=e,n[13]*=e,n[2]*=e,n[6]*=e,n[10]*=e,n[14]*=e,n[3]*=e,n[7]*=e,n[11]*=e,n[15]*=e,this}determinant(){const e=this.elements,n=e[0],i=e[4],r=e[8],a=e[12],s=e[1],l=e[5],c=e[9],d=e[13],f=e[2],h=e[6],g=e[10],m=e[14],b=e[3],y=e[7],x=e[11],v=e[15];return b*(+a*c*h-r*d*h-a*l*g+i*d*g+r*l*m-i*c*m)+y*(+n*c*m-n*d*g+a*s*g-r*s*m+r*d*f-a*c*f)+x*(+n*d*h-n*l*m-a*s*h+i*s*m+a*l*f-i*d*f)+v*(-r*l*f-n*c*h+n*l*g+r*s*h-i*s*g+i*c*f)}transpose(){const e=this.elements;let n;return n=e[1],e[1]=e[4],e[4]=n,n=e[2],e[2]=e[8],e[8]=n,n=e[6],e[6]=e[9],e[9]=n,n=e[3],e[3]=e[12],e[12]=n,n=e[7],e[7]=e[13],e[13]=n,n=e[11],e[11]=e[14],e[14]=n,this}setPosition(e,n,i){const r=this.elements;return e.isVector3?(r[12]=e.x,r[13]=e.y,r[14]=e.z):(r[12]=e,r[13]=n,r[14]=i),this}invert(){const e=this.elements,n=e[0],i=e[1],r=e[2],a=e[3],s=e[4],l=e[5],c=e[6],d=e[7],f=e[8],h=e[9],g=e[10],m=e[11],b=e[12],y=e[13],x=e[14],v=e[15],w=h*x*d-y*g*d+y*c*m-l*x*m-h*c*v+l*g*v,S=b*g*d-f*x*d-b*c*m+s*x*m+f*c*v-s*g*v,A=f*y*d-b*h*d+b*l*m-s*y*m-f*l*v+s*h*v,R=b*h*c-f*y*c-b*l*g+s*y*g+f*l*x-s*h*x,N=n*w+i*S+r*A+a*R;if(N===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const C=1/N;return e[0]=w*C,e[1]=(y*g*a-h*x*a-y*r*m+i*x*m+h*r*v-i*g*v)*C,e[2]=(l*x*a-y*c*a+y*r*d-i*x*d-l*r*v+i*c*v)*C,e[3]=(h*c*a-l*g*a-h*r*d+i*g*d+l*r*m-i*c*m)*C,e[4]=S*C,e[5]=(f*x*a-b*g*a+b*r*m-n*x*m-f*r*v+n*g*v)*C,e[6]=(b*c*a-s*x*a-b*r*d+n*x*d+s*r*v-n*c*v)*C,e[7]=(s*g*a-f*c*a+f*r*d-n*g*d-s*r*m+n*c*m)*C,e[8]=A*C,e[9]=(b*h*a-f*y*a-b*i*m+n*y*m+f*i*v-n*h*v)*C,e[10]=(s*y*a-b*l*a+b*i*d-n*y*d-s*i*v+n*l*v)*C,e[11]=(f*l*a-s*h*a-f*i*d+n*h*d+s*i*m-n*l*m)*C,e[12]=R*C,e[13]=(f*y*r-b*h*r+b*i*g-n*y*g-f*i*x+n*h*x)*C,e[14]=(b*l*r-s*y*r-b*i*c+n*y*c+s*i*x-n*l*x)*C,e[15]=(s*h*r-f*l*r+f*i*c-n*h*c-s*i*g+n*l*g)*C,this}scale(e){const n=this.elements,i=e.x,r=e.y,a=e.z;return n[0]*=i,n[4]*=r,n[8]*=a,n[1]*=i,n[5]*=r,n[9]*=a,n[2]*=i,n[6]*=r,n[10]*=a,n[3]*=i,n[7]*=r,n[11]*=a,this}getMaxScaleOnAxis(){const e=this.elements,n=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],i=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],r=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(n,i,r))}makeTranslation(e,n,i){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,n,0,0,1,i,0,0,0,1),this}makeRotationX(e){const n=Math.cos(e),i=Math.sin(e);return this.set(1,0,0,0,0,n,-i,0,0,i,n,0,0,0,0,1),this}makeRotationY(e){const n=Math.cos(e),i=Math.sin(e);return this.set(n,0,i,0,0,1,0,0,-i,0,n,0,0,0,0,1),this}makeRotationZ(e){const n=Math.cos(e),i=Math.sin(e);return this.set(n,-i,0,0,i,n,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,n){const i=Math.cos(n),r=Math.sin(n),a=1-i,s=e.x,l=e.y,c=e.z,d=a*s,f=a*l;return this.set(d*s+i,d*l-r*c,d*c+r*l,0,d*l+r*c,f*l+i,f*c-r*s,0,d*c-r*l,f*c+r*s,a*c*c+i,0,0,0,0,1),this}makeScale(e,n,i){return this.set(e,0,0,0,0,n,0,0,0,0,i,0,0,0,0,1),this}makeShear(e,n,i,r,a,s){return this.set(1,i,a,0,e,1,s,0,n,r,1,0,0,0,0,1),this}compose(e,n,i){const r=this.elements,a=n._x,s=n._y,l=n._z,c=n._w,d=a+a,f=s+s,h=l+l,g=a*d,m=a*f,b=a*h,y=s*f,x=s*h,v=l*h,w=c*d,S=c*f,A=c*h,R=i.x,N=i.y,C=i.z;return r[0]=(1-(y+v))*R,r[1]=(m+A)*R,r[2]=(b-S)*R,r[3]=0,r[4]=(m-A)*N,r[5]=(1-(g+v))*N,r[6]=(x+w)*N,r[7]=0,r[8]=(b+S)*C,r[9]=(x-w)*C,r[10]=(1-(g+y))*C,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this}decompose(e,n,i){const r=this.elements;let a=kd.set(r[0],r[1],r[2]).length();const s=kd.set(r[4],r[5],r[6]).length(),l=kd.set(r[8],r[9],r[10]).length();this.determinant()<0&&(a=-a),e.x=r[12],e.y=r[13],e.z=r[14],ls.copy(this);const d=1/a,f=1/s,h=1/l;return ls.elements[0]*=d,ls.elements[1]*=d,ls.elements[2]*=d,ls.elements[4]*=f,ls.elements[5]*=f,ls.elements[6]*=f,ls.elements[8]*=h,ls.elements[9]*=h,ls.elements[10]*=h,n.setFromRotationMatrix(ls),i.x=a,i.y=s,i.z=l,this}makePerspective(e,n,i,r,a,s,l=Us){const c=this.elements,d=2*a/(n-e),f=2*a/(i-r),h=(n+e)/(n-e),g=(i+r)/(i-r);let m,b;if(l===Us)m=-(s+a)/(s-a),b=-2*s*a/(s-a);else if(l===Wp)m=-s/(s-a),b=-s*a/(s-a);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+l);return c[0]=d,c[4]=0,c[8]=h,c[12]=0,c[1]=0,c[5]=f,c[9]=g,c[13]=0,c[2]=0,c[6]=0,c[10]=m,c[14]=b,c[3]=0,c[7]=0,c[11]=-1,c[15]=0,this}makeOrthographic(e,n,i,r,a,s,l=Us){const c=this.elements,d=1/(n-e),f=1/(i-r),h=1/(s-a),g=(n+e)*d,m=(i+r)*f;let b,y;if(l===Us)b=(s+a)*h,y=-2*h;else if(l===Wp)b=a*h,y=-1*h;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+l);return c[0]=2*d,c[4]=0,c[8]=0,c[12]=-g,c[1]=0,c[5]=2*f,c[9]=0,c[13]=-m,c[2]=0,c[6]=0,c[10]=y,c[14]=-b,c[3]=0,c[7]=0,c[11]=0,c[15]=1,this}equals(e){const n=this.elements,i=e.elements;for(let r=0;r<16;r++)if(n[r]!==i[r])return!1;return!0}fromArray(e,n=0){for(let i=0;i<16;i++)this.elements[i]=e[i+n];return this}toArray(e=[],n=0){const i=this.elements;return e[n]=i[0],e[n+1]=i[1],e[n+2]=i[2],e[n+3]=i[3],e[n+4]=i[4],e[n+5]=i[5],e[n+6]=i[6],e[n+7]=i[7],e[n+8]=i[8],e[n+9]=i[9],e[n+10]=i[10],e[n+11]=i[11],e[n+12]=i[12],e[n+13]=i[13],e[n+14]=i[14],e[n+15]=i[15],e}}const kd=new Ce,ls=new Ln,Une=new Ce(0,0,0),kne=new Ce(1,1,1),Bl=new Ce,z0=new Ce,fa=new Ce,lL=new Ln,cL=new Mu;class ym{constructor(e=0,n=0,i=0,r=ym.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=n,this._z=i,this._order=r}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,n,i,r=this._order){return this._x=e,this._y=n,this._z=i,this._order=r,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,n=this._order,i=!0){const r=e.elements,a=r[0],s=r[4],l=r[8],c=r[1],d=r[5],f=r[9],h=r[2],g=r[6],m=r[10];switch(n){case"XYZ":this._y=Math.asin(hr(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-f,m),this._z=Math.atan2(-s,a)):(this._x=Math.atan2(g,d),this._z=0);break;case"YXZ":this._x=Math.asin(-hr(f,-1,1)),Math.abs(f)<.9999999?(this._y=Math.atan2(l,m),this._z=Math.atan2(c,d)):(this._y=Math.atan2(-h,a),this._z=0);break;case"ZXY":this._x=Math.asin(hr(g,-1,1)),Math.abs(g)<.9999999?(this._y=Math.atan2(-h,m),this._z=Math.atan2(-s,d)):(this._y=0,this._z=Math.atan2(c,a));break;case"ZYX":this._y=Math.asin(-hr(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(g,m),this._z=Math.atan2(c,a)):(this._x=0,this._z=Math.atan2(-s,d));break;case"YZX":this._z=Math.asin(hr(c,-1,1)),Math.abs(c)<.9999999?(this._x=Math.atan2(-f,d),this._y=Math.atan2(-h,a)):(this._x=0,this._y=Math.atan2(l,m));break;case"XZY":this._z=Math.asin(-hr(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(g,d),this._y=Math.atan2(l,a)):(this._x=Math.atan2(-f,m),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+n)}return this._order=n,i===!0&&this._onChangeCallback(),this}setFromQuaternion(e,n,i){return lL.makeRotationFromQuaternion(e),this.setFromRotationMatrix(lL,n,i)}setFromVector3(e,n=this._order){return this.set(e.x,e.y,e.z,n)}reorder(e){return cL.setFromEuler(this),this.setFromQuaternion(cL,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=[],n=0){return e[n]=this._x,e[n+1]=this._y,e[n+2]=this._z,e[n+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}}ym.DEFAULT_ORDER="XYZ";class jB{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 Fne=0;const uL=new Ce,Fd=new Mu,Eo=new Ln,B0=new Ce,sp=new Ce,zne=new Ce,Bne=new Mu,dL=new Ce(1,0,0),fL=new Ce(0,1,0),hL=new Ce(0,0,1),jne={type:"added"},Hne={type:"removed"};class Ur extends Uu{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:Fne++}),this.uuid=jo(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=Ur.DEFAULT_UP.clone();const e=new Ce,n=new ym,i=new Mu,r=new Ce(1,1,1);function a(){i.setFromEuler(n,!1)}function s(){n.setFromQuaternion(i,void 0,!1)}n._onChange(a),i._onChange(s),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:n},quaternion:{configurable:!0,enumerable:!0,value:i},scale:{configurable:!0,enumerable:!0,value:r},modelViewMatrix:{value:new Ln},normalMatrix:{value:new Yt}}),this.matrix=new Ln,this.matrixWorld=new Ln,this.matrixAutoUpdate=Ur.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=Ur.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new jB,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.userData={}}onBeforeShadow(){}onAfterShadow(){}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,n){this.quaternion.setFromAxisAngle(e,n)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,n){return Fd.setFromAxisAngle(e,n),this.quaternion.multiply(Fd),this}rotateOnWorldAxis(e,n){return Fd.setFromAxisAngle(e,n),this.quaternion.premultiply(Fd),this}rotateX(e){return this.rotateOnAxis(dL,e)}rotateY(e){return this.rotateOnAxis(fL,e)}rotateZ(e){return this.rotateOnAxis(hL,e)}translateOnAxis(e,n){return uL.copy(e).applyQuaternion(this.quaternion),this.position.add(uL.multiplyScalar(n)),this}translateX(e){return this.translateOnAxis(dL,e)}translateY(e){return this.translateOnAxis(fL,e)}translateZ(e){return this.translateOnAxis(hL,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(Eo.copy(this.matrixWorld).invert())}lookAt(e,n,i){e.isVector3?B0.copy(e):B0.set(e,n,i);const r=this.parent;this.updateWorldMatrix(!0,!1),sp.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Eo.lookAt(sp,B0,this.up):Eo.lookAt(B0,sp,this.up),this.quaternion.setFromRotationMatrix(Eo),r&&(Eo.extractRotation(r.matrixWorld),Fd.setFromRotationMatrix(Eo),this.quaternion.premultiply(Fd.invert()))}add(e){if(arguments.length>1){for(let n=0;n<arguments.length;n++)this.add(arguments[n]);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(jne)):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let i=0;i<arguments.length;i++)this.remove(arguments[i]);return this}const n=this.children.indexOf(e);return n!==-1&&(e.parent=null,this.children.splice(n,1),e.dispatchEvent(Hne)),this}removeFromParent(){const e=this.parent;return e!==null&&e.remove(this),this}clear(){return this.remove(...this.children)}attach(e){return this.updateWorldMatrix(!0,!1),Eo.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),Eo.multiply(e.parent.matrixWorld)),e.applyMatrix4(Eo),this.add(e),e.updateWorldMatrix(!1,!0),this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,n){if(this[e]===n)return this;for(let i=0,r=this.children.length;i<r;i++){const s=this.children[i].getObjectByProperty(e,n);if(s!==void 0)return s}}getObjectsByProperty(e,n,i=[]){this[e]===n&&i.push(this);const r=this.children;for(let a=0,s=r.length;a<s;a++)r[a].getObjectsByProperty(e,n,i);return i}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(sp,e,zne),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(sp,Bne,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const n=this.matrixWorld.elements;return e.set(n[8],n[9],n[10]).normalize()}raycast(){}traverse(e){e(this);const n=this.children;for(let i=0,r=n.length;i<r;i++)n[i].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);const n=this.children;for(let i=0,r=n.length;i<r;i++)n[i].traverseVisible(e)}traverseAncestors(e){const n=this.parent;n!==null&&(e(n),n.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 n=this.children;for(let i=0,r=n.length;i<r;i++){const a=n[i];(a.matrixWorldAutoUpdate===!0||e===!0)&&a.updateMatrixWorld(e)}}updateWorldMatrix(e,n){const i=this.parent;if(e===!0&&i!==null&&i.matrixWorldAutoUpdate===!0&&i.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),n===!0){const r=this.children;for(let a=0,s=r.length;a<s;a++){const l=r[a];l.matrixWorldAutoUpdate===!0&&l.updateWorldMatrix(!1,!0)}}}toJSON(e){const n=e===void 0||typeof e=="string",i={};n&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},i.metadata={version:4.6,type:"Object",generator:"Object3D.toJSON"});const r={};r.uuid=this.uuid,r.type=this.type,this.name!==""&&(r.name=this.name),this.castShadow===!0&&(r.castShadow=!0),this.receiveShadow===!0&&(r.receiveShadow=!0),this.visible===!1&&(r.visible=!1),this.frustumCulled===!1&&(r.frustumCulled=!1),this.renderOrder!==0&&(r.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),r.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(r.matrixAutoUpdate=!1),this.isInstancedMesh&&(r.type="InstancedMesh",r.count=this.count,r.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(r.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(r.type="BatchedMesh",r.perObjectFrustumCulled=this.perObjectFrustumCulled,r.sortObjects=this.sortObjects,r.drawRanges=this._drawRanges,r.reservedRanges=this._reservedRanges,r.visibility=this._visibility,r.active=this._active,r.bounds=this._bounds.map(l=>({boxInitialized:l.boxInitialized,boxMin:l.box.min.toArray(),boxMax:l.box.max.toArray(),sphereInitialized:l.sphereInitialized,sphereRadius:l.sphere.radius,sphereCenter:l.sphere.center.toArray()})),r.maxGeometryCount=this._maxGeometryCount,r.maxVertexCount=this._maxVertexCount,r.maxIndexCount=this._maxIndexCount,r.geometryInitialized=this._geometryInitialized,r.geometryCount=this._geometryCount,r.matricesTexture=this._matricesTexture.toJSON(e),this.boundingSphere!==null&&(r.boundingSphere={center:r.boundingSphere.center.toArray(),radius:r.boundingSphere.radius}),this.boundingBox!==null&&(r.boundingBox={min:r.boundingBox.min.toArray(),max:r.boundingBox.max.toArray()}));function a(l,c){return l[c.uuid]===void 0&&(l[c.uuid]=c.toJSON(e)),c.uuid}if(this.isScene)this.background&&(this.background.isColor?r.background=this.background.toJSON():this.background.isTexture&&(r.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(r.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){r.geometry=a(e.geometries,this.geometry);const l=this.geometry.parameters;if(l!==void 0&&l.shapes!==void 0){const c=l.shapes;if(Array.isArray(c))for(let d=0,f=c.length;d<f;d++){const h=c[d];a(e.shapes,h)}else a(e.shapes,c)}}if(this.isSkinnedMesh&&(r.bindMode=this.bindMode,r.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(a(e.skeletons,this.skeleton),r.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){const l=[];for(let c=0,d=this.material.length;c<d;c++)l.push(a(e.materials,this.material[c]));r.material=l}else r.material=a(e.materials,this.material);if(this.children.length>0){r.children=[];for(let l=0;l<this.children.length;l++)r.children.push(this.children[l].toJSON(e).object)}if(this.animations.length>0){r.animations=[];for(let l=0;l<this.animations.length;l++){const c=this.animations[l];r.animations.push(a(e.animations,c))}}if(n){const l=s(e.geometries),c=s(e.materials),d=s(e.textures),f=s(e.images),h=s(e.shapes),g=s(e.skeletons),m=s(e.animations),b=s(e.nodes);l.length>0&&(i.geometries=l),c.length>0&&(i.materials=c),d.length>0&&(i.textures=d),f.length>0&&(i.images=f),h.length>0&&(i.shapes=h),g.length>0&&(i.skeletons=g),m.length>0&&(i.animations=m),b.length>0&&(i.nodes=b)}return i.object=r,i;function s(l){const c=[];for(const d in l){const f=l[d];delete f.metadata,c.push(f)}return c}}clone(e){return new this.constructor().copy(this,e)}copy(e,n=!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.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,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.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),n===!0)for(let i=0;i<e.children.length;i++){const r=e.children[i];this.add(r.clone())}return this}}Ur.DEFAULT_UP=new Ce(0,1,0);Ur.DEFAULT_MATRIX_AUTO_UPDATE=!0;Ur.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;const cs=new Ce,Mo=new Ce,w1=new Ce,Ao=new Ce,zd=new Ce,Bd=new Ce,pL=new Ce,E1=new Ce,M1=new Ce,A1=new Ce;let j0=!1;class us{constructor(e=new Ce,n=new Ce,i=new Ce){this.a=e,this.b=n,this.c=i}static getNormal(e,n,i,r){r.subVectors(i,n),cs.subVectors(e,n),r.cross(cs);const a=r.lengthSq();return a>0?r.multiplyScalar(1/Math.sqrt(a)):r.set(0,0,0)}static getBarycoord(e,n,i,r,a){cs.subVectors(r,n),Mo.subVectors(i,n),w1.subVectors(e,n);const s=cs.dot(cs),l=cs.dot(Mo),c=cs.dot(w1),d=Mo.dot(Mo),f=Mo.dot(w1),h=s*d-l*l;if(h===0)return a.set(-2,-1,-1);const g=1/h,m=(d*c-l*f)*g,b=(s*f-l*c)*g;return a.set(1-m-b,b,m)}static containsPoint(e,n,i,r){return this.getBarycoord(e,n,i,r,Ao),Ao.x>=0&&Ao.y>=0&&Ao.x+Ao.y<=1}static getUV(e,n,i,r,a,s,l,c){return j0===!1&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."),j0=!0),this.getInterpolation(e,n,i,r,a,s,l,c)}static getInterpolation(e,n,i,r,a,s,l,c){return this.getBarycoord(e,n,i,r,Ao),c.setScalar(0),c.addScaledVector(a,Ao.x),c.addScaledVector(s,Ao.y),c.addScaledVector(l,Ao.z),c}static isFrontFacing(e,n,i,r){return cs.subVectors(i,n),Mo.subVectors(e,n),cs.cross(Mo).dot(r)<0}set(e,n,i){return this.a.copy(e),this.b.copy(n),this.c.copy(i),this}setFromPointsAndIndices(e,n,i,r){return this.a.copy(e[n]),this.b.copy(e[i]),this.c.copy(e[r]),this}setFromAttributeAndIndices(e,n,i,r){return this.a.fromBufferAttribute(e,n),this.b.fromBufferAttribute(e,i),this.c.fromBufferAttribute(e,r),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 cs.subVectors(this.c,this.b),Mo.subVectors(this.a,this.b),cs.cross(Mo).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return us.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,n){return us.getBarycoord(e,this.a,this.b,this.c,n)}getUV(e,n,i,r,a){return j0===!1&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."),j0=!0),us.getInterpolation(e,this.a,this.b,this.c,n,i,r,a)}getInterpolation(e,n,i,r,a){return us.getInterpolation(e,this.a,this.b,this.c,n,i,r,a)}containsPoint(e){return us.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return us.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,n){const i=this.a,r=this.b,a=this.c;let s,l;zd.subVectors(r,i),Bd.subVectors(a,i),E1.subVectors(e,i);const c=zd.dot(E1),d=Bd.dot(E1);if(c<=0&&d<=0)return n.copy(i);M1.subVectors(e,r);const f=zd.dot(M1),h=Bd.dot(M1);if(f>=0&&h<=f)return n.copy(r);const g=c*h-f*d;if(g<=0&&c>=0&&f<=0)return s=c/(c-f),n.copy(i).addScaledVector(zd,s);A1.subVectors(e,a);const m=zd.dot(A1),b=Bd.dot(A1);if(b>=0&&m<=b)return n.copy(a);const y=m*d-c*b;if(y<=0&&d>=0&&b<=0)return l=d/(d-b),n.copy(i).addScaledVector(Bd,l);const x=f*b-m*h;if(x<=0&&h-f>=0&&m-b>=0)return pL.subVectors(a,r),l=(h-f)/(h-f+(m-b)),n.copy(r).addScaledVector(pL,l);const v=1/(x+y+g);return s=y*v,l=g*v,n.copy(i).addScaledVector(zd,s).addScaledVector(Bd,l)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}const HB={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},jl={h:0,s:0,l:0},H0={h:0,s:0,l:0};function T1(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+(e-t)*6*n:n<1/2?e:n<2/3?t+(e-t)*6*(2/3-n):t}let Nt=class{constructor(e,n,i){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,n,i)}set(e,n,i){if(n===void 0&&i===void 0){const r=e;r&&r.isColor?this.copy(r):typeof r=="number"?this.setHex(r):typeof r=="string"&&this.setStyle(r)}else this.setRGB(e,n,i);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,n=fr){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,An.toWorkingColorSpace(this,n),this}setRGB(e,n,i,r=An.workingColorSpace){return this.r=e,this.g=n,this.b=i,An.toWorkingColorSpace(this,r),this}setHSL(e,n,i,r=An.workingColorSpace){if(e=UT(e,1),n=hr(n,0,1),i=hr(i,0,1),n===0)this.r=this.g=this.b=i;else{const a=i<=.5?i*(1+n):i+n-i*n,s=2*i-a;this.r=T1(s,a,e+1/3),this.g=T1(s,a,e),this.b=T1(s,a,e-1/3)}return An.toWorkingColorSpace(this,r),this}setStyle(e,n=fr){function i(a){a!==void 0&&parseFloat(a)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let r;if(r=/^(\w+)\(([^\)]*)\)/.exec(e)){let a;const s=r[1],l=r[2];switch(s){case"rgb":case"rgba":if(a=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(l))return i(a[4]),this.setRGB(Math.min(255,parseInt(a[1],10))/255,Math.min(255,parseInt(a[2],10))/255,Math.min(255,parseInt(a[3],10))/255,n);if(a=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(l))return i(a[4]),this.setRGB(Math.min(100,parseInt(a[1],10))/100,Math.min(100,parseInt(a[2],10))/100,Math.min(100,parseInt(a[3],10))/100,n);break;case"hsl":case"hsla":if(a=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(l))return i(a[4]),this.setHSL(parseFloat(a[1])/360,parseFloat(a[2])/100,parseFloat(a[3])/100,n);break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(r=/^\#([A-Fa-f\d]+)$/.exec(e)){const a=r[1],s=a.length;if(s===3)return this.setRGB(parseInt(a.charAt(0),16)/15,parseInt(a.charAt(1),16)/15,parseInt(a.charAt(2),16)/15,n);if(s===6)return this.setHex(parseInt(a,16),n);console.warn("THREE.Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,n);return this}setColorName(e,n=fr){const i=HB[e.toLowerCase()];return i!==void 0?this.setHex(i,n):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=uf(e.r),this.g=uf(e.g),this.b=uf(e.b),this}copyLinearToSRGB(e){return this.r=m1(e.r),this.g=m1(e.g),this.b=m1(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=fr){return An.fromWorkingColorSpace(br.copy(this),e),Math.round(hr(br.r*255,0,255))*65536+Math.round(hr(br.g*255,0,255))*256+Math.round(hr(br.b*255,0,255))}getHexString(e=fr){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,n=An.workingColorSpace){An.fromWorkingColorSpace(br.copy(this),n);const i=br.r,r=br.g,a=br.b,s=Math.max(i,r,a),l=Math.min(i,r,a);let c,d;const f=(l+s)/2;if(l===s)c=0,d=0;else{const h=s-l;switch(d=f<=.5?h/(s+l):h/(2-s-l),s){case i:c=(r-a)/h+(r<a?6:0);break;case r:c=(a-i)/h+2;break;case a:c=(i-r)/h+4;break}c/=6}return e.h=c,e.s=d,e.l=f,e}getRGB(e,n=An.workingColorSpace){return An.fromWorkingColorSpace(br.copy(this),n),e.r=br.r,e.g=br.g,e.b=br.b,e}getStyle(e=fr){An.fromWorkingColorSpace(br.copy(this),e);const n=br.r,i=br.g,r=br.b;return e!==fr?`color(${e} ${n.toFixed(3)} ${i.toFixed(3)} ${r.toFixed(3)})`:`rgb(${Math.round(n*255)},${Math.round(i*255)},${Math.round(r*255)})`}offsetHSL(e,n,i){return this.getHSL(jl),this.setHSL(jl.h+e,jl.s+n,jl.l+i)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,n){return this.r=e.r+n.r,this.g=e.g+n.g,this.b=e.b+n.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,n){return this.r+=(e.r-this.r)*n,this.g+=(e.g-this.g)*n,this.b+=(e.b-this.b)*n,this}lerpColors(e,n,i){return this.r=e.r+(n.r-e.r)*i,this.g=e.g+(n.g-e.g)*i,this.b=e.b+(n.b-e.b)*i,this}lerpHSL(e,n){this.getHSL(jl),e.getHSL(H0);const i=Ap(jl.h,H0.h,n),r=Ap(jl.s,H0.s,n),a=Ap(jl.l,H0.l,n);return this.setHSL(i,r,a),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){const n=this.r,i=this.g,r=this.b,a=e.elements;return this.r=a[0]*n+a[3]*i+a[6]*r,this.g=a[1]*n+a[4]*i+a[7]*r,this.b=a[2]*n+a[5]*i+a[8]*r,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,n=0){return this.r=e[n],this.g=e[n+1],this.b=e[n+2],this}toArray(e=[],n=0){return e[n]=this.r,e[n+1]=this.g,e[n+2]=this.b,e}fromBufferAttribute(e,n){return this.r=e.getX(n),this.g=e.getY(n),this.b=e.getZ(n),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}};const br=new Nt;Nt.NAMES=HB;let Gne=0;class Gf extends Uu{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:Gne++}),this.uuid=jo(),this.name="",this.type="Material",this.blending=cf,this.side=cc,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=IM,this.blendDst=UM,this.blendEquation=Jc,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new Nt(0,0,0),this.blendAlpha=0,this.depthFunc=rx,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=tL,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=Nd,this.stencilZFail=Nd,this.stencilZPass=Nd,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 n in e){const i=e[n];if(i===void 0){console.warn(`THREE.Material: parameter '${n}' has value of undefined.`);continue}const r=this[n];if(r===void 0){console.warn(`THREE.Material: '${n}' is not a property of THREE.${this.type}.`);continue}r&&r.isColor?r.set(i):r&&r.isVector3&&i&&i.isVector3?r.copy(i):this[n]=i}}toJSON(e){const n=e===void 0||typeof e=="string";n&&(e={textures:{},images:{}});const i={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};i.uuid=this.uuid,i.type=this.type,this.name!==""&&(i.name=this.name),this.color&&this.color.isColor&&(i.color=this.color.getHex()),this.roughness!==void 0&&(i.roughness=this.roughness),this.metalness!==void 0&&(i.metalness=this.metalness),this.sheen!==void 0&&(i.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(i.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(i.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(i.emissive=this.emissive.getHex()),this.emissiveIntensity&&this.emissiveIntensity!==1&&(i.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(i.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(i.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(i.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(i.shininess=this.shininess),this.clearcoat!==void 0&&(i.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(i.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(i.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(i.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(i.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,i.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.iridescence!==void 0&&(i.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(i.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(i.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(i.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(i.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(i.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(i.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(i.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(i.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(i.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(i.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(i.lightMap=this.lightMap.toJSON(e).uuid,i.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(i.aoMap=this.aoMap.toJSON(e).uuid,i.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(i.bumpMap=this.bumpMap.toJSON(e).uuid,i.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(i.normalMap=this.normalMap.toJSON(e).uuid,i.normalMapType=this.normalMapType,i.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(i.displacementMap=this.displacementMap.toJSON(e).uuid,i.displacementScale=this.displacementScale,i.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(i.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(i.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(i.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(i.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(i.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(i.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(i.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(i.combine=this.combine)),this.envMapIntensity!==void 0&&(i.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(i.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(i.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(i.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(i.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(i.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(i.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(i.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(i.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(i.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(i.size=this.size),this.shadowSide!==null&&(i.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(i.sizeAttenuation=this.sizeAttenuation),this.blending!==cf&&(i.blending=this.blending),this.side!==cc&&(i.side=this.side),this.vertexColors===!0&&(i.vertexColors=!0),this.opacity<1&&(i.opacity=this.opacity),this.transparent===!0&&(i.transparent=!0),this.blendSrc!==IM&&(i.blendSrc=this.blendSrc),this.blendDst!==UM&&(i.blendDst=this.blendDst),this.blendEquation!==Jc&&(i.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(i.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(i.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(i.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(i.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(i.blendAlpha=this.blendAlpha),this.depthFunc!==rx&&(i.depthFunc=this.depthFunc),this.depthTest===!1&&(i.depthTest=this.depthTest),this.depthWrite===!1&&(i.depthWrite=this.depthWrite),this.colorWrite===!1&&(i.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(i.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==tL&&(i.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(i.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(i.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==Nd&&(i.stencilFail=this.stencilFail),this.stencilZFail!==Nd&&(i.stencilZFail=this.stencilZFail),this.stencilZPass!==Nd&&(i.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(i.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(i.rotation=this.rotation),this.polygonOffset===!0&&(i.polygonOffset=!0),this.polygonOffsetFactor!==0&&(i.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(i.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(i.linewidth=this.linewidth),this.dashSize!==void 0&&(i.dashSize=this.dashSize),this.gapSize!==void 0&&(i.gapSize=this.gapSize),this.scale!==void 0&&(i.scale=this.scale),this.dithering===!0&&(i.dithering=!0),this.alphaTest>0&&(i.alphaTest=this.alphaTest),this.alphaHash===!0&&(i.alphaHash=!0),this.alphaToCoverage===!0&&(i.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(i.premultipliedAlpha=!0),this.forceSinglePass===!0&&(i.forceSinglePass=!0),this.wireframe===!0&&(i.wireframe=!0),this.wireframeLinewidth>1&&(i.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(i.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(i.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(i.flatShading=!0),this.visible===!1&&(i.visible=!1),this.toneMapped===!1&&(i.toneMapped=!1),this.fog===!1&&(i.fog=!1),Object.keys(this.userData).length>0&&(i.userData=this.userData);function r(a){const s=[];for(const l in a){const c=a[l];delete c.metadata,s.push(c)}return s}if(n){const a=r(e.textures),s=r(e.images);a.length>0&&(i.textures=a),s.length>0&&(i.images=s)}return i}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.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,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 n=e.clippingPlanes;let i=null;if(n!==null){const r=n.length;i=new Array(r);for(let a=0;a!==r;++a)i[a]=n[a].clone()}return this.clippingPlanes=i,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.alphaHash=e.alphaHash,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 GB extends Gf{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Nt(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=OT,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 pi=new Ce,G0=new Ut;class ya{constructor(e,n,i=!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=n,this.count=e!==void 0?e.length/n:0,this.normalized=i,this.usage=jM,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.gpuType=Io,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}get updateRange(){return console.warn('THREE.BufferAttribute: "updateRange" is deprecated and removed in r169. Use "addUpdateRange()" instead.'),this._updateRange}setUsage(e){return this.usage=e,this}addUpdateRange(e,n){this.updateRanges.push({start:e,count:n})}clearUpdateRanges(){this.updateRanges.length=0}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.gpuType=e.gpuType,this}copyAt(e,n,i){e*=this.itemSize,i*=n.itemSize;for(let r=0,a=this.itemSize;r<a;r++)this.array[e+r]=n.array[i+r];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let n=0,i=this.count;n<i;n++)G0.fromBufferAttribute(this,n),G0.applyMatrix3(e),this.setXY(n,G0.x,G0.y);else if(this.itemSize===3)for(let n=0,i=this.count;n<i;n++)pi.fromBufferAttribute(this,n),pi.applyMatrix3(e),this.setXYZ(n,pi.x,pi.y,pi.z);return this}applyMatrix4(e){for(let n=0,i=this.count;n<i;n++)pi.fromBufferAttribute(this,n),pi.applyMatrix4(e),this.setXYZ(n,pi.x,pi.y,pi.z);return this}applyNormalMatrix(e){for(let n=0,i=this.count;n<i;n++)pi.fromBufferAttribute(this,n),pi.applyNormalMatrix(e),this.setXYZ(n,pi.x,pi.y,pi.z);return this}transformDirection(e){for(let n=0,i=this.count;n<i;n++)pi.fromBufferAttribute(this,n),pi.transformDirection(e),this.setXYZ(n,pi.x,pi.y,pi.z);return this}set(e,n=0){return this.array.set(e,n),this}getComponent(e,n){let i=this.array[e*this.itemSize+n];return this.normalized&&(i=Ls(i,this.array)),i}setComponent(e,n,i){return this.normalized&&(i=Mn(i,this.array)),this.array[e*this.itemSize+n]=i,this}getX(e){let n=this.array[e*this.itemSize];return this.normalized&&(n=Ls(n,this.array)),n}setX(e,n){return this.normalized&&(n=Mn(n,this.array)),this.array[e*this.itemSize]=n,this}getY(e){let n=this.array[e*this.itemSize+1];return this.normalized&&(n=Ls(n,this.array)),n}setY(e,n){return this.normalized&&(n=Mn(n,this.array)),this.array[e*this.itemSize+1]=n,this}getZ(e){let n=this.array[e*this.itemSize+2];return this.normalized&&(n=Ls(n,this.array)),n}setZ(e,n){return this.normalized&&(n=Mn(n,this.array)),this.array[e*this.itemSize+2]=n,this}getW(e){let n=this.array[e*this.itemSize+3];return this.normalized&&(n=Ls(n,this.array)),n}setW(e,n){return this.normalized&&(n=Mn(n,this.array)),this.array[e*this.itemSize+3]=n,this}setXY(e,n,i){return e*=this.itemSize,this.normalized&&(n=Mn(n,this.array),i=Mn(i,this.array)),this.array[e+0]=n,this.array[e+1]=i,this}setXYZ(e,n,i,r){return e*=this.itemSize,this.normalized&&(n=Mn(n,this.array),i=Mn(i,this.array),r=Mn(r,this.array)),this.array[e+0]=n,this.array[e+1]=i,this.array[e+2]=r,this}setXYZW(e,n,i,r,a){return e*=this.itemSize,this.normalized&&(n=Mn(n,this.array),i=Mn(i,this.array),r=Mn(r,this.array),a=Mn(a,this.array)),this.array[e+0]=n,this.array[e+1]=i,this.array[e+2]=r,this.array[e+3]=a,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!==jM&&(e.usage=this.usage),e}}class VB extends ya{constructor(e,n,i){super(new Uint16Array(e),n,i)}}class $B extends ya{constructor(e,n,i){super(new Uint32Array(e),n,i)}}class si extends ya{constructor(e,n,i){super(new Float32Array(e),n,i)}}let Vne=0;const Oa=new Ln,C1=new Ur,jd=new Ce,ha=new qa,op=new qa,$i=new Ce;class Mr extends Uu{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:Vne++}),this.uuid=jo(),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(kB(e)?$B:VB)(e,1):this.index=e,this}getAttribute(e){return this.attributes[e]}setAttribute(e,n){return this.attributes[e]=n,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,n,i=0){this.groups.push({start:e,count:n,materialIndex:i})}clearGroups(){this.groups=[]}setDrawRange(e,n){this.drawRange.start=e,this.drawRange.count=n}applyMatrix4(e){const n=this.attributes.position;n!==void 0&&(n.applyMatrix4(e),n.needsUpdate=!0);const i=this.attributes.normal;if(i!==void 0){const a=new Yt().getNormalMatrix(e);i.applyNormalMatrix(a),i.needsUpdate=!0}const r=this.attributes.tangent;return r!==void 0&&(r.transformDirection(e),r.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(e){return Oa.makeRotationFromQuaternion(e),this.applyMatrix4(Oa),this}rotateX(e){return Oa.makeRotationX(e),this.applyMatrix4(Oa),this}rotateY(e){return Oa.makeRotationY(e),this.applyMatrix4(Oa),this}rotateZ(e){return Oa.makeRotationZ(e),this.applyMatrix4(Oa),this}translate(e,n,i){return Oa.makeTranslation(e,n,i),this.applyMatrix4(Oa),this}scale(e,n,i){return Oa.makeScale(e,n,i),this.applyMatrix4(Oa),this}lookAt(e){return C1.lookAt(e),C1.updateMatrix(),this.applyMatrix4(C1.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(jd).negate(),this.translate(jd.x,jd.y,jd.z),this}setFromPoints(e){const n=[];for(let i=0,r=e.length;i<r;i++){const a=e[i];n.push(a.x,a.y,a.z||0)}return this.setAttribute("position",new si(n,3)),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new qa);const e=this.attributes.position,n=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 Ce(-1/0,-1/0,-1/0),new Ce(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),n)for(let i=0,r=n.length;i<r;i++){const a=n[i];ha.setFromBufferAttribute(a),this.morphTargetsRelative?($i.addVectors(this.boundingBox.min,ha.min),this.boundingBox.expandByPoint($i),$i.addVectors(this.boundingBox.max,ha.max),this.boundingBox.expandByPoint($i)):(this.boundingBox.expandByPoint(ha.min),this.boundingBox.expandByPoint(ha.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 Fs);const e=this.attributes.position,n=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 Ce,1/0);return}if(e){const i=this.boundingSphere.center;if(ha.setFromBufferAttribute(e),n)for(let a=0,s=n.length;a<s;a++){const l=n[a];op.setFromBufferAttribute(l),this.morphTargetsRelative?($i.addVectors(ha.min,op.min),ha.expandByPoint($i),$i.addVectors(ha.max,op.max),ha.expandByPoint($i)):(ha.expandByPoint(op.min),ha.expandByPoint(op.max))}ha.getCenter(i);let r=0;for(let a=0,s=e.count;a<s;a++)$i.fromBufferAttribute(e,a),r=Math.max(r,i.distanceToSquared($i));if(n)for(let a=0,s=n.length;a<s;a++){const l=n[a],c=this.morphTargetsRelative;for(let d=0,f=l.count;d<f;d++)$i.fromBufferAttribute(l,d),c&&(jd.fromBufferAttribute(e,d),$i.add(jd)),r=Math.max(r,i.distanceToSquared($i))}this.boundingSphere.radius=Math.sqrt(r),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,n=this.attributes;if(e===null||n.position===void 0||n.normal===void 0||n.uv===void 0){console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}const i=e.array,r=n.position.array,a=n.normal.array,s=n.uv.array,l=r.length/3;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new ya(new Float32Array(4*l),4));const c=this.getAttribute("tangent").array,d=[],f=[];for(let L=0;L<l;L++)d[L]=new Ce,f[L]=new Ce;const h=new Ce,g=new Ce,m=new Ce,b=new Ut,y=new Ut,x=new Ut,v=new Ce,w=new Ce;function S(L,B,U){h.fromArray(r,L*3),g.fromArray(r,B*3),m.fromArray(r,U*3),b.fromArray(s,L*2),y.fromArray(s,B*2),x.fromArray(s,U*2),g.sub(h),m.sub(h),y.sub(b),x.sub(b);const $=1/(y.x*x.y-x.x*y.y);isFinite($)&&(v.copy(g).multiplyScalar(x.y).addScaledVector(m,-y.y).multiplyScalar($),w.copy(m).multiplyScalar(y.x).addScaledVector(g,-x.x).multiplyScalar($),d[L].add(v),d[B].add(v),d[U].add(v),f[L].add(w),f[B].add(w),f[U].add(w))}let A=this.groups;A.length===0&&(A=[{start:0,count:i.length}]);for(let L=0,B=A.length;L<B;++L){const U=A[L],$=U.start,I=U.count;for(let W=$,X=$+I;W<X;W+=3)S(i[W+0],i[W+1],i[W+2])}const R=new Ce,N=new Ce,C=new Ce,F=new Ce;function P(L){C.fromArray(a,L*3),F.copy(C);const B=d[L];R.copy(B),R.sub(C.multiplyScalar(C.dot(B))).normalize(),N.crossVectors(F,B);const $=N.dot(f[L])<0?-1:1;c[L*4]=R.x,c[L*4+1]=R.y,c[L*4+2]=R.z,c[L*4+3]=$}for(let L=0,B=A.length;L<B;++L){const U=A[L],$=U.start,I=U.count;for(let W=$,X=$+I;W<X;W+=3)P(i[W+0]),P(i[W+1]),P(i[W+2])}}computeVertexNormals(){const e=this.index,n=this.getAttribute("position");if(n!==void 0){let i=this.getAttribute("normal");if(i===void 0)i=new ya(new Float32Array(n.count*3),3),this.setAttribute("normal",i);else for(let g=0,m=i.count;g<m;g++)i.setXYZ(g,0,0,0);const r=new Ce,a=new Ce,s=new Ce,l=new Ce,c=new Ce,d=new Ce,f=new Ce,h=new Ce;if(e)for(let g=0,m=e.count;g<m;g+=3){const b=e.getX(g+0),y=e.getX(g+1),x=e.getX(g+2);r.fromBufferAttribute(n,b),a.fromBufferAttribute(n,y),s.fromBufferAttribute(n,x),f.subVectors(s,a),h.subVectors(r,a),f.cross(h),l.fromBufferAttribute(i,b),c.fromBufferAttribute(i,y),d.fromBufferAttribute(i,x),l.add(f),c.add(f),d.add(f),i.setXYZ(b,l.x,l.y,l.z),i.setXYZ(y,c.x,c.y,c.z),i.setXYZ(x,d.x,d.y,d.z)}else for(let g=0,m=n.count;g<m;g+=3)r.fromBufferAttribute(n,g+0),a.fromBufferAttribute(n,g+1),s.fromBufferAttribute(n,g+2),f.subVectors(s,a),h.subVectors(r,a),f.cross(h),i.setXYZ(g+0,f.x,f.y,f.z),i.setXYZ(g+1,f.x,f.y,f.z),i.setXYZ(g+2,f.x,f.y,f.z);this.normalizeNormals(),i.needsUpdate=!0}}normalizeNormals(){const e=this.attributes.normal;for(let n=0,i=e.count;n<i;n++)$i.fromBufferAttribute(e,n),$i.normalize(),e.setXYZ(n,$i.x,$i.y,$i.z)}toNonIndexed(){function e(l,c){const d=l.array,f=l.itemSize,h=l.normalized,g=new d.constructor(c.length*f);let m=0,b=0;for(let y=0,x=c.length;y<x;y++){l.isInterleavedBufferAttribute?m=c[y]*l.data.stride+l.offset:m=c[y]*f;for(let v=0;v<f;v++)g[b++]=d[m++]}return new ya(g,f,h)}if(this.index===null)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const n=new Mr,i=this.index.array,r=this.attributes;for(const l in r){const c=r[l],d=e(c,i);n.setAttribute(l,d)}const a=this.morphAttributes;for(const l in a){const c=[],d=a[l];for(let f=0,h=d.length;f<h;f++){const g=d[f],m=e(g,i);c.push(m)}n.morphAttributes[l]=c}n.morphTargetsRelative=this.morphTargetsRelative;const s=this.groups;for(let l=0,c=s.length;l<c;l++){const d=s[l];n.addGroup(d.start,d.count,d.materialIndex)}return n}toJSON(){const e={metadata:{version:4.6,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 n=this.index;n!==null&&(e.data.index={type:n.array.constructor.name,array:Array.prototype.slice.call(n.array)});const i=this.attributes;for(const c in i){const d=i[c];e.data.attributes[c]=d.toJSON(e.data)}const r={};let a=!1;for(const c in this.morphAttributes){const d=this.morphAttributes[c],f=[];for(let h=0,g=d.length;h<g;h++){const m=d[h];f.push(m.toJSON(e.data))}f.length>0&&(r[c]=f,a=!0)}a&&(e.data.morphAttributes=r,e.data.morphTargetsRelative=this.morphTargetsRelative);const s=this.groups;s.length>0&&(e.data.groups=JSON.parse(JSON.stringify(s)));const l=this.boundingSphere;return l!==null&&(e.data.boundingSphere={center:l.center.toArray(),radius:l.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 n={};this.name=e.name;const i=e.index;i!==null&&this.setIndex(i.clone(n));const r=e.attributes;for(const d in r){const f=r[d];this.setAttribute(d,f.clone(n))}const a=e.morphAttributes;for(const d in a){const f=[],h=a[d];for(let g=0,m=h.length;g<m;g++)f.push(h[g].clone(n));this.morphAttributes[d]=f}this.morphTargetsRelative=e.morphTargetsRelative;const s=e.groups;for(let d=0,f=s.length;d<f;d++){const h=s[d];this.addGroup(h.start,h.count,h.materialIndex)}const l=e.boundingBox;l!==null&&(this.boundingBox=l.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,this}dispose(){this.dispatchEvent({type:"dispose"})}}const mL=new Ln,Gc=new kT,V0=new Fs,gL=new Ce,Hd=new Ce,Gd=new Ce,Vd=new Ce,R1=new Ce,$0=new Ce,W0=new Ut,X0=new Ut,q0=new Ut,vL=new Ce,xL=new Ce,yL=new Ce,Y0=new Ce,K0=new Ce;class gs extends Ur{constructor(e=new Mr,n=new GB){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=n,this.updateMorphTargets()}copy(e,n){return super.copy(e,n),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){const n=this.geometry.morphAttributes,i=Object.keys(n);if(i.length>0){const r=n[i[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let a=0,s=r.length;a<s;a++){const l=r[a].name||String(a);this.morphTargetInfluences.push(0),this.morphTargetDictionary[l]=a}}}}getVertexPosition(e,n){const i=this.geometry,r=i.attributes.position,a=i.morphAttributes.position,s=i.morphTargetsRelative;n.fromBufferAttribute(r,e);const l=this.morphTargetInfluences;if(a&&l){$0.set(0,0,0);for(let c=0,d=a.length;c<d;c++){const f=l[c],h=a[c];f!==0&&(R1.fromBufferAttribute(h,e),s?$0.addScaledVector(R1,f):$0.addScaledVector(R1.sub(n),f))}n.add($0)}return n}raycast(e,n){const i=this.geometry,r=this.material,a=this.matrixWorld;r!==void 0&&(i.boundingSphere===null&&i.computeBoundingSphere(),V0.copy(i.boundingSphere),V0.applyMatrix4(a),Gc.copy(e.ray).recast(e.near),!(V0.containsPoint(Gc.origin)===!1&&(Gc.intersectSphere(V0,gL)===null||Gc.origin.distanceToSquared(gL)>(e.far-e.near)**2))&&(mL.copy(a).invert(),Gc.copy(e.ray).applyMatrix4(mL),!(i.boundingBox!==null&&Gc.intersectsBox(i.boundingBox)===!1)&&this._computeIntersections(e,n,Gc)))}_computeIntersections(e,n,i){let r;const a=this.geometry,s=this.material,l=a.index,c=a.attributes.position,d=a.attributes.uv,f=a.attributes.uv1,h=a.attributes.normal,g=a.groups,m=a.drawRange;if(l!==null)if(Array.isArray(s))for(let b=0,y=g.length;b<y;b++){const x=g[b],v=s[x.materialIndex],w=Math.max(x.start,m.start),S=Math.min(l.count,Math.min(x.start+x.count,m.start+m.count));for(let A=w,R=S;A<R;A+=3){const N=l.getX(A),C=l.getX(A+1),F=l.getX(A+2);r=Z0(this,v,e,i,d,f,h,N,C,F),r&&(r.faceIndex=Math.floor(A/3),r.face.materialIndex=x.materialIndex,n.push(r))}}else{const b=Math.max(0,m.start),y=Math.min(l.count,m.start+m.count);for(let x=b,v=y;x<v;x+=3){const w=l.getX(x),S=l.getX(x+1),A=l.getX(x+2);r=Z0(this,s,e,i,d,f,h,w,S,A),r&&(r.faceIndex=Math.floor(x/3),n.push(r))}}else if(c!==void 0)if(Array.isArray(s))for(let b=0,y=g.length;b<y;b++){const x=g[b],v=s[x.materialIndex],w=Math.max(x.start,m.start),S=Math.min(c.count,Math.min(x.start+x.count,m.start+m.count));for(let A=w,R=S;A<R;A+=3){const N=A,C=A+1,F=A+2;r=Z0(this,v,e,i,d,f,h,N,C,F),r&&(r.faceIndex=Math.floor(A/3),r.face.materialIndex=x.materialIndex,n.push(r))}}else{const b=Math.max(0,m.start),y=Math.min(c.count,m.start+m.count);for(let x=b,v=y;x<v;x+=3){const w=x,S=x+1,A=x+2;r=Z0(this,s,e,i,d,f,h,w,S,A),r&&(r.faceIndex=Math.floor(x/3),n.push(r))}}}}function $ne(t,e,n,i,r,a,s,l){let c;if(e.side===Zr?c=i.intersectTriangle(s,a,r,!0,l):c=i.intersectTriangle(r,a,s,e.side===cc,l),c===null)return null;K0.copy(l),K0.applyMatrix4(t.matrixWorld);const d=n.ray.origin.distanceTo(K0);return d<n.near||d>n.far?null:{distance:d,point:K0.clone(),object:t}}function Z0(t,e,n,i,r,a,s,l,c,d){t.getVertexPosition(l,Hd),t.getVertexPosition(c,Gd),t.getVertexPosition(d,Vd);const f=$ne(t,e,n,i,Hd,Gd,Vd,Y0);if(f){r&&(W0.fromBufferAttribute(r,l),X0.fromBufferAttribute(r,c),q0.fromBufferAttribute(r,d),f.uv=us.getInterpolation(Y0,Hd,Gd,Vd,W0,X0,q0,new Ut)),a&&(W0.fromBufferAttribute(a,l),X0.fromBufferAttribute(a,c),q0.fromBufferAttribute(a,d),f.uv1=us.getInterpolation(Y0,Hd,Gd,Vd,W0,X0,q0,new Ut),f.uv2=f.uv1),s&&(vL.fromBufferAttribute(s,l),xL.fromBufferAttribute(s,c),yL.fromBufferAttribute(s,d),f.normal=us.getInterpolation(Y0,Hd,Gd,Vd,vL,xL,yL,new Ce),f.normal.dot(i.direction)>0&&f.normal.multiplyScalar(-1));const h={a:l,b:c,c:d,normal:new Ce,materialIndex:0};us.getNormal(Hd,Gd,Vd,h.normal),f.face=h}return f}class bm extends Mr{constructor(e=1,n=1,i=1,r=1,a=1,s=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:n,depth:i,widthSegments:r,heightSegments:a,depthSegments:s};const l=this;r=Math.floor(r),a=Math.floor(a),s=Math.floor(s);const c=[],d=[],f=[],h=[];let g=0,m=0;b("z","y","x",-1,-1,i,n,e,s,a,0),b("z","y","x",1,-1,i,n,-e,s,a,1),b("x","z","y",1,1,e,i,n,r,s,2),b("x","z","y",1,-1,e,i,-n,r,s,3),b("x","y","z",1,-1,e,n,i,r,a,4),b("x","y","z",-1,-1,e,n,-i,r,a,5),this.setIndex(c),this.setAttribute("position",new si(d,3)),this.setAttribute("normal",new si(f,3)),this.setAttribute("uv",new si(h,2));function b(y,x,v,w,S,A,R,N,C,F,P){const L=A/C,B=R/F,U=A/2,$=R/2,I=N/2,W=C+1,X=F+1;let V=0,Y=0;const J=new Ce;for(let se=0;se<X;se++){const H=se*B-$;for(let q=0;q<W;q++){const re=q*L-U;J[y]=re*w,J[x]=H*S,J[v]=I,d.push(J.x,J.y,J.z),J[y]=0,J[x]=0,J[v]=N>0?1:-1,f.push(J.x,J.y,J.z),h.push(q/C),h.push(1-se/F),V+=1}}for(let se=0;se<F;se++)for(let H=0;H<C;H++){const q=g+H+W*se,re=g+H+W*(se+1),ce=g+(H+1)+W*(se+1),ye=g+(H+1)+W*se;c.push(q,re,ye),c.push(re,ce,ye),Y+=6}l.addGroup(m,Y,P),m+=Y,g+=V}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new bm(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}function Mf(t){const e={};for(const n in t){e[n]={};for(const i in t[n]){const r=t[n][i];r&&(r.isColor||r.isMatrix3||r.isMatrix4||r.isVector2||r.isVector3||r.isVector4||r.isTexture||r.isQuaternion)?r.isRenderTargetTexture?(console.warn("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[n][i]=null):e[n][i]=r.clone():Array.isArray(r)?e[n][i]=r.slice():e[n][i]=r}}return e}function Dr(t){const e={};for(let n=0;n<t.length;n++){const i=Mf(t[n]);for(const r in i)e[r]=i[r]}return e}function Wne(t){const e=[];for(let n=0;n<t.length;n++)e.push(t[n].clone());return e}function WB(t){return t.getRenderTarget()===null?t.outputColorSpace:An.workingColorSpace}const FT={clone:Mf,merge:Dr};var Xne=`void main() {
  3840. gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
  3841. }`,qne=`void main() {
  3842. gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
  3843. }`;class uc extends Gf{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=Xne,this.fragmentShader=qne,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={derivatives:!1,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[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=Mf(e.uniforms),this.uniformsGroups=Wne(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 n=super.toJSON(e);n.glslVersion=this.glslVersion,n.uniforms={};for(const r in this.uniforms){const s=this.uniforms[r].value;s&&s.isTexture?n.uniforms[r]={type:"t",value:s.toJSON(e).uuid}:s&&s.isColor?n.uniforms[r]={type:"c",value:s.getHex()}:s&&s.isVector2?n.uniforms[r]={type:"v2",value:s.toArray()}:s&&s.isVector3?n.uniforms[r]={type:"v3",value:s.toArray()}:s&&s.isVector4?n.uniforms[r]={type:"v4",value:s.toArray()}:s&&s.isMatrix3?n.uniforms[r]={type:"m3",value:s.toArray()}:s&&s.isMatrix4?n.uniforms[r]={type:"m4",value:s.toArray()}:n.uniforms[r]={value:s}}Object.keys(this.defines).length>0&&(n.defines=this.defines),n.vertexShader=this.vertexShader,n.fragmentShader=this.fragmentShader,n.lights=this.lights,n.clipping=this.clipping;const i={};for(const r in this.extensions)this.extensions[r]===!0&&(i[r]=!0);return Object.keys(i).length>0&&(n.extensions=i),n}}class XB extends Ur{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new Ln,this.projectionMatrix=new Ln,this.projectionMatrixInverse=new Ln,this.coordinateSystem=Us}copy(e,n){return super.copy(e,n),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,n){super.updateWorldMatrix(e,n),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}}class ma extends XB{constructor(e=50,n=1,i=.1,r=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=i,this.far=r,this.focus=10,this.aspect=n,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,n){return super.copy(e,n),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 n=.5*this.getFilmHeight()/e;this.fov=Xp*2*Math.atan(n),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(Mp*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return Xp*2*Math.atan(Math.tan(Mp*.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,n,i,r,a,s){this.aspect=e/n,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=n,this.view.offsetX=i,this.view.offsetY=r,this.view.width=a,this.view.height=s,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let n=e*Math.tan(Mp*.5*this.fov)/this.zoom,i=2*n,r=this.aspect*i,a=-.5*r;const s=this.view;if(this.view!==null&&this.view.enabled){const c=s.fullWidth,d=s.fullHeight;a+=s.offsetX*r/c,n-=s.offsetY*i/d,r*=s.width/c,i*=s.height/d}const l=this.filmOffset;l!==0&&(a+=e*l/this.getFilmWidth()),this.projectionMatrix.makePerspective(a,a+r,n,n-i,e,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const n=super.toJSON(e);return n.object.fov=this.fov,n.object.zoom=this.zoom,n.object.near=this.near,n.object.far=this.far,n.object.focus=this.focus,n.object.aspect=this.aspect,this.view!==null&&(n.object.view=Object.assign({},this.view)),n.object.filmGauge=this.filmGauge,n.object.filmOffset=this.filmOffset,n}}const $d=-90,Wd=1;class Yne extends Ur{constructor(e,n,i){super(),this.type="CubeCamera",this.renderTarget=i,this.coordinateSystem=null,this.activeMipmapLevel=0;const r=new ma($d,Wd,e,n);r.layers=this.layers,this.add(r);const a=new ma($d,Wd,e,n);a.layers=this.layers,this.add(a);const s=new ma($d,Wd,e,n);s.layers=this.layers,this.add(s);const l=new ma($d,Wd,e,n);l.layers=this.layers,this.add(l);const c=new ma($d,Wd,e,n);c.layers=this.layers,this.add(c);const d=new ma($d,Wd,e,n);d.layers=this.layers,this.add(d)}updateCoordinateSystem(){const e=this.coordinateSystem,n=this.children.concat(),[i,r,a,s,l,c]=n;for(const d of n)this.remove(d);if(e===Us)i.up.set(0,1,0),i.lookAt(1,0,0),r.up.set(0,1,0),r.lookAt(-1,0,0),a.up.set(0,0,-1),a.lookAt(0,1,0),s.up.set(0,0,1),s.lookAt(0,-1,0),l.up.set(0,1,0),l.lookAt(0,0,1),c.up.set(0,1,0),c.lookAt(0,0,-1);else if(e===Wp)i.up.set(0,-1,0),i.lookAt(-1,0,0),r.up.set(0,-1,0),r.lookAt(1,0,0),a.up.set(0,0,1),a.lookAt(0,1,0),s.up.set(0,0,-1),s.lookAt(0,-1,0),l.up.set(0,-1,0),l.lookAt(0,0,1),c.up.set(0,-1,0),c.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(const d of n)this.add(d),d.updateMatrixWorld()}update(e,n){this.parent===null&&this.updateMatrixWorld();const{renderTarget:i,activeMipmapLevel:r}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[a,s,l,c,d,f]=this.children,h=e.getRenderTarget(),g=e.getActiveCubeFace(),m=e.getActiveMipmapLevel(),b=e.xr.enabled;e.xr.enabled=!1;const y=i.texture.generateMipmaps;i.texture.generateMipmaps=!1,e.setRenderTarget(i,0,r),e.render(n,a),e.setRenderTarget(i,1,r),e.render(n,s),e.setRenderTarget(i,2,r),e.render(n,l),e.setRenderTarget(i,3,r),e.render(n,c),e.setRenderTarget(i,4,r),e.render(n,d),i.texture.generateMipmaps=y,e.setRenderTarget(i,5,r),e.render(n,f),e.setRenderTarget(h,g,m),e.xr.enabled=b,i.texture.needsPMREMUpdate=!0}}class qB extends Qr{constructor(e,n,i,r,a,s,l,c,d,f){e=e!==void 0?e:[],n=n!==void 0?n:Sf,super(e,n,i,r,a,s,l,c,d,f),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class Kne extends Eu{constructor(e=1,n={}){super(e,e,n),this.isWebGLCubeRenderTarget=!0;const i={width:e,height:e,depth:1},r=[i,i,i,i,i,i];n.encoding!==void 0&&(Tp("THREE.WebGLCubeRenderTarget: option.encoding has been replaced by option.colorSpace."),n.colorSpace=n.encoding===uu?fr:Va),this.texture=new qB(r,n.mapping,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=n.generateMipmaps!==void 0?n.generateMipmaps:!1,this.texture.minFilter=n.minFilter!==void 0?n.minFilter:Ha}fromEquirectangularTexture(e,n){this.texture.type=n.type,this.texture.colorSpace=n.colorSpace,this.texture.generateMipmaps=n.generateMipmaps,this.texture.minFilter=n.minFilter,this.texture.magFilter=n.magFilter;const i={uniforms:{tEquirect:{value:null}},vertexShader:`
  3844. varying vec3 vWorldDirection;
  3845. vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
  3846. return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
  3847. }
  3848. void main() {
  3849. vWorldDirection = transformDirection( position, modelMatrix );
  3850. #include <begin_vertex>
  3851. #include <project_vertex>
  3852. }
  3853. `,fragmentShader:`
  3854. uniform sampler2D tEquirect;
  3855. varying vec3 vWorldDirection;
  3856. #include <common>
  3857. void main() {
  3858. vec3 direction = normalize( vWorldDirection );
  3859. vec2 sampleUV = equirectUv( direction );
  3860. gl_FragColor = texture2D( tEquirect, sampleUV );
  3861. }
  3862. `},r=new bm(5,5,5),a=new uc({name:"CubemapFromEquirect",uniforms:Mf(i.uniforms),vertexShader:i.vertexShader,fragmentShader:i.fragmentShader,side:Zr,blending:ic});a.uniforms.tEquirect.value=n;const s=new gs(r,a),l=n.minFilter;return n.minFilter===Vp&&(n.minFilter=Ha),new Yne(1,10,this).update(e,s),n.minFilter=l,s.geometry.dispose(),s.material.dispose(),this}clear(e,n,i,r){const a=e.getRenderTarget();for(let s=0;s<6;s++)e.setRenderTarget(this,s),e.clear(n,i,r);e.setRenderTarget(a)}}const P1=new Ce,Zne=new Ce,Qne=new Yt;class $l{constructor(e=new Ce(1,0,0),n=0){this.isPlane=!0,this.normal=e,this.constant=n}set(e,n){return this.normal.copy(e),this.constant=n,this}setComponents(e,n,i,r){return this.normal.set(e,n,i),this.constant=r,this}setFromNormalAndCoplanarPoint(e,n){return this.normal.copy(e),this.constant=-n.dot(this.normal),this}setFromCoplanarPoints(e,n,i){const r=P1.subVectors(i,n).cross(Zne.subVectors(e,n)).normalize();return this.setFromNormalAndCoplanarPoint(r,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,n){return n.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,n){const i=e.delta(P1),r=this.normal.dot(i);if(r===0)return this.distanceToPoint(e.start)===0?n.copy(e.start):null;const a=-(e.start.dot(this.normal)+this.constant)/r;return a<0||a>1?null:n.copy(e.start).addScaledVector(i,a)}intersectsLine(e){const n=this.distanceToPoint(e.start),i=this.distanceToPoint(e.end);return n<0&&i>0||i<0&&n>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,n){const i=n||Qne.getNormalMatrix(e),r=this.coplanarPoint(P1).applyMatrix4(e),a=this.normal.applyMatrix3(i).normalize();return this.constant=-r.dot(a),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 Vc=new Fs,Q0=new Ce;class yy{constructor(e=new $l,n=new $l,i=new $l,r=new $l,a=new $l,s=new $l){this.planes=[e,n,i,r,a,s]}set(e,n,i,r,a,s){const l=this.planes;return l[0].copy(e),l[1].copy(n),l[2].copy(i),l[3].copy(r),l[4].copy(a),l[5].copy(s),this}copy(e){const n=this.planes;for(let i=0;i<6;i++)n[i].copy(e.planes[i]);return this}setFromProjectionMatrix(e,n=Us){const i=this.planes,r=e.elements,a=r[0],s=r[1],l=r[2],c=r[3],d=r[4],f=r[5],h=r[6],g=r[7],m=r[8],b=r[9],y=r[10],x=r[11],v=r[12],w=r[13],S=r[14],A=r[15];if(i[0].setComponents(c-a,g-d,x-m,A-v).normalize(),i[1].setComponents(c+a,g+d,x+m,A+v).normalize(),i[2].setComponents(c+s,g+f,x+b,A+w).normalize(),i[3].setComponents(c-s,g-f,x-b,A-w).normalize(),i[4].setComponents(c-l,g-h,x-y,A-S).normalize(),n===Us)i[5].setComponents(c+l,g+h,x+y,A+S).normalize();else if(n===Wp)i[5].setComponents(l,h,y,S).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+n);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),Vc.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const n=e.geometry;n.boundingSphere===null&&n.computeBoundingSphere(),Vc.copy(n.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(Vc)}intersectsSprite(e){return Vc.center.set(0,0,0),Vc.radius=.7071067811865476,Vc.applyMatrix4(e.matrixWorld),this.intersectsSphere(Vc)}intersectsSphere(e){const n=this.planes,i=e.center,r=-e.radius;for(let a=0;a<6;a++)if(n[a].distanceToPoint(i)<r)return!1;return!0}intersectsBox(e){const n=this.planes;for(let i=0;i<6;i++){const r=n[i];if(Q0.x=r.normal.x>0?e.max.x:e.min.x,Q0.y=r.normal.y>0?e.max.y:e.min.y,Q0.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(Q0)<0)return!1}return!0}containsPoint(e){const n=this.planes;for(let i=0;i<6;i++)if(n[i].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}function YB(){let t=null,e=!1,n=null,i=null;function r(a,s){n(a,s),i=t.requestAnimationFrame(r)}return{start:function(){e!==!0&&n!==null&&(i=t.requestAnimationFrame(r),e=!0)},stop:function(){t.cancelAnimationFrame(i),e=!1},setAnimationLoop:function(a){n=a},setContext:function(a){t=a}}}function Jne(t,e){const n=e.isWebGL2,i=new WeakMap;function r(d,f){const h=d.array,g=d.usage,m=h.byteLength,b=t.createBuffer();t.bindBuffer(f,b),t.bufferData(f,h,g),d.onUploadCallback();let y;if(h instanceof Float32Array)y=t.FLOAT;else if(h instanceof Uint16Array)if(d.isFloat16BufferAttribute)if(n)y=t.HALF_FLOAT;else throw new Error("THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2.");else y=t.UNSIGNED_SHORT;else if(h instanceof Int16Array)y=t.SHORT;else if(h instanceof Uint32Array)y=t.UNSIGNED_INT;else if(h instanceof Int32Array)y=t.INT;else if(h instanceof Int8Array)y=t.BYTE;else if(h instanceof Uint8Array)y=t.UNSIGNED_BYTE;else if(h instanceof Uint8ClampedArray)y=t.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+h);return{buffer:b,type:y,bytesPerElement:h.BYTES_PER_ELEMENT,version:d.version,size:m}}function a(d,f,h){const g=f.array,m=f._updateRange,b=f.updateRanges;if(t.bindBuffer(h,d),m.count===-1&&b.length===0&&t.bufferSubData(h,0,g),b.length!==0){for(let y=0,x=b.length;y<x;y++){const v=b[y];n?t.bufferSubData(h,v.start*g.BYTES_PER_ELEMENT,g,v.start,v.count):t.bufferSubData(h,v.start*g.BYTES_PER_ELEMENT,g.subarray(v.start,v.start+v.count))}f.clearUpdateRanges()}m.count!==-1&&(n?t.bufferSubData(h,m.offset*g.BYTES_PER_ELEMENT,g,m.offset,m.count):t.bufferSubData(h,m.offset*g.BYTES_PER_ELEMENT,g.subarray(m.offset,m.offset+m.count)),m.count=-1),f.onUploadCallback()}function s(d){return d.isInterleavedBufferAttribute&&(d=d.data),i.get(d)}function l(d){d.isInterleavedBufferAttribute&&(d=d.data);const f=i.get(d);f&&(t.deleteBuffer(f.buffer),i.delete(d))}function c(d,f){if(d.isGLBufferAttribute){const g=i.get(d);(!g||g.version<d.version)&&i.set(d,{buffer:d.buffer,type:d.type,bytesPerElement:d.elementSize,version:d.version});return}d.isInterleavedBufferAttribute&&(d=d.data);const h=i.get(d);if(h===void 0)i.set(d,r(d,f));else if(h.version<d.version){if(h.size!==d.array.byteLength)throw new Error("THREE.WebGLAttributes: The size of the buffer attribute's array buffer does not match the original size. Resizing buffer attributes is not supported.");a(h.buffer,d,f),h.version=d.version}}return{get:s,remove:l,update:c}}class zT extends Mr{constructor(e=1,n=1,i=1,r=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:n,widthSegments:i,heightSegments:r};const a=e/2,s=n/2,l=Math.floor(i),c=Math.floor(r),d=l+1,f=c+1,h=e/l,g=n/c,m=[],b=[],y=[],x=[];for(let v=0;v<f;v++){const w=v*g-s;for(let S=0;S<d;S++){const A=S*h-a;b.push(A,-w,0),y.push(0,0,1),x.push(S/l),x.push(1-v/c)}}for(let v=0;v<c;v++)for(let w=0;w<l;w++){const S=w+d*v,A=w+d*(v+1),R=w+1+d*(v+1),N=w+1+d*v;m.push(S,A,N),m.push(A,R,N)}this.setIndex(m),this.setAttribute("position",new si(b,3)),this.setAttribute("normal",new si(y,3)),this.setAttribute("uv",new si(x,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new zT(e.width,e.height,e.widthSegments,e.heightSegments)}}var eie=`#ifdef USE_ALPHAHASH
  3863. if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;
  3864. #endif`,tie=`#ifdef USE_ALPHAHASH
  3865. const float ALPHA_HASH_SCALE = 0.05;
  3866. float hash2D( vec2 value ) {
  3867. return fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );
  3868. }
  3869. float hash3D( vec3 value ) {
  3870. return hash2D( vec2( hash2D( value.xy ), value.z ) );
  3871. }
  3872. float getAlphaHashThreshold( vec3 position ) {
  3873. float maxDeriv = max(
  3874. length( dFdx( position.xyz ) ),
  3875. length( dFdy( position.xyz ) )
  3876. );
  3877. float pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv );
  3878. vec2 pixScales = vec2(
  3879. exp2( floor( log2( pixScale ) ) ),
  3880. exp2( ceil( log2( pixScale ) ) )
  3881. );
  3882. vec2 alpha = vec2(
  3883. hash3D( floor( pixScales.x * position.xyz ) ),
  3884. hash3D( floor( pixScales.y * position.xyz ) )
  3885. );
  3886. float lerpFactor = fract( log2( pixScale ) );
  3887. float x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y;
  3888. float a = min( lerpFactor, 1.0 - lerpFactor );
  3889. vec3 cases = vec3(
  3890. x * x / ( 2.0 * a * ( 1.0 - a ) ),
  3891. ( x - 0.5 * a ) / ( 1.0 - a ),
  3892. 1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) )
  3893. );
  3894. float threshold = ( x < ( 1.0 - a ) )
  3895. ? ( ( x < a ) ? cases.x : cases.y )
  3896. : cases.z;
  3897. return clamp( threshold , 1.0e-6, 1.0 );
  3898. }
  3899. #endif`,nie=`#ifdef USE_ALPHAMAP
  3900. diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;
  3901. #endif`,iie=`#ifdef USE_ALPHAMAP
  3902. uniform sampler2D alphaMap;
  3903. #endif`,rie=`#ifdef USE_ALPHATEST
  3904. if ( diffuseColor.a < alphaTest ) discard;
  3905. #endif`,aie=`#ifdef USE_ALPHATEST
  3906. uniform float alphaTest;
  3907. #endif`,sie=`#ifdef USE_AOMAP
  3908. float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;
  3909. reflectedLight.indirectDiffuse *= ambientOcclusion;
  3910. #if defined( USE_CLEARCOAT )
  3911. clearcoatSpecularIndirect *= ambientOcclusion;
  3912. #endif
  3913. #if defined( USE_SHEEN )
  3914. sheenSpecularIndirect *= ambientOcclusion;
  3915. #endif
  3916. #if defined( USE_ENVMAP ) && defined( STANDARD )
  3917. float dotNV = saturate( dot( geometryNormal, geometryViewDir ) );
  3918. reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );
  3919. #endif
  3920. #endif`,oie=`#ifdef USE_AOMAP
  3921. uniform sampler2D aoMap;
  3922. uniform float aoMapIntensity;
  3923. #endif`,lie=`#ifdef USE_BATCHING
  3924. attribute float batchId;
  3925. uniform highp sampler2D batchingTexture;
  3926. mat4 getBatchingMatrix( const in float i ) {
  3927. int size = textureSize( batchingTexture, 0 ).x;
  3928. int j = int( i ) * 4;
  3929. int x = j % size;
  3930. int y = j / size;
  3931. vec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 );
  3932. vec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 );
  3933. vec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 );
  3934. vec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 );
  3935. return mat4( v1, v2, v3, v4 );
  3936. }
  3937. #endif`,cie=`#ifdef USE_BATCHING
  3938. mat4 batchingMatrix = getBatchingMatrix( batchId );
  3939. #endif`,uie=`vec3 transformed = vec3( position );
  3940. #ifdef USE_ALPHAHASH
  3941. vPosition = vec3( position );
  3942. #endif`,die=`vec3 objectNormal = vec3( normal );
  3943. #ifdef USE_TANGENT
  3944. vec3 objectTangent = vec3( tangent.xyz );
  3945. #endif`,fie=`float G_BlinnPhong_Implicit( ) {
  3946. return 0.25;
  3947. }
  3948. float D_BlinnPhong( const in float shininess, const in float dotNH ) {
  3949. return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );
  3950. }
  3951. vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {
  3952. vec3 halfDir = normalize( lightDir + viewDir );
  3953. float dotNH = saturate( dot( normal, halfDir ) );
  3954. float dotVH = saturate( dot( viewDir, halfDir ) );
  3955. vec3 F = F_Schlick( specularColor, 1.0, dotVH );
  3956. float G = G_BlinnPhong_Implicit( );
  3957. float D = D_BlinnPhong( shininess, dotNH );
  3958. return F * ( G * D );
  3959. } // validated`,hie=`#ifdef USE_IRIDESCENCE
  3960. const mat3 XYZ_TO_REC709 = mat3(
  3961. 3.2404542, -0.9692660, 0.0556434,
  3962. -1.5371385, 1.8760108, -0.2040259,
  3963. -0.4985314, 0.0415560, 1.0572252
  3964. );
  3965. vec3 Fresnel0ToIor( vec3 fresnel0 ) {
  3966. vec3 sqrtF0 = sqrt( fresnel0 );
  3967. return ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );
  3968. }
  3969. vec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {
  3970. return pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );
  3971. }
  3972. float IorToFresnel0( float transmittedIor, float incidentIor ) {
  3973. return pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));
  3974. }
  3975. vec3 evalSensitivity( float OPD, vec3 shift ) {
  3976. float phase = 2.0 * PI * OPD * 1.0e-9;
  3977. vec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );
  3978. vec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );
  3979. vec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );
  3980. vec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );
  3981. 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 ) );
  3982. xyz /= 1.0685e-7;
  3983. vec3 rgb = XYZ_TO_REC709 * xyz;
  3984. return rgb;
  3985. }
  3986. vec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {
  3987. vec3 I;
  3988. float iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );
  3989. float sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );
  3990. float cosTheta2Sq = 1.0 - sinTheta2Sq;
  3991. if ( cosTheta2Sq < 0.0 ) {
  3992. return vec3( 1.0 );
  3993. }
  3994. float cosTheta2 = sqrt( cosTheta2Sq );
  3995. float R0 = IorToFresnel0( iridescenceIOR, outsideIOR );
  3996. float R12 = F_Schlick( R0, 1.0, cosTheta1 );
  3997. float T121 = 1.0 - R12;
  3998. float phi12 = 0.0;
  3999. if ( iridescenceIOR < outsideIOR ) phi12 = PI;
  4000. float phi21 = PI - phi12;
  4001. vec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) ); vec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );
  4002. vec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );
  4003. vec3 phi23 = vec3( 0.0 );
  4004. if ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;
  4005. if ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;
  4006. if ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;
  4007. float OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;
  4008. vec3 phi = vec3( phi21 ) + phi23;
  4009. vec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );
  4010. vec3 r123 = sqrt( R123 );
  4011. vec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );
  4012. vec3 C0 = R12 + Rs;
  4013. I = C0;
  4014. vec3 Cm = Rs - T121;
  4015. for ( int m = 1; m <= 2; ++ m ) {
  4016. Cm *= r123;
  4017. vec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );
  4018. I += Cm * Sm;
  4019. }
  4020. return max( I, vec3( 0.0 ) );
  4021. }
  4022. #endif`,pie=`#ifdef USE_BUMPMAP
  4023. uniform sampler2D bumpMap;
  4024. uniform float bumpScale;
  4025. vec2 dHdxy_fwd() {
  4026. vec2 dSTdx = dFdx( vBumpMapUv );
  4027. vec2 dSTdy = dFdy( vBumpMapUv );
  4028. float Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x;
  4029. float dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll;
  4030. float dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll;
  4031. return vec2( dBx, dBy );
  4032. }
  4033. vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {
  4034. vec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) );
  4035. vec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) );
  4036. vec3 vN = surf_norm;
  4037. vec3 R1 = cross( vSigmaY, vN );
  4038. vec3 R2 = cross( vN, vSigmaX );
  4039. float fDet = dot( vSigmaX, R1 ) * faceDirection;
  4040. vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );
  4041. return normalize( abs( fDet ) * surf_norm - vGrad );
  4042. }
  4043. #endif`,mie=`#if NUM_CLIPPING_PLANES > 0
  4044. vec4 plane;
  4045. #pragma unroll_loop_start
  4046. for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {
  4047. plane = clippingPlanes[ i ];
  4048. if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;
  4049. }
  4050. #pragma unroll_loop_end
  4051. #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES
  4052. bool clipped = true;
  4053. #pragma unroll_loop_start
  4054. for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {
  4055. plane = clippingPlanes[ i ];
  4056. clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;
  4057. }
  4058. #pragma unroll_loop_end
  4059. if ( clipped ) discard;
  4060. #endif
  4061. #endif`,gie=`#if NUM_CLIPPING_PLANES > 0
  4062. varying vec3 vClipPosition;
  4063. uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];
  4064. #endif`,vie=`#if NUM_CLIPPING_PLANES > 0
  4065. varying vec3 vClipPosition;
  4066. #endif`,xie=`#if NUM_CLIPPING_PLANES > 0
  4067. vClipPosition = - mvPosition.xyz;
  4068. #endif`,yie=`#if defined( USE_COLOR_ALPHA )
  4069. diffuseColor *= vColor;
  4070. #elif defined( USE_COLOR )
  4071. diffuseColor.rgb *= vColor;
  4072. #endif`,bie=`#if defined( USE_COLOR_ALPHA )
  4073. varying vec4 vColor;
  4074. #elif defined( USE_COLOR )
  4075. varying vec3 vColor;
  4076. #endif`,_ie=`#if defined( USE_COLOR_ALPHA )
  4077. varying vec4 vColor;
  4078. #elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )
  4079. varying vec3 vColor;
  4080. #endif`,Sie=`#if defined( USE_COLOR_ALPHA )
  4081. vColor = vec4( 1.0 );
  4082. #elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )
  4083. vColor = vec3( 1.0 );
  4084. #endif
  4085. #ifdef USE_COLOR
  4086. vColor *= color;
  4087. #endif
  4088. #ifdef USE_INSTANCING_COLOR
  4089. vColor.xyz *= instanceColor.xyz;
  4090. #endif`,wie=`#define PI 3.141592653589793
  4091. #define PI2 6.283185307179586
  4092. #define PI_HALF 1.5707963267948966
  4093. #define RECIPROCAL_PI 0.3183098861837907
  4094. #define RECIPROCAL_PI2 0.15915494309189535
  4095. #define EPSILON 1e-6
  4096. #ifndef saturate
  4097. #define saturate( a ) clamp( a, 0.0, 1.0 )
  4098. #endif
  4099. #define whiteComplement( a ) ( 1.0 - saturate( a ) )
  4100. float pow2( const in float x ) { return x*x; }
  4101. vec3 pow2( const in vec3 x ) { return x*x; }
  4102. float pow3( const in float x ) { return x*x*x; }
  4103. float pow4( const in float x ) { float x2 = x*x; return x2*x2; }
  4104. float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }
  4105. float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }
  4106. highp float rand( const in vec2 uv ) {
  4107. const highp float a = 12.9898, b = 78.233, c = 43758.5453;
  4108. highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );
  4109. return fract( sin( sn ) * c );
  4110. }
  4111. #ifdef HIGH_PRECISION
  4112. float precisionSafeLength( vec3 v ) { return length( v ); }
  4113. #else
  4114. float precisionSafeLength( vec3 v ) {
  4115. float maxComponent = max3( abs( v ) );
  4116. return length( v / maxComponent ) * maxComponent;
  4117. }
  4118. #endif
  4119. struct IncidentLight {
  4120. vec3 color;
  4121. vec3 direction;
  4122. bool visible;
  4123. };
  4124. struct ReflectedLight {
  4125. vec3 directDiffuse;
  4126. vec3 directSpecular;
  4127. vec3 indirectDiffuse;
  4128. vec3 indirectSpecular;
  4129. };
  4130. #ifdef USE_ALPHAHASH
  4131. varying vec3 vPosition;
  4132. #endif
  4133. vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
  4134. return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
  4135. }
  4136. vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {
  4137. return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );
  4138. }
  4139. mat3 transposeMat3( const in mat3 m ) {
  4140. mat3 tmp;
  4141. tmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );
  4142. tmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );
  4143. tmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );
  4144. return tmp;
  4145. }
  4146. float luminance( const in vec3 rgb ) {
  4147. const vec3 weights = vec3( 0.2126729, 0.7151522, 0.0721750 );
  4148. return dot( weights, rgb );
  4149. }
  4150. bool isPerspectiveMatrix( mat4 m ) {
  4151. return m[ 2 ][ 3 ] == - 1.0;
  4152. }
  4153. vec2 equirectUv( in vec3 dir ) {
  4154. float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;
  4155. float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;
  4156. return vec2( u, v );
  4157. }
  4158. vec3 BRDF_Lambert( const in vec3 diffuseColor ) {
  4159. return RECIPROCAL_PI * diffuseColor;
  4160. }
  4161. vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {
  4162. float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
  4163. return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
  4164. }
  4165. float F_Schlick( const in float f0, const in float f90, const in float dotVH ) {
  4166. float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
  4167. return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
  4168. } // validated`,Eie=`#ifdef ENVMAP_TYPE_CUBE_UV
  4169. #define cubeUV_minMipLevel 4.0
  4170. #define cubeUV_minTileSize 16.0
  4171. float getFace( vec3 direction ) {
  4172. vec3 absDirection = abs( direction );
  4173. float face = - 1.0;
  4174. if ( absDirection.x > absDirection.z ) {
  4175. if ( absDirection.x > absDirection.y )
  4176. face = direction.x > 0.0 ? 0.0 : 3.0;
  4177. else
  4178. face = direction.y > 0.0 ? 1.0 : 4.0;
  4179. } else {
  4180. if ( absDirection.z > absDirection.y )
  4181. face = direction.z > 0.0 ? 2.0 : 5.0;
  4182. else
  4183. face = direction.y > 0.0 ? 1.0 : 4.0;
  4184. }
  4185. return face;
  4186. }
  4187. vec2 getUV( vec3 direction, float face ) {
  4188. vec2 uv;
  4189. if ( face == 0.0 ) {
  4190. uv = vec2( direction.z, direction.y ) / abs( direction.x );
  4191. } else if ( face == 1.0 ) {
  4192. uv = vec2( - direction.x, - direction.z ) / abs( direction.y );
  4193. } else if ( face == 2.0 ) {
  4194. uv = vec2( - direction.x, direction.y ) / abs( direction.z );
  4195. } else if ( face == 3.0 ) {
  4196. uv = vec2( - direction.z, direction.y ) / abs( direction.x );
  4197. } else if ( face == 4.0 ) {
  4198. uv = vec2( - direction.x, direction.z ) / abs( direction.y );
  4199. } else {
  4200. uv = vec2( direction.x, direction.y ) / abs( direction.z );
  4201. }
  4202. return 0.5 * ( uv + 1.0 );
  4203. }
  4204. vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {
  4205. float face = getFace( direction );
  4206. float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );
  4207. mipInt = max( mipInt, cubeUV_minMipLevel );
  4208. float faceSize = exp2( mipInt );
  4209. highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;
  4210. if ( face > 2.0 ) {
  4211. uv.y += faceSize;
  4212. face -= 3.0;
  4213. }
  4214. uv.x += face * faceSize;
  4215. uv.x += filterInt * 3.0 * cubeUV_minTileSize;
  4216. uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );
  4217. uv.x *= CUBEUV_TEXEL_WIDTH;
  4218. uv.y *= CUBEUV_TEXEL_HEIGHT;
  4219. #ifdef texture2DGradEXT
  4220. return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;
  4221. #else
  4222. return texture2D( envMap, uv ).rgb;
  4223. #endif
  4224. }
  4225. #define cubeUV_r0 1.0
  4226. #define cubeUV_v0 0.339
  4227. #define cubeUV_m0 - 2.0
  4228. #define cubeUV_r1 0.8
  4229. #define cubeUV_v1 0.276
  4230. #define cubeUV_m1 - 1.0
  4231. #define cubeUV_r4 0.4
  4232. #define cubeUV_v4 0.046
  4233. #define cubeUV_m4 2.0
  4234. #define cubeUV_r5 0.305
  4235. #define cubeUV_v5 0.016
  4236. #define cubeUV_m5 3.0
  4237. #define cubeUV_r6 0.21
  4238. #define cubeUV_v6 0.0038
  4239. #define cubeUV_m6 4.0
  4240. float roughnessToMip( float roughness ) {
  4241. float mip = 0.0;
  4242. if ( roughness >= cubeUV_r1 ) {
  4243. mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;
  4244. } else if ( roughness >= cubeUV_r4 ) {
  4245. mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;
  4246. } else if ( roughness >= cubeUV_r5 ) {
  4247. mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;
  4248. } else if ( roughness >= cubeUV_r6 ) {
  4249. mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;
  4250. } else {
  4251. mip = - 2.0 * log2( 1.16 * roughness ); }
  4252. return mip;
  4253. }
  4254. vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {
  4255. float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );
  4256. float mipF = fract( mip );
  4257. float mipInt = floor( mip );
  4258. vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );
  4259. if ( mipF == 0.0 ) {
  4260. return vec4( color0, 1.0 );
  4261. } else {
  4262. vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );
  4263. return vec4( mix( color0, color1, mipF ), 1.0 );
  4264. }
  4265. }
  4266. #endif`,Mie=`vec3 transformedNormal = objectNormal;
  4267. #ifdef USE_TANGENT
  4268. vec3 transformedTangent = objectTangent;
  4269. #endif
  4270. #ifdef USE_BATCHING
  4271. mat3 bm = mat3( batchingMatrix );
  4272. transformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) );
  4273. transformedNormal = bm * transformedNormal;
  4274. #ifdef USE_TANGENT
  4275. transformedTangent = bm * transformedTangent;
  4276. #endif
  4277. #endif
  4278. #ifdef USE_INSTANCING
  4279. mat3 im = mat3( instanceMatrix );
  4280. transformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) );
  4281. transformedNormal = im * transformedNormal;
  4282. #ifdef USE_TANGENT
  4283. transformedTangent = im * transformedTangent;
  4284. #endif
  4285. #endif
  4286. transformedNormal = normalMatrix * transformedNormal;
  4287. #ifdef FLIP_SIDED
  4288. transformedNormal = - transformedNormal;
  4289. #endif
  4290. #ifdef USE_TANGENT
  4291. transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;
  4292. #ifdef FLIP_SIDED
  4293. transformedTangent = - transformedTangent;
  4294. #endif
  4295. #endif`,Aie=`#ifdef USE_DISPLACEMENTMAP
  4296. uniform sampler2D displacementMap;
  4297. uniform float displacementScale;
  4298. uniform float displacementBias;
  4299. #endif`,Tie=`#ifdef USE_DISPLACEMENTMAP
  4300. transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );
  4301. #endif`,Cie=`#ifdef USE_EMISSIVEMAP
  4302. vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );
  4303. totalEmissiveRadiance *= emissiveColor.rgb;
  4304. #endif`,Rie=`#ifdef USE_EMISSIVEMAP
  4305. uniform sampler2D emissiveMap;
  4306. #endif`,Pie="gl_FragColor = linearToOutputTexel( gl_FragColor );",Die=`
  4307. const mat3 LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 = mat3(
  4308. vec3( 0.8224621, 0.177538, 0.0 ),
  4309. vec3( 0.0331941, 0.9668058, 0.0 ),
  4310. vec3( 0.0170827, 0.0723974, 0.9105199 )
  4311. );
  4312. const mat3 LINEAR_DISPLAY_P3_TO_LINEAR_SRGB = mat3(
  4313. vec3( 1.2249401, - 0.2249404, 0.0 ),
  4314. vec3( - 0.0420569, 1.0420571, 0.0 ),
  4315. vec3( - 0.0196376, - 0.0786361, 1.0982735 )
  4316. );
  4317. vec4 LinearSRGBToLinearDisplayP3( in vec4 value ) {
  4318. return vec4( value.rgb * LINEAR_SRGB_TO_LINEAR_DISPLAY_P3, value.a );
  4319. }
  4320. vec4 LinearDisplayP3ToLinearSRGB( in vec4 value ) {
  4321. return vec4( value.rgb * LINEAR_DISPLAY_P3_TO_LINEAR_SRGB, value.a );
  4322. }
  4323. vec4 LinearTransferOETF( in vec4 value ) {
  4324. return value;
  4325. }
  4326. vec4 sRGBTransferOETF( in vec4 value ) {
  4327. 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 );
  4328. }
  4329. vec4 LinearToLinear( in vec4 value ) {
  4330. return value;
  4331. }
  4332. vec4 LinearTosRGB( in vec4 value ) {
  4333. return sRGBTransferOETF( value );
  4334. }`,Nie=`#ifdef USE_ENVMAP
  4335. #ifdef ENV_WORLDPOS
  4336. vec3 cameraToFrag;
  4337. if ( isOrthographic ) {
  4338. cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
  4339. } else {
  4340. cameraToFrag = normalize( vWorldPosition - cameraPosition );
  4341. }
  4342. vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
  4343. #ifdef ENVMAP_MODE_REFLECTION
  4344. vec3 reflectVec = reflect( cameraToFrag, worldNormal );
  4345. #else
  4346. vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );
  4347. #endif
  4348. #else
  4349. vec3 reflectVec = vReflect;
  4350. #endif
  4351. #ifdef ENVMAP_TYPE_CUBE
  4352. vec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );
  4353. #else
  4354. vec4 envColor = vec4( 0.0 );
  4355. #endif
  4356. #ifdef ENVMAP_BLENDING_MULTIPLY
  4357. outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );
  4358. #elif defined( ENVMAP_BLENDING_MIX )
  4359. outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );
  4360. #elif defined( ENVMAP_BLENDING_ADD )
  4361. outgoingLight += envColor.xyz * specularStrength * reflectivity;
  4362. #endif
  4363. #endif`,Oie=`#ifdef USE_ENVMAP
  4364. uniform float envMapIntensity;
  4365. uniform float flipEnvMap;
  4366. #ifdef ENVMAP_TYPE_CUBE
  4367. uniform samplerCube envMap;
  4368. #else
  4369. uniform sampler2D envMap;
  4370. #endif
  4371. #endif`,Lie=`#ifdef USE_ENVMAP
  4372. uniform float reflectivity;
  4373. #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
  4374. #define ENV_WORLDPOS
  4375. #endif
  4376. #ifdef ENV_WORLDPOS
  4377. varying vec3 vWorldPosition;
  4378. uniform float refractionRatio;
  4379. #else
  4380. varying vec3 vReflect;
  4381. #endif
  4382. #endif`,Iie=`#ifdef USE_ENVMAP
  4383. #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
  4384. #define ENV_WORLDPOS
  4385. #endif
  4386. #ifdef ENV_WORLDPOS
  4387. varying vec3 vWorldPosition;
  4388. #else
  4389. varying vec3 vReflect;
  4390. uniform float refractionRatio;
  4391. #endif
  4392. #endif`,Uie=`#ifdef USE_ENVMAP
  4393. #ifdef ENV_WORLDPOS
  4394. vWorldPosition = worldPosition.xyz;
  4395. #else
  4396. vec3 cameraToVertex;
  4397. if ( isOrthographic ) {
  4398. cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
  4399. } else {
  4400. cameraToVertex = normalize( worldPosition.xyz - cameraPosition );
  4401. }
  4402. vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
  4403. #ifdef ENVMAP_MODE_REFLECTION
  4404. vReflect = reflect( cameraToVertex, worldNormal );
  4405. #else
  4406. vReflect = refract( cameraToVertex, worldNormal, refractionRatio );
  4407. #endif
  4408. #endif
  4409. #endif`,kie=`#ifdef USE_FOG
  4410. vFogDepth = - mvPosition.z;
  4411. #endif`,Fie=`#ifdef USE_FOG
  4412. varying float vFogDepth;
  4413. #endif`,zie=`#ifdef USE_FOG
  4414. #ifdef FOG_EXP2
  4415. float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );
  4416. #else
  4417. float fogFactor = smoothstep( fogNear, fogFar, vFogDepth );
  4418. #endif
  4419. gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );
  4420. #endif`,Bie=`#ifdef USE_FOG
  4421. uniform vec3 fogColor;
  4422. varying float vFogDepth;
  4423. #ifdef FOG_EXP2
  4424. uniform float fogDensity;
  4425. #else
  4426. uniform float fogNear;
  4427. uniform float fogFar;
  4428. #endif
  4429. #endif`,jie=`#ifdef USE_GRADIENTMAP
  4430. uniform sampler2D gradientMap;
  4431. #endif
  4432. vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {
  4433. float dotNL = dot( normal, lightDirection );
  4434. vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );
  4435. #ifdef USE_GRADIENTMAP
  4436. return vec3( texture2D( gradientMap, coord ).r );
  4437. #else
  4438. vec2 fw = fwidth( coord ) * 0.5;
  4439. return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );
  4440. #endif
  4441. }`,Hie=`#ifdef USE_LIGHTMAP
  4442. vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
  4443. vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;
  4444. reflectedLight.indirectDiffuse += lightMapIrradiance;
  4445. #endif`,Gie=`#ifdef USE_LIGHTMAP
  4446. uniform sampler2D lightMap;
  4447. uniform float lightMapIntensity;
  4448. #endif`,Vie=`LambertMaterial material;
  4449. material.diffuseColor = diffuseColor.rgb;
  4450. material.specularStrength = specularStrength;`,$ie=`varying vec3 vViewPosition;
  4451. struct LambertMaterial {
  4452. vec3 diffuseColor;
  4453. float specularStrength;
  4454. };
  4455. void RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {
  4456. float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
  4457. vec3 irradiance = dotNL * directLight.color;
  4458. reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
  4459. }
  4460. void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {
  4461. reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
  4462. }
  4463. #define RE_Direct RE_Direct_Lambert
  4464. #define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,Wie=`uniform bool receiveShadow;
  4465. uniform vec3 ambientLightColor;
  4466. #if defined( USE_LIGHT_PROBES )
  4467. uniform vec3 lightProbe[ 9 ];
  4468. #endif
  4469. vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {
  4470. float x = normal.x, y = normal.y, z = normal.z;
  4471. vec3 result = shCoefficients[ 0 ] * 0.886227;
  4472. result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;
  4473. result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;
  4474. result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;
  4475. result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;
  4476. result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;
  4477. result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );
  4478. result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;
  4479. result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );
  4480. return result;
  4481. }
  4482. vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {
  4483. vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
  4484. vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );
  4485. return irradiance;
  4486. }
  4487. vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {
  4488. vec3 irradiance = ambientLightColor;
  4489. return irradiance;
  4490. }
  4491. float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {
  4492. #if defined ( LEGACY_LIGHTS )
  4493. if ( cutoffDistance > 0.0 && decayExponent > 0.0 ) {
  4494. return pow( saturate( - lightDistance / cutoffDistance + 1.0 ), decayExponent );
  4495. }
  4496. return 1.0;
  4497. #else
  4498. float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );
  4499. if ( cutoffDistance > 0.0 ) {
  4500. distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );
  4501. }
  4502. return distanceFalloff;
  4503. #endif
  4504. }
  4505. float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {
  4506. return smoothstep( coneCosine, penumbraCosine, angleCosine );
  4507. }
  4508. #if NUM_DIR_LIGHTS > 0
  4509. struct DirectionalLight {
  4510. vec3 direction;
  4511. vec3 color;
  4512. };
  4513. uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];
  4514. void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) {
  4515. light.color = directionalLight.color;
  4516. light.direction = directionalLight.direction;
  4517. light.visible = true;
  4518. }
  4519. #endif
  4520. #if NUM_POINT_LIGHTS > 0
  4521. struct PointLight {
  4522. vec3 position;
  4523. vec3 color;
  4524. float distance;
  4525. float decay;
  4526. };
  4527. uniform PointLight pointLights[ NUM_POINT_LIGHTS ];
  4528. void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) {
  4529. vec3 lVector = pointLight.position - geometryPosition;
  4530. light.direction = normalize( lVector );
  4531. float lightDistance = length( lVector );
  4532. light.color = pointLight.color;
  4533. light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );
  4534. light.visible = ( light.color != vec3( 0.0 ) );
  4535. }
  4536. #endif
  4537. #if NUM_SPOT_LIGHTS > 0
  4538. struct SpotLight {
  4539. vec3 position;
  4540. vec3 direction;
  4541. vec3 color;
  4542. float distance;
  4543. float decay;
  4544. float coneCos;
  4545. float penumbraCos;
  4546. };
  4547. uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];
  4548. void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) {
  4549. vec3 lVector = spotLight.position - geometryPosition;
  4550. light.direction = normalize( lVector );
  4551. float angleCos = dot( light.direction, spotLight.direction );
  4552. float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );
  4553. if ( spotAttenuation > 0.0 ) {
  4554. float lightDistance = length( lVector );
  4555. light.color = spotLight.color * spotAttenuation;
  4556. light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );
  4557. light.visible = ( light.color != vec3( 0.0 ) );
  4558. } else {
  4559. light.color = vec3( 0.0 );
  4560. light.visible = false;
  4561. }
  4562. }
  4563. #endif
  4564. #if NUM_RECT_AREA_LIGHTS > 0
  4565. struct RectAreaLight {
  4566. vec3 color;
  4567. vec3 position;
  4568. vec3 halfWidth;
  4569. vec3 halfHeight;
  4570. };
  4571. uniform sampler2D ltc_1; uniform sampler2D ltc_2;
  4572. uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];
  4573. #endif
  4574. #if NUM_HEMI_LIGHTS > 0
  4575. struct HemisphereLight {
  4576. vec3 direction;
  4577. vec3 skyColor;
  4578. vec3 groundColor;
  4579. };
  4580. uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];
  4581. vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {
  4582. float dotNL = dot( normal, hemiLight.direction );
  4583. float hemiDiffuseWeight = 0.5 * dotNL + 0.5;
  4584. vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );
  4585. return irradiance;
  4586. }
  4587. #endif`,Xie=`#ifdef USE_ENVMAP
  4588. vec3 getIBLIrradiance( const in vec3 normal ) {
  4589. #ifdef ENVMAP_TYPE_CUBE_UV
  4590. vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
  4591. vec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 );
  4592. return PI * envMapColor.rgb * envMapIntensity;
  4593. #else
  4594. return vec3( 0.0 );
  4595. #endif
  4596. }
  4597. vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {
  4598. #ifdef ENVMAP_TYPE_CUBE_UV
  4599. vec3 reflectVec = reflect( - viewDir, normal );
  4600. reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );
  4601. reflectVec = inverseTransformDirection( reflectVec, viewMatrix );
  4602. vec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness );
  4603. return envMapColor.rgb * envMapIntensity;
  4604. #else
  4605. return vec3( 0.0 );
  4606. #endif
  4607. }
  4608. #ifdef USE_ANISOTROPY
  4609. vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {
  4610. #ifdef ENVMAP_TYPE_CUBE_UV
  4611. vec3 bentNormal = cross( bitangent, viewDir );
  4612. bentNormal = normalize( cross( bentNormal, bitangent ) );
  4613. bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );
  4614. return getIBLRadiance( viewDir, bentNormal, roughness );
  4615. #else
  4616. return vec3( 0.0 );
  4617. #endif
  4618. }
  4619. #endif
  4620. #endif`,qie=`ToonMaterial material;
  4621. material.diffuseColor = diffuseColor.rgb;`,Yie=`varying vec3 vViewPosition;
  4622. struct ToonMaterial {
  4623. vec3 diffuseColor;
  4624. };
  4625. void RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {
  4626. vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color;
  4627. reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
  4628. }
  4629. void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {
  4630. reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
  4631. }
  4632. #define RE_Direct RE_Direct_Toon
  4633. #define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,Kie=`BlinnPhongMaterial material;
  4634. material.diffuseColor = diffuseColor.rgb;
  4635. material.specularColor = specular;
  4636. material.specularShininess = shininess;
  4637. material.specularStrength = specularStrength;`,Zie=`varying vec3 vViewPosition;
  4638. struct BlinnPhongMaterial {
  4639. vec3 diffuseColor;
  4640. vec3 specularColor;
  4641. float specularShininess;
  4642. float specularStrength;
  4643. };
  4644. void RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {
  4645. float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
  4646. vec3 irradiance = dotNL * directLight.color;
  4647. reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
  4648. reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength;
  4649. }
  4650. void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {
  4651. reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
  4652. }
  4653. #define RE_Direct RE_Direct_BlinnPhong
  4654. #define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,Qie=`PhysicalMaterial material;
  4655. material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );
  4656. vec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );
  4657. float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );
  4658. material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;
  4659. material.roughness = min( material.roughness, 1.0 );
  4660. #ifdef IOR
  4661. material.ior = ior;
  4662. #ifdef USE_SPECULAR
  4663. float specularIntensityFactor = specularIntensity;
  4664. vec3 specularColorFactor = specularColor;
  4665. #ifdef USE_SPECULAR_COLORMAP
  4666. specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;
  4667. #endif
  4668. #ifdef USE_SPECULAR_INTENSITYMAP
  4669. specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;
  4670. #endif
  4671. material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );
  4672. #else
  4673. float specularIntensityFactor = 1.0;
  4674. vec3 specularColorFactor = vec3( 1.0 );
  4675. material.specularF90 = 1.0;
  4676. #endif
  4677. material.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );
  4678. #else
  4679. material.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );
  4680. material.specularF90 = 1.0;
  4681. #endif
  4682. #ifdef USE_CLEARCOAT
  4683. material.clearcoat = clearcoat;
  4684. material.clearcoatRoughness = clearcoatRoughness;
  4685. material.clearcoatF0 = vec3( 0.04 );
  4686. material.clearcoatF90 = 1.0;
  4687. #ifdef USE_CLEARCOATMAP
  4688. material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;
  4689. #endif
  4690. #ifdef USE_CLEARCOAT_ROUGHNESSMAP
  4691. material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;
  4692. #endif
  4693. material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );
  4694. material.clearcoatRoughness += geometryRoughness;
  4695. material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );
  4696. #endif
  4697. #ifdef USE_IRIDESCENCE
  4698. material.iridescence = iridescence;
  4699. material.iridescenceIOR = iridescenceIOR;
  4700. #ifdef USE_IRIDESCENCEMAP
  4701. material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;
  4702. #endif
  4703. #ifdef USE_IRIDESCENCE_THICKNESSMAP
  4704. material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;
  4705. #else
  4706. material.iridescenceThickness = iridescenceThicknessMaximum;
  4707. #endif
  4708. #endif
  4709. #ifdef USE_SHEEN
  4710. material.sheenColor = sheenColor;
  4711. #ifdef USE_SHEEN_COLORMAP
  4712. material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;
  4713. #endif
  4714. material.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );
  4715. #ifdef USE_SHEEN_ROUGHNESSMAP
  4716. material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;
  4717. #endif
  4718. #endif
  4719. #ifdef USE_ANISOTROPY
  4720. #ifdef USE_ANISOTROPYMAP
  4721. mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );
  4722. vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;
  4723. vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;
  4724. #else
  4725. vec2 anisotropyV = anisotropyVector;
  4726. #endif
  4727. material.anisotropy = length( anisotropyV );
  4728. if( material.anisotropy == 0.0 ) {
  4729. anisotropyV = vec2( 1.0, 0.0 );
  4730. } else {
  4731. anisotropyV /= material.anisotropy;
  4732. material.anisotropy = saturate( material.anisotropy );
  4733. }
  4734. material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );
  4735. material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;
  4736. material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;
  4737. #endif`,Jie=`struct PhysicalMaterial {
  4738. vec3 diffuseColor;
  4739. float roughness;
  4740. vec3 specularColor;
  4741. float specularF90;
  4742. #ifdef USE_CLEARCOAT
  4743. float clearcoat;
  4744. float clearcoatRoughness;
  4745. vec3 clearcoatF0;
  4746. float clearcoatF90;
  4747. #endif
  4748. #ifdef USE_IRIDESCENCE
  4749. float iridescence;
  4750. float iridescenceIOR;
  4751. float iridescenceThickness;
  4752. vec3 iridescenceFresnel;
  4753. vec3 iridescenceF0;
  4754. #endif
  4755. #ifdef USE_SHEEN
  4756. vec3 sheenColor;
  4757. float sheenRoughness;
  4758. #endif
  4759. #ifdef IOR
  4760. float ior;
  4761. #endif
  4762. #ifdef USE_TRANSMISSION
  4763. float transmission;
  4764. float transmissionAlpha;
  4765. float thickness;
  4766. float attenuationDistance;
  4767. vec3 attenuationColor;
  4768. #endif
  4769. #ifdef USE_ANISOTROPY
  4770. float anisotropy;
  4771. float alphaT;
  4772. vec3 anisotropyT;
  4773. vec3 anisotropyB;
  4774. #endif
  4775. };
  4776. vec3 clearcoatSpecularDirect = vec3( 0.0 );
  4777. vec3 clearcoatSpecularIndirect = vec3( 0.0 );
  4778. vec3 sheenSpecularDirect = vec3( 0.0 );
  4779. vec3 sheenSpecularIndirect = vec3(0.0 );
  4780. vec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {
  4781. float x = clamp( 1.0 - dotVH, 0.0, 1.0 );
  4782. float x2 = x * x;
  4783. float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );
  4784. return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );
  4785. }
  4786. float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {
  4787. float a2 = pow2( alpha );
  4788. float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );
  4789. float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );
  4790. return 0.5 / max( gv + gl, EPSILON );
  4791. }
  4792. float D_GGX( const in float alpha, const in float dotNH ) {
  4793. float a2 = pow2( alpha );
  4794. float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;
  4795. return RECIPROCAL_PI * a2 / pow2( denom );
  4796. }
  4797. #ifdef USE_ANISOTROPY
  4798. float V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) {
  4799. float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );
  4800. float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );
  4801. float v = 0.5 / ( gv + gl );
  4802. return saturate(v);
  4803. }
  4804. float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {
  4805. float a2 = alphaT * alphaB;
  4806. highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );
  4807. highp float v2 = dot( v, v );
  4808. float w2 = a2 / v2;
  4809. return RECIPROCAL_PI * a2 * pow2 ( w2 );
  4810. }
  4811. #endif
  4812. #ifdef USE_CLEARCOAT
  4813. vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {
  4814. vec3 f0 = material.clearcoatF0;
  4815. float f90 = material.clearcoatF90;
  4816. float roughness = material.clearcoatRoughness;
  4817. float alpha = pow2( roughness );
  4818. vec3 halfDir = normalize( lightDir + viewDir );
  4819. float dotNL = saturate( dot( normal, lightDir ) );
  4820. float dotNV = saturate( dot( normal, viewDir ) );
  4821. float dotNH = saturate( dot( normal, halfDir ) );
  4822. float dotVH = saturate( dot( viewDir, halfDir ) );
  4823. vec3 F = F_Schlick( f0, f90, dotVH );
  4824. float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );
  4825. float D = D_GGX( alpha, dotNH );
  4826. return F * ( V * D );
  4827. }
  4828. #endif
  4829. vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {
  4830. vec3 f0 = material.specularColor;
  4831. float f90 = material.specularF90;
  4832. float roughness = material.roughness;
  4833. float alpha = pow2( roughness );
  4834. vec3 halfDir = normalize( lightDir + viewDir );
  4835. float dotNL = saturate( dot( normal, lightDir ) );
  4836. float dotNV = saturate( dot( normal, viewDir ) );
  4837. float dotNH = saturate( dot( normal, halfDir ) );
  4838. float dotVH = saturate( dot( viewDir, halfDir ) );
  4839. vec3 F = F_Schlick( f0, f90, dotVH );
  4840. #ifdef USE_IRIDESCENCE
  4841. F = mix( F, material.iridescenceFresnel, material.iridescence );
  4842. #endif
  4843. #ifdef USE_ANISOTROPY
  4844. float dotTL = dot( material.anisotropyT, lightDir );
  4845. float dotTV = dot( material.anisotropyT, viewDir );
  4846. float dotTH = dot( material.anisotropyT, halfDir );
  4847. float dotBL = dot( material.anisotropyB, lightDir );
  4848. float dotBV = dot( material.anisotropyB, viewDir );
  4849. float dotBH = dot( material.anisotropyB, halfDir );
  4850. float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );
  4851. float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );
  4852. #else
  4853. float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );
  4854. float D = D_GGX( alpha, dotNH );
  4855. #endif
  4856. return F * ( V * D );
  4857. }
  4858. vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {
  4859. const float LUT_SIZE = 64.0;
  4860. const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;
  4861. const float LUT_BIAS = 0.5 / LUT_SIZE;
  4862. float dotNV = saturate( dot( N, V ) );
  4863. vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );
  4864. uv = uv * LUT_SCALE + LUT_BIAS;
  4865. return uv;
  4866. }
  4867. float LTC_ClippedSphereFormFactor( const in vec3 f ) {
  4868. float l = length( f );
  4869. return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );
  4870. }
  4871. vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {
  4872. float x = dot( v1, v2 );
  4873. float y = abs( x );
  4874. float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;
  4875. float b = 3.4175940 + ( 4.1616724 + y ) * y;
  4876. float v = a / b;
  4877. float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;
  4878. return cross( v1, v2 ) * theta_sintheta;
  4879. }
  4880. vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {
  4881. vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];
  4882. vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];
  4883. vec3 lightNormal = cross( v1, v2 );
  4884. if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );
  4885. vec3 T1, T2;
  4886. T1 = normalize( V - N * dot( V, N ) );
  4887. T2 = - cross( N, T1 );
  4888. mat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );
  4889. vec3 coords[ 4 ];
  4890. coords[ 0 ] = mat * ( rectCoords[ 0 ] - P );
  4891. coords[ 1 ] = mat * ( rectCoords[ 1 ] - P );
  4892. coords[ 2 ] = mat * ( rectCoords[ 2 ] - P );
  4893. coords[ 3 ] = mat * ( rectCoords[ 3 ] - P );
  4894. coords[ 0 ] = normalize( coords[ 0 ] );
  4895. coords[ 1 ] = normalize( coords[ 1 ] );
  4896. coords[ 2 ] = normalize( coords[ 2 ] );
  4897. coords[ 3 ] = normalize( coords[ 3 ] );
  4898. vec3 vectorFormFactor = vec3( 0.0 );
  4899. vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );
  4900. vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );
  4901. vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );
  4902. vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );
  4903. float result = LTC_ClippedSphereFormFactor( vectorFormFactor );
  4904. return vec3( result );
  4905. }
  4906. #if defined( USE_SHEEN )
  4907. float D_Charlie( float roughness, float dotNH ) {
  4908. float alpha = pow2( roughness );
  4909. float invAlpha = 1.0 / alpha;
  4910. float cos2h = dotNH * dotNH;
  4911. float sin2h = max( 1.0 - cos2h, 0.0078125 );
  4912. return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );
  4913. }
  4914. float V_Neubelt( float dotNV, float dotNL ) {
  4915. return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );
  4916. }
  4917. vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {
  4918. vec3 halfDir = normalize( lightDir + viewDir );
  4919. float dotNL = saturate( dot( normal, lightDir ) );
  4920. float dotNV = saturate( dot( normal, viewDir ) );
  4921. float dotNH = saturate( dot( normal, halfDir ) );
  4922. float D = D_Charlie( sheenRoughness, dotNH );
  4923. float V = V_Neubelt( dotNV, dotNL );
  4924. return sheenColor * ( D * V );
  4925. }
  4926. #endif
  4927. float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {
  4928. float dotNV = saturate( dot( normal, viewDir ) );
  4929. float r2 = roughness * roughness;
  4930. float a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;
  4931. float b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;
  4932. float DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );
  4933. return saturate( DG * RECIPROCAL_PI );
  4934. }
  4935. vec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {
  4936. float dotNV = saturate( dot( normal, viewDir ) );
  4937. const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );
  4938. const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );
  4939. vec4 r = roughness * c0 + c1;
  4940. float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;
  4941. vec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;
  4942. return fab;
  4943. }
  4944. vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {
  4945. vec2 fab = DFGApprox( normal, viewDir, roughness );
  4946. return specularColor * fab.x + specularF90 * fab.y;
  4947. }
  4948. #ifdef USE_IRIDESCENCE
  4949. 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 ) {
  4950. #else
  4951. 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 ) {
  4952. #endif
  4953. vec2 fab = DFGApprox( normal, viewDir, roughness );
  4954. #ifdef USE_IRIDESCENCE
  4955. vec3 Fr = mix( specularColor, iridescenceF0, iridescence );
  4956. #else
  4957. vec3 Fr = specularColor;
  4958. #endif
  4959. vec3 FssEss = Fr * fab.x + specularF90 * fab.y;
  4960. float Ess = fab.x + fab.y;
  4961. float Ems = 1.0 - Ess;
  4962. vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );
  4963. singleScatter += FssEss;
  4964. multiScatter += Fms * Ems;
  4965. }
  4966. #if NUM_RECT_AREA_LIGHTS > 0
  4967. void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
  4968. vec3 normal = geometryNormal;
  4969. vec3 viewDir = geometryViewDir;
  4970. vec3 position = geometryPosition;
  4971. vec3 lightPos = rectAreaLight.position;
  4972. vec3 halfWidth = rectAreaLight.halfWidth;
  4973. vec3 halfHeight = rectAreaLight.halfHeight;
  4974. vec3 lightColor = rectAreaLight.color;
  4975. float roughness = material.roughness;
  4976. vec3 rectCoords[ 4 ];
  4977. rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight;
  4978. rectCoords[ 2 ] = lightPos - halfWidth + halfHeight;
  4979. rectCoords[ 3 ] = lightPos + halfWidth + halfHeight;
  4980. vec2 uv = LTC_Uv( normal, viewDir, roughness );
  4981. vec4 t1 = texture2D( ltc_1, uv );
  4982. vec4 t2 = texture2D( ltc_2, uv );
  4983. mat3 mInv = mat3(
  4984. vec3( t1.x, 0, t1.y ),
  4985. vec3( 0, 1, 0 ),
  4986. vec3( t1.z, 0, t1.w )
  4987. );
  4988. vec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );
  4989. reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );
  4990. reflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );
  4991. }
  4992. #endif
  4993. void RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
  4994. float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
  4995. vec3 irradiance = dotNL * directLight.color;
  4996. #ifdef USE_CLEARCOAT
  4997. float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );
  4998. vec3 ccIrradiance = dotNLcc * directLight.color;
  4999. clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );
  5000. #endif
  5001. #ifdef USE_SHEEN
  5002. sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );
  5003. #endif
  5004. reflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material );
  5005. reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
  5006. }
  5007. void RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
  5008. reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
  5009. }
  5010. void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {
  5011. #ifdef USE_CLEARCOAT
  5012. clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );
  5013. #endif
  5014. #ifdef USE_SHEEN
  5015. sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );
  5016. #endif
  5017. vec3 singleScattering = vec3( 0.0 );
  5018. vec3 multiScattering = vec3( 0.0 );
  5019. vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;
  5020. #ifdef USE_IRIDESCENCE
  5021. computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );
  5022. #else
  5023. computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );
  5024. #endif
  5025. vec3 totalScattering = singleScattering + multiScattering;
  5026. vec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );
  5027. reflectedLight.indirectSpecular += radiance * singleScattering;
  5028. reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;
  5029. reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;
  5030. }
  5031. #define RE_Direct RE_Direct_Physical
  5032. #define RE_Direct_RectArea RE_Direct_RectArea_Physical
  5033. #define RE_IndirectDiffuse RE_IndirectDiffuse_Physical
  5034. #define RE_IndirectSpecular RE_IndirectSpecular_Physical
  5035. float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {
  5036. return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );
  5037. }`,ere=`
  5038. vec3 geometryPosition = - vViewPosition;
  5039. vec3 geometryNormal = normal;
  5040. vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );
  5041. vec3 geometryClearcoatNormal = vec3( 0.0 );
  5042. #ifdef USE_CLEARCOAT
  5043. geometryClearcoatNormal = clearcoatNormal;
  5044. #endif
  5045. #ifdef USE_IRIDESCENCE
  5046. float dotNVi = saturate( dot( normal, geometryViewDir ) );
  5047. if ( material.iridescenceThickness == 0.0 ) {
  5048. material.iridescence = 0.0;
  5049. } else {
  5050. material.iridescence = saturate( material.iridescence );
  5051. }
  5052. if ( material.iridescence > 0.0 ) {
  5053. material.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );
  5054. material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );
  5055. }
  5056. #endif
  5057. IncidentLight directLight;
  5058. #if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )
  5059. PointLight pointLight;
  5060. #if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0
  5061. PointLightShadow pointLightShadow;
  5062. #endif
  5063. #pragma unroll_loop_start
  5064. for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {
  5065. pointLight = pointLights[ i ];
  5066. getPointLightInfo( pointLight, geometryPosition, directLight );
  5067. #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )
  5068. pointLightShadow = pointLightShadows[ i ];
  5069. directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;
  5070. #endif
  5071. RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
  5072. }
  5073. #pragma unroll_loop_end
  5074. #endif
  5075. #if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )
  5076. SpotLight spotLight;
  5077. vec4 spotColor;
  5078. vec3 spotLightCoord;
  5079. bool inSpotLightMap;
  5080. #if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0
  5081. SpotLightShadow spotLightShadow;
  5082. #endif
  5083. #pragma unroll_loop_start
  5084. for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {
  5085. spotLight = spotLights[ i ];
  5086. getSpotLightInfo( spotLight, geometryPosition, directLight );
  5087. #if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )
  5088. #define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX
  5089. #elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
  5090. #define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS
  5091. #else
  5092. #define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )
  5093. #endif
  5094. #if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )
  5095. spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;
  5096. inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );
  5097. spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );
  5098. directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;
  5099. #endif
  5100. #undef SPOT_LIGHT_MAP_INDEX
  5101. #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
  5102. spotLightShadow = spotLightShadows[ i ];
  5103. directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
  5104. #endif
  5105. RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
  5106. }
  5107. #pragma unroll_loop_end
  5108. #endif
  5109. #if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )
  5110. DirectionalLight directionalLight;
  5111. #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0
  5112. DirectionalLightShadow directionalLightShadow;
  5113. #endif
  5114. #pragma unroll_loop_start
  5115. for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {
  5116. directionalLight = directionalLights[ i ];
  5117. getDirectionalLightInfo( directionalLight, directLight );
  5118. #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )
  5119. directionalLightShadow = directionalLightShadows[ i ];
  5120. directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
  5121. #endif
  5122. RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
  5123. }
  5124. #pragma unroll_loop_end
  5125. #endif
  5126. #if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )
  5127. RectAreaLight rectAreaLight;
  5128. #pragma unroll_loop_start
  5129. for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {
  5130. rectAreaLight = rectAreaLights[ i ];
  5131. RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
  5132. }
  5133. #pragma unroll_loop_end
  5134. #endif
  5135. #if defined( RE_IndirectDiffuse )
  5136. vec3 iblIrradiance = vec3( 0.0 );
  5137. vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );
  5138. #if defined( USE_LIGHT_PROBES )
  5139. irradiance += getLightProbeIrradiance( lightProbe, geometryNormal );
  5140. #endif
  5141. #if ( NUM_HEMI_LIGHTS > 0 )
  5142. #pragma unroll_loop_start
  5143. for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {
  5144. irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );
  5145. }
  5146. #pragma unroll_loop_end
  5147. #endif
  5148. #endif
  5149. #if defined( RE_IndirectSpecular )
  5150. vec3 radiance = vec3( 0.0 );
  5151. vec3 clearcoatRadiance = vec3( 0.0 );
  5152. #endif`,tre=`#if defined( RE_IndirectDiffuse )
  5153. #ifdef USE_LIGHTMAP
  5154. vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
  5155. vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;
  5156. irradiance += lightMapIrradiance;
  5157. #endif
  5158. #if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )
  5159. iblIrradiance += getIBLIrradiance( geometryNormal );
  5160. #endif
  5161. #endif
  5162. #if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )
  5163. #ifdef USE_ANISOTROPY
  5164. radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );
  5165. #else
  5166. radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );
  5167. #endif
  5168. #ifdef USE_CLEARCOAT
  5169. clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );
  5170. #endif
  5171. #endif`,nre=`#if defined( RE_IndirectDiffuse )
  5172. RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
  5173. #endif
  5174. #if defined( RE_IndirectSpecular )
  5175. RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
  5176. #endif`,ire=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )
  5177. gl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;
  5178. #endif`,rre=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )
  5179. uniform float logDepthBufFC;
  5180. varying float vFragDepth;
  5181. varying float vIsPerspective;
  5182. #endif`,are=`#ifdef USE_LOGDEPTHBUF
  5183. #ifdef USE_LOGDEPTHBUF_EXT
  5184. varying float vFragDepth;
  5185. varying float vIsPerspective;
  5186. #else
  5187. uniform float logDepthBufFC;
  5188. #endif
  5189. #endif`,sre=`#ifdef USE_LOGDEPTHBUF
  5190. #ifdef USE_LOGDEPTHBUF_EXT
  5191. vFragDepth = 1.0 + gl_Position.w;
  5192. vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );
  5193. #else
  5194. if ( isPerspectiveMatrix( projectionMatrix ) ) {
  5195. gl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;
  5196. gl_Position.z *= gl_Position.w;
  5197. }
  5198. #endif
  5199. #endif`,ore=`#ifdef USE_MAP
  5200. vec4 sampledDiffuseColor = texture2D( map, vMapUv );
  5201. #ifdef DECODE_VIDEO_TEXTURE
  5202. 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 );
  5203. #endif
  5204. diffuseColor *= sampledDiffuseColor;
  5205. #endif`,lre=`#ifdef USE_MAP
  5206. uniform sampler2D map;
  5207. #endif`,cre=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
  5208. #if defined( USE_POINTS_UV )
  5209. vec2 uv = vUv;
  5210. #else
  5211. vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;
  5212. #endif
  5213. #endif
  5214. #ifdef USE_MAP
  5215. diffuseColor *= texture2D( map, uv );
  5216. #endif
  5217. #ifdef USE_ALPHAMAP
  5218. diffuseColor.a *= texture2D( alphaMap, uv ).g;
  5219. #endif`,ure=`#if defined( USE_POINTS_UV )
  5220. varying vec2 vUv;
  5221. #else
  5222. #if defined( USE_MAP ) || defined( USE_ALPHAMAP )
  5223. uniform mat3 uvTransform;
  5224. #endif
  5225. #endif
  5226. #ifdef USE_MAP
  5227. uniform sampler2D map;
  5228. #endif
  5229. #ifdef USE_ALPHAMAP
  5230. uniform sampler2D alphaMap;
  5231. #endif`,dre=`float metalnessFactor = metalness;
  5232. #ifdef USE_METALNESSMAP
  5233. vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );
  5234. metalnessFactor *= texelMetalness.b;
  5235. #endif`,fre=`#ifdef USE_METALNESSMAP
  5236. uniform sampler2D metalnessMap;
  5237. #endif`,hre=`#if defined( USE_MORPHCOLORS ) && defined( MORPHTARGETS_TEXTURE )
  5238. vColor *= morphTargetBaseInfluence;
  5239. for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
  5240. #if defined( USE_COLOR_ALPHA )
  5241. if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];
  5242. #elif defined( USE_COLOR )
  5243. if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];
  5244. #endif
  5245. }
  5246. #endif`,pre=`#ifdef USE_MORPHNORMALS
  5247. objectNormal *= morphTargetBaseInfluence;
  5248. #ifdef MORPHTARGETS_TEXTURE
  5249. for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
  5250. if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];
  5251. }
  5252. #else
  5253. objectNormal += morphNormal0 * morphTargetInfluences[ 0 ];
  5254. objectNormal += morphNormal1 * morphTargetInfluences[ 1 ];
  5255. objectNormal += morphNormal2 * morphTargetInfluences[ 2 ];
  5256. objectNormal += morphNormal3 * morphTargetInfluences[ 3 ];
  5257. #endif
  5258. #endif`,mre=`#ifdef USE_MORPHTARGETS
  5259. uniform float morphTargetBaseInfluence;
  5260. #ifdef MORPHTARGETS_TEXTURE
  5261. uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];
  5262. uniform sampler2DArray morphTargetsTexture;
  5263. uniform ivec2 morphTargetsTextureSize;
  5264. vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {
  5265. int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;
  5266. int y = texelIndex / morphTargetsTextureSize.x;
  5267. int x = texelIndex - y * morphTargetsTextureSize.x;
  5268. ivec3 morphUV = ivec3( x, y, morphTargetIndex );
  5269. return texelFetch( morphTargetsTexture, morphUV, 0 );
  5270. }
  5271. #else
  5272. #ifndef USE_MORPHNORMALS
  5273. uniform float morphTargetInfluences[ 8 ];
  5274. #else
  5275. uniform float morphTargetInfluences[ 4 ];
  5276. #endif
  5277. #endif
  5278. #endif`,gre=`#ifdef USE_MORPHTARGETS
  5279. transformed *= morphTargetBaseInfluence;
  5280. #ifdef MORPHTARGETS_TEXTURE
  5281. for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
  5282. if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];
  5283. }
  5284. #else
  5285. transformed += morphTarget0 * morphTargetInfluences[ 0 ];
  5286. transformed += morphTarget1 * morphTargetInfluences[ 1 ];
  5287. transformed += morphTarget2 * morphTargetInfluences[ 2 ];
  5288. transformed += morphTarget3 * morphTargetInfluences[ 3 ];
  5289. #ifndef USE_MORPHNORMALS
  5290. transformed += morphTarget4 * morphTargetInfluences[ 4 ];
  5291. transformed += morphTarget5 * morphTargetInfluences[ 5 ];
  5292. transformed += morphTarget6 * morphTargetInfluences[ 6 ];
  5293. transformed += morphTarget7 * morphTargetInfluences[ 7 ];
  5294. #endif
  5295. #endif
  5296. #endif`,vre=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;
  5297. #ifdef FLAT_SHADED
  5298. vec3 fdx = dFdx( vViewPosition );
  5299. vec3 fdy = dFdy( vViewPosition );
  5300. vec3 normal = normalize( cross( fdx, fdy ) );
  5301. #else
  5302. vec3 normal = normalize( vNormal );
  5303. #ifdef DOUBLE_SIDED
  5304. normal *= faceDirection;
  5305. #endif
  5306. #endif
  5307. #if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )
  5308. #ifdef USE_TANGENT
  5309. mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );
  5310. #else
  5311. mat3 tbn = getTangentFrame( - vViewPosition, normal,
  5312. #if defined( USE_NORMALMAP )
  5313. vNormalMapUv
  5314. #elif defined( USE_CLEARCOAT_NORMALMAP )
  5315. vClearcoatNormalMapUv
  5316. #else
  5317. vUv
  5318. #endif
  5319. );
  5320. #endif
  5321. #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )
  5322. tbn[0] *= faceDirection;
  5323. tbn[1] *= faceDirection;
  5324. #endif
  5325. #endif
  5326. #ifdef USE_CLEARCOAT_NORMALMAP
  5327. #ifdef USE_TANGENT
  5328. mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );
  5329. #else
  5330. mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );
  5331. #endif
  5332. #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )
  5333. tbn2[0] *= faceDirection;
  5334. tbn2[1] *= faceDirection;
  5335. #endif
  5336. #endif
  5337. vec3 nonPerturbedNormal = normal;`,xre=`#ifdef USE_NORMALMAP_OBJECTSPACE
  5338. normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;
  5339. #ifdef FLIP_SIDED
  5340. normal = - normal;
  5341. #endif
  5342. #ifdef DOUBLE_SIDED
  5343. normal = normal * faceDirection;
  5344. #endif
  5345. normal = normalize( normalMatrix * normal );
  5346. #elif defined( USE_NORMALMAP_TANGENTSPACE )
  5347. vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;
  5348. mapN.xy *= normalScale;
  5349. normal = normalize( tbn * mapN );
  5350. #elif defined( USE_BUMPMAP )
  5351. normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );
  5352. #endif`,yre=`#ifndef FLAT_SHADED
  5353. varying vec3 vNormal;
  5354. #ifdef USE_TANGENT
  5355. varying vec3 vTangent;
  5356. varying vec3 vBitangent;
  5357. #endif
  5358. #endif`,bre=`#ifndef FLAT_SHADED
  5359. varying vec3 vNormal;
  5360. #ifdef USE_TANGENT
  5361. varying vec3 vTangent;
  5362. varying vec3 vBitangent;
  5363. #endif
  5364. #endif`,_re=`#ifndef FLAT_SHADED
  5365. vNormal = normalize( transformedNormal );
  5366. #ifdef USE_TANGENT
  5367. vTangent = normalize( transformedTangent );
  5368. vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );
  5369. #endif
  5370. #endif`,Sre=`#ifdef USE_NORMALMAP
  5371. uniform sampler2D normalMap;
  5372. uniform vec2 normalScale;
  5373. #endif
  5374. #ifdef USE_NORMALMAP_OBJECTSPACE
  5375. uniform mat3 normalMatrix;
  5376. #endif
  5377. #if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )
  5378. mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {
  5379. vec3 q0 = dFdx( eye_pos.xyz );
  5380. vec3 q1 = dFdy( eye_pos.xyz );
  5381. vec2 st0 = dFdx( uv.st );
  5382. vec2 st1 = dFdy( uv.st );
  5383. vec3 N = surf_norm;
  5384. vec3 q1perp = cross( q1, N );
  5385. vec3 q0perp = cross( N, q0 );
  5386. vec3 T = q1perp * st0.x + q0perp * st1.x;
  5387. vec3 B = q1perp * st0.y + q0perp * st1.y;
  5388. float det = max( dot( T, T ), dot( B, B ) );
  5389. float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );
  5390. return mat3( T * scale, B * scale, N );
  5391. }
  5392. #endif`,wre=`#ifdef USE_CLEARCOAT
  5393. vec3 clearcoatNormal = nonPerturbedNormal;
  5394. #endif`,Ere=`#ifdef USE_CLEARCOAT_NORMALMAP
  5395. vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;
  5396. clearcoatMapN.xy *= clearcoatNormalScale;
  5397. clearcoatNormal = normalize( tbn2 * clearcoatMapN );
  5398. #endif`,Mre=`#ifdef USE_CLEARCOATMAP
  5399. uniform sampler2D clearcoatMap;
  5400. #endif
  5401. #ifdef USE_CLEARCOAT_NORMALMAP
  5402. uniform sampler2D clearcoatNormalMap;
  5403. uniform vec2 clearcoatNormalScale;
  5404. #endif
  5405. #ifdef USE_CLEARCOAT_ROUGHNESSMAP
  5406. uniform sampler2D clearcoatRoughnessMap;
  5407. #endif`,Are=`#ifdef USE_IRIDESCENCEMAP
  5408. uniform sampler2D iridescenceMap;
  5409. #endif
  5410. #ifdef USE_IRIDESCENCE_THICKNESSMAP
  5411. uniform sampler2D iridescenceThicknessMap;
  5412. #endif`,Tre=`#ifdef OPAQUE
  5413. diffuseColor.a = 1.0;
  5414. #endif
  5415. #ifdef USE_TRANSMISSION
  5416. diffuseColor.a *= material.transmissionAlpha;
  5417. #endif
  5418. gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,Cre=`vec3 packNormalToRGB( const in vec3 normal ) {
  5419. return normalize( normal ) * 0.5 + 0.5;
  5420. }
  5421. vec3 unpackRGBToNormal( const in vec3 rgb ) {
  5422. return 2.0 * rgb.xyz - 1.0;
  5423. }
  5424. const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;
  5425. const vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );
  5426. const vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );
  5427. const float ShiftRight8 = 1. / 256.;
  5428. vec4 packDepthToRGBA( const in float v ) {
  5429. vec4 r = vec4( fract( v * PackFactors ), v );
  5430. r.yzw -= r.xyz * ShiftRight8; return r * PackUpscale;
  5431. }
  5432. float unpackRGBAToDepth( const in vec4 v ) {
  5433. return dot( v, UnpackFactors );
  5434. }
  5435. vec2 packDepthToRG( in highp float v ) {
  5436. return packDepthToRGBA( v ).yx;
  5437. }
  5438. float unpackRGToDepth( const in highp vec2 v ) {
  5439. return unpackRGBAToDepth( vec4( v.xy, 0.0, 0.0 ) );
  5440. }
  5441. vec4 pack2HalfToRGBA( vec2 v ) {
  5442. vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );
  5443. return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );
  5444. }
  5445. vec2 unpackRGBATo2Half( vec4 v ) {
  5446. return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );
  5447. }
  5448. float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {
  5449. return ( viewZ + near ) / ( near - far );
  5450. }
  5451. float orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) {
  5452. return depth * ( near - far ) - near;
  5453. }
  5454. float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {
  5455. return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );
  5456. }
  5457. float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {
  5458. return ( near * far ) / ( ( far - near ) * depth - far );
  5459. }`,Rre=`#ifdef PREMULTIPLIED_ALPHA
  5460. gl_FragColor.rgb *= gl_FragColor.a;
  5461. #endif`,Pre=`vec4 mvPosition = vec4( transformed, 1.0 );
  5462. #ifdef USE_BATCHING
  5463. mvPosition = batchingMatrix * mvPosition;
  5464. #endif
  5465. #ifdef USE_INSTANCING
  5466. mvPosition = instanceMatrix * mvPosition;
  5467. #endif
  5468. mvPosition = modelViewMatrix * mvPosition;
  5469. gl_Position = projectionMatrix * mvPosition;`,Dre=`#ifdef DITHERING
  5470. gl_FragColor.rgb = dithering( gl_FragColor.rgb );
  5471. #endif`,Nre=`#ifdef DITHERING
  5472. vec3 dithering( vec3 color ) {
  5473. float grid_position = rand( gl_FragCoord.xy );
  5474. vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );
  5475. dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );
  5476. return color + dither_shift_RGB;
  5477. }
  5478. #endif`,Ore=`float roughnessFactor = roughness;
  5479. #ifdef USE_ROUGHNESSMAP
  5480. vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );
  5481. roughnessFactor *= texelRoughness.g;
  5482. #endif`,Lre=`#ifdef USE_ROUGHNESSMAP
  5483. uniform sampler2D roughnessMap;
  5484. #endif`,Ire=`#if NUM_SPOT_LIGHT_COORDS > 0
  5485. varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
  5486. #endif
  5487. #if NUM_SPOT_LIGHT_MAPS > 0
  5488. uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];
  5489. #endif
  5490. #ifdef USE_SHADOWMAP
  5491. #if NUM_DIR_LIGHT_SHADOWS > 0
  5492. uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];
  5493. varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
  5494. struct DirectionalLightShadow {
  5495. float shadowBias;
  5496. float shadowNormalBias;
  5497. float shadowRadius;
  5498. vec2 shadowMapSize;
  5499. };
  5500. uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
  5501. #endif
  5502. #if NUM_SPOT_LIGHT_SHADOWS > 0
  5503. uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];
  5504. struct SpotLightShadow {
  5505. float shadowBias;
  5506. float shadowNormalBias;
  5507. float shadowRadius;
  5508. vec2 shadowMapSize;
  5509. };
  5510. uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
  5511. #endif
  5512. #if NUM_POINT_LIGHT_SHADOWS > 0
  5513. uniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];
  5514. varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
  5515. struct PointLightShadow {
  5516. float shadowBias;
  5517. float shadowNormalBias;
  5518. float shadowRadius;
  5519. vec2 shadowMapSize;
  5520. float shadowCameraNear;
  5521. float shadowCameraFar;
  5522. };
  5523. uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
  5524. #endif
  5525. float texture2DCompare( sampler2D depths, vec2 uv, float compare ) {
  5526. return step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );
  5527. }
  5528. vec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {
  5529. return unpackRGBATo2Half( texture2D( shadow, uv ) );
  5530. }
  5531. float VSMShadow (sampler2D shadow, vec2 uv, float compare ){
  5532. float occlusion = 1.0;
  5533. vec2 distribution = texture2DDistribution( shadow, uv );
  5534. float hard_shadow = step( compare , distribution.x );
  5535. if (hard_shadow != 1.0 ) {
  5536. float distance = compare - distribution.x ;
  5537. float variance = max( 0.00000, distribution.y * distribution.y );
  5538. 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 );
  5539. }
  5540. return occlusion;
  5541. }
  5542. float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {
  5543. float shadow = 1.0;
  5544. shadowCoord.xyz /= shadowCoord.w;
  5545. shadowCoord.z += shadowBias;
  5546. bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;
  5547. bool frustumTest = inFrustum && shadowCoord.z <= 1.0;
  5548. if ( frustumTest ) {
  5549. #if defined( SHADOWMAP_TYPE_PCF )
  5550. vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
  5551. float dx0 = - texelSize.x * shadowRadius;
  5552. float dy0 = - texelSize.y * shadowRadius;
  5553. float dx1 = + texelSize.x * shadowRadius;
  5554. float dy1 = + texelSize.y * shadowRadius;
  5555. float dx2 = dx0 / 2.0;
  5556. float dy2 = dy0 / 2.0;
  5557. float dx3 = dx1 / 2.0;
  5558. float dy3 = dy1 / 2.0;
  5559. shadow = (
  5560. texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +
  5561. texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +
  5562. texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +
  5563. texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +
  5564. texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +
  5565. texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +
  5566. texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +
  5567. texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +
  5568. texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +
  5569. texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +
  5570. texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +
  5571. texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +
  5572. texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +
  5573. texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +
  5574. texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +
  5575. texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +
  5576. texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )
  5577. ) * ( 1.0 / 17.0 );
  5578. #elif defined( SHADOWMAP_TYPE_PCF_SOFT )
  5579. vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
  5580. float dx = texelSize.x;
  5581. float dy = texelSize.y;
  5582. vec2 uv = shadowCoord.xy;
  5583. vec2 f = fract( uv * shadowMapSize + 0.5 );
  5584. uv -= f * texelSize;
  5585. shadow = (
  5586. texture2DCompare( shadowMap, uv, shadowCoord.z ) +
  5587. texture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +
  5588. texture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +
  5589. texture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +
  5590. mix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ),
  5591. texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),
  5592. f.x ) +
  5593. mix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ),
  5594. texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),
  5595. f.x ) +
  5596. mix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ),
  5597. texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),
  5598. f.y ) +
  5599. mix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ),
  5600. texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),
  5601. f.y ) +
  5602. mix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ),
  5603. texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),
  5604. f.x ),
  5605. mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ),
  5606. texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),
  5607. f.x ),
  5608. f.y )
  5609. ) * ( 1.0 / 9.0 );
  5610. #elif defined( SHADOWMAP_TYPE_VSM )
  5611. shadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );
  5612. #else
  5613. shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );
  5614. #endif
  5615. }
  5616. return shadow;
  5617. }
  5618. vec2 cubeToUV( vec3 v, float texelSizeY ) {
  5619. vec3 absV = abs( v );
  5620. float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );
  5621. absV *= scaleToCube;
  5622. v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );
  5623. vec2 planar = v.xy;
  5624. float almostATexel = 1.5 * texelSizeY;
  5625. float almostOne = 1.0 - almostATexel;
  5626. if ( absV.z >= almostOne ) {
  5627. if ( v.z > 0.0 )
  5628. planar.x = 4.0 - v.x;
  5629. } else if ( absV.x >= almostOne ) {
  5630. float signX = sign( v.x );
  5631. planar.x = v.z * signX + 2.0 * signX;
  5632. } else if ( absV.y >= almostOne ) {
  5633. float signY = sign( v.y );
  5634. planar.x = v.x + 2.0 * signY + 2.0;
  5635. planar.y = v.z * signY - 2.0;
  5636. }
  5637. return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );
  5638. }
  5639. float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {
  5640. vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );
  5641. vec3 lightToPosition = shadowCoord.xyz;
  5642. float dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear ); dp += shadowBias;
  5643. vec3 bd3D = normalize( lightToPosition );
  5644. #if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )
  5645. vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;
  5646. return (
  5647. texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +
  5648. texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +
  5649. texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +
  5650. texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +
  5651. texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +
  5652. texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +
  5653. texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +
  5654. texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +
  5655. texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )
  5656. ) * ( 1.0 / 9.0 );
  5657. #else
  5658. return texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );
  5659. #endif
  5660. }
  5661. #endif`,Ure=`#if NUM_SPOT_LIGHT_COORDS > 0
  5662. uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];
  5663. varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
  5664. #endif
  5665. #ifdef USE_SHADOWMAP
  5666. #if NUM_DIR_LIGHT_SHADOWS > 0
  5667. uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];
  5668. varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
  5669. struct DirectionalLightShadow {
  5670. float shadowBias;
  5671. float shadowNormalBias;
  5672. float shadowRadius;
  5673. vec2 shadowMapSize;
  5674. };
  5675. uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
  5676. #endif
  5677. #if NUM_SPOT_LIGHT_SHADOWS > 0
  5678. struct SpotLightShadow {
  5679. float shadowBias;
  5680. float shadowNormalBias;
  5681. float shadowRadius;
  5682. vec2 shadowMapSize;
  5683. };
  5684. uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
  5685. #endif
  5686. #if NUM_POINT_LIGHT_SHADOWS > 0
  5687. uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];
  5688. varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
  5689. struct PointLightShadow {
  5690. float shadowBias;
  5691. float shadowNormalBias;
  5692. float shadowRadius;
  5693. vec2 shadowMapSize;
  5694. float shadowCameraNear;
  5695. float shadowCameraFar;
  5696. };
  5697. uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
  5698. #endif
  5699. #endif`,kre=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )
  5700. vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
  5701. vec4 shadowWorldPosition;
  5702. #endif
  5703. #if defined( USE_SHADOWMAP )
  5704. #if NUM_DIR_LIGHT_SHADOWS > 0
  5705. #pragma unroll_loop_start
  5706. for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
  5707. shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );
  5708. vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;
  5709. }
  5710. #pragma unroll_loop_end
  5711. #endif
  5712. #if NUM_POINT_LIGHT_SHADOWS > 0
  5713. #pragma unroll_loop_start
  5714. for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
  5715. shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );
  5716. vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;
  5717. }
  5718. #pragma unroll_loop_end
  5719. #endif
  5720. #endif
  5721. #if NUM_SPOT_LIGHT_COORDS > 0
  5722. #pragma unroll_loop_start
  5723. for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {
  5724. shadowWorldPosition = worldPosition;
  5725. #if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
  5726. shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;
  5727. #endif
  5728. vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;
  5729. }
  5730. #pragma unroll_loop_end
  5731. #endif`,Fre=`float getShadowMask() {
  5732. float shadow = 1.0;
  5733. #ifdef USE_SHADOWMAP
  5734. #if NUM_DIR_LIGHT_SHADOWS > 0
  5735. DirectionalLightShadow directionalLight;
  5736. #pragma unroll_loop_start
  5737. for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
  5738. directionalLight = directionalLightShadows[ i ];
  5739. shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
  5740. }
  5741. #pragma unroll_loop_end
  5742. #endif
  5743. #if NUM_SPOT_LIGHT_SHADOWS > 0
  5744. SpotLightShadow spotLight;
  5745. #pragma unroll_loop_start
  5746. for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {
  5747. spotLight = spotLightShadows[ i ];
  5748. shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
  5749. }
  5750. #pragma unroll_loop_end
  5751. #endif
  5752. #if NUM_POINT_LIGHT_SHADOWS > 0
  5753. PointLightShadow pointLight;
  5754. #pragma unroll_loop_start
  5755. for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
  5756. pointLight = pointLightShadows[ i ];
  5757. shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;
  5758. }
  5759. #pragma unroll_loop_end
  5760. #endif
  5761. #endif
  5762. return shadow;
  5763. }`,zre=`#ifdef USE_SKINNING
  5764. mat4 boneMatX = getBoneMatrix( skinIndex.x );
  5765. mat4 boneMatY = getBoneMatrix( skinIndex.y );
  5766. mat4 boneMatZ = getBoneMatrix( skinIndex.z );
  5767. mat4 boneMatW = getBoneMatrix( skinIndex.w );
  5768. #endif`,Bre=`#ifdef USE_SKINNING
  5769. uniform mat4 bindMatrix;
  5770. uniform mat4 bindMatrixInverse;
  5771. uniform highp sampler2D boneTexture;
  5772. mat4 getBoneMatrix( const in float i ) {
  5773. int size = textureSize( boneTexture, 0 ).x;
  5774. int j = int( i ) * 4;
  5775. int x = j % size;
  5776. int y = j / size;
  5777. vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 );
  5778. vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 );
  5779. vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 );
  5780. vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );
  5781. return mat4( v1, v2, v3, v4 );
  5782. }
  5783. #endif`,jre=`#ifdef USE_SKINNING
  5784. vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );
  5785. vec4 skinned = vec4( 0.0 );
  5786. skinned += boneMatX * skinVertex * skinWeight.x;
  5787. skinned += boneMatY * skinVertex * skinWeight.y;
  5788. skinned += boneMatZ * skinVertex * skinWeight.z;
  5789. skinned += boneMatW * skinVertex * skinWeight.w;
  5790. transformed = ( bindMatrixInverse * skinned ).xyz;
  5791. #endif`,Hre=`#ifdef USE_SKINNING
  5792. mat4 skinMatrix = mat4( 0.0 );
  5793. skinMatrix += skinWeight.x * boneMatX;
  5794. skinMatrix += skinWeight.y * boneMatY;
  5795. skinMatrix += skinWeight.z * boneMatZ;
  5796. skinMatrix += skinWeight.w * boneMatW;
  5797. skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;
  5798. objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;
  5799. #ifdef USE_TANGENT
  5800. objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;
  5801. #endif
  5802. #endif`,Gre=`float specularStrength;
  5803. #ifdef USE_SPECULARMAP
  5804. vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );
  5805. specularStrength = texelSpecular.r;
  5806. #else
  5807. specularStrength = 1.0;
  5808. #endif`,Vre=`#ifdef USE_SPECULARMAP
  5809. uniform sampler2D specularMap;
  5810. #endif`,$re=`#if defined( TONE_MAPPING )
  5811. gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );
  5812. #endif`,Wre=`#ifndef saturate
  5813. #define saturate( a ) clamp( a, 0.0, 1.0 )
  5814. #endif
  5815. uniform float toneMappingExposure;
  5816. vec3 LinearToneMapping( vec3 color ) {
  5817. return saturate( toneMappingExposure * color );
  5818. }
  5819. vec3 ReinhardToneMapping( vec3 color ) {
  5820. color *= toneMappingExposure;
  5821. return saturate( color / ( vec3( 1.0 ) + color ) );
  5822. }
  5823. vec3 OptimizedCineonToneMapping( vec3 color ) {
  5824. color *= toneMappingExposure;
  5825. color = max( vec3( 0.0 ), color - 0.004 );
  5826. return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );
  5827. }
  5828. vec3 RRTAndODTFit( vec3 v ) {
  5829. vec3 a = v * ( v + 0.0245786 ) - 0.000090537;
  5830. vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;
  5831. return a / b;
  5832. }
  5833. vec3 ACESFilmicToneMapping( vec3 color ) {
  5834. const mat3 ACESInputMat = mat3(
  5835. vec3( 0.59719, 0.07600, 0.02840 ), vec3( 0.35458, 0.90834, 0.13383 ),
  5836. vec3( 0.04823, 0.01566, 0.83777 )
  5837. );
  5838. const mat3 ACESOutputMat = mat3(
  5839. vec3( 1.60475, -0.10208, -0.00327 ), vec3( -0.53108, 1.10813, -0.07276 ),
  5840. vec3( -0.07367, -0.00605, 1.07602 )
  5841. );
  5842. color *= toneMappingExposure / 0.6;
  5843. color = ACESInputMat * color;
  5844. color = RRTAndODTFit( color );
  5845. color = ACESOutputMat * color;
  5846. return saturate( color );
  5847. }
  5848. vec3 CustomToneMapping( vec3 color ) { return color; }`,Xre=`#ifdef USE_TRANSMISSION
  5849. material.transmission = transmission;
  5850. material.transmissionAlpha = 1.0;
  5851. material.thickness = thickness;
  5852. material.attenuationDistance = attenuationDistance;
  5853. material.attenuationColor = attenuationColor;
  5854. #ifdef USE_TRANSMISSIONMAP
  5855. material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;
  5856. #endif
  5857. #ifdef USE_THICKNESSMAP
  5858. material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;
  5859. #endif
  5860. vec3 pos = vWorldPosition;
  5861. vec3 v = normalize( cameraPosition - pos );
  5862. vec3 n = inverseTransformDirection( normal, viewMatrix );
  5863. vec4 transmitted = getIBLVolumeRefraction(
  5864. n, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,
  5865. pos, modelMatrix, viewMatrix, projectionMatrix, material.ior, material.thickness,
  5866. material.attenuationColor, material.attenuationDistance );
  5867. material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );
  5868. totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );
  5869. #endif`,qre=`#ifdef USE_TRANSMISSION
  5870. uniform float transmission;
  5871. uniform float thickness;
  5872. uniform float attenuationDistance;
  5873. uniform vec3 attenuationColor;
  5874. #ifdef USE_TRANSMISSIONMAP
  5875. uniform sampler2D transmissionMap;
  5876. #endif
  5877. #ifdef USE_THICKNESSMAP
  5878. uniform sampler2D thicknessMap;
  5879. #endif
  5880. uniform vec2 transmissionSamplerSize;
  5881. uniform sampler2D transmissionSamplerMap;
  5882. uniform mat4 modelMatrix;
  5883. uniform mat4 projectionMatrix;
  5884. varying vec3 vWorldPosition;
  5885. float w0( float a ) {
  5886. return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );
  5887. }
  5888. float w1( float a ) {
  5889. return ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 );
  5890. }
  5891. float w2( float a ){
  5892. return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );
  5893. }
  5894. float w3( float a ) {
  5895. return ( 1.0 / 6.0 ) * ( a * a * a );
  5896. }
  5897. float g0( float a ) {
  5898. return w0( a ) + w1( a );
  5899. }
  5900. float g1( float a ) {
  5901. return w2( a ) + w3( a );
  5902. }
  5903. float h0( float a ) {
  5904. return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );
  5905. }
  5906. float h1( float a ) {
  5907. return 1.0 + w3( a ) / ( w2( a ) + w3( a ) );
  5908. }
  5909. vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {
  5910. uv = uv * texelSize.zw + 0.5;
  5911. vec2 iuv = floor( uv );
  5912. vec2 fuv = fract( uv );
  5913. float g0x = g0( fuv.x );
  5914. float g1x = g1( fuv.x );
  5915. float h0x = h0( fuv.x );
  5916. float h1x = h1( fuv.x );
  5917. float h0y = h0( fuv.y );
  5918. float h1y = h1( fuv.y );
  5919. vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;
  5920. vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;
  5921. vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;
  5922. vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;
  5923. return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +
  5924. g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );
  5925. }
  5926. vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {
  5927. vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );
  5928. vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );
  5929. vec2 fLodSizeInv = 1.0 / fLodSize;
  5930. vec2 cLodSizeInv = 1.0 / cLodSize;
  5931. vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );
  5932. vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );
  5933. return mix( fSample, cSample, fract( lod ) );
  5934. }
  5935. vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {
  5936. vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );
  5937. vec3 modelScale;
  5938. modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );
  5939. modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );
  5940. modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );
  5941. return normalize( refractionVector ) * thickness * modelScale;
  5942. }
  5943. float applyIorToRoughness( const in float roughness, const in float ior ) {
  5944. return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );
  5945. }
  5946. vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {
  5947. float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );
  5948. return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );
  5949. }
  5950. vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {
  5951. if ( isinf( attenuationDistance ) ) {
  5952. return vec3( 1.0 );
  5953. } else {
  5954. vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;
  5955. vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); return transmittance;
  5956. }
  5957. }
  5958. vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,
  5959. const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,
  5960. const in mat4 viewMatrix, const in mat4 projMatrix, const in float ior, const in float thickness,
  5961. const in vec3 attenuationColor, const in float attenuationDistance ) {
  5962. vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );
  5963. vec3 refractedRayExit = position + transmissionRay;
  5964. vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );
  5965. vec2 refractionCoords = ndcPos.xy / ndcPos.w;
  5966. refractionCoords += 1.0;
  5967. refractionCoords /= 2.0;
  5968. vec4 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );
  5969. vec3 transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );
  5970. vec3 attenuatedColor = transmittance * transmittedLight.rgb;
  5971. vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );
  5972. float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;
  5973. return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );
  5974. }
  5975. #endif`,Yre=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
  5976. varying vec2 vUv;
  5977. #endif
  5978. #ifdef USE_MAP
  5979. varying vec2 vMapUv;
  5980. #endif
  5981. #ifdef USE_ALPHAMAP
  5982. varying vec2 vAlphaMapUv;
  5983. #endif
  5984. #ifdef USE_LIGHTMAP
  5985. varying vec2 vLightMapUv;
  5986. #endif
  5987. #ifdef USE_AOMAP
  5988. varying vec2 vAoMapUv;
  5989. #endif
  5990. #ifdef USE_BUMPMAP
  5991. varying vec2 vBumpMapUv;
  5992. #endif
  5993. #ifdef USE_NORMALMAP
  5994. varying vec2 vNormalMapUv;
  5995. #endif
  5996. #ifdef USE_EMISSIVEMAP
  5997. varying vec2 vEmissiveMapUv;
  5998. #endif
  5999. #ifdef USE_METALNESSMAP
  6000. varying vec2 vMetalnessMapUv;
  6001. #endif
  6002. #ifdef USE_ROUGHNESSMAP
  6003. varying vec2 vRoughnessMapUv;
  6004. #endif
  6005. #ifdef USE_ANISOTROPYMAP
  6006. varying vec2 vAnisotropyMapUv;
  6007. #endif
  6008. #ifdef USE_CLEARCOATMAP
  6009. varying vec2 vClearcoatMapUv;
  6010. #endif
  6011. #ifdef USE_CLEARCOAT_NORMALMAP
  6012. varying vec2 vClearcoatNormalMapUv;
  6013. #endif
  6014. #ifdef USE_CLEARCOAT_ROUGHNESSMAP
  6015. varying vec2 vClearcoatRoughnessMapUv;
  6016. #endif
  6017. #ifdef USE_IRIDESCENCEMAP
  6018. varying vec2 vIridescenceMapUv;
  6019. #endif
  6020. #ifdef USE_IRIDESCENCE_THICKNESSMAP
  6021. varying vec2 vIridescenceThicknessMapUv;
  6022. #endif
  6023. #ifdef USE_SHEEN_COLORMAP
  6024. varying vec2 vSheenColorMapUv;
  6025. #endif
  6026. #ifdef USE_SHEEN_ROUGHNESSMAP
  6027. varying vec2 vSheenRoughnessMapUv;
  6028. #endif
  6029. #ifdef USE_SPECULARMAP
  6030. varying vec2 vSpecularMapUv;
  6031. #endif
  6032. #ifdef USE_SPECULAR_COLORMAP
  6033. varying vec2 vSpecularColorMapUv;
  6034. #endif
  6035. #ifdef USE_SPECULAR_INTENSITYMAP
  6036. varying vec2 vSpecularIntensityMapUv;
  6037. #endif
  6038. #ifdef USE_TRANSMISSIONMAP
  6039. uniform mat3 transmissionMapTransform;
  6040. varying vec2 vTransmissionMapUv;
  6041. #endif
  6042. #ifdef USE_THICKNESSMAP
  6043. uniform mat3 thicknessMapTransform;
  6044. varying vec2 vThicknessMapUv;
  6045. #endif`,Kre=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
  6046. varying vec2 vUv;
  6047. #endif
  6048. #ifdef USE_MAP
  6049. uniform mat3 mapTransform;
  6050. varying vec2 vMapUv;
  6051. #endif
  6052. #ifdef USE_ALPHAMAP
  6053. uniform mat3 alphaMapTransform;
  6054. varying vec2 vAlphaMapUv;
  6055. #endif
  6056. #ifdef USE_LIGHTMAP
  6057. uniform mat3 lightMapTransform;
  6058. varying vec2 vLightMapUv;
  6059. #endif
  6060. #ifdef USE_AOMAP
  6061. uniform mat3 aoMapTransform;
  6062. varying vec2 vAoMapUv;
  6063. #endif
  6064. #ifdef USE_BUMPMAP
  6065. uniform mat3 bumpMapTransform;
  6066. varying vec2 vBumpMapUv;
  6067. #endif
  6068. #ifdef USE_NORMALMAP
  6069. uniform mat3 normalMapTransform;
  6070. varying vec2 vNormalMapUv;
  6071. #endif
  6072. #ifdef USE_DISPLACEMENTMAP
  6073. uniform mat3 displacementMapTransform;
  6074. varying vec2 vDisplacementMapUv;
  6075. #endif
  6076. #ifdef USE_EMISSIVEMAP
  6077. uniform mat3 emissiveMapTransform;
  6078. varying vec2 vEmissiveMapUv;
  6079. #endif
  6080. #ifdef USE_METALNESSMAP
  6081. uniform mat3 metalnessMapTransform;
  6082. varying vec2 vMetalnessMapUv;
  6083. #endif
  6084. #ifdef USE_ROUGHNESSMAP
  6085. uniform mat3 roughnessMapTransform;
  6086. varying vec2 vRoughnessMapUv;
  6087. #endif
  6088. #ifdef USE_ANISOTROPYMAP
  6089. uniform mat3 anisotropyMapTransform;
  6090. varying vec2 vAnisotropyMapUv;
  6091. #endif
  6092. #ifdef USE_CLEARCOATMAP
  6093. uniform mat3 clearcoatMapTransform;
  6094. varying vec2 vClearcoatMapUv;
  6095. #endif
  6096. #ifdef USE_CLEARCOAT_NORMALMAP
  6097. uniform mat3 clearcoatNormalMapTransform;
  6098. varying vec2 vClearcoatNormalMapUv;
  6099. #endif
  6100. #ifdef USE_CLEARCOAT_ROUGHNESSMAP
  6101. uniform mat3 clearcoatRoughnessMapTransform;
  6102. varying vec2 vClearcoatRoughnessMapUv;
  6103. #endif
  6104. #ifdef USE_SHEEN_COLORMAP
  6105. uniform mat3 sheenColorMapTransform;
  6106. varying vec2 vSheenColorMapUv;
  6107. #endif
  6108. #ifdef USE_SHEEN_ROUGHNESSMAP
  6109. uniform mat3 sheenRoughnessMapTransform;
  6110. varying vec2 vSheenRoughnessMapUv;
  6111. #endif
  6112. #ifdef USE_IRIDESCENCEMAP
  6113. uniform mat3 iridescenceMapTransform;
  6114. varying vec2 vIridescenceMapUv;
  6115. #endif
  6116. #ifdef USE_IRIDESCENCE_THICKNESSMAP
  6117. uniform mat3 iridescenceThicknessMapTransform;
  6118. varying vec2 vIridescenceThicknessMapUv;
  6119. #endif
  6120. #ifdef USE_SPECULARMAP
  6121. uniform mat3 specularMapTransform;
  6122. varying vec2 vSpecularMapUv;
  6123. #endif
  6124. #ifdef USE_SPECULAR_COLORMAP
  6125. uniform mat3 specularColorMapTransform;
  6126. varying vec2 vSpecularColorMapUv;
  6127. #endif
  6128. #ifdef USE_SPECULAR_INTENSITYMAP
  6129. uniform mat3 specularIntensityMapTransform;
  6130. varying vec2 vSpecularIntensityMapUv;
  6131. #endif
  6132. #ifdef USE_TRANSMISSIONMAP
  6133. uniform mat3 transmissionMapTransform;
  6134. varying vec2 vTransmissionMapUv;
  6135. #endif
  6136. #ifdef USE_THICKNESSMAP
  6137. uniform mat3 thicknessMapTransform;
  6138. varying vec2 vThicknessMapUv;
  6139. #endif`,Zre=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
  6140. vUv = vec3( uv, 1 ).xy;
  6141. #endif
  6142. #ifdef USE_MAP
  6143. vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;
  6144. #endif
  6145. #ifdef USE_ALPHAMAP
  6146. vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;
  6147. #endif
  6148. #ifdef USE_LIGHTMAP
  6149. vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;
  6150. #endif
  6151. #ifdef USE_AOMAP
  6152. vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;
  6153. #endif
  6154. #ifdef USE_BUMPMAP
  6155. vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;
  6156. #endif
  6157. #ifdef USE_NORMALMAP
  6158. vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;
  6159. #endif
  6160. #ifdef USE_DISPLACEMENTMAP
  6161. vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;
  6162. #endif
  6163. #ifdef USE_EMISSIVEMAP
  6164. vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;
  6165. #endif
  6166. #ifdef USE_METALNESSMAP
  6167. vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;
  6168. #endif
  6169. #ifdef USE_ROUGHNESSMAP
  6170. vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;
  6171. #endif
  6172. #ifdef USE_ANISOTROPYMAP
  6173. vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;
  6174. #endif
  6175. #ifdef USE_CLEARCOATMAP
  6176. vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;
  6177. #endif
  6178. #ifdef USE_CLEARCOAT_NORMALMAP
  6179. vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;
  6180. #endif
  6181. #ifdef USE_CLEARCOAT_ROUGHNESSMAP
  6182. vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;
  6183. #endif
  6184. #ifdef USE_IRIDESCENCEMAP
  6185. vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;
  6186. #endif
  6187. #ifdef USE_IRIDESCENCE_THICKNESSMAP
  6188. vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;
  6189. #endif
  6190. #ifdef USE_SHEEN_COLORMAP
  6191. vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;
  6192. #endif
  6193. #ifdef USE_SHEEN_ROUGHNESSMAP
  6194. vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;
  6195. #endif
  6196. #ifdef USE_SPECULARMAP
  6197. vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;
  6198. #endif
  6199. #ifdef USE_SPECULAR_COLORMAP
  6200. vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;
  6201. #endif
  6202. #ifdef USE_SPECULAR_INTENSITYMAP
  6203. vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;
  6204. #endif
  6205. #ifdef USE_TRANSMISSIONMAP
  6206. vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;
  6207. #endif
  6208. #ifdef USE_THICKNESSMAP
  6209. vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;
  6210. #endif`,Qre=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0
  6211. vec4 worldPosition = vec4( transformed, 1.0 );
  6212. #ifdef USE_BATCHING
  6213. worldPosition = batchingMatrix * worldPosition;
  6214. #endif
  6215. #ifdef USE_INSTANCING
  6216. worldPosition = instanceMatrix * worldPosition;
  6217. #endif
  6218. worldPosition = modelMatrix * worldPosition;
  6219. #endif`;const Jre=`varying vec2 vUv;
  6220. uniform mat3 uvTransform;
  6221. void main() {
  6222. vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
  6223. gl_Position = vec4( position.xy, 1.0, 1.0 );
  6224. }`,eae=`uniform sampler2D t2D;
  6225. uniform float backgroundIntensity;
  6226. varying vec2 vUv;
  6227. void main() {
  6228. vec4 texColor = texture2D( t2D, vUv );
  6229. #ifdef DECODE_VIDEO_TEXTURE
  6230. 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 );
  6231. #endif
  6232. texColor.rgb *= backgroundIntensity;
  6233. gl_FragColor = texColor;
  6234. #include <tonemapping_fragment>
  6235. #include <colorspace_fragment>
  6236. }`,tae=`varying vec3 vWorldDirection;
  6237. #include <common>
  6238. void main() {
  6239. vWorldDirection = transformDirection( position, modelMatrix );
  6240. #include <begin_vertex>
  6241. #include <project_vertex>
  6242. gl_Position.z = gl_Position.w;
  6243. }`,nae=`#ifdef ENVMAP_TYPE_CUBE
  6244. uniform samplerCube envMap;
  6245. #elif defined( ENVMAP_TYPE_CUBE_UV )
  6246. uniform sampler2D envMap;
  6247. #endif
  6248. uniform float flipEnvMap;
  6249. uniform float backgroundBlurriness;
  6250. uniform float backgroundIntensity;
  6251. varying vec3 vWorldDirection;
  6252. #include <cube_uv_reflection_fragment>
  6253. void main() {
  6254. #ifdef ENVMAP_TYPE_CUBE
  6255. vec4 texColor = textureCube( envMap, vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );
  6256. #elif defined( ENVMAP_TYPE_CUBE_UV )
  6257. vec4 texColor = textureCubeUV( envMap, vWorldDirection, backgroundBlurriness );
  6258. #else
  6259. vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );
  6260. #endif
  6261. texColor.rgb *= backgroundIntensity;
  6262. gl_FragColor = texColor;
  6263. #include <tonemapping_fragment>
  6264. #include <colorspace_fragment>
  6265. }`,iae=`varying vec3 vWorldDirection;
  6266. #include <common>
  6267. void main() {
  6268. vWorldDirection = transformDirection( position, modelMatrix );
  6269. #include <begin_vertex>
  6270. #include <project_vertex>
  6271. gl_Position.z = gl_Position.w;
  6272. }`,rae=`uniform samplerCube tCube;
  6273. uniform float tFlip;
  6274. uniform float opacity;
  6275. varying vec3 vWorldDirection;
  6276. void main() {
  6277. vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );
  6278. gl_FragColor = texColor;
  6279. gl_FragColor.a *= opacity;
  6280. #include <tonemapping_fragment>
  6281. #include <colorspace_fragment>
  6282. }`,aae=`#include <common>
  6283. #include <batching_pars_vertex>
  6284. #include <uv_pars_vertex>
  6285. #include <displacementmap_pars_vertex>
  6286. #include <morphtarget_pars_vertex>
  6287. #include <skinning_pars_vertex>
  6288. #include <logdepthbuf_pars_vertex>
  6289. #include <clipping_planes_pars_vertex>
  6290. varying vec2 vHighPrecisionZW;
  6291. void main() {
  6292. #include <uv_vertex>
  6293. #include <batching_vertex>
  6294. #include <skinbase_vertex>
  6295. #ifdef USE_DISPLACEMENTMAP
  6296. #include <beginnormal_vertex>
  6297. #include <morphnormal_vertex>
  6298. #include <skinnormal_vertex>
  6299. #endif
  6300. #include <begin_vertex>
  6301. #include <morphtarget_vertex>
  6302. #include <skinning_vertex>
  6303. #include <displacementmap_vertex>
  6304. #include <project_vertex>
  6305. #include <logdepthbuf_vertex>
  6306. #include <clipping_planes_vertex>
  6307. vHighPrecisionZW = gl_Position.zw;
  6308. }`,sae=`#if DEPTH_PACKING == 3200
  6309. uniform float opacity;
  6310. #endif
  6311. #include <common>
  6312. #include <packing>
  6313. #include <uv_pars_fragment>
  6314. #include <map_pars_fragment>
  6315. #include <alphamap_pars_fragment>
  6316. #include <alphatest_pars_fragment>
  6317. #include <alphahash_pars_fragment>
  6318. #include <logdepthbuf_pars_fragment>
  6319. #include <clipping_planes_pars_fragment>
  6320. varying vec2 vHighPrecisionZW;
  6321. void main() {
  6322. #include <clipping_planes_fragment>
  6323. vec4 diffuseColor = vec4( 1.0 );
  6324. #if DEPTH_PACKING == 3200
  6325. diffuseColor.a = opacity;
  6326. #endif
  6327. #include <map_fragment>
  6328. #include <alphamap_fragment>
  6329. #include <alphatest_fragment>
  6330. #include <alphahash_fragment>
  6331. #include <logdepthbuf_fragment>
  6332. float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;
  6333. #if DEPTH_PACKING == 3200
  6334. gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );
  6335. #elif DEPTH_PACKING == 3201
  6336. gl_FragColor = packDepthToRGBA( fragCoordZ );
  6337. #endif
  6338. }`,oae=`#define DISTANCE
  6339. varying vec3 vWorldPosition;
  6340. #include <common>
  6341. #include <batching_pars_vertex>
  6342. #include <uv_pars_vertex>
  6343. #include <displacementmap_pars_vertex>
  6344. #include <morphtarget_pars_vertex>
  6345. #include <skinning_pars_vertex>
  6346. #include <clipping_planes_pars_vertex>
  6347. void main() {
  6348. #include <uv_vertex>
  6349. #include <batching_vertex>
  6350. #include <skinbase_vertex>
  6351. #ifdef USE_DISPLACEMENTMAP
  6352. #include <beginnormal_vertex>
  6353. #include <morphnormal_vertex>
  6354. #include <skinnormal_vertex>
  6355. #endif
  6356. #include <begin_vertex>
  6357. #include <morphtarget_vertex>
  6358. #include <skinning_vertex>
  6359. #include <displacementmap_vertex>
  6360. #include <project_vertex>
  6361. #include <worldpos_vertex>
  6362. #include <clipping_planes_vertex>
  6363. vWorldPosition = worldPosition.xyz;
  6364. }`,lae=`#define DISTANCE
  6365. uniform vec3 referencePosition;
  6366. uniform float nearDistance;
  6367. uniform float farDistance;
  6368. varying vec3 vWorldPosition;
  6369. #include <common>
  6370. #include <packing>
  6371. #include <uv_pars_fragment>
  6372. #include <map_pars_fragment>
  6373. #include <alphamap_pars_fragment>
  6374. #include <alphatest_pars_fragment>
  6375. #include <alphahash_pars_fragment>
  6376. #include <clipping_planes_pars_fragment>
  6377. void main () {
  6378. #include <clipping_planes_fragment>
  6379. vec4 diffuseColor = vec4( 1.0 );
  6380. #include <map_fragment>
  6381. #include <alphamap_fragment>
  6382. #include <alphatest_fragment>
  6383. #include <alphahash_fragment>
  6384. float dist = length( vWorldPosition - referencePosition );
  6385. dist = ( dist - nearDistance ) / ( farDistance - nearDistance );
  6386. dist = saturate( dist );
  6387. gl_FragColor = packDepthToRGBA( dist );
  6388. }`,cae=`varying vec3 vWorldDirection;
  6389. #include <common>
  6390. void main() {
  6391. vWorldDirection = transformDirection( position, modelMatrix );
  6392. #include <begin_vertex>
  6393. #include <project_vertex>
  6394. }`,uae=`uniform sampler2D tEquirect;
  6395. varying vec3 vWorldDirection;
  6396. #include <common>
  6397. void main() {
  6398. vec3 direction = normalize( vWorldDirection );
  6399. vec2 sampleUV = equirectUv( direction );
  6400. gl_FragColor = texture2D( tEquirect, sampleUV );
  6401. #include <tonemapping_fragment>
  6402. #include <colorspace_fragment>
  6403. }`,dae=`uniform float scale;
  6404. attribute float lineDistance;
  6405. varying float vLineDistance;
  6406. #include <common>
  6407. #include <uv_pars_vertex>
  6408. #include <color_pars_vertex>
  6409. #include <fog_pars_vertex>
  6410. #include <morphtarget_pars_vertex>
  6411. #include <logdepthbuf_pars_vertex>
  6412. #include <clipping_planes_pars_vertex>
  6413. void main() {
  6414. vLineDistance = scale * lineDistance;
  6415. #include <uv_vertex>
  6416. #include <color_vertex>
  6417. #include <morphcolor_vertex>
  6418. #include <begin_vertex>
  6419. #include <morphtarget_vertex>
  6420. #include <project_vertex>
  6421. #include <logdepthbuf_vertex>
  6422. #include <clipping_planes_vertex>
  6423. #include <fog_vertex>
  6424. }`,fae=`uniform vec3 diffuse;
  6425. uniform float opacity;
  6426. uniform float dashSize;
  6427. uniform float totalSize;
  6428. varying float vLineDistance;
  6429. #include <common>
  6430. #include <color_pars_fragment>
  6431. #include <uv_pars_fragment>
  6432. #include <map_pars_fragment>
  6433. #include <fog_pars_fragment>
  6434. #include <logdepthbuf_pars_fragment>
  6435. #include <clipping_planes_pars_fragment>
  6436. void main() {
  6437. #include <clipping_planes_fragment>
  6438. if ( mod( vLineDistance, totalSize ) > dashSize ) {
  6439. discard;
  6440. }
  6441. vec3 outgoingLight = vec3( 0.0 );
  6442. vec4 diffuseColor = vec4( diffuse, opacity );
  6443. #include <logdepthbuf_fragment>
  6444. #include <map_fragment>
  6445. #include <color_fragment>
  6446. outgoingLight = diffuseColor.rgb;
  6447. #include <opaque_fragment>
  6448. #include <tonemapping_fragment>
  6449. #include <colorspace_fragment>
  6450. #include <fog_fragment>
  6451. #include <premultiplied_alpha_fragment>
  6452. }`,hae=`#include <common>
  6453. #include <batching_pars_vertex>
  6454. #include <uv_pars_vertex>
  6455. #include <envmap_pars_vertex>
  6456. #include <color_pars_vertex>
  6457. #include <fog_pars_vertex>
  6458. #include <morphtarget_pars_vertex>
  6459. #include <skinning_pars_vertex>
  6460. #include <logdepthbuf_pars_vertex>
  6461. #include <clipping_planes_pars_vertex>
  6462. void main() {
  6463. #include <uv_vertex>
  6464. #include <color_vertex>
  6465. #include <morphcolor_vertex>
  6466. #include <batching_vertex>
  6467. #if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )
  6468. #include <beginnormal_vertex>
  6469. #include <morphnormal_vertex>
  6470. #include <skinbase_vertex>
  6471. #include <skinnormal_vertex>
  6472. #include <defaultnormal_vertex>
  6473. #endif
  6474. #include <begin_vertex>
  6475. #include <morphtarget_vertex>
  6476. #include <skinning_vertex>
  6477. #include <project_vertex>
  6478. #include <logdepthbuf_vertex>
  6479. #include <clipping_planes_vertex>
  6480. #include <worldpos_vertex>
  6481. #include <envmap_vertex>
  6482. #include <fog_vertex>
  6483. }`,pae=`uniform vec3 diffuse;
  6484. uniform float opacity;
  6485. #ifndef FLAT_SHADED
  6486. varying vec3 vNormal;
  6487. #endif
  6488. #include <common>
  6489. #include <dithering_pars_fragment>
  6490. #include <color_pars_fragment>
  6491. #include <uv_pars_fragment>
  6492. #include <map_pars_fragment>
  6493. #include <alphamap_pars_fragment>
  6494. #include <alphatest_pars_fragment>
  6495. #include <alphahash_pars_fragment>
  6496. #include <aomap_pars_fragment>
  6497. #include <lightmap_pars_fragment>
  6498. #include <envmap_common_pars_fragment>
  6499. #include <envmap_pars_fragment>
  6500. #include <fog_pars_fragment>
  6501. #include <specularmap_pars_fragment>
  6502. #include <logdepthbuf_pars_fragment>
  6503. #include <clipping_planes_pars_fragment>
  6504. void main() {
  6505. #include <clipping_planes_fragment>
  6506. vec4 diffuseColor = vec4( diffuse, opacity );
  6507. #include <logdepthbuf_fragment>
  6508. #include <map_fragment>
  6509. #include <color_fragment>
  6510. #include <alphamap_fragment>
  6511. #include <alphatest_fragment>
  6512. #include <alphahash_fragment>
  6513. #include <specularmap_fragment>
  6514. ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
  6515. #ifdef USE_LIGHTMAP
  6516. vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
  6517. reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;
  6518. #else
  6519. reflectedLight.indirectDiffuse += vec3( 1.0 );
  6520. #endif
  6521. #include <aomap_fragment>
  6522. reflectedLight.indirectDiffuse *= diffuseColor.rgb;
  6523. vec3 outgoingLight = reflectedLight.indirectDiffuse;
  6524. #include <envmap_fragment>
  6525. #include <opaque_fragment>
  6526. #include <tonemapping_fragment>
  6527. #include <colorspace_fragment>
  6528. #include <fog_fragment>
  6529. #include <premultiplied_alpha_fragment>
  6530. #include <dithering_fragment>
  6531. }`,mae=`#define LAMBERT
  6532. varying vec3 vViewPosition;
  6533. #include <common>
  6534. #include <batching_pars_vertex>
  6535. #include <uv_pars_vertex>
  6536. #include <displacementmap_pars_vertex>
  6537. #include <envmap_pars_vertex>
  6538. #include <color_pars_vertex>
  6539. #include <fog_pars_vertex>
  6540. #include <normal_pars_vertex>
  6541. #include <morphtarget_pars_vertex>
  6542. #include <skinning_pars_vertex>
  6543. #include <shadowmap_pars_vertex>
  6544. #include <logdepthbuf_pars_vertex>
  6545. #include <clipping_planes_pars_vertex>
  6546. void main() {
  6547. #include <uv_vertex>
  6548. #include <color_vertex>
  6549. #include <morphcolor_vertex>
  6550. #include <batching_vertex>
  6551. #include <beginnormal_vertex>
  6552. #include <morphnormal_vertex>
  6553. #include <skinbase_vertex>
  6554. #include <skinnormal_vertex>
  6555. #include <defaultnormal_vertex>
  6556. #include <normal_vertex>
  6557. #include <begin_vertex>
  6558. #include <morphtarget_vertex>
  6559. #include <skinning_vertex>
  6560. #include <displacementmap_vertex>
  6561. #include <project_vertex>
  6562. #include <logdepthbuf_vertex>
  6563. #include <clipping_planes_vertex>
  6564. vViewPosition = - mvPosition.xyz;
  6565. #include <worldpos_vertex>
  6566. #include <envmap_vertex>
  6567. #include <shadowmap_vertex>
  6568. #include <fog_vertex>
  6569. }`,gae=`#define LAMBERT
  6570. uniform vec3 diffuse;
  6571. uniform vec3 emissive;
  6572. uniform float opacity;
  6573. #include <common>
  6574. #include <packing>
  6575. #include <dithering_pars_fragment>
  6576. #include <color_pars_fragment>
  6577. #include <uv_pars_fragment>
  6578. #include <map_pars_fragment>
  6579. #include <alphamap_pars_fragment>
  6580. #include <alphatest_pars_fragment>
  6581. #include <alphahash_pars_fragment>
  6582. #include <aomap_pars_fragment>
  6583. #include <lightmap_pars_fragment>
  6584. #include <emissivemap_pars_fragment>
  6585. #include <envmap_common_pars_fragment>
  6586. #include <envmap_pars_fragment>
  6587. #include <fog_pars_fragment>
  6588. #include <bsdfs>
  6589. #include <lights_pars_begin>
  6590. #include <normal_pars_fragment>
  6591. #include <lights_lambert_pars_fragment>
  6592. #include <shadowmap_pars_fragment>
  6593. #include <bumpmap_pars_fragment>
  6594. #include <normalmap_pars_fragment>
  6595. #include <specularmap_pars_fragment>
  6596. #include <logdepthbuf_pars_fragment>
  6597. #include <clipping_planes_pars_fragment>
  6598. void main() {
  6599. #include <clipping_planes_fragment>
  6600. vec4 diffuseColor = vec4( diffuse, opacity );
  6601. ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
  6602. vec3 totalEmissiveRadiance = emissive;
  6603. #include <logdepthbuf_fragment>
  6604. #include <map_fragment>
  6605. #include <color_fragment>
  6606. #include <alphamap_fragment>
  6607. #include <alphatest_fragment>
  6608. #include <alphahash_fragment>
  6609. #include <specularmap_fragment>
  6610. #include <normal_fragment_begin>
  6611. #include <normal_fragment_maps>
  6612. #include <emissivemap_fragment>
  6613. #include <lights_lambert_fragment>
  6614. #include <lights_fragment_begin>
  6615. #include <lights_fragment_maps>
  6616. #include <lights_fragment_end>
  6617. #include <aomap_fragment>
  6618. vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
  6619. #include <envmap_fragment>
  6620. #include <opaque_fragment>
  6621. #include <tonemapping_fragment>
  6622. #include <colorspace_fragment>
  6623. #include <fog_fragment>
  6624. #include <premultiplied_alpha_fragment>
  6625. #include <dithering_fragment>
  6626. }`,vae=`#define MATCAP
  6627. varying vec3 vViewPosition;
  6628. #include <common>
  6629. #include <batching_pars_vertex>
  6630. #include <uv_pars_vertex>
  6631. #include <color_pars_vertex>
  6632. #include <displacementmap_pars_vertex>
  6633. #include <fog_pars_vertex>
  6634. #include <normal_pars_vertex>
  6635. #include <morphtarget_pars_vertex>
  6636. #include <skinning_pars_vertex>
  6637. #include <logdepthbuf_pars_vertex>
  6638. #include <clipping_planes_pars_vertex>
  6639. void main() {
  6640. #include <uv_vertex>
  6641. #include <color_vertex>
  6642. #include <morphcolor_vertex>
  6643. #include <batching_vertex>
  6644. #include <beginnormal_vertex>
  6645. #include <morphnormal_vertex>
  6646. #include <skinbase_vertex>
  6647. #include <skinnormal_vertex>
  6648. #include <defaultnormal_vertex>
  6649. #include <normal_vertex>
  6650. #include <begin_vertex>
  6651. #include <morphtarget_vertex>
  6652. #include <skinning_vertex>
  6653. #include <displacementmap_vertex>
  6654. #include <project_vertex>
  6655. #include <logdepthbuf_vertex>
  6656. #include <clipping_planes_vertex>
  6657. #include <fog_vertex>
  6658. vViewPosition = - mvPosition.xyz;
  6659. }`,xae=`#define MATCAP
  6660. uniform vec3 diffuse;
  6661. uniform float opacity;
  6662. uniform sampler2D matcap;
  6663. varying vec3 vViewPosition;
  6664. #include <common>
  6665. #include <dithering_pars_fragment>
  6666. #include <color_pars_fragment>
  6667. #include <uv_pars_fragment>
  6668. #include <map_pars_fragment>
  6669. #include <alphamap_pars_fragment>
  6670. #include <alphatest_pars_fragment>
  6671. #include <alphahash_pars_fragment>
  6672. #include <fog_pars_fragment>
  6673. #include <normal_pars_fragment>
  6674. #include <bumpmap_pars_fragment>
  6675. #include <normalmap_pars_fragment>
  6676. #include <logdepthbuf_pars_fragment>
  6677. #include <clipping_planes_pars_fragment>
  6678. void main() {
  6679. #include <clipping_planes_fragment>
  6680. vec4 diffuseColor = vec4( diffuse, opacity );
  6681. #include <logdepthbuf_fragment>
  6682. #include <map_fragment>
  6683. #include <color_fragment>
  6684. #include <alphamap_fragment>
  6685. #include <alphatest_fragment>
  6686. #include <alphahash_fragment>
  6687. #include <normal_fragment_begin>
  6688. #include <normal_fragment_maps>
  6689. vec3 viewDir = normalize( vViewPosition );
  6690. vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );
  6691. vec3 y = cross( viewDir, x );
  6692. vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;
  6693. #ifdef USE_MATCAP
  6694. vec4 matcapColor = texture2D( matcap, uv );
  6695. #else
  6696. vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );
  6697. #endif
  6698. vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;
  6699. #include <opaque_fragment>
  6700. #include <tonemapping_fragment>
  6701. #include <colorspace_fragment>
  6702. #include <fog_fragment>
  6703. #include <premultiplied_alpha_fragment>
  6704. #include <dithering_fragment>
  6705. }`,yae=`#define NORMAL
  6706. #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
  6707. varying vec3 vViewPosition;
  6708. #endif
  6709. #include <common>
  6710. #include <batching_pars_vertex>
  6711. #include <uv_pars_vertex>
  6712. #include <displacementmap_pars_vertex>
  6713. #include <normal_pars_vertex>
  6714. #include <morphtarget_pars_vertex>
  6715. #include <skinning_pars_vertex>
  6716. #include <logdepthbuf_pars_vertex>
  6717. #include <clipping_planes_pars_vertex>
  6718. void main() {
  6719. #include <uv_vertex>
  6720. #include <batching_vertex>
  6721. #include <beginnormal_vertex>
  6722. #include <morphnormal_vertex>
  6723. #include <skinbase_vertex>
  6724. #include <skinnormal_vertex>
  6725. #include <defaultnormal_vertex>
  6726. #include <normal_vertex>
  6727. #include <begin_vertex>
  6728. #include <morphtarget_vertex>
  6729. #include <skinning_vertex>
  6730. #include <displacementmap_vertex>
  6731. #include <project_vertex>
  6732. #include <logdepthbuf_vertex>
  6733. #include <clipping_planes_vertex>
  6734. #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
  6735. vViewPosition = - mvPosition.xyz;
  6736. #endif
  6737. }`,bae=`#define NORMAL
  6738. uniform float opacity;
  6739. #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
  6740. varying vec3 vViewPosition;
  6741. #endif
  6742. #include <packing>
  6743. #include <uv_pars_fragment>
  6744. #include <normal_pars_fragment>
  6745. #include <bumpmap_pars_fragment>
  6746. #include <normalmap_pars_fragment>
  6747. #include <logdepthbuf_pars_fragment>
  6748. #include <clipping_planes_pars_fragment>
  6749. void main() {
  6750. #include <clipping_planes_fragment>
  6751. #include <logdepthbuf_fragment>
  6752. #include <normal_fragment_begin>
  6753. #include <normal_fragment_maps>
  6754. gl_FragColor = vec4( packNormalToRGB( normal ), opacity );
  6755. #ifdef OPAQUE
  6756. gl_FragColor.a = 1.0;
  6757. #endif
  6758. }`,_ae=`#define PHONG
  6759. varying vec3 vViewPosition;
  6760. #include <common>
  6761. #include <batching_pars_vertex>
  6762. #include <uv_pars_vertex>
  6763. #include <displacementmap_pars_vertex>
  6764. #include <envmap_pars_vertex>
  6765. #include <color_pars_vertex>
  6766. #include <fog_pars_vertex>
  6767. #include <normal_pars_vertex>
  6768. #include <morphtarget_pars_vertex>
  6769. #include <skinning_pars_vertex>
  6770. #include <shadowmap_pars_vertex>
  6771. #include <logdepthbuf_pars_vertex>
  6772. #include <clipping_planes_pars_vertex>
  6773. void main() {
  6774. #include <uv_vertex>
  6775. #include <color_vertex>
  6776. #include <morphcolor_vertex>
  6777. #include <batching_vertex>
  6778. #include <beginnormal_vertex>
  6779. #include <morphnormal_vertex>
  6780. #include <skinbase_vertex>
  6781. #include <skinnormal_vertex>
  6782. #include <defaultnormal_vertex>
  6783. #include <normal_vertex>
  6784. #include <begin_vertex>
  6785. #include <morphtarget_vertex>
  6786. #include <skinning_vertex>
  6787. #include <displacementmap_vertex>
  6788. #include <project_vertex>
  6789. #include <logdepthbuf_vertex>
  6790. #include <clipping_planes_vertex>
  6791. vViewPosition = - mvPosition.xyz;
  6792. #include <worldpos_vertex>
  6793. #include <envmap_vertex>
  6794. #include <shadowmap_vertex>
  6795. #include <fog_vertex>
  6796. }`,Sae=`#define PHONG
  6797. uniform vec3 diffuse;
  6798. uniform vec3 emissive;
  6799. uniform vec3 specular;
  6800. uniform float shininess;
  6801. uniform float opacity;
  6802. #include <common>
  6803. #include <packing>
  6804. #include <dithering_pars_fragment>
  6805. #include <color_pars_fragment>
  6806. #include <uv_pars_fragment>
  6807. #include <map_pars_fragment>
  6808. #include <alphamap_pars_fragment>
  6809. #include <alphatest_pars_fragment>
  6810. #include <alphahash_pars_fragment>
  6811. #include <aomap_pars_fragment>
  6812. #include <lightmap_pars_fragment>
  6813. #include <emissivemap_pars_fragment>
  6814. #include <envmap_common_pars_fragment>
  6815. #include <envmap_pars_fragment>
  6816. #include <fog_pars_fragment>
  6817. #include <bsdfs>
  6818. #include <lights_pars_begin>
  6819. #include <normal_pars_fragment>
  6820. #include <lights_phong_pars_fragment>
  6821. #include <shadowmap_pars_fragment>
  6822. #include <bumpmap_pars_fragment>
  6823. #include <normalmap_pars_fragment>
  6824. #include <specularmap_pars_fragment>
  6825. #include <logdepthbuf_pars_fragment>
  6826. #include <clipping_planes_pars_fragment>
  6827. void main() {
  6828. #include <clipping_planes_fragment>
  6829. vec4 diffuseColor = vec4( diffuse, opacity );
  6830. ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
  6831. vec3 totalEmissiveRadiance = emissive;
  6832. #include <logdepthbuf_fragment>
  6833. #include <map_fragment>
  6834. #include <color_fragment>
  6835. #include <alphamap_fragment>
  6836. #include <alphatest_fragment>
  6837. #include <alphahash_fragment>
  6838. #include <specularmap_fragment>
  6839. #include <normal_fragment_begin>
  6840. #include <normal_fragment_maps>
  6841. #include <emissivemap_fragment>
  6842. #include <lights_phong_fragment>
  6843. #include <lights_fragment_begin>
  6844. #include <lights_fragment_maps>
  6845. #include <lights_fragment_end>
  6846. #include <aomap_fragment>
  6847. vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;
  6848. #include <envmap_fragment>
  6849. #include <opaque_fragment>
  6850. #include <tonemapping_fragment>
  6851. #include <colorspace_fragment>
  6852. #include <fog_fragment>
  6853. #include <premultiplied_alpha_fragment>
  6854. #include <dithering_fragment>
  6855. }`,wae=`#define STANDARD
  6856. varying vec3 vViewPosition;
  6857. #ifdef USE_TRANSMISSION
  6858. varying vec3 vWorldPosition;
  6859. #endif
  6860. #include <common>
  6861. #include <batching_pars_vertex>
  6862. #include <uv_pars_vertex>
  6863. #include <displacementmap_pars_vertex>
  6864. #include <color_pars_vertex>
  6865. #include <fog_pars_vertex>
  6866. #include <normal_pars_vertex>
  6867. #include <morphtarget_pars_vertex>
  6868. #include <skinning_pars_vertex>
  6869. #include <shadowmap_pars_vertex>
  6870. #include <logdepthbuf_pars_vertex>
  6871. #include <clipping_planes_pars_vertex>
  6872. void main() {
  6873. #include <uv_vertex>
  6874. #include <color_vertex>
  6875. #include <morphcolor_vertex>
  6876. #include <batching_vertex>
  6877. #include <beginnormal_vertex>
  6878. #include <morphnormal_vertex>
  6879. #include <skinbase_vertex>
  6880. #include <skinnormal_vertex>
  6881. #include <defaultnormal_vertex>
  6882. #include <normal_vertex>
  6883. #include <begin_vertex>
  6884. #include <morphtarget_vertex>
  6885. #include <skinning_vertex>
  6886. #include <displacementmap_vertex>
  6887. #include <project_vertex>
  6888. #include <logdepthbuf_vertex>
  6889. #include <clipping_planes_vertex>
  6890. vViewPosition = - mvPosition.xyz;
  6891. #include <worldpos_vertex>
  6892. #include <shadowmap_vertex>
  6893. #include <fog_vertex>
  6894. #ifdef USE_TRANSMISSION
  6895. vWorldPosition = worldPosition.xyz;
  6896. #endif
  6897. }`,Eae=`#define STANDARD
  6898. #ifdef PHYSICAL
  6899. #define IOR
  6900. #define USE_SPECULAR
  6901. #endif
  6902. uniform vec3 diffuse;
  6903. uniform vec3 emissive;
  6904. uniform float roughness;
  6905. uniform float metalness;
  6906. uniform float opacity;
  6907. #ifdef IOR
  6908. uniform float ior;
  6909. #endif
  6910. #ifdef USE_SPECULAR
  6911. uniform float specularIntensity;
  6912. uniform vec3 specularColor;
  6913. #ifdef USE_SPECULAR_COLORMAP
  6914. uniform sampler2D specularColorMap;
  6915. #endif
  6916. #ifdef USE_SPECULAR_INTENSITYMAP
  6917. uniform sampler2D specularIntensityMap;
  6918. #endif
  6919. #endif
  6920. #ifdef USE_CLEARCOAT
  6921. uniform float clearcoat;
  6922. uniform float clearcoatRoughness;
  6923. #endif
  6924. #ifdef USE_IRIDESCENCE
  6925. uniform float iridescence;
  6926. uniform float iridescenceIOR;
  6927. uniform float iridescenceThicknessMinimum;
  6928. uniform float iridescenceThicknessMaximum;
  6929. #endif
  6930. #ifdef USE_SHEEN
  6931. uniform vec3 sheenColor;
  6932. uniform float sheenRoughness;
  6933. #ifdef USE_SHEEN_COLORMAP
  6934. uniform sampler2D sheenColorMap;
  6935. #endif
  6936. #ifdef USE_SHEEN_ROUGHNESSMAP
  6937. uniform sampler2D sheenRoughnessMap;
  6938. #endif
  6939. #endif
  6940. #ifdef USE_ANISOTROPY
  6941. uniform vec2 anisotropyVector;
  6942. #ifdef USE_ANISOTROPYMAP
  6943. uniform sampler2D anisotropyMap;
  6944. #endif
  6945. #endif
  6946. varying vec3 vViewPosition;
  6947. #include <common>
  6948. #include <packing>
  6949. #include <dithering_pars_fragment>
  6950. #include <color_pars_fragment>
  6951. #include <uv_pars_fragment>
  6952. #include <map_pars_fragment>
  6953. #include <alphamap_pars_fragment>
  6954. #include <alphatest_pars_fragment>
  6955. #include <alphahash_pars_fragment>
  6956. #include <aomap_pars_fragment>
  6957. #include <lightmap_pars_fragment>
  6958. #include <emissivemap_pars_fragment>
  6959. #include <iridescence_fragment>
  6960. #include <cube_uv_reflection_fragment>
  6961. #include <envmap_common_pars_fragment>
  6962. #include <envmap_physical_pars_fragment>
  6963. #include <fog_pars_fragment>
  6964. #include <lights_pars_begin>
  6965. #include <normal_pars_fragment>
  6966. #include <lights_physical_pars_fragment>
  6967. #include <transmission_pars_fragment>
  6968. #include <shadowmap_pars_fragment>
  6969. #include <bumpmap_pars_fragment>
  6970. #include <normalmap_pars_fragment>
  6971. #include <clearcoat_pars_fragment>
  6972. #include <iridescence_pars_fragment>
  6973. #include <roughnessmap_pars_fragment>
  6974. #include <metalnessmap_pars_fragment>
  6975. #include <logdepthbuf_pars_fragment>
  6976. #include <clipping_planes_pars_fragment>
  6977. void main() {
  6978. #include <clipping_planes_fragment>
  6979. vec4 diffuseColor = vec4( diffuse, opacity );
  6980. ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
  6981. vec3 totalEmissiveRadiance = emissive;
  6982. #include <logdepthbuf_fragment>
  6983. #include <map_fragment>
  6984. #include <color_fragment>
  6985. #include <alphamap_fragment>
  6986. #include <alphatest_fragment>
  6987. #include <alphahash_fragment>
  6988. #include <roughnessmap_fragment>
  6989. #include <metalnessmap_fragment>
  6990. #include <normal_fragment_begin>
  6991. #include <normal_fragment_maps>
  6992. #include <clearcoat_normal_fragment_begin>
  6993. #include <clearcoat_normal_fragment_maps>
  6994. #include <emissivemap_fragment>
  6995. #include <lights_physical_fragment>
  6996. #include <lights_fragment_begin>
  6997. #include <lights_fragment_maps>
  6998. #include <lights_fragment_end>
  6999. #include <aomap_fragment>
  7000. vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;
  7001. vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;
  7002. #include <transmission_fragment>
  7003. vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;
  7004. #ifdef USE_SHEEN
  7005. float sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );
  7006. outgoingLight = outgoingLight * sheenEnergyComp + sheenSpecularDirect + sheenSpecularIndirect;
  7007. #endif
  7008. #ifdef USE_CLEARCOAT
  7009. float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );
  7010. vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );
  7011. outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat;
  7012. #endif
  7013. #include <opaque_fragment>
  7014. #include <tonemapping_fragment>
  7015. #include <colorspace_fragment>
  7016. #include <fog_fragment>
  7017. #include <premultiplied_alpha_fragment>
  7018. #include <dithering_fragment>
  7019. }`,Mae=`#define TOON
  7020. varying vec3 vViewPosition;
  7021. #include <common>
  7022. #include <batching_pars_vertex>
  7023. #include <uv_pars_vertex>
  7024. #include <displacementmap_pars_vertex>
  7025. #include <color_pars_vertex>
  7026. #include <fog_pars_vertex>
  7027. #include <normal_pars_vertex>
  7028. #include <morphtarget_pars_vertex>
  7029. #include <skinning_pars_vertex>
  7030. #include <shadowmap_pars_vertex>
  7031. #include <logdepthbuf_pars_vertex>
  7032. #include <clipping_planes_pars_vertex>
  7033. void main() {
  7034. #include <uv_vertex>
  7035. #include <color_vertex>
  7036. #include <morphcolor_vertex>
  7037. #include <batching_vertex>
  7038. #include <beginnormal_vertex>
  7039. #include <morphnormal_vertex>
  7040. #include <skinbase_vertex>
  7041. #include <skinnormal_vertex>
  7042. #include <defaultnormal_vertex>
  7043. #include <normal_vertex>
  7044. #include <begin_vertex>
  7045. #include <morphtarget_vertex>
  7046. #include <skinning_vertex>
  7047. #include <displacementmap_vertex>
  7048. #include <project_vertex>
  7049. #include <logdepthbuf_vertex>
  7050. #include <clipping_planes_vertex>
  7051. vViewPosition = - mvPosition.xyz;
  7052. #include <worldpos_vertex>
  7053. #include <shadowmap_vertex>
  7054. #include <fog_vertex>
  7055. }`,Aae=`#define TOON
  7056. uniform vec3 diffuse;
  7057. uniform vec3 emissive;
  7058. uniform float opacity;
  7059. #include <common>
  7060. #include <packing>
  7061. #include <dithering_pars_fragment>
  7062. #include <color_pars_fragment>
  7063. #include <uv_pars_fragment>
  7064. #include <map_pars_fragment>
  7065. #include <alphamap_pars_fragment>
  7066. #include <alphatest_pars_fragment>
  7067. #include <alphahash_pars_fragment>
  7068. #include <aomap_pars_fragment>
  7069. #include <lightmap_pars_fragment>
  7070. #include <emissivemap_pars_fragment>
  7071. #include <gradientmap_pars_fragment>
  7072. #include <fog_pars_fragment>
  7073. #include <bsdfs>
  7074. #include <lights_pars_begin>
  7075. #include <normal_pars_fragment>
  7076. #include <lights_toon_pars_fragment>
  7077. #include <shadowmap_pars_fragment>
  7078. #include <bumpmap_pars_fragment>
  7079. #include <normalmap_pars_fragment>
  7080. #include <logdepthbuf_pars_fragment>
  7081. #include <clipping_planes_pars_fragment>
  7082. void main() {
  7083. #include <clipping_planes_fragment>
  7084. vec4 diffuseColor = vec4( diffuse, opacity );
  7085. ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
  7086. vec3 totalEmissiveRadiance = emissive;
  7087. #include <logdepthbuf_fragment>
  7088. #include <map_fragment>
  7089. #include <color_fragment>
  7090. #include <alphamap_fragment>
  7091. #include <alphatest_fragment>
  7092. #include <alphahash_fragment>
  7093. #include <normal_fragment_begin>
  7094. #include <normal_fragment_maps>
  7095. #include <emissivemap_fragment>
  7096. #include <lights_toon_fragment>
  7097. #include <lights_fragment_begin>
  7098. #include <lights_fragment_maps>
  7099. #include <lights_fragment_end>
  7100. #include <aomap_fragment>
  7101. vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
  7102. #include <opaque_fragment>
  7103. #include <tonemapping_fragment>
  7104. #include <colorspace_fragment>
  7105. #include <fog_fragment>
  7106. #include <premultiplied_alpha_fragment>
  7107. #include <dithering_fragment>
  7108. }`,Tae=`uniform float size;
  7109. uniform float scale;
  7110. #include <common>
  7111. #include <color_pars_vertex>
  7112. #include <fog_pars_vertex>
  7113. #include <morphtarget_pars_vertex>
  7114. #include <logdepthbuf_pars_vertex>
  7115. #include <clipping_planes_pars_vertex>
  7116. #ifdef USE_POINTS_UV
  7117. varying vec2 vUv;
  7118. uniform mat3 uvTransform;
  7119. #endif
  7120. void main() {
  7121. #ifdef USE_POINTS_UV
  7122. vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
  7123. #endif
  7124. #include <color_vertex>
  7125. #include <morphcolor_vertex>
  7126. #include <begin_vertex>
  7127. #include <morphtarget_vertex>
  7128. #include <project_vertex>
  7129. gl_PointSize = size;
  7130. #ifdef USE_SIZEATTENUATION
  7131. bool isPerspective = isPerspectiveMatrix( projectionMatrix );
  7132. if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );
  7133. #endif
  7134. #include <logdepthbuf_vertex>
  7135. #include <clipping_planes_vertex>
  7136. #include <worldpos_vertex>
  7137. #include <fog_vertex>
  7138. }`,Cae=`uniform vec3 diffuse;
  7139. uniform float opacity;
  7140. #include <common>
  7141. #include <color_pars_fragment>
  7142. #include <map_particle_pars_fragment>
  7143. #include <alphatest_pars_fragment>
  7144. #include <alphahash_pars_fragment>
  7145. #include <fog_pars_fragment>
  7146. #include <logdepthbuf_pars_fragment>
  7147. #include <clipping_planes_pars_fragment>
  7148. void main() {
  7149. #include <clipping_planes_fragment>
  7150. vec3 outgoingLight = vec3( 0.0 );
  7151. vec4 diffuseColor = vec4( diffuse, opacity );
  7152. #include <logdepthbuf_fragment>
  7153. #include <map_particle_fragment>
  7154. #include <color_fragment>
  7155. #include <alphatest_fragment>
  7156. #include <alphahash_fragment>
  7157. outgoingLight = diffuseColor.rgb;
  7158. #include <opaque_fragment>
  7159. #include <tonemapping_fragment>
  7160. #include <colorspace_fragment>
  7161. #include <fog_fragment>
  7162. #include <premultiplied_alpha_fragment>
  7163. }`,Rae=`#include <common>
  7164. #include <batching_pars_vertex>
  7165. #include <fog_pars_vertex>
  7166. #include <morphtarget_pars_vertex>
  7167. #include <skinning_pars_vertex>
  7168. #include <logdepthbuf_pars_vertex>
  7169. #include <shadowmap_pars_vertex>
  7170. void main() {
  7171. #include <batching_vertex>
  7172. #include <beginnormal_vertex>
  7173. #include <morphnormal_vertex>
  7174. #include <skinbase_vertex>
  7175. #include <skinnormal_vertex>
  7176. #include <defaultnormal_vertex>
  7177. #include <begin_vertex>
  7178. #include <morphtarget_vertex>
  7179. #include <skinning_vertex>
  7180. #include <project_vertex>
  7181. #include <logdepthbuf_vertex>
  7182. #include <worldpos_vertex>
  7183. #include <shadowmap_vertex>
  7184. #include <fog_vertex>
  7185. }`,Pae=`uniform vec3 color;
  7186. uniform float opacity;
  7187. #include <common>
  7188. #include <packing>
  7189. #include <fog_pars_fragment>
  7190. #include <bsdfs>
  7191. #include <lights_pars_begin>
  7192. #include <logdepthbuf_pars_fragment>
  7193. #include <shadowmap_pars_fragment>
  7194. #include <shadowmask_pars_fragment>
  7195. void main() {
  7196. #include <logdepthbuf_fragment>
  7197. gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );
  7198. #include <tonemapping_fragment>
  7199. #include <colorspace_fragment>
  7200. #include <fog_fragment>
  7201. }`,Dae=`uniform float rotation;
  7202. uniform vec2 center;
  7203. #include <common>
  7204. #include <uv_pars_vertex>
  7205. #include <fog_pars_vertex>
  7206. #include <logdepthbuf_pars_vertex>
  7207. #include <clipping_planes_pars_vertex>
  7208. void main() {
  7209. #include <uv_vertex>
  7210. vec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );
  7211. vec2 scale;
  7212. scale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );
  7213. scale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );
  7214. #ifndef USE_SIZEATTENUATION
  7215. bool isPerspective = isPerspectiveMatrix( projectionMatrix );
  7216. if ( isPerspective ) scale *= - mvPosition.z;
  7217. #endif
  7218. vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;
  7219. vec2 rotatedPosition;
  7220. rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;
  7221. rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;
  7222. mvPosition.xy += rotatedPosition;
  7223. gl_Position = projectionMatrix * mvPosition;
  7224. #include <logdepthbuf_vertex>
  7225. #include <clipping_planes_vertex>
  7226. #include <fog_vertex>
  7227. }`,Nae=`uniform vec3 diffuse;
  7228. uniform float opacity;
  7229. #include <common>
  7230. #include <uv_pars_fragment>
  7231. #include <map_pars_fragment>
  7232. #include <alphamap_pars_fragment>
  7233. #include <alphatest_pars_fragment>
  7234. #include <alphahash_pars_fragment>
  7235. #include <fog_pars_fragment>
  7236. #include <logdepthbuf_pars_fragment>
  7237. #include <clipping_planes_pars_fragment>
  7238. void main() {
  7239. #include <clipping_planes_fragment>
  7240. vec3 outgoingLight = vec3( 0.0 );
  7241. vec4 diffuseColor = vec4( diffuse, opacity );
  7242. #include <logdepthbuf_fragment>
  7243. #include <map_fragment>
  7244. #include <alphamap_fragment>
  7245. #include <alphatest_fragment>
  7246. #include <alphahash_fragment>
  7247. outgoingLight = diffuseColor.rgb;
  7248. #include <opaque_fragment>
  7249. #include <tonemapping_fragment>
  7250. #include <colorspace_fragment>
  7251. #include <fog_fragment>
  7252. }`,Vt={alphahash_fragment:eie,alphahash_pars_fragment:tie,alphamap_fragment:nie,alphamap_pars_fragment:iie,alphatest_fragment:rie,alphatest_pars_fragment:aie,aomap_fragment:sie,aomap_pars_fragment:oie,batching_pars_vertex:lie,batching_vertex:cie,begin_vertex:uie,beginnormal_vertex:die,bsdfs:fie,iridescence_fragment:hie,bumpmap_pars_fragment:pie,clipping_planes_fragment:mie,clipping_planes_pars_fragment:gie,clipping_planes_pars_vertex:vie,clipping_planes_vertex:xie,color_fragment:yie,color_pars_fragment:bie,color_pars_vertex:_ie,color_vertex:Sie,common:wie,cube_uv_reflection_fragment:Eie,defaultnormal_vertex:Mie,displacementmap_pars_vertex:Aie,displacementmap_vertex:Tie,emissivemap_fragment:Cie,emissivemap_pars_fragment:Rie,colorspace_fragment:Pie,colorspace_pars_fragment:Die,envmap_fragment:Nie,envmap_common_pars_fragment:Oie,envmap_pars_fragment:Lie,envmap_pars_vertex:Iie,envmap_physical_pars_fragment:Xie,envmap_vertex:Uie,fog_vertex:kie,fog_pars_vertex:Fie,fog_fragment:zie,fog_pars_fragment:Bie,gradientmap_pars_fragment:jie,lightmap_fragment:Hie,lightmap_pars_fragment:Gie,lights_lambert_fragment:Vie,lights_lambert_pars_fragment:$ie,lights_pars_begin:Wie,lights_toon_fragment:qie,lights_toon_pars_fragment:Yie,lights_phong_fragment:Kie,lights_phong_pars_fragment:Zie,lights_physical_fragment:Qie,lights_physical_pars_fragment:Jie,lights_fragment_begin:ere,lights_fragment_maps:tre,lights_fragment_end:nre,logdepthbuf_fragment:ire,logdepthbuf_pars_fragment:rre,logdepthbuf_pars_vertex:are,logdepthbuf_vertex:sre,map_fragment:ore,map_pars_fragment:lre,map_particle_fragment:cre,map_particle_pars_fragment:ure,metalnessmap_fragment:dre,metalnessmap_pars_fragment:fre,morphcolor_vertex:hre,morphnormal_vertex:pre,morphtarget_pars_vertex:mre,morphtarget_vertex:gre,normal_fragment_begin:vre,normal_fragment_maps:xre,normal_pars_fragment:yre,normal_pars_vertex:bre,normal_vertex:_re,normalmap_pars_fragment:Sre,clearcoat_normal_fragment_begin:wre,clearcoat_normal_fragment_maps:Ere,clearcoat_pars_fragment:Mre,iridescence_pars_fragment:Are,opaque_fragment:Tre,packing:Cre,premultiplied_alpha_fragment:Rre,project_vertex:Pre,dithering_fragment:Dre,dithering_pars_fragment:Nre,roughnessmap_fragment:Ore,roughnessmap_pars_fragment:Lre,shadowmap_pars_fragment:Ire,shadowmap_pars_vertex:Ure,shadowmap_vertex:kre,shadowmask_pars_fragment:Fre,skinbase_vertex:zre,skinning_pars_vertex:Bre,skinning_vertex:jre,skinnormal_vertex:Hre,specularmap_fragment:Gre,specularmap_pars_fragment:Vre,tonemapping_fragment:$re,tonemapping_pars_fragment:Wre,transmission_fragment:Xre,transmission_pars_fragment:qre,uv_pars_fragment:Yre,uv_pars_vertex:Kre,uv_vertex:Zre,worldpos_vertex:Qre,background_vert:Jre,background_frag:eae,backgroundCube_vert:tae,backgroundCube_frag:nae,cube_vert:iae,cube_frag:rae,depth_vert:aae,depth_frag:sae,distanceRGBA_vert:oae,distanceRGBA_frag:lae,equirect_vert:cae,equirect_frag:uae,linedashed_vert:dae,linedashed_frag:fae,meshbasic_vert:hae,meshbasic_frag:pae,meshlambert_vert:mae,meshlambert_frag:gae,meshmatcap_vert:vae,meshmatcap_frag:xae,meshnormal_vert:yae,meshnormal_frag:bae,meshphong_vert:_ae,meshphong_frag:Sae,meshphysical_vert:wae,meshphysical_frag:Eae,meshtoon_vert:Mae,meshtoon_frag:Aae,points_vert:Tae,points_frag:Cae,shadow_vert:Rae,shadow_frag:Pae,sprite_vert:Dae,sprite_frag:Nae},ht={common:{diffuse:{value:new Nt(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Yt},alphaMap:{value:null},alphaMapTransform:{value:new Yt},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Yt}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new Yt}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Yt}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Yt},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Yt},normalScale:{value:new Ut(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Yt},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new Yt}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new Yt}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new Yt}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Nt(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 Nt(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new Yt},alphaTest:{value:0},uvTransform:{value:new Yt}},sprite:{diffuse:{value:new Nt(16777215)},opacity:{value:1},center:{value:new Ut(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new Yt},alphaMap:{value:null},alphaMapTransform:{value:new Yt},alphaTest:{value:0}}},qr={basic:{uniforms:Dr([ht.common,ht.specularmap,ht.envmap,ht.aomap,ht.lightmap,ht.fog]),vertexShader:Vt.meshbasic_vert,fragmentShader:Vt.meshbasic_frag},lambert:{uniforms:Dr([ht.common,ht.specularmap,ht.envmap,ht.aomap,ht.lightmap,ht.emissivemap,ht.bumpmap,ht.normalmap,ht.displacementmap,ht.fog,ht.lights,{emissive:{value:new Nt(0)}}]),vertexShader:Vt.meshlambert_vert,fragmentShader:Vt.meshlambert_frag},phong:{uniforms:Dr([ht.common,ht.specularmap,ht.envmap,ht.aomap,ht.lightmap,ht.emissivemap,ht.bumpmap,ht.normalmap,ht.displacementmap,ht.fog,ht.lights,{emissive:{value:new Nt(0)},specular:{value:new Nt(1118481)},shininess:{value:30}}]),vertexShader:Vt.meshphong_vert,fragmentShader:Vt.meshphong_frag},standard:{uniforms:Dr([ht.common,ht.envmap,ht.aomap,ht.lightmap,ht.emissivemap,ht.bumpmap,ht.normalmap,ht.displacementmap,ht.roughnessmap,ht.metalnessmap,ht.fog,ht.lights,{emissive:{value:new Nt(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Vt.meshphysical_vert,fragmentShader:Vt.meshphysical_frag},toon:{uniforms:Dr([ht.common,ht.aomap,ht.lightmap,ht.emissivemap,ht.bumpmap,ht.normalmap,ht.displacementmap,ht.gradientmap,ht.fog,ht.lights,{emissive:{value:new Nt(0)}}]),vertexShader:Vt.meshtoon_vert,fragmentShader:Vt.meshtoon_frag},matcap:{uniforms:Dr([ht.common,ht.bumpmap,ht.normalmap,ht.displacementmap,ht.fog,{matcap:{value:null}}]),vertexShader:Vt.meshmatcap_vert,fragmentShader:Vt.meshmatcap_frag},points:{uniforms:Dr([ht.points,ht.fog]),vertexShader:Vt.points_vert,fragmentShader:Vt.points_frag},dashed:{uniforms:Dr([ht.common,ht.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Vt.linedashed_vert,fragmentShader:Vt.linedashed_frag},depth:{uniforms:Dr([ht.common,ht.displacementmap]),vertexShader:Vt.depth_vert,fragmentShader:Vt.depth_frag},normal:{uniforms:Dr([ht.common,ht.bumpmap,ht.normalmap,ht.displacementmap,{opacity:{value:1}}]),vertexShader:Vt.meshnormal_vert,fragmentShader:Vt.meshnormal_frag},sprite:{uniforms:Dr([ht.sprite,ht.fog]),vertexShader:Vt.sprite_vert,fragmentShader:Vt.sprite_frag},background:{uniforms:{uvTransform:{value:new Yt},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Vt.background_vert,fragmentShader:Vt.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1}},vertexShader:Vt.backgroundCube_vert,fragmentShader:Vt.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Vt.cube_vert,fragmentShader:Vt.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Vt.equirect_vert,fragmentShader:Vt.equirect_frag},distanceRGBA:{uniforms:Dr([ht.common,ht.displacementmap,{referencePosition:{value:new Ce},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Vt.distanceRGBA_vert,fragmentShader:Vt.distanceRGBA_frag},shadow:{uniforms:Dr([ht.lights,ht.fog,{color:{value:new Nt(0)},opacity:{value:1}}]),vertexShader:Vt.shadow_vert,fragmentShader:Vt.shadow_frag}};qr.physical={uniforms:Dr([qr.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new Yt},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new Yt},clearcoatNormalScale:{value:new Ut(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new Yt},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new Yt},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new Yt},sheen:{value:0},sheenColor:{value:new Nt(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new Yt},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new Yt},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new Yt},transmissionSamplerSize:{value:new Ut},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Yt},attenuationDistance:{value:0},attenuationColor:{value:new Nt(0)},specularColor:{value:new Nt(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new Yt},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new Yt},anisotropyVector:{value:new Ut},anisotropyMap:{value:null},anisotropyMapTransform:{value:new Yt}}]),vertexShader:Vt.meshphysical_vert,fragmentShader:Vt.meshphysical_frag};const J0={r:0,b:0,g:0};function Oae(t,e,n,i,r,a,s){const l=new Nt(0);let c=a===!0?0:1,d,f,h=null,g=0,m=null;function b(x,v){let w=!1,S=v.isScene===!0?v.background:null;S&&S.isTexture&&(S=(v.backgroundBlurriness>0?n:e).get(S)),S===null?y(l,c):S&&S.isColor&&(y(S,1),w=!0);const A=t.xr.getEnvironmentBlendMode();A==="additive"?i.buffers.color.setClear(0,0,0,1,s):A==="alpha-blend"&&i.buffers.color.setClear(0,0,0,0,s),(t.autoClear||w)&&t.clear(t.autoClearColor,t.autoClearDepth,t.autoClearStencil),S&&(S.isCubeTexture||S.mapping===vy)?(f===void 0&&(f=new gs(new bm(1,1,1),new uc({name:"BackgroundCubeMaterial",uniforms:Mf(qr.backgroundCube.uniforms),vertexShader:qr.backgroundCube.vertexShader,fragmentShader:qr.backgroundCube.fragmentShader,side:Zr,depthTest:!1,depthWrite:!1,fog:!1})),f.geometry.deleteAttribute("normal"),f.geometry.deleteAttribute("uv"),f.onBeforeRender=function(R,N,C){this.matrixWorld.copyPosition(C.matrixWorld)},Object.defineProperty(f.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),r.update(f)),f.material.uniforms.envMap.value=S,f.material.uniforms.flipEnvMap.value=S.isCubeTexture&&S.isRenderTargetTexture===!1?-1:1,f.material.uniforms.backgroundBlurriness.value=v.backgroundBlurriness,f.material.uniforms.backgroundIntensity.value=v.backgroundIntensity,f.material.toneMapped=An.getTransfer(S.colorSpace)!==Fn,(h!==S||g!==S.version||m!==t.toneMapping)&&(f.material.needsUpdate=!0,h=S,g=S.version,m=t.toneMapping),f.layers.enableAll(),x.unshift(f,f.geometry,f.material,0,0,null)):S&&S.isTexture&&(d===void 0&&(d=new gs(new zT(2,2),new uc({name:"BackgroundMaterial",uniforms:Mf(qr.background.uniforms),vertexShader:qr.background.vertexShader,fragmentShader:qr.background.fragmentShader,side:cc,depthTest:!1,depthWrite:!1,fog:!1})),d.geometry.deleteAttribute("normal"),Object.defineProperty(d.material,"map",{get:function(){return this.uniforms.t2D.value}}),r.update(d)),d.material.uniforms.t2D.value=S,d.material.uniforms.backgroundIntensity.value=v.backgroundIntensity,d.material.toneMapped=An.getTransfer(S.colorSpace)!==Fn,S.matrixAutoUpdate===!0&&S.updateMatrix(),d.material.uniforms.uvTransform.value.copy(S.matrix),(h!==S||g!==S.version||m!==t.toneMapping)&&(d.material.needsUpdate=!0,h=S,g=S.version,m=t.toneMapping),d.layers.enableAll(),x.unshift(d,d.geometry,d.material,0,0,null))}function y(x,v){x.getRGB(J0,WB(t)),i.buffers.color.setClear(J0.r,J0.g,J0.b,v,s)}return{getClearColor:function(){return l},setClearColor:function(x,v=1){l.set(x),c=v,y(l,c)},getClearAlpha:function(){return c},setClearAlpha:function(x){c=x,y(l,c)},render:b}}function Lae(t,e,n,i){const r=t.getParameter(t.MAX_VERTEX_ATTRIBS),a=i.isWebGL2?null:e.get("OES_vertex_array_object"),s=i.isWebGL2||a!==null,l={},c=x(null);let d=c,f=!1;function h(I,W,X,V,Y){let J=!1;if(s){const se=y(V,X,W);d!==se&&(d=se,m(d.object)),J=v(I,V,X,Y),J&&w(I,V,X,Y)}else{const se=W.wireframe===!0;(d.geometry!==V.id||d.program!==X.id||d.wireframe!==se)&&(d.geometry=V.id,d.program=X.id,d.wireframe=se,J=!0)}Y!==null&&n.update(Y,t.ELEMENT_ARRAY_BUFFER),(J||f)&&(f=!1,F(I,W,X,V),Y!==null&&t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,n.get(Y).buffer))}function g(){return i.isWebGL2?t.createVertexArray():a.createVertexArrayOES()}function m(I){return i.isWebGL2?t.bindVertexArray(I):a.bindVertexArrayOES(I)}function b(I){return i.isWebGL2?t.deleteVertexArray(I):a.deleteVertexArrayOES(I)}function y(I,W,X){const V=X.wireframe===!0;let Y=l[I.id];Y===void 0&&(Y={},l[I.id]=Y);let J=Y[W.id];J===void 0&&(J={},Y[W.id]=J);let se=J[V];return se===void 0&&(se=x(g()),J[V]=se),se}function x(I){const W=[],X=[],V=[];for(let Y=0;Y<r;Y++)W[Y]=0,X[Y]=0,V[Y]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:W,enabledAttributes:X,attributeDivisors:V,object:I,attributes:{},index:null}}function v(I,W,X,V){const Y=d.attributes,J=W.attributes;let se=0;const H=X.getAttributes();for(const q in H)if(H[q].location>=0){const ce=Y[q];let ye=J[q];if(ye===void 0&&(q==="instanceMatrix"&&I.instanceMatrix&&(ye=I.instanceMatrix),q==="instanceColor"&&I.instanceColor&&(ye=I.instanceColor)),ce===void 0||ce.attribute!==ye||ye&&ce.data!==ye.data)return!0;se++}return d.attributesNum!==se||d.index!==V}function w(I,W,X,V){const Y={},J=W.attributes;let se=0;const H=X.getAttributes();for(const q in H)if(H[q].location>=0){let ce=J[q];ce===void 0&&(q==="instanceMatrix"&&I.instanceMatrix&&(ce=I.instanceMatrix),q==="instanceColor"&&I.instanceColor&&(ce=I.instanceColor));const ye={};ye.attribute=ce,ce&&ce.data&&(ye.data=ce.data),Y[q]=ye,se++}d.attributes=Y,d.attributesNum=se,d.index=V}function S(){const I=d.newAttributes;for(let W=0,X=I.length;W<X;W++)I[W]=0}function A(I){R(I,0)}function R(I,W){const X=d.newAttributes,V=d.enabledAttributes,Y=d.attributeDivisors;X[I]=1,V[I]===0&&(t.enableVertexAttribArray(I),V[I]=1),Y[I]!==W&&((i.isWebGL2?t:e.get("ANGLE_instanced_arrays"))[i.isWebGL2?"vertexAttribDivisor":"vertexAttribDivisorANGLE"](I,W),Y[I]=W)}function N(){const I=d.newAttributes,W=d.enabledAttributes;for(let X=0,V=W.length;X<V;X++)W[X]!==I[X]&&(t.disableVertexAttribArray(X),W[X]=0)}function C(I,W,X,V,Y,J,se){se===!0?t.vertexAttribIPointer(I,W,X,Y,J):t.vertexAttribPointer(I,W,X,V,Y,J)}function F(I,W,X,V){if(i.isWebGL2===!1&&(I.isInstancedMesh||V.isInstancedBufferGeometry)&&e.get("ANGLE_instanced_arrays")===null)return;S();const Y=V.attributes,J=X.getAttributes(),se=W.defaultAttributeValues;for(const H in J){const q=J[H];if(q.location>=0){let re=Y[H];if(re===void 0&&(H==="instanceMatrix"&&I.instanceMatrix&&(re=I.instanceMatrix),H==="instanceColor"&&I.instanceColor&&(re=I.instanceColor)),re!==void 0){const ce=re.normalized,ye=re.itemSize,me=n.get(re);if(me===void 0)continue;const be=me.buffer,Ne=me.type,he=me.bytesPerElement,Ae=i.isWebGL2===!0&&(Ne===t.INT||Ne===t.UNSIGNED_INT||re.gpuType===AB);if(re.isInterleavedBufferAttribute){const Be=re.data,le=Be.stride,lt=re.offset;if(Be.isInstancedInterleavedBuffer){for(let z=0;z<q.locationSize;z++)R(q.location+z,Be.meshPerAttribute);I.isInstancedMesh!==!0&&V._maxInstanceCount===void 0&&(V._maxInstanceCount=Be.meshPerAttribute*Be.count)}else for(let z=0;z<q.locationSize;z++)A(q.location+z);t.bindBuffer(t.ARRAY_BUFFER,be);for(let z=0;z<q.locationSize;z++)C(q.location+z,ye/q.locationSize,Ne,ce,le*he,(lt+ye/q.locationSize*z)*he,Ae)}else{if(re.isInstancedBufferAttribute){for(let Be=0;Be<q.locationSize;Be++)R(q.location+Be,re.meshPerAttribute);I.isInstancedMesh!==!0&&V._maxInstanceCount===void 0&&(V._maxInstanceCount=re.meshPerAttribute*re.count)}else for(let Be=0;Be<q.locationSize;Be++)A(q.location+Be);t.bindBuffer(t.ARRAY_BUFFER,be);for(let Be=0;Be<q.locationSize;Be++)C(q.location+Be,ye/q.locationSize,Ne,ce,ye*he,ye/q.locationSize*Be*he,Ae)}}else if(se!==void 0){const ce=se[H];if(ce!==void 0)switch(ce.length){case 2:t.vertexAttrib2fv(q.location,ce);break;case 3:t.vertexAttrib3fv(q.location,ce);break;case 4:t.vertexAttrib4fv(q.location,ce);break;default:t.vertexAttrib1fv(q.location,ce)}}}}N()}function P(){U();for(const I in l){const W=l[I];for(const X in W){const V=W[X];for(const Y in V)b(V[Y].object),delete V[Y];delete W[X]}delete l[I]}}function L(I){if(l[I.id]===void 0)return;const W=l[I.id];for(const X in W){const V=W[X];for(const Y in V)b(V[Y].object),delete V[Y];delete W[X]}delete l[I.id]}function B(I){for(const W in l){const X=l[W];if(X[I.id]===void 0)continue;const V=X[I.id];for(const Y in V)b(V[Y].object),delete V[Y];delete X[I.id]}}function U(){$(),f=!0,d!==c&&(d=c,m(d.object))}function $(){c.geometry=null,c.program=null,c.wireframe=!1}return{setup:h,reset:U,resetDefaultState:$,dispose:P,releaseStatesOfGeometry:L,releaseStatesOfProgram:B,initAttributes:S,enableAttribute:A,disableUnusedAttributes:N}}function Iae(t,e,n,i){const r=i.isWebGL2;let a;function s(f){a=f}function l(f,h){t.drawArrays(a,f,h),n.update(h,a,1)}function c(f,h,g){if(g===0)return;let m,b;if(r)m=t,b="drawArraysInstanced";else if(m=e.get("ANGLE_instanced_arrays"),b="drawArraysInstancedANGLE",m===null){console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");return}m[b](a,f,h,g),n.update(h,a,g)}function d(f,h,g){if(g===0)return;const m=e.get("WEBGL_multi_draw");if(m===null)for(let b=0;b<g;b++)this.render(f[b],h[b]);else{m.multiDrawArraysWEBGL(a,f,0,h,0,g);let b=0;for(let y=0;y<g;y++)b+=h[y];n.update(b,a,1)}}this.setMode=s,this.render=l,this.renderInstances=c,this.renderMultiDraw=d}function Uae(t,e,n){let i;function r(){if(i!==void 0)return i;if(e.has("EXT_texture_filter_anisotropic")===!0){const C=e.get("EXT_texture_filter_anisotropic");i=t.getParameter(C.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else i=0;return i}function a(C){if(C==="highp"){if(t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.HIGH_FLOAT).precision>0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.HIGH_FLOAT).precision>0)return"highp";C="mediump"}return C==="mediump"&&t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.MEDIUM_FLOAT).precision>0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}const s=typeof WebGL2RenderingContext<"u"&&t.constructor.name==="WebGL2RenderingContext";let l=n.precision!==void 0?n.precision:"highp";const c=a(l);c!==l&&(console.warn("THREE.WebGLRenderer:",l,"not supported, using",c,"instead."),l=c);const d=s||e.has("WEBGL_draw_buffers"),f=n.logarithmicDepthBuffer===!0,h=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),g=t.getParameter(t.MAX_VERTEX_TEXTURE_IMAGE_UNITS),m=t.getParameter(t.MAX_TEXTURE_SIZE),b=t.getParameter(t.MAX_CUBE_MAP_TEXTURE_SIZE),y=t.getParameter(t.MAX_VERTEX_ATTRIBS),x=t.getParameter(t.MAX_VERTEX_UNIFORM_VECTORS),v=t.getParameter(t.MAX_VARYING_VECTORS),w=t.getParameter(t.MAX_FRAGMENT_UNIFORM_VECTORS),S=g>0,A=s||e.has("OES_texture_float"),R=S&&A,N=s?t.getParameter(t.MAX_SAMPLES):0;return{isWebGL2:s,drawBuffers:d,getMaxAnisotropy:r,getMaxPrecision:a,precision:l,logarithmicDepthBuffer:f,maxTextures:h,maxVertexTextures:g,maxTextureSize:m,maxCubemapSize:b,maxAttributes:y,maxVertexUniforms:x,maxVaryings:v,maxFragmentUniforms:w,vertexTextures:S,floatFragmentTextures:A,floatVertexTextures:R,maxSamples:N}}function kae(t){const e=this;let n=null,i=0,r=!1,a=!1;const s=new $l,l=new Yt,c={value:null,needsUpdate:!1};this.uniform=c,this.numPlanes=0,this.numIntersection=0,this.init=function(h,g){const m=h.length!==0||g||i!==0||r;return r=g,i=h.length,m},this.beginShadows=function(){a=!0,f(null)},this.endShadows=function(){a=!1},this.setGlobalState=function(h,g){n=f(h,g,0)},this.setState=function(h,g,m){const b=h.clippingPlanes,y=h.clipIntersection,x=h.clipShadows,v=t.get(h);if(!r||b===null||b.length===0||a&&!x)a?f(null):d();else{const w=a?0:i,S=w*4;let A=v.clippingState||null;c.value=A,A=f(b,g,S,m);for(let R=0;R!==S;++R)A[R]=n[R];v.clippingState=A,this.numIntersection=y?this.numPlanes:0,this.numPlanes+=w}};function d(){c.value!==n&&(c.value=n,c.needsUpdate=i>0),e.numPlanes=i,e.numIntersection=0}function f(h,g,m,b){const y=h!==null?h.length:0;let x=null;if(y!==0){if(x=c.value,b!==!0||x===null){const v=m+y*4,w=g.matrixWorldInverse;l.getNormalMatrix(w),(x===null||x.length<v)&&(x=new Float32Array(v));for(let S=0,A=m;S!==y;++S,A+=4)s.copy(h[S]).applyMatrix4(w,l),s.normal.toArray(x,A),x[A+3]=s.constant}c.value=x,c.needsUpdate=!0}return e.numPlanes=y,e.numIntersection=0,x}}function Fae(t){let e=new WeakMap;function n(s,l){return l===kM?s.mapping=Sf:l===FM&&(s.mapping=wf),s}function i(s){if(s&&s.isTexture){const l=s.mapping;if(l===kM||l===FM)if(e.has(s)){const c=e.get(s).texture;return n(c,s.mapping)}else{const c=s.image;if(c&&c.height>0){const d=new Kne(c.height/2);return d.fromEquirectangularTexture(t,s),e.set(s,d),s.addEventListener("dispose",r),n(d.texture,s.mapping)}else return null}}return s}function r(s){const l=s.target;l.removeEventListener("dispose",r);const c=e.get(l);c!==void 0&&(e.delete(l),c.dispose())}function a(){e=new WeakMap}return{get:i,dispose:a}}class zae extends XB{constructor(e=-1,n=1,i=1,r=-1,a=.1,s=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=n,this.top=i,this.bottom=r,this.near=a,this.far=s,this.updateProjectionMatrix()}copy(e,n){return super.copy(e,n),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,n,i,r,a,s){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=n,this.view.offsetX=i,this.view.offsetY=r,this.view.width=a,this.view.height=s,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=(this.right-this.left)/(2*this.zoom),n=(this.top-this.bottom)/(2*this.zoom),i=(this.right+this.left)/2,r=(this.top+this.bottom)/2;let a=i-e,s=i+e,l=r+n,c=r-n;if(this.view!==null&&this.view.enabled){const d=(this.right-this.left)/this.view.fullWidth/this.zoom,f=(this.top-this.bottom)/this.view.fullHeight/this.zoom;a+=d*this.view.offsetX,s=a+d*this.view.width,l-=f*this.view.offsetY,c=l-f*this.view.height}this.projectionMatrix.makeOrthographic(a,s,l,c,this.near,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const n=super.toJSON(e);return n.object.zoom=this.zoom,n.object.left=this.left,n.object.right=this.right,n.object.top=this.top,n.object.bottom=this.bottom,n.object.near=this.near,n.object.far=this.far,this.view!==null&&(n.object.view=Object.assign({},this.view)),n}}const tf=4,bL=[.125,.215,.35,.446,.526,.582],eu=20,D1=new zae,_L=new Nt;let N1=null,O1=0,L1=0;const Xc=(1+Math.sqrt(5))/2,Xd=1/Xc,SL=[new Ce(1,1,1),new Ce(-1,1,1),new Ce(1,1,-1),new Ce(-1,1,-1),new Ce(0,Xc,Xd),new Ce(0,Xc,-Xd),new Ce(Xd,0,Xc),new Ce(-Xd,0,Xc),new Ce(Xc,Xd,0),new Ce(-Xc,Xd,0)];class wL{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,n=0,i=.1,r=100){N1=this._renderer.getRenderTarget(),O1=this._renderer.getActiveCubeFace(),L1=this._renderer.getActiveMipmapLevel(),this._setSize(256);const a=this._allocateTargets();return a.depthBuffer=!0,this._sceneToCubeUV(e,i,r,a),n>0&&this._blur(a,0,0,n),this._applyPMREM(a),this._cleanup(a),a}fromEquirectangular(e,n=null){return this._fromTexture(e,n)}fromCubemap(e,n=null){return this._fromTexture(e,n)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=AL(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=ML(),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(N1,O1,L1),e.scissorTest=!1,ev(e,0,0,e.width,e.height)}_fromTexture(e,n){e.mapping===Sf||e.mapping===wf?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),N1=this._renderer.getRenderTarget(),O1=this._renderer.getActiveCubeFace(),L1=this._renderer.getActiveMipmapLevel();const i=n||this._allocateTargets();return this._textureToCubeUV(e,i),this._applyPMREM(i),this._cleanup(i),i}_allocateTargets(){const e=3*Math.max(this._cubeSize,112),n=4*this._cubeSize,i={magFilter:Ha,minFilter:Ha,generateMipmaps:!1,type:$p,format:Ga,colorSpace:Wo,depthBuffer:!1},r=EL(e,n,i);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==n){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=EL(e,n,i);const{_lodMax:a}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=Bae(a)),this._blurMaterial=jae(a,e,n)}return r}_compileMaterial(e){const n=new gs(this._lodPlanes[0],e);this._renderer.compile(n,D1)}_sceneToCubeUV(e,n,i,r){const l=new ma(90,1,n,i),c=[1,-1,1,1,1,1],d=[1,1,1,-1,-1,-1],f=this._renderer,h=f.autoClear,g=f.toneMapping;f.getClearColor(_L),f.toneMapping=rc,f.autoClear=!1;const m=new GB({name:"PMREM.Background",side:Zr,depthWrite:!1,depthTest:!1}),b=new gs(new bm,m);let y=!1;const x=e.background;x?x.isColor&&(m.color.copy(x),e.background=null,y=!0):(m.color.copy(_L),y=!0);for(let v=0;v<6;v++){const w=v%3;w===0?(l.up.set(0,c[v],0),l.lookAt(d[v],0,0)):w===1?(l.up.set(0,0,c[v]),l.lookAt(0,d[v],0)):(l.up.set(0,c[v],0),l.lookAt(0,0,d[v]));const S=this._cubeSize;ev(r,w*S,v>2?S:0,S,S),f.setRenderTarget(r),y&&f.render(b,l),f.render(e,l)}b.geometry.dispose(),b.material.dispose(),f.toneMapping=g,f.autoClear=h,e.background=x}_textureToCubeUV(e,n){const i=this._renderer,r=e.mapping===Sf||e.mapping===wf;r?(this._cubemapMaterial===null&&(this._cubemapMaterial=AL()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=ML());const a=r?this._cubemapMaterial:this._equirectMaterial,s=new gs(this._lodPlanes[0],a),l=a.uniforms;l.envMap.value=e;const c=this._cubeSize;ev(n,0,0,3*c,2*c),i.setRenderTarget(n),i.render(s,D1)}_applyPMREM(e){const n=this._renderer,i=n.autoClear;n.autoClear=!1;for(let r=1;r<this._lodPlanes.length;r++){const a=Math.sqrt(this._sigmas[r]*this._sigmas[r]-this._sigmas[r-1]*this._sigmas[r-1]),s=SL[(r-1)%SL.length];this._blur(e,r-1,r,a,s)}n.autoClear=i}_blur(e,n,i,r,a){const s=this._pingPongRenderTarget;this._halfBlur(e,s,n,i,r,"latitudinal",a),this._halfBlur(s,e,i,i,r,"longitudinal",a)}_halfBlur(e,n,i,r,a,s,l){const c=this._renderer,d=this._blurMaterial;s!=="latitudinal"&&s!=="longitudinal"&&console.error("blur direction must be either latitudinal or longitudinal!");const f=3,h=new gs(this._lodPlanes[r],d),g=d.uniforms,m=this._sizeLods[i]-1,b=isFinite(a)?Math.PI/(2*m):2*Math.PI/(2*eu-1),y=a/b,x=isFinite(a)?1+Math.floor(f*y):eu;x>eu&&console.warn(`sigmaRadians, ${a}, is too large and will clip, as it requested ${x} samples when the maximum is set to ${eu}`);const v=[];let w=0;for(let C=0;C<eu;++C){const F=C/y,P=Math.exp(-F*F/2);v.push(P),C===0?w+=P:C<x&&(w+=2*P)}for(let C=0;C<v.length;C++)v[C]=v[C]/w;g.envMap.value=e.texture,g.samples.value=x,g.weights.value=v,g.latitudinal.value=s==="latitudinal",l&&(g.poleAxis.value=l);const{_lodMax:S}=this;g.dTheta.value=b,g.mipInt.value=S-i;const A=this._sizeLods[r],R=3*A*(r>S-tf?r-S+tf:0),N=4*(this._cubeSize-A);ev(n,R,N,3*A,2*A),c.setRenderTarget(n),c.render(h,D1)}}function Bae(t){const e=[],n=[],i=[];let r=t;const a=t-tf+1+bL.length;for(let s=0;s<a;s++){const l=Math.pow(2,r);n.push(l);let c=1/l;s>t-tf?c=bL[s-t+tf-1]:s===0&&(c=0),i.push(c);const d=1/(l-2),f=-d,h=1+d,g=[f,f,h,f,h,h,f,f,h,h,f,h],m=6,b=6,y=3,x=2,v=1,w=new Float32Array(y*b*m),S=new Float32Array(x*b*m),A=new Float32Array(v*b*m);for(let N=0;N<m;N++){const C=N%3*2/3-1,F=N>2?0:-1,P=[C,F,0,C+2/3,F,0,C+2/3,F+1,0,C,F,0,C+2/3,F+1,0,C,F+1,0];w.set(P,y*b*N),S.set(g,x*b*N);const L=[N,N,N,N,N,N];A.set(L,v*b*N)}const R=new Mr;R.setAttribute("position",new ya(w,y)),R.setAttribute("uv",new ya(S,x)),R.setAttribute("faceIndex",new ya(A,v)),e.push(R),r>tf&&r--}return{lodPlanes:e,sizeLods:n,sigmas:i}}function EL(t,e,n){const i=new Eu(t,e,n);return i.texture.mapping=vy,i.texture.name="PMREM.cubeUv",i.scissorTest=!0,i}function ev(t,e,n,i,r){t.viewport.set(e,n,i,r),t.scissor.set(e,n,i,r)}function jae(t,e,n){const i=new Float32Array(eu),r=new Ce(0,1,0);return new uc({name:"SphericalGaussianBlur",defines:{n:eu,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/n,CUBEUV_MAX_MIP:`${t}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:i},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:r}},vertexShader:BT(),fragmentShader:`
  7253. precision mediump float;
  7254. precision mediump int;
  7255. varying vec3 vOutputDirection;
  7256. uniform sampler2D envMap;
  7257. uniform int samples;
  7258. uniform float weights[ n ];
  7259. uniform bool latitudinal;
  7260. uniform float dTheta;
  7261. uniform float mipInt;
  7262. uniform vec3 poleAxis;
  7263. #define ENVMAP_TYPE_CUBE_UV
  7264. #include <cube_uv_reflection_fragment>
  7265. vec3 getSample( float theta, vec3 axis ) {
  7266. float cosTheta = cos( theta );
  7267. // Rodrigues' axis-angle rotation
  7268. vec3 sampleDirection = vOutputDirection * cosTheta
  7269. + cross( axis, vOutputDirection ) * sin( theta )
  7270. + axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );
  7271. return bilinearCubeUV( envMap, sampleDirection, mipInt );
  7272. }
  7273. void main() {
  7274. vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );
  7275. if ( all( equal( axis, vec3( 0.0 ) ) ) ) {
  7276. axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );
  7277. }
  7278. axis = normalize( axis );
  7279. gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );
  7280. gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );
  7281. for ( int i = 1; i < n; i++ ) {
  7282. if ( i >= samples ) {
  7283. break;
  7284. }
  7285. float theta = dTheta * float( i );
  7286. gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );
  7287. gl_FragColor.rgb += weights[ i ] * getSample( theta, axis );
  7288. }
  7289. }
  7290. `,blending:ic,depthTest:!1,depthWrite:!1})}function ML(){return new uc({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:BT(),fragmentShader:`
  7291. precision mediump float;
  7292. precision mediump int;
  7293. varying vec3 vOutputDirection;
  7294. uniform sampler2D envMap;
  7295. #include <common>
  7296. void main() {
  7297. vec3 outputDirection = normalize( vOutputDirection );
  7298. vec2 uv = equirectUv( outputDirection );
  7299. gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );
  7300. }
  7301. `,blending:ic,depthTest:!1,depthWrite:!1})}function AL(){return new uc({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:BT(),fragmentShader:`
  7302. precision mediump float;
  7303. precision mediump int;
  7304. uniform float flipEnvMap;
  7305. varying vec3 vOutputDirection;
  7306. uniform samplerCube envMap;
  7307. void main() {
  7308. gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );
  7309. }
  7310. `,blending:ic,depthTest:!1,depthWrite:!1})}function BT(){return`
  7311. precision mediump float;
  7312. precision mediump int;
  7313. attribute float faceIndex;
  7314. varying vec3 vOutputDirection;
  7315. // RH coordinate system; PMREM face-indexing convention
  7316. vec3 getDirection( vec2 uv, float face ) {
  7317. uv = 2.0 * uv - 1.0;
  7318. vec3 direction = vec3( uv, 1.0 );
  7319. if ( face == 0.0 ) {
  7320. direction = direction.zyx; // ( 1, v, u ) pos x
  7321. } else if ( face == 1.0 ) {
  7322. direction = direction.xzy;
  7323. direction.xz *= -1.0; // ( -u, 1, -v ) pos y
  7324. } else if ( face == 2.0 ) {
  7325. direction.x *= -1.0; // ( -u, v, 1 ) pos z
  7326. } else if ( face == 3.0 ) {
  7327. direction = direction.zyx;
  7328. direction.xz *= -1.0; // ( -1, v, -u ) neg x
  7329. } else if ( face == 4.0 ) {
  7330. direction = direction.xzy;
  7331. direction.xy *= -1.0; // ( -u, -1, v ) neg y
  7332. } else if ( face == 5.0 ) {
  7333. direction.z *= -1.0; // ( u, v, -1 ) neg z
  7334. }
  7335. return direction;
  7336. }
  7337. void main() {
  7338. vOutputDirection = getDirection( uv, faceIndex );
  7339. gl_Position = vec4( position, 1.0 );
  7340. }
  7341. `}function Hae(t){let e=new WeakMap,n=null;function i(l){if(l&&l.isTexture){const c=l.mapping,d=c===kM||c===FM,f=c===Sf||c===wf;if(d||f)if(l.isRenderTargetTexture&&l.needsPMREMUpdate===!0){l.needsPMREMUpdate=!1;let h=e.get(l);return n===null&&(n=new wL(t)),h=d?n.fromEquirectangular(l,h):n.fromCubemap(l,h),e.set(l,h),h.texture}else{if(e.has(l))return e.get(l).texture;{const h=l.image;if(d&&h&&h.height>0||f&&h&&r(h)){n===null&&(n=new wL(t));const g=d?n.fromEquirectangular(l):n.fromCubemap(l);return e.set(l,g),l.addEventListener("dispose",a),g.texture}else return null}}}return l}function r(l){let c=0;const d=6;for(let f=0;f<d;f++)l[f]!==void 0&&c++;return c===d}function a(l){const c=l.target;c.removeEventListener("dispose",a);const d=e.get(c);d!==void 0&&(e.delete(c),d.dispose())}function s(){e=new WeakMap,n!==null&&(n.dispose(),n=null)}return{get:i,dispose:s}}function Gae(t){const e={};function n(i){if(e[i]!==void 0)return e[i];let r;switch(i){case"WEBGL_depth_texture":r=t.getExtension("WEBGL_depth_texture")||t.getExtension("MOZ_WEBGL_depth_texture")||t.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":r=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("MOZ_EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":r=t.getExtension("WEBGL_compressed_texture_s3tc")||t.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":r=t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:r=t.getExtension(i)}return e[i]=r,r}return{has:function(i){return n(i)!==null},init:function(i){i.isWebGL2?n("EXT_color_buffer_float"):(n("WEBGL_depth_texture"),n("OES_texture_float"),n("OES_texture_half_float"),n("OES_texture_half_float_linear"),n("OES_standard_derivatives"),n("OES_element_index_uint"),n("OES_vertex_array_object"),n("ANGLE_instanced_arrays")),n("OES_texture_float_linear"),n("EXT_color_buffer_half_float"),n("WEBGL_multisampled_render_to_texture")},get:function(i){const r=n(i);return r===null&&console.warn("THREE.WebGLRenderer: "+i+" extension not supported."),r}}}function Vae(t,e,n,i){const r={},a=new WeakMap;function s(h){const g=h.target;g.index!==null&&e.remove(g.index);for(const b in g.attributes)e.remove(g.attributes[b]);for(const b in g.morphAttributes){const y=g.morphAttributes[b];for(let x=0,v=y.length;x<v;x++)e.remove(y[x])}g.removeEventListener("dispose",s),delete r[g.id];const m=a.get(g);m&&(e.remove(m),a.delete(g)),i.releaseStatesOfGeometry(g),g.isInstancedBufferGeometry===!0&&delete g._maxInstanceCount,n.memory.geometries--}function l(h,g){return r[g.id]===!0||(g.addEventListener("dispose",s),r[g.id]=!0,n.memory.geometries++),g}function c(h){const g=h.attributes;for(const b in g)e.update(g[b],t.ARRAY_BUFFER);const m=h.morphAttributes;for(const b in m){const y=m[b];for(let x=0,v=y.length;x<v;x++)e.update(y[x],t.ARRAY_BUFFER)}}function d(h){const g=[],m=h.index,b=h.attributes.position;let y=0;if(m!==null){const w=m.array;y=m.version;for(let S=0,A=w.length;S<A;S+=3){const R=w[S+0],N=w[S+1],C=w[S+2];g.push(R,N,N,C,C,R)}}else if(b!==void 0){const w=b.array;y=b.version;for(let S=0,A=w.length/3-1;S<A;S+=3){const R=S+0,N=S+1,C=S+2;g.push(R,N,N,C,C,R)}}else return;const x=new(kB(g)?$B:VB)(g,1);x.version=y;const v=a.get(h);v&&e.remove(v),a.set(h,x)}function f(h){const g=a.get(h);if(g){const m=h.index;m!==null&&g.version<m.version&&d(h)}else d(h);return a.get(h)}return{get:l,update:c,getWireframeAttribute:f}}function $ae(t,e,n,i){const r=i.isWebGL2;let a;function s(m){a=m}let l,c;function d(m){l=m.type,c=m.bytesPerElement}function f(m,b){t.drawElements(a,b,l,m*c),n.update(b,a,1)}function h(m,b,y){if(y===0)return;let x,v;if(r)x=t,v="drawElementsInstanced";else if(x=e.get("ANGLE_instanced_arrays"),v="drawElementsInstancedANGLE",x===null){console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");return}x[v](a,b,l,m*c,y),n.update(b,a,y)}function g(m,b,y){if(y===0)return;const x=e.get("WEBGL_multi_draw");if(x===null)for(let v=0;v<y;v++)this.render(m[v]/c,b[v]);else{x.multiDrawElementsWEBGL(a,b,0,l,m,0,y);let v=0;for(let w=0;w<y;w++)v+=b[w];n.update(v,a,1)}}this.setMode=s,this.setIndex=d,this.render=f,this.renderInstances=h,this.renderMultiDraw=g}function Wae(t){const e={geometries:0,textures:0},n={frame:0,calls:0,triangles:0,points:0,lines:0};function i(a,s,l){switch(n.calls++,s){case t.TRIANGLES:n.triangles+=l*(a/3);break;case t.LINES:n.lines+=l*(a/2);break;case t.LINE_STRIP:n.lines+=l*(a-1);break;case t.LINE_LOOP:n.lines+=l*a;break;case t.POINTS:n.points+=l*a;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",s);break}}function r(){n.calls=0,n.triangles=0,n.points=0,n.lines=0}return{memory:e,render:n,programs:null,autoReset:!0,reset:r,update:i}}function Xae(t,e){return t[0]-e[0]}function qae(t,e){return Math.abs(e[1])-Math.abs(t[1])}function Yae(t,e,n){const i={},r=new Float32Array(8),a=new WeakMap,s=new Cn,l=[];for(let d=0;d<8;d++)l[d]=[d,0];function c(d,f,h){const g=d.morphTargetInfluences;if(e.isWebGL2===!0){const b=f.morphAttributes.position||f.morphAttributes.normal||f.morphAttributes.color,y=b!==void 0?b.length:0;let x=a.get(f);if(x===void 0||x.count!==y){let W=function(){$.dispose(),a.delete(f),f.removeEventListener("dispose",W)};var m=W;x!==void 0&&x.texture.dispose();const S=f.morphAttributes.position!==void 0,A=f.morphAttributes.normal!==void 0,R=f.morphAttributes.color!==void 0,N=f.morphAttributes.position||[],C=f.morphAttributes.normal||[],F=f.morphAttributes.color||[];let P=0;S===!0&&(P=1),A===!0&&(P=2),R===!0&&(P=3);let L=f.attributes.position.count*P,B=1;L>e.maxTextureSize&&(B=Math.ceil(L/e.maxTextureSize),L=e.maxTextureSize);const U=new Float32Array(L*B*4*y),$=new BB(U,L,B,y);$.type=Io,$.needsUpdate=!0;const I=P*4;for(let X=0;X<y;X++){const V=N[X],Y=C[X],J=F[X],se=L*B*4*X;for(let H=0;H<V.count;H++){const q=H*I;S===!0&&(s.fromBufferAttribute(V,H),U[se+q+0]=s.x,U[se+q+1]=s.y,U[se+q+2]=s.z,U[se+q+3]=0),A===!0&&(s.fromBufferAttribute(Y,H),U[se+q+4]=s.x,U[se+q+5]=s.y,U[se+q+6]=s.z,U[se+q+7]=0),R===!0&&(s.fromBufferAttribute(J,H),U[se+q+8]=s.x,U[se+q+9]=s.y,U[se+q+10]=s.z,U[se+q+11]=J.itemSize===4?s.w:1)}}x={count:y,texture:$,size:new Ut(L,B)},a.set(f,x),f.addEventListener("dispose",W)}let v=0;for(let S=0;S<g.length;S++)v+=g[S];const w=f.morphTargetsRelative?1:1-v;h.getUniforms().setValue(t,"morphTargetBaseInfluence",w),h.getUniforms().setValue(t,"morphTargetInfluences",g),h.getUniforms().setValue(t,"morphTargetsTexture",x.texture,n),h.getUniforms().setValue(t,"morphTargetsTextureSize",x.size)}else{const b=g===void 0?0:g.length;let y=i[f.id];if(y===void 0||y.length!==b){y=[];for(let A=0;A<b;A++)y[A]=[A,0];i[f.id]=y}for(let A=0;A<b;A++){const R=y[A];R[0]=A,R[1]=g[A]}y.sort(qae);for(let A=0;A<8;A++)A<b&&y[A][1]?(l[A][0]=y[A][0],l[A][1]=y[A][1]):(l[A][0]=Number.MAX_SAFE_INTEGER,l[A][1]=0);l.sort(Xae);const x=f.morphAttributes.position,v=f.morphAttributes.normal;let w=0;for(let A=0;A<8;A++){const R=l[A],N=R[0],C=R[1];N!==Number.MAX_SAFE_INTEGER&&C?(x&&f.getAttribute("morphTarget"+A)!==x[N]&&f.setAttribute("morphTarget"+A,x[N]),v&&f.getAttribute("morphNormal"+A)!==v[N]&&f.setAttribute("morphNormal"+A,v[N]),r[A]=C,w+=C):(x&&f.hasAttribute("morphTarget"+A)===!0&&f.deleteAttribute("morphTarget"+A),v&&f.hasAttribute("morphNormal"+A)===!0&&f.deleteAttribute("morphNormal"+A),r[A]=0)}const S=f.morphTargetsRelative?1:1-w;h.getUniforms().setValue(t,"morphTargetBaseInfluence",S),h.getUniforms().setValue(t,"morphTargetInfluences",r)}}return{update:c}}function Kae(t,e,n,i){let r=new WeakMap;function a(c){const d=i.render.frame,f=c.geometry,h=e.get(c,f);if(r.get(h)!==d&&(e.update(h),r.set(h,d)),c.isInstancedMesh&&(c.hasEventListener("dispose",l)===!1&&c.addEventListener("dispose",l),r.get(c)!==d&&(n.update(c.instanceMatrix,t.ARRAY_BUFFER),c.instanceColor!==null&&n.update(c.instanceColor,t.ARRAY_BUFFER),r.set(c,d))),c.isSkinnedMesh){const g=c.skeleton;r.get(g)!==d&&(g.update(),r.set(g,d))}return h}function s(){r=new WeakMap}function l(c){const d=c.target;d.removeEventListener("dispose",l),n.remove(d.instanceMatrix),d.instanceColor!==null&&n.remove(d.instanceColor)}return{update:a,dispose:s}}class KB extends Qr{constructor(e,n,i,r,a,s,l,c,d,f){if(f=f!==void 0?f:cu,f!==cu&&f!==Ef)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");i===void 0&&f===cu&&(i=Jl),i===void 0&&f===Ef&&(i=lu),super(null,r,a,s,l,c,f,i,d),this.isDepthTexture=!0,this.image={width:e,height:n},this.magFilter=l!==void 0?l:dr,this.minFilter=c!==void 0?c:dr,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.compareFunction=e.compareFunction,this}toJSON(e){const n=super.toJSON(e);return this.compareFunction!==null&&(n.compareFunction=this.compareFunction),n}}const ZB=new Qr,QB=new KB(1,1);QB.compareFunction=IB;const JB=new BB,e5=new Lne,t5=new qB,TL=[],CL=[],RL=new Float32Array(16),PL=new Float32Array(9),DL=new Float32Array(4);function Vf(t,e,n){const i=t[0];if(i<=0||i>0)return t;const r=e*n;let a=TL[r];if(a===void 0&&(a=new Float32Array(r),TL[r]=a),e!==0){i.toArray(a,0);for(let s=1,l=0;s!==e;++s)l+=n,t[s].toArray(a,l)}return a}function Oi(t,e){if(t.length!==e.length)return!1;for(let n=0,i=t.length;n<i;n++)if(t[n]!==e[n])return!1;return!0}function Li(t,e){for(let n=0,i=e.length;n<i;n++)t[n]=e[n]}function by(t,e){let n=CL[e];n===void 0&&(n=new Int32Array(e),CL[e]=n);for(let i=0;i!==e;++i)n[i]=t.allocateTextureUnit();return n}function Zae(t,e){const n=this.cache;n[0]!==e&&(t.uniform1f(this.addr,e),n[0]=e)}function Qae(t,e){const n=this.cache;if(e.x!==void 0)(n[0]!==e.x||n[1]!==e.y)&&(t.uniform2f(this.addr,e.x,e.y),n[0]=e.x,n[1]=e.y);else{if(Oi(n,e))return;t.uniform2fv(this.addr,e),Li(n,e)}}function Jae(t,e){const n=this.cache;if(e.x!==void 0)(n[0]!==e.x||n[1]!==e.y||n[2]!==e.z)&&(t.uniform3f(this.addr,e.x,e.y,e.z),n[0]=e.x,n[1]=e.y,n[2]=e.z);else if(e.r!==void 0)(n[0]!==e.r||n[1]!==e.g||n[2]!==e.b)&&(t.uniform3f(this.addr,e.r,e.g,e.b),n[0]=e.r,n[1]=e.g,n[2]=e.b);else{if(Oi(n,e))return;t.uniform3fv(this.addr,e),Li(n,e)}}function ese(t,e){const n=this.cache;if(e.x!==void 0)(n[0]!==e.x||n[1]!==e.y||n[2]!==e.z||n[3]!==e.w)&&(t.uniform4f(this.addr,e.x,e.y,e.z,e.w),n[0]=e.x,n[1]=e.y,n[2]=e.z,n[3]=e.w);else{if(Oi(n,e))return;t.uniform4fv(this.addr,e),Li(n,e)}}function tse(t,e){const n=this.cache,i=e.elements;if(i===void 0){if(Oi(n,e))return;t.uniformMatrix2fv(this.addr,!1,e),Li(n,e)}else{if(Oi(n,i))return;DL.set(i),t.uniformMatrix2fv(this.addr,!1,DL),Li(n,i)}}function nse(t,e){const n=this.cache,i=e.elements;if(i===void 0){if(Oi(n,e))return;t.uniformMatrix3fv(this.addr,!1,e),Li(n,e)}else{if(Oi(n,i))return;PL.set(i),t.uniformMatrix3fv(this.addr,!1,PL),Li(n,i)}}function ise(t,e){const n=this.cache,i=e.elements;if(i===void 0){if(Oi(n,e))return;t.uniformMatrix4fv(this.addr,!1,e),Li(n,e)}else{if(Oi(n,i))return;RL.set(i),t.uniformMatrix4fv(this.addr,!1,RL),Li(n,i)}}function rse(t,e){const n=this.cache;n[0]!==e&&(t.uniform1i(this.addr,e),n[0]=e)}function ase(t,e){const n=this.cache;if(e.x!==void 0)(n[0]!==e.x||n[1]!==e.y)&&(t.uniform2i(this.addr,e.x,e.y),n[0]=e.x,n[1]=e.y);else{if(Oi(n,e))return;t.uniform2iv(this.addr,e),Li(n,e)}}function sse(t,e){const n=this.cache;if(e.x!==void 0)(n[0]!==e.x||n[1]!==e.y||n[2]!==e.z)&&(t.uniform3i(this.addr,e.x,e.y,e.z),n[0]=e.x,n[1]=e.y,n[2]=e.z);else{if(Oi(n,e))return;t.uniform3iv(this.addr,e),Li(n,e)}}function ose(t,e){const n=this.cache;if(e.x!==void 0)(n[0]!==e.x||n[1]!==e.y||n[2]!==e.z||n[3]!==e.w)&&(t.uniform4i(this.addr,e.x,e.y,e.z,e.w),n[0]=e.x,n[1]=e.y,n[2]=e.z,n[3]=e.w);else{if(Oi(n,e))return;t.uniform4iv(this.addr,e),Li(n,e)}}function lse(t,e){const n=this.cache;n[0]!==e&&(t.uniform1ui(this.addr,e),n[0]=e)}function cse(t,e){const n=this.cache;if(e.x!==void 0)(n[0]!==e.x||n[1]!==e.y)&&(t.uniform2ui(this.addr,e.x,e.y),n[0]=e.x,n[1]=e.y);else{if(Oi(n,e))return;t.uniform2uiv(this.addr,e),Li(n,e)}}function use(t,e){const n=this.cache;if(e.x!==void 0)(n[0]!==e.x||n[1]!==e.y||n[2]!==e.z)&&(t.uniform3ui(this.addr,e.x,e.y,e.z),n[0]=e.x,n[1]=e.y,n[2]=e.z);else{if(Oi(n,e))return;t.uniform3uiv(this.addr,e),Li(n,e)}}function dse(t,e){const n=this.cache;if(e.x!==void 0)(n[0]!==e.x||n[1]!==e.y||n[2]!==e.z||n[3]!==e.w)&&(t.uniform4ui(this.addr,e.x,e.y,e.z,e.w),n[0]=e.x,n[1]=e.y,n[2]=e.z,n[3]=e.w);else{if(Oi(n,e))return;t.uniform4uiv(this.addr,e),Li(n,e)}}function fse(t,e,n){const i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(t.uniform1i(this.addr,r),i[0]=r);const a=this.type===t.SAMPLER_2D_SHADOW?QB:ZB;n.setTexture2D(e||a,r)}function hse(t,e,n){const i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(t.uniform1i(this.addr,r),i[0]=r),n.setTexture3D(e||e5,r)}function pse(t,e,n){const i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(t.uniform1i(this.addr,r),i[0]=r),n.setTextureCube(e||t5,r)}function mse(t,e,n){const i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(t.uniform1i(this.addr,r),i[0]=r),n.setTexture2DArray(e||JB,r)}function gse(t){switch(t){case 5126:return Zae;case 35664:return Qae;case 35665:return Jae;case 35666:return ese;case 35674:return tse;case 35675:return nse;case 35676:return ise;case 5124:case 35670:return rse;case 35667:case 35671:return ase;case 35668:case 35672:return sse;case 35669:case 35673:return ose;case 5125:return lse;case 36294:return cse;case 36295:return use;case 36296:return dse;case 35678:case 36198:case 36298:case 36306:case 35682:return fse;case 35679:case 36299:case 36307:return hse;case 35680:case 36300:case 36308:case 36293:return pse;case 36289:case 36303:case 36311:case 36292:return mse}}function vse(t,e){t.uniform1fv(this.addr,e)}function xse(t,e){const n=Vf(e,this.size,2);t.uniform2fv(this.addr,n)}function yse(t,e){const n=Vf(e,this.size,3);t.uniform3fv(this.addr,n)}function bse(t,e){const n=Vf(e,this.size,4);t.uniform4fv(this.addr,n)}function _se(t,e){const n=Vf(e,this.size,4);t.uniformMatrix2fv(this.addr,!1,n)}function Sse(t,e){const n=Vf(e,this.size,9);t.uniformMatrix3fv(this.addr,!1,n)}function wse(t,e){const n=Vf(e,this.size,16);t.uniformMatrix4fv(this.addr,!1,n)}function Ese(t,e){t.uniform1iv(this.addr,e)}function Mse(t,e){t.uniform2iv(this.addr,e)}function Ase(t,e){t.uniform3iv(this.addr,e)}function Tse(t,e){t.uniform4iv(this.addr,e)}function Cse(t,e){t.uniform1uiv(this.addr,e)}function Rse(t,e){t.uniform2uiv(this.addr,e)}function Pse(t,e){t.uniform3uiv(this.addr,e)}function Dse(t,e){t.uniform4uiv(this.addr,e)}function Nse(t,e,n){const i=this.cache,r=e.length,a=by(n,r);Oi(i,a)||(t.uniform1iv(this.addr,a),Li(i,a));for(let s=0;s!==r;++s)n.setTexture2D(e[s]||ZB,a[s])}function Ose(t,e,n){const i=this.cache,r=e.length,a=by(n,r);Oi(i,a)||(t.uniform1iv(this.addr,a),Li(i,a));for(let s=0;s!==r;++s)n.setTexture3D(e[s]||e5,a[s])}function Lse(t,e,n){const i=this.cache,r=e.length,a=by(n,r);Oi(i,a)||(t.uniform1iv(this.addr,a),Li(i,a));for(let s=0;s!==r;++s)n.setTextureCube(e[s]||t5,a[s])}function Ise(t,e,n){const i=this.cache,r=e.length,a=by(n,r);Oi(i,a)||(t.uniform1iv(this.addr,a),Li(i,a));for(let s=0;s!==r;++s)n.setTexture2DArray(e[s]||JB,a[s])}function Use(t){switch(t){case 5126:return vse;case 35664:return xse;case 35665:return yse;case 35666:return bse;case 35674:return _se;case 35675:return Sse;case 35676:return wse;case 5124:case 35670:return Ese;case 35667:case 35671:return Mse;case 35668:case 35672:return Ase;case 35669:case 35673:return Tse;case 5125:return Cse;case 36294:return Rse;case 36295:return Pse;case 36296:return Dse;case 35678:case 36198:case 36298:case 36306:case 35682:return Nse;case 35679:case 36299:case 36307:return Ose;case 35680:case 36300:case 36308:case 36293:return Lse;case 36289:case 36303:case 36311:case 36292:return Ise}}class kse{constructor(e,n,i){this.id=e,this.addr=i,this.cache=[],this.type=n.type,this.setValue=gse(n.type)}}class Fse{constructor(e,n,i){this.id=e,this.addr=i,this.cache=[],this.type=n.type,this.size=n.size,this.setValue=Use(n.type)}}class zse{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,n,i){const r=this.seq;for(let a=0,s=r.length;a!==s;++a){const l=r[a];l.setValue(e,n[l.id],i)}}}const I1=/(\w+)(\])?(\[|\.)?/g;function NL(t,e){t.seq.push(e),t.map[e.id]=e}function Bse(t,e,n){const i=t.name,r=i.length;for(I1.lastIndex=0;;){const a=I1.exec(i),s=I1.lastIndex;let l=a[1];const c=a[2]==="]",d=a[3];if(c&&(l=l|0),d===void 0||d==="["&&s+2===r){NL(n,d===void 0?new kse(l,t,e):new Fse(l,t,e));break}else{let h=n.map[l];h===void 0&&(h=new zse(l),NL(n,h)),n=h}}}class Fv{constructor(e,n){this.seq=[],this.map={};const i=e.getProgramParameter(n,e.ACTIVE_UNIFORMS);for(let r=0;r<i;++r){const a=e.getActiveUniform(n,r),s=e.getUniformLocation(n,a.name);Bse(a,s,this)}}setValue(e,n,i,r){const a=this.map[n];a!==void 0&&a.setValue(e,i,r)}setOptional(e,n,i){const r=n[i];r!==void 0&&this.setValue(e,i,r)}static upload(e,n,i,r){for(let a=0,s=n.length;a!==s;++a){const l=n[a],c=i[l.id];c.needsUpdate!==!1&&l.setValue(e,c.value,r)}}static seqWithValue(e,n){const i=[];for(let r=0,a=e.length;r!==a;++r){const s=e[r];s.id in n&&i.push(s)}return i}}function OL(t,e,n){const i=t.createShader(e);return t.shaderSource(i,n),t.compileShader(i),i}const jse=37297;let Hse=0;function Gse(t,e){const n=t.split(`
  7342. `),i=[],r=Math.max(e-6,0),a=Math.min(e+6,n.length);for(let s=r;s<a;s++){const l=s+1;i.push(`${l===e?">":" "} ${l}: ${n[s]}`)}return i.join(`
  7343. `)}function Vse(t){const e=An.getPrimaries(An.workingColorSpace),n=An.getPrimaries(t);let i;switch(e===n?i="":e===ox&&n===sx?i="LinearDisplayP3ToLinearSRGB":e===sx&&n===ox&&(i="LinearSRGBToLinearDisplayP3"),t){case Wo:case xy:return[i,"LinearTransferOETF"];case fr:case IT:return[i,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space:",t),[i,"LinearTransferOETF"]}}function LL(t,e,n){const i=t.getShaderParameter(e,t.COMPILE_STATUS),r=t.getShaderInfoLog(e).trim();if(i&&r==="")return"";const a=/ERROR: 0:(\d+)/.exec(r);if(a){const s=parseInt(a[1]);return n.toUpperCase()+`
  7344. `+r+`
  7345. `+Gse(t.getShaderSource(e),s)}else return r}function $se(t,e){const n=Vse(e);return`vec4 ${t}( vec4 value ) { return ${n[0]}( ${n[1]}( value ) ); }`}function Wse(t,e){let n;switch(e){case $te:n="Linear";break;case Wte:n="Reinhard";break;case Xte:n="OptimizedCineon";break;case qte:n="ACESFilmic";break;case Yte:n="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),n="Linear"}return"vec3 "+t+"( vec3 color ) { return "+n+"ToneMapping( color ); }"}function Xse(t){return[t.extensionDerivatives||t.envMapCubeUVHeight||t.bumpMap||t.normalMapTangentSpace||t.clearcoatNormalMap||t.flatShading||t.shaderID==="physical"?"#extension GL_OES_standard_derivatives : enable":"",(t.extensionFragDepth||t.logarithmicDepthBuffer)&&t.rendererExtensionFragDepth?"#extension GL_EXT_frag_depth : enable":"",t.extensionDrawBuffers&&t.rendererExtensionDrawBuffers?"#extension GL_EXT_draw_buffers : require":"",(t.extensionShaderTextureLOD||t.envMap||t.transmission)&&t.rendererExtensionShaderTextureLod?"#extension GL_EXT_shader_texture_lod : enable":""].filter(bp).join(`
  7346. `)}function qse(t){const e=[];for(const n in t){const i=t[n];i!==!1&&e.push("#define "+n+" "+i)}return e.join(`
  7347. `)}function Yse(t,e){const n={},i=t.getProgramParameter(e,t.ACTIVE_ATTRIBUTES);for(let r=0;r<i;r++){const a=t.getActiveAttrib(e,r),s=a.name;let l=1;a.type===t.FLOAT_MAT2&&(l=2),a.type===t.FLOAT_MAT3&&(l=3),a.type===t.FLOAT_MAT4&&(l=4),n[s]={type:a.type,location:t.getAttribLocation(e,s),locationSize:l}}return n}function bp(t){return t!==""}function IL(t,e){const n=e.numSpotLightShadows+e.numSpotLightMaps-e.numSpotLightShadowsWithMaps;return t.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,n).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 UL(t,e){return t.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const Kse=/^[ \t]*#include +<([\w\d./]+)>/gm;function VM(t){return t.replace(Kse,Qse)}const Zse=new Map([["encodings_fragment","colorspace_fragment"],["encodings_pars_fragment","colorspace_pars_fragment"],["output_fragment","opaque_fragment"]]);function Qse(t,e){let n=Vt[e];if(n===void 0){const i=Zse.get(e);if(i!==void 0)n=Vt[i],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,i);else throw new Error("Can not resolve #include <"+e+">")}return VM(n)}const Jse=/#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 kL(t){return t.replace(Jse,eoe)}function eoe(t,e,n,i){let r="";for(let a=parseInt(e);a<parseInt(n);a++)r+=i.replace(/\[\s*i\s*\]/g,"[ "+a+" ]").replace(/UNROLLED_LOOP_INDEX/g,a);return r}function FL(t){let e="precision "+t.precision+` float;
  7348. precision `+t.precision+" int;";return t.precision==="highp"?e+=`
  7349. #define HIGH_PRECISION`:t.precision==="mediump"?e+=`
  7350. #define MEDIUM_PRECISION`:t.precision==="lowp"&&(e+=`
  7351. #define LOW_PRECISION`),e}function toe(t){let e="SHADOWMAP_TYPE_BASIC";return t.shadowMapType===EB?e="SHADOWMAP_TYPE_PCF":t.shadowMapType===yte?e="SHADOWMAP_TYPE_PCF_SOFT":t.shadowMapType===Co&&(e="SHADOWMAP_TYPE_VSM"),e}function noe(t){let e="ENVMAP_TYPE_CUBE";if(t.envMap)switch(t.envMapMode){case Sf:case wf:e="ENVMAP_TYPE_CUBE";break;case vy:e="ENVMAP_TYPE_CUBE_UV";break}return e}function ioe(t){let e="ENVMAP_MODE_REFLECTION";if(t.envMap)switch(t.envMapMode){case wf:e="ENVMAP_MODE_REFRACTION";break}return e}function roe(t){let e="ENVMAP_BLENDING_NONE";if(t.envMap)switch(t.combine){case OT:e="ENVMAP_BLENDING_MULTIPLY";break;case Gte:e="ENVMAP_BLENDING_MIX";break;case Vte:e="ENVMAP_BLENDING_ADD";break}return e}function aoe(t){const e=t.envMapCubeUVHeight;if(e===null)return null;const n=Math.log2(e)-2,i=1/e;return{texelWidth:1/(3*Math.max(Math.pow(2,n),112)),texelHeight:i,maxMip:n}}function soe(t,e,n,i){const r=t.getContext(),a=n.defines;let s=n.vertexShader,l=n.fragmentShader;const c=toe(n),d=noe(n),f=ioe(n),h=roe(n),g=aoe(n),m=n.isWebGL2?"":Xse(n),b=qse(a),y=r.createProgram();let x,v,w=n.glslVersion?"#version "+n.glslVersion+`
  7352. `:"";n.isRawShaderMaterial?(x=["#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,b].filter(bp).join(`
  7353. `),x.length>0&&(x+=`
  7354. `),v=[m,"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,b].filter(bp).join(`
  7355. `),v.length>0&&(v+=`
  7356. `)):(x=[FL(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,b,n.batching?"#define USE_BATCHING":"",n.instancing?"#define USE_INSTANCING":"",n.instancingColor?"#define USE_INSTANCING_COLOR":"",n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+f:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",n.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",n.displacementMap?"#define USE_DISPLACEMENTMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.anisotropy?"#define USE_ANISOTROPY":"",n.anisotropyMap?"#define USE_ANISOTROPYMAP":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",n.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaHash?"#define USE_ALPHAHASH":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",n.mapUv?"#define MAP_UV "+n.mapUv:"",n.alphaMapUv?"#define ALPHAMAP_UV "+n.alphaMapUv:"",n.lightMapUv?"#define LIGHTMAP_UV "+n.lightMapUv:"",n.aoMapUv?"#define AOMAP_UV "+n.aoMapUv:"",n.emissiveMapUv?"#define EMISSIVEMAP_UV "+n.emissiveMapUv:"",n.bumpMapUv?"#define BUMPMAP_UV "+n.bumpMapUv:"",n.normalMapUv?"#define NORMALMAP_UV "+n.normalMapUv:"",n.displacementMapUv?"#define DISPLACEMENTMAP_UV "+n.displacementMapUv:"",n.metalnessMapUv?"#define METALNESSMAP_UV "+n.metalnessMapUv:"",n.roughnessMapUv?"#define ROUGHNESSMAP_UV "+n.roughnessMapUv:"",n.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+n.anisotropyMapUv:"",n.clearcoatMapUv?"#define CLEARCOATMAP_UV "+n.clearcoatMapUv:"",n.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+n.clearcoatNormalMapUv:"",n.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+n.clearcoatRoughnessMapUv:"",n.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+n.iridescenceMapUv:"",n.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+n.iridescenceThicknessMapUv:"",n.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+n.sheenColorMapUv:"",n.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+n.sheenRoughnessMapUv:"",n.specularMapUv?"#define SPECULARMAP_UV "+n.specularMapUv:"",n.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+n.specularColorMapUv:"",n.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+n.specularIntensityMapUv:"",n.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+n.transmissionMapUv:"",n.thicknessMapUv?"#define THICKNESSMAP_UV "+n.thicknessMapUv:"",n.vertexTangents&&n.flatShading===!1?"#define USE_TANGENT":"",n.vertexColors?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUv1s?"#define USE_UV1":"",n.vertexUv2s?"#define USE_UV2":"",n.vertexUv3s?"#define USE_UV3":"",n.pointsUvs?"#define USE_POINTS_UV":"",n.flatShading?"#define FLAT_SHADED":"",n.skinning?"#define USE_SKINNING":"",n.morphTargets?"#define USE_MORPHTARGETS":"",n.morphNormals&&n.flatShading===!1?"#define USE_MORPHNORMALS":"",n.morphColors&&n.isWebGL2?"#define USE_MORPHCOLORS":"",n.morphTargetsCount>0&&n.isWebGL2?"#define MORPHTARGETS_TEXTURE":"",n.morphTargetsCount>0&&n.isWebGL2?"#define MORPHTARGETS_TEXTURE_STRIDE "+n.morphTextureStride:"",n.morphTargetsCount>0&&n.isWebGL2?"#define MORPHTARGETS_COUNT "+n.morphTargetsCount:"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+c:"",n.sizeAttenuation?"#define USE_SIZEATTENUATION":"",n.numLightProbes>0?"#define USE_LIGHT_PROBES":"",n.useLegacyLights?"#define LEGACY_LIGHTS":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.logarithmicDepthBuffer&&n.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_UV1"," attribute vec2 uv1;","#endif","#ifdef USE_UV2"," attribute vec2 uv2;","#endif","#ifdef USE_UV3"," attribute vec2 uv3;","#endif","#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",`
  7357. `].filter(bp).join(`
  7358. `),v=[m,FL(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,b,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.matcap?"#define USE_MATCAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+d:"",n.envMap?"#define "+f:"",n.envMap?"#define "+h:"",g?"#define CUBEUV_TEXEL_WIDTH "+g.texelWidth:"",g?"#define CUBEUV_TEXEL_HEIGHT "+g.texelHeight:"",g?"#define CUBEUV_MAX_MIP "+g.maxMip+".0":"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",n.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.anisotropy?"#define USE_ANISOTROPY":"",n.anisotropyMap?"#define USE_ANISOTROPYMAP":"",n.clearcoat?"#define USE_CLEARCOAT":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.iridescence?"#define USE_IRIDESCENCE":"",n.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",n.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaTest?"#define USE_ALPHATEST":"",n.alphaHash?"#define USE_ALPHAHASH":"",n.sheen?"#define USE_SHEEN":"",n.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.vertexTangents&&n.flatShading===!1?"#define USE_TANGENT":"",n.vertexColors||n.instancingColor?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUv1s?"#define USE_UV1":"",n.vertexUv2s?"#define USE_UV2":"",n.vertexUv3s?"#define USE_UV3":"",n.pointsUvs?"#define USE_POINTS_UV":"",n.gradientMap?"#define USE_GRADIENTMAP":"",n.flatShading?"#define FLAT_SHADED":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+c:"",n.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",n.numLightProbes>0?"#define USE_LIGHT_PROBES":"",n.useLegacyLights?"#define LEGACY_LIGHTS":"",n.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.logarithmicDepthBuffer&&n.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",n.toneMapping!==rc?"#define TONE_MAPPING":"",n.toneMapping!==rc?Vt.tonemapping_pars_fragment:"",n.toneMapping!==rc?Wse("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",n.opaque?"#define OPAQUE":"",Vt.colorspace_pars_fragment,$se("linearToOutputTexel",n.outputColorSpace),n.useDepthPacking?"#define DEPTH_PACKING "+n.depthPacking:"",`
  7359. `].filter(bp).join(`
  7360. `)),s=VM(s),s=IL(s,n),s=UL(s,n),l=VM(l),l=IL(l,n),l=UL(l,n),s=kL(s),l=kL(l),n.isWebGL2&&n.isRawShaderMaterial!==!0&&(w=`#version 300 es
  7361. `,x=["precision mediump sampler2DArray;","#define attribute in","#define varying out","#define texture2D texture"].join(`
  7362. `)+`
  7363. `+x,v=["precision mediump sampler2DArray;","#define varying in",n.glslVersion===nL?"":"layout(location = 0) out highp vec4 pc_fragColor;",n.glslVersion===nL?"":"#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(`
  7364. `)+`
  7365. `+v);const S=w+x+s,A=w+v+l,R=OL(r,r.VERTEX_SHADER,S),N=OL(r,r.FRAGMENT_SHADER,A);r.attachShader(y,R),r.attachShader(y,N),n.index0AttributeName!==void 0?r.bindAttribLocation(y,0,n.index0AttributeName):n.morphTargets===!0&&r.bindAttribLocation(y,0,"position"),r.linkProgram(y);function C(B){if(t.debug.checkShaderErrors){const U=r.getProgramInfoLog(y).trim(),$=r.getShaderInfoLog(R).trim(),I=r.getShaderInfoLog(N).trim();let W=!0,X=!0;if(r.getProgramParameter(y,r.LINK_STATUS)===!1)if(W=!1,typeof t.debug.onShaderError=="function")t.debug.onShaderError(r,y,R,N);else{const V=LL(r,R,"vertex"),Y=LL(r,N,"fragment");console.error("THREE.WebGLProgram: Shader Error "+r.getError()+" - VALIDATE_STATUS "+r.getProgramParameter(y,r.VALIDATE_STATUS)+`
  7366. Program Info Log: `+U+`
  7367. `+V+`
  7368. `+Y)}else U!==""?console.warn("THREE.WebGLProgram: Program Info Log:",U):($===""||I==="")&&(X=!1);X&&(B.diagnostics={runnable:W,programLog:U,vertexShader:{log:$,prefix:x},fragmentShader:{log:I,prefix:v}})}r.deleteShader(R),r.deleteShader(N),F=new Fv(r,y),P=Yse(r,y)}let F;this.getUniforms=function(){return F===void 0&&C(this),F};let P;this.getAttributes=function(){return P===void 0&&C(this),P};let L=n.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return L===!1&&(L=r.getProgramParameter(y,jse)),L},this.destroy=function(){i.releaseStatesOfProgram(this),r.deleteProgram(y),this.program=void 0},this.type=n.shaderType,this.name=n.shaderName,this.id=Hse++,this.cacheKey=e,this.usedTimes=1,this.program=y,this.vertexShader=R,this.fragmentShader=N,this}let ooe=0;class loe{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const n=e.vertexShader,i=e.fragmentShader,r=this._getShaderStage(n),a=this._getShaderStage(i),s=this._getShaderCacheForMaterial(e);return s.has(r)===!1&&(s.add(r),r.usedTimes++),s.has(a)===!1&&(s.add(a),a.usedTimes++),this}remove(e){const n=this.materialCache.get(e);for(const i of n)i.usedTimes--,i.usedTimes===0&&this.shaderCache.delete(i.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 n=this.materialCache;let i=n.get(e);return i===void 0&&(i=new Set,n.set(e,i)),i}_getShaderStage(e){const n=this.shaderCache;let i=n.get(e);return i===void 0&&(i=new coe(e),n.set(e,i)),i}}class coe{constructor(e){this.id=ooe++,this.code=e,this.usedTimes=0}}function uoe(t,e,n,i,r,a,s){const l=new jB,c=new loe,d=[],f=r.isWebGL2,h=r.logarithmicDepthBuffer,g=r.vertexTextures;let m=r.precision;const b={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(P){return P===0?"uv":`uv${P}`}function x(P,L,B,U,$){const I=U.fog,W=$.geometry,X=P.isMeshStandardMaterial?U.environment:null,V=(P.isMeshStandardMaterial?n:e).get(P.envMap||X),Y=V&&V.mapping===vy?V.image.height:null,J=b[P.type];P.precision!==null&&(m=r.getMaxPrecision(P.precision),m!==P.precision&&console.warn("THREE.WebGLProgram.getParameters:",P.precision,"not supported, using",m,"instead."));const se=W.morphAttributes.position||W.morphAttributes.normal||W.morphAttributes.color,H=se!==void 0?se.length:0;let q=0;W.morphAttributes.position!==void 0&&(q=1),W.morphAttributes.normal!==void 0&&(q=2),W.morphAttributes.color!==void 0&&(q=3);let re,ce,ye,me;if(J){const Wt=qr[J];re=Wt.vertexShader,ce=Wt.fragmentShader}else re=P.vertexShader,ce=P.fragmentShader,c.update(P),ye=c.getVertexShaderID(P),me=c.getFragmentShaderID(P);const be=t.getRenderTarget(),Ne=$.isInstancedMesh===!0,he=$.isBatchedMesh===!0,Ae=!!P.map,Be=!!P.matcap,le=!!V,lt=!!P.aoMap,z=!!P.lightMap,G=!!P.bumpMap,ne=!!P.normalMap,Q=!!P.displacementMap,ee=!!P.emissiveMap,ae=!!P.metalnessMap,ie=!!P.roughnessMap,we=P.anisotropy>0,ve=P.clearcoat>0,k=P.iridescence>0,O=P.sheen>0,K=P.transmission>0,pe=we&&!!P.anisotropyMap,xe=ve&&!!P.clearcoatMap,fe=ve&&!!P.clearcoatNormalMap,Ke=ve&&!!P.clearcoatRoughnessMap,Ie=k&&!!P.iridescenceMap,$e=k&&!!P.iridescenceThicknessMap,rt=O&&!!P.sheenColorMap,ke=O&&!!P.sheenRoughnessMap,De=!!P.specularMap,ct=!!P.specularColorMap,et=!!P.specularIntensityMap,Je=K&&!!P.transmissionMap,st=K&&!!P.thicknessMap,ue=!!P.gradientMap,tt=!!P.alphaMap,de=P.alphaTest>0,Le=!!P.alphaHash,Me=!!P.extensions,ge=!!W.attributes.uv1,je=!!W.attributes.uv2,at=!!W.attributes.uv3;let mt=rc;return P.toneMapped&&(be===null||be.isXRRenderTarget===!0)&&(mt=t.toneMapping),{isWebGL2:f,shaderID:J,shaderType:P.type,shaderName:P.name,vertexShader:re,fragmentShader:ce,defines:P.defines,customVertexShaderID:ye,customFragmentShaderID:me,isRawShaderMaterial:P.isRawShaderMaterial===!0,glslVersion:P.glslVersion,precision:m,batching:he,instancing:Ne,instancingColor:Ne&&$.instanceColor!==null,supportsVertexTextures:g,outputColorSpace:be===null?t.outputColorSpace:be.isXRRenderTarget===!0?be.texture.colorSpace:Wo,map:Ae,matcap:Be,envMap:le,envMapMode:le&&V.mapping,envMapCubeUVHeight:Y,aoMap:lt,lightMap:z,bumpMap:G,normalMap:ne,displacementMap:g&&Q,emissiveMap:ee,normalMapObjectSpace:ne&&P.normalMapType===one,normalMapTangentSpace:ne&&P.normalMapType===LB,metalnessMap:ae,roughnessMap:ie,anisotropy:we,anisotropyMap:pe,clearcoat:ve,clearcoatMap:xe,clearcoatNormalMap:fe,clearcoatRoughnessMap:Ke,iridescence:k,iridescenceMap:Ie,iridescenceThicknessMap:$e,sheen:O,sheenColorMap:rt,sheenRoughnessMap:ke,specularMap:De,specularColorMap:ct,specularIntensityMap:et,transmission:K,transmissionMap:Je,thicknessMap:st,gradientMap:ue,opaque:P.transparent===!1&&P.blending===cf,alphaMap:tt,alphaTest:de,alphaHash:Le,combine:P.combine,mapUv:Ae&&y(P.map.channel),aoMapUv:lt&&y(P.aoMap.channel),lightMapUv:z&&y(P.lightMap.channel),bumpMapUv:G&&y(P.bumpMap.channel),normalMapUv:ne&&y(P.normalMap.channel),displacementMapUv:Q&&y(P.displacementMap.channel),emissiveMapUv:ee&&y(P.emissiveMap.channel),metalnessMapUv:ae&&y(P.metalnessMap.channel),roughnessMapUv:ie&&y(P.roughnessMap.channel),anisotropyMapUv:pe&&y(P.anisotropyMap.channel),clearcoatMapUv:xe&&y(P.clearcoatMap.channel),clearcoatNormalMapUv:fe&&y(P.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:Ke&&y(P.clearcoatRoughnessMap.channel),iridescenceMapUv:Ie&&y(P.iridescenceMap.channel),iridescenceThicknessMapUv:$e&&y(P.iridescenceThicknessMap.channel),sheenColorMapUv:rt&&y(P.sheenColorMap.channel),sheenRoughnessMapUv:ke&&y(P.sheenRoughnessMap.channel),specularMapUv:De&&y(P.specularMap.channel),specularColorMapUv:ct&&y(P.specularColorMap.channel),specularIntensityMapUv:et&&y(P.specularIntensityMap.channel),transmissionMapUv:Je&&y(P.transmissionMap.channel),thicknessMapUv:st&&y(P.thicknessMap.channel),alphaMapUv:tt&&y(P.alphaMap.channel),vertexTangents:!!W.attributes.tangent&&(ne||we),vertexColors:P.vertexColors,vertexAlphas:P.vertexColors===!0&&!!W.attributes.color&&W.attributes.color.itemSize===4,vertexUv1s:ge,vertexUv2s:je,vertexUv3s:at,pointsUvs:$.isPoints===!0&&!!W.attributes.uv&&(Ae||tt),fog:!!I,useFog:P.fog===!0,fogExp2:I&&I.isFogExp2,flatShading:P.flatShading===!0,sizeAttenuation:P.sizeAttenuation===!0,logarithmicDepthBuffer:h,skinning:$.isSkinnedMesh===!0,morphTargets:W.morphAttributes.position!==void 0,morphNormals:W.morphAttributes.normal!==void 0,morphColors:W.morphAttributes.color!==void 0,morphTargetsCount:H,morphTextureStride:q,numDirLights:L.directional.length,numPointLights:L.point.length,numSpotLights:L.spot.length,numSpotLightMaps:L.spotLightMap.length,numRectAreaLights:L.rectArea.length,numHemiLights:L.hemi.length,numDirLightShadows:L.directionalShadowMap.length,numPointLightShadows:L.pointShadowMap.length,numSpotLightShadows:L.spotShadowMap.length,numSpotLightShadowsWithMaps:L.numSpotLightShadowsWithMaps,numLightProbes:L.numLightProbes,numClippingPlanes:s.numPlanes,numClipIntersection:s.numIntersection,dithering:P.dithering,shadowMapEnabled:t.shadowMap.enabled&&B.length>0,shadowMapType:t.shadowMap.type,toneMapping:mt,useLegacyLights:t._useLegacyLights,decodeVideoTexture:Ae&&P.map.isVideoTexture===!0&&An.getTransfer(P.map.colorSpace)===Fn,premultipliedAlpha:P.premultipliedAlpha,doubleSided:P.side===Po,flipSided:P.side===Zr,useDepthPacking:P.depthPacking>=0,depthPacking:P.depthPacking||0,index0AttributeName:P.index0AttributeName,extensionDerivatives:Me&&P.extensions.derivatives===!0,extensionFragDepth:Me&&P.extensions.fragDepth===!0,extensionDrawBuffers:Me&&P.extensions.drawBuffers===!0,extensionShaderTextureLOD:Me&&P.extensions.shaderTextureLOD===!0,rendererExtensionFragDepth:f||i.has("EXT_frag_depth"),rendererExtensionDrawBuffers:f||i.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:f||i.has("EXT_shader_texture_lod"),rendererExtensionParallelShaderCompile:i.has("KHR_parallel_shader_compile"),customProgramCacheKey:P.customProgramCacheKey()}}function v(P){const L=[];if(P.shaderID?L.push(P.shaderID):(L.push(P.customVertexShaderID),L.push(P.customFragmentShaderID)),P.defines!==void 0)for(const B in P.defines)L.push(B),L.push(P.defines[B]);return P.isRawShaderMaterial===!1&&(w(L,P),S(L,P),L.push(t.outputColorSpace)),L.push(P.customProgramCacheKey),L.join()}function w(P,L){P.push(L.precision),P.push(L.outputColorSpace),P.push(L.envMapMode),P.push(L.envMapCubeUVHeight),P.push(L.mapUv),P.push(L.alphaMapUv),P.push(L.lightMapUv),P.push(L.aoMapUv),P.push(L.bumpMapUv),P.push(L.normalMapUv),P.push(L.displacementMapUv),P.push(L.emissiveMapUv),P.push(L.metalnessMapUv),P.push(L.roughnessMapUv),P.push(L.anisotropyMapUv),P.push(L.clearcoatMapUv),P.push(L.clearcoatNormalMapUv),P.push(L.clearcoatRoughnessMapUv),P.push(L.iridescenceMapUv),P.push(L.iridescenceThicknessMapUv),P.push(L.sheenColorMapUv),P.push(L.sheenRoughnessMapUv),P.push(L.specularMapUv),P.push(L.specularColorMapUv),P.push(L.specularIntensityMapUv),P.push(L.transmissionMapUv),P.push(L.thicknessMapUv),P.push(L.combine),P.push(L.fogExp2),P.push(L.sizeAttenuation),P.push(L.morphTargetsCount),P.push(L.morphAttributeCount),P.push(L.numDirLights),P.push(L.numPointLights),P.push(L.numSpotLights),P.push(L.numSpotLightMaps),P.push(L.numHemiLights),P.push(L.numRectAreaLights),P.push(L.numDirLightShadows),P.push(L.numPointLightShadows),P.push(L.numSpotLightShadows),P.push(L.numSpotLightShadowsWithMaps),P.push(L.numLightProbes),P.push(L.shadowMapType),P.push(L.toneMapping),P.push(L.numClippingPlanes),P.push(L.numClipIntersection),P.push(L.depthPacking)}function S(P,L){l.disableAll(),L.isWebGL2&&l.enable(0),L.supportsVertexTextures&&l.enable(1),L.instancing&&l.enable(2),L.instancingColor&&l.enable(3),L.matcap&&l.enable(4),L.envMap&&l.enable(5),L.normalMapObjectSpace&&l.enable(6),L.normalMapTangentSpace&&l.enable(7),L.clearcoat&&l.enable(8),L.iridescence&&l.enable(9),L.alphaTest&&l.enable(10),L.vertexColors&&l.enable(11),L.vertexAlphas&&l.enable(12),L.vertexUv1s&&l.enable(13),L.vertexUv2s&&l.enable(14),L.vertexUv3s&&l.enable(15),L.vertexTangents&&l.enable(16),L.anisotropy&&l.enable(17),L.alphaHash&&l.enable(18),L.batching&&l.enable(19),P.push(l.mask),l.disableAll(),L.fog&&l.enable(0),L.useFog&&l.enable(1),L.flatShading&&l.enable(2),L.logarithmicDepthBuffer&&l.enable(3),L.skinning&&l.enable(4),L.morphTargets&&l.enable(5),L.morphNormals&&l.enable(6),L.morphColors&&l.enable(7),L.premultipliedAlpha&&l.enable(8),L.shadowMapEnabled&&l.enable(9),L.useLegacyLights&&l.enable(10),L.doubleSided&&l.enable(11),L.flipSided&&l.enable(12),L.useDepthPacking&&l.enable(13),L.dithering&&l.enable(14),L.transmission&&l.enable(15),L.sheen&&l.enable(16),L.opaque&&l.enable(17),L.pointsUvs&&l.enable(18),L.decodeVideoTexture&&l.enable(19),P.push(l.mask)}function A(P){const L=b[P.type];let B;if(L){const U=qr[L];B=FT.clone(U.uniforms)}else B=P.uniforms;return B}function R(P,L){let B;for(let U=0,$=d.length;U<$;U++){const I=d[U];if(I.cacheKey===L){B=I,++B.usedTimes;break}}return B===void 0&&(B=new soe(t,L,P,a),d.push(B)),B}function N(P){if(--P.usedTimes===0){const L=d.indexOf(P);d[L]=d[d.length-1],d.pop(),P.destroy()}}function C(P){c.remove(P)}function F(){c.dispose()}return{getParameters:x,getProgramCacheKey:v,getUniforms:A,acquireProgram:R,releaseProgram:N,releaseShaderCache:C,programs:d,dispose:F}}function doe(){let t=new WeakMap;function e(a){let s=t.get(a);return s===void 0&&(s={},t.set(a,s)),s}function n(a){t.delete(a)}function i(a,s,l){t.get(a)[s]=l}function r(){t=new WeakMap}return{get:e,remove:n,update:i,dispose:r}}function foe(t,e){return t.groupOrder!==e.groupOrder?t.groupOrder-e.groupOrder:t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.material.id!==e.material.id?t.material.id-e.material.id:t.z!==e.z?t.z-e.z:t.id-e.id}function zL(t,e){return t.groupOrder!==e.groupOrder?t.groupOrder-e.groupOrder:t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.z!==e.z?e.z-t.z:t.id-e.id}function BL(){const t=[];let e=0;const n=[],i=[],r=[];function a(){e=0,n.length=0,i.length=0,r.length=0}function s(h,g,m,b,y,x){let v=t[e];return v===void 0?(v={id:h.id,object:h,geometry:g,material:m,groupOrder:b,renderOrder:h.renderOrder,z:y,group:x},t[e]=v):(v.id=h.id,v.object=h,v.geometry=g,v.material=m,v.groupOrder=b,v.renderOrder=h.renderOrder,v.z=y,v.group=x),e++,v}function l(h,g,m,b,y,x){const v=s(h,g,m,b,y,x);m.transmission>0?i.push(v):m.transparent===!0?r.push(v):n.push(v)}function c(h,g,m,b,y,x){const v=s(h,g,m,b,y,x);m.transmission>0?i.unshift(v):m.transparent===!0?r.unshift(v):n.unshift(v)}function d(h,g){n.length>1&&n.sort(h||foe),i.length>1&&i.sort(g||zL),r.length>1&&r.sort(g||zL)}function f(){for(let h=e,g=t.length;h<g;h++){const m=t[h];if(m.id===null)break;m.id=null,m.object=null,m.geometry=null,m.material=null,m.group=null}}return{opaque:n,transmissive:i,transparent:r,init:a,push:l,unshift:c,finish:f,sort:d}}function hoe(){let t=new WeakMap;function e(i,r){const a=t.get(i);let s;return a===void 0?(s=new BL,t.set(i,[s])):r>=a.length?(s=new BL,a.push(s)):s=a[r],s}function n(){t=new WeakMap}return{get:e,dispose:n}}function poe(){const t={};return{get:function(e){if(t[e.id]!==void 0)return t[e.id];let n;switch(e.type){case"DirectionalLight":n={direction:new Ce,color:new Nt};break;case"SpotLight":n={position:new Ce,direction:new Ce,color:new Nt,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new Ce,color:new Nt,distance:0,decay:0};break;case"HemisphereLight":n={direction:new Ce,skyColor:new Nt,groundColor:new Nt};break;case"RectAreaLight":n={color:new Nt,position:new Ce,halfWidth:new Ce,halfHeight:new Ce};break}return t[e.id]=n,n}}}function moe(){const t={};return{get:function(e){if(t[e.id]!==void 0)return t[e.id];let n;switch(e.type){case"DirectionalLight":n={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ut};break;case"SpotLight":n={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ut};break;case"PointLight":n={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ut,shadowCameraNear:1,shadowCameraFar:1e3};break}return t[e.id]=n,n}}}let goe=0;function voe(t,e){return(e.castShadow?2:0)-(t.castShadow?2:0)+(e.map?1:0)-(t.map?1:0)}function xoe(t,e){const n=new poe,i=moe(),r={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-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,numLightProbes:0};for(let f=0;f<9;f++)r.probe.push(new Ce);const a=new Ce,s=new Ln,l=new Ln;function c(f,h){let g=0,m=0,b=0;for(let U=0;U<9;U++)r.probe[U].set(0,0,0);let y=0,x=0,v=0,w=0,S=0,A=0,R=0,N=0,C=0,F=0,P=0;f.sort(voe);const L=h===!0?Math.PI:1;for(let U=0,$=f.length;U<$;U++){const I=f[U],W=I.color,X=I.intensity,V=I.distance,Y=I.shadow&&I.shadow.map?I.shadow.map.texture:null;if(I.isAmbientLight)g+=W.r*X*L,m+=W.g*X*L,b+=W.b*X*L;else if(I.isLightProbe){for(let J=0;J<9;J++)r.probe[J].addScaledVector(I.sh.coefficients[J],X);P++}else if(I.isDirectionalLight){const J=n.get(I);if(J.color.copy(I.color).multiplyScalar(I.intensity*L),I.castShadow){const se=I.shadow,H=i.get(I);H.shadowBias=se.bias,H.shadowNormalBias=se.normalBias,H.shadowRadius=se.radius,H.shadowMapSize=se.mapSize,r.directionalShadow[y]=H,r.directionalShadowMap[y]=Y,r.directionalShadowMatrix[y]=I.shadow.matrix,A++}r.directional[y]=J,y++}else if(I.isSpotLight){const J=n.get(I);J.position.setFromMatrixPosition(I.matrixWorld),J.color.copy(W).multiplyScalar(X*L),J.distance=V,J.coneCos=Math.cos(I.angle),J.penumbraCos=Math.cos(I.angle*(1-I.penumbra)),J.decay=I.decay,r.spot[v]=J;const se=I.shadow;if(I.map&&(r.spotLightMap[C]=I.map,C++,se.updateMatrices(I),I.castShadow&&F++),r.spotLightMatrix[v]=se.matrix,I.castShadow){const H=i.get(I);H.shadowBias=se.bias,H.shadowNormalBias=se.normalBias,H.shadowRadius=se.radius,H.shadowMapSize=se.mapSize,r.spotShadow[v]=H,r.spotShadowMap[v]=Y,N++}v++}else if(I.isRectAreaLight){const J=n.get(I);J.color.copy(W).multiplyScalar(X),J.halfWidth.set(I.width*.5,0,0),J.halfHeight.set(0,I.height*.5,0),r.rectArea[w]=J,w++}else if(I.isPointLight){const J=n.get(I);if(J.color.copy(I.color).multiplyScalar(I.intensity*L),J.distance=I.distance,J.decay=I.decay,I.castShadow){const se=I.shadow,H=i.get(I);H.shadowBias=se.bias,H.shadowNormalBias=se.normalBias,H.shadowRadius=se.radius,H.shadowMapSize=se.mapSize,H.shadowCameraNear=se.camera.near,H.shadowCameraFar=se.camera.far,r.pointShadow[x]=H,r.pointShadowMap[x]=Y,r.pointShadowMatrix[x]=I.shadow.matrix,R++}r.point[x]=J,x++}else if(I.isHemisphereLight){const J=n.get(I);J.skyColor.copy(I.color).multiplyScalar(X*L),J.groundColor.copy(I.groundColor).multiplyScalar(X*L),r.hemi[S]=J,S++}}w>0&&(e.isWebGL2||t.has("OES_texture_float_linear")===!0?(r.rectAreaLTC1=ht.LTC_FLOAT_1,r.rectAreaLTC2=ht.LTC_FLOAT_2):t.has("OES_texture_half_float_linear")===!0?(r.rectAreaLTC1=ht.LTC_HALF_1,r.rectAreaLTC2=ht.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),r.ambient[0]=g,r.ambient[1]=m,r.ambient[2]=b;const B=r.hash;(B.directionalLength!==y||B.pointLength!==x||B.spotLength!==v||B.rectAreaLength!==w||B.hemiLength!==S||B.numDirectionalShadows!==A||B.numPointShadows!==R||B.numSpotShadows!==N||B.numSpotMaps!==C||B.numLightProbes!==P)&&(r.directional.length=y,r.spot.length=v,r.rectArea.length=w,r.point.length=x,r.hemi.length=S,r.directionalShadow.length=A,r.directionalShadowMap.length=A,r.pointShadow.length=R,r.pointShadowMap.length=R,r.spotShadow.length=N,r.spotShadowMap.length=N,r.directionalShadowMatrix.length=A,r.pointShadowMatrix.length=R,r.spotLightMatrix.length=N+C-F,r.spotLightMap.length=C,r.numSpotLightShadowsWithMaps=F,r.numLightProbes=P,B.directionalLength=y,B.pointLength=x,B.spotLength=v,B.rectAreaLength=w,B.hemiLength=S,B.numDirectionalShadows=A,B.numPointShadows=R,B.numSpotShadows=N,B.numSpotMaps=C,B.numLightProbes=P,r.version=goe++)}function d(f,h){let g=0,m=0,b=0,y=0,x=0;const v=h.matrixWorldInverse;for(let w=0,S=f.length;w<S;w++){const A=f[w];if(A.isDirectionalLight){const R=r.directional[g];R.direction.setFromMatrixPosition(A.matrixWorld),a.setFromMatrixPosition(A.target.matrixWorld),R.direction.sub(a),R.direction.transformDirection(v),g++}else if(A.isSpotLight){const R=r.spot[b];R.position.setFromMatrixPosition(A.matrixWorld),R.position.applyMatrix4(v),R.direction.setFromMatrixPosition(A.matrixWorld),a.setFromMatrixPosition(A.target.matrixWorld),R.direction.sub(a),R.direction.transformDirection(v),b++}else if(A.isRectAreaLight){const R=r.rectArea[y];R.position.setFromMatrixPosition(A.matrixWorld),R.position.applyMatrix4(v),l.identity(),s.copy(A.matrixWorld),s.premultiply(v),l.extractRotation(s),R.halfWidth.set(A.width*.5,0,0),R.halfHeight.set(0,A.height*.5,0),R.halfWidth.applyMatrix4(l),R.halfHeight.applyMatrix4(l),y++}else if(A.isPointLight){const R=r.point[m];R.position.setFromMatrixPosition(A.matrixWorld),R.position.applyMatrix4(v),m++}else if(A.isHemisphereLight){const R=r.hemi[x];R.direction.setFromMatrixPosition(A.matrixWorld),R.direction.transformDirection(v),x++}}}return{setup:c,setupView:d,state:r}}function jL(t,e){const n=new xoe(t,e),i=[],r=[];function a(){i.length=0,r.length=0}function s(h){i.push(h)}function l(h){r.push(h)}function c(h){n.setup(i,h)}function d(h){n.setupView(i,h)}return{init:a,state:{lightsArray:i,shadowsArray:r,lights:n},setupLights:c,setupLightsView:d,pushLight:s,pushShadow:l}}function yoe(t,e){let n=new WeakMap;function i(a,s=0){const l=n.get(a);let c;return l===void 0?(c=new jL(t,e),n.set(a,[c])):s>=l.length?(c=new jL(t,e),l.push(c)):c=l[s],c}function r(){n=new WeakMap}return{get:i,dispose:r}}class boe extends Gf{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=ane,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 _oe extends Gf{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",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.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}const Soe=`void main() {
  7369. gl_Position = vec4( position, 1.0 );
  7370. }`,woe=`uniform sampler2D shadow_pass;
  7371. uniform vec2 resolution;
  7372. uniform float radius;
  7373. #include <packing>
  7374. void main() {
  7375. const float samples = float( VSM_SAMPLES );
  7376. float mean = 0.0;
  7377. float squared_mean = 0.0;
  7378. float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );
  7379. float uvStart = samples <= 1.0 ? 0.0 : - 1.0;
  7380. for ( float i = 0.0; i < samples; i ++ ) {
  7381. float uvOffset = uvStart + i * uvStride;
  7382. #ifdef HORIZONTAL_PASS
  7383. vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) );
  7384. mean += distribution.x;
  7385. squared_mean += distribution.y * distribution.y + distribution.x * distribution.x;
  7386. #else
  7387. float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) );
  7388. mean += depth;
  7389. squared_mean += depth * depth;
  7390. #endif
  7391. }
  7392. mean = mean / samples;
  7393. squared_mean = squared_mean / samples;
  7394. float std_dev = sqrt( squared_mean - mean * mean );
  7395. gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );
  7396. }`;function Eoe(t,e,n){let i=new yy;const r=new Ut,a=new Ut,s=new Cn,l=new boe({depthPacking:sne}),c=new _oe,d={},f=n.maxTextureSize,h={[cc]:Zr,[Zr]:cc,[Po]:Po},g=new uc({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Ut},radius:{value:4}},vertexShader:Soe,fragmentShader:woe}),m=g.clone();m.defines.HORIZONTAL_PASS=1;const b=new Mr;b.setAttribute("position",new ya(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const y=new gs(b,g),x=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=EB;let v=this.type;this.render=function(R,N,C){if(x.enabled===!1||x.autoUpdate===!1&&x.needsUpdate===!1||R.length===0)return;const F=t.getRenderTarget(),P=t.getActiveCubeFace(),L=t.getActiveMipmapLevel(),B=t.state;B.setBlending(ic),B.buffers.color.setClear(1,1,1,1),B.buffers.depth.setTest(!0),B.setScissorTest(!1);const U=v!==Co&&this.type===Co,$=v===Co&&this.type!==Co;for(let I=0,W=R.length;I<W;I++){const X=R[I],V=X.shadow;if(V===void 0){console.warn("THREE.WebGLShadowMap:",X,"has no shadow.");continue}if(V.autoUpdate===!1&&V.needsUpdate===!1)continue;r.copy(V.mapSize);const Y=V.getFrameExtents();if(r.multiply(Y),a.copy(V.mapSize),(r.x>f||r.y>f)&&(r.x>f&&(a.x=Math.floor(f/Y.x),r.x=a.x*Y.x,V.mapSize.x=a.x),r.y>f&&(a.y=Math.floor(f/Y.y),r.y=a.y*Y.y,V.mapSize.y=a.y)),V.map===null||U===!0||$===!0){const se=this.type!==Co?{minFilter:dr,magFilter:dr}:{};V.map!==null&&V.map.dispose(),V.map=new Eu(r.x,r.y,se),V.map.texture.name=X.name+".shadowMap",V.camera.updateProjectionMatrix()}t.setRenderTarget(V.map),t.clear();const J=V.getViewportCount();for(let se=0;se<J;se++){const H=V.getViewport(se);s.set(a.x*H.x,a.y*H.y,a.x*H.z,a.y*H.w),B.viewport(s),V.updateMatrices(X,se),i=V.getFrustum(),A(N,C,V.camera,X,this.type)}V.isPointLightShadow!==!0&&this.type===Co&&w(V,C),V.needsUpdate=!1}v=this.type,x.needsUpdate=!1,t.setRenderTarget(F,P,L)};function w(R,N){const C=e.update(y);g.defines.VSM_SAMPLES!==R.blurSamples&&(g.defines.VSM_SAMPLES=R.blurSamples,m.defines.VSM_SAMPLES=R.blurSamples,g.needsUpdate=!0,m.needsUpdate=!0),R.mapPass===null&&(R.mapPass=new Eu(r.x,r.y)),g.uniforms.shadow_pass.value=R.map.texture,g.uniforms.resolution.value=R.mapSize,g.uniforms.radius.value=R.radius,t.setRenderTarget(R.mapPass),t.clear(),t.renderBufferDirect(N,null,C,g,y,null),m.uniforms.shadow_pass.value=R.mapPass.texture,m.uniforms.resolution.value=R.mapSize,m.uniforms.radius.value=R.radius,t.setRenderTarget(R.map),t.clear(),t.renderBufferDirect(N,null,C,m,y,null)}function S(R,N,C,F){let P=null;const L=C.isPointLight===!0?R.customDistanceMaterial:R.customDepthMaterial;if(L!==void 0)P=L;else if(P=C.isPointLight===!0?c:l,t.localClippingEnabled&&N.clipShadows===!0&&Array.isArray(N.clippingPlanes)&&N.clippingPlanes.length!==0||N.displacementMap&&N.displacementScale!==0||N.alphaMap&&N.alphaTest>0||N.map&&N.alphaTest>0){const B=P.uuid,U=N.uuid;let $=d[B];$===void 0&&($={},d[B]=$);let I=$[U];I===void 0&&(I=P.clone(),$[U]=I),P=I}if(P.visible=N.visible,P.wireframe=N.wireframe,F===Co?P.side=N.shadowSide!==null?N.shadowSide:N.side:P.side=N.shadowSide!==null?N.shadowSide:h[N.side],P.alphaMap=N.alphaMap,P.alphaTest=N.alphaTest,P.map=N.map,P.clipShadows=N.clipShadows,P.clippingPlanes=N.clippingPlanes,P.clipIntersection=N.clipIntersection,P.displacementMap=N.displacementMap,P.displacementScale=N.displacementScale,P.displacementBias=N.displacementBias,P.wireframeLinewidth=N.wireframeLinewidth,P.linewidth=N.linewidth,C.isPointLight===!0&&P.isMeshDistanceMaterial===!0){const B=t.properties.get(P);B.light=C}return P}function A(R,N,C,F,P){if(R.visible===!1)return;if(R.layers.test(N.layers)&&(R.isMesh||R.isLine||R.isPoints)&&(R.castShadow||R.receiveShadow&&P===Co)&&(!R.frustumCulled||i.intersectsObject(R))){R.modelViewMatrix.multiplyMatrices(C.matrixWorldInverse,R.matrixWorld);const U=e.update(R),$=R.material;if(Array.isArray($)){const I=U.groups;for(let W=0,X=I.length;W<X;W++){const V=I[W],Y=$[V.materialIndex];if(Y&&Y.visible){const J=S(R,Y,F,P);R.onBeforeShadow(t,R,N,C,U,J,V),t.renderBufferDirect(C,null,U,J,R,V),R.onAfterShadow(t,R,N,C,U,J,V)}}}else if($.visible){const I=S(R,$,F,P);R.onBeforeShadow(t,R,N,C,U,I,null),t.renderBufferDirect(C,null,U,I,R,null),R.onAfterShadow(t,R,N,C,U,I,null)}}const B=R.children;for(let U=0,$=B.length;U<$;U++)A(B[U],N,C,F,P)}}function Moe(t,e,n){const i=n.isWebGL2;function r(){let de=!1;const Le=new Cn;let Me=null;const ge=new Cn(0,0,0,0);return{setMask:function(je){Me!==je&&!de&&(t.colorMask(je,je,je,je),Me=je)},setLocked:function(je){de=je},setClear:function(je,at,mt,wt,Wt){Wt===!0&&(je*=wt,at*=wt,mt*=wt),Le.set(je,at,mt,wt),ge.equals(Le)===!1&&(t.clearColor(je,at,mt,wt),ge.copy(Le))},reset:function(){de=!1,Me=null,ge.set(-1,0,0,0)}}}function a(){let de=!1,Le=null,Me=null,ge=null;return{setTest:function(je){je?he(t.DEPTH_TEST):Ae(t.DEPTH_TEST)},setMask:function(je){Le!==je&&!de&&(t.depthMask(je),Le=je)},setFunc:function(je){if(Me!==je){switch(je){case Ute:t.depthFunc(t.NEVER);break;case kte:t.depthFunc(t.ALWAYS);break;case Fte:t.depthFunc(t.LESS);break;case rx:t.depthFunc(t.LEQUAL);break;case zte:t.depthFunc(t.EQUAL);break;case Bte:t.depthFunc(t.GEQUAL);break;case jte:t.depthFunc(t.GREATER);break;case Hte:t.depthFunc(t.NOTEQUAL);break;default:t.depthFunc(t.LEQUAL)}Me=je}},setLocked:function(je){de=je},setClear:function(je){ge!==je&&(t.clearDepth(je),ge=je)},reset:function(){de=!1,Le=null,Me=null,ge=null}}}function s(){let de=!1,Le=null,Me=null,ge=null,je=null,at=null,mt=null,wt=null,Wt=null;return{setTest:function(Ct){de||(Ct?he(t.STENCIL_TEST):Ae(t.STENCIL_TEST))},setMask:function(Ct){Le!==Ct&&!de&&(t.stencilMask(Ct),Le=Ct)},setFunc:function(Ct,mn,Rn){(Me!==Ct||ge!==mn||je!==Rn)&&(t.stencilFunc(Ct,mn,Rn),Me=Ct,ge=mn,je=Rn)},setOp:function(Ct,mn,Rn){(at!==Ct||mt!==mn||wt!==Rn)&&(t.stencilOp(Ct,mn,Rn),at=Ct,mt=mn,wt=Rn)},setLocked:function(Ct){de=Ct},setClear:function(Ct){Wt!==Ct&&(t.clearStencil(Ct),Wt=Ct)},reset:function(){de=!1,Le=null,Me=null,ge=null,je=null,at=null,mt=null,wt=null,Wt=null}}}const l=new r,c=new a,d=new s,f=new WeakMap,h=new WeakMap;let g={},m={},b=new WeakMap,y=[],x=null,v=!1,w=null,S=null,A=null,R=null,N=null,C=null,F=null,P=new Nt(0,0,0),L=0,B=!1,U=null,$=null,I=null,W=null,X=null;const V=t.getParameter(t.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let Y=!1,J=0;const se=t.getParameter(t.VERSION);se.indexOf("WebGL")!==-1?(J=parseFloat(/^WebGL (\d)/.exec(se)[1]),Y=J>=1):se.indexOf("OpenGL ES")!==-1&&(J=parseFloat(/^OpenGL ES (\d)/.exec(se)[1]),Y=J>=2);let H=null,q={};const re=t.getParameter(t.SCISSOR_BOX),ce=t.getParameter(t.VIEWPORT),ye=new Cn().fromArray(re),me=new Cn().fromArray(ce);function be(de,Le,Me,ge){const je=new Uint8Array(4),at=t.createTexture();t.bindTexture(de,at),t.texParameteri(de,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(de,t.TEXTURE_MAG_FILTER,t.NEAREST);for(let mt=0;mt<Me;mt++)i&&(de===t.TEXTURE_3D||de===t.TEXTURE_2D_ARRAY)?t.texImage3D(Le,0,t.RGBA,1,1,ge,0,t.RGBA,t.UNSIGNED_BYTE,je):t.texImage2D(Le+mt,0,t.RGBA,1,1,0,t.RGBA,t.UNSIGNED_BYTE,je);return at}const Ne={};Ne[t.TEXTURE_2D]=be(t.TEXTURE_2D,t.TEXTURE_2D,1),Ne[t.TEXTURE_CUBE_MAP]=be(t.TEXTURE_CUBE_MAP,t.TEXTURE_CUBE_MAP_POSITIVE_X,6),i&&(Ne[t.TEXTURE_2D_ARRAY]=be(t.TEXTURE_2D_ARRAY,t.TEXTURE_2D_ARRAY,1,1),Ne[t.TEXTURE_3D]=be(t.TEXTURE_3D,t.TEXTURE_3D,1,1)),l.setClear(0,0,0,1),c.setClear(1),d.setClear(0),he(t.DEPTH_TEST),c.setFunc(rx),ee(!1),ae(wO),he(t.CULL_FACE),ne(ic);function he(de){g[de]!==!0&&(t.enable(de),g[de]=!0)}function Ae(de){g[de]!==!1&&(t.disable(de),g[de]=!1)}function Be(de,Le){return m[de]!==Le?(t.bindFramebuffer(de,Le),m[de]=Le,i&&(de===t.DRAW_FRAMEBUFFER&&(m[t.FRAMEBUFFER]=Le),de===t.FRAMEBUFFER&&(m[t.DRAW_FRAMEBUFFER]=Le)),!0):!1}function le(de,Le){let Me=y,ge=!1;if(de)if(Me=b.get(Le),Me===void 0&&(Me=[],b.set(Le,Me)),de.isWebGLMultipleRenderTargets){const je=de.texture;if(Me.length!==je.length||Me[0]!==t.COLOR_ATTACHMENT0){for(let at=0,mt=je.length;at<mt;at++)Me[at]=t.COLOR_ATTACHMENT0+at;Me.length=je.length,ge=!0}}else Me[0]!==t.COLOR_ATTACHMENT0&&(Me[0]=t.COLOR_ATTACHMENT0,ge=!0);else Me[0]!==t.BACK&&(Me[0]=t.BACK,ge=!0);ge&&(n.isWebGL2?t.drawBuffers(Me):e.get("WEBGL_draw_buffers").drawBuffersWEBGL(Me))}function lt(de){return x!==de?(t.useProgram(de),x=de,!0):!1}const z={[Jc]:t.FUNC_ADD,[_te]:t.FUNC_SUBTRACT,[Ste]:t.FUNC_REVERSE_SUBTRACT};if(i)z[TO]=t.MIN,z[CO]=t.MAX;else{const de=e.get("EXT_blend_minmax");de!==null&&(z[TO]=de.MIN_EXT,z[CO]=de.MAX_EXT)}const G={[wte]:t.ZERO,[Ete]:t.ONE,[Mte]:t.SRC_COLOR,[IM]:t.SRC_ALPHA,[Dte]:t.SRC_ALPHA_SATURATE,[Rte]:t.DST_COLOR,[Tte]:t.DST_ALPHA,[Ate]:t.ONE_MINUS_SRC_COLOR,[UM]:t.ONE_MINUS_SRC_ALPHA,[Pte]:t.ONE_MINUS_DST_COLOR,[Cte]:t.ONE_MINUS_DST_ALPHA,[Nte]:t.CONSTANT_COLOR,[Ote]:t.ONE_MINUS_CONSTANT_COLOR,[Lte]:t.CONSTANT_ALPHA,[Ite]:t.ONE_MINUS_CONSTANT_ALPHA};function ne(de,Le,Me,ge,je,at,mt,wt,Wt,Ct){if(de===ic){v===!0&&(Ae(t.BLEND),v=!1);return}if(v===!1&&(he(t.BLEND),v=!0),de!==bte){if(de!==w||Ct!==B){if((S!==Jc||N!==Jc)&&(t.blendEquation(t.FUNC_ADD),S=Jc,N=Jc),Ct)switch(de){case cf:t.blendFuncSeparate(t.ONE,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA);break;case EO:t.blendFunc(t.ONE,t.ONE);break;case MO:t.blendFuncSeparate(t.ZERO,t.ONE_MINUS_SRC_COLOR,t.ZERO,t.ONE);break;case AO:t.blendFuncSeparate(t.ZERO,t.SRC_COLOR,t.ZERO,t.SRC_ALPHA);break;default:console.error("THREE.WebGLState: Invalid blending: ",de);break}else switch(de){case cf:t.blendFuncSeparate(t.SRC_ALPHA,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA);break;case EO:t.blendFunc(t.SRC_ALPHA,t.ONE);break;case MO:t.blendFuncSeparate(t.ZERO,t.ONE_MINUS_SRC_COLOR,t.ZERO,t.ONE);break;case AO:t.blendFunc(t.ZERO,t.SRC_COLOR);break;default:console.error("THREE.WebGLState: Invalid blending: ",de);break}A=null,R=null,C=null,F=null,P.set(0,0,0),L=0,w=de,B=Ct}return}je=je||Le,at=at||Me,mt=mt||ge,(Le!==S||je!==N)&&(t.blendEquationSeparate(z[Le],z[je]),S=Le,N=je),(Me!==A||ge!==R||at!==C||mt!==F)&&(t.blendFuncSeparate(G[Me],G[ge],G[at],G[mt]),A=Me,R=ge,C=at,F=mt),(wt.equals(P)===!1||Wt!==L)&&(t.blendColor(wt.r,wt.g,wt.b,Wt),P.copy(wt),L=Wt),w=de,B=!1}function Q(de,Le){de.side===Po?Ae(t.CULL_FACE):he(t.CULL_FACE);let Me=de.side===Zr;Le&&(Me=!Me),ee(Me),de.blending===cf&&de.transparent===!1?ne(ic):ne(de.blending,de.blendEquation,de.blendSrc,de.blendDst,de.blendEquationAlpha,de.blendSrcAlpha,de.blendDstAlpha,de.blendColor,de.blendAlpha,de.premultipliedAlpha),c.setFunc(de.depthFunc),c.setTest(de.depthTest),c.setMask(de.depthWrite),l.setMask(de.colorWrite);const ge=de.stencilWrite;d.setTest(ge),ge&&(d.setMask(de.stencilWriteMask),d.setFunc(de.stencilFunc,de.stencilRef,de.stencilFuncMask),d.setOp(de.stencilFail,de.stencilZFail,de.stencilZPass)),we(de.polygonOffset,de.polygonOffsetFactor,de.polygonOffsetUnits),de.alphaToCoverage===!0?he(t.SAMPLE_ALPHA_TO_COVERAGE):Ae(t.SAMPLE_ALPHA_TO_COVERAGE)}function ee(de){U!==de&&(de?t.frontFace(t.CW):t.frontFace(t.CCW),U=de)}function ae(de){de!==vte?(he(t.CULL_FACE),de!==$&&(de===wO?t.cullFace(t.BACK):de===xte?t.cullFace(t.FRONT):t.cullFace(t.FRONT_AND_BACK))):Ae(t.CULL_FACE),$=de}function ie(de){de!==I&&(Y&&t.lineWidth(de),I=de)}function we(de,Le,Me){de?(he(t.POLYGON_OFFSET_FILL),(W!==Le||X!==Me)&&(t.polygonOffset(Le,Me),W=Le,X=Me)):Ae(t.POLYGON_OFFSET_FILL)}function ve(de){de?he(t.SCISSOR_TEST):Ae(t.SCISSOR_TEST)}function k(de){de===void 0&&(de=t.TEXTURE0+V-1),H!==de&&(t.activeTexture(de),H=de)}function O(de,Le,Me){Me===void 0&&(H===null?Me=t.TEXTURE0+V-1:Me=H);let ge=q[Me];ge===void 0&&(ge={type:void 0,texture:void 0},q[Me]=ge),(ge.type!==de||ge.texture!==Le)&&(H!==Me&&(t.activeTexture(Me),H=Me),t.bindTexture(de,Le||Ne[de]),ge.type=de,ge.texture=Le)}function K(){const de=q[H];de!==void 0&&de.type!==void 0&&(t.bindTexture(de.type,null),de.type=void 0,de.texture=void 0)}function pe(){try{t.compressedTexImage2D.apply(t,arguments)}catch(de){console.error("THREE.WebGLState:",de)}}function xe(){try{t.compressedTexImage3D.apply(t,arguments)}catch(de){console.error("THREE.WebGLState:",de)}}function fe(){try{t.texSubImage2D.apply(t,arguments)}catch(de){console.error("THREE.WebGLState:",de)}}function Ke(){try{t.texSubImage3D.apply(t,arguments)}catch(de){console.error("THREE.WebGLState:",de)}}function Ie(){try{t.compressedTexSubImage2D.apply(t,arguments)}catch(de){console.error("THREE.WebGLState:",de)}}function $e(){try{t.compressedTexSubImage3D.apply(t,arguments)}catch(de){console.error("THREE.WebGLState:",de)}}function rt(){try{t.texStorage2D.apply(t,arguments)}catch(de){console.error("THREE.WebGLState:",de)}}function ke(){try{t.texStorage3D.apply(t,arguments)}catch(de){console.error("THREE.WebGLState:",de)}}function De(){try{t.texImage2D.apply(t,arguments)}catch(de){console.error("THREE.WebGLState:",de)}}function ct(){try{t.texImage3D.apply(t,arguments)}catch(de){console.error("THREE.WebGLState:",de)}}function et(de){ye.equals(de)===!1&&(t.scissor(de.x,de.y,de.z,de.w),ye.copy(de))}function Je(de){me.equals(de)===!1&&(t.viewport(de.x,de.y,de.z,de.w),me.copy(de))}function st(de,Le){let Me=h.get(Le);Me===void 0&&(Me=new WeakMap,h.set(Le,Me));let ge=Me.get(de);ge===void 0&&(ge=t.getUniformBlockIndex(Le,de.name),Me.set(de,ge))}function ue(de,Le){const ge=h.get(Le).get(de);f.get(Le)!==ge&&(t.uniformBlockBinding(Le,ge,de.__bindingPointIndex),f.set(Le,ge))}function tt(){t.disable(t.BLEND),t.disable(t.CULL_FACE),t.disable(t.DEPTH_TEST),t.disable(t.POLYGON_OFFSET_FILL),t.disable(t.SCISSOR_TEST),t.disable(t.STENCIL_TEST),t.disable(t.SAMPLE_ALPHA_TO_COVERAGE),t.blendEquation(t.FUNC_ADD),t.blendFunc(t.ONE,t.ZERO),t.blendFuncSeparate(t.ONE,t.ZERO,t.ONE,t.ZERO),t.blendColor(0,0,0,0),t.colorMask(!0,!0,!0,!0),t.clearColor(0,0,0,0),t.depthMask(!0),t.depthFunc(t.LESS),t.clearDepth(1),t.stencilMask(4294967295),t.stencilFunc(t.ALWAYS,0,4294967295),t.stencilOp(t.KEEP,t.KEEP,t.KEEP),t.clearStencil(0),t.cullFace(t.BACK),t.frontFace(t.CCW),t.polygonOffset(0,0),t.activeTexture(t.TEXTURE0),t.bindFramebuffer(t.FRAMEBUFFER,null),i===!0&&(t.bindFramebuffer(t.DRAW_FRAMEBUFFER,null),t.bindFramebuffer(t.READ_FRAMEBUFFER,null)),t.useProgram(null),t.lineWidth(1),t.scissor(0,0,t.canvas.width,t.canvas.height),t.viewport(0,0,t.canvas.width,t.canvas.height),g={},H=null,q={},m={},b=new WeakMap,y=[],x=null,v=!1,w=null,S=null,A=null,R=null,N=null,C=null,F=null,P=new Nt(0,0,0),L=0,B=!1,U=null,$=null,I=null,W=null,X=null,ye.set(0,0,t.canvas.width,t.canvas.height),me.set(0,0,t.canvas.width,t.canvas.height),l.reset(),c.reset(),d.reset()}return{buffers:{color:l,depth:c,stencil:d},enable:he,disable:Ae,bindFramebuffer:Be,drawBuffers:le,useProgram:lt,setBlending:ne,setMaterial:Q,setFlipSided:ee,setCullFace:ae,setLineWidth:ie,setPolygonOffset:we,setScissorTest:ve,activeTexture:k,bindTexture:O,unbindTexture:K,compressedTexImage2D:pe,compressedTexImage3D:xe,texImage2D:De,texImage3D:ct,updateUBOMapping:st,uniformBlockBinding:ue,texStorage2D:rt,texStorage3D:ke,texSubImage2D:fe,texSubImage3D:Ke,compressedTexSubImage2D:Ie,compressedTexSubImage3D:$e,scissor:et,viewport:Je,reset:tt}}function Aoe(t,e,n,i,r,a,s){const l=r.isWebGL2,c=r.maxTextures,d=r.maxCubemapSize,f=r.maxTextureSize,h=r.maxSamples,g=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,m=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),b=new WeakMap;let y;const x=new WeakMap;let v=!1;try{v=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function w(k,O){return v?new OffscreenCanvas(k,O):cx("canvas")}function S(k,O,K,pe){let xe=1;if((k.width>pe||k.height>pe)&&(xe=pe/Math.max(k.width,k.height)),xe<1||O===!0)if(typeof HTMLImageElement<"u"&&k instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&k instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&k instanceof ImageBitmap){const fe=O?lx:Math.floor,Ke=fe(xe*k.width),Ie=fe(xe*k.height);y===void 0&&(y=w(Ke,Ie));const $e=K?w(Ke,Ie):y;return $e.width=Ke,$e.height=Ie,$e.getContext("2d").drawImage(k,0,0,Ke,Ie),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+k.width+"x"+k.height+") to ("+Ke+"x"+Ie+")."),$e}else return"data"in k&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+k.width+"x"+k.height+")."),k;return k}function A(k){return GM(k.width)&&GM(k.height)}function R(k){return l?!1:k.wrapS!==ds||k.wrapT!==ds||k.minFilter!==dr&&k.minFilter!==Ha}function N(k,O){return k.generateMipmaps&&O&&k.minFilter!==dr&&k.minFilter!==Ha}function C(k){t.generateMipmap(k)}function F(k,O,K,pe,xe=!1){if(l===!1)return O;if(k!==null){if(t[k]!==void 0)return t[k];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+k+"'")}let fe=O;if(O===t.RED&&(K===t.FLOAT&&(fe=t.R32F),K===t.HALF_FLOAT&&(fe=t.R16F),K===t.UNSIGNED_BYTE&&(fe=t.R8)),O===t.RED_INTEGER&&(K===t.UNSIGNED_BYTE&&(fe=t.R8UI),K===t.UNSIGNED_SHORT&&(fe=t.R16UI),K===t.UNSIGNED_INT&&(fe=t.R32UI),K===t.BYTE&&(fe=t.R8I),K===t.SHORT&&(fe=t.R16I),K===t.INT&&(fe=t.R32I)),O===t.RG&&(K===t.FLOAT&&(fe=t.RG32F),K===t.HALF_FLOAT&&(fe=t.RG16F),K===t.UNSIGNED_BYTE&&(fe=t.RG8)),O===t.RGBA){const Ke=xe?ax:An.getTransfer(pe);K===t.FLOAT&&(fe=t.RGBA32F),K===t.HALF_FLOAT&&(fe=t.RGBA16F),K===t.UNSIGNED_BYTE&&(fe=Ke===Fn?t.SRGB8_ALPHA8:t.RGBA8),K===t.UNSIGNED_SHORT_4_4_4_4&&(fe=t.RGBA4),K===t.UNSIGNED_SHORT_5_5_5_1&&(fe=t.RGB5_A1)}return(fe===t.R16F||fe===t.R32F||fe===t.RG16F||fe===t.RG32F||fe===t.RGBA16F||fe===t.RGBA32F)&&e.get("EXT_color_buffer_float"),fe}function P(k,O,K){return N(k,K)===!0||k.isFramebufferTexture&&k.minFilter!==dr&&k.minFilter!==Ha?Math.log2(Math.max(O.width,O.height))+1:k.mipmaps!==void 0&&k.mipmaps.length>0?k.mipmaps.length:k.isCompressedTexture&&Array.isArray(k.image)?O.mipmaps.length:1}function L(k){return k===dr||k===RO||k===l1?t.NEAREST:t.LINEAR}function B(k){const O=k.target;O.removeEventListener("dispose",B),$(O),O.isVideoTexture&&b.delete(O)}function U(k){const O=k.target;O.removeEventListener("dispose",U),W(O)}function $(k){const O=i.get(k);if(O.__webglInit===void 0)return;const K=k.source,pe=x.get(K);if(pe){const xe=pe[O.__cacheKey];xe.usedTimes--,xe.usedTimes===0&&I(k),Object.keys(pe).length===0&&x.delete(K)}i.remove(k)}function I(k){const O=i.get(k);t.deleteTexture(O.__webglTexture);const K=k.source,pe=x.get(K);delete pe[O.__cacheKey],s.memory.textures--}function W(k){const O=k.texture,K=i.get(k),pe=i.get(O);if(pe.__webglTexture!==void 0&&(t.deleteTexture(pe.__webglTexture),s.memory.textures--),k.depthTexture&&k.depthTexture.dispose(),k.isWebGLCubeRenderTarget)for(let xe=0;xe<6;xe++){if(Array.isArray(K.__webglFramebuffer[xe]))for(let fe=0;fe<K.__webglFramebuffer[xe].length;fe++)t.deleteFramebuffer(K.__webglFramebuffer[xe][fe]);else t.deleteFramebuffer(K.__webglFramebuffer[xe]);K.__webglDepthbuffer&&t.deleteRenderbuffer(K.__webglDepthbuffer[xe])}else{if(Array.isArray(K.__webglFramebuffer))for(let xe=0;xe<K.__webglFramebuffer.length;xe++)t.deleteFramebuffer(K.__webglFramebuffer[xe]);else t.deleteFramebuffer(K.__webglFramebuffer);if(K.__webglDepthbuffer&&t.deleteRenderbuffer(K.__webglDepthbuffer),K.__webglMultisampledFramebuffer&&t.deleteFramebuffer(K.__webglMultisampledFramebuffer),K.__webglColorRenderbuffer)for(let xe=0;xe<K.__webglColorRenderbuffer.length;xe++)K.__webglColorRenderbuffer[xe]&&t.deleteRenderbuffer(K.__webglColorRenderbuffer[xe]);K.__webglDepthRenderbuffer&&t.deleteRenderbuffer(K.__webglDepthRenderbuffer)}if(k.isWebGLMultipleRenderTargets)for(let xe=0,fe=O.length;xe<fe;xe++){const Ke=i.get(O[xe]);Ke.__webglTexture&&(t.deleteTexture(Ke.__webglTexture),s.memory.textures--),i.remove(O[xe])}i.remove(O),i.remove(k)}let X=0;function V(){X=0}function Y(){const k=X;return k>=c&&console.warn("THREE.WebGLTextures: Trying to use "+k+" texture units while this GPU supports only "+c),X+=1,k}function J(k){const O=[];return O.push(k.wrapS),O.push(k.wrapT),O.push(k.wrapR||0),O.push(k.magFilter),O.push(k.minFilter),O.push(k.anisotropy),O.push(k.internalFormat),O.push(k.format),O.push(k.type),O.push(k.generateMipmaps),O.push(k.premultiplyAlpha),O.push(k.flipY),O.push(k.unpackAlignment),O.push(k.colorSpace),O.join()}function se(k,O){const K=i.get(k);if(k.isVideoTexture&&we(k),k.isRenderTargetTexture===!1&&k.version>0&&K.__version!==k.version){const pe=k.image;if(pe===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(pe.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{he(K,k,O);return}}n.bindTexture(t.TEXTURE_2D,K.__webglTexture,t.TEXTURE0+O)}function H(k,O){const K=i.get(k);if(k.version>0&&K.__version!==k.version){he(K,k,O);return}n.bindTexture(t.TEXTURE_2D_ARRAY,K.__webglTexture,t.TEXTURE0+O)}function q(k,O){const K=i.get(k);if(k.version>0&&K.__version!==k.version){he(K,k,O);return}n.bindTexture(t.TEXTURE_3D,K.__webglTexture,t.TEXTURE0+O)}function re(k,O){const K=i.get(k);if(k.version>0&&K.__version!==k.version){Ae(K,k,O);return}n.bindTexture(t.TEXTURE_CUBE_MAP,K.__webglTexture,t.TEXTURE0+O)}const ce={[zM]:t.REPEAT,[ds]:t.CLAMP_TO_EDGE,[BM]:t.MIRRORED_REPEAT},ye={[dr]:t.NEAREST,[RO]:t.NEAREST_MIPMAP_NEAREST,[l1]:t.NEAREST_MIPMAP_LINEAR,[Ha]:t.LINEAR,[Kte]:t.LINEAR_MIPMAP_NEAREST,[Vp]:t.LINEAR_MIPMAP_LINEAR},me={[lne]:t.NEVER,[pne]:t.ALWAYS,[cne]:t.LESS,[IB]:t.LEQUAL,[une]:t.EQUAL,[hne]:t.GEQUAL,[dne]:t.GREATER,[fne]:t.NOTEQUAL};function be(k,O,K){if(K?(t.texParameteri(k,t.TEXTURE_WRAP_S,ce[O.wrapS]),t.texParameteri(k,t.TEXTURE_WRAP_T,ce[O.wrapT]),(k===t.TEXTURE_3D||k===t.TEXTURE_2D_ARRAY)&&t.texParameteri(k,t.TEXTURE_WRAP_R,ce[O.wrapR]),t.texParameteri(k,t.TEXTURE_MAG_FILTER,ye[O.magFilter]),t.texParameteri(k,t.TEXTURE_MIN_FILTER,ye[O.minFilter])):(t.texParameteri(k,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(k,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),(k===t.TEXTURE_3D||k===t.TEXTURE_2D_ARRAY)&&t.texParameteri(k,t.TEXTURE_WRAP_R,t.CLAMP_TO_EDGE),(O.wrapS!==ds||O.wrapT!==ds)&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),t.texParameteri(k,t.TEXTURE_MAG_FILTER,L(O.magFilter)),t.texParameteri(k,t.TEXTURE_MIN_FILTER,L(O.minFilter)),O.minFilter!==dr&&O.minFilter!==Ha&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),O.compareFunction&&(t.texParameteri(k,t.TEXTURE_COMPARE_MODE,t.COMPARE_REF_TO_TEXTURE),t.texParameteri(k,t.TEXTURE_COMPARE_FUNC,me[O.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){const pe=e.get("EXT_texture_filter_anisotropic");if(O.magFilter===dr||O.minFilter!==l1&&O.minFilter!==Vp||O.type===Io&&e.has("OES_texture_float_linear")===!1||l===!1&&O.type===$p&&e.has("OES_texture_half_float_linear")===!1)return;(O.anisotropy>1||i.get(O).__currentAnisotropy)&&(t.texParameterf(k,pe.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(O.anisotropy,r.getMaxAnisotropy())),i.get(O).__currentAnisotropy=O.anisotropy)}}function Ne(k,O){let K=!1;k.__webglInit===void 0&&(k.__webglInit=!0,O.addEventListener("dispose",B));const pe=O.source;let xe=x.get(pe);xe===void 0&&(xe={},x.set(pe,xe));const fe=J(O);if(fe!==k.__cacheKey){xe[fe]===void 0&&(xe[fe]={texture:t.createTexture(),usedTimes:0},s.memory.textures++,K=!0),xe[fe].usedTimes++;const Ke=xe[k.__cacheKey];Ke!==void 0&&(xe[k.__cacheKey].usedTimes--,Ke.usedTimes===0&&I(O)),k.__cacheKey=fe,k.__webglTexture=xe[fe].texture}return K}function he(k,O,K){let pe=t.TEXTURE_2D;(O.isDataArrayTexture||O.isCompressedArrayTexture)&&(pe=t.TEXTURE_2D_ARRAY),O.isData3DTexture&&(pe=t.TEXTURE_3D);const xe=Ne(k,O),fe=O.source;n.bindTexture(pe,k.__webglTexture,t.TEXTURE0+K);const Ke=i.get(fe);if(fe.version!==Ke.__version||xe===!0){n.activeTexture(t.TEXTURE0+K);const Ie=An.getPrimaries(An.workingColorSpace),$e=O.colorSpace===Va?null:An.getPrimaries(O.colorSpace),rt=O.colorSpace===Va||Ie===$e?t.NONE:t.BROWSER_DEFAULT_WEBGL;t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,O.flipY),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,O.premultiplyAlpha),t.pixelStorei(t.UNPACK_ALIGNMENT,O.unpackAlignment),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,rt);const ke=R(O)&&A(O.image)===!1;let De=S(O.image,ke,!1,f);De=ve(O,De);const ct=A(De)||l,et=a.convert(O.format,O.colorSpace);let Je=a.convert(O.type),st=F(O.internalFormat,et,Je,O.colorSpace,O.isVideoTexture);be(pe,O,ct);let ue;const tt=O.mipmaps,de=l&&O.isVideoTexture!==!0&&st!==NB,Le=Ke.__version===void 0||xe===!0,Me=P(O,De,ct);if(O.isDepthTexture)st=t.DEPTH_COMPONENT,l?O.type===Io?st=t.DEPTH_COMPONENT32F:O.type===Jl?st=t.DEPTH_COMPONENT24:O.type===lu?st=t.DEPTH24_STENCIL8:st=t.DEPTH_COMPONENT16:O.type===Io&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),O.format===cu&&st===t.DEPTH_COMPONENT&&O.type!==LT&&O.type!==Jl&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),O.type=Jl,Je=a.convert(O.type)),O.format===Ef&&st===t.DEPTH_COMPONENT&&(st=t.DEPTH_STENCIL,O.type!==lu&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),O.type=lu,Je=a.convert(O.type))),Le&&(de?n.texStorage2D(t.TEXTURE_2D,1,st,De.width,De.height):n.texImage2D(t.TEXTURE_2D,0,st,De.width,De.height,0,et,Je,null));else if(O.isDataTexture)if(tt.length>0&&ct){de&&Le&&n.texStorage2D(t.TEXTURE_2D,Me,st,tt[0].width,tt[0].height);for(let ge=0,je=tt.length;ge<je;ge++)ue=tt[ge],de?n.texSubImage2D(t.TEXTURE_2D,ge,0,0,ue.width,ue.height,et,Je,ue.data):n.texImage2D(t.TEXTURE_2D,ge,st,ue.width,ue.height,0,et,Je,ue.data);O.generateMipmaps=!1}else de?(Le&&n.texStorage2D(t.TEXTURE_2D,Me,st,De.width,De.height),n.texSubImage2D(t.TEXTURE_2D,0,0,0,De.width,De.height,et,Je,De.data)):n.texImage2D(t.TEXTURE_2D,0,st,De.width,De.height,0,et,Je,De.data);else if(O.isCompressedTexture)if(O.isCompressedArrayTexture){de&&Le&&n.texStorage3D(t.TEXTURE_2D_ARRAY,Me,st,tt[0].width,tt[0].height,De.depth);for(let ge=0,je=tt.length;ge<je;ge++)ue=tt[ge],O.format!==Ga?et!==null?de?n.compressedTexSubImage3D(t.TEXTURE_2D_ARRAY,ge,0,0,0,ue.width,ue.height,De.depth,et,ue.data,0,0):n.compressedTexImage3D(t.TEXTURE_2D_ARRAY,ge,st,ue.width,ue.height,De.depth,0,ue.data,0,0):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):de?n.texSubImage3D(t.TEXTURE_2D_ARRAY,ge,0,0,0,ue.width,ue.height,De.depth,et,Je,ue.data):n.texImage3D(t.TEXTURE_2D_ARRAY,ge,st,ue.width,ue.height,De.depth,0,et,Je,ue.data)}else{de&&Le&&n.texStorage2D(t.TEXTURE_2D,Me,st,tt[0].width,tt[0].height);for(let ge=0,je=tt.length;ge<je;ge++)ue=tt[ge],O.format!==Ga?et!==null?de?n.compressedTexSubImage2D(t.TEXTURE_2D,ge,0,0,ue.width,ue.height,et,ue.data):n.compressedTexImage2D(t.TEXTURE_2D,ge,st,ue.width,ue.height,0,ue.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):de?n.texSubImage2D(t.TEXTURE_2D,ge,0,0,ue.width,ue.height,et,Je,ue.data):n.texImage2D(t.TEXTURE_2D,ge,st,ue.width,ue.height,0,et,Je,ue.data)}else if(O.isDataArrayTexture)de?(Le&&n.texStorage3D(t.TEXTURE_2D_ARRAY,Me,st,De.width,De.height,De.depth),n.texSubImage3D(t.TEXTURE_2D_ARRAY,0,0,0,0,De.width,De.height,De.depth,et,Je,De.data)):n.texImage3D(t.TEXTURE_2D_ARRAY,0,st,De.width,De.height,De.depth,0,et,Je,De.data);else if(O.isData3DTexture)de?(Le&&n.texStorage3D(t.TEXTURE_3D,Me,st,De.width,De.height,De.depth),n.texSubImage3D(t.TEXTURE_3D,0,0,0,0,De.width,De.height,De.depth,et,Je,De.data)):n.texImage3D(t.TEXTURE_3D,0,st,De.width,De.height,De.depth,0,et,Je,De.data);else if(O.isFramebufferTexture){if(Le)if(de)n.texStorage2D(t.TEXTURE_2D,Me,st,De.width,De.height);else{let ge=De.width,je=De.height;for(let at=0;at<Me;at++)n.texImage2D(t.TEXTURE_2D,at,st,ge,je,0,et,Je,null),ge>>=1,je>>=1}}else if(tt.length>0&&ct){de&&Le&&n.texStorage2D(t.TEXTURE_2D,Me,st,tt[0].width,tt[0].height);for(let ge=0,je=tt.length;ge<je;ge++)ue=tt[ge],de?n.texSubImage2D(t.TEXTURE_2D,ge,0,0,et,Je,ue):n.texImage2D(t.TEXTURE_2D,ge,st,et,Je,ue);O.generateMipmaps=!1}else de?(Le&&n.texStorage2D(t.TEXTURE_2D,Me,st,De.width,De.height),n.texSubImage2D(t.TEXTURE_2D,0,0,0,et,Je,De)):n.texImage2D(t.TEXTURE_2D,0,st,et,Je,De);N(O,ct)&&C(pe),Ke.__version=fe.version,O.onUpdate&&O.onUpdate(O)}k.__version=O.version}function Ae(k,O,K){if(O.image.length!==6)return;const pe=Ne(k,O),xe=O.source;n.bindTexture(t.TEXTURE_CUBE_MAP,k.__webglTexture,t.TEXTURE0+K);const fe=i.get(xe);if(xe.version!==fe.__version||pe===!0){n.activeTexture(t.TEXTURE0+K);const Ke=An.getPrimaries(An.workingColorSpace),Ie=O.colorSpace===Va?null:An.getPrimaries(O.colorSpace),$e=O.colorSpace===Va||Ke===Ie?t.NONE:t.BROWSER_DEFAULT_WEBGL;t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,O.flipY),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,O.premultiplyAlpha),t.pixelStorei(t.UNPACK_ALIGNMENT,O.unpackAlignment),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,$e);const rt=O.isCompressedTexture||O.image[0].isCompressedTexture,ke=O.image[0]&&O.image[0].isDataTexture,De=[];for(let ge=0;ge<6;ge++)!rt&&!ke?De[ge]=S(O.image[ge],!1,!0,d):De[ge]=ke?O.image[ge].image:O.image[ge],De[ge]=ve(O,De[ge]);const ct=De[0],et=A(ct)||l,Je=a.convert(O.format,O.colorSpace),st=a.convert(O.type),ue=F(O.internalFormat,Je,st,O.colorSpace),tt=l&&O.isVideoTexture!==!0,de=fe.__version===void 0||pe===!0;let Le=P(O,ct,et);be(t.TEXTURE_CUBE_MAP,O,et);let Me;if(rt){tt&&de&&n.texStorage2D(t.TEXTURE_CUBE_MAP,Le,ue,ct.width,ct.height);for(let ge=0;ge<6;ge++){Me=De[ge].mipmaps;for(let je=0;je<Me.length;je++){const at=Me[je];O.format!==Ga?Je!==null?tt?n.compressedTexSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+ge,je,0,0,at.width,at.height,Je,at.data):n.compressedTexImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+ge,je,ue,at.width,at.height,0,at.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):tt?n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+ge,je,0,0,at.width,at.height,Je,st,at.data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+ge,je,ue,at.width,at.height,0,Je,st,at.data)}}}else{Me=O.mipmaps,tt&&de&&(Me.length>0&&Le++,n.texStorage2D(t.TEXTURE_CUBE_MAP,Le,ue,De[0].width,De[0].height));for(let ge=0;ge<6;ge++)if(ke){tt?n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+ge,0,0,0,De[ge].width,De[ge].height,Je,st,De[ge].data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+ge,0,ue,De[ge].width,De[ge].height,0,Je,st,De[ge].data);for(let je=0;je<Me.length;je++){const mt=Me[je].image[ge].image;tt?n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+ge,je+1,0,0,mt.width,mt.height,Je,st,mt.data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+ge,je+1,ue,mt.width,mt.height,0,Je,st,mt.data)}}else{tt?n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+ge,0,0,0,Je,st,De[ge]):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+ge,0,ue,Je,st,De[ge]);for(let je=0;je<Me.length;je++){const at=Me[je];tt?n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+ge,je+1,0,0,Je,st,at.image[ge]):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+ge,je+1,ue,Je,st,at.image[ge])}}}N(O,et)&&C(t.TEXTURE_CUBE_MAP),fe.__version=xe.version,O.onUpdate&&O.onUpdate(O)}k.__version=O.version}function Be(k,O,K,pe,xe,fe){const Ke=a.convert(K.format,K.colorSpace),Ie=a.convert(K.type),$e=F(K.internalFormat,Ke,Ie,K.colorSpace);if(!i.get(O).__hasExternalTextures){const ke=Math.max(1,O.width>>fe),De=Math.max(1,O.height>>fe);xe===t.TEXTURE_3D||xe===t.TEXTURE_2D_ARRAY?n.texImage3D(xe,fe,$e,ke,De,O.depth,0,Ke,Ie,null):n.texImage2D(xe,fe,$e,ke,De,0,Ke,Ie,null)}n.bindFramebuffer(t.FRAMEBUFFER,k),ie(O)?g.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,pe,xe,i.get(K).__webglTexture,0,ae(O)):(xe===t.TEXTURE_2D||xe>=t.TEXTURE_CUBE_MAP_POSITIVE_X&&xe<=t.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&t.framebufferTexture2D(t.FRAMEBUFFER,pe,xe,i.get(K).__webglTexture,fe),n.bindFramebuffer(t.FRAMEBUFFER,null)}function le(k,O,K){if(t.bindRenderbuffer(t.RENDERBUFFER,k),O.depthBuffer&&!O.stencilBuffer){let pe=l===!0?t.DEPTH_COMPONENT24:t.DEPTH_COMPONENT16;if(K||ie(O)){const xe=O.depthTexture;xe&&xe.isDepthTexture&&(xe.type===Io?pe=t.DEPTH_COMPONENT32F:xe.type===Jl&&(pe=t.DEPTH_COMPONENT24));const fe=ae(O);ie(O)?g.renderbufferStorageMultisampleEXT(t.RENDERBUFFER,fe,pe,O.width,O.height):t.renderbufferStorageMultisample(t.RENDERBUFFER,fe,pe,O.width,O.height)}else t.renderbufferStorage(t.RENDERBUFFER,pe,O.width,O.height);t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.RENDERBUFFER,k)}else if(O.depthBuffer&&O.stencilBuffer){const pe=ae(O);K&&ie(O)===!1?t.renderbufferStorageMultisample(t.RENDERBUFFER,pe,t.DEPTH24_STENCIL8,O.width,O.height):ie(O)?g.renderbufferStorageMultisampleEXT(t.RENDERBUFFER,pe,t.DEPTH24_STENCIL8,O.width,O.height):t.renderbufferStorage(t.RENDERBUFFER,t.DEPTH_STENCIL,O.width,O.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.RENDERBUFFER,k)}else{const pe=O.isWebGLMultipleRenderTargets===!0?O.texture:[O.texture];for(let xe=0;xe<pe.length;xe++){const fe=pe[xe],Ke=a.convert(fe.format,fe.colorSpace),Ie=a.convert(fe.type),$e=F(fe.internalFormat,Ke,Ie,fe.colorSpace),rt=ae(O);K&&ie(O)===!1?t.renderbufferStorageMultisample(t.RENDERBUFFER,rt,$e,O.width,O.height):ie(O)?g.renderbufferStorageMultisampleEXT(t.RENDERBUFFER,rt,$e,O.width,O.height):t.renderbufferStorage(t.RENDERBUFFER,$e,O.width,O.height)}}t.bindRenderbuffer(t.RENDERBUFFER,null)}function lt(k,O){if(O&&O.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(n.bindFramebuffer(t.FRAMEBUFFER,k),!(O.depthTexture&&O.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");(!i.get(O.depthTexture).__webglTexture||O.depthTexture.image.width!==O.width||O.depthTexture.image.height!==O.height)&&(O.depthTexture.image.width=O.width,O.depthTexture.image.height=O.height,O.depthTexture.needsUpdate=!0),se(O.depthTexture,0);const pe=i.get(O.depthTexture).__webglTexture,xe=ae(O);if(O.depthTexture.format===cu)ie(O)?g.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.TEXTURE_2D,pe,0,xe):t.framebufferTexture2D(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.TEXTURE_2D,pe,0);else if(O.depthTexture.format===Ef)ie(O)?g.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.TEXTURE_2D,pe,0,xe):t.framebufferTexture2D(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.TEXTURE_2D,pe,0);else throw new Error("Unknown depthTexture format")}function z(k){const O=i.get(k),K=k.isWebGLCubeRenderTarget===!0;if(k.depthTexture&&!O.__autoAllocateDepthBuffer){if(K)throw new Error("target.depthTexture not supported in Cube render targets");lt(O.__webglFramebuffer,k)}else if(K){O.__webglDepthbuffer=[];for(let pe=0;pe<6;pe++)n.bindFramebuffer(t.FRAMEBUFFER,O.__webglFramebuffer[pe]),O.__webglDepthbuffer[pe]=t.createRenderbuffer(),le(O.__webglDepthbuffer[pe],k,!1)}else n.bindFramebuffer(t.FRAMEBUFFER,O.__webglFramebuffer),O.__webglDepthbuffer=t.createRenderbuffer(),le(O.__webglDepthbuffer,k,!1);n.bindFramebuffer(t.FRAMEBUFFER,null)}function G(k,O,K){const pe=i.get(k);O!==void 0&&Be(pe.__webglFramebuffer,k,k.texture,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,0),K!==void 0&&z(k)}function ne(k){const O=k.texture,K=i.get(k),pe=i.get(O);k.addEventListener("dispose",U),k.isWebGLMultipleRenderTargets!==!0&&(pe.__webglTexture===void 0&&(pe.__webglTexture=t.createTexture()),pe.__version=O.version,s.memory.textures++);const xe=k.isWebGLCubeRenderTarget===!0,fe=k.isWebGLMultipleRenderTargets===!0,Ke=A(k)||l;if(xe){K.__webglFramebuffer=[];for(let Ie=0;Ie<6;Ie++)if(l&&O.mipmaps&&O.mipmaps.length>0){K.__webglFramebuffer[Ie]=[];for(let $e=0;$e<O.mipmaps.length;$e++)K.__webglFramebuffer[Ie][$e]=t.createFramebuffer()}else K.__webglFramebuffer[Ie]=t.createFramebuffer()}else{if(l&&O.mipmaps&&O.mipmaps.length>0){K.__webglFramebuffer=[];for(let Ie=0;Ie<O.mipmaps.length;Ie++)K.__webglFramebuffer[Ie]=t.createFramebuffer()}else K.__webglFramebuffer=t.createFramebuffer();if(fe)if(r.drawBuffers){const Ie=k.texture;for(let $e=0,rt=Ie.length;$e<rt;$e++){const ke=i.get(Ie[$e]);ke.__webglTexture===void 0&&(ke.__webglTexture=t.createTexture(),s.memory.textures++)}}else console.warn("THREE.WebGLRenderer: WebGLMultipleRenderTargets can only be used with WebGL2 or WEBGL_draw_buffers extension.");if(l&&k.samples>0&&ie(k)===!1){const Ie=fe?O:[O];K.__webglMultisampledFramebuffer=t.createFramebuffer(),K.__webglColorRenderbuffer=[],n.bindFramebuffer(t.FRAMEBUFFER,K.__webglMultisampledFramebuffer);for(let $e=0;$e<Ie.length;$e++){const rt=Ie[$e];K.__webglColorRenderbuffer[$e]=t.createRenderbuffer(),t.bindRenderbuffer(t.RENDERBUFFER,K.__webglColorRenderbuffer[$e]);const ke=a.convert(rt.format,rt.colorSpace),De=a.convert(rt.type),ct=F(rt.internalFormat,ke,De,rt.colorSpace,k.isXRRenderTarget===!0),et=ae(k);t.renderbufferStorageMultisample(t.RENDERBUFFER,et,ct,k.width,k.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+$e,t.RENDERBUFFER,K.__webglColorRenderbuffer[$e])}t.bindRenderbuffer(t.RENDERBUFFER,null),k.depthBuffer&&(K.__webglDepthRenderbuffer=t.createRenderbuffer(),le(K.__webglDepthRenderbuffer,k,!0)),n.bindFramebuffer(t.FRAMEBUFFER,null)}}if(xe){n.bindTexture(t.TEXTURE_CUBE_MAP,pe.__webglTexture),be(t.TEXTURE_CUBE_MAP,O,Ke);for(let Ie=0;Ie<6;Ie++)if(l&&O.mipmaps&&O.mipmaps.length>0)for(let $e=0;$e<O.mipmaps.length;$e++)Be(K.__webglFramebuffer[Ie][$e],k,O,t.COLOR_ATTACHMENT0,t.TEXTURE_CUBE_MAP_POSITIVE_X+Ie,$e);else Be(K.__webglFramebuffer[Ie],k,O,t.COLOR_ATTACHMENT0,t.TEXTURE_CUBE_MAP_POSITIVE_X+Ie,0);N(O,Ke)&&C(t.TEXTURE_CUBE_MAP),n.unbindTexture()}else if(fe){const Ie=k.texture;for(let $e=0,rt=Ie.length;$e<rt;$e++){const ke=Ie[$e],De=i.get(ke);n.bindTexture(t.TEXTURE_2D,De.__webglTexture),be(t.TEXTURE_2D,ke,Ke),Be(K.__webglFramebuffer,k,ke,t.COLOR_ATTACHMENT0+$e,t.TEXTURE_2D,0),N(ke,Ke)&&C(t.TEXTURE_2D)}n.unbindTexture()}else{let Ie=t.TEXTURE_2D;if((k.isWebGL3DRenderTarget||k.isWebGLArrayRenderTarget)&&(l?Ie=k.isWebGL3DRenderTarget?t.TEXTURE_3D:t.TEXTURE_2D_ARRAY:console.error("THREE.WebGLTextures: THREE.Data3DTexture and THREE.DataArrayTexture only supported with WebGL2.")),n.bindTexture(Ie,pe.__webglTexture),be(Ie,O,Ke),l&&O.mipmaps&&O.mipmaps.length>0)for(let $e=0;$e<O.mipmaps.length;$e++)Be(K.__webglFramebuffer[$e],k,O,t.COLOR_ATTACHMENT0,Ie,$e);else Be(K.__webglFramebuffer,k,O,t.COLOR_ATTACHMENT0,Ie,0);N(O,Ke)&&C(Ie),n.unbindTexture()}k.depthBuffer&&z(k)}function Q(k){const O=A(k)||l,K=k.isWebGLMultipleRenderTargets===!0?k.texture:[k.texture];for(let pe=0,xe=K.length;pe<xe;pe++){const fe=K[pe];if(N(fe,O)){const Ke=k.isWebGLCubeRenderTarget?t.TEXTURE_CUBE_MAP:t.TEXTURE_2D,Ie=i.get(fe).__webglTexture;n.bindTexture(Ke,Ie),C(Ke),n.unbindTexture()}}}function ee(k){if(l&&k.samples>0&&ie(k)===!1){const O=k.isWebGLMultipleRenderTargets?k.texture:[k.texture],K=k.width,pe=k.height;let xe=t.COLOR_BUFFER_BIT;const fe=[],Ke=k.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,Ie=i.get(k),$e=k.isWebGLMultipleRenderTargets===!0;if($e)for(let rt=0;rt<O.length;rt++)n.bindFramebuffer(t.FRAMEBUFFER,Ie.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+rt,t.RENDERBUFFER,null),n.bindFramebuffer(t.FRAMEBUFFER,Ie.__webglFramebuffer),t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0+rt,t.TEXTURE_2D,null,0);n.bindFramebuffer(t.READ_FRAMEBUFFER,Ie.__webglMultisampledFramebuffer),n.bindFramebuffer(t.DRAW_FRAMEBUFFER,Ie.__webglFramebuffer);for(let rt=0;rt<O.length;rt++){fe.push(t.COLOR_ATTACHMENT0+rt),k.depthBuffer&&fe.push(Ke);const ke=Ie.__ignoreDepthValues!==void 0?Ie.__ignoreDepthValues:!1;if(ke===!1&&(k.depthBuffer&&(xe|=t.DEPTH_BUFFER_BIT),k.stencilBuffer&&(xe|=t.STENCIL_BUFFER_BIT)),$e&&t.framebufferRenderbuffer(t.READ_FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.RENDERBUFFER,Ie.__webglColorRenderbuffer[rt]),ke===!0&&(t.invalidateFramebuffer(t.READ_FRAMEBUFFER,[Ke]),t.invalidateFramebuffer(t.DRAW_FRAMEBUFFER,[Ke])),$e){const De=i.get(O[rt]).__webglTexture;t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,De,0)}t.blitFramebuffer(0,0,K,pe,0,0,K,pe,xe,t.NEAREST),m&&t.invalidateFramebuffer(t.READ_FRAMEBUFFER,fe)}if(n.bindFramebuffer(t.READ_FRAMEBUFFER,null),n.bindFramebuffer(t.DRAW_FRAMEBUFFER,null),$e)for(let rt=0;rt<O.length;rt++){n.bindFramebuffer(t.FRAMEBUFFER,Ie.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+rt,t.RENDERBUFFER,Ie.__webglColorRenderbuffer[rt]);const ke=i.get(O[rt]).__webglTexture;n.bindFramebuffer(t.FRAMEBUFFER,Ie.__webglFramebuffer),t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0+rt,t.TEXTURE_2D,ke,0)}n.bindFramebuffer(t.DRAW_FRAMEBUFFER,Ie.__webglMultisampledFramebuffer)}}function ae(k){return Math.min(h,k.samples)}function ie(k){const O=i.get(k);return l&&k.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&O.__useRenderToTexture!==!1}function we(k){const O=s.render.frame;b.get(k)!==O&&(b.set(k,O),k.update())}function ve(k,O){const K=k.colorSpace,pe=k.format,xe=k.type;return k.isCompressedTexture===!0||k.isVideoTexture===!0||k.format===HM||K!==Wo&&K!==Va&&(An.getTransfer(K)===Fn?l===!1?e.has("EXT_sRGB")===!0&&pe===Ga?(k.format=HM,k.minFilter=Ha,k.generateMipmaps=!1):O=FB.sRGBToLinear(O):(pe!==Ga||xe!==ac)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",K)),O}this.allocateTextureUnit=Y,this.resetTextureUnits=V,this.setTexture2D=se,this.setTexture2DArray=H,this.setTexture3D=q,this.setTextureCube=re,this.rebindTextures=G,this.setupRenderTarget=ne,this.updateRenderTargetMipmap=Q,this.updateMultisampleRenderTarget=ee,this.setupDepthRenderbuffer=z,this.setupFrameBufferTexture=Be,this.useMultisampledRTT=ie}function Toe(t,e,n){const i=n.isWebGL2;function r(a,s=Va){let l;const c=An.getTransfer(s);if(a===ac)return t.UNSIGNED_BYTE;if(a===TB)return t.UNSIGNED_SHORT_4_4_4_4;if(a===CB)return t.UNSIGNED_SHORT_5_5_5_1;if(a===Zte)return t.BYTE;if(a===Qte)return t.SHORT;if(a===LT)return t.UNSIGNED_SHORT;if(a===AB)return t.INT;if(a===Jl)return t.UNSIGNED_INT;if(a===Io)return t.FLOAT;if(a===$p)return i?t.HALF_FLOAT:(l=e.get("OES_texture_half_float"),l!==null?l.HALF_FLOAT_OES:null);if(a===Jte)return t.ALPHA;if(a===Ga)return t.RGBA;if(a===ene)return t.LUMINANCE;if(a===tne)return t.LUMINANCE_ALPHA;if(a===cu)return t.DEPTH_COMPONENT;if(a===Ef)return t.DEPTH_STENCIL;if(a===HM)return l=e.get("EXT_sRGB"),l!==null?l.SRGB_ALPHA_EXT:null;if(a===nne)return t.RED;if(a===RB)return t.RED_INTEGER;if(a===ine)return t.RG;if(a===PB)return t.RG_INTEGER;if(a===DB)return t.RGBA_INTEGER;if(a===c1||a===u1||a===d1||a===f1)if(c===Fn)if(l=e.get("WEBGL_compressed_texture_s3tc_srgb"),l!==null){if(a===c1)return l.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(a===u1)return l.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(a===d1)return l.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(a===f1)return l.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(l=e.get("WEBGL_compressed_texture_s3tc"),l!==null){if(a===c1)return l.COMPRESSED_RGB_S3TC_DXT1_EXT;if(a===u1)return l.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(a===d1)return l.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(a===f1)return l.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(a===PO||a===DO||a===NO||a===OO)if(l=e.get("WEBGL_compressed_texture_pvrtc"),l!==null){if(a===PO)return l.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(a===DO)return l.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(a===NO)return l.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(a===OO)return l.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(a===NB)return l=e.get("WEBGL_compressed_texture_etc1"),l!==null?l.COMPRESSED_RGB_ETC1_WEBGL:null;if(a===LO||a===IO)if(l=e.get("WEBGL_compressed_texture_etc"),l!==null){if(a===LO)return c===Fn?l.COMPRESSED_SRGB8_ETC2:l.COMPRESSED_RGB8_ETC2;if(a===IO)return c===Fn?l.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:l.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(a===UO||a===kO||a===FO||a===zO||a===BO||a===jO||a===HO||a===GO||a===VO||a===$O||a===WO||a===XO||a===qO||a===YO)if(l=e.get("WEBGL_compressed_texture_astc"),l!==null){if(a===UO)return c===Fn?l.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:l.COMPRESSED_RGBA_ASTC_4x4_KHR;if(a===kO)return c===Fn?l.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:l.COMPRESSED_RGBA_ASTC_5x4_KHR;if(a===FO)return c===Fn?l.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:l.COMPRESSED_RGBA_ASTC_5x5_KHR;if(a===zO)return c===Fn?l.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:l.COMPRESSED_RGBA_ASTC_6x5_KHR;if(a===BO)return c===Fn?l.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:l.COMPRESSED_RGBA_ASTC_6x6_KHR;if(a===jO)return c===Fn?l.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:l.COMPRESSED_RGBA_ASTC_8x5_KHR;if(a===HO)return c===Fn?l.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:l.COMPRESSED_RGBA_ASTC_8x6_KHR;if(a===GO)return c===Fn?l.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:l.COMPRESSED_RGBA_ASTC_8x8_KHR;if(a===VO)return c===Fn?l.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:l.COMPRESSED_RGBA_ASTC_10x5_KHR;if(a===$O)return c===Fn?l.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:l.COMPRESSED_RGBA_ASTC_10x6_KHR;if(a===WO)return c===Fn?l.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:l.COMPRESSED_RGBA_ASTC_10x8_KHR;if(a===XO)return c===Fn?l.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:l.COMPRESSED_RGBA_ASTC_10x10_KHR;if(a===qO)return c===Fn?l.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:l.COMPRESSED_RGBA_ASTC_12x10_KHR;if(a===YO)return c===Fn?l.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:l.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(a===h1||a===KO||a===ZO)if(l=e.get("EXT_texture_compression_bptc"),l!==null){if(a===h1)return c===Fn?l.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:l.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(a===KO)return l.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(a===ZO)return l.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(a===rne||a===QO||a===JO||a===eL)if(l=e.get("EXT_texture_compression_rgtc"),l!==null){if(a===h1)return l.COMPRESSED_RED_RGTC1_EXT;if(a===QO)return l.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(a===JO)return l.COMPRESSED_RED_GREEN_RGTC2_EXT;if(a===eL)return l.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return a===lu?i?t.UNSIGNED_INT_24_8:(l=e.get("WEBGL_depth_texture"),l!==null?l.UNSIGNED_INT_24_8_WEBGL:null):t[a]!==void 0?t[a]:null}return{convert:r}}class Coe extends ma{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}}class _p extends Ur{constructor(){super(),this.isGroup=!0,this.type="Group"}}const Roe={type:"move"};class U1{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new _p,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 _p,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new Ce,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new Ce),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new _p,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new Ce,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new Ce),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 n=this._hand;if(n)for(const i of e.hand.values())this._getHandJoint(n,i)}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,n,i){let r=null,a=null,s=null;const l=this._targetRay,c=this._grip,d=this._hand;if(e&&n.session.visibilityState!=="visible-blurred"){if(d&&e.hand){s=!0;for(const y of e.hand.values()){const x=n.getJointPose(y,i),v=this._getHandJoint(d,y);x!==null&&(v.matrix.fromArray(x.transform.matrix),v.matrix.decompose(v.position,v.rotation,v.scale),v.matrixWorldNeedsUpdate=!0,v.jointRadius=x.radius),v.visible=x!==null}const f=d.joints["index-finger-tip"],h=d.joints["thumb-tip"],g=f.position.distanceTo(h.position),m=.02,b=.005;d.inputState.pinching&&g>m+b?(d.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!d.inputState.pinching&&g<=m-b&&(d.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else c!==null&&e.gripSpace&&(a=n.getPose(e.gripSpace,i),a!==null&&(c.matrix.fromArray(a.transform.matrix),c.matrix.decompose(c.position,c.rotation,c.scale),c.matrixWorldNeedsUpdate=!0,a.linearVelocity?(c.hasLinearVelocity=!0,c.linearVelocity.copy(a.linearVelocity)):c.hasLinearVelocity=!1,a.angularVelocity?(c.hasAngularVelocity=!0,c.angularVelocity.copy(a.angularVelocity)):c.hasAngularVelocity=!1));l!==null&&(r=n.getPose(e.targetRaySpace,i),r===null&&a!==null&&(r=a),r!==null&&(l.matrix.fromArray(r.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),l.matrixWorldNeedsUpdate=!0,r.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(r.linearVelocity)):l.hasLinearVelocity=!1,r.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(r.angularVelocity)):l.hasAngularVelocity=!1,this.dispatchEvent(Roe)))}return l!==null&&(l.visible=r!==null),c!==null&&(c.visible=a!==null),d!==null&&(d.visible=s!==null),this}_getHandJoint(e,n){if(e.joints[n.jointName]===void 0){const i=new _p;i.matrixAutoUpdate=!1,i.visible=!1,e.joints[n.jointName]=i,e.add(i)}return e.joints[n.jointName]}}class Poe extends Uu{constructor(e,n){super();const i=this;let r=null,a=1,s=null,l="local-floor",c=1,d=null,f=null,h=null,g=null,m=null,b=null;const y=n.getContextAttributes();let x=null,v=null;const w=[],S=[],A=new Ut;let R=null;const N=new ma;N.layers.enable(1),N.viewport=new Cn;const C=new ma;C.layers.enable(2),C.viewport=new Cn;const F=[N,C],P=new Coe;P.layers.enable(1),P.layers.enable(2);let L=null,B=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(re){let ce=w[re];return ce===void 0&&(ce=new U1,w[re]=ce),ce.getTargetRaySpace()},this.getControllerGrip=function(re){let ce=w[re];return ce===void 0&&(ce=new U1,w[re]=ce),ce.getGripSpace()},this.getHand=function(re){let ce=w[re];return ce===void 0&&(ce=new U1,w[re]=ce),ce.getHandSpace()};function U(re){const ce=S.indexOf(re.inputSource);if(ce===-1)return;const ye=w[ce];ye!==void 0&&(ye.update(re.inputSource,re.frame,d||s),ye.dispatchEvent({type:re.type,data:re.inputSource}))}function $(){r.removeEventListener("select",U),r.removeEventListener("selectstart",U),r.removeEventListener("selectend",U),r.removeEventListener("squeeze",U),r.removeEventListener("squeezestart",U),r.removeEventListener("squeezeend",U),r.removeEventListener("end",$),r.removeEventListener("inputsourceschange",I);for(let re=0;re<w.length;re++){const ce=S[re];ce!==null&&(S[re]=null,w[re].disconnect(ce))}L=null,B=null,e.setRenderTarget(x),m=null,g=null,h=null,r=null,v=null,q.stop(),i.isPresenting=!1,e.setPixelRatio(R),e.setSize(A.width,A.height,!1),i.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(re){a=re,i.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(re){l=re,i.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return d||s},this.setReferenceSpace=function(re){d=re},this.getBaseLayer=function(){return g!==null?g:m},this.getBinding=function(){return h},this.getFrame=function(){return b},this.getSession=function(){return r},this.setSession=async function(re){if(r=re,r!==null){if(x=e.getRenderTarget(),r.addEventListener("select",U),r.addEventListener("selectstart",U),r.addEventListener("selectend",U),r.addEventListener("squeeze",U),r.addEventListener("squeezestart",U),r.addEventListener("squeezeend",U),r.addEventListener("end",$),r.addEventListener("inputsourceschange",I),y.xrCompatible!==!0&&await n.makeXRCompatible(),R=e.getPixelRatio(),e.getSize(A),r.renderState.layers===void 0||e.capabilities.isWebGL2===!1){const ce={antialias:r.renderState.layers===void 0?y.antialias:!0,alpha:!0,depth:y.depth,stencil:y.stencil,framebufferScaleFactor:a};m=new XRWebGLLayer(r,n,ce),r.updateRenderState({baseLayer:m}),e.setPixelRatio(1),e.setSize(m.framebufferWidth,m.framebufferHeight,!1),v=new Eu(m.framebufferWidth,m.framebufferHeight,{format:Ga,type:ac,colorSpace:e.outputColorSpace,stencilBuffer:y.stencil})}else{let ce=null,ye=null,me=null;y.depth&&(me=y.stencil?n.DEPTH24_STENCIL8:n.DEPTH_COMPONENT24,ce=y.stencil?Ef:cu,ye=y.stencil?lu:Jl);const be={colorFormat:n.RGBA8,depthFormat:me,scaleFactor:a};h=new XRWebGLBinding(r,n),g=h.createProjectionLayer(be),r.updateRenderState({layers:[g]}),e.setPixelRatio(1),e.setSize(g.textureWidth,g.textureHeight,!1),v=new Eu(g.textureWidth,g.textureHeight,{format:Ga,type:ac,depthTexture:new KB(g.textureWidth,g.textureHeight,ye,void 0,void 0,void 0,void 0,void 0,void 0,ce),stencilBuffer:y.stencil,colorSpace:e.outputColorSpace,samples:y.antialias?4:0});const Ne=e.properties.get(v);Ne.__ignoreDepthValues=g.ignoreDepthValues}v.isXRRenderTarget=!0,this.setFoveation(c),d=null,s=await r.requestReferenceSpace(l),q.setContext(r),q.start(),i.isPresenting=!0,i.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(r!==null)return r.environmentBlendMode};function I(re){for(let ce=0;ce<re.removed.length;ce++){const ye=re.removed[ce],me=S.indexOf(ye);me>=0&&(S[me]=null,w[me].disconnect(ye))}for(let ce=0;ce<re.added.length;ce++){const ye=re.added[ce];let me=S.indexOf(ye);if(me===-1){for(let Ne=0;Ne<w.length;Ne++)if(Ne>=S.length){S.push(ye),me=Ne;break}else if(S[Ne]===null){S[Ne]=ye,me=Ne;break}if(me===-1)break}const be=w[me];be&&be.connect(ye)}}const W=new Ce,X=new Ce;function V(re,ce,ye){W.setFromMatrixPosition(ce.matrixWorld),X.setFromMatrixPosition(ye.matrixWorld);const me=W.distanceTo(X),be=ce.projectionMatrix.elements,Ne=ye.projectionMatrix.elements,he=be[14]/(be[10]-1),Ae=be[14]/(be[10]+1),Be=(be[9]+1)/be[5],le=(be[9]-1)/be[5],lt=(be[8]-1)/be[0],z=(Ne[8]+1)/Ne[0],G=he*lt,ne=he*z,Q=me/(-lt+z),ee=Q*-lt;ce.matrixWorld.decompose(re.position,re.quaternion,re.scale),re.translateX(ee),re.translateZ(Q),re.matrixWorld.compose(re.position,re.quaternion,re.scale),re.matrixWorldInverse.copy(re.matrixWorld).invert();const ae=he+Q,ie=Ae+Q,we=G-ee,ve=ne+(me-ee),k=Be*Ae/ie*ae,O=le*Ae/ie*ae;re.projectionMatrix.makePerspective(we,ve,k,O,ae,ie),re.projectionMatrixInverse.copy(re.projectionMatrix).invert()}function Y(re,ce){ce===null?re.matrixWorld.copy(re.matrix):re.matrixWorld.multiplyMatrices(ce.matrixWorld,re.matrix),re.matrixWorldInverse.copy(re.matrixWorld).invert()}this.updateCamera=function(re){if(r===null)return;P.near=C.near=N.near=re.near,P.far=C.far=N.far=re.far,(L!==P.near||B!==P.far)&&(r.updateRenderState({depthNear:P.near,depthFar:P.far}),L=P.near,B=P.far);const ce=re.parent,ye=P.cameras;Y(P,ce);for(let me=0;me<ye.length;me++)Y(ye[me],ce);ye.length===2?V(P,N,C):P.projectionMatrix.copy(N.projectionMatrix),J(re,P,ce)};function J(re,ce,ye){ye===null?re.matrix.copy(ce.matrixWorld):(re.matrix.copy(ye.matrixWorld),re.matrix.invert(),re.matrix.multiply(ce.matrixWorld)),re.matrix.decompose(re.position,re.quaternion,re.scale),re.updateMatrixWorld(!0),re.projectionMatrix.copy(ce.projectionMatrix),re.projectionMatrixInverse.copy(ce.projectionMatrixInverse),re.isPerspectiveCamera&&(re.fov=Xp*2*Math.atan(1/re.projectionMatrix.elements[5]),re.zoom=1)}this.getCamera=function(){return P},this.getFoveation=function(){if(!(g===null&&m===null))return c},this.setFoveation=function(re){c=re,g!==null&&(g.fixedFoveation=re),m!==null&&m.fixedFoveation!==void 0&&(m.fixedFoveation=re)};let se=null;function H(re,ce){if(f=ce.getViewerPose(d||s),b=ce,f!==null){const ye=f.views;m!==null&&(e.setRenderTargetFramebuffer(v,m.framebuffer),e.setRenderTarget(v));let me=!1;ye.length!==P.cameras.length&&(P.cameras.length=0,me=!0);for(let be=0;be<ye.length;be++){const Ne=ye[be];let he=null;if(m!==null)he=m.getViewport(Ne);else{const Be=h.getViewSubImage(g,Ne);he=Be.viewport,be===0&&(e.setRenderTargetTextures(v,Be.colorTexture,g.ignoreDepthValues?void 0:Be.depthStencilTexture),e.setRenderTarget(v))}let Ae=F[be];Ae===void 0&&(Ae=new ma,Ae.layers.enable(be),Ae.viewport=new Cn,F[be]=Ae),Ae.matrix.fromArray(Ne.transform.matrix),Ae.matrix.decompose(Ae.position,Ae.quaternion,Ae.scale),Ae.projectionMatrix.fromArray(Ne.projectionMatrix),Ae.projectionMatrixInverse.copy(Ae.projectionMatrix).invert(),Ae.viewport.set(he.x,he.y,he.width,he.height),be===0&&(P.matrix.copy(Ae.matrix),P.matrix.decompose(P.position,P.quaternion,P.scale)),me===!0&&P.cameras.push(Ae)}}for(let ye=0;ye<w.length;ye++){const me=S[ye],be=w[ye];me!==null&&be!==void 0&&be.update(me,ce,d||s)}se&&se(re,ce),ce.detectedPlanes&&i.dispatchEvent({type:"planesdetected",data:ce}),b=null}const q=new YB;q.setAnimationLoop(H),this.setAnimationLoop=function(re){se=re},this.dispose=function(){}}}function Doe(t,e){function n(x,v){x.matrixAutoUpdate===!0&&x.updateMatrix(),v.value.copy(x.matrix)}function i(x,v){v.color.getRGB(x.fogColor.value,WB(t)),v.isFog?(x.fogNear.value=v.near,x.fogFar.value=v.far):v.isFogExp2&&(x.fogDensity.value=v.density)}function r(x,v,w,S,A){v.isMeshBasicMaterial||v.isMeshLambertMaterial?a(x,v):v.isMeshToonMaterial?(a(x,v),h(x,v)):v.isMeshPhongMaterial?(a(x,v),f(x,v)):v.isMeshStandardMaterial?(a(x,v),g(x,v),v.isMeshPhysicalMaterial&&m(x,v,A)):v.isMeshMatcapMaterial?(a(x,v),b(x,v)):v.isMeshDepthMaterial?a(x,v):v.isMeshDistanceMaterial?(a(x,v),y(x,v)):v.isMeshNormalMaterial?a(x,v):v.isLineBasicMaterial?(s(x,v),v.isLineDashedMaterial&&l(x,v)):v.isPointsMaterial?c(x,v,w,S):v.isSpriteMaterial?d(x,v):v.isShadowMaterial?(x.color.value.copy(v.color),x.opacity.value=v.opacity):v.isShaderMaterial&&(v.uniformsNeedUpdate=!1)}function a(x,v){x.opacity.value=v.opacity,v.color&&x.diffuse.value.copy(v.color),v.emissive&&x.emissive.value.copy(v.emissive).multiplyScalar(v.emissiveIntensity),v.map&&(x.map.value=v.map,n(v.map,x.mapTransform)),v.alphaMap&&(x.alphaMap.value=v.alphaMap,n(v.alphaMap,x.alphaMapTransform)),v.bumpMap&&(x.bumpMap.value=v.bumpMap,n(v.bumpMap,x.bumpMapTransform),x.bumpScale.value=v.bumpScale,v.side===Zr&&(x.bumpScale.value*=-1)),v.normalMap&&(x.normalMap.value=v.normalMap,n(v.normalMap,x.normalMapTransform),x.normalScale.value.copy(v.normalScale),v.side===Zr&&x.normalScale.value.negate()),v.displacementMap&&(x.displacementMap.value=v.displacementMap,n(v.displacementMap,x.displacementMapTransform),x.displacementScale.value=v.displacementScale,x.displacementBias.value=v.displacementBias),v.emissiveMap&&(x.emissiveMap.value=v.emissiveMap,n(v.emissiveMap,x.emissiveMapTransform)),v.specularMap&&(x.specularMap.value=v.specularMap,n(v.specularMap,x.specularMapTransform)),v.alphaTest>0&&(x.alphaTest.value=v.alphaTest);const w=e.get(v).envMap;if(w&&(x.envMap.value=w,x.flipEnvMap.value=w.isCubeTexture&&w.isRenderTargetTexture===!1?-1:1,x.reflectivity.value=v.reflectivity,x.ior.value=v.ior,x.refractionRatio.value=v.refractionRatio),v.lightMap){x.lightMap.value=v.lightMap;const S=t._useLegacyLights===!0?Math.PI:1;x.lightMapIntensity.value=v.lightMapIntensity*S,n(v.lightMap,x.lightMapTransform)}v.aoMap&&(x.aoMap.value=v.aoMap,x.aoMapIntensity.value=v.aoMapIntensity,n(v.aoMap,x.aoMapTransform))}function s(x,v){x.diffuse.value.copy(v.color),x.opacity.value=v.opacity,v.map&&(x.map.value=v.map,n(v.map,x.mapTransform))}function l(x,v){x.dashSize.value=v.dashSize,x.totalSize.value=v.dashSize+v.gapSize,x.scale.value=v.scale}function c(x,v,w,S){x.diffuse.value.copy(v.color),x.opacity.value=v.opacity,x.size.value=v.size*w,x.scale.value=S*.5,v.map&&(x.map.value=v.map,n(v.map,x.uvTransform)),v.alphaMap&&(x.alphaMap.value=v.alphaMap,n(v.alphaMap,x.alphaMapTransform)),v.alphaTest>0&&(x.alphaTest.value=v.alphaTest)}function d(x,v){x.diffuse.value.copy(v.color),x.opacity.value=v.opacity,x.rotation.value=v.rotation,v.map&&(x.map.value=v.map,n(v.map,x.mapTransform)),v.alphaMap&&(x.alphaMap.value=v.alphaMap,n(v.alphaMap,x.alphaMapTransform)),v.alphaTest>0&&(x.alphaTest.value=v.alphaTest)}function f(x,v){x.specular.value.copy(v.specular),x.shininess.value=Math.max(v.shininess,1e-4)}function h(x,v){v.gradientMap&&(x.gradientMap.value=v.gradientMap)}function g(x,v){x.metalness.value=v.metalness,v.metalnessMap&&(x.metalnessMap.value=v.metalnessMap,n(v.metalnessMap,x.metalnessMapTransform)),x.roughness.value=v.roughness,v.roughnessMap&&(x.roughnessMap.value=v.roughnessMap,n(v.roughnessMap,x.roughnessMapTransform)),e.get(v).envMap&&(x.envMapIntensity.value=v.envMapIntensity)}function m(x,v,w){x.ior.value=v.ior,v.sheen>0&&(x.sheenColor.value.copy(v.sheenColor).multiplyScalar(v.sheen),x.sheenRoughness.value=v.sheenRoughness,v.sheenColorMap&&(x.sheenColorMap.value=v.sheenColorMap,n(v.sheenColorMap,x.sheenColorMapTransform)),v.sheenRoughnessMap&&(x.sheenRoughnessMap.value=v.sheenRoughnessMap,n(v.sheenRoughnessMap,x.sheenRoughnessMapTransform))),v.clearcoat>0&&(x.clearcoat.value=v.clearcoat,x.clearcoatRoughness.value=v.clearcoatRoughness,v.clearcoatMap&&(x.clearcoatMap.value=v.clearcoatMap,n(v.clearcoatMap,x.clearcoatMapTransform)),v.clearcoatRoughnessMap&&(x.clearcoatRoughnessMap.value=v.clearcoatRoughnessMap,n(v.clearcoatRoughnessMap,x.clearcoatRoughnessMapTransform)),v.clearcoatNormalMap&&(x.clearcoatNormalMap.value=v.clearcoatNormalMap,n(v.clearcoatNormalMap,x.clearcoatNormalMapTransform),x.clearcoatNormalScale.value.copy(v.clearcoatNormalScale),v.side===Zr&&x.clearcoatNormalScale.value.negate())),v.iridescence>0&&(x.iridescence.value=v.iridescence,x.iridescenceIOR.value=v.iridescenceIOR,x.iridescenceThicknessMinimum.value=v.iridescenceThicknessRange[0],x.iridescenceThicknessMaximum.value=v.iridescenceThicknessRange[1],v.iridescenceMap&&(x.iridescenceMap.value=v.iridescenceMap,n(v.iridescenceMap,x.iridescenceMapTransform)),v.iridescenceThicknessMap&&(x.iridescenceThicknessMap.value=v.iridescenceThicknessMap,n(v.iridescenceThicknessMap,x.iridescenceThicknessMapTransform))),v.transmission>0&&(x.transmission.value=v.transmission,x.transmissionSamplerMap.value=w.texture,x.transmissionSamplerSize.value.set(w.width,w.height),v.transmissionMap&&(x.transmissionMap.value=v.transmissionMap,n(v.transmissionMap,x.transmissionMapTransform)),x.thickness.value=v.thickness,v.thicknessMap&&(x.thicknessMap.value=v.thicknessMap,n(v.thicknessMap,x.thicknessMapTransform)),x.attenuationDistance.value=v.attenuationDistance,x.attenuationColor.value.copy(v.attenuationColor)),v.anisotropy>0&&(x.anisotropyVector.value.set(v.anisotropy*Math.cos(v.anisotropyRotation),v.anisotropy*Math.sin(v.anisotropyRotation)),v.anisotropyMap&&(x.anisotropyMap.value=v.anisotropyMap,n(v.anisotropyMap,x.anisotropyMapTransform))),x.specularIntensity.value=v.specularIntensity,x.specularColor.value.copy(v.specularColor),v.specularColorMap&&(x.specularColorMap.value=v.specularColorMap,n(v.specularColorMap,x.specularColorMapTransform)),v.specularIntensityMap&&(x.specularIntensityMap.value=v.specularIntensityMap,n(v.specularIntensityMap,x.specularIntensityMapTransform))}function b(x,v){v.matcap&&(x.matcap.value=v.matcap)}function y(x,v){const w=e.get(v).light;x.referencePosition.value.setFromMatrixPosition(w.matrixWorld),x.nearDistance.value=w.shadow.camera.near,x.farDistance.value=w.shadow.camera.far}return{refreshFogUniforms:i,refreshMaterialUniforms:r}}function Noe(t,e,n,i){let r={},a={},s=[];const l=n.isWebGL2?t.getParameter(t.MAX_UNIFORM_BUFFER_BINDINGS):0;function c(w,S){const A=S.program;i.uniformBlockBinding(w,A)}function d(w,S){let A=r[w.id];A===void 0&&(b(w),A=f(w),r[w.id]=A,w.addEventListener("dispose",x));const R=S.program;i.updateUBOMapping(w,R);const N=e.render.frame;a[w.id]!==N&&(g(w),a[w.id]=N)}function f(w){const S=h();w.__bindingPointIndex=S;const A=t.createBuffer(),R=w.__size,N=w.usage;return t.bindBuffer(t.UNIFORM_BUFFER,A),t.bufferData(t.UNIFORM_BUFFER,R,N),t.bindBuffer(t.UNIFORM_BUFFER,null),t.bindBufferBase(t.UNIFORM_BUFFER,S,A),A}function h(){for(let w=0;w<l;w++)if(s.indexOf(w)===-1)return s.push(w),w;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function g(w){const S=r[w.id],A=w.uniforms,R=w.__cache;t.bindBuffer(t.UNIFORM_BUFFER,S);for(let N=0,C=A.length;N<C;N++){const F=A[N];if(m(F,N,R)===!0){const P=F.__offset,L=Array.isArray(F.value)?F.value:[F.value];let B=0;for(let U=0;U<L.length;U++){const $=L[U],I=y($);typeof $=="number"?(F.__data[0]=$,t.bufferSubData(t.UNIFORM_BUFFER,P+B,F.__data)):$.isMatrix3?(F.__data[0]=$.elements[0],F.__data[1]=$.elements[1],F.__data[2]=$.elements[2],F.__data[3]=$.elements[0],F.__data[4]=$.elements[3],F.__data[5]=$.elements[4],F.__data[6]=$.elements[5],F.__data[7]=$.elements[0],F.__data[8]=$.elements[6],F.__data[9]=$.elements[7],F.__data[10]=$.elements[8],F.__data[11]=$.elements[0]):($.toArray(F.__data,B),B+=I.storage/Float32Array.BYTES_PER_ELEMENT)}t.bufferSubData(t.UNIFORM_BUFFER,P,F.__data)}}t.bindBuffer(t.UNIFORM_BUFFER,null)}function m(w,S,A){const R=w.value;if(A[S]===void 0){if(typeof R=="number")A[S]=R;else{const N=Array.isArray(R)?R:[R],C=[];for(let F=0;F<N.length;F++)C.push(N[F].clone());A[S]=C}return!0}else if(typeof R=="number"){if(A[S]!==R)return A[S]=R,!0}else{const N=Array.isArray(A[S])?A[S]:[A[S]],C=Array.isArray(R)?R:[R];for(let F=0;F<N.length;F++){const P=N[F];if(P.equals(C[F])===!1)return P.copy(C[F]),!0}}return!1}function b(w){const S=w.uniforms;let A=0;const R=16;let N=0;for(let C=0,F=S.length;C<F;C++){const P=S[C],L={boundary:0,storage:0},B=Array.isArray(P.value)?P.value:[P.value];for(let U=0,$=B.length;U<$;U++){const I=B[U],W=y(I);L.boundary+=W.boundary,L.storage+=W.storage}if(P.__data=new Float32Array(L.storage/Float32Array.BYTES_PER_ELEMENT),P.__offset=A,C>0){N=A%R;const U=R-N;N!==0&&U-L.boundary<0&&(A+=R-N,P.__offset=A)}A+=L.storage}return N=A%R,N>0&&(A+=R-N),w.__size=A,w.__cache={},this}function y(w){const S={boundary:0,storage:0};return typeof w=="number"?(S.boundary=4,S.storage=4):w.isVector2?(S.boundary=8,S.storage=8):w.isVector3||w.isColor?(S.boundary=16,S.storage=12):w.isVector4?(S.boundary=16,S.storage=16):w.isMatrix3?(S.boundary=48,S.storage=48):w.isMatrix4?(S.boundary=64,S.storage=64):w.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",w),S}function x(w){const S=w.target;S.removeEventListener("dispose",x);const A=s.indexOf(S.__bindingPointIndex);s.splice(A,1),t.deleteBuffer(r[S.id]),delete r[S.id],delete a[S.id]}function v(){for(const w in r)t.deleteBuffer(r[w]);s=[],r={},a={}}return{bind:c,update:d,dispose:v}}class $M{constructor(e={}){const{canvas:n=Rne(),context:i=null,depth:r=!0,stencil:a=!0,alpha:s=!1,antialias:l=!1,premultipliedAlpha:c=!0,preserveDrawingBuffer:d=!1,powerPreference:f="default",failIfMajorPerformanceCaveat:h=!1}=e;this.isWebGLRenderer=!0;let g;i!==null?g=i.getContextAttributes().alpha:g=s;const m=new Uint32Array(4),b=new Int32Array(4);let y=null,x=null;const v=[],w=[];this.domElement=n,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this._outputColorSpace=fr,this._useLegacyLights=!1,this.toneMapping=rc,this.toneMappingExposure=1;const S=this;let A=!1,R=0,N=0,C=null,F=-1,P=null;const L=new Cn,B=new Cn;let U=null;const $=new Nt(0);let I=0,W=n.width,X=n.height,V=1,Y=null,J=null;const se=new Cn(0,0,W,X),H=new Cn(0,0,W,X);let q=!1;const re=new yy;let ce=!1,ye=!1,me=null;const be=new Ln,Ne=new Ut,he=new Ce,Ae={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function Be(){return C===null?V:1}let le=i;function lt(oe,Ue){for(let Xe=0;Xe<oe.length;Xe++){const qe=oe[Xe],We=n.getContext(qe,Ue);if(We!==null)return We}return null}try{const oe={alpha:!0,depth:r,stencil:a,antialias:l,premultipliedAlpha:c,preserveDrawingBuffer:d,powerPreference:f,failIfMajorPerformanceCaveat:h};if("setAttribute"in n&&n.setAttribute("data-engine",`three.js r${gy}`),n.addEventListener("webglcontextlost",tt,!1),n.addEventListener("webglcontextrestored",de,!1),n.addEventListener("webglcontextcreationerror",Le,!1),le===null){const Ue=["webgl2","webgl","experimental-webgl"];if(S.isWebGL1Renderer===!0&&Ue.shift(),le=lt(Ue,oe),le===null)throw lt(Ue)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}typeof WebGLRenderingContext<"u"&&le instanceof WebGLRenderingContext&&console.warn("THREE.WebGLRenderer: WebGL 1 support was deprecated in r153 and will be removed in r163."),le.getShaderPrecisionFormat===void 0&&(le.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(oe){throw console.error("THREE.WebGLRenderer: "+oe.message),oe}let z,G,ne,Q,ee,ae,ie,we,ve,k,O,K,pe,xe,fe,Ke,Ie,$e,rt,ke,De,ct,et,Je;function st(){z=new Gae(le),G=new Uae(le,z,e),z.init(G),ct=new Toe(le,z,G),ne=new Moe(le,z,G),Q=new Wae(le),ee=new doe,ae=new Aoe(le,z,ne,ee,G,ct,Q),ie=new Fae(S),we=new Hae(S),ve=new Jne(le,G),et=new Lae(le,z,ve,G),k=new Vae(le,ve,Q,et),O=new Kae(le,k,ve,Q),rt=new Yae(le,G,ae),Ke=new kae(ee),K=new uoe(S,ie,we,z,G,et,Ke),pe=new Doe(S,ee),xe=new hoe,fe=new yoe(z,G),$e=new Oae(S,ie,we,ne,O,g,c),Ie=new Eoe(S,O,G),Je=new Noe(le,Q,G,ne),ke=new Iae(le,z,Q,G),De=new $ae(le,z,Q,G),Q.programs=K.programs,S.capabilities=G,S.extensions=z,S.properties=ee,S.renderLists=xe,S.shadowMap=Ie,S.state=ne,S.info=Q}st();const ue=new Poe(S,le);this.xr=ue,this.getContext=function(){return le},this.getContextAttributes=function(){return le.getContextAttributes()},this.forceContextLoss=function(){const oe=z.get("WEBGL_lose_context");oe&&oe.loseContext()},this.forceContextRestore=function(){const oe=z.get("WEBGL_lose_context");oe&&oe.restoreContext()},this.getPixelRatio=function(){return V},this.setPixelRatio=function(oe){oe!==void 0&&(V=oe,this.setSize(W,X,!1))},this.getSize=function(oe){return oe.set(W,X)},this.setSize=function(oe,Ue,Xe=!0){if(ue.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}W=oe,X=Ue,n.width=Math.floor(oe*V),n.height=Math.floor(Ue*V),Xe===!0&&(n.style.width=oe+"px",n.style.height=Ue+"px"),this.setViewport(0,0,oe,Ue)},this.getDrawingBufferSize=function(oe){return oe.set(W*V,X*V).floor()},this.setDrawingBufferSize=function(oe,Ue,Xe){W=oe,X=Ue,V=Xe,n.width=Math.floor(oe*Xe),n.height=Math.floor(Ue*Xe),this.setViewport(0,0,oe,Ue)},this.getCurrentViewport=function(oe){return oe.copy(L)},this.getViewport=function(oe){return oe.copy(se)},this.setViewport=function(oe,Ue,Xe,qe){oe.isVector4?se.set(oe.x,oe.y,oe.z,oe.w):se.set(oe,Ue,Xe,qe),ne.viewport(L.copy(se).multiplyScalar(V).floor())},this.getScissor=function(oe){return oe.copy(H)},this.setScissor=function(oe,Ue,Xe,qe){oe.isVector4?H.set(oe.x,oe.y,oe.z,oe.w):H.set(oe,Ue,Xe,qe),ne.scissor(B.copy(H).multiplyScalar(V).floor())},this.getScissorTest=function(){return q},this.setScissorTest=function(oe){ne.setScissorTest(q=oe)},this.setOpaqueSort=function(oe){Y=oe},this.setTransparentSort=function(oe){J=oe},this.getClearColor=function(oe){return oe.copy($e.getClearColor())},this.setClearColor=function(){$e.setClearColor.apply($e,arguments)},this.getClearAlpha=function(){return $e.getClearAlpha()},this.setClearAlpha=function(){$e.setClearAlpha.apply($e,arguments)},this.clear=function(oe=!0,Ue=!0,Xe=!0){let qe=0;if(oe){let We=!1;if(C!==null){const gt=C.texture.format;We=gt===DB||gt===PB||gt===RB}if(We){const gt=C.texture.type,Z=gt===ac||gt===Jl||gt===LT||gt===lu||gt===TB||gt===CB,_e=$e.getClearColor(),Pe=$e.getClearAlpha(),Re=_e.r,Ee=_e.g,Ze=_e.b;Z?(m[0]=Re,m[1]=Ee,m[2]=Ze,m[3]=Pe,le.clearBufferuiv(le.COLOR,0,m)):(b[0]=Re,b[1]=Ee,b[2]=Ze,b[3]=Pe,le.clearBufferiv(le.COLOR,0,b))}else qe|=le.COLOR_BUFFER_BIT}Ue&&(qe|=le.DEPTH_BUFFER_BIT),Xe&&(qe|=le.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),le.clear(qe)},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(){n.removeEventListener("webglcontextlost",tt,!1),n.removeEventListener("webglcontextrestored",de,!1),n.removeEventListener("webglcontextcreationerror",Le,!1),xe.dispose(),fe.dispose(),ee.dispose(),ie.dispose(),we.dispose(),O.dispose(),et.dispose(),Je.dispose(),K.dispose(),ue.dispose(),ue.removeEventListener("sessionstart",Wt),ue.removeEventListener("sessionend",Ct),me&&(me.dispose(),me=null),mn.stop()};function tt(oe){oe.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),A=!0}function de(){console.log("THREE.WebGLRenderer: Context Restored."),A=!1;const oe=Q.autoReset,Ue=Ie.enabled,Xe=Ie.autoUpdate,qe=Ie.needsUpdate,We=Ie.type;st(),Q.autoReset=oe,Ie.enabled=Ue,Ie.autoUpdate=Xe,Ie.needsUpdate=qe,Ie.type=We}function Le(oe){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",oe.statusMessage)}function Me(oe){const Ue=oe.target;Ue.removeEventListener("dispose",Me),ge(Ue)}function ge(oe){je(oe),ee.remove(oe)}function je(oe){const Ue=ee.get(oe).programs;Ue!==void 0&&(Ue.forEach(function(Xe){K.releaseProgram(Xe)}),oe.isShaderMaterial&&K.releaseShaderCache(oe))}this.renderBufferDirect=function(oe,Ue,Xe,qe,We,gt){Ue===null&&(Ue=Ae);const Z=We.isMesh&&We.matrixWorld.determinant()<0,_e=ei(oe,Ue,Xe,qe,We);ne.setMaterial(qe,Z);let Pe=Xe.index,Re=1;if(qe.wireframe===!0){if(Pe=k.getWireframeAttribute(Xe),Pe===void 0)return;Re=2}const Ee=Xe.drawRange,Ze=Xe.attributes.position;let ot=Ee.start*Re,ft=(Ee.start+Ee.count)*Re;gt!==null&&(ot=Math.max(ot,gt.start*Re),ft=Math.min(ft,(gt.start+gt.count)*Re)),Pe!==null?(ot=Math.max(ot,0),ft=Math.min(ft,Pe.count)):Ze!=null&&(ot=Math.max(ot,0),ft=Math.min(ft,Ze.count));const dt=ft-ot;if(dt<0||dt===1/0)return;et.setup(We,qe,_e,Xe,Pe);let Et,xt=ke;if(Pe!==null&&(Et=ve.get(Pe),xt=De,xt.setIndex(Et)),We.isMesh)qe.wireframe===!0?(ne.setLineWidth(qe.wireframeLinewidth*Be()),xt.setMode(le.LINES)):xt.setMode(le.TRIANGLES);else if(We.isLine){let ut=qe.linewidth;ut===void 0&&(ut=1),ne.setLineWidth(ut*Be()),We.isLineSegments?xt.setMode(le.LINES):We.isLineLoop?xt.setMode(le.LINE_LOOP):xt.setMode(le.LINE_STRIP)}else We.isPoints?xt.setMode(le.POINTS):We.isSprite&&xt.setMode(le.TRIANGLES);if(We.isBatchedMesh)xt.renderMultiDraw(We._multiDrawStarts,We._multiDrawCounts,We._multiDrawCount);else if(We.isInstancedMesh)xt.renderInstances(ot,dt,We.count);else if(Xe.isInstancedBufferGeometry){const ut=Xe._maxInstanceCount!==void 0?Xe._maxInstanceCount:1/0,Lt=Math.min(Xe.instanceCount,ut);xt.renderInstances(ot,dt,Lt)}else xt.render(ot,dt)};function at(oe,Ue,Xe){oe.transparent===!0&&oe.side===Po&&oe.forceSinglePass===!1?(oe.side=Zr,oe.needsUpdate=!0,mr(oe,Ue,Xe),oe.side=cc,oe.needsUpdate=!0,mr(oe,Ue,Xe),oe.side=Po):mr(oe,Ue,Xe)}this.compile=function(oe,Ue,Xe=null){Xe===null&&(Xe=oe),x=fe.get(Xe),x.init(),w.push(x),Xe.traverseVisible(function(We){We.isLight&&We.layers.test(Ue.layers)&&(x.pushLight(We),We.castShadow&&x.pushShadow(We))}),oe!==Xe&&oe.traverseVisible(function(We){We.isLight&&We.layers.test(Ue.layers)&&(x.pushLight(We),We.castShadow&&x.pushShadow(We))}),x.setupLights(S._useLegacyLights);const qe=new Set;return oe.traverse(function(We){const gt=We.material;if(gt)if(Array.isArray(gt))for(let Z=0;Z<gt.length;Z++){const _e=gt[Z];at(_e,Xe,We),qe.add(_e)}else at(gt,Xe,We),qe.add(gt)}),w.pop(),x=null,qe},this.compileAsync=function(oe,Ue,Xe=null){const qe=this.compile(oe,Ue,Xe);return new Promise(We=>{function gt(){if(qe.forEach(function(Z){ee.get(Z).currentProgram.isReady()&&qe.delete(Z)}),qe.size===0){We(oe);return}setTimeout(gt,10)}z.get("KHR_parallel_shader_compile")!==null?gt():setTimeout(gt,10)})};let mt=null;function wt(oe){mt&&mt(oe)}function Wt(){mn.stop()}function Ct(){mn.start()}const mn=new YB;mn.setAnimationLoop(wt),typeof self<"u"&&mn.setContext(self),this.setAnimationLoop=function(oe){mt=oe,ue.setAnimationLoop(oe),oe===null?mn.stop():mn.start()},ue.addEventListener("sessionstart",Wt),ue.addEventListener("sessionend",Ct),this.render=function(oe,Ue){if(Ue!==void 0&&Ue.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(A===!0)return;oe.matrixWorldAutoUpdate===!0&&oe.updateMatrixWorld(),Ue.parent===null&&Ue.matrixWorldAutoUpdate===!0&&Ue.updateMatrixWorld(),ue.enabled===!0&&ue.isPresenting===!0&&(ue.cameraAutoUpdate===!0&&ue.updateCamera(Ue),Ue=ue.getCamera()),oe.isScene===!0&&oe.onBeforeRender(S,oe,Ue,C),x=fe.get(oe,w.length),x.init(),w.push(x),be.multiplyMatrices(Ue.projectionMatrix,Ue.matrixWorldInverse),re.setFromProjectionMatrix(be),ye=this.localClippingEnabled,ce=Ke.init(this.clippingPlanes,ye),y=xe.get(oe,v.length),y.init(),v.push(y),Rn(oe,Ue,0,S.sortObjects),y.finish(),S.sortObjects===!0&&y.sort(Y,J),this.info.render.frame++,ce===!0&&Ke.beginShadows();const Xe=x.state.shadowsArray;if(Ie.render(Xe,oe,Ue),ce===!0&&Ke.endShadows(),this.info.autoReset===!0&&this.info.reset(),$e.render(y,oe),x.setupLights(S._useLegacyLights),Ue.isArrayCamera){const qe=Ue.cameras;for(let We=0,gt=qe.length;We<gt;We++){const Z=qe[We];zi(y,oe,Z,Z.viewport)}}else zi(y,oe,Ue);C!==null&&(ae.updateMultisampleRenderTarget(C),ae.updateRenderTargetMipmap(C)),oe.isScene===!0&&oe.onAfterRender(S,oe,Ue),et.resetDefaultState(),F=-1,P=null,w.pop(),w.length>0?x=w[w.length-1]:x=null,v.pop(),v.length>0?y=v[v.length-1]:y=null};function Rn(oe,Ue,Xe,qe){if(oe.visible===!1)return;if(oe.layers.test(Ue.layers)){if(oe.isGroup)Xe=oe.renderOrder;else if(oe.isLOD)oe.autoUpdate===!0&&oe.update(Ue);else if(oe.isLight)x.pushLight(oe),oe.castShadow&&x.pushShadow(oe);else if(oe.isSprite){if(!oe.frustumCulled||re.intersectsSprite(oe)){qe&&he.setFromMatrixPosition(oe.matrixWorld).applyMatrix4(be);const Z=O.update(oe),_e=oe.material;_e.visible&&y.push(oe,Z,_e,Xe,he.z,null)}}else if((oe.isMesh||oe.isLine||oe.isPoints)&&(!oe.frustumCulled||re.intersectsObject(oe))){const Z=O.update(oe),_e=oe.material;if(qe&&(oe.boundingSphere!==void 0?(oe.boundingSphere===null&&oe.computeBoundingSphere(),he.copy(oe.boundingSphere.center)):(Z.boundingSphere===null&&Z.computeBoundingSphere(),he.copy(Z.boundingSphere.center)),he.applyMatrix4(oe.matrixWorld).applyMatrix4(be)),Array.isArray(_e)){const Pe=Z.groups;for(let Re=0,Ee=Pe.length;Re<Ee;Re++){const Ze=Pe[Re],ot=_e[Ze.materialIndex];ot&&ot.visible&&y.push(oe,Z,ot,Xe,he.z,Ze)}}else _e.visible&&y.push(oe,Z,_e,Xe,he.z,null)}}const gt=oe.children;for(let Z=0,_e=gt.length;Z<_e;Z++)Rn(gt[Z],Ue,Xe,qe)}function zi(oe,Ue,Xe,qe){const We=oe.opaque,gt=oe.transmissive,Z=oe.transparent;x.setupLightsView(Xe),ce===!0&&Ke.setGlobalState(S.clippingPlanes,Xe),gt.length>0&&wi(We,gt,Ue,Xe),qe&&ne.viewport(L.copy(qe)),We.length>0&&Bi(We,Ue,Xe),gt.length>0&&Bi(gt,Ue,Xe),Z.length>0&&Bi(Z,Ue,Xe),ne.buffers.depth.setTest(!0),ne.buffers.depth.setMask(!0),ne.buffers.color.setMask(!0),ne.setPolygonOffset(!1)}function wi(oe,Ue,Xe,qe){if((Xe.isScene===!0?Xe.overrideMaterial:null)!==null)return;const gt=G.isWebGL2;me===null&&(me=new Eu(1,1,{generateMipmaps:!0,type:z.has("EXT_color_buffer_half_float")?$p:ac,minFilter:Vp,samples:gt?4:0})),S.getDrawingBufferSize(Ne),gt?me.setSize(Ne.x,Ne.y):me.setSize(lx(Ne.x),lx(Ne.y));const Z=S.getRenderTarget();S.setRenderTarget(me),S.getClearColor($),I=S.getClearAlpha(),I<1&&S.setClearColor(16777215,.5),S.clear();const _e=S.toneMapping;S.toneMapping=rc,Bi(oe,Xe,qe),ae.updateMultisampleRenderTarget(me),ae.updateRenderTargetMipmap(me);let Pe=!1;for(let Re=0,Ee=Ue.length;Re<Ee;Re++){const Ze=Ue[Re],ot=Ze.object,ft=Ze.geometry,dt=Ze.material,Et=Ze.group;if(dt.side===Po&&ot.layers.test(qe.layers)){const xt=dt.side;dt.side=Zr,dt.needsUpdate=!0,tr(ot,Xe,qe,ft,dt,Et),dt.side=xt,dt.needsUpdate=!0,Pe=!0}}Pe===!0&&(ae.updateMultisampleRenderTarget(me),ae.updateRenderTargetMipmap(me)),S.setRenderTarget(Z),S.setClearColor($,I),S.toneMapping=_e}function Bi(oe,Ue,Xe){const qe=Ue.isScene===!0?Ue.overrideMaterial:null;for(let We=0,gt=oe.length;We<gt;We++){const Z=oe[We],_e=Z.object,Pe=Z.geometry,Re=qe===null?Z.material:qe,Ee=Z.group;_e.layers.test(Xe.layers)&&tr(_e,Ue,Xe,Pe,Re,Ee)}}function tr(oe,Ue,Xe,qe,We,gt){oe.onBeforeRender(S,Ue,Xe,qe,We,gt),oe.modelViewMatrix.multiplyMatrices(Xe.matrixWorldInverse,oe.matrixWorld),oe.normalMatrix.getNormalMatrix(oe.modelViewMatrix),We.onBeforeRender(S,Ue,Xe,qe,oe,gt),We.transparent===!0&&We.side===Po&&We.forceSinglePass===!1?(We.side=Zr,We.needsUpdate=!0,S.renderBufferDirect(Xe,Ue,qe,We,oe,gt),We.side=cc,We.needsUpdate=!0,S.renderBufferDirect(Xe,Ue,qe,We,oe,gt),We.side=Po):S.renderBufferDirect(Xe,Ue,qe,We,oe,gt),oe.onAfterRender(S,Ue,Xe,qe,We,gt)}function mr(oe,Ue,Xe){Ue.isScene!==!0&&(Ue=Ae);const qe=ee.get(oe),We=x.state.lights,gt=x.state.shadowsArray,Z=We.state.version,_e=K.getParameters(oe,We.state,gt,Ue,Xe),Pe=K.getProgramCacheKey(_e);let Re=qe.programs;qe.environment=oe.isMeshStandardMaterial?Ue.environment:null,qe.fog=Ue.fog,qe.envMap=(oe.isMeshStandardMaterial?we:ie).get(oe.envMap||qe.environment),Re===void 0&&(oe.addEventListener("dispose",Me),Re=new Map,qe.programs=Re);let Ee=Re.get(Pe);if(Ee!==void 0){if(qe.currentProgram===Ee&&qe.lightsStateVersion===Z)return Wn(oe,_e),Ee}else _e.uniforms=K.getUniforms(oe),oe.onBuild(Xe,_e,S),oe.onBeforeCompile(_e,S),Ee=K.acquireProgram(_e,Pe),Re.set(Pe,Ee),qe.uniforms=_e.uniforms;const Ze=qe.uniforms;return(!oe.isShaderMaterial&&!oe.isRawShaderMaterial||oe.clipping===!0)&&(Ze.clippingPlanes=Ke.uniform),Wn(oe,_e),qe.needsLights=ol(oe),qe.lightsStateVersion=Z,qe.needsLights&&(Ze.ambientLightColor.value=We.state.ambient,Ze.lightProbe.value=We.state.probe,Ze.directionalLights.value=We.state.directional,Ze.directionalLightShadows.value=We.state.directionalShadow,Ze.spotLights.value=We.state.spot,Ze.spotLightShadows.value=We.state.spotShadow,Ze.rectAreaLights.value=We.state.rectArea,Ze.ltc_1.value=We.state.rectAreaLTC1,Ze.ltc_2.value=We.state.rectAreaLTC2,Ze.pointLights.value=We.state.point,Ze.pointLightShadows.value=We.state.pointShadow,Ze.hemisphereLights.value=We.state.hemi,Ze.directionalShadowMap.value=We.state.directionalShadowMap,Ze.directionalShadowMatrix.value=We.state.directionalShadowMatrix,Ze.spotShadowMap.value=We.state.spotShadowMap,Ze.spotLightMatrix.value=We.state.spotLightMatrix,Ze.spotLightMap.value=We.state.spotLightMap,Ze.pointShadowMap.value=We.state.pointShadowMap,Ze.pointShadowMatrix.value=We.state.pointShadowMatrix),qe.currentProgram=Ee,qe.uniformsList=null,Ee}function li(oe){if(oe.uniformsList===null){const Ue=oe.currentProgram.getUniforms();oe.uniformsList=Fv.seqWithValue(Ue.seq,oe.uniforms)}return oe.uniformsList}function Wn(oe,Ue){const Xe=ee.get(oe);Xe.outputColorSpace=Ue.outputColorSpace,Xe.batching=Ue.batching,Xe.instancing=Ue.instancing,Xe.instancingColor=Ue.instancingColor,Xe.skinning=Ue.skinning,Xe.morphTargets=Ue.morphTargets,Xe.morphNormals=Ue.morphNormals,Xe.morphColors=Ue.morphColors,Xe.morphTargetsCount=Ue.morphTargetsCount,Xe.numClippingPlanes=Ue.numClippingPlanes,Xe.numIntersection=Ue.numClipIntersection,Xe.vertexAlphas=Ue.vertexAlphas,Xe.vertexTangents=Ue.vertexTangents,Xe.toneMapping=Ue.toneMapping}function ei(oe,Ue,Xe,qe,We){Ue.isScene!==!0&&(Ue=Ae),ae.resetTextureUnits();const gt=Ue.fog,Z=qe.isMeshStandardMaterial?Ue.environment:null,_e=C===null?S.outputColorSpace:C.isXRRenderTarget===!0?C.texture.colorSpace:Wo,Pe=(qe.isMeshStandardMaterial?we:ie).get(qe.envMap||Z),Re=qe.vertexColors===!0&&!!Xe.attributes.color&&Xe.attributes.color.itemSize===4,Ee=!!Xe.attributes.tangent&&(!!qe.normalMap||qe.anisotropy>0),Ze=!!Xe.morphAttributes.position,ot=!!Xe.morphAttributes.normal,ft=!!Xe.morphAttributes.color;let dt=rc;qe.toneMapped&&(C===null||C.isXRRenderTarget===!0)&&(dt=S.toneMapping);const Et=Xe.morphAttributes.position||Xe.morphAttributes.normal||Xe.morphAttributes.color,xt=Et!==void 0?Et.length:0,ut=ee.get(qe),Lt=x.state.lights;if(ce===!0&&(ye===!0||oe!==P)){const ti=oe===P&&qe.id===F;Ke.setState(qe,oe,ti)}let Pt=!1;qe.version===ut.__version?(ut.needsLights&&ut.lightsStateVersion!==Lt.state.version||ut.outputColorSpace!==_e||We.isBatchedMesh&&ut.batching===!1||!We.isBatchedMesh&&ut.batching===!0||We.isInstancedMesh&&ut.instancing===!1||!We.isInstancedMesh&&ut.instancing===!0||We.isSkinnedMesh&&ut.skinning===!1||!We.isSkinnedMesh&&ut.skinning===!0||We.isInstancedMesh&&ut.instancingColor===!0&&We.instanceColor===null||We.isInstancedMesh&&ut.instancingColor===!1&&We.instanceColor!==null||ut.envMap!==Pe||qe.fog===!0&&ut.fog!==gt||ut.numClippingPlanes!==void 0&&(ut.numClippingPlanes!==Ke.numPlanes||ut.numIntersection!==Ke.numIntersection)||ut.vertexAlphas!==Re||ut.vertexTangents!==Ee||ut.morphTargets!==Ze||ut.morphNormals!==ot||ut.morphColors!==ft||ut.toneMapping!==dt||G.isWebGL2===!0&&ut.morphTargetsCount!==xt)&&(Pt=!0):(Pt=!0,ut.__version=qe.version);let Ht=ut.currentProgram;Pt===!0&&(Ht=mr(qe,Ue,We));let qt=!1,Jt=!1,Rt=!1;const kt=Ht.getUniforms(),zt=ut.uniforms;if(ne.useProgram(Ht.program)&&(qt=!0,Jt=!0,Rt=!0),qe.id!==F&&(F=qe.id,Jt=!0),qt||P!==oe){kt.setValue(le,"projectionMatrix",oe.projectionMatrix),kt.setValue(le,"viewMatrix",oe.matrixWorldInverse);const ti=kt.map.cameraPosition;ti!==void 0&&ti.setValue(le,he.setFromMatrixPosition(oe.matrixWorld)),G.logarithmicDepthBuffer&&kt.setValue(le,"logDepthBufFC",2/(Math.log(oe.far+1)/Math.LN2)),(qe.isMeshPhongMaterial||qe.isMeshToonMaterial||qe.isMeshLambertMaterial||qe.isMeshBasicMaterial||qe.isMeshStandardMaterial||qe.isShaderMaterial)&&kt.setValue(le,"isOrthographic",oe.isOrthographicCamera===!0),P!==oe&&(P=oe,Jt=!0,Rt=!0)}if(We.isSkinnedMesh){kt.setOptional(le,We,"bindMatrix"),kt.setOptional(le,We,"bindMatrixInverse");const ti=We.skeleton;ti&&(G.floatVertexTextures?(ti.boneTexture===null&&ti.computeBoneTexture(),kt.setValue(le,"boneTexture",ti.boneTexture,ae)):console.warn("THREE.WebGLRenderer: SkinnedMesh can only be used with WebGL 2. With WebGL 1 OES_texture_float and vertex textures support is required."))}We.isBatchedMesh&&(kt.setOptional(le,We,"batchingTexture"),kt.setValue(le,"batchingTexture",We._matricesTexture,ae));const Kn=Xe.morphAttributes;if((Kn.position!==void 0||Kn.normal!==void 0||Kn.color!==void 0&&G.isWebGL2===!0)&&rt.update(We,Xe,Ht),(Jt||ut.receiveShadow!==We.receiveShadow)&&(ut.receiveShadow=We.receiveShadow,kt.setValue(le,"receiveShadow",We.receiveShadow)),qe.isMeshGouraudMaterial&&qe.envMap!==null&&(zt.envMap.value=Pe,zt.flipEnvMap.value=Pe.isCubeTexture&&Pe.isRenderTargetTexture===!1?-1:1),Jt&&(kt.setValue(le,"toneMappingExposure",S.toneMappingExposure),ut.needsLights&&Ja(zt,Rt),gt&&qe.fog===!0&&pe.refreshFogUniforms(zt,gt),pe.refreshMaterialUniforms(zt,qe,V,X,me),Fv.upload(le,li(ut),zt,ae)),qe.isShaderMaterial&&qe.uniformsNeedUpdate===!0&&(Fv.upload(le,li(ut),zt,ae),qe.uniformsNeedUpdate=!1),qe.isSpriteMaterial&&kt.setValue(le,"center",We.center),kt.setValue(le,"modelViewMatrix",We.modelViewMatrix),kt.setValue(le,"normalMatrix",We.normalMatrix),kt.setValue(le,"modelMatrix",We.matrixWorld),qe.isShaderMaterial||qe.isRawShaderMaterial){const ti=qe.uniformsGroups;for(let pn=0,es=ti.length;pn<es;pn++)if(G.isWebGL2){const gn=ti[pn];Je.update(gn,Ht),Je.bind(gn,Ht)}else console.warn("THREE.WebGLRenderer: Uniform Buffer Objects can only be used with WebGL 2.")}return Ht}function Ja(oe,Ue){oe.ambientLightColor.needsUpdate=Ue,oe.lightProbe.needsUpdate=Ue,oe.directionalLights.needsUpdate=Ue,oe.directionalLightShadows.needsUpdate=Ue,oe.pointLights.needsUpdate=Ue,oe.pointLightShadows.needsUpdate=Ue,oe.spotLights.needsUpdate=Ue,oe.spotLightShadows.needsUpdate=Ue,oe.rectAreaLights.needsUpdate=Ue,oe.hemisphereLights.needsUpdate=Ue}function ol(oe){return oe.isMeshLambertMaterial||oe.isMeshToonMaterial||oe.isMeshPhongMaterial||oe.isMeshStandardMaterial||oe.isShadowMaterial||oe.isShaderMaterial&&oe.lights===!0}this.getActiveCubeFace=function(){return R},this.getActiveMipmapLevel=function(){return N},this.getRenderTarget=function(){return C},this.setRenderTargetTextures=function(oe,Ue,Xe){ee.get(oe.texture).__webglTexture=Ue,ee.get(oe.depthTexture).__webglTexture=Xe;const qe=ee.get(oe);qe.__hasExternalTextures=!0,qe.__hasExternalTextures&&(qe.__autoAllocateDepthBuffer=Xe===void 0,qe.__autoAllocateDepthBuffer||z.has("WEBGL_multisampled_render_to_texture")===!0&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),qe.__useRenderToTexture=!1))},this.setRenderTargetFramebuffer=function(oe,Ue){const Xe=ee.get(oe);Xe.__webglFramebuffer=Ue,Xe.__useDefaultFramebuffer=Ue===void 0},this.setRenderTarget=function(oe,Ue=0,Xe=0){C=oe,R=Ue,N=Xe;let qe=!0,We=null,gt=!1,Z=!1;if(oe){const Pe=ee.get(oe);Pe.__useDefaultFramebuffer!==void 0?(ne.bindFramebuffer(le.FRAMEBUFFER,null),qe=!1):Pe.__webglFramebuffer===void 0?ae.setupRenderTarget(oe):Pe.__hasExternalTextures&&ae.rebindTextures(oe,ee.get(oe.texture).__webglTexture,ee.get(oe.depthTexture).__webglTexture);const Re=oe.texture;(Re.isData3DTexture||Re.isDataArrayTexture||Re.isCompressedArrayTexture)&&(Z=!0);const Ee=ee.get(oe).__webglFramebuffer;oe.isWebGLCubeRenderTarget?(Array.isArray(Ee[Ue])?We=Ee[Ue][Xe]:We=Ee[Ue],gt=!0):G.isWebGL2&&oe.samples>0&&ae.useMultisampledRTT(oe)===!1?We=ee.get(oe).__webglMultisampledFramebuffer:Array.isArray(Ee)?We=Ee[Xe]:We=Ee,L.copy(oe.viewport),B.copy(oe.scissor),U=oe.scissorTest}else L.copy(se).multiplyScalar(V).floor(),B.copy(H).multiplyScalar(V).floor(),U=q;if(ne.bindFramebuffer(le.FRAMEBUFFER,We)&&G.drawBuffers&&qe&&ne.drawBuffers(oe,We),ne.viewport(L),ne.scissor(B),ne.setScissorTest(U),gt){const Pe=ee.get(oe.texture);le.framebufferTexture2D(le.FRAMEBUFFER,le.COLOR_ATTACHMENT0,le.TEXTURE_CUBE_MAP_POSITIVE_X+Ue,Pe.__webglTexture,Xe)}else if(Z){const Pe=ee.get(oe.texture),Re=Ue||0;le.framebufferTextureLayer(le.FRAMEBUFFER,le.COLOR_ATTACHMENT0,Pe.__webglTexture,Xe||0,Re)}F=-1},this.readRenderTargetPixels=function(oe,Ue,Xe,qe,We,gt,Z){if(!(oe&&oe.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let _e=ee.get(oe).__webglFramebuffer;if(oe.isWebGLCubeRenderTarget&&Z!==void 0&&(_e=_e[Z]),_e){ne.bindFramebuffer(le.FRAMEBUFFER,_e);try{const Pe=oe.texture,Re=Pe.format,Ee=Pe.type;if(Re!==Ga&&ct.convert(Re)!==le.getParameter(le.IMPLEMENTATION_COLOR_READ_FORMAT)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}const Ze=Ee===$p&&(z.has("EXT_color_buffer_half_float")||G.isWebGL2&&z.has("EXT_color_buffer_float"));if(Ee!==ac&&ct.convert(Ee)!==le.getParameter(le.IMPLEMENTATION_COLOR_READ_TYPE)&&!(Ee===Io&&(G.isWebGL2||z.has("OES_texture_float")||z.has("WEBGL_color_buffer_float")))&&!Ze){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}Ue>=0&&Ue<=oe.width-qe&&Xe>=0&&Xe<=oe.height-We&&le.readPixels(Ue,Xe,qe,We,ct.convert(Re),ct.convert(Ee),gt)}finally{const Pe=C!==null?ee.get(C).__webglFramebuffer:null;ne.bindFramebuffer(le.FRAMEBUFFER,Pe)}}},this.copyFramebufferToTexture=function(oe,Ue,Xe=0){const qe=Math.pow(2,-Xe),We=Math.floor(Ue.image.width*qe),gt=Math.floor(Ue.image.height*qe);ae.setTexture2D(Ue,0),le.copyTexSubImage2D(le.TEXTURE_2D,Xe,0,0,oe.x,oe.y,We,gt),ne.unbindTexture()},this.copyTextureToTexture=function(oe,Ue,Xe,qe=0){const We=Ue.image.width,gt=Ue.image.height,Z=ct.convert(Xe.format),_e=ct.convert(Xe.type);ae.setTexture2D(Xe,0),le.pixelStorei(le.UNPACK_FLIP_Y_WEBGL,Xe.flipY),le.pixelStorei(le.UNPACK_PREMULTIPLY_ALPHA_WEBGL,Xe.premultiplyAlpha),le.pixelStorei(le.UNPACK_ALIGNMENT,Xe.unpackAlignment),Ue.isDataTexture?le.texSubImage2D(le.TEXTURE_2D,qe,oe.x,oe.y,We,gt,Z,_e,Ue.image.data):Ue.isCompressedTexture?le.compressedTexSubImage2D(le.TEXTURE_2D,qe,oe.x,oe.y,Ue.mipmaps[0].width,Ue.mipmaps[0].height,Z,Ue.mipmaps[0].data):le.texSubImage2D(le.TEXTURE_2D,qe,oe.x,oe.y,Z,_e,Ue.image),qe===0&&Xe.generateMipmaps&&le.generateMipmap(le.TEXTURE_2D),ne.unbindTexture()},this.copyTextureToTexture3D=function(oe,Ue,Xe,qe,We=0){if(S.isWebGL1Renderer){console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");return}const gt=oe.max.x-oe.min.x+1,Z=oe.max.y-oe.min.y+1,_e=oe.max.z-oe.min.z+1,Pe=ct.convert(qe.format),Re=ct.convert(qe.type);let Ee;if(qe.isData3DTexture)ae.setTexture3D(qe,0),Ee=le.TEXTURE_3D;else if(qe.isDataArrayTexture)ae.setTexture2DArray(qe,0),Ee=le.TEXTURE_2D_ARRAY;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}le.pixelStorei(le.UNPACK_FLIP_Y_WEBGL,qe.flipY),le.pixelStorei(le.UNPACK_PREMULTIPLY_ALPHA_WEBGL,qe.premultiplyAlpha),le.pixelStorei(le.UNPACK_ALIGNMENT,qe.unpackAlignment);const Ze=le.getParameter(le.UNPACK_ROW_LENGTH),ot=le.getParameter(le.UNPACK_IMAGE_HEIGHT),ft=le.getParameter(le.UNPACK_SKIP_PIXELS),dt=le.getParameter(le.UNPACK_SKIP_ROWS),Et=le.getParameter(le.UNPACK_SKIP_IMAGES),xt=Xe.isCompressedTexture?Xe.mipmaps[0]:Xe.image;le.pixelStorei(le.UNPACK_ROW_LENGTH,xt.width),le.pixelStorei(le.UNPACK_IMAGE_HEIGHT,xt.height),le.pixelStorei(le.UNPACK_SKIP_PIXELS,oe.min.x),le.pixelStorei(le.UNPACK_SKIP_ROWS,oe.min.y),le.pixelStorei(le.UNPACK_SKIP_IMAGES,oe.min.z),Xe.isDataTexture||Xe.isData3DTexture?le.texSubImage3D(Ee,We,Ue.x,Ue.y,Ue.z,gt,Z,_e,Pe,Re,xt.data):Xe.isCompressedArrayTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),le.compressedTexSubImage3D(Ee,We,Ue.x,Ue.y,Ue.z,gt,Z,_e,Pe,xt.data)):le.texSubImage3D(Ee,We,Ue.x,Ue.y,Ue.z,gt,Z,_e,Pe,Re,xt),le.pixelStorei(le.UNPACK_ROW_LENGTH,Ze),le.pixelStorei(le.UNPACK_IMAGE_HEIGHT,ot),le.pixelStorei(le.UNPACK_SKIP_PIXELS,ft),le.pixelStorei(le.UNPACK_SKIP_ROWS,dt),le.pixelStorei(le.UNPACK_SKIP_IMAGES,Et),We===0&&qe.generateMipmaps&&le.generateMipmap(Ee),ne.unbindTexture()},this.initTexture=function(oe){oe.isCubeTexture?ae.setTextureCube(oe,0):oe.isData3DTexture?ae.setTexture3D(oe,0):oe.isDataArrayTexture||oe.isCompressedArrayTexture?ae.setTexture2DArray(oe,0):ae.setTexture2D(oe,0),ne.unbindTexture()},this.resetState=function(){R=0,N=0,C=null,ne.reset(),et.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return Us}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const n=this.getContext();n.drawingBufferColorSpace=e===IT?"display-p3":"srgb",n.unpackColorSpace=An.workingColorSpace===xy?"display-p3":"srgb"}get physicallyCorrectLights(){return console.warn("THREE.WebGLRenderer: The property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead."),!this.useLegacyLights}set physicallyCorrectLights(e){console.warn("THREE.WebGLRenderer: The property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead."),this.useLegacyLights=!e}get outputEncoding(){return console.warn("THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead."),this.outputColorSpace===fr?uu:OB}set outputEncoding(e){console.warn("THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead."),this.outputColorSpace=e===uu?fr:Wo}get useLegacyLights(){return console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733."),this._useLegacyLights}set useLegacyLights(e){console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733."),this._useLegacyLights=e}}class Ooe extends $M{}Ooe.prototype.isWebGL1Renderer=!0;class jT{constructor(e,n=1,i=1e3){this.isFog=!0,this.name="",this.color=new Nt(e),this.near=n,this.far=i}clone(){return new jT(this.color,this.near,this.far)}toJSON(){return{type:"Fog",name:this.name,color:this.color.getHex(),near:this.near,far:this.far}}}class Loe extends Ur{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,n){return super.copy(e,n),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 n=super.toJSON(e);return this.fog!==null&&(n.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(n.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(n.object.backgroundIntensity=this.backgroundIntensity),n}}class Ioe{constructor(e,n){this.isInterleavedBuffer=!0,this.array=e,this.stride=n,this.count=e!==void 0?e.length/n:0,this.usage=jM,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.version=0,this.uuid=jo()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}get updateRange(){return console.warn('THREE.InterleavedBuffer: "updateRange" is deprecated and removed in r169. Use "addUpdateRange()" instead.'),this._updateRange}setUsage(e){return this.usage=e,this}addUpdateRange(e,n){this.updateRanges.push({start:e,count:n})}clearUpdateRanges(){this.updateRanges.length=0}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,n,i){e*=this.stride,i*=n.stride;for(let r=0,a=this.stride;r<a;r++)this.array[e+r]=n.array[i+r];return this}set(e,n=0){return this.array.set(e,n),this}clone(e){e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=jo()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);const n=new this.array.constructor(e.arrayBuffers[this.array.buffer._uuid]),i=new this.constructor(n,this.stride);return i.setUsage(this.usage),i}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=jo()),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 Cr=new Ce;class ec{constructor(e,n,i,r=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=e,this.itemSize=n,this.offset=i,this.normalized=r}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(e){this.data.needsUpdate=e}applyMatrix4(e){for(let n=0,i=this.data.count;n<i;n++)Cr.fromBufferAttribute(this,n),Cr.applyMatrix4(e),this.setXYZ(n,Cr.x,Cr.y,Cr.z);return this}applyNormalMatrix(e){for(let n=0,i=this.count;n<i;n++)Cr.fromBufferAttribute(this,n),Cr.applyNormalMatrix(e),this.setXYZ(n,Cr.x,Cr.y,Cr.z);return this}transformDirection(e){for(let n=0,i=this.count;n<i;n++)Cr.fromBufferAttribute(this,n),Cr.transformDirection(e),this.setXYZ(n,Cr.x,Cr.y,Cr.z);return this}setX(e,n){return this.normalized&&(n=Mn(n,this.array)),this.data.array[e*this.data.stride+this.offset]=n,this}setY(e,n){return this.normalized&&(n=Mn(n,this.array)),this.data.array[e*this.data.stride+this.offset+1]=n,this}setZ(e,n){return this.normalized&&(n=Mn(n,this.array)),this.data.array[e*this.data.stride+this.offset+2]=n,this}setW(e,n){return this.normalized&&(n=Mn(n,this.array)),this.data.array[e*this.data.stride+this.offset+3]=n,this}getX(e){let n=this.data.array[e*this.data.stride+this.offset];return this.normalized&&(n=Ls(n,this.array)),n}getY(e){let n=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(n=Ls(n,this.array)),n}getZ(e){let n=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(n=Ls(n,this.array)),n}getW(e){let n=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(n=Ls(n,this.array)),n}setXY(e,n,i){return e=e*this.data.stride+this.offset,this.normalized&&(n=Mn(n,this.array),i=Mn(i,this.array)),this.data.array[e+0]=n,this.data.array[e+1]=i,this}setXYZ(e,n,i,r){return e=e*this.data.stride+this.offset,this.normalized&&(n=Mn(n,this.array),i=Mn(i,this.array),r=Mn(r,this.array)),this.data.array[e+0]=n,this.data.array[e+1]=i,this.data.array[e+2]=r,this}setXYZW(e,n,i,r,a){return e=e*this.data.stride+this.offset,this.normalized&&(n=Mn(n,this.array),i=Mn(i,this.array),r=Mn(r,this.array),a=Mn(a,this.array)),this.data.array[e+0]=n,this.data.array[e+1]=i,this.data.array[e+2]=r,this.data.array[e+3]=a,this}clone(e){if(e===void 0){console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");const n=[];for(let i=0;i<this.count;i++){const r=i*this.data.stride+this.offset;for(let a=0;a<this.itemSize;a++)n.push(this.data.array[r+a])}return new ya(new this.array.constructor(n),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 ec(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 n=[];for(let i=0;i<this.count;i++){const r=i*this.data.stride+this.offset;for(let a=0;a<this.itemSize;a++)n.push(this.data.array[r+a])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:n,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 Uoe extends Qr{constructor(e=null,n=1,i=1,r,a,s,l,c,d=dr,f=dr,h,g){super(null,s,l,c,d,f,r,a,h,g),this.isDataTexture=!0,this.image={data:e,width:n,height:i},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}function koe(t,e){return t.z-e.z}function Foe(t,e){return e.z-t.z}class zoe{constructor(){this.index=0,this.pool=[],this.list=[]}push(e,n){const i=this.pool,r=this.list;this.index>=i.length&&i.push({start:-1,count:-1,z:-1});const a=i[this.index];r.push(a),this.index++,a.start=e.start,a.count=e.count,a.z=n}reset(){this.list.length=0,this.index=0}}const qd="batchId",Hl=new Ln,HL=new Ln,Boe=new Ln,GL=new Ln,k1=new yy,tv=new qa,$c=new Fs,lp=new Ce,F1=new zoe,_r=new gs,nv=[];function joe(t,e,n=0){const i=e.itemSize;if(t.isInterleavedBufferAttribute||t.array.constructor!==e.array.constructor){const r=t.count;for(let a=0;a<r;a++)for(let s=0;s<i;s++)e.setComponent(a+n,s,t.getComponent(a,s))}else e.array.set(t.array,n*i);e.needsUpdate=!0}class Hoe extends gs{get maxGeometryCount(){return this._maxGeometryCount}constructor(e,n,i=n*2,r){super(new Mr,r),this.isBatchedMesh=!0,this.perObjectFrustumCulled=!0,this.sortObjects=!0,this.boundingBox=null,this.boundingSphere=null,this.customSort=null,this._drawRanges=[],this._reservedRanges=[],this._visibility=[],this._active=[],this._bounds=[],this._maxGeometryCount=e,this._maxVertexCount=n,this._maxIndexCount=i,this._geometryInitialized=!1,this._geometryCount=0,this._multiDrawCounts=new Int32Array(e),this._multiDrawStarts=new Int32Array(e),this._multiDrawCount=0,this._visibilityChanged=!0,this._matricesTexture=null,this._initMatricesTexture()}_initMatricesTexture(){let e=Math.sqrt(this._maxGeometryCount*4);e=Math.ceil(e/4)*4,e=Math.max(e,4);const n=new Float32Array(e*e*4),i=new Uoe(n,e,e,Ga,Io);this._matricesTexture=i}_initializeGeometry(e){const n=this.geometry,i=this._maxVertexCount,r=this._maxGeometryCount,a=this._maxIndexCount;if(this._geometryInitialized===!1){for(const l in e.attributes){const c=e.getAttribute(l),{array:d,itemSize:f,normalized:h}=c,g=new d.constructor(i*f),m=new c.constructor(g,f,h);m.setUsage(c.usage),n.setAttribute(l,m)}if(e.getIndex()!==null){const l=i>65536?new Uint32Array(a):new Uint16Array(a);n.setIndex(new ya(l,1))}const s=r>65536?new Uint32Array(i):new Uint16Array(i);n.setAttribute(qd,new ya(s,1)),this._geometryInitialized=!0}}_validateGeometry(e){if(e.getAttribute(qd))throw new Error(`BatchedMesh: Geometry cannot use attribute "${qd}"`);const n=this.geometry;if(!!e.getIndex()!=!!n.getIndex())throw new Error('BatchedMesh: All geometries must consistently have "index".');for(const i in n.attributes){if(i===qd)continue;if(!e.hasAttribute(i))throw new Error(`BatchedMesh: Added geometry missing "${i}". All geometries must have consistent attributes.`);const r=e.getAttribute(i),a=n.getAttribute(i);if(r.itemSize!==a.itemSize||r.normalized!==a.normalized)throw new Error("BatchedMesh: All attributes must have a consistent itemSize and normalized value.")}}setCustomSort(e){return this.customSort=e,this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new qa);const e=this._geometryCount,n=this.boundingBox,i=this._active;n.makeEmpty();for(let r=0;r<e;r++)i[r]!==!1&&(this.getMatrixAt(r,Hl),this.getBoundingBoxAt(r,tv).applyMatrix4(Hl),n.union(tv))}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new Fs);const e=this._geometryCount,n=this.boundingSphere,i=this._active;n.makeEmpty();for(let r=0;r<e;r++)i[r]!==!1&&(this.getMatrixAt(r,Hl),this.getBoundingSphereAt(r,$c).applyMatrix4(Hl),n.union($c))}addGeometry(e,n=-1,i=-1){if(this._initializeGeometry(e),this._validateGeometry(e),this._geometryCount>=this._maxGeometryCount)throw new Error("BatchedMesh: Maximum geometry count reached.");const r={vertexStart:-1,vertexCount:-1,indexStart:-1,indexCount:-1};let a=null;const s=this._reservedRanges,l=this._drawRanges,c=this._bounds;this._geometryCount!==0&&(a=s[s.length-1]),n===-1?r.vertexCount=e.getAttribute("position").count:r.vertexCount=n,a===null?r.vertexStart=0:r.vertexStart=a.vertexStart+a.vertexCount;const d=e.getIndex(),f=d!==null;if(f&&(i===-1?r.indexCount=d.count:r.indexCount=i,a===null?r.indexStart=0:r.indexStart=a.indexStart+a.indexCount),r.indexStart!==-1&&r.indexStart+r.indexCount>this._maxIndexCount||r.vertexStart+r.vertexCount>this._maxVertexCount)throw new Error("BatchedMesh: Reserved space request exceeds the maximum buffer size.");const h=this._visibility,g=this._active,m=this._matricesTexture,b=this._matricesTexture.image.data;h.push(!0),g.push(!0);const y=this._geometryCount;this._geometryCount++,Boe.toArray(b,y*16),m.needsUpdate=!0,s.push(r),l.push({start:f?r.indexStart:r.vertexStart,count:-1}),c.push({boxInitialized:!1,box:new qa,sphereInitialized:!1,sphere:new Fs});const x=this.geometry.getAttribute(qd);for(let v=0;v<r.vertexCount;v++)x.setX(r.vertexStart+v,y);return x.needsUpdate=!0,this.setGeometryAt(y,e),y}setGeometryAt(e,n){if(e>=this._geometryCount)throw new Error("BatchedMesh: Maximum geometry count reached.");this._validateGeometry(n);const i=this.geometry,r=i.getIndex()!==null,a=i.getIndex(),s=n.getIndex(),l=this._reservedRanges[e];if(r&&s.count>l.indexCount||n.attributes.position.count>l.vertexCount)throw new Error("BatchedMesh: Reserved space not large enough for provided geometry.");const c=l.vertexStart,d=l.vertexCount;for(const m in i.attributes){if(m===qd)continue;const b=n.getAttribute(m),y=i.getAttribute(m);joe(b,y,c);const x=b.itemSize;for(let v=b.count,w=d;v<w;v++){const S=c+v;for(let A=0;A<x;A++)y.setComponent(S,A,0)}y.needsUpdate=!0}if(r){const m=l.indexStart;for(let b=0;b<s.count;b++)a.setX(m+b,c+s.getX(b));for(let b=s.count,y=l.indexCount;b<y;b++)a.setX(m+b,c);a.needsUpdate=!0}const f=this._bounds[e];n.boundingBox!==null?(f.box.copy(n.boundingBox),f.boxInitialized=!0):f.boxInitialized=!1,n.boundingSphere!==null?(f.sphere.copy(n.boundingSphere),f.sphereInitialized=!0):f.sphereInitialized=!1;const h=this._drawRanges[e],g=n.getAttribute("position");return h.count=r?s.count:g.count,this._visibilityChanged=!0,e}deleteGeometry(e){const n=this._active;return e>=n.length||n[e]===!1?this:(n[e]=!1,this._visibilityChanged=!0,this)}getBoundingBoxAt(e,n){if(this._active[e]===!1)return this;const r=this._bounds[e],a=r.box,s=this.geometry;if(r.boxInitialized===!1){a.makeEmpty();const l=s.index,c=s.attributes.position,d=this._drawRanges[e];for(let f=d.start,h=d.start+d.count;f<h;f++){let g=f;l&&(g=l.getX(g)),a.expandByPoint(lp.fromBufferAttribute(c,g))}r.boxInitialized=!0}return n.copy(a),n}getBoundingSphereAt(e,n){if(this._active[e]===!1)return this;const r=this._bounds[e],a=r.sphere,s=this.geometry;if(r.sphereInitialized===!1){a.makeEmpty(),this.getBoundingBoxAt(e,tv),tv.getCenter(a.center);const l=s.index,c=s.attributes.position,d=this._drawRanges[e];let f=0;for(let h=d.start,g=d.start+d.count;h<g;h++){let m=h;l&&(m=l.getX(m)),lp.fromBufferAttribute(c,m),f=Math.max(f,a.center.distanceToSquared(lp))}a.radius=Math.sqrt(f),r.sphereInitialized=!0}return n.copy(a),n}setMatrixAt(e,n){const i=this._active,r=this._matricesTexture,a=this._matricesTexture.image.data,s=this._geometryCount;return e>=s||i[e]===!1?this:(n.toArray(a,e*16),r.needsUpdate=!0,this)}getMatrixAt(e,n){const i=this._active,r=this._matricesTexture.image.data,a=this._geometryCount;return e>=a||i[e]===!1?null:n.fromArray(r,e*16)}setVisibleAt(e,n){const i=this._visibility,r=this._active,a=this._geometryCount;return e>=a||r[e]===!1||i[e]===n?this:(i[e]=n,this._visibilityChanged=!0,this)}getVisibleAt(e){const n=this._visibility,i=this._active,r=this._geometryCount;return e>=r||i[e]===!1?!1:n[e]}raycast(e,n){const i=this._visibility,r=this._active,a=this._drawRanges,s=this._geometryCount,l=this.matrixWorld,c=this.geometry;_r.material=this.material,_r.geometry.index=c.index,_r.geometry.attributes=c.attributes,_r.geometry.boundingBox===null&&(_r.geometry.boundingBox=new qa),_r.geometry.boundingSphere===null&&(_r.geometry.boundingSphere=new Fs);for(let d=0;d<s;d++){if(!i[d]||!r[d])continue;const f=a[d];_r.geometry.setDrawRange(f.start,f.count),this.getMatrixAt(d,_r.matrixWorld).premultiply(l),this.getBoundingBoxAt(d,_r.geometry.boundingBox),this.getBoundingSphereAt(d,_r.geometry.boundingSphere),_r.raycast(e,nv);for(let h=0,g=nv.length;h<g;h++){const m=nv[h];m.object=this,m.batchId=d,n.push(m)}nv.length=0}_r.material=null,_r.geometry.index=null,_r.geometry.attributes={},_r.geometry.setDrawRange(0,1/0)}copy(e){return super.copy(e),this.geometry=e.geometry.clone(),this.perObjectFrustumCulled=e.perObjectFrustumCulled,this.sortObjects=e.sortObjects,this.boundingBox=e.boundingBox!==null?e.boundingBox.clone():null,this.boundingSphere=e.boundingSphere!==null?e.boundingSphere.clone():null,this._drawRanges=e._drawRanges.map(n=>({...n})),this._reservedRanges=e._reservedRanges.map(n=>({...n})),this._visibility=e._visibility.slice(),this._active=e._active.slice(),this._bounds=e._bounds.map(n=>({boxInitialized:n.boxInitialized,box:n.box.clone(),sphereInitialized:n.sphereInitialized,sphere:n.sphere.clone()})),this._maxGeometryCount=e._maxGeometryCount,this._maxVertexCount=e._maxVertexCount,this._maxIndexCount=e._maxIndexCount,this._geometryInitialized=e._geometryInitialized,this._geometryCount=e._geometryCount,this._multiDrawCounts=e._multiDrawCounts.slice(),this._multiDrawStarts=e._multiDrawStarts.slice(),this._matricesTexture=e._matricesTexture.clone(),this._matricesTexture.image.data=this._matricesTexture.image.slice(),this}dispose(){return this.geometry.dispose(),this._matricesTexture.dispose(),this._matricesTexture=null,this}onBeforeRender(e,n,i,r,a){if(!this._visibilityChanged&&!this.perObjectFrustumCulled&&!this.sortObjects)return;const s=r.getIndex(),l=s===null?1:s.array.BYTES_PER_ELEMENT,c=this._visibility,d=this._multiDrawStarts,f=this._multiDrawCounts,h=this._drawRanges,g=this.perObjectFrustumCulled;g&&(GL.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse).multiply(this.matrixWorld),k1.setFromProjectionMatrix(GL,e.isWebGPURenderer?Wp:Us));let m=0;if(this.sortObjects){HL.copy(this.matrixWorld).invert(),lp.setFromMatrixPosition(i.matrixWorld).applyMatrix4(HL);for(let x=0,v=c.length;x<v;x++)if(c[x]){this.getMatrixAt(x,Hl),this.getBoundingSphereAt(x,$c).applyMatrix4(Hl);let w=!1;if(g&&(w=!k1.intersectsSphere($c)),!w){const S=lp.distanceTo($c.center);F1.push(h[x],S)}}const b=F1.list,y=this.customSort;y===null?b.sort(a.transparent?Foe:koe):y.call(this,b,i);for(let x=0,v=b.length;x<v;x++){const w=b[x];d[m]=w.start*l,f[m]=w.count,m++}F1.reset()}else for(let b=0,y=c.length;b<y;b++)if(c[b]){let x=!1;if(g&&(this.getMatrixAt(b,Hl),this.getBoundingSphereAt(b,$c).applyMatrix4(Hl),x=!k1.intersectsSphere($c)),!x){const v=h[b];d[m]=v.start*l,f[m]=v.count,m++}}this._multiDrawCount=m,this._visibilityChanged=!1}onBeforeShadow(e,n,i,r,a,s){this.onBeforeRender(e,null,r,a,s)}}class _m extends Gf{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new Nt(16777215),this.map=null,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.map=e.map,this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}}const VL=new Ce,$L=new Ce,WL=new Ln,z1=new kT,iv=new Fs;class Goe extends Ur{constructor(e=new Mr,n=new _m){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=n,this.updateMorphTargets()}copy(e,n){return super.copy(e,n),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}computeLineDistances(){const e=this.geometry;if(e.index===null){const n=e.attributes.position,i=[0];for(let r=1,a=n.count;r<a;r++)VL.fromBufferAttribute(n,r-1),$L.fromBufferAttribute(n,r),i[r]=i[r-1],i[r]+=VL.distanceTo($L);e.setAttribute("lineDistance",new si(i,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(e,n){const i=this.geometry,r=this.matrixWorld,a=e.params.Line.threshold,s=i.drawRange;if(i.boundingSphere===null&&i.computeBoundingSphere(),iv.copy(i.boundingSphere),iv.applyMatrix4(r),iv.radius+=a,e.ray.intersectsSphere(iv)===!1)return;WL.copy(r).invert(),z1.copy(e.ray).applyMatrix4(WL);const l=a/((this.scale.x+this.scale.y+this.scale.z)/3),c=l*l,d=new Ce,f=new Ce,h=new Ce,g=new Ce,m=this.isLineSegments?2:1,b=i.index,x=i.attributes.position;if(b!==null){const v=Math.max(0,s.start),w=Math.min(b.count,s.start+s.count);for(let S=v,A=w-1;S<A;S+=m){const R=b.getX(S),N=b.getX(S+1);if(d.fromBufferAttribute(x,R),f.fromBufferAttribute(x,N),z1.distanceSqToSegment(d,f,g,h)>c)continue;g.applyMatrix4(this.matrixWorld);const F=e.ray.origin.distanceTo(g);F<e.near||F>e.far||n.push({distance:F,point:h.clone().applyMatrix4(this.matrixWorld),index:S,face:null,faceIndex:null,object:this})}}else{const v=Math.max(0,s.start),w=Math.min(x.count,s.start+s.count);for(let S=v,A=w-1;S<A;S+=m){if(d.fromBufferAttribute(x,S),f.fromBufferAttribute(x,S+1),z1.distanceSqToSegment(d,f,g,h)>c)continue;g.applyMatrix4(this.matrixWorld);const N=e.ray.origin.distanceTo(g);N<e.near||N>e.far||n.push({distance:N,point:h.clone().applyMatrix4(this.matrixWorld),index:S,face:null,faceIndex:null,object:this})}}}updateMorphTargets(){const n=this.geometry.morphAttributes,i=Object.keys(n);if(i.length>0){const r=n[i[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let a=0,s=r.length;a<s;a++){const l=r[a].name||String(a);this.morphTargetInfluences.push(0),this.morphTargetDictionary[l]=a}}}}}const XL=new Ce,qL=new Ce;class _y extends Goe{constructor(e,n){super(e,n),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const e=this.geometry;if(e.index===null){const n=e.attributes.position,i=[];for(let r=0,a=n.count;r<a;r+=2)XL.fromBufferAttribute(n,r),qL.fromBufferAttribute(n,r+1),i[r]=r===0?0:i[r-1],i[r+1]=i[r]+XL.distanceTo(qL);e.setAttribute("lineDistance",new si(i,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class Voe extends Mr{constructor(e=null){if(super(),this.type="WireframeGeometry",this.parameters={geometry:e},e!==null){const n=[],i=new Set,r=new Ce,a=new Ce;if(e.index!==null){const s=e.attributes.position,l=e.index;let c=e.groups;c.length===0&&(c=[{start:0,count:l.count,materialIndex:0}]);for(let d=0,f=c.length;d<f;++d){const h=c[d],g=h.start,m=h.count;for(let b=g,y=g+m;b<y;b+=3)for(let x=0;x<3;x++){const v=l.getX(b+x),w=l.getX(b+(x+1)%3);r.fromBufferAttribute(s,v),a.fromBufferAttribute(s,w),YL(r,a,i)===!0&&(n.push(r.x,r.y,r.z),n.push(a.x,a.y,a.z))}}}else{const s=e.attributes.position;for(let l=0,c=s.count/3;l<c;l++)for(let d=0;d<3;d++){const f=3*l+d,h=3*l+(d+1)%3;r.fromBufferAttribute(s,f),a.fromBufferAttribute(s,h),YL(r,a,i)===!0&&(n.push(r.x,r.y,r.z),n.push(a.x,a.y,a.z))}}this.setAttribute("position",new si(n,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}}function YL(t,e,n){const i=`${t.x},${t.y},${t.z}-${e.x},${e.y},${e.z}`,r=`${e.x},${e.y},${e.z}-${t.x},${t.y},${t.z}`;return n.has(i)===!0||n.has(r)===!0?!1:(n.add(i),n.add(r),!0)}class $oe extends Gf{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new Nt(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Nt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=LB,this.normalScale=new Ut(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=OT,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 Woe extends _m{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}}class n5 extends Ur{constructor(e,n=1){super(),this.isLight=!0,this.type="Light",this.color=new Nt(e),this.intensity=n}dispose(){}copy(e,n){return super.copy(e,n),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){const n=super.toJSON(e);return n.object.color=this.color.getHex(),n.object.intensity=this.intensity,this.groundColor!==void 0&&(n.object.groundColor=this.groundColor.getHex()),this.distance!==void 0&&(n.object.distance=this.distance),this.angle!==void 0&&(n.object.angle=this.angle),this.decay!==void 0&&(n.object.decay=this.decay),this.penumbra!==void 0&&(n.object.penumbra=this.penumbra),this.shadow!==void 0&&(n.object.shadow=this.shadow.toJSON()),n}}const B1=new Ln,KL=new Ce,ZL=new Ce;class Xoe{constructor(e){this.camera=e,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new Ut(512,512),this.map=null,this.mapPass=null,this.matrix=new Ln,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new yy,this._frameExtents=new Ut(1,1),this._viewportCount=1,this._viewports=[new Cn(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const n=this.camera,i=this.matrix;KL.setFromMatrixPosition(e.matrixWorld),n.position.copy(KL),ZL.setFromMatrixPosition(e.target.matrixWorld),n.lookAt(ZL),n.updateMatrixWorld(),B1.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(B1),i.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),i.multiply(B1)}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}}const QL=new Ln,cp=new Ce,j1=new Ce;class qoe extends Xoe{constructor(){super(new ma(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new Ut(4,2),this._viewportCount=6,this._viewports=[new Cn(2,1,1,1),new Cn(0,1,1,1),new Cn(3,1,1,1),new Cn(1,1,1,1),new Cn(3,0,1,1),new Cn(1,0,1,1)],this._cubeDirections=[new Ce(1,0,0),new Ce(-1,0,0),new Ce(0,0,1),new Ce(0,0,-1),new Ce(0,1,0),new Ce(0,-1,0)],this._cubeUps=[new Ce(0,1,0),new Ce(0,1,0),new Ce(0,1,0),new Ce(0,1,0),new Ce(0,0,1),new Ce(0,0,-1)]}updateMatrices(e,n=0){const i=this.camera,r=this.matrix,a=e.distance||i.far;a!==i.far&&(i.far=a,i.updateProjectionMatrix()),cp.setFromMatrixPosition(e.matrixWorld),i.position.copy(cp),j1.copy(i.position),j1.add(this._cubeDirections[n]),i.up.copy(this._cubeUps[n]),i.lookAt(j1),i.updateMatrixWorld(),r.makeTranslation(-cp.x,-cp.y,-cp.z),QL.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),this._frustum.setFromProjectionMatrix(QL)}}class Yoe extends n5{constructor(e,n,i=0,r=2){super(e,n),this.isPointLight=!0,this.type="PointLight",this.distance=i,this.decay=r,this.shadow=new qoe}get power(){return this.intensity*4*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){this.shadow.dispose()}copy(e,n){return super.copy(e,n),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}}class Koe extends n5{constructor(e,n){super(e,n),this.isAmbientLight=!0,this.type="AmbientLight"}}class Zoe extends Mr{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 WM extends Ioe{constructor(e,n,i=1){super(e,n),this.isInstancedInterleavedBuffer=!0,this.meshPerAttribute=i}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}clone(e){const n=super.clone(e);return n.meshPerAttribute=this.meshPerAttribute,n}toJSON(e){const n=super.toJSON(e);return n.isInstancedInterleavedBuffer=!0,n.meshPerAttribute=this.meshPerAttribute,n}}class JL{constructor(e=1,n=0,i=0){return this.radius=e,this.phi=n,this.theta=i,this}set(e,n,i){return this.radius=e,this.phi=n,this.theta=i,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,n,i){return this.radius=Math.sqrt(e*e+n*n+i*i),this.radius===0?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,i),this.phi=Math.acos(hr(n/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}}const eI=new Ce,rv=new Ce;class Qoe{constructor(e=new Ce,n=new Ce){this.start=e,this.end=n}set(e,n){return this.start.copy(e),this.end.copy(n),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,n){return this.delta(n).multiplyScalar(e).add(this.start)}closestPointToPointParameter(e,n){eI.subVectors(e,this.start),rv.subVectors(this.end,this.start);const i=rv.dot(rv);let a=rv.dot(eI)/i;return n&&(a=hr(a,0,1)),a}closestPointToPoint(e,n,i){const r=this.closestPointToPointParameter(e,n);return this.delta(i).multiplyScalar(r).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)}}class Joe extends _y{constructor(e=1){const n=[0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e],i=[1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],r=new Mr;r.setAttribute("position",new si(n,3)),r.setAttribute("color",new si(i,3));const a=new _m({vertexColors:!0,toneMapped:!1});super(r,a),this.type="AxesHelper"}setColors(e,n,i){const r=new Nt,a=this.geometry.attributes.color.array;return r.set(e),r.toArray(a,0),r.toArray(a,3),r.set(n),r.toArray(a,6),r.toArray(a,9),r.set(i),r.toArray(a,12),r.toArray(a,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:gy}}));typeof window<"u"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=gy);class zs{constructor(e,n,i,r,a="div"){this.parent=e,this.object=n,this.property=i,this._disabled=!1,this._hidden=!1,this.initialValue=this.getValue(),this.domElement=document.createElement(a),this.domElement.classList.add("controller"),this.domElement.classList.add(r),this.$name=document.createElement("div"),this.$name.classList.add("name"),zs.nextNameID=zs.nextNameID||0,this.$name.id=`lil-gui-name-${++zs.nextNameID}`,this.$widget=document.createElement("div"),this.$widget.classList.add("widget"),this.$disable=this.$widget,this.domElement.appendChild(this.$name),this.domElement.appendChild(this.$widget),this.domElement.addEventListener("keydown",s=>s.stopPropagation()),this.domElement.addEventListener("keyup",s=>s.stopPropagation()),this.parent.children.push(this),this.parent.controllers.push(this),this.parent.$children.appendChild(this.domElement),this._listenCallback=this._listenCallback.bind(this),this.name(i)}name(e){return this._name=e,this.$name.textContent=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:(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 n=this.parent.add(this.object,this.property,e);return n.name(this._name),this.destroy(),n}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.getValue()!==e&&(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 ele extends zs{constructor(e,n,i){super(e,n,i,"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 XM(t){let e,n;return(e=t.match(/(#|0x)?([a-f0-9]{6})/i))?n=e[2]:(e=t.match(/rgb\(\s*(\d*)\s*,\s*(\d*)\s*,\s*(\d*)\s*\)/))?n=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=t.match(/^#?([a-f0-9])([a-f0-9])([a-f0-9])$/i))&&(n=e[1]+e[1]+e[2]+e[2]+e[3]+e[3]),n?"#"+n:!1}const tle={isPrimitive:!0,match:t=>typeof t=="string",fromHexString:XM,toHexString:XM},qp={isPrimitive:!0,match:t=>typeof t=="number",fromHexString:t=>parseInt(t.substring(1),16),toHexString:t=>"#"+t.toString(16).padStart(6,0)},nle={isPrimitive:!1,match:t=>Array.isArray(t),fromHexString(t,e,n=1){const i=qp.fromHexString(t);e[0]=(i>>16&255)/255*n,e[1]=(i>>8&255)/255*n,e[2]=(i&255)/255*n},toHexString([t,e,n],i=1){i=255/i;const r=t*i<<16^e*i<<8^n*i<<0;return qp.toHexString(r)}},ile={isPrimitive:!1,match:t=>Object(t)===t,fromHexString(t,e,n=1){const i=qp.fromHexString(t);e.r=(i>>16&255)/255*n,e.g=(i>>8&255)/255*n,e.b=(i&255)/255*n},toHexString({r:t,g:e,b:n},i=1){i=255/i;const r=t*i<<16^e*i<<8^n*i<<0;return qp.toHexString(r)}},rle=[tle,qp,nle,ile];function ale(t){return rle.find(e=>e.match(t))}class sle extends zs{constructor(e,n,i,r){super(e,n,i,"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=ale(this.initialValue),this._rgbScale=r,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 a=XM(this.$text.value);a&&this._setValueFromHexString(a)}),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 n=this._format.fromHexString(e);this.setValue(n)}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 H1 extends zs{constructor(e,n,i){super(e,n,i,"function"),this.$button=document.createElement("button"),this.$button.appendChild(this.$name),this.$widget.appendChild(this.$button),this.$button.addEventListener("click",r=>{r.preventDefault(),this.getValue().call(this.object),this._callOnChange()}),this.$button.addEventListener("touchstart",()=>{},{passive:!0}),this.$disable=this.$button}}class ole extends zs{constructor(e,n,i,r,a,s){super(e,n,i,"number"),this._initInput(),this.min(r),this.max(a);const l=s!==void 0;this.step(l?s:this._getImplicitStep(),l),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,n=!0){return this._step=e,this._stepExplicit=n,this}updateDisplay(){const e=this.getValue();if(this._hasSlider){let n=(e-this._min)/(this._max-this._min);n=Math.max(0,Math.min(n,1)),this.$fill.style.width=n*100+"%"}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","text"),this.$input.setAttribute("aria-labelledby",this.$name.id),window.matchMedia("(pointer: coarse)").matches&&(this.$input.setAttribute("type","number"),this.$input.setAttribute("step","any")),this.$widget.appendChild(this.$input),this.$disable=this.$input;const n=()=>{let w=parseFloat(this.$input.value);isNaN(w)||(this._stepExplicit&&(w=this._snap(w)),this.setValue(this._clamp(w)))},i=w=>{const S=parseFloat(this.$input.value);isNaN(S)||(this._snapClampSetValue(S+w),this.$input.value=this.getValue())},r=w=>{w.key==="Enter"&&this.$input.blur(),w.code==="ArrowUp"&&(w.preventDefault(),i(this._step*this._arrowKeyMultiplier(w))),w.code==="ArrowDown"&&(w.preventDefault(),i(this._step*this._arrowKeyMultiplier(w)*-1))},a=w=>{this._inputFocused&&(w.preventDefault(),i(this._step*this._normalizeMouseWheel(w)))};let s=!1,l,c,d,f,h;const g=5,m=w=>{l=w.clientX,c=d=w.clientY,s=!0,f=this.getValue(),h=0,window.addEventListener("mousemove",b),window.addEventListener("mouseup",y)},b=w=>{if(s){const S=w.clientX-l,A=w.clientY-c;Math.abs(A)>g?(w.preventDefault(),this.$input.blur(),s=!1,this._setDraggingStyle(!0,"vertical")):Math.abs(S)>g&&y()}if(!s){const S=w.clientY-d;h-=S*this._step*this._arrowKeyMultiplier(w),f+h>this._max?h=this._max-f:f+h<this._min&&(h=this._min-f),this._snapClampSetValue(f+h)}d=w.clientY},y=()=>{this._setDraggingStyle(!1,"vertical"),this._callOnFinishChange(),window.removeEventListener("mousemove",b),window.removeEventListener("mouseup",y)},x=()=>{this._inputFocused=!0},v=()=>{this._inputFocused=!1,this.updateDisplay(),this._callOnFinishChange()};this.$input.addEventListener("input",n),this.$input.addEventListener("keydown",r),this.$input.addEventListener("wheel",a,{passive:!1}),this.$input.addEventListener("mousedown",m),this.$input.addEventListener("focus",x),this.$input.addEventListener("blur",v)}_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=(v,w,S,A,R)=>(v-w)/(S-w)*(R-A)+A,n=v=>{const w=this.$slider.getBoundingClientRect();let S=e(v,w.left,w.right,this._min,this._max);this._snapClampSetValue(S)},i=v=>{this._setDraggingStyle(!0),n(v.clientX),window.addEventListener("mousemove",r),window.addEventListener("mouseup",a)},r=v=>{n(v.clientX)},a=()=>{this._callOnFinishChange(),this._setDraggingStyle(!1),window.removeEventListener("mousemove",r),window.removeEventListener("mouseup",a)};let s=!1,l,c;const d=v=>{v.preventDefault(),this._setDraggingStyle(!0),n(v.touches[0].clientX),s=!1},f=v=>{v.touches.length>1||(this._hasScrollBar?(l=v.touches[0].clientX,c=v.touches[0].clientY,s=!0):d(v),window.addEventListener("touchmove",h,{passive:!1}),window.addEventListener("touchend",g))},h=v=>{if(s){const w=v.touches[0].clientX-l,S=v.touches[0].clientY-c;Math.abs(w)>Math.abs(S)?d(v):(window.removeEventListener("touchmove",h),window.removeEventListener("touchend",g))}else v.preventDefault(),n(v.touches[0].clientX)},g=()=>{this._callOnFinishChange(),this._setDraggingStyle(!1),window.removeEventListener("touchmove",h),window.removeEventListener("touchend",g)},m=this._callOnFinishChange.bind(this),b=400;let y;const x=v=>{if(Math.abs(v.deltaX)<Math.abs(v.deltaY)&&this._hasScrollBar)return;v.preventDefault();const S=this._normalizeMouseWheel(v)*this._step;this._snapClampSetValue(this.getValue()+S),this.$input.value=this.getValue(),clearTimeout(y),y=setTimeout(m,b)};this.$slider.addEventListener("mousedown",i),this.$slider.addEventListener("touchstart",f,{passive:!1}),this.$slider.addEventListener("wheel",x,{passive:!1})}_setDraggingStyle(e,n="horizontal"){this.$slider&&this.$slider.classList.toggle("active",e),document.body.classList.toggle("lil-gui-dragging",e),document.body.classList.toggle(`lil-gui-${n}`,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:n,deltaY:i}=e;return Math.floor(e.deltaY)!==e.deltaY&&e.wheelDelta&&(n=0,i=-e.wheelDelta/120,i*=this._stepExplicit?1:10),n+-i}_arrowKeyMultiplier(e){let n=this._stepExplicit?1:10;return e.shiftKey?n*=10:e.altKey&&(n/=10),n}_snap(e){const n=Math.round(e/this._step)*this._step;return parseFloat(n.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 lle extends zs{constructor(e,n,i,r){super(e,n,i,"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.$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.options(r)}options(e){return this._values=Array.isArray(e)?e:Object.values(e),this._names=Array.isArray(e)?e:Object.keys(e),this.$select.replaceChildren(),this._names.forEach(n=>{const i=document.createElement("option");i.textContent=n,this.$select.appendChild(i)}),this.updateDisplay(),this}updateDisplay(){const e=this.getValue(),n=this._values.indexOf(e);return this.$select.selectedIndex=n,this.$display.textContent=n===-1?e:this._names[n],this}}class cle extends zs{constructor(e,n,i){super(e,n,i,"string"),this.$input=document.createElement("input"),this.$input.setAttribute("type","text"),this.$input.setAttribute("spellcheck","false"),this.$input.setAttribute("aria-labelledby",this.$name.id),this.$input.addEventListener("input",()=>{this.setValue(this.$input.value)}),this.$input.addEventListener("keydown",r=>{r.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}}const ule=`.lil-gui {
  7397. font-family: var(--font-family);
  7398. font-size: var(--font-size);
  7399. line-height: 1;
  7400. font-weight: normal;
  7401. font-style: normal;
  7402. text-align: left;
  7403. color: var(--text-color);
  7404. user-select: none;
  7405. -webkit-user-select: none;
  7406. touch-action: manipulation;
  7407. --background-color: #1f1f1f;
  7408. --text-color: #ebebeb;
  7409. --title-background-color: #111111;
  7410. --title-text-color: #ebebeb;
  7411. --widget-color: #424242;
  7412. --hover-color: #4f4f4f;
  7413. --focus-color: #595959;
  7414. --number-color: #2cc9ff;
  7415. --string-color: #a2db3c;
  7416. --font-size: 11px;
  7417. --input-font-size: 11px;
  7418. --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  7419. --font-family-mono: Menlo, Monaco, Consolas, "Droid Sans Mono", monospace;
  7420. --padding: 4px;
  7421. --spacing: 4px;
  7422. --widget-height: 20px;
  7423. --title-height: calc(var(--widget-height) + var(--spacing) * 1.25);
  7424. --name-width: 45%;
  7425. --slider-knob-width: 2px;
  7426. --slider-input-width: 27%;
  7427. --color-input-width: 27%;
  7428. --slider-input-min-width: 45px;
  7429. --color-input-min-width: 45px;
  7430. --folder-indent: 7px;
  7431. --widget-padding: 0 0 0 3px;
  7432. --widget-border-radius: 2px;
  7433. --checkbox-size: calc(0.75 * var(--widget-height));
  7434. --scrollbar-width: 5px;
  7435. }
  7436. .lil-gui, .lil-gui * {
  7437. box-sizing: border-box;
  7438. margin: 0;
  7439. padding: 0;
  7440. }
  7441. .lil-gui.root {
  7442. width: var(--width, 245px);
  7443. display: flex;
  7444. flex-direction: column;
  7445. background: var(--background-color);
  7446. }
  7447. .lil-gui.root > .title {
  7448. background: var(--title-background-color);
  7449. color: var(--title-text-color);
  7450. }
  7451. .lil-gui.root > .children {
  7452. overflow-x: hidden;
  7453. overflow-y: auto;
  7454. }
  7455. .lil-gui.root > .children::-webkit-scrollbar {
  7456. width: var(--scrollbar-width);
  7457. height: var(--scrollbar-width);
  7458. background: var(--background-color);
  7459. }
  7460. .lil-gui.root > .children::-webkit-scrollbar-thumb {
  7461. border-radius: var(--scrollbar-width);
  7462. background: var(--focus-color);
  7463. }
  7464. @media (pointer: coarse) {
  7465. .lil-gui.allow-touch-styles, .lil-gui.allow-touch-styles .lil-gui {
  7466. --widget-height: 28px;
  7467. --padding: 6px;
  7468. --spacing: 6px;
  7469. --font-size: 13px;
  7470. --input-font-size: 16px;
  7471. --folder-indent: 10px;
  7472. --scrollbar-width: 7px;
  7473. --slider-input-min-width: 50px;
  7474. --color-input-min-width: 65px;
  7475. }
  7476. }
  7477. .lil-gui.force-touch-styles, .lil-gui.force-touch-styles .lil-gui {
  7478. --widget-height: 28px;
  7479. --padding: 6px;
  7480. --spacing: 6px;
  7481. --font-size: 13px;
  7482. --input-font-size: 16px;
  7483. --folder-indent: 10px;
  7484. --scrollbar-width: 7px;
  7485. --slider-input-min-width: 50px;
  7486. --color-input-min-width: 65px;
  7487. }
  7488. .lil-gui.autoPlace {
  7489. max-height: 100%;
  7490. position: fixed;
  7491. top: 0;
  7492. right: 15px;
  7493. z-index: 1001;
  7494. }
  7495. .lil-gui .controller {
  7496. display: flex;
  7497. align-items: center;
  7498. padding: 0 var(--padding);
  7499. margin: var(--spacing) 0;
  7500. }
  7501. .lil-gui .controller.disabled {
  7502. opacity: 0.5;
  7503. }
  7504. .lil-gui .controller.disabled, .lil-gui .controller.disabled * {
  7505. pointer-events: none !important;
  7506. }
  7507. .lil-gui .controller > .name {
  7508. min-width: var(--name-width);
  7509. flex-shrink: 0;
  7510. white-space: pre;
  7511. padding-right: var(--spacing);
  7512. line-height: var(--widget-height);
  7513. }
  7514. .lil-gui .controller .widget {
  7515. position: relative;
  7516. display: flex;
  7517. align-items: center;
  7518. width: 100%;
  7519. min-height: var(--widget-height);
  7520. }
  7521. .lil-gui .controller.string input {
  7522. color: var(--string-color);
  7523. }
  7524. .lil-gui .controller.boolean {
  7525. cursor: pointer;
  7526. }
  7527. .lil-gui .controller.color .display {
  7528. width: 100%;
  7529. height: var(--widget-height);
  7530. border-radius: var(--widget-border-radius);
  7531. position: relative;
  7532. }
  7533. @media (hover: hover) {
  7534. .lil-gui .controller.color .display:hover:before {
  7535. content: " ";
  7536. display: block;
  7537. position: absolute;
  7538. border-radius: var(--widget-border-radius);
  7539. border: 1px solid #fff9;
  7540. top: 0;
  7541. right: 0;
  7542. bottom: 0;
  7543. left: 0;
  7544. }
  7545. }
  7546. .lil-gui .controller.color input[type=color] {
  7547. opacity: 0;
  7548. width: 100%;
  7549. height: 100%;
  7550. cursor: pointer;
  7551. }
  7552. .lil-gui .controller.color input[type=text] {
  7553. margin-left: var(--spacing);
  7554. font-family: var(--font-family-mono);
  7555. min-width: var(--color-input-min-width);
  7556. width: var(--color-input-width);
  7557. flex-shrink: 0;
  7558. }
  7559. .lil-gui .controller.option select {
  7560. opacity: 0;
  7561. position: absolute;
  7562. width: 100%;
  7563. max-width: 100%;
  7564. }
  7565. .lil-gui .controller.option .display {
  7566. position: relative;
  7567. pointer-events: none;
  7568. border-radius: var(--widget-border-radius);
  7569. height: var(--widget-height);
  7570. line-height: var(--widget-height);
  7571. max-width: 100%;
  7572. overflow: hidden;
  7573. word-break: break-all;
  7574. padding-left: 0.55em;
  7575. padding-right: 1.75em;
  7576. background: var(--widget-color);
  7577. }
  7578. @media (hover: hover) {
  7579. .lil-gui .controller.option .display.focus {
  7580. background: var(--focus-color);
  7581. }
  7582. }
  7583. .lil-gui .controller.option .display.active {
  7584. background: var(--focus-color);
  7585. }
  7586. .lil-gui .controller.option .display:after {
  7587. font-family: "lil-gui";
  7588. content: "↕";
  7589. position: absolute;
  7590. top: 0;
  7591. right: 0;
  7592. bottom: 0;
  7593. padding-right: 0.375em;
  7594. }
  7595. .lil-gui .controller.option .widget,
  7596. .lil-gui .controller.option select {
  7597. cursor: pointer;
  7598. }
  7599. @media (hover: hover) {
  7600. .lil-gui .controller.option .widget:hover .display {
  7601. background: var(--hover-color);
  7602. }
  7603. }
  7604. .lil-gui .controller.number input {
  7605. color: var(--number-color);
  7606. }
  7607. .lil-gui .controller.number.hasSlider input {
  7608. margin-left: var(--spacing);
  7609. width: var(--slider-input-width);
  7610. min-width: var(--slider-input-min-width);
  7611. flex-shrink: 0;
  7612. }
  7613. .lil-gui .controller.number .slider {
  7614. width: 100%;
  7615. height: var(--widget-height);
  7616. background: var(--widget-color);
  7617. border-radius: var(--widget-border-radius);
  7618. padding-right: var(--slider-knob-width);
  7619. overflow: hidden;
  7620. cursor: ew-resize;
  7621. touch-action: pan-y;
  7622. }
  7623. @media (hover: hover) {
  7624. .lil-gui .controller.number .slider:hover {
  7625. background: var(--hover-color);
  7626. }
  7627. }
  7628. .lil-gui .controller.number .slider.active {
  7629. background: var(--focus-color);
  7630. }
  7631. .lil-gui .controller.number .slider.active .fill {
  7632. opacity: 0.95;
  7633. }
  7634. .lil-gui .controller.number .fill {
  7635. height: 100%;
  7636. border-right: var(--slider-knob-width) solid var(--number-color);
  7637. box-sizing: content-box;
  7638. }
  7639. .lil-gui-dragging .lil-gui {
  7640. --hover-color: var(--widget-color);
  7641. }
  7642. .lil-gui-dragging * {
  7643. cursor: ew-resize !important;
  7644. }
  7645. .lil-gui-dragging.lil-gui-vertical * {
  7646. cursor: ns-resize !important;
  7647. }
  7648. .lil-gui .title {
  7649. height: var(--title-height);
  7650. line-height: calc(var(--title-height) - 4px);
  7651. font-weight: 600;
  7652. padding: 0 var(--padding);
  7653. -webkit-tap-highlight-color: transparent;
  7654. cursor: pointer;
  7655. outline: none;
  7656. text-decoration-skip: objects;
  7657. }
  7658. .lil-gui .title:before {
  7659. font-family: "lil-gui";
  7660. content: "▾";
  7661. padding-right: 2px;
  7662. display: inline-block;
  7663. }
  7664. .lil-gui .title:active {
  7665. background: var(--title-background-color);
  7666. opacity: 0.75;
  7667. }
  7668. @media (hover: hover) {
  7669. body:not(.lil-gui-dragging) .lil-gui .title:hover {
  7670. background: var(--title-background-color);
  7671. opacity: 0.85;
  7672. }
  7673. .lil-gui .title:focus {
  7674. text-decoration: underline var(--focus-color);
  7675. }
  7676. }
  7677. .lil-gui.root > .title:focus {
  7678. text-decoration: none !important;
  7679. }
  7680. .lil-gui.closed > .title:before {
  7681. content: "▸";
  7682. }
  7683. .lil-gui.closed > .children {
  7684. transform: translateY(-7px);
  7685. opacity: 0;
  7686. }
  7687. .lil-gui.closed:not(.transition) > .children {
  7688. display: none;
  7689. }
  7690. .lil-gui.transition > .children {
  7691. transition-duration: 300ms;
  7692. transition-property: height, opacity, transform;
  7693. transition-timing-function: cubic-bezier(0.2, 0.6, 0.35, 1);
  7694. overflow: hidden;
  7695. pointer-events: none;
  7696. }
  7697. .lil-gui .children:empty:before {
  7698. content: "Empty";
  7699. padding: 0 var(--padding);
  7700. margin: var(--spacing) 0;
  7701. display: block;
  7702. height: var(--widget-height);
  7703. font-style: italic;
  7704. line-height: var(--widget-height);
  7705. opacity: 0.5;
  7706. }
  7707. .lil-gui.root > .children > .lil-gui > .title {
  7708. border: 0 solid var(--widget-color);
  7709. border-width: 1px 0;
  7710. transition: border-color 300ms;
  7711. }
  7712. .lil-gui.root > .children > .lil-gui.closed > .title {
  7713. border-bottom-color: transparent;
  7714. }
  7715. .lil-gui + .controller {
  7716. border-top: 1px solid var(--widget-color);
  7717. margin-top: 0;
  7718. padding-top: var(--spacing);
  7719. }
  7720. .lil-gui .lil-gui .lil-gui > .title {
  7721. border: none;
  7722. }
  7723. .lil-gui .lil-gui .lil-gui > .children {
  7724. border: none;
  7725. margin-left: var(--folder-indent);
  7726. border-left: 2px solid var(--widget-color);
  7727. }
  7728. .lil-gui .lil-gui .controller {
  7729. border: none;
  7730. }
  7731. .lil-gui label, .lil-gui input, .lil-gui button {
  7732. -webkit-tap-highlight-color: transparent;
  7733. }
  7734. .lil-gui input {
  7735. border: 0;
  7736. outline: none;
  7737. font-family: var(--font-family);
  7738. font-size: var(--input-font-size);
  7739. border-radius: var(--widget-border-radius);
  7740. height: var(--widget-height);
  7741. background: var(--widget-color);
  7742. color: var(--text-color);
  7743. width: 100%;
  7744. }
  7745. @media (hover: hover) {
  7746. .lil-gui input:hover {
  7747. background: var(--hover-color);
  7748. }
  7749. .lil-gui input:active {
  7750. background: var(--focus-color);
  7751. }
  7752. }
  7753. .lil-gui input:disabled {
  7754. opacity: 1;
  7755. }
  7756. .lil-gui input[type=text],
  7757. .lil-gui input[type=number] {
  7758. padding: var(--widget-padding);
  7759. -moz-appearance: textfield;
  7760. }
  7761. .lil-gui input[type=text]:focus,
  7762. .lil-gui input[type=number]:focus {
  7763. background: var(--focus-color);
  7764. }
  7765. .lil-gui input[type=checkbox] {
  7766. appearance: none;
  7767. width: var(--checkbox-size);
  7768. height: var(--checkbox-size);
  7769. border-radius: var(--widget-border-radius);
  7770. text-align: center;
  7771. cursor: pointer;
  7772. }
  7773. .lil-gui input[type=checkbox]:checked:before {
  7774. font-family: "lil-gui";
  7775. content: "✓";
  7776. font-size: var(--checkbox-size);
  7777. line-height: var(--checkbox-size);
  7778. }
  7779. @media (hover: hover) {
  7780. .lil-gui input[type=checkbox]:focus {
  7781. box-shadow: inset 0 0 0 1px var(--focus-color);
  7782. }
  7783. }
  7784. .lil-gui button {
  7785. outline: none;
  7786. cursor: pointer;
  7787. font-family: var(--font-family);
  7788. font-size: var(--font-size);
  7789. color: var(--text-color);
  7790. width: 100%;
  7791. height: var(--widget-height);
  7792. text-transform: none;
  7793. background: var(--widget-color);
  7794. border-radius: var(--widget-border-radius);
  7795. border: none;
  7796. }
  7797. @media (hover: hover) {
  7798. .lil-gui button:hover {
  7799. background: var(--hover-color);
  7800. }
  7801. .lil-gui button:focus {
  7802. box-shadow: inset 0 0 0 1px var(--focus-color);
  7803. }
  7804. }
  7805. .lil-gui button:active {
  7806. background: var(--focus-color);
  7807. }
  7808. @font-face {
  7809. font-family: "lil-gui";
  7810. 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");
  7811. }`;function dle(t){const e=document.createElement("style");e.innerHTML=t;const n=document.querySelector("head link[rel=stylesheet], head style");n?document.head.insertBefore(e,n):document.head.appendChild(e)}let tI=!1;class ux{constructor({parent:e,autoPlace:n=e===void 0,container:i,width:r,title:a="Controls",closeFolders:s=!1,injectStyles:l=!0,touchStyles:c=!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",d=>{(d.code==="Enter"||d.code==="Space")&&(d.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(a),this.parent){this.parent.children.push(this),this.parent.folders.push(this),this.parent.$children.appendChild(this.domElement);return}this.domElement.classList.add("root"),c&&this.domElement.classList.add("allow-touch-styles"),!tI&&l&&(dle(ule),tI=!0),i?i.appendChild(this.domElement):n&&(this.domElement.classList.add("autoPlace"),document.body.appendChild(this.domElement)),r&&this.domElement.style.setProperty("--width",r+"px"),this._closeFolders=s}add(e,n,i,r,a){if(Object(i)===i)return new lle(this,e,n,i);const s=e[n];switch(typeof s){case"number":return new ole(this,e,n,i,r,a);case"boolean":return new ele(this,e,n);case"string":return new cle(this,e,n);case"function":return new H1(this,e,n)}console.error(`gui.add failed
  7812. property:`,n,`
  7813. object:`,e,`
  7814. value:`,s)}addColor(e,n,i=1){return new sle(this,e,n,i)}addFolder(e){const n=new ux({parent:this,title:e});return this.root._closeFolders&&n.close(),n}load(e,n=!0){return e.controllers&&this.controllers.forEach(i=>{i instanceof H1||i._name in e.controllers&&i.load(e.controllers[i._name])}),n&&e.folders&&this.folders.forEach(i=>{i._title in e.folders&&i.load(e.folders[i._title])}),this}save(e=!0){const n={controllers:{},folders:{}};return this.controllers.forEach(i=>{if(!(i instanceof H1)){if(i._name in n.controllers)throw new Error(`Cannot save GUI with duplicate property "${i._name}"`);n.controllers[i._name]=i.save()}}),e&&this.folders.forEach(i=>{if(i._title in n.folders)throw new Error(`Cannot save GUI with duplicate folder "${i._title}"`);n.folders[i._title]=i.save()}),n}open(e=!0){return this._setClosed(!e),this.$title.setAttribute("aria-expanded",!this._closed),this.domElement.classList.toggle("closed",this._closed),this}close(){return this.open(!1)}_setClosed(e){this._closed!==e&&(this._closed=e,this._callOnOpenClose(this))}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._setClosed(!e),this.$title.setAttribute("aria-expanded",!this._closed),requestAnimationFrame(()=>{const n=this.$children.clientHeight;this.$children.style.height=n+"px",this.domElement.classList.add("transition");const i=a=>{a.target===this.$children&&(this.$children.style.height="",this.domElement.classList.remove("transition"),this.$children.removeEventListener("transitionend",i))};this.$children.addEventListener("transitionend",i);const r=e?this.$children.scrollHeight:0;this.domElement.classList.toggle("closed",!e),requestAnimationFrame(()=>{this.$children.style.height=r+"px"})}),this}title(e){return this._title=e,this.$title.textContent=e,this}reset(e=!0){return(e?this.controllersRecursive():this.controllers).forEach(i=>i.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})}onOpenClose(e){return this._onOpenClose=e,this}_callOnOpenClose(e){this.parent&&this.parent._callOnOpenClose(e),this._onOpenClose!==void 0&&this._onOpenClose.call(this,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(n=>{e=e.concat(n.controllersRecursive())}),e}foldersRecursive(){let e=Array.from(this.folders);return this.folders.forEach(n=>{e=e.concat(n.foldersRecursive())}),e}}function G1(t,e,n,i){return new(n||(n=Promise))((function(r,a){function s(d){try{c(i.next(d))}catch(f){a(f)}}function l(d){try{c(i.throw(d))}catch(f){a(f)}}function c(d){var f;d.done?r(d.value):(f=d.value,f instanceof n?f:new n((function(h){h(f)}))).then(s,l)}c((i=i.apply(t,[])).next())}))}class HT{constructor(e,n,i,r){this.size=e,this.width=n,this.height=i,this.charLength=r,this.chars=""}static parse(e){const n=e.split(" "),i=n[0],r=i.split("x");return new HT(i,+r[0],+r[1],+n[1])}get src(){return"data:image/jpeg;base64,"+this.chars}get isValid(){return this.chars.length==this.charLength&&/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(this.chars)}}class GT{constructor(e,n,i,r){this.src=e,this.gcode=n,this.params=i,this.comment=r}}class nI extends GT{constructor(e,n,i,r){super(e,n,i,r),this.params=i}}class Gl extends GT{constructor(e,n,i,r){super(e,n,void 0,i),this.toolIndex=r}}class iI{constructor(e,n,i,r=0){this.layer=e,this.commands=n,this.lineNumber=i,this.height=r}}class dx{constructor(e){this.lines=[],this.preamble=new iI(-1,[],0),this.layers=[],this.curZ=0,this.maxZ=0,this.metadata={thumbnails:{}},this.tolerance=0,this.tolerance=e??this.tolerance}parseGCode(e){const n=Array.isArray(e)?e:e.split(`
  7815. `);this.lines=this.lines.concat(n);const i=this.lines2commands(n);this.groupIntoLayers(i);const r=this.parseMetadata(i.filter((a=>a.comment))).thumbnails;for(const[a,s]of Object.entries(r))this.metadata.thumbnails[a]=s;return{layers:this.layers,metadata:this.metadata}}lines2commands(e){return e.map((n=>this.parseCommand(n)))}parseCommand(e,n=!0){var i;const r=e.trim().split(";"),a=r[0],s=n&&r[1]||void 0,l=a.split(/([a-zA-Z])/g).slice(1).map((f=>f.trim())),c=l.length?`${(i=l[0])===null||i===void 0?void 0:i.toLowerCase()}${l[1]}`:"",d=this.parseParams(l.slice(2));switch(c){case"g0":case"g00":case"g1":case"g01":case"g2":case"g02":case"g3":case"g03":return new nI(e,c,d,s);case"t0":return new Gl(e,c,s,0);case"t1":return new Gl(e,c,s,1);case"t2":return new Gl(e,c,s,2);case"t3":return new Gl(e,c,s,3);case"t4":return new Gl(e,c,s,4);case"t5":return new Gl(e,c,s,5);case"t6":return new Gl(e,c,s,6);case"t7":return new Gl(e,c,s,7);default:return new GT(e,c,d,s)}}parseMove(e){return e.reduce(((n,i)=>{const r=i.charAt(0).toLowerCase();return r!="x"&&r!="y"&&r!="z"&&r!="e"&&r!="r"&&r!="f"&&r!="i"&&r!="j"||(n[r]=parseFloat(i.slice(1))),n}),{})}isAlpha(e){const n=e.charCodeAt(0);return n>=97&&n<=122||n>=65&&n<=90}parseParams(e){return e.reduce(((n,i,r,a)=>{if(r%2==0)return n;let s=a[r-1];return s=s.toLowerCase(),this.isAlpha(s)&&(n[s]=parseFloat(i)),n}),{})}groupIntoLayers(e){var n;for(let i=0;i<e.length;i++){const r=e[i];if(r instanceof nI){const a=r.params;if(a.z&&(this.curZ=a.z),((n=a.e)!==null&&n!==void 0?n:0)>0&&(a.x!=null||a.y!=null)&&Math.abs(this.curZ-(this.maxZ||-1/0))>this.tolerance){const s=Math.abs(this.curZ-this.maxZ);this.maxZ=this.curZ,this.layers.push(new iI(this.layers.length,[],i,s))}}this.maxLayer.commands.push(r)}return this.layers}get maxLayer(){var e;return(e=this.layers[this.layers.length-1])!==null&&e!==void 0?e:this.preamble}parseMetadata(e){const n={};let i;for(const r of e){const a=r.comment;if(!a)continue;const s=a.indexOf("thumbnail begin"),l=a.indexOf("thumbnail end");s>-1?i=HT.parse(a.slice(s+15).trim()):i&&(l==-1?i.chars+=a.trim():(i.isValid&&(n[i.size]=i),i=void 0))}return{thumbnails:n}}}dx.prototype.parseGcode=dx.prototype.parseGCode;const rI={type:"change"},V1={type:"start"},aI={type:"end"},av=new kT,sI=new $l,fle=Math.cos(70*UB.DEG2RAD);class hle extends Uu{constructor(e,n){super(),this.object=e,this.domElement=n,this.domElement.style.touchAction="none",this.enabled=!0,this.target=new Ce,this.cursor=new Ce,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minTargetRadius=0,this.maxTargetRadius=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.zoomToCursor=!1,this.autoRotate=!1,this.autoRotateSpeed=2,this.keys={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"},this.mouseButtons={LEFT:Pd.ROTATE,MIDDLE:Pd.DOLLY,RIGHT:Pd.PAN},this.touches={ONE:Dd.ROTATE,TWO:Dd.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 l.phi},this.getAzimuthalAngle=function(){return l.theta},this.getDistance=function(){return this.object.position.distanceTo(this.target)},this.listenToKeyEvents=function(G){G.addEventListener("keydown",Be),this._domElementKeyEvents=G},this.stopListenToKeyEvents=function(){this._domElementKeyEvents.removeEventListener("keydown",Be),this._domElementKeyEvents=null},this.saveState=function(){i.target0.copy(i.target),i.position0.copy(i.object.position),i.zoom0=i.object.zoom},this.reset=function(){i.target.copy(i.target0),i.object.position.copy(i.position0),i.object.zoom=i.zoom0,i.object.updateProjectionMatrix(),i.dispatchEvent(rI),i.update(),a=r.NONE},this.update=(function(){const G=new Ce,ne=new Mu().setFromUnitVectors(e.up,new Ce(0,1,0)),Q=ne.clone().invert(),ee=new Ce,ae=new Mu,ie=new Ce,we=2*Math.PI;return function(ve=null){const k=i.object.position;G.copy(k).sub(i.target),G.applyQuaternion(ne),l.setFromVector3(G),i.autoRotate&&a===r.NONE&&L((function(xe){return xe!==null?2*Math.PI/60*i.autoRotateSpeed*xe:2*Math.PI/60/60*i.autoRotateSpeed})(ve)),i.enableDamping?(l.theta+=c.theta*i.dampingFactor,l.phi+=c.phi*i.dampingFactor):(l.theta+=c.theta,l.phi+=c.phi);let O=i.minAzimuthAngle,K=i.maxAzimuthAngle;isFinite(O)&&isFinite(K)&&(O<-Math.PI?O+=we:O>Math.PI&&(O-=we),K<-Math.PI?K+=we:K>Math.PI&&(K-=we),l.theta=O<=K?Math.max(O,Math.min(K,l.theta)):l.theta>(O+K)/2?Math.max(O,l.theta):Math.min(K,l.theta)),l.phi=Math.max(i.minPolarAngle,Math.min(i.maxPolarAngle,l.phi)),l.makeSafe(),i.enableDamping===!0?i.target.addScaledVector(f,i.dampingFactor):i.target.add(f),i.target.sub(i.cursor),i.target.clampLength(i.minTargetRadius,i.maxTargetRadius),i.target.add(i.cursor),i.zoomToCursor&&N||i.object.isOrthographicCamera?l.radius=Y(l.radius):l.radius=Y(l.radius*d),G.setFromSpherical(l),G.applyQuaternion(Q),k.copy(i.target).add(G),i.object.lookAt(i.target),i.enableDamping===!0?(c.theta*=1-i.dampingFactor,c.phi*=1-i.dampingFactor,f.multiplyScalar(1-i.dampingFactor)):(c.set(0,0,0),f.set(0,0,0));let pe=!1;if(i.zoomToCursor&&N){let xe=null;if(i.object.isPerspectiveCamera){const fe=G.length();xe=Y(fe*d);const Ke=fe-xe;i.object.position.addScaledVector(A,Ke),i.object.updateMatrixWorld()}else if(i.object.isOrthographicCamera){const fe=new Ce(R.x,R.y,0);fe.unproject(i.object),i.object.zoom=Math.max(i.minZoom,Math.min(i.maxZoom,i.object.zoom/d)),i.object.updateProjectionMatrix(),pe=!0;const Ke=new Ce(R.x,R.y,0);Ke.unproject(i.object),i.object.position.sub(Ke).add(fe),i.object.updateMatrixWorld(),xe=G.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),i.zoomToCursor=!1;xe!==null&&(this.screenSpacePanning?i.target.set(0,0,-1).transformDirection(i.object.matrix).multiplyScalar(xe).add(i.object.position):(av.origin.copy(i.object.position),av.direction.set(0,0,-1).transformDirection(i.object.matrix),Math.abs(i.object.up.dot(av.direction))<fle?e.lookAt(i.target):(sI.setFromNormalAndCoplanarPoint(i.object.up,i.target),av.intersectPlane(sI,i.target))))}else i.object.isOrthographicCamera&&(i.object.zoom=Math.max(i.minZoom,Math.min(i.maxZoom,i.object.zoom/d)),i.object.updateProjectionMatrix(),pe=!0);return d=1,N=!1,!!(pe||ee.distanceToSquared(i.object.position)>s||8*(1-ae.dot(i.object.quaternion))>s||ie.distanceToSquared(i.target)>0)&&(i.dispatchEvent(rI),ee.copy(i.object.position),ae.copy(i.object.quaternion),ie.copy(i.target),!0)}})(),this.dispose=function(){i.domElement.removeEventListener("contextmenu",le),i.domElement.removeEventListener("pointerdown",be),i.domElement.removeEventListener("pointercancel",he),i.domElement.removeEventListener("wheel",Ae),i.domElement.removeEventListener("pointermove",Ne),i.domElement.removeEventListener("pointerup",he),i._domElementKeyEvents!==null&&(i._domElementKeyEvents.removeEventListener("keydown",Be),i._domElementKeyEvents=null)};const i=this,r={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6};let a=r.NONE;const s=1e-6,l=new JL,c=new JL;let d=1;const f=new Ce,h=new Ut,g=new Ut,m=new Ut,b=new Ut,y=new Ut,x=new Ut,v=new Ut,w=new Ut,S=new Ut,A=new Ce,R=new Ut;let N=!1;const C=[],F={};function P(){return Math.pow(.95,i.zoomSpeed)}function L(G){c.theta-=G}function B(G){c.phi-=G}const U=(function(){const G=new Ce;return function(ne,Q){G.setFromMatrixColumn(Q,0),G.multiplyScalar(-ne),f.add(G)}})(),$=(function(){const G=new Ce;return function(ne,Q){i.screenSpacePanning===!0?G.setFromMatrixColumn(Q,1):(G.setFromMatrixColumn(Q,0),G.crossVectors(i.object.up,G)),G.multiplyScalar(ne),f.add(G)}})(),I=(function(){const G=new Ce;return function(ne,Q){const ee=i.domElement;if(i.object.isPerspectiveCamera){const ae=i.object.position;G.copy(ae).sub(i.target);let ie=G.length();ie*=Math.tan(i.object.fov/2*Math.PI/180),U(2*ne*ie/ee.clientHeight,i.object.matrix),$(2*Q*ie/ee.clientHeight,i.object.matrix)}else i.object.isOrthographicCamera?(U(ne*(i.object.right-i.object.left)/i.object.zoom/ee.clientWidth,i.object.matrix),$(Q*(i.object.top-i.object.bottom)/i.object.zoom/ee.clientHeight,i.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),i.enablePan=!1)}})();function W(G){i.object.isPerspectiveCamera||i.object.isOrthographicCamera?d/=G:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),i.enableZoom=!1)}function X(G){i.object.isPerspectiveCamera||i.object.isOrthographicCamera?d*=G:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),i.enableZoom=!1)}function V(G){if(!i.zoomToCursor)return;N=!0;const ne=i.domElement.getBoundingClientRect(),Q=G.clientX-ne.left,ee=G.clientY-ne.top,ae=ne.width,ie=ne.height;R.x=Q/ae*2-1,R.y=-ee/ie*2+1,A.set(R.x,R.y,1).unproject(i.object).sub(i.object.position).normalize()}function Y(G){return Math.max(i.minDistance,Math.min(i.maxDistance,G))}function J(G){h.set(G.clientX,G.clientY)}function se(G){b.set(G.clientX,G.clientY)}function H(){if(C.length===1)h.set(C[0].pageX,C[0].pageY);else{const G=.5*(C[0].pageX+C[1].pageX),ne=.5*(C[0].pageY+C[1].pageY);h.set(G,ne)}}function q(){if(C.length===1)b.set(C[0].pageX,C[0].pageY);else{const G=.5*(C[0].pageX+C[1].pageX),ne=.5*(C[0].pageY+C[1].pageY);b.set(G,ne)}}function re(){const G=C[0].pageX-C[1].pageX,ne=C[0].pageY-C[1].pageY,Q=Math.sqrt(G*G+ne*ne);v.set(0,Q)}function ce(G){if(C.length==1)g.set(G.pageX,G.pageY);else{const Q=z(G),ee=.5*(G.pageX+Q.x),ae=.5*(G.pageY+Q.y);g.set(ee,ae)}m.subVectors(g,h).multiplyScalar(i.rotateSpeed);const ne=i.domElement;L(2*Math.PI*m.x/ne.clientHeight),B(2*Math.PI*m.y/ne.clientHeight),h.copy(g)}function ye(G){if(C.length===1)y.set(G.pageX,G.pageY);else{const ne=z(G),Q=.5*(G.pageX+ne.x),ee=.5*(G.pageY+ne.y);y.set(Q,ee)}x.subVectors(y,b).multiplyScalar(i.panSpeed),I(x.x,x.y),b.copy(y)}function me(G){const ne=z(G),Q=G.pageX-ne.x,ee=G.pageY-ne.y,ae=Math.sqrt(Q*Q+ee*ee);w.set(0,ae),S.set(0,Math.pow(w.y/v.y,i.zoomSpeed)),W(S.y),v.copy(w)}function be(G){i.enabled!==!1&&(C.length===0&&(i.domElement.setPointerCapture(G.pointerId),i.domElement.addEventListener("pointermove",Ne),i.domElement.addEventListener("pointerup",he)),(function(ne){C.push(ne)})(G),G.pointerType==="touch"?(function(ne){switch(lt(ne),C.length){case 1:switch(i.touches.ONE){case Dd.ROTATE:if(i.enableRotate===!1)return;H(),a=r.TOUCH_ROTATE;break;case Dd.PAN:if(i.enablePan===!1)return;q(),a=r.TOUCH_PAN;break;default:a=r.NONE}break;case 2:switch(i.touches.TWO){case Dd.DOLLY_PAN:if(i.enableZoom===!1&&i.enablePan===!1)return;i.enableZoom&&re(),i.enablePan&&q(),a=r.TOUCH_DOLLY_PAN;break;case Dd.DOLLY_ROTATE:if(i.enableZoom===!1&&i.enableRotate===!1)return;i.enableZoom&&re(),i.enableRotate&&H(),a=r.TOUCH_DOLLY_ROTATE;break;default:a=r.NONE}break;default:a=r.NONE}a!==r.NONE&&i.dispatchEvent(V1)})(G):(function(ne){let Q;switch(ne.button){case 0:Q=i.mouseButtons.LEFT;break;case 1:Q=i.mouseButtons.MIDDLE;break;case 2:Q=i.mouseButtons.RIGHT;break;default:Q=-1}switch(Q){case Pd.DOLLY:if(i.enableZoom===!1)return;(function(ee){V(ee),v.set(ee.clientX,ee.clientY)})(ne),a=r.DOLLY;break;case Pd.ROTATE:if(ne.ctrlKey||ne.metaKey||ne.shiftKey){if(i.enablePan===!1)return;se(ne),a=r.PAN}else{if(i.enableRotate===!1)return;J(ne),a=r.ROTATE}break;case Pd.PAN:if(ne.ctrlKey||ne.metaKey||ne.shiftKey){if(i.enableRotate===!1)return;J(ne),a=r.ROTATE}else{if(i.enablePan===!1)return;se(ne),a=r.PAN}break;default:a=r.NONE}a!==r.NONE&&i.dispatchEvent(V1)})(G))}function Ne(G){i.enabled!==!1&&(G.pointerType==="touch"?(function(ne){switch(lt(ne),a){case r.TOUCH_ROTATE:if(i.enableRotate===!1)return;ce(ne),i.update();break;case r.TOUCH_PAN:if(i.enablePan===!1)return;ye(ne),i.update();break;case r.TOUCH_DOLLY_PAN:if(i.enableZoom===!1&&i.enablePan===!1)return;(function(Q){i.enableZoom&&me(Q),i.enablePan&&ye(Q)})(ne),i.update();break;case r.TOUCH_DOLLY_ROTATE:if(i.enableZoom===!1&&i.enableRotate===!1)return;(function(Q){i.enableZoom&&me(Q),i.enableRotate&&ce(Q)})(ne),i.update();break;default:a=r.NONE}})(G):(function(ne){switch(a){case r.ROTATE:if(i.enableRotate===!1)return;(function(Q){g.set(Q.clientX,Q.clientY),m.subVectors(g,h).multiplyScalar(i.rotateSpeed);const ee=i.domElement;L(2*Math.PI*m.x/ee.clientHeight),B(2*Math.PI*m.y/ee.clientHeight),h.copy(g),i.update()})(ne);break;case r.DOLLY:if(i.enableZoom===!1)return;(function(Q){w.set(Q.clientX,Q.clientY),S.subVectors(w,v),S.y>0?W(P()):S.y<0&&X(P()),v.copy(w),i.update()})(ne);break;case r.PAN:if(i.enablePan===!1)return;(function(Q){y.set(Q.clientX,Q.clientY),x.subVectors(y,b).multiplyScalar(i.panSpeed),I(x.x,x.y),b.copy(y),i.update()})(ne)}})(G))}function he(G){(function(ne){delete F[ne.pointerId];for(let Q=0;Q<C.length;Q++)if(C[Q].pointerId==ne.pointerId)return void C.splice(Q,1)})(G),C.length===0&&(i.domElement.releasePointerCapture(G.pointerId),i.domElement.removeEventListener("pointermove",Ne),i.domElement.removeEventListener("pointerup",he)),i.dispatchEvent(aI),a=r.NONE}function Ae(G){i.enabled!==!1&&i.enableZoom!==!1&&a===r.NONE&&(G.preventDefault(),i.dispatchEvent(V1),(function(ne){V(ne),ne.deltaY<0?X(P()):ne.deltaY>0&&W(P()),i.update()})(G),i.dispatchEvent(aI))}function Be(G){i.enabled!==!1&&i.enablePan!==!1&&(function(ne){let Q=!1;switch(ne.code){case i.keys.UP:ne.ctrlKey||ne.metaKey||ne.shiftKey?B(2*Math.PI*i.rotateSpeed/i.domElement.clientHeight):I(0,i.keyPanSpeed),Q=!0;break;case i.keys.BOTTOM:ne.ctrlKey||ne.metaKey||ne.shiftKey?B(-2*Math.PI*i.rotateSpeed/i.domElement.clientHeight):I(0,-i.keyPanSpeed),Q=!0;break;case i.keys.LEFT:ne.ctrlKey||ne.metaKey||ne.shiftKey?L(2*Math.PI*i.rotateSpeed/i.domElement.clientHeight):I(i.keyPanSpeed,0),Q=!0;break;case i.keys.RIGHT:ne.ctrlKey||ne.metaKey||ne.shiftKey?L(-2*Math.PI*i.rotateSpeed/i.domElement.clientHeight):I(-i.keyPanSpeed,0),Q=!0}Q&&(ne.preventDefault(),i.update())})(G)}function le(G){i.enabled!==!1&&G.preventDefault()}function lt(G){let ne=F[G.pointerId];ne===void 0&&(ne=new Ut,F[G.pointerId]=ne),ne.set(G.pageX,G.pageY)}function z(G){const ne=G.pointerId===C[0].pointerId?C[1]:C[0];return F[ne.pointerId]}i.domElement.addEventListener("contextmenu",le),i.domElement.addEventListener("pointerdown",be),i.domElement.addEventListener("pointercancel",he),i.domElement.addEventListener("wheel",Ae,{passive:!1}),this.update()}}ht.line={worldUnits:{value:1},linewidth:{value:1},resolution:{value:new Ut(1,1)},dashOffset:{value:0},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1}},qr.line={uniforms:FT.merge([ht.common,ht.fog,ht.line]),vertexShader:`
  7816. #include <common>
  7817. #include <color_pars_vertex>
  7818. #include <fog_pars_vertex>
  7819. #include <logdepthbuf_pars_vertex>
  7820. #include <clipping_planes_pars_vertex>
  7821. uniform float linewidth;
  7822. uniform vec2 resolution;
  7823. attribute vec3 instanceStart;
  7824. attribute vec3 instanceEnd;
  7825. attribute vec3 instanceColorStart;
  7826. attribute vec3 instanceColorEnd;
  7827. #ifdef WORLD_UNITS
  7828. varying vec4 worldPos;
  7829. varying vec3 worldStart;
  7830. varying vec3 worldEnd;
  7831. #ifdef USE_DASH
  7832. varying vec2 vUv;
  7833. #endif
  7834. #else
  7835. varying vec2 vUv;
  7836. #endif
  7837. #ifdef USE_DASH
  7838. uniform float dashScale;
  7839. attribute float instanceDistanceStart;
  7840. attribute float instanceDistanceEnd;
  7841. varying float vLineDistance;
  7842. #endif
  7843. void trimSegment( const in vec4 start, inout vec4 end ) {
  7844. // trim end segment so it terminates between the camera plane and the near plane
  7845. // conservative estimate of the near plane
  7846. float a = projectionMatrix[ 2 ][ 2 ]; // 3nd entry in 3th column
  7847. float b = projectionMatrix[ 3 ][ 2 ]; // 3nd entry in 4th column
  7848. float nearEstimate = - 0.5 * b / a;
  7849. float alpha = ( nearEstimate - start.z ) / ( end.z - start.z );
  7850. end.xyz = mix( start.xyz, end.xyz, alpha );
  7851. }
  7852. void main() {
  7853. #ifdef USE_COLOR
  7854. vColor.xyz = ( position.y < 0.5 ) ? instanceColorStart : instanceColorEnd;
  7855. #endif
  7856. #ifdef USE_DASH
  7857. vLineDistance = ( position.y < 0.5 ) ? dashScale * instanceDistanceStart : dashScale * instanceDistanceEnd;
  7858. vUv = uv;
  7859. #endif
  7860. float aspect = resolution.x / resolution.y;
  7861. // camera space
  7862. vec4 start = modelViewMatrix * vec4( instanceStart, 1.0 );
  7863. vec4 end = modelViewMatrix * vec4( instanceEnd, 1.0 );
  7864. #ifdef WORLD_UNITS
  7865. worldStart = start.xyz;
  7866. worldEnd = end.xyz;
  7867. #else
  7868. vUv = uv;
  7869. #endif
  7870. // special case for perspective projection, and segments that terminate either in, or behind, the camera plane
  7871. // clearly the gpu firmware has a way of addressing this issue when projecting into ndc space
  7872. // but we need to perform ndc-space calculations in the shader, so we must address this issue directly
  7873. // perhaps there is a more elegant solution -- WestLangley
  7874. bool perspective = ( projectionMatrix[ 2 ][ 3 ] == - 1.0 ); // 4th entry in the 3rd column
  7875. if ( perspective ) {
  7876. if ( start.z < 0.0 && end.z >= 0.0 ) {
  7877. trimSegment( start, end );
  7878. } else if ( end.z < 0.0 && start.z >= 0.0 ) {
  7879. trimSegment( end, start );
  7880. }
  7881. }
  7882. // clip space
  7883. vec4 clipStart = projectionMatrix * start;
  7884. vec4 clipEnd = projectionMatrix * end;
  7885. // ndc space
  7886. vec3 ndcStart = clipStart.xyz / clipStart.w;
  7887. vec3 ndcEnd = clipEnd.xyz / clipEnd.w;
  7888. // direction
  7889. vec2 dir = ndcEnd.xy - ndcStart.xy;
  7890. // account for clip-space aspect ratio
  7891. dir.x *= aspect;
  7892. dir = normalize( dir );
  7893. #ifdef WORLD_UNITS
  7894. // get the offset direction as perpendicular to the view vector
  7895. vec3 worldDir = normalize( end.xyz - start.xyz );
  7896. vec3 offset;
  7897. if ( position.y < 0.5 ) {
  7898. offset = normalize( cross( start.xyz, worldDir ) );
  7899. } else {
  7900. offset = normalize( cross( end.xyz, worldDir ) );
  7901. }
  7902. // sign flip
  7903. if ( position.x < 0.0 ) offset *= - 1.0;
  7904. float forwardOffset = dot( worldDir, vec3( 0.0, 0.0, 1.0 ) );
  7905. // don't extend the line if we're rendering dashes because we
  7906. // won't be rendering the endcaps
  7907. #ifndef USE_DASH
  7908. // extend the line bounds to encompass endcaps
  7909. start.xyz += - worldDir * linewidth * 0.5;
  7910. end.xyz += worldDir * linewidth * 0.5;
  7911. // shift the position of the quad so it hugs the forward edge of the line
  7912. offset.xy -= dir * forwardOffset;
  7913. offset.z += 0.5;
  7914. #endif
  7915. // endcaps
  7916. if ( position.y > 1.0 || position.y < 0.0 ) {
  7917. offset.xy += dir * 2.0 * forwardOffset;
  7918. }
  7919. // adjust for linewidth
  7920. offset *= linewidth * 0.5;
  7921. // set the world position
  7922. worldPos = ( position.y < 0.5 ) ? start : end;
  7923. worldPos.xyz += offset;
  7924. // project the worldpos
  7925. vec4 clip = projectionMatrix * worldPos;
  7926. // shift the depth of the projected points so the line
  7927. // segments overlap neatly
  7928. vec3 clipPose = ( position.y < 0.5 ) ? ndcStart : ndcEnd;
  7929. clip.z = clipPose.z * clip.w;
  7930. #else
  7931. vec2 offset = vec2( dir.y, - dir.x );
  7932. // undo aspect ratio adjustment
  7933. dir.x /= aspect;
  7934. offset.x /= aspect;
  7935. // sign flip
  7936. if ( position.x < 0.0 ) offset *= - 1.0;
  7937. // endcaps
  7938. if ( position.y < 0.0 ) {
  7939. offset += - dir;
  7940. } else if ( position.y > 1.0 ) {
  7941. offset += dir;
  7942. }
  7943. // adjust for linewidth
  7944. offset *= linewidth;
  7945. // adjust for clip-space to screen-space conversion // maybe resolution should be based on viewport ...
  7946. offset /= resolution.y;
  7947. // select end
  7948. vec4 clip = ( position.y < 0.5 ) ? clipStart : clipEnd;
  7949. // back to clip space
  7950. offset *= clip.w;
  7951. clip.xy += offset;
  7952. #endif
  7953. gl_Position = clip;
  7954. vec4 mvPosition = ( position.y < 0.5 ) ? start : end; // this is an approximation
  7955. #include <logdepthbuf_vertex>
  7956. #include <clipping_planes_vertex>
  7957. #include <fog_vertex>
  7958. }
  7959. `,fragmentShader:`
  7960. uniform vec3 diffuse;
  7961. uniform float opacity;
  7962. uniform float linewidth;
  7963. #ifdef USE_DASH
  7964. uniform float dashOffset;
  7965. uniform float dashSize;
  7966. uniform float gapSize;
  7967. #endif
  7968. varying float vLineDistance;
  7969. #ifdef WORLD_UNITS
  7970. varying vec4 worldPos;
  7971. varying vec3 worldStart;
  7972. varying vec3 worldEnd;
  7973. #ifdef USE_DASH
  7974. varying vec2 vUv;
  7975. #endif
  7976. #else
  7977. varying vec2 vUv;
  7978. #endif
  7979. #include <common>
  7980. #include <color_pars_fragment>
  7981. #include <fog_pars_fragment>
  7982. #include <logdepthbuf_pars_fragment>
  7983. #include <clipping_planes_pars_fragment>
  7984. vec2 closestLineToLine(vec3 p1, vec3 p2, vec3 p3, vec3 p4) {
  7985. float mua;
  7986. float mub;
  7987. vec3 p13 = p1 - p3;
  7988. vec3 p43 = p4 - p3;
  7989. vec3 p21 = p2 - p1;
  7990. float d1343 = dot( p13, p43 );
  7991. float d4321 = dot( p43, p21 );
  7992. float d1321 = dot( p13, p21 );
  7993. float d4343 = dot( p43, p43 );
  7994. float d2121 = dot( p21, p21 );
  7995. float denom = d2121 * d4343 - d4321 * d4321;
  7996. float numer = d1343 * d4321 - d1321 * d4343;
  7997. mua = numer / denom;
  7998. mua = clamp( mua, 0.0, 1.0 );
  7999. mub = ( d1343 + d4321 * ( mua ) ) / d4343;
  8000. mub = clamp( mub, 0.0, 1.0 );
  8001. return vec2( mua, mub );
  8002. }
  8003. void main() {
  8004. #include <clipping_planes_fragment>
  8005. #ifdef USE_DASH
  8006. if ( vUv.y < - 1.0 || vUv.y > 1.0 ) discard; // discard endcaps
  8007. if ( mod( vLineDistance + dashOffset, dashSize + gapSize ) > dashSize ) discard; // todo - FIX
  8008. #endif
  8009. float alpha = opacity;
  8010. #ifdef WORLD_UNITS
  8011. // Find the closest points on the view ray and the line segment
  8012. vec3 rayEnd = normalize( worldPos.xyz ) * 1e5;
  8013. vec3 lineDir = worldEnd - worldStart;
  8014. vec2 params = closestLineToLine( worldStart, worldEnd, vec3( 0.0, 0.0, 0.0 ), rayEnd );
  8015. vec3 p1 = worldStart + lineDir * params.x;
  8016. vec3 p2 = rayEnd * params.y;
  8017. vec3 delta = p1 - p2;
  8018. float len = length( delta );
  8019. float norm = len / linewidth;
  8020. #ifndef USE_DASH
  8021. #ifdef USE_ALPHA_TO_COVERAGE
  8022. float dnorm = fwidth( norm );
  8023. alpha = 1.0 - smoothstep( 0.5 - dnorm, 0.5 + dnorm, norm );
  8024. #else
  8025. if ( norm > 0.5 ) {
  8026. discard;
  8027. }
  8028. #endif
  8029. #endif
  8030. #else
  8031. #ifdef USE_ALPHA_TO_COVERAGE
  8032. // artifacts appear on some hardware if a derivative is taken within a conditional
  8033. float a = vUv.x;
  8034. float b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;
  8035. float len2 = a * a + b * b;
  8036. float dlen = fwidth( len2 );
  8037. if ( abs( vUv.y ) > 1.0 ) {
  8038. alpha = 1.0 - smoothstep( 1.0 - dlen, 1.0 + dlen, len2 );
  8039. }
  8040. #else
  8041. if ( abs( vUv.y ) > 1.0 ) {
  8042. float a = vUv.x;
  8043. float b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;
  8044. float len2 = a * a + b * b;
  8045. if ( len2 > 1.0 ) discard;
  8046. }
  8047. #endif
  8048. #endif
  8049. vec4 diffuseColor = vec4( diffuse, alpha );
  8050. #include <logdepthbuf_fragment>
  8051. #include <color_fragment>
  8052. gl_FragColor = vec4( diffuseColor.rgb, alpha );
  8053. #include <tonemapping_fragment>
  8054. #include <colorspace_fragment>
  8055. #include <fog_fragment>
  8056. #include <premultiplied_alpha_fragment>
  8057. }
  8058. `};class i5 extends uc{constructor(e){super({type:"LineMaterial",uniforms:FT.clone(qr.line.uniforms),vertexShader:qr.line.vertexShader,fragmentShader:qr.line.fragmentShader,clipping:!0}),this.isLineMaterial=!0,this.setValues(e)}get color(){return this.uniforms.diffuse.value}set color(e){this.uniforms.diffuse.value=e}get worldUnits(){return"WORLD_UNITS"in this.defines}set worldUnits(e){e===!0?this.defines.WORLD_UNITS="":delete this.defines.WORLD_UNITS}get linewidth(){return this.uniforms.linewidth.value}set linewidth(e){this.uniforms.linewidth&&(this.uniforms.linewidth.value=e)}get dashed(){return"USE_DASH"in this.defines}set dashed(e){e===!0!==this.dashed&&(this.needsUpdate=!0),e===!0?this.defines.USE_DASH="":delete this.defines.USE_DASH}get dashScale(){return this.uniforms.dashScale.value}set dashScale(e){this.uniforms.dashScale.value=e}get dashSize(){return this.uniforms.dashSize.value}set dashSize(e){this.uniforms.dashSize.value=e}get dashOffset(){return this.uniforms.dashOffset.value}set dashOffset(e){this.uniforms.dashOffset.value=e}get gapSize(){return this.uniforms.gapSize.value}set gapSize(e){this.uniforms.gapSize.value=e}get opacity(){return this.uniforms.opacity.value}set opacity(e){this.uniforms&&(this.uniforms.opacity.value=e)}get resolution(){return this.uniforms.resolution.value}set resolution(e){this.uniforms.resolution.value.copy(e)}get alphaToCoverage(){return"USE_ALPHA_TO_COVERAGE"in this.defines}set alphaToCoverage(e){this.defines&&(e===!0!==this.alphaToCoverage&&(this.needsUpdate=!0),e===!0?(this.defines.USE_ALPHA_TO_COVERAGE="",this.extensions.derivatives=!0):(delete this.defines.USE_ALPHA_TO_COVERAGE,this.extensions.derivatives=!1))}}const oI=new qa,sv=new Ce;class r5 extends Zoe{constructor(){super(),this.isLineSegmentsGeometry=!0,this.type="LineSegmentsGeometry",this.setIndex([0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5]),this.setAttribute("position",new si([-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],3)),this.setAttribute("uv",new si([-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],2))}applyMatrix4(e){const n=this.attributes.instanceStart,i=this.attributes.instanceEnd;return n!==void 0&&(n.applyMatrix4(e),i.applyMatrix4(e),n.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}setPositions(e){let n;e instanceof Float32Array?n=e:Array.isArray(e)&&(n=new Float32Array(e));const i=new WM(n,6,1);return this.setAttribute("instanceStart",new ec(i,3,0)),this.setAttribute("instanceEnd",new ec(i,3,3)),this.computeBoundingBox(),this.computeBoundingSphere(),this}setColors(e){let n;e instanceof Float32Array?n=e:Array.isArray(e)&&(n=new Float32Array(e));const i=new WM(n,6,1);return this.setAttribute("instanceColorStart",new ec(i,3,0)),this.setAttribute("instanceColorEnd",new ec(i,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 Voe(e.geometry)),this}fromLineSegments(e){const n=e.geometry;return this.setPositions(n.attributes.position.array),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new qa);const e=this.attributes.instanceStart,n=this.attributes.instanceEnd;e!==void 0&&n!==void 0&&(this.boundingBox.setFromBufferAttribute(e),oI.setFromBufferAttribute(n),this.boundingBox.union(oI))}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new Fs),this.boundingBox===null&&this.computeBoundingBox();const e=this.attributes.instanceStart,n=this.attributes.instanceEnd;if(e!==void 0&&n!==void 0){const i=this.boundingSphere.center;this.boundingBox.getCenter(i);let r=0;for(let a=0,s=e.count;a<s;a++)sv.fromBufferAttribute(e,a),r=Math.max(r,i.distanceToSquared(sv)),sv.fromBufferAttribute(n,a),r=Math.max(r,i.distanceToSquared(sv));this.boundingSphere.radius=Math.sqrt(r),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)}}const lI=new Ce,cI=new Ce,or=new Cn,lr=new Cn,Rs=new Cn,$1=new Ce,W1=new Ln,cr=new Qoe,uI=new Ce,ov=new qa,lv=new Fs,Ps=new Cn;let Ds,tu;function dI(t,e,n){return Ps.set(0,0,-e,1).applyMatrix4(t.projectionMatrix),Ps.multiplyScalar(1/Ps.w),Ps.x=tu/n.width,Ps.y=tu/n.height,Ps.applyMatrix4(t.projectionMatrixInverse),Ps.multiplyScalar(1/Ps.w),Math.abs(Math.max(Ps.x,Ps.y))}class ple extends gs{constructor(e=new r5,n=new i5({color:16777215*Math.random()})){super(e,n),this.isLineSegments2=!0,this.type="LineSegments2"}computeLineDistances(){const e=this.geometry,n=e.attributes.instanceStart,i=e.attributes.instanceEnd,r=new Float32Array(2*n.count);for(let s=0,l=0,c=n.count;s<c;s++,l+=2)lI.fromBufferAttribute(n,s),cI.fromBufferAttribute(i,s),r[l]=l===0?0:r[l-1],r[l+1]=r[l]+lI.distanceTo(cI);const a=new WM(r,2,1);return e.setAttribute("instanceDistanceStart",new ec(a,1,0)),e.setAttribute("instanceDistanceEnd",new ec(a,1,1)),this}raycast(e,n){const i=this.material.worldUnits,r=e.camera;r!==null||i||console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2 while worldUnits is set to false.');const a=e.params.Line2!==void 0&&e.params.Line2.threshold||0;Ds=e.ray;const s=this.matrixWorld,l=this.geometry,c=this.material;let d,f;tu=c.linewidth+a,l.boundingSphere===null&&l.computeBoundingSphere(),lv.copy(l.boundingSphere).applyMatrix4(s),i?d=.5*tu:d=dI(r,Math.max(r.near,lv.distanceToPoint(Ds.origin)),c.resolution),lv.radius+=d,Ds.intersectsSphere(lv)!==!1&&(l.boundingBox===null&&l.computeBoundingBox(),ov.copy(l.boundingBox).applyMatrix4(s),i?f=.5*tu:f=dI(r,Math.max(r.near,ov.distanceToPoint(Ds.origin)),c.resolution),ov.expandByScalar(f),Ds.intersectsBox(ov)!==!1&&(i?(function(h,g){const m=h.matrixWorld,b=h.geometry,y=b.attributes.instanceStart,x=b.attributes.instanceEnd;for(let v=0,w=Math.min(b.instanceCount,y.count);v<w;v++){cr.start.fromBufferAttribute(y,v),cr.end.fromBufferAttribute(x,v),cr.applyMatrix4(m);const S=new Ce,A=new Ce;Ds.distanceSqToSegment(cr.start,cr.end,A,S),A.distanceTo(S)<.5*tu&&g.push({point:A,pointOnLine:S,distance:Ds.origin.distanceTo(A),object:h,face:null,faceIndex:v,uv:null,uv1:null})}})(this,n):(function(h,g,m){const b=g.projectionMatrix,y=h.material.resolution,x=h.matrixWorld,v=h.geometry,w=v.attributes.instanceStart,S=v.attributes.instanceEnd,A=Math.min(v.instanceCount,w.count),R=-g.near;Ds.at(1,Rs),Rs.w=1,Rs.applyMatrix4(g.matrixWorldInverse),Rs.applyMatrix4(b),Rs.multiplyScalar(1/Rs.w),Rs.x*=y.x/2,Rs.y*=y.y/2,Rs.z=0,$1.copy(Rs),W1.multiplyMatrices(g.matrixWorldInverse,x);for(let N=0,C=A;N<C;N++){if(or.fromBufferAttribute(w,N),lr.fromBufferAttribute(S,N),or.w=1,lr.w=1,or.applyMatrix4(W1),lr.applyMatrix4(W1),or.z>R&&lr.z>R)continue;if(or.z>R){const U=or.z-lr.z,$=(or.z-R)/U;or.lerp(lr,$)}else if(lr.z>R){const U=lr.z-or.z,$=(lr.z-R)/U;lr.lerp(or,$)}or.applyMatrix4(b),lr.applyMatrix4(b),or.multiplyScalar(1/or.w),lr.multiplyScalar(1/lr.w),or.x*=y.x/2,or.y*=y.y/2,lr.x*=y.x/2,lr.y*=y.y/2,cr.start.copy(or),cr.start.z=0,cr.end.copy(lr),cr.end.z=0;const F=cr.closestPointToPointParameter($1,!0);cr.at(F,uI);const P=UB.lerp(or.z,lr.z,F),L=P>=-1&&P<=1,B=$1.distanceTo(uI)<.5*tu;if(L&&B){cr.start.fromBufferAttribute(w,N),cr.end.fromBufferAttribute(S,N),cr.start.applyMatrix4(x),cr.end.applyMatrix4(x);const U=new Ce,$=new Ce;Ds.distanceSqToSegment(cr.start,cr.end,$,U),m.push({point:$,pointOnLine:U,distance:Ds.origin.distanceTo($),object:h,face:null,faceIndex:N,uv:null,uv1:null})}}})(this,r,n)))}}class mle extends _y{constructor(e,n,i,r,a=4473924,s=8947848){a=new Nt(a),s=new Nt(s);const l=Math.round(e/n);i=Math.round(i/r)*r/2;const c=[],d=[];let f=0;for(let g=-1*(e=l*n/2);g<=e;g+=n){c.push(g,0,-1*i,g,0,i);const m=g===0?a:s;m.toArray(d,f),f+=3,m.toArray(d,f),f+=3,m.toArray(d,f),f+=3,m.toArray(d,f),f+=3}for(let g=-1*i;g<=i;g+=r){c.push(-1*e,0,g,e,0,g);const m=g===0?a:s;m.toArray(d,f),f+=3,m.toArray(d,f),f+=3,m.toArray(d,f),f+=3,m.toArray(d,f),f+=3}const h=new Mr;h.setAttribute("position",new si(c,3)),h.setAttribute("color",new si(d,3)),super(h,new _m({vertexColors:!0,toneMapped:!1}))}}function gle(t,e,n,i){const r=(function(s,l,c){s*=.5,l*=.5,c*=.5;const d=new Mr,f=[];return f.push(-s,-l,-c,-s,l,-c,-s,l,-c,s,l,-c,s,l,-c,s,-l,-c,s,-l,-c,-s,-l,-c,-s,-l,c,-s,l,c,-s,l,c,s,l,c,s,l,c,s,-l,c,s,-l,c,-s,-l,c,-s,-l,-c,-s,-l,c,-s,l,-c,-s,l,c,s,l,-c,s,l,c,s,-l,-c,s,-l,c),d.setAttribute("position",new si(f,3)),d})(t,e,n),a=new _y(r,new Woe({color:new Nt(i),dashSize:3,gapSize:1}));return a.computeLineDistances(),a}var Cp=function(){var t=0,e=document.createElement("div");function n(f){return e.appendChild(f.dom),f}function i(f){for(var h=0;h<e.children.length;h++)e.children[h].style.display=h===f?"block":"none";t=f}e.style.cssText="position:fixed;top:0;left:0;cursor:pointer;opacity:0.9;z-index:10000",e.addEventListener("click",(function(f){f.preventDefault(),i(++t%e.children.length)}),!1);var r=(performance||Date).now(),a=r,s=0,l=n(new Cp.Panel("FPS","#0ff","#002")),c=n(new Cp.Panel("MS","#0f0","#020"));if(self.performance&&self.performance.memory)var d=n(new Cp.Panel("MB","#f08","#201"));return i(0),{REVISION:16,dom:e,addPanel:n,showPanel:i,begin:function(){r=(performance||Date).now()},end:function(){s++;var f=(performance||Date).now();if(c.update(f-r,200),f>=a+1e3&&(l.update(1e3*s/(f-a),100),a=f,s=0,d)){var h=performance.memory;d.update(h.usedJSHeapSize/1048576,h.jsHeapSizeLimit/1048576)}return f},update:function(){r=this.end()},domElement:e,setMode:i}};Cp.Panel=function(t,e,n){var i=1/0,r=0,a=Math.round,s=a(window.devicePixelRatio||1),l=80*s,c=48*s,d=3*s,f=2*s,h=3*s,g=15*s,m=74*s,b=30*s,y=document.createElement("canvas");y.width=l,y.height=c,y.style.cssText="width:80px;height:48px";var x=y.getContext("2d");return x.font="bold "+9*s+"px Helvetica,Arial,sans-serif",x.textBaseline="top",x.fillStyle=n,x.fillRect(0,0,l,c),x.fillStyle=e,x.fillText(t,d,f),x.fillRect(h,g,m,b),x.fillStyle=n,x.globalAlpha=.9,x.fillRect(h,g,m,b),{dom:y,update:function(v,w){i=Math.min(i,v),r=Math.max(r,v),x.fillStyle=n,x.globalAlpha=1,x.fillRect(0,0,l,g),x.fillStyle=e,x.fillText(a(v)+" "+t+" ("+a(i)+"-"+a(r)+")",d,f),x.drawImage(y,h+s,g,m-s,b,h,g,m-s,b),x.fillRect(h+m-s,g,s,b),x.fillStyle=n,x.globalAlpha=.9,x.fillRect(h+m-s,g,s,a((1-v/w)*b))}}};var vle=Cp;class fI{constructor(e,n){this.openFolders=[],this.watchedObject=e,this.options=n,this.gui=new ux,this.gui.title("Dev info"),this.setup()}setup(){this.loadOpenFolders(),this.options&&!this.options.renderer||this.setupRedererFolder(),this.options&&!this.options.camera||this.setupCameraFolder(),this.options&&!this.options.parser||this.setupParserFolder(),this.options&&!this.options.buildVolume||this.setupBuildVolumeFolder(),this.options&&!this.options.devHelpers||this.setupDevHelpers()}reset(){this.gui.destroy(),this.gui=new ux,this.gui.title("Dev info"),this.setup()}loadOpenFolders(){this.openFolders=JSON.parse(localStorage.getItem("dev-gui-open")||"{}").open||[]}saveOpenFolders(){this.openFolders=this.gui.foldersRecursive().filter((e=>!e._closed)).map((e=>e._title)),console.log(this.openFolders),localStorage.setItem("dev-gui-open",JSON.stringify({open:this.openFolders}))}setupRedererFolder(){const e=this.gui.addFolder("Render Info");this.openFolders.includes("Render Info")||e.close(),e.onOpenClose((()=>{this.saveOpenFolders()})),e.add(this.watchedObject.renderer.info.render,"triangles").listen(),e.add(this.watchedObject.renderer.info.render,"calls").listen(),e.add(this.watchedObject.renderer.info.render,"lines").listen(),e.add(this.watchedObject.renderer.info.render,"points").listen(),e.add(this.watchedObject.renderer.info.memory,"geometries").listen(),e.add(this.watchedObject.renderer.info.memory,"textures").listen(),e.add(this.watchedObject,"_lastRenderTime").listen()}setupCameraFolder(){const e=this.gui.addFolder("Camera");this.openFolders.includes("Camera")||e.close(),e.onOpenClose((()=>{this.saveOpenFolders()}));const n=e.addFolder("Camera position");n.add(this.watchedObject.camera.position,"x").listen(),n.add(this.watchedObject.camera.position,"y").listen(),n.add(this.watchedObject.camera.position,"z").listen();const i=e.addFolder("Camera rotation");i.add(this.watchedObject.camera.rotation,"x").listen(),i.add(this.watchedObject.camera.rotation,"y").listen(),i.add(this.watchedObject.camera.rotation,"z").listen()}setupParserFolder(){const e=this.gui.addFolder("Parser");this.openFolders.includes("Parser")||e.close(),e.onOpenClose((()=>{this.saveOpenFolders()})),e.add(this.watchedObject.parser,"curZ").listen(),e.add(this.watchedObject.parser,"maxZ").listen(),e.add(this.watchedObject.parser,"tolerance").listen(),e.add(this.watchedObject.parser.layers,"length").name("layers.count").listen(),e.add(this.watchedObject.parser.lines,"length").name("lines.count").listen()}setupBuildVolumeFolder(){const e=this.gui.addFolder("Build Volume");this.openFolders.includes("Build Volume")||e.close(),e.onOpenClose((()=>{this.saveOpenFolders()})),e.add(this.watchedObject.buildVolume,"x").min(0).max(600).listen().onChange((()=>{this.watchedObject.render()})),e.add(this.watchedObject.buildVolume,"y").min(0).max(600).listen().onChange((()=>{this.watchedObject.render()})),e.add(this.watchedObject.buildVolume,"z").min(0).max(600).listen().onChange((()=>{this.watchedObject.render()}))}setupDevHelpers(){const e=this.gui.addFolder("Dev Helpers");this.openFolders.includes("Dev Helpers")||e.close(),e.onOpenClose((()=>{this.saveOpenFolders()})),e.add(this.watchedObject,"_wireframe").listen().onChange((()=>{this.watchedObject.render()})),e.add(this.watchedObject,"render").listen(),e.add(this.watchedObject,"clear").listen()}}class xle extends Mr{constructor(e=[new Ce],n=.6,i=.2,r=8){super(),this.type="ExtrusionGeometry",this.parameters={points:e,lineWidth:n,lineHeight:i,radialSegments:r,closed:!1};const a=new Ce,s=new Ce,l=new Ut,c=[],d=[],f=[],h=[];function g(m){const[b,y,x]=(function(v){const w=e[v],S=new Ce,A=new Ce,R=new Ce,N=new Ce;S.copy(w).sub(e[v-1]||w).normalize().add((e[v+1]||w).clone().sub(w).normalize()).normalize();let C=Number.MAX_VALUE;const F=Math.abs(S.x),P=Math.abs(S.y),L=Math.abs(S.z);return F<=C&&(C=F,A.set(1,0,0)),P<=C&&(C=P,A.set(0,1,0)),L<=C&&A.set(0,0,1),N.crossVectors(S,A).normalize(),A.crossVectors(S,N),R.crossVectors(S,A),[w,A,R]})(m);for(let v=0;v<=r;v++){const w=v/r*Math.PI*2,S=Math.sin(w),A=-Math.cos(w);s.x=A*y.x+S*x.x,s.y=A*y.y+S*x.y,s.z=A*y.z+S*x.z,s.normalize(),d.push(s.x,s.y,s.z),a.x=b.x+n*s.x*.5,a.y=b.y+n*s.y*.5,a.z=b.z+i*s.z*.5,c.push(a.x,a.y,a.z)}}(function(){for(let m=0;m<e.length;m++)g(m);g(closed===!1?e.length-1:0),(function(){for(let m=0;m<e.length;m++)for(let b=0;b<=r;b++)l.x=m/e.length,l.y=b/r,f.push(l.x,l.y)})(),(function(){for(let m=1;m<e.length;m++)for(let b=1;b<=r;b++){const y=(r+1)*(m-1)+(b-1),x=(r+1)*m+(b-1),v=(r+1)*m+b,w=(r+1)*(m-1)+b;h.push(y,x,w),h.push(x,v,w)}})()})(),this.setIndex(h),this.setAttribute("position",new si(c,3)),this.setAttribute("normal",new si(d,3)),this.setAttribute("uv",new si(f,2))}}class Rp{static get initial(){const e=new Rp;return Object.assign(e,{x:0,y:0,z:0,r:0,e:0,i:0,j:0,t:0}),e}}const X1={h:0,s:0,l:0};class df{constructor(e){var n,i,r,a,s,l,c,d,f;if(this.minLayerThreshold=.05,this.renderExtrusion=!0,this.renderTravel=!1,this.renderTubes=!1,this.extrusionWidth=.6,this.singleLayerMode=!1,this.initialCameraPosition=[-100,400,450],this.debug=!1,this.inches=!1,this.nonTravelmoves=[],this.disableGradient=!1,this.state=Rp.initial,this.beyondFirstMove=!1,this.disposables=[],this._extrusionColor=df.defaultExtrusionColor,this.renderLayerIndex=0,this._geometries={},this._backgroundColor=new Nt(14737632),this._travelColor=new Nt(10027008),this._toolColors={},this.devMode=!1,this._lastRenderTime=0,this._wireframe=!1,this.minLayerThreshold=(n=e.minLayerThreshold)!==null&&n!==void 0?n:this.minLayerThreshold,this.parser=new dx(this.minLayerThreshold),this.scene=new Loe,this.scene.background=this._backgroundColor,e.backgroundColor!==void 0&&(this.backgroundColor=new Nt(e.backgroundColor)),this.targetId=e.targetId,this.endLayer=e.endLayer,this.startLayer=e.startLayer,this.lineWidth=e.lineWidth,this.lineHeight=e.lineHeight,this.buildVolume=e.buildVolume,this.initialCameraPosition=(i=e.initialCameraPosition)!==null&&i!==void 0?i:this.initialCameraPosition,this.debug=(r=e.debug)!==null&&r!==void 0?r:this.debug,this.renderExtrusion=(a=e.renderExtrusion)!==null&&a!==void 0?a:this.renderExtrusion,this.renderTravel=(s=e.renderTravel)!==null&&s!==void 0?s:this.renderTravel,this.nonTravelmoves=(l=e.nonTravelMoves)!==null&&l!==void 0?l:this.nonTravelmoves,this.renderTubes=(c=e.renderTubes)!==null&&c!==void 0?c:this.renderTubes,this.extrusionWidth=(d=e.extrusionWidth)!==null&&d!==void 0?d:this.extrusionWidth,this.devMode=(f=e.devMode)!==null&&f!==void 0?f:this.devMode,this.stats=this.devMode?new vle:void 0,e.extrusionColor!==void 0&&(this.extrusionColor=e.extrusionColor),e.travelColor!==void 0&&(this.travelColor=new Nt(e.travelColor)),e.topLayerColor!==void 0&&(this.topLayerColor=new Nt(e.topLayerColor)),e.lastSegmentColor!==void 0&&(this.lastSegmentColor=new Nt(e.lastSegmentColor)),e.toolColors){this._toolColors={};for(const[m,b]of Object.entries(e.toolColors))this._toolColors[parseInt(m)]=new Nt(b)}if(e.disableGradient!==void 0&&(this.disableGradient=e.disableGradient),console.info("Using THREE r"+gy),console.debug("opts",e),this.targetId&&console.warn("`targetId` is deprecated and will removed in the future. Use `canvas` instead."),e.canvas)this.canvas=e.canvas,this.renderer=new $M({canvas:this.canvas,preserveDrawingBuffer:!0});else{if(!this.targetId)throw Error("Set either opts.canvas or opts.targetId");const m=document.getElementById(this.targetId);if(!m)throw new Error("Unable to find element "+this.targetId);this.renderer=new $M({preserveDrawingBuffer:!0}),this.canvas=this.renderer.domElement,m.appendChild(this.canvas)}this.camera=new ma(25,this.canvas.offsetWidth/this.canvas.offsetHeight,10,5e3),this.camera.position.fromArray(this.initialCameraPosition);const h=this.camera.far,g=.8*h;this.scene.fog=new jT(this._backgroundColor,g,h),this.resize(),this.controls=new hle(this.camera,this.renderer.domElement),this.initScene(),this.animate(),e.allowDragNDrop&&this._enableDropHandler(),this.initStats()}get extrusionColor(){return this._extrusionColor}set extrusionColor(e){if(Array.isArray(e)){this._extrusionColor=[];for(const[n,i]of e.entries())this._extrusionColor[n]=new Nt(i)}else this._extrusionColor=new Nt(e)}get currentToolColor(){var e;return this._extrusionColor===void 0?df.defaultExtrusionColor:this._extrusionColor instanceof Nt?this._extrusionColor:(e=this._extrusionColor[this.state.t])!==null&&e!==void 0?e:df.defaultExtrusionColor}get backgroundColor(){return this._backgroundColor}set backgroundColor(e){this._backgroundColor=new Nt(e),this.scene.background=this._backgroundColor}get travelColor(){return this._travelColor}set travelColor(e){this._travelColor=new Nt(e)}get topLayerColor(){return this._topLayerColor}set topLayerColor(e){this._topLayerColor=e!==void 0?new Nt(e):void 0}get lastSegmentColor(){return this._lastSegmentColor}set lastSegmentColor(e){this._lastSegmentColor=e!==void 0?new Nt(e):void 0}get layers(){return[this.parser.preamble].concat(this.parser.layers.concat())}get maxLayerIndex(){var e;return((e=this.endLayer)!==null&&e!==void 0?e:this.layers.length)-1}get minLayerIndex(){var e;return this.singleLayerMode?this.maxLayerIndex:((e=this.startLayer)!==null&&e!==void 0?e:0)-1}animate(){var e;this.animationFrameId=requestAnimationFrame((()=>this.animate())),this.controls.update(),this.renderer.render(this.scene,this.camera),(e=this.stats)===null||e===void 0||e.update()}processGCode(e){this.parser.parseGCode(e),this.render()}initScene(){for(;this.scene.children.length>0;)this.scene.remove(this.scene.children[0]);for(;this.disposables.length>0;){const e=this.disposables.pop();e&&e.dispose()}if(this.debug&&this.buildVolume){const e=new Joe(Math.max(this.buildVolume.x/2,this.buildVolume.y/2)+20);this.scene.add(e)}if(this.buildVolume&&this.drawBuildVolume(),this.renderTubes){console.warn("Volumetric rendering is experimental. It may not work as expected or change in the future.");const e=new Koe(13421772,.3*Math.PI),n=new Yoe(16777215,Math.PI,void 0,.001);n.position.set(0,500,500),this.scene.add(e),this.scene.add(n)}}createGroup(e){const n=new _p;return n.name=e,n.quaternion.setFromEuler(new ym(-Math.PI/2,0,0)),this.buildVolume?n.position.set(-this.buildVolume.x/2,0,this.buildVolume.y/2):n.position.set(-100,0,100),n}render(){const e=performance.now();this.group=this.createGroup("allLayers"),this.state=Rp.initial,this.initScene();for(let n=0;n<this.layers.length;n++)this.renderLayer(n);this.batchGeometries(),this.scene.add(this.group),this.renderer.render(this.scene,this.camera),this._lastRenderTime=performance.now()-e}renderAnimated(e=1){return G1(this,void 0,void 0,(function*(){return this.initScene(),this.renderLayerIndex=0,this.renderFrameLoop(e>0?e:1)}))}renderFrameLoop(e){return new Promise((n=>{const i=()=>{this.renderLayerIndex>this.layers.length-1?n():(this.renderFrame(e),requestAnimationFrame(i))};i()}))}renderFrame(e){this.group=this.createGroup("layer"+this.renderLayerIndex);for(let n=0;n<e&&this.renderLayerIndex+n<this.layers.length;n++)this.renderLayer(this.renderLayerIndex),this.renderLayerIndex++;this.batchGeometries(),this.scene.add(this.group)}renderLayer(e){var n,i,r,a,s,l,c,d;if(e>this.maxLayerIndex)return;const f=this.layers[e],h={extrusion:[],travel:[],z:this.state.z,height:f.height};for(const g of f.commands)if(g.gcode!="g20"){if(g.gcode.startsWith("t")){this.doRenderExtrusion(h,e),h.extrusion=[];const m=g;this.state.t=m.toolIndex}else if(["g0","g00","g1","g01","g2","g02","g3","g03"].indexOf(g.gcode)>-1){const m=g,b={x:(n=m.params.x)!==null&&n!==void 0?n:this.state.x,y:(i=m.params.y)!==null&&i!==void 0?i:this.state.y,z:(r=m.params.z)!==null&&r!==void 0?r:this.state.z,r:(a=m.params.r)!==null&&a!==void 0?a:this.state.r,e:(s=m.params.e)!==null&&s!==void 0?s:this.state.e,i:(l=m.params.i)!==null&&l!==void 0?l:this.state.i,j:(c=m.params.j)!==null&&c!==void 0?c:this.state.j,t:this.state.t};if(e>=this.minLayerIndex){const y=((d=m.params.e)!==null&&d!==void 0?d:0)>0||this.nonTravelmoves.indexOf(g.gcode)>-1;(b.x!=this.state.x||b.y!=this.state.y||b.z!=this.state.z)&&(y&&this.renderExtrusion||!y&&this.renderTravel)&&(g.gcode=="g2"||g.gcode=="g3"||g.gcode=="g02"||g.gcode=="g03"?this.addArcSegment(h,this.state,b,y,g.gcode=="g2"||g.gcode=="g02"):this.addLineSegment(h,this.state,b,y))}this.state.x=b.x,this.state.y=b.y,this.state.z=b.z,this.beyondFirstMove||(this.beyondFirstMove=!0)}}else this.setInches();this.doRenderExtrusion(h,e)}doRenderExtrusion(e,n){var i,r;if(this.renderExtrusion){let a=this.currentToolColor;if(!this.singleLayerMode&&!this.renderTubes&&!this.disableGradient){const s=.1+.7*n/this.layers.length;a.getHSL(X1),a=new Nt().setHSL(X1.h,X1.s,s)}if(n==this.layers.length-1){const s=(i=this._topLayerColor)!==null&&i!==void 0?i:a,l=(r=this._lastSegmentColor)!==null&&r!==void 0?r:s,c=e.extrusion.splice(-3),d=e.extrusion.splice(-3);this.renderTubes?(this.addTubeLine(e.extrusion,s.getHex(),e.height),this.addTubeLine([...d,...c],l.getHex(),e.height)):(this.addLine(e.extrusion,s.getHex()),this.addLine([...d,...c],l.getHex()))}else this.renderTubes?this.addTubeLine(e.extrusion,a.getHex(),e.height):this.addLine(e.extrusion,a.getHex())}this.renderTravel&&this.addLine(e.travel,this._travelColor.getHex())}setInches(){this.beyondFirstMove?console.warn("Switching units after movement is already made is discouraged and is not supported."):this.inches=!0}drawBuildVolume(){if(!this.buildVolume)return;this.scene.add(new mle(this.buildVolume.x,10,this.buildVolume.y,10));const e=gle(this.buildVolume.x,this.buildVolume.z,this.buildVolume.y,8947848);e.position.setY(this.buildVolume.z/2),this.scene.add(e)}clear(){this.resetState(),this.parser=new dx(this.minLayerThreshold)}resetState(){var e;this.startLayer=1,this.endLayer=1/0,this.singleLayerMode=!1,this.beyondFirstMove=!1,this.state=Rp.initial,(e=this.devGui)===null||e===void 0||e.reset(),this._geometries={}}resize(){const[e,n]=[this.canvas.offsetWidth,this.canvas.offsetHeight];this.camera.aspect=e/n,this.camera.updateProjectionMatrix(),this.renderer.setPixelRatio(window.devicePixelRatio),this.renderer.setSize(e,n,!1)}addLineSegment(e,n,i,r){(r?e.extrusion:e.travel).push(n.x,n.y,n.z,i.x,i.y,i.z)}addArcSegment(e,n,i,r,a){const s=r?e.extrusion:e.travel,l=n.x,c=n.y,d=n.z,f=i.x,h=i.y,g=i.z;let m=i.r,b=i.i,y=i.j;if(m){const W=f-l,X=h-c,V=Math.sqrt(Math.pow(W/2,2)+Math.pow(X/2,2));m=Math.max(m,V);const Y=Math.pow(W,2)+Math.pow(X,2),J=Math.pow(m,2)-Y/4;let se=Math.sqrt(J/Y);(a&&m<0||!a&&m>0)&&(se=-se),b=W/2+X*se,y=X/2-W*se}const x=l==f&&c==h,v=l+b,w=c+y,S=Math.sqrt(b*b+y*y),A=Math.atan2(-y,-b),R=Math.atan2(h-w,f-v);let N;x?N=2*Math.PI:(N=a?A-R:R-A,N<0&&(N+=2*Math.PI));let C=S*N/1.8;this.inches&&(C*=25),C<1&&(C=1);let F=N/C;F*=a?-1:1;const P=[];P.push({x:l,y:c,z:d});const L=(d-g)/C;let B=l,U=c,$=d,I=A;for(let W=0;W<C-1;W++)I+=F,B=v+S*Math.cos(I),U=w+S*Math.sin(I),$+=L,P.push({x:B,y:U,z:$});P.push({x:i.x,y:i.y,z:i.z});for(let W=0;W<P.length-1;W++)s.push(P[W].x,P[W].y,P[W].z,P[W+1].x,P[W+1].y,P[W+1].z)}addLine(e,n){var i;if(typeof this.lineWidth=="number"&&this.lineWidth>0)return void this.addThickLine(e,n);const r=new Mr;r.setAttribute("position",new si(e,3)),this.disposables.push(r);const a=new _m({color:n});this.disposables.push(a);const s=new _y(r,a);(i=this.group)===null||i===void 0||i.add(s)}addTubeLine(e,n,i=.2){let r=[];const a=[];for(let s=0;s<e.length;s+=6){const l=e.slice(s,s+9),c=new Ce(l[0],l[1],l[2]),d=new Ce(l[3],l[4],l[5]),f=new Ce(l[6],l[7],l[8]);r.push(c),d.equals(f)||(r.push(d),a.push(r),r=[])}a.forEach((s=>{var l;const c=new xle(s,this.extrusionWidth,this.lineHeight||i,4);(l=this._geometries)[n]||(l[n]=[]),this._geometries[n].push(c)}))}addThickLine(e,n){var i;if(!e.length||!this.lineWidth)return;const r=new r5;this.disposables.push(r);const a=new i5({color:n,linewidth:this.lineWidth/(1e3*window.devicePixelRatio)});this.disposables.push(a),r.setPositions(e);const s=new ple(r,a);(i=this.group)===null||i===void 0||i.add(s)}dispose(){this.disposables.forEach((e=>e.dispose())),this.disposables=[],this.controls.dispose(),this.renderer.dispose(),this.cancelAnimation()}cancelAnimation(){this.animationFrameId!==void 0&&cancelAnimationFrame(this.animationFrameId),this.animationFrameId=void 0}_enableDropHandler(){console.warn("Drag and drop is deprecated as a library feature. See the demo how to implement your own."),this.canvas.addEventListener("dragover",(e=>{e.stopPropagation(),e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect="copy"),this.canvas.classList.add("dragging")})),this.canvas.addEventListener("dragleave",(e=>{e.stopPropagation(),e.preventDefault(),this.canvas.classList.remove("dragging")})),this.canvas.addEventListener("drop",(e=>G1(this,void 0,void 0,(function*(){var n,i;e.stopPropagation(),e.preventDefault(),this.canvas.classList.remove("dragging");const r=((i=(n=e.dataTransfer)===null||n===void 0?void 0:n.files)!==null&&i!==void 0?i:[])[0];this.clear(),yield this._readFromStream(r.stream()),this.render()}))))}batchGeometries(){if(this._geometries)for(const e in this._geometries){const n=this.createBatchMesh(parseInt(e));for(;this._geometries[e].length>0;){const i=this._geometries[e].pop();n.addGeometry(i)}}}createBatchMesh(e){var n;const i=this._geometries[e],r=new $oe({color:e,wireframe:this._wireframe});this.disposables.push(r);const a=i.reduce(((l,c)=>3*c.attributes.position.count+l),0),s=new Hoe(i.length,a,void 0,r);return this.disposables.push(s),(n=this.group)===null||n===void 0||n.add(s),s}_readFromStream(e){var n,i;return G1(this,void 0,void 0,(function*(){const r=e.getReader();let a,s="",l=0;do{console.debug("reading from stream"),a=yield r.read(),l+=(i=(n=a.value)===null||n===void 0?void 0:n.length)!==null&&i!==void 0?i:0;const d=(c=a.value,new TextDecoder("utf-8").decode(c)),f=d.lastIndexOf(`
  8059. `),h=d.slice(0,f);this.parser.parseGCode(s+h),s=d.slice(f)}while(!a.done);var c;console.debug("read from stream",l)}))}initGui(){typeof this.devMode=="boolean"&&this.devMode===!0?this.devGui=new fI(this):typeof this.devMode=="object"&&(this.devGui=new fI(this,this.devMode))}initStats(){var e;this.stats&&(typeof this.devMode=="object"&&(this.statsContainer=this.devMode.statsContainer),((e=this.statsContainer)!==null&&e!==void 0?e:document.body).appendChild(this.stats.dom),this.stats.dom.classList.add("stats"),this.initGui())}}df.defaultExtrusionColor=new Nt("hotpink");const yle=function(t){return new df(t)};function ble({gcodeUrl:t,buildVolume:e={x:256,y:256,z:256},className:n=""}){const i=T.useRef(null),r=T.useRef(null),[a,s]=T.useState(!0),[l,c]=T.useState(null),[d,f]=T.useState(!1),[h,g]=T.useState(0),[m,b]=T.useState(0);T.useEffect(()=>{if(!i.current)return;const v=i.current,w=yle({canvas:v,buildVolume:e,backgroundColor:1710618,travelColor:4473924,extrusionColor:44610,topLayerColor:65370,lastSegmentColor:16777215,lineWidth:2,renderTravel:!1,renderExtrusion:!0});r.current=w,s(!0),c(null),f(!1),fetch(t).then(async A=>{if(!A.ok)throw A.status===404&&(await A.json().catch(()=>({}))).detail?.includes("sliced")?(f(!0),new Error("not_sliced")):new Error("Failed to load G-code");return A.text()}).then(A=>{w.processGCode(A);const R=w.layers?.length||0;b(R),g(R),w.render(),s(!1)}).catch(A=>{c(A.message),s(!1)});const S=()=>{if(v.parentElement){const A=v.parentElement.getBoundingClientRect();v.width=A.width,v.height=A.height,w.resize()}};return S(),window.addEventListener("resize",S),()=>{window.removeEventListener("resize",S),w.dispose()}},[t,e]);const y=v=>{if(!r.current)return;const w=Math.max(1,Math.min(v,m));g(w),r.current.render()},x=v=>{y(parseInt(v.target.value,10))};return E.jsxs("div",{className:`relative flex flex-col h-full ${n}`,children:[E.jsxs("div",{className:"flex-1 relative bg-bambu-dark rounded-lg overflow-hidden",children:[E.jsx("canvas",{ref:i,className:"w-full h-full"}),a&&E.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-bambu-dark/80",children:E.jsxs("div",{className:"text-center",children:[E.jsx(pr,{className:"w-8 h-8 animate-spin text-bambu-green mx-auto mb-2"}),E.jsx("p",{className:"text-bambu-gray text-sm",children:"Loading G-code..."})]})}),d&&E.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-bambu-dark/80",children:E.jsxs("div",{className:"text-center max-w-sm px-4",children:[E.jsx(WW,{className:"w-12 h-12 text-bambu-gray mx-auto mb-3"}),E.jsx("p",{className:"text-white font-medium mb-2",children:"G-code not available"}),E.jsx("p",{className:"text-bambu-gray text-sm",children:"This file hasn't been sliced yet. G-code preview is only available after slicing the model in Bambu Studio or Orca Slicer."})]})}),l&&!d&&E.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-bambu-dark/80",children:E.jsx("div",{className:"text-center text-red-400",children:E.jsx("p",{className:"text-sm",children:l})})})]}),!a&&!l&&!d&&m>0&&E.jsx("div",{className:"mt-4 px-2",children:E.jsxs("div",{className:"flex items-center gap-3",children:[E.jsx(Lz,{className:"w-4 h-4 text-bambu-gray flex-shrink-0"}),E.jsx("button",{onClick:()=>y(h-1),disabled:h<=1,className:"p-1 rounded hover:bg-bambu-dark-tertiary disabled:opacity-30 disabled:cursor-not-allowed",children:E.jsx(gf,{className:"w-4 h-4"})}),E.jsx("input",{type:"range",min:1,max:m,value:h,onChange:x,className:"flex-1 h-2 bg-bambu-dark-tertiary rounded-lg appearance-none cursor-pointer accent-bambu-green"}),E.jsx("button",{onClick:()=>y(h+1),disabled:h>=m,className:"p-1 rounded hover:bg-bambu-dark-tertiary disabled:opacity-30 disabled:cursor-not-allowed",children:E.jsx(vm,{className:"w-4 h-4"})}),E.jsxs("span",{className:"text-sm text-bambu-gray min-w-[80px] text-right",children:[h," / ",m]})]})})]})}function _le({archiveId:t,title:e,onClose:n}){const[i,r]=T.useState(null),[a,s]=T.useState(null),[l,c]=T.useState(!0);T.useEffect(()=>{const f=h=>{h.key==="Escape"&&n()};return window.addEventListener("keydown",f),()=>window.removeEventListener("keydown",f)},[n]),T.useEffect(()=>{Mt.getArchiveCapabilities(t).then(f=>{s(f),f.has_model?r("3d"):f.has_gcode&&r("gcode"),c(!1)}).catch(()=>{s({has_model:!0,has_gcode:!1,build_volume:{x:256,y:256,z:256}}),r("3d"),c(!1)})},[t]);const d=()=>{const f=e||"model",h=`${window.location.origin}${Mt.getArchiveForSlicer(t,f)}`;window.location.href=`bambustudioopen://${encodeURIComponent(h)}`};return E.jsx("div",{className:"fixed inset-0 bg-black/70 flex items-center justify-center z-50 p-8",onClick:n,children:E.jsxs("div",{className:"bg-bambu-dark-secondary rounded-xl border border-bambu-dark-tertiary w-full max-w-4xl h-[80vh] flex flex-col",onClick:f=>f.stopPropagation(),children:[E.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-bambu-dark-tertiary",children:[E.jsx("h2",{className:"text-lg font-semibold text-white truncate flex-1 mr-4",children:e}),E.jsxs("div",{className:"flex items-center gap-2",children:[E.jsxs(At,{variant:"secondary",size:"sm",onClick:d,children:[E.jsx(qv,{className:"w-4 h-4"}),"Open in Slicer"]}),E.jsx(At,{variant:"ghost",size:"sm",onClick:n,children:E.jsx(Ji,{className:"w-5 h-5"})})]})]}),a&&E.jsxs("div",{className:"flex border-b border-bambu-dark-tertiary",children:[E.jsxs("button",{onClick:()=>a.has_model&&r("3d"),disabled:!a.has_model,className:`flex items-center gap-2 px-6 py-3 text-sm font-medium transition-colors ${i==="3d"?"text-bambu-green border-b-2 border-bambu-green":a.has_model?"text-bambu-gray hover:text-white":"text-bambu-gray/30 cursor-not-allowed"}`,children:[E.jsx(Up,{className:"w-4 h-4"}),"3D Model",!a.has_model&&E.jsx("span",{className:"text-xs",children:"(not available)"})]}),E.jsxs("button",{onClick:()=>a.has_gcode&&r("gcode"),disabled:!a.has_gcode,className:`flex items-center gap-2 px-6 py-3 text-sm font-medium transition-colors ${i==="gcode"?"text-bambu-green border-b-2 border-bambu-green":a.has_gcode?"text-bambu-gray hover:text-white":"text-bambu-gray/30 cursor-not-allowed"}`,children:[E.jsx(RW,{className:"w-4 h-4"}),"G-code Preview",!a.has_gcode&&E.jsx("span",{className:"text-xs",children:"(not sliced)"})]})]}),E.jsx("div",{className:"flex-1 overflow-hidden p-4",children:l?E.jsx("div",{className:"w-full h-full flex items-center justify-center",children:E.jsx(pr,{className:"w-8 h-8 animate-spin text-bambu-green"})}):i==="3d"&&a?E.jsx(gte,{url:Mt.getArchiveDownload(t),buildVolume:a.build_volume,className:"w-full h-full"}):i==="gcode"&&a?E.jsx(ble,{gcodeUrl:Mt.getArchiveGcode(t),buildVolume:a.build_volume,className:"w-full h-full"}):E.jsx("div",{className:"w-full h-full flex items-center justify-center text-bambu-gray",children:"No preview available for this file"})})]})})}function Sle({archiveId:t,archiveName:e,onClose:n,onSuccess:i}){const[r,a]=T.useState(null),{data:s,isLoading:l}=Ki({queryKey:["printers"],queryFn:Mt.getPrinters}),c=Qi({mutationFn:()=>{if(!r)throw new Error("No printer selected");return Mt.reprintArchive(t,r)},onSuccess:()=>{i(),n()}}),d=s?.filter(f=>f.is_active)||[];return E.jsx("div",{className:"fixed inset-0 bg-black/70 flex items-center justify-center z-50 p-8",children:E.jsx(vi,{className:"w-full max-w-md",children:E.jsxs(Pi,{children:[E.jsxs("div",{className:"flex items-center justify-between mb-4",children:[E.jsx("h2",{className:"text-lg font-semibold text-white",children:"Re-print"}),E.jsx(At,{variant:"ghost",size:"sm",onClick:n,children:E.jsx(Ji,{className:"w-5 h-5"})})]}),E.jsxs("p",{className:"text-sm text-bambu-gray mb-4",children:["Send ",E.jsx("span",{className:"text-white",children:e})," to a printer"]}),l?E.jsx("div",{className:"flex justify-center py-8",children:E.jsx(pr,{className:"w-6 h-6 text-bambu-green animate-spin"})}):d.length===0?E.jsx("div",{className:"text-center py-8 text-bambu-gray",children:"No active printers available"}):E.jsx("div",{className:"space-y-2 mb-6",children:d.map(f=>E.jsxs("button",{onClick:()=>a(f.id),className:`w-full flex items-center gap-3 p-3 rounded-lg border transition-colors ${r===f.id?"border-bambu-green bg-bambu-green/10":"border-bambu-dark-tertiary bg-bambu-dark hover:border-bambu-gray"}`,children:[E.jsx("div",{className:`p-2 rounded-lg ${r===f.id?"bg-bambu-green/20":"bg-bambu-dark-tertiary"}`,children:E.jsx(xu,{className:`w-5 h-5 ${r===f.id?"text-bambu-green":"text-bambu-gray"}`})}),E.jsxs("div",{className:"text-left",children:[E.jsx("p",{className:"text-white font-medium",children:f.name}),E.jsxs("p",{className:"text-xs text-bambu-gray",children:[f.model||"Unknown model"," • ",f.ip_address]})]})]},f.id))}),c.isError&&E.jsx("div",{className:"mb-4 p-3 bg-red-500/20 border border-red-500/50 rounded-lg text-sm text-red-400",children:c.error.message||"Failed to start print"}),E.jsxs("div",{className:"flex gap-3",children:[E.jsx(At,{variant:"secondary",onClick:n,className:"flex-1",children:"Cancel"}),E.jsx(At,{onClick:()=>c.mutate(),disabled:!r||c.isPending,className:"flex-1",children:c.isPending?E.jsxs(E.Fragment,{children:[E.jsx(pr,{className:"w-4 h-4 animate-spin"}),"Sending..."]}):E.jsxs(E.Fragment,{children:[E.jsx(xu,{className:"w-4 h-4"}),"Print"]})})]})]})})})}function wle({onClose:t,initialFiles:e}){const n=wa(),{showToast:i}=Lu(),r=T.useRef(null),[a,s]=T.useState(()=>e?.filter(C=>C.name.endsWith(".3mf")).map(C=>({file:C,status:"pending"}))||[]),[l,c]=T.useState(!1),[d,f]=T.useState(),[h,g]=T.useState(null),{data:m}=Ki({queryKey:["printers"],queryFn:Mt.getPrinters}),b=Qi({mutationFn:C=>Mt.uploadArchivesBulk(C,d),onSuccess:C=>{g(C),n.invalidateQueries({queryKey:["archives"]}),n.invalidateQueries({queryKey:["archiveStats"]}),s(F=>F.map(P=>{const L=C.results.find(U=>U.filename===P.file.name),B=C.errors.find(U=>U.filename===P.file.name);return L?{...P,status:"success",archiveId:L.id}:B?{...P,status:"error",error:B.error}:P})),C.failed===0?i(`${C.uploaded} file${C.uploaded!==1?"s":""} uploaded`):C.uploaded===0?i(`Failed to upload ${C.failed} file${C.failed!==1?"s":""}`,"error"):i(`${C.uploaded} uploaded, ${C.failed} failed`,"warning")},onError:()=>{s(C=>C.map(F=>({...F,status:"error",error:"Upload failed"}))),i("Upload failed","error")}}),y=T.useCallback(C=>{C.preventDefault(),c(!0)},[]),x=T.useCallback(C=>{C.preventDefault(),c(!1)},[]),v=T.useCallback(C=>{C.preventDefault(),c(!1);const F=Array.from(C.dataTransfer.files).filter(P=>P.name.endsWith(".3mf"));F.length>0&&s(P=>[...P,...F.map(L=>({file:L,status:"pending"}))])},[]),w=T.useCallback(C=>{const F=Array.from(C.target.files||[]).filter(P=>P.name.endsWith(".3mf"));F.length>0&&s(P=>[...P,...F.map(L=>({file:L,status:"pending"}))]),r.current&&(r.current.value="")},[]),S=T.useCallback(C=>{s(F=>F.filter((P,L)=>L!==C))},[]),A=()=>{if(a.length===0)return;const C=a.filter(F=>F.status==="pending");C.length!==0&&(s(F=>F.map(P=>P.status==="pending"?{...P,status:"uploading"}:P)),b.mutate(C.map(F=>F.file)))},R=a.filter(C=>C.status==="pending").length,N=b.isPending;return E.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4",children:E.jsx(vi,{className:"w-full max-w-2xl max-h-[90vh] flex flex-col",children:E.jsxs(Pi,{className:"p-0 flex flex-col h-full",children:[E.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-bambu-dark-tertiary",children:[E.jsx("h2",{className:"text-xl font-semibold text-white",children:"Upload 3MF Files"}),E.jsx("button",{onClick:t,className:"text-bambu-gray hover:text-white transition-colors",children:E.jsx(Ji,{className:"w-5 h-5"})})]}),E.jsx("div",{className:"p-4",children:E.jsxs("div",{className:`border-2 border-dashed rounded-lg p-8 text-center transition-colors ${l?"border-bambu-green bg-bambu-green/10":"border-bambu-dark-tertiary hover:border-bambu-gray"}`,onDragOver:y,onDragLeave:x,onDrop:v,children:[E.jsx(Qv,{className:"w-12 h-12 mx-auto mb-4 text-bambu-gray"}),E.jsx("p",{className:"text-white mb-2",children:"Drag & drop .3mf files here"}),E.jsx("p",{className:"text-bambu-gray text-sm mb-4",children:"or"}),E.jsx(At,{variant:"secondary",onClick:()=>r.current?.click(),disabled:N,children:"Browse Files"}),E.jsx("input",{ref:r,type:"file",accept:".3mf",multiple:!0,className:"hidden",onChange:w})]})}),E.jsxs("div",{className:"px-4 pb-4",children:[E.jsx("label",{className:"block text-sm text-bambu-gray mb-2",children:"Associate with printer (optional)"}),E.jsxs("select",{className:"w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none",value:d||"",onChange:C=>f(C.target.value?Number(C.target.value):void 0),disabled:N,children:[E.jsx("option",{value:"",children:"No printer"}),m?.map(C=>E.jsx("option",{value:C.id,children:C.name},C.id))]})]}),a.length>0&&E.jsx("div",{className:"px-4 pb-4 max-h-60 overflow-y-auto",children:E.jsx("div",{className:"space-y-2",children:a.map((C,F)=>E.jsxs("div",{className:"flex items-center gap-3 p-3 bg-bambu-dark rounded-lg",children:[E.jsx(Dz,{className:"w-5 h-5 text-bambu-gray flex-shrink-0"}),E.jsx("span",{className:"flex-1 text-white text-sm truncate",children:C.file.name}),E.jsxs("span",{className:"text-xs text-bambu-gray",children:[(C.file.size/(1024*1024)).toFixed(1)," MB"]}),C.status==="pending"&&E.jsx("button",{onClick:()=>S(F),className:"text-bambu-gray hover:text-red-400 transition-colors",disabled:N,children:E.jsx(Ji,{className:"w-4 h-4"})}),C.status==="uploading"&&E.jsx(pr,{className:"w-4 h-4 text-bambu-green animate-spin"}),C.status==="success"&&E.jsx(fT,{className:"w-4 h-4 text-bambu-green"}),C.status==="error"&&E.jsxs("div",{className:"flex items-center gap-2",children:[E.jsx("span",{className:"text-xs text-red-400",children:C.error}),E.jsx(dT,{className:"w-4 h-4 text-red-400"})]})]},`${C.file.name}-${F}`))})}),h&&E.jsx("div",{className:"px-4 pb-4",children:E.jsx("div",{className:"p-3 bg-bambu-dark rounded-lg",children:E.jsxs("p",{className:"text-sm text-white",children:[E.jsx("span",{className:"text-bambu-green",children:h.uploaded})," uploaded",h.failed>0&&E.jsxs(E.Fragment,{children:[", ",E.jsx("span",{className:"text-red-400",children:h.failed})," failed"]})]})})}),E.jsxs("div",{className:"flex gap-3 p-4 border-t border-bambu-dark-tertiary",children:[E.jsx(At,{variant:"secondary",onClick:t,className:"flex-1",children:h?"Close":"Cancel"}),!h&&E.jsx(At,{onClick:A,disabled:R===0||N,className:"flex-1",children:N?E.jsxs(E.Fragment,{children:[E.jsx(pr,{className:"w-4 h-4 animate-spin"}),"Uploading..."]}):E.jsxs(E.Fragment,{children:[E.jsx(Qv,{className:"w-4 h-4"}),"Upload ",R>0&&`(${R})`]})})]})]})})})}const Ele=["Adhesion failure","Spaghetti / Detached","Layer shift","Clogged nozzle","Filament runout","Warping","Stringing","Under-extrusion","Power failure","User cancelled","Other"];function Mle({archive:t,onClose:e,existingTags:n=[]}){T.useEffect(()=>{const Y=J=>{J.key==="Escape"&&e()};return window.addEventListener("keydown",Y),()=>window.removeEventListener("keydown",Y)},[e]);const i=wa(),[r,a]=T.useState(t.print_name||""),[s,l]=T.useState(t.printer_id),[c,d]=T.useState(t.notes||""),[f,h]=T.useState(t.tags||""),[g,m]=T.useState(t.failure_reason||""),[b,y]=T.useState(t.photos||[]),[x,v]=T.useState(!1),[w,S]=T.useState(!1),A=T.useRef(null),R=T.useRef(null),N=T.useRef(null),{data:C}=Ki({queryKey:["printers"],queryFn:Mt.getPrinters}),{data:F}=Ki({queryKey:["archives"],queryFn:()=>Mt.getArchives(void 0,1e3,0),enabled:n.length===0}),P=n.length>0?n:[...new Set(F?.flatMap(Y=>Y.tags?.split(",").map(J=>J.trim())||[]).filter(Boolean)||[])].sort(),L=f.split(",").map(Y=>Y.trim()).filter(Boolean),B=P.filter(Y=>!L.includes(Y)),U=Y=>{if(!L.includes(Y)){const J=[...L,Y].join(", ");h(J)}N.current!==null&&clearTimeout(N.current),A.current?.focus()},$=Y=>{const J=L.filter(se=>se!==Y).join(", ");h(J)},I=Qi({mutationFn:Y=>Mt.updateArchive(t.id,Y),onSuccess:()=>{i.invalidateQueries({queryKey:["archives"]}),e()}}),W=async Y=>{const J=Y.target.files?.[0];if(J){v(!0);try{const se=await Mt.uploadArchivePhoto(t.id,J);y(se.photos),i.invalidateQueries({queryKey:["archives"]})}catch(se){console.error("Failed to upload photo:",se)}finally{v(!1),R.current&&(R.current.value="")}}},X=async Y=>{try{const J=await Mt.deleteArchivePhoto(t.id,Y);y(J.photos||[]),i.invalidateQueries({queryKey:["archives"]})}catch(J){console.error("Failed to delete photo:",J)}},V=Y=>{Y.preventDefault(),I.mutate({print_name:r||void 0,printer_id:s,notes:c||void 0,tags:f||void 0,failure_reason:t.status==="failed"&&g||void 0})};return E.jsx("div",{className:"fixed inset-0 bg-black/70 flex items-center justify-center z-50 p-4",onClick:e,children:E.jsxs("div",{className:"bg-bambu-dark-secondary rounded-xl border border-bambu-dark-tertiary w-full max-w-md max-h-[90vh] flex flex-col",onClick:Y=>Y.stopPropagation(),children:[E.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-bambu-dark-tertiary",children:[E.jsx("h2",{className:"text-lg font-semibold text-white",children:"Edit Archive"}),E.jsx("button",{onClick:e,className:"text-bambu-gray hover:text-white transition-colors",children:E.jsx(Ji,{className:"w-5 h-5"})})]}),E.jsxs("form",{onSubmit:V,className:"p-6 space-y-4 overflow-y-auto flex-1",children:[E.jsxs("div",{children:[E.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:"Name"}),E.jsx("input",{type:"text",value:r,onChange:Y=>a(Y.target.value),className:"w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none",placeholder:"Print name"})]}),E.jsxs("div",{children:[E.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:"Printer"}),E.jsxs("select",{value:s??"",onChange:Y=>l(Y.target.value?Number(Y.target.value):null),className:"w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none",children:[E.jsx("option",{value:"",children:"No printer"}),C?.map(Y=>E.jsx("option",{value:Y.id,children:Y.name},Y.id))]})]}),E.jsxs("div",{children:[E.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:"Notes"}),E.jsx("textarea",{value:c,onChange:Y=>d(Y.target.value),rows:3,className:"w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none resize-none",placeholder:"Add notes about this print..."})]}),E.jsxs("div",{children:[E.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:"Tags"}),L.length>0&&E.jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:L.map(Y=>E.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 bg-bambu-dark-tertiary rounded text-sm text-white",children:[E.jsx(Fp,{className:"w-3 h-3"}),Y,E.jsx("button",{type:"button",onClick:()=>$(Y),className:"ml-0.5 text-bambu-gray hover:text-white",children:E.jsx(Ji,{className:"w-3 h-3"})})]},Y))}),E.jsxs("div",{className:"relative",children:[E.jsx("input",{ref:A,type:"text",value:f,onChange:Y=>h(Y.target.value),onFocus:()=>{N.current!==null&&clearTimeout(N.current),S(!0)},onBlur:()=>{N.current=window.setTimeout(()=>S(!1),200)},className:"w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none",placeholder:L.length>0?"Add more tags...":"Add tags..."}),w&&B.length>0&&E.jsxs("div",{className:"absolute top-full left-0 right-0 mt-1 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg shadow-lg z-10 max-h-40 overflow-y-auto",children:[E.jsx("div",{className:"p-2 text-xs text-bambu-gray border-b border-bambu-dark-tertiary",children:"Existing tags (click to add)"}),E.jsx("div",{className:"p-2 flex flex-wrap gap-1.5",children:B.map(Y=>E.jsx("button",{type:"button",onClick:()=>U(Y),className:"px-2 py-0.5 bg-bambu-dark-tertiary hover:bg-bambu-green/20 rounded text-sm text-bambu-gray hover:text-white transition-colors",children:Y},Y))})]})]})]}),t.status==="failed"&&E.jsxs("div",{children:[E.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:"Failure Reason"}),E.jsxs("select",{value:g,onChange:Y=>m(Y.target.value),className:"w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none",children:[E.jsx("option",{value:"",children:"Select reason..."}),Ele.map(Y=>E.jsx("option",{value:Y,children:Y},Y))]})]}),E.jsxs("div",{children:[E.jsxs("label",{className:"block text-sm text-bambu-gray mb-1",children:[E.jsx(HE,{className:"w-4 h-4 inline mr-1"}),"Photos of Printed Result"]}),E.jsxs("div",{className:"flex flex-wrap gap-2 mb-2",children:[b.map(Y=>E.jsxs("div",{className:"relative group",children:[E.jsx("img",{src:Mt.getArchivePhotoUrl(t.id,Y),alt:"Print result",className:"w-20 h-20 object-cover rounded-lg border border-bambu-dark-tertiary"}),E.jsx("button",{type:"button",onClick:()=>X(Y),className:"absolute -top-1 -right-1 p-1 bg-red-500 rounded-full opacity-0 group-hover:opacity-100 transition-opacity",children:E.jsx(yu,{className:"w-3 h-3 text-white"})})]},Y)),E.jsxs("label",{className:"w-20 h-20 flex items-center justify-center border-2 border-dashed border-bambu-dark-tertiary rounded-lg cursor-pointer hover:border-bambu-green transition-colors",children:[E.jsx("input",{ref:R,type:"file",accept:"image/jpeg,image/png,image/webp",onChange:W,className:"hidden",disabled:x}),x?E.jsx(pr,{className:"w-6 h-6 text-bambu-gray animate-spin"}):E.jsx(Kv,{className:"w-6 h-6 text-bambu-gray"})]})]}),E.jsx("p",{className:"text-xs text-bambu-gray",children:"Click + to add photos of your printed result"})]}),E.jsxs("div",{className:"flex gap-3 pt-2",children:[E.jsx(At,{type:"button",variant:"secondary",onClick:e,className:"flex-1",children:"Cancel"}),E.jsxs(At,{type:"submit",disabled:I.isPending,className:"flex-1",children:[E.jsx(Iz,{className:"w-4 h-4"}),I.isPending?"Saving...":"Save"]})]})]})]})})}function Ale({x:t,y:e,items:n,onClose:i}){const r=T.useRef(null);return T.useEffect(()=>{const a=c=>{r.current&&!r.current.contains(c.target)&&i()},s=c=>{c.key==="Escape"&&i()},l=()=>{i()};return document.addEventListener("mousedown",a),document.addEventListener("keydown",s),document.addEventListener("scroll",l,!0),()=>{document.removeEventListener("mousedown",a),document.removeEventListener("keydown",s),document.removeEventListener("scroll",l,!0)}},[i]),T.useEffect(()=>{if(r.current){const a=r.current.getBoundingClientRect(),s=window.innerWidth,l=window.innerHeight;let c=t,d=e;t+a.width>s&&(c=s-a.width-8),e+a.height>l&&(d=l-a.height-8),r.current.style.left=`${c}px`,r.current.style.top=`${d}px`}},[t,e]),E.jsx("div",{ref:r,className:"fixed z-50 min-w-[160px] bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg shadow-xl py-1 overflow-hidden",style:{left:t,top:e},children:n.map((a,s)=>a.divider?E.jsx("div",{className:"my-1 border-t border-bambu-dark-tertiary"},s):E.jsxs("button",{onClick:()=>{a.disabled||(a.onClick(),i())},disabled:a.disabled,className:`w-full flex items-center gap-2 px-3 py-2 text-sm text-left transition-colors ${a.disabled?"text-bambu-gray cursor-not-allowed":a.danger?"text-red-400 hover:bg-red-400/10":"text-white hover:bg-bambu-dark-tertiary"}`,children:[a.icon&&E.jsx("span",{className:"w-4 h-4 flex-shrink-0",children:a.icon}),a.label]},s))})}function Tle({selectedIds:t,existingTags:e,onClose:n}){const i=wa(),{showToast:r}=Lu(),[a,s]=T.useState(""),[l,c]=T.useState(new Set),[d,f]=T.useState("add"),h=Qi({mutationFn:async()=>{const y=Array.from(l);return await Promise.all(t.map(async x=>{const v=await Mt.getArchive(x),w=v.tags?v.tags.split(",").map(A=>A.trim()).filter(Boolean):[];let S;return d==="add"?S=[...new Set([...w,...y])]:S=w.filter(A=>!l.has(A)),Mt.updateArchive(x,{tags:S.join(", ")})})),{count:t.length,mode:d,tags:y}},onSuccess:({count:y,mode:x,tags:v})=>{i.invalidateQueries({queryKey:["archives"]}),r(`${x==="add"?"Added":"Removed"} ${v.length} tag${v.length!==1?"s":""} ${x==="add"?"to":"from"} ${y} archive${y!==1?"s":""}`),n()},onError:()=>{r("Failed to update tags","error")}}),g=y=>{c(x=>{const v=new Set(x);return v.has(y)?v.delete(y):v.add(y),v})},m=()=>{a.trim()&&!l.has(a.trim())&&(c(y=>new Set([...y,a.trim()])),s(""))},b=y=>{y.key==="Enter"&&(y.preventDefault(),m())};return E.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4",children:E.jsx(vi,{className:"w-full max-w-md",children:E.jsxs(Pi,{className:"p-0",children:[E.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-bambu-dark-tertiary",children:[E.jsxs("div",{className:"flex items-center gap-2",children:[E.jsx(Fp,{className:"w-5 h-5 text-bambu-green"}),E.jsx("h2",{className:"text-xl font-semibold text-white",children:d==="add"?"Add Tags":"Remove Tags"})]}),E.jsx("button",{onClick:n,className:"text-bambu-gray hover:text-white transition-colors",children:E.jsx(Ji,{className:"w-5 h-5"})})]}),E.jsxs("div",{className:"p-4 space-y-4",children:[E.jsxs("p",{className:"text-sm text-bambu-gray",children:[d==="add"?"Add":"Remove"," tags for ",t.length," selected archive",t.length!==1?"s":""]}),E.jsxs("div",{className:"flex gap-2",children:[E.jsx(At,{size:"sm",variant:d==="add"?"primary":"secondary",onClick:()=>f("add"),children:"Add Tags"}),E.jsx(At,{size:"sm",variant:d==="remove"?"primary":"secondary",onClick:()=>f("remove"),children:"Remove Tags"})]}),d==="add"&&E.jsxs("div",{className:"flex gap-2",children:[E.jsx("input",{type:"text",placeholder:"Enter new tag...",className:"flex-1 px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-sm focus:border-bambu-green focus:outline-none",value:a,onChange:y=>s(y.target.value),onKeyDown:b}),E.jsx(At,{size:"sm",variant:"secondary",onClick:m,disabled:!a.trim(),children:E.jsx(Kv,{className:"w-4 h-4"})})]}),e.length>0&&E.jsxs("div",{children:[E.jsx("p",{className:"text-xs text-bambu-gray mb-2",children:"Existing tags:"}),E.jsx("div",{className:"flex flex-wrap gap-2",children:e.map(y=>E.jsx("button",{onClick:()=>g(y),className:`px-2 py-1 rounded text-sm transition-colors ${l.has(y)?"bg-bambu-green text-white":"bg-bambu-dark-tertiary text-bambu-gray-light hover:bg-bambu-dark"}`,children:y},y))})]}),l.size>0&&E.jsxs("div",{children:[E.jsxs("p",{className:"text-xs text-bambu-gray mb-2",children:["Tags to ",d==="add"?"add":"remove",":"]}),E.jsx("div",{className:"flex flex-wrap gap-2",children:Array.from(l).map(y=>E.jsxs("span",{className:`px-2 py-1 rounded text-sm flex items-center gap-1 ${d==="add"?"bg-green-500/20 text-green-400":"bg-red-500/20 text-red-400"}`,children:[y,E.jsx("button",{onClick:()=>g(y),className:"hover:opacity-70",children:E.jsx(Ji,{className:"w-3 h-3"})})]},y))})]})]}),E.jsxs("div",{className:"flex gap-3 p-4 border-t border-bambu-dark-tertiary",children:[E.jsx(At,{variant:"secondary",onClick:n,className:"flex-1",children:"Cancel"}),E.jsx(At,{onClick:()=>h.mutate(),disabled:l.size===0||h.isPending,className:"flex-1",children:h.isPending?E.jsxs(E.Fragment,{children:[E.jsx(pr,{className:"w-4 h-4 animate-spin"}),"Processing..."]}):E.jsxs(E.Fragment,{children:[E.jsx(Fp,{className:"w-4 h-4"}),d==="add"?"Add Tags":"Remove Tags"]})})]})]})})})}function Cle(t,e){return new Date(t,e+1,0).getDate()}function Rle(t,e){return new Date(t,e,1).getDay()}const Ple=["January","February","March","April","May","June","July","August","September","October","November","December"],Dle=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];function Nle({archives:t,onArchiveClick:e}){const n=new Date,[i,r]=T.useState(n.getMonth()),[a,s]=T.useState(n.getFullYear()),[l,c]=T.useState(null),d=T.useMemo(()=>{const v=new Map;return t.forEach(w=>{const S=new Date(w.completed_at||w.created_at),A=`${S.getFullYear()}-${String(S.getMonth()+1).padStart(2,"0")}-${String(S.getDate()).padStart(2,"0")}`,R=v.get(A)||[];R.push(w),v.set(A,R)}),v},[t]),f=Cle(a,i),h=Rle(a,i),g=()=>{i===0?(r(11),s(a-1)):r(i-1)},m=()=>{i===11?(r(0),s(a+1)):r(i+1)},b=()=>{r(n.getMonth()),s(n.getFullYear())},y=[];for(let v=0;v<h;v++)y.push(null);for(let v=1;v<=f;v++)y.push(v);const x=l?d.get(l)||[]:[];return E.jsxs("div",{className:"flex flex-col lg:flex-row gap-6",children:[E.jsxs("div",{className:"flex-1",children:[E.jsxs("div",{className:"flex items-center justify-between mb-4",children:[E.jsx("button",{onClick:g,className:"p-2 hover:bg-bambu-dark-tertiary rounded-lg transition-colors",children:E.jsx(gf,{className:"w-5 h-5 text-bambu-gray"})}),E.jsxs("div",{className:"flex items-center gap-3",children:[E.jsxs("h2",{className:"text-lg font-semibold text-white",children:[Ple[i]," ",a]}),E.jsx("button",{onClick:b,className:"px-2 py-1 text-xs bg-bambu-dark-tertiary hover:bg-bambu-green/20 text-bambu-gray hover:text-white rounded transition-colors",children:"Today"})]}),E.jsx("button",{onClick:m,className:"p-2 hover:bg-bambu-dark-tertiary rounded-lg transition-colors",children:E.jsx(vm,{className:"w-5 h-5 text-bambu-gray"})})]}),E.jsx("div",{className:"grid grid-cols-7 gap-1 mb-1",children:Dle.map(v=>E.jsx("div",{className:"text-center text-xs text-bambu-gray py-2",children:v},v))}),E.jsx("div",{className:"grid grid-cols-7 gap-1",children:y.map((v,w)=>{if(v===null)return E.jsx("div",{className:"aspect-square"},`empty-${w}`);const S=`${a}-${String(i+1).padStart(2,"0")}-${String(v).padStart(2,"0")}`,A=d.get(S)||[],R=A.length>0,N=v===n.getDate()&&i===n.getMonth()&&a===n.getFullYear(),C=S===l,F=A.filter(L=>L.status==="completed").length,P=A.filter(L=>L.status==="failed").length;return E.jsxs("button",{onClick:()=>c(C?null:S),className:`aspect-square rounded-lg p-1 flex flex-col items-center justify-center transition-colors relative ${C?"bg-bambu-green text-white":N?"bg-bambu-green/20 text-white ring-2 ring-bambu-green":R?"bg-bambu-dark-tertiary hover:bg-bambu-dark-tertiary/70 text-white":"hover:bg-bambu-dark-tertiary/50 text-bambu-gray"}`,children:[E.jsx("span",{className:`text-sm font-medium ${N&&!C?"text-bambu-green":""}`,children:v}),R&&E.jsxs("div",{className:"absolute bottom-1 left-1/2 -translate-x-1/2 flex items-center gap-1",children:[E.jsx("div",{className:`w-2 h-2 rounded-full ${P>0&&F===0?"bg-red-400":P>0?"bg-yellow-400":"bg-green-400"}`}),E.jsx("span",{className:"text-xs font-medium",children:A.length})]})]},v)})}),E.jsx("div",{className:"mt-4 pt-4 border-t border-bambu-dark-tertiary",children:E.jsxs("div",{className:"grid grid-cols-3 gap-4 text-center",children:[E.jsxs("div",{children:[E.jsx("div",{className:"text-2xl font-bold text-white",children:t.filter(v=>{const w=new Date(v.completed_at||v.created_at);return w.getMonth()===i&&w.getFullYear()===a}).length}),E.jsx("div",{className:"text-xs text-bambu-gray",children:"Prints this month"})]}),E.jsxs("div",{children:[E.jsx("div",{className:"text-2xl font-bold text-green-400",children:t.filter(v=>{const w=new Date(v.completed_at||v.created_at);return w.getMonth()===i&&w.getFullYear()===a&&v.status==="completed"}).length}),E.jsx("div",{className:"text-xs text-bambu-gray",children:"Successful"})]}),E.jsxs("div",{children:[E.jsx("div",{className:"text-2xl font-bold text-red-400",children:t.filter(v=>{const w=new Date(v.completed_at||v.created_at);return w.getMonth()===i&&w.getFullYear()===a&&v.status==="failed"}).length}),E.jsx("div",{className:"text-xs text-bambu-gray",children:"Failed"})]})]})})]}),E.jsx("div",{className:"lg:w-80 bg-bambu-dark rounded-xl p-4",children:l?E.jsxs(E.Fragment,{children:[E.jsx("h3",{className:"text-sm font-medium text-bambu-gray mb-3",children:new Date(l+"T12:00:00").toLocaleDateString("en-US",{weekday:"long",month:"long",day:"numeric",year:"numeric"})}),x.length>0?E.jsx("div",{className:"space-y-2 max-h-96 overflow-y-auto",children:x.map(v=>E.jsxs("button",{onClick:()=>e?.(v),className:"w-full flex items-center gap-3 p-2 rounded-lg hover:bg-bambu-dark-tertiary transition-colors text-left",children:[v.thumbnail_path?E.jsx("img",{src:Mt.getArchiveThumbnail(v.id),alt:"",className:"w-12 h-12 rounded object-cover"}):E.jsx("div",{className:"w-12 h-12 rounded bg-bambu-dark-tertiary flex items-center justify-center",children:E.jsx("span",{className:"text-xs text-bambu-gray",children:"3MF"})}),E.jsxs("div",{className:"flex-1 min-w-0",children:[E.jsx("p",{className:"text-sm text-white truncate",children:v.print_name||v.filename}),E.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[E.jsx("span",{className:v.status==="failed"?"text-red-400":"text-green-400",children:v.status==="failed"?"Failed":"Completed"}),v.filament_color&&E.jsx("div",{className:"flex gap-0.5",children:v.filament_color.split(",").map((w,S)=>E.jsx("div",{className:"w-3 h-3 rounded-full border border-white/20",style:{backgroundColor:w}},S))})]})]})]},v.id))}):E.jsx("p",{className:"text-sm text-bambu-gray",children:"No prints on this day"})]}):E.jsx("div",{className:"text-center py-8",children:E.jsx("p",{className:"text-sm text-bambu-gray",children:"Select a day to see prints"})})})]})}function Ole({archiveId:t,archiveName:e,onClose:n}){const i=Mt.getArchiveQRCodeUrl(t,300),r=()=>{const a=document.createElement("a");a.href=i,a.download=`${e}_qrcode.png`,a.click()};return E.jsx("div",{className:"fixed inset-0 bg-black/70 flex items-center justify-center z-50 p-4",onClick:n,children:E.jsxs("div",{className:"bg-bambu-dark-secondary rounded-xl border border-bambu-dark-tertiary w-full max-w-sm",onClick:a=>a.stopPropagation(),children:[E.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-bambu-dark-tertiary",children:[E.jsx("h2",{className:"text-lg font-semibold text-white",children:"QR Code"}),E.jsx("button",{onClick:n,className:"text-bambu-gray hover:text-white transition-colors",children:E.jsx(Ji,{className:"w-5 h-5"})})]}),E.jsxs("div",{className:"p-6 flex flex-col items-center",children:[E.jsx("p",{className:"text-sm text-bambu-gray mb-4 text-center truncate max-w-full",children:e}),E.jsx("div",{className:"bg-white p-4 rounded-lg mb-4",children:E.jsx("img",{src:i,alt:"QR Code",className:"w-64 h-64"})}),E.jsx("p",{className:"text-xs text-bambu-gray mb-4 text-center",children:"Scan to open this archive"}),E.jsxs(At,{onClick:r,className:"w-full",children:[E.jsx(ou,{className:"w-4 h-4"}),"Download QR Code"]})]})]})})}function Lle({archiveId:t,archiveName:e,photos:n,onClose:i,onDelete:r}){const[a,s]=T.useState(0),[l,c]=T.useState(!1);if(T.useEffect(()=>{const m=b=>{b.key==="Escape"&&i(),b.key==="ArrowLeft"&&s(y=>Math.max(0,y-1)),b.key==="ArrowRight"&&s(y=>Math.min(n.length-1,y+1))};return window.addEventListener("keydown",m),()=>window.removeEventListener("keydown",m)},[i,n.length]),T.useEffect(()=>{a>=n.length&&s(Math.max(0,n.length-1))},[n.length,a]),n.length===0)return i(),null;const d=n[a],f=Mt.getArchivePhotoUrl(t,d),h=()=>{const m=document.createElement("a");m.href=f,m.download=`${e}_photo_${a+1}.jpg`,m.click()},g=()=>{r&&c(!0)};return E.jsxs("div",{className:"fixed inset-0 bg-black/90 flex items-center justify-center z-50",onClick:i,children:[E.jsxs("div",{className:"relative w-full h-full flex flex-col",onClick:m=>m.stopPropagation(),children:[E.jsxs("div",{className:"flex items-center justify-between px-6 py-4 bg-black/50",children:[E.jsxs("div",{children:[E.jsx("h2",{className:"text-lg font-semibold text-white",children:e}),E.jsxs("p",{className:"text-sm text-bambu-gray",children:["Photo ",a+1," of ",n.length]})]}),E.jsxs("div",{className:"flex items-center gap-2",children:[E.jsxs(At,{variant:"secondary",size:"sm",onClick:h,children:[E.jsx(ou,{className:"w-4 h-4"}),"Download"]}),r&&E.jsx(At,{variant:"secondary",size:"sm",onClick:g,className:"text-red-400 hover:text-red-300",children:E.jsx(yu,{className:"w-4 h-4"})}),E.jsx("button",{onClick:i,className:"p-2 text-bambu-gray hover:text-white transition-colors",children:E.jsx(Ji,{className:"w-6 h-6"})})]})]}),E.jsxs("div",{className:"flex-1 min-h-0 flex items-center justify-center p-4 relative overflow-hidden",children:[a>0&&E.jsx("button",{onClick:()=>s(m=>m-1),className:"absolute left-4 z-10 p-3 bg-black/50 hover:bg-black/70 rounded-full transition-colors",children:E.jsx(gf,{className:"w-8 h-8 text-white"})}),E.jsx("img",{src:f,alt:`Photo ${a+1}`,className:"max-w-full max-h-full object-contain rounded-lg",style:{maxHeight:"calc(100vh - 200px)"}}),a<n.length-1&&E.jsx("button",{onClick:()=>s(m=>m+1),className:"absolute right-4 z-10 p-3 bg-black/50 hover:bg-black/70 rounded-full transition-colors",children:E.jsx(vm,{className:"w-8 h-8 text-white"})})]}),n.length>1&&E.jsx("div",{className:"flex justify-center gap-2 p-4 bg-black/50",children:n.map((m,b)=>E.jsx("button",{onClick:()=>s(b),className:`w-16 h-16 rounded-lg overflow-hidden border-2 transition-colors ${b===a?"border-bambu-green":"border-transparent hover:border-bambu-gray"}`,children:E.jsx("img",{src:Mt.getArchivePhotoUrl(t,m),alt:`Thumbnail ${b+1}`,className:"w-full h-full object-cover"})},m))})]}),l&&E.jsx(zf,{title:"Delete Photo",message:"Delete this photo? This cannot be undone.",confirmText:"Delete",variant:"danger",onConfirm:()=>{r?.(d),c(!1)},onCancel:()=>c(!1)})]})}function a5(t){return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/(1024*1024)).toFixed(1)} MB`}function Ile(t){const e=Math.floor(t/3600),n=Math.floor(t%3600/60);return e>0?`${e}h ${n}m`:`${n}m`}function Ule(t){return new Date(t).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}function kle({archive:t,printerName:e,isSelected:n,onSelect:i,selectionMode:r}){const a=wa(),{showToast:s}=Lu(),[l,c]=T.useState(!1),[d,f]=T.useState(!1),[h,g]=T.useState(!1),[m,b]=T.useState(!1),[y,x]=T.useState(!1),[v,w]=T.useState(!1),[S,A]=T.useState(!1),[R,N]=T.useState(null),C=Qi({mutationFn:()=>Mt.scanArchiveTimelapse(t.id),onSuccess:U=>{U.status==="attached"?(a.invalidateQueries({queryKey:["archives"]}),s(`Timelapse attached: ${U.filename}`)):U.status==="exists"?s("Timelapse already attached"):s(U.message||"No matching timelapse found","warning")},onError:U=>{s(U.message||"Failed to scan for timelapse","error")}}),F=Qi({mutationFn:()=>Mt.deleteArchive(t.id),onSuccess:()=>{a.invalidateQueries({queryKey:["archives"]}),s("Archive deleted")},onError:()=>{s("Failed to delete archive","error")}}),P=Qi({mutationFn:()=>Mt.toggleFavorite(t.id),onSuccess:U=>{a.invalidateQueries({queryKey:["archives"]}),s(U.is_favorite?"Added to favorites":"Removed from favorites")}}),L=U=>{U.preventDefault(),N({x:U.clientX,y:U.clientY})},B=[{label:"Print",icon:E.jsx(xu,{className:"w-4 h-4"}),onClick:()=>f(!0)},{label:"Open in Bambu Studio",icon:E.jsx(qv,{className:"w-4 h-4"}),onClick:()=>{const U=t.print_name||t.filename||"model",$=`${window.location.origin}${Mt.getArchiveForSlicer(t.id,U)}`;window.location.href=`bambustudioopen://${encodeURIComponent($)}`}},{label:"View on MakerWorld",icon:E.jsx(GE,{className:"w-4 h-4"}),onClick:()=>t.makerworld_url&&window.open(t.makerworld_url,"_blank"),disabled:!t.makerworld_url},{label:"",divider:!0,onClick:()=>{}},{label:"3D Preview",icon:E.jsx(Up,{className:"w-4 h-4"}),onClick:()=>c(!0)},{label:"View Timelapse",icon:E.jsx(Ep,{className:"w-4 h-4"}),onClick:()=>x(!0),disabled:!t.timelapse_path},{label:"Scan for Timelapse",icon:E.jsx(BX,{className:"w-4 h-4"}),onClick:()=>C.mutate(),disabled:!t.printer_id||!!t.timelapse_path||C.isPending},{label:"Download",icon:E.jsx(ou,{className:"w-4 h-4"}),onClick:()=>{const U=document.createElement("a");U.href=Mt.getArchiveDownload(t.id),U.download=`${t.print_name||t.filename}.3mf`,U.click()}},{label:"Copy Download Link",icon:E.jsx(DW,{className:"w-4 h-4"}),onClick:()=>{const U=`${window.location.origin}${Mt.getArchiveDownload(t.id)}`;navigator.clipboard.writeText(U).then(()=>{s("Link copied to clipboard")}).catch(()=>{s("Failed to copy link","error")})}},{label:"QR Code",icon:E.jsx(IX,{className:"w-4 h-4"}),onClick:()=>w(!0)},{label:`View Photos${t.photos?.length?` (${t.photos.length})`:""}`,icon:E.jsx(HE,{className:"w-4 h-4"}),onClick:()=>A(!0),disabled:!t.photos?.length},{label:"",divider:!0,onClick:()=>{}},{label:t.is_favorite?"Remove from Favorites":"Add to Favorites",icon:E.jsx(kp,{className:`w-4 h-4 ${t.is_favorite?"fill-yellow-400 text-yellow-400":""}`}),onClick:()=>P.mutate()},{label:"Edit",icon:E.jsx(dN,{className:"w-4 h-4"}),onClick:()=>b(!0)},{label:n?"Deselect":"Select",icon:n?E.jsx(Zv,{className:"w-4 h-4"}):E.jsx(VE,{className:"w-4 h-4"}),onClick:()=>i(t.id)},{label:"",divider:!0,onClick:()=>{}},{label:"Delete",icon:E.jsx(yu,{className:"w-4 h-4"}),onClick:()=>g(!0),danger:!0}];return E.jsxs(vi,{className:`relative flex flex-col ${n?"ring-2 ring-bambu-green":""}`,onContextMenu:L,children:[r&&E.jsx("button",{className:"absolute top-2 left-2 z-10 p-1 rounded bg-black/50 hover:bg-black/70 transition-colors",onClick:()=>i(t.id),children:n?E.jsx(Zv,{className:"w-5 h-5 text-bambu-green"}):E.jsx(VE,{className:"w-5 h-5 text-white"})}),E.jsxs("div",{className:"aspect-video bg-bambu-dark relative flex-shrink-0 overflow-hidden rounded-t-xl",children:[t.thumbnail_path?E.jsx("img",{src:Mt.getArchiveThumbnail(t.id),alt:t.print_name||t.filename,className:"w-full h-full object-cover"}):E.jsx("div",{className:"w-full h-full flex items-center justify-center",children:E.jsx(pT,{className:"w-12 h-12 text-bambu-dark-tertiary"})}),E.jsx("button",{className:"absolute top-2 right-2 p-1 rounded bg-black/50 hover:bg-black/70 transition-colors",onClick:U=>{U.stopPropagation(),P.mutate()},title:t.is_favorite?"Remove from favorites":"Add to favorites",children:E.jsx(kp,{className:`w-5 h-5 ${t.is_favorite?"text-yellow-400 fill-yellow-400":"text-white"}`})}),t.status==="failed"&&E.jsx("div",{className:"absolute top-2 left-12 px-2 py-1 rounded text-xs bg-red-500/80 text-white",children:"failed"}),t.timelapse_path&&E.jsx("button",{className:"absolute bottom-2 right-2 p-1.5 rounded bg-black/60 hover:bg-black/80 transition-colors",onClick:U=>{U.stopPropagation(),x(!0)},title:"View timelapse",children:E.jsx(Ep,{className:"w-4 h-4 text-bambu-green"})}),t.photos&&t.photos.length>0&&E.jsxs("button",{className:`absolute bottom-2 ${t.timelapse_path?"right-12":"right-2"} p-1.5 rounded bg-black/60 hover:bg-black/80 transition-colors`,onClick:U=>{U.stopPropagation(),A(!0)},title:`View ${t.photos.length} photo${t.photos.length>1?"s":""}`,children:[E.jsx(HE,{className:"w-4 h-4 text-blue-400"}),t.photos.length>1&&E.jsx("span",{className:"absolute -top-1 -right-1 w-4 h-4 bg-blue-500 rounded-full text-[10px] text-white flex items-center justify-center",children:t.photos.length})]})]}),E.jsxs(Pi,{className:"p-4 flex-1 flex flex-col",children:[E.jsx("h3",{className:"font-medium text-white mb-1 truncate",children:t.print_name||t.filename}),E.jsx("p",{className:"text-xs text-bambu-gray mb-3",children:e}),E.jsxs("div",{className:"grid grid-cols-2 gap-2 text-xs mb-4 min-h-[48px]",children:[t.print_time_seconds&&E.jsxs("div",{className:"flex items-center gap-1.5 text-bambu-gray",children:[E.jsx(dy,{className:"w-3 h-3"}),Ile(t.print_time_seconds)]}),t.filament_used_grams&&E.jsxs("div",{className:"flex items-center gap-1.5 text-bambu-gray",children:[E.jsx(Yv,{className:"w-3 h-3"}),t.filament_used_grams.toFixed(1),"g"]}),t.layer_height&&E.jsxs("div",{className:"flex items-center gap-1.5 text-bambu-gray",children:[E.jsx(Lz,{className:"w-3 h-3"}),t.layer_height,"mm"]}),t.filament_type&&E.jsxs("div",{className:"flex items-center gap-1.5 col-span-2",children:[E.jsx("span",{className:"text-bambu-gray text-xs",children:t.filament_type}),t.filament_color&&E.jsx("div",{className:"flex items-center gap-0.5 flex-wrap",children:t.filament_color.split(",").map((U,$)=>E.jsx("div",{className:"w-3 h-3 rounded-full border border-white/20",style:{backgroundColor:U},title:U},$))})]})]}),(t.tags||t.notes)&&E.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 mb-3",children:[t.notes&&E.jsx("div",{className:"flex items-center gap-1 px-1.5 py-0.5 bg-blue-500/20 text-blue-400 rounded text-xs",title:t.notes,children:E.jsx(KX,{className:"w-3 h-3"})}),t.tags?.split(",").map((U,$)=>E.jsx("span",{className:"px-1.5 py-0.5 bg-bambu-dark-tertiary text-bambu-gray-light rounded text-xs",children:U.trim()},$))]}),E.jsx("div",{className:"flex-1"}),E.jsxs("div",{className:"flex items-center justify-between text-xs text-bambu-gray border-t border-bambu-dark-tertiary pt-3",children:[E.jsx("span",{children:Ule(t.created_at)}),E.jsx("span",{children:a5(t.file_size)})]}),E.jsxs("div",{className:"flex gap-1 mt-3",children:[E.jsxs(At,{variant:"primary",size:"sm",className:"flex-1 min-w-0",onClick:()=>f(!0),children:[E.jsx(xu,{className:"w-3 h-3 flex-shrink-0"}),E.jsx("span",{className:"hidden sm:inline",children:"Print"})]}),E.jsx(At,{variant:"secondary",size:"sm",className:"min-w-0 p-1 sm:p-1.5",onClick:()=>{const U=t.print_name||t.filename||"model",$=`${window.location.origin}${Mt.getArchiveForSlicer(t.id,U)}`;window.location.href=`bambustudioopen://${encodeURIComponent($)}`},title:"Open in Bambu Studio",children:E.jsx(qv,{className:"w-3 h-3 sm:w-4 sm:h-4"})}),E.jsx(At,{variant:"secondary",size:"sm",className:"min-w-0 p-1 sm:p-1.5",onClick:()=>t.makerworld_url&&window.open(t.makerworld_url,"_blank"),disabled:!t.makerworld_url,title:t.makerworld_url?`MakerWorld: ${t.designer||"View project"}`:"Not from MakerWorld",children:E.jsx(GE,{className:`w-3 h-3 sm:w-4 sm:h-4 ${t.makerworld_url?"":"opacity-20"}`})}),E.jsx(At,{variant:"secondary",size:"sm",className:"min-w-0 p-1 sm:p-1.5",onClick:()=>c(!0),title:"3D Preview",children:E.jsx(Up,{className:"w-3 h-3 sm:w-4 sm:h-4"})}),E.jsx(At,{variant:"secondary",size:"sm",className:"min-w-0 p-1 sm:p-1.5",onClick:()=>{const U=document.createElement("a");U.href=Mt.getArchiveDownload(t.id),U.download=`${t.print_name||t.filename}.3mf`,U.click()},title:"Download",children:E.jsx(ou,{className:"w-3 h-3 sm:w-4 sm:h-4"})}),E.jsx(At,{variant:"ghost",size:"sm",className:"min-w-0 p-1 sm:p-1.5",onClick:()=>b(!0),title:"Edit",children:E.jsx(dN,{className:"w-3 h-3 sm:w-4 sm:h-4"})}),E.jsx(At,{variant:"ghost",size:"sm",className:"min-w-0 p-1 sm:p-1.5",onClick:()=>g(!0),title:"Delete",children:E.jsx(yu,{className:"w-3 h-3 sm:w-4 sm:h-4 text-red-400"})})]})]}),m&&E.jsx(Mle,{archive:t,onClose:()=>b(!1)}),l&&E.jsx(_le,{archiveId:t.id,title:t.print_name||t.filename,onClose:()=>c(!1)}),d&&E.jsx(Sle,{archiveId:t.id,archiveName:t.print_name||t.filename,onClose:()=>f(!1),onSuccess:()=>{}}),h&&E.jsx(zf,{title:"Delete Archive",message:`Are you sure you want to delete "${t.print_name||t.filename}"? This action cannot be undone.`,confirmText:"Delete",variant:"danger",onConfirm:()=>{F.mutate(),g(!1)},onCancel:()=>g(!1)}),R&&E.jsx(Ale,{x:R.x,y:R.y,items:B,onClose:()=>N(null)}),y&&t.timelapse_path&&E.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/80",children:E.jsxs("div",{className:"relative bg-bambu-dark-secondary rounded-xl max-w-4xl w-full mx-4 overflow-hidden",children:[E.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-bambu-dark-tertiary",children:[E.jsxs("h3",{className:"text-lg font-semibold text-white flex items-center gap-2",children:[E.jsx(Ep,{className:"w-5 h-5 text-bambu-green"}),t.print_name||t.filename," - Timelapse"]}),E.jsxs("div",{className:"flex items-center gap-2",children:[E.jsxs(At,{variant:"secondary",size:"sm",onClick:()=>{const U=document.createElement("a");U.href=Mt.getArchiveTimelapse(t.id),U.download=`${t.print_name||t.filename}_timelapse.mp4`,U.click()},children:[E.jsx(ou,{className:"w-4 h-4"}),"Download"]}),E.jsx("button",{onClick:()=>x(!1),className:"p-1 hover:bg-bambu-dark-tertiary rounded transition-colors",children:E.jsx(Ji,{className:"w-5 h-5 text-bambu-gray"})})]})]}),E.jsx("div",{className:"p-4",children:E.jsx("video",{src:Mt.getArchiveTimelapse(t.id),controls:!0,autoPlay:!0,className:"w-full rounded-lg"})})]})}),v&&E.jsx(Ole,{archiveId:t.id,archiveName:t.print_name||t.filename,onClose:()=>w(!1)}),S&&t.photos&&t.photos.length>0&&E.jsx(Lle,{archiveId:t.id,archiveName:t.print_name||t.filename,photos:t.photos,onClose:()=>A(!1),onDelete:async U=>{try{await Mt.deleteArchivePhoto(t.id,U),a.invalidateQueries({queryKey:["archives"]}),s("Photo deleted")}catch{s("Failed to delete photo","error")}}})]})}const Fle=[{id:"all",label:"All Archives",icon:E.jsx(QW,{className:"w-4 h-4"})},{id:"recent",label:"Last 24 Hours",icon:E.jsx(dy,{className:"w-4 h-4"})},{id:"this-week",label:"This Week",icon:E.jsx(lN,{className:"w-4 h-4"})},{id:"this-month",label:"This Month",icon:E.jsx(lN,{className:"w-4 h-4"})},{id:"favorites",label:"Favorites",icon:E.jsx(kp,{className:"w-4 h-4"})},{id:"failed",label:"Failed Prints",icon:E.jsx(dT,{className:"w-4 h-4"})}];function zle(){const t=wa(),{showToast:e}=Lu(),n=T.useRef(null),[i,r]=T.useState(""),[a,s]=T.useState(null),[l,c]=T.useState(null),[d,f]=T.useState(new Set),[h,g]=T.useState("or"),[m,b]=T.useState(!1),[y,x]=T.useState(null),[v,w]=T.useState(!1),[S,A]=T.useState([]),[R,N]=T.useState(!1),[C,F]=T.useState(new Set),[P,L]=T.useState(!1),[B,U]=T.useState(!1),[$,I]=T.useState("grid"),[W,X]=T.useState("date-desc"),[V,Y]=T.useState("all"),{data:J,isLoading:se}=Ki({queryKey:["archives",a],queryFn:()=>Mt.getArchives(a||void 0)}),{data:H}=Ki({queryKey:["printers"],queryFn:Mt.getPrinters}),q=Qi({mutationFn:async ie=>(await Promise.all(ie.map(we=>Mt.deleteArchive(we))),ie.length),onSuccess:ie=>{t.invalidateQueries({queryKey:["archives"]}),F(new Set),e(`${ie} archive${ie!==1?"s":""} deleted`)},onError:()=>{e("Failed to delete archives","error")}}),re=new Map(H?.map(ie=>[ie.id,ie.name])||[]),ce=[...new Set(J?.flatMap(ie=>ie.filament_type?.split(", ")||[]).filter(Boolean)||[])].sort(),ye=[...new Set(J?.flatMap(ie=>ie.filament_color?.split(",")||[]).filter(Boolean)||[])],me=[...new Set(J?.flatMap(ie=>ie.tags?.split(",").map(we=>we.trim())||[]).filter(Boolean)||[])].sort(),be=J?.filter(ie=>{const we=new Date,ve=new Date(ie.created_at);let k=!0;switch(V){case"recent":k=we.getTime()-ve.getTime()<1440*60*1e3;break;case"this-week":k=we.getTime()-ve.getTime()<10080*60*1e3;break;case"this-month":k=ve.getMonth()===we.getMonth()&&ve.getFullYear()===we.getFullYear();break;case"favorites":k=ie.is_favorite===!0;break;case"failed":k=ie.status==="failed";break}const O=(ie.print_name||ie.filename).toLowerCase().includes(i.toLowerCase()),K=!l||ie.filament_type?.split(", ").includes(l),pe=ie.filament_color?.split(",")||[],xe=d.size===0||(h==="or"?pe.some($e=>d.has($e)):[...d].every($e=>pe.includes($e))),fe=V==="favorites"||!m||ie.is_favorite,Ke=ie.tags?.split(",").map($e=>$e.trim())||[],Ie=!y||Ke.includes(y);return k&&O&&K&&xe&&fe&&Ie}).sort((ie,we)=>{switch(W){case"date-desc":return new Date(we.created_at).getTime()-new Date(ie.created_at).getTime();case"date-asc":return new Date(ie.created_at).getTime()-new Date(we.created_at).getTime();case"name-asc":return(ie.print_name||ie.filename).localeCompare(we.print_name||we.filename);case"name-desc":return(we.print_name||we.filename).localeCompare(ie.print_name||ie.filename);case"size-desc":return we.file_size-ie.file_size;case"size-asc":return ie.file_size-we.file_size;default:return 0}}),Ne=C.size>0,he=ie=>{F(we=>{const ve=new Set(we);return ve.has(ie)?ve.delete(ie):ve.add(ie),ve})},Ae=()=>{be&&F(new Set(be.map(ie=>ie.id)))},Be=()=>{F(new Set)},le=ie=>{f(we=>{const ve=new Set(we);return ve.has(ie)?ve.delete(ie):ve.add(ie),ve})},lt=()=>{f(new Set)},z=()=>{r(""),s(null),c(null),b(!1),x(null)},G=i||a||l||m||y,ne=T.useCallback(ie=>{ie.preventDefault(),ie.dataTransfer.types.includes("Files")&&N(!0)},[]),Q=T.useCallback(ie=>{ie.preventDefault(),ie.currentTarget===ie.target&&N(!1)},[]),ee=T.useCallback(ie=>{ie.preventDefault(),N(!1);const we=Array.from(ie.dataTransfer.files).filter(ve=>ve.name.endsWith(".3mf"));we.length>0?(A(we),w(!0)):ie.dataTransfer.files.length>0&&e("Only .3mf files are supported","warning")},[e]),ae=T.useCallback(ie=>{const we=ie.target;if(we.tagName==="INPUT"||we.tagName==="TEXTAREA"||we.isContentEditable){ie.key==="Escape"&&we.blur();return}switch(ie.key){case"/":ie.preventDefault(),n.current?.focus();break;case"u":case"U":!ie.metaKey&&!ie.ctrlKey&&(ie.preventDefault(),w(!0));break;case"Escape":Ne&&Be();break}},[Ne]);return T.useEffect(()=>(document.addEventListener("keydown",ae),()=>document.removeEventListener("keydown",ae)),[ae]),E.jsxs("div",{className:"p-8 relative min-h-full",onDragOver:ne,onDragLeave:Q,onDrop:ee,children:[R&&E.jsx("div",{className:"fixed inset-0 z-50 bg-bambu-dark/90 flex items-center justify-center pointer-events-none",children:E.jsxs("div",{className:"border-4 border-dashed border-bambu-green rounded-xl p-12 text-center",children:[E.jsx(Qv,{className:"w-16 h-16 mx-auto mb-4 text-bambu-green"}),E.jsx("p",{className:"text-2xl font-semibold text-white mb-2",children:"Drop .3mf files here"}),E.jsx("p",{className:"text-bambu-gray",children:"Release to upload"})]})}),Ne&&E.jsxs("div",{className:"fixed bottom-6 left-1/2 -translate-x-1/2 z-40 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded-lg shadow-xl px-4 py-3 flex items-center gap-4",children:[E.jsxs("span",{className:"text-white font-medium",children:[C.size," selected"]}),E.jsx("div",{className:"w-px h-6 bg-bambu-dark-tertiary"}),E.jsx(At,{variant:"secondary",size:"sm",onClick:Ae,children:"Select All"}),E.jsxs(At,{variant:"secondary",size:"sm",onClick:Be,children:[E.jsx(Ji,{className:"w-4 h-4"}),"Clear"]}),E.jsx("div",{className:"w-px h-6 bg-bambu-dark-tertiary"}),E.jsxs(At,{variant:"secondary",size:"sm",onClick:()=>U(!0),children:[E.jsx(Fp,{className:"w-4 h-4"}),"Tags"]}),E.jsxs(At,{variant:"secondary",size:"sm",onClick:()=>{const ie=Array.from(C);Promise.all(ie.map(we=>Mt.toggleFavorite(we))).then(()=>{t.invalidateQueries({queryKey:["archives"]}),e(`Toggled favorites for ${ie.length} archive${ie.length!==1?"s":""}`)}).catch(()=>{e("Failed to update favorites","error")})},children:[E.jsx(kp,{className:"w-4 h-4"}),"Favorite"]}),E.jsxs(At,{size:"sm",className:"bg-red-500 hover:bg-red-600",onClick:()=>L(!0),children:[E.jsx(yu,{className:"w-4 h-4"}),"Delete"]})]}),E.jsxs("div",{className:"flex items-center justify-between mb-8",children:[E.jsxs("div",{children:[E.jsxs("div",{className:"flex items-center gap-3",children:[E.jsx("h1",{className:"text-2xl font-bold text-white",children:"Archives"}),E.jsx("select",{className:"px-3 py-1.5 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-bambu-gray-light text-sm focus:border-bambu-green focus:outline-none",value:V,onChange:ie=>Y(ie.target.value),children:Fle.map(ie=>E.jsx("option",{value:ie.id,children:ie.label},ie.id))})]}),E.jsxs("p",{className:"text-bambu-gray",children:[be?.length||0," of ",J?.length||0," prints"]})]}),E.jsxs("div",{className:"flex items-center gap-3",children:[!Ne&&E.jsxs(At,{variant:"secondary",onClick:()=>be?.length&&he(be[0].id),children:[E.jsx(Zv,{className:"w-4 h-4"}),"Select"]}),E.jsxs(At,{onClick:()=>w(!0),children:[E.jsx(Qv,{className:"w-4 h-4"}),"Upload 3MF"]})]})]}),E.jsx(vi,{className:"mb-6",children:E.jsxs(Pi,{className:"py-4",children:[E.jsxs("div",{className:"flex gap-4 items-center flex-wrap",children:[E.jsxs("div",{className:"flex-1 relative min-w-[200px]",children:[E.jsx(Uz,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray"}),E.jsx("input",{ref:n,type:"text",placeholder:"Search archives... (press /)",className:"w-full pl-10 pr-4 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none",value:i,onChange:ie=>r(ie.target.value)})]}),E.jsxs("div",{className:"flex items-center gap-2",children:[E.jsx(nX,{className:"w-4 h-4 text-bambu-gray"}),E.jsxs("select",{className:"px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none",value:a||"",onChange:ie=>s(ie.target.value?Number(ie.target.value):null),children:[E.jsx("option",{value:"",children:"All Printers"}),H?.map(ie=>E.jsx("option",{value:ie.id,children:ie.name},ie.id))]})]}),E.jsxs("div",{className:"flex items-center gap-2",children:[E.jsx(Yv,{className:"w-4 h-4 text-bambu-gray"}),E.jsxs("select",{className:"px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none",value:l||"",onChange:ie=>c(ie.target.value||null),children:[E.jsx("option",{value:"",children:"All Materials"}),ce.map(ie=>E.jsx("option",{value:ie,children:ie},ie))]})]}),E.jsxs("button",{onClick:()=>b(!m),className:`flex items-center gap-2 px-3 py-2 rounded-lg border transition-colors ${m?"bg-yellow-500/20 border-yellow-500 text-yellow-400":"bg-bambu-dark border-bambu-dark-tertiary text-bambu-gray hover:text-white"}`,title:m?"Show all":"Show favorites only",children:[E.jsx(kp,{className:`w-4 h-4 ${m?"fill-yellow-400":""}`}),E.jsx("span",{className:"text-sm",children:"Favorites"})]}),me.length>0&&E.jsxs("div",{className:"flex items-center gap-2",children:[E.jsx(Fp,{className:"w-4 h-4 text-bambu-gray"}),E.jsxs("select",{className:"px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none",value:y||"",onChange:ie=>x(ie.target.value||null),children:[E.jsx("option",{value:"",children:"All Tags"}),me.map(ie=>E.jsx("option",{value:ie,children:ie},ie))]})]}),E.jsxs("div",{className:"flex items-center gap-2",children:[E.jsx(cW,{className:"w-4 h-4 text-bambu-gray"}),E.jsxs("select",{className:"px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none",value:W,onChange:ie=>X(ie.target.value),children:[E.jsx("option",{value:"date-desc",children:"Newest first"}),E.jsx("option",{value:"date-asc",children:"Oldest first"}),E.jsx("option",{value:"name-asc",children:"Name A-Z"}),E.jsx("option",{value:"name-desc",children:"Name Z-A"}),E.jsx("option",{value:"size-desc",children:"Largest first"}),E.jsx("option",{value:"size-asc",children:"Smallest first"})]})]}),E.jsxs("div",{className:"flex items-center border border-bambu-dark-tertiary rounded-lg overflow-hidden",children:[E.jsx("button",{className:`p-2 ${$==="grid"?"bg-bambu-green text-white":"bg-bambu-dark text-bambu-gray hover:text-white"}`,onClick:()=>I("grid"),title:"Grid view",children:E.jsx(vX,{className:"w-4 h-4"})}),E.jsx("button",{className:`p-2 ${$==="list"?"bg-bambu-green text-white":"bg-bambu-dark text-bambu-gray hover:text-white"}`,onClick:()=>I("list"),title:"List view",children:E.jsx(yX,{className:"w-4 h-4"})}),E.jsx("button",{className:`p-2 ${$==="calendar"?"bg-bambu-green text-white":"bg-bambu-dark text-bambu-gray hover:text-white"}`,onClick:()=>I("calendar"),title:"Calendar view",children:E.jsx(fW,{className:"w-4 h-4"})})]}),G&&E.jsxs(At,{variant:"ghost",size:"sm",onClick:z,className:"text-bambu-gray hover:text-white",children:[E.jsx(Ji,{className:"w-4 h-4"}),"Reset"]})]}),ye.length>0&&E.jsxs("div",{className:"flex items-center gap-3 mt-4 pt-4 border-t border-bambu-dark-tertiary",children:[E.jsx("span",{className:"text-xs text-bambu-gray",children:"Colors:"}),d.size>1&&E.jsx("button",{onClick:()=>g(ie=>ie==="or"?"and":"or"),className:`px-2 py-0.5 text-xs rounded transition-colors ${h==="and"?"bg-bambu-green text-white":"bg-bambu-dark-tertiary text-bambu-gray hover:text-white"}`,title:h==="or"?"Match ANY selected color":"Match ALL selected colors",children:h.toUpperCase()}),E.jsx("div",{className:"flex items-center gap-1.5 flex-wrap",children:ye.map(ie=>E.jsx("button",{onClick:()=>le(ie),className:`w-6 h-6 rounded-full border-2 transition-all ${d.has(ie)?"border-bambu-green scale-110":"border-white/20 hover:border-white/40"}`,style:{backgroundColor:ie},title:ie},ie))}),d.size>0&&E.jsxs("button",{onClick:lt,className:"text-xs text-bambu-gray hover:text-white flex items-center gap-1",children:[E.jsx(Ji,{className:"w-3 h-3"}),"Clear"]})]})]})}),se?E.jsx("div",{className:"text-center py-12 text-bambu-gray",children:"Loading archives..."}):be?.length===0?E.jsx(vi,{children:E.jsxs(Pi,{className:"text-center py-12",children:[E.jsx("p",{className:"text-bambu-gray",children:i?"No archives match your search":"No archives yet"}),E.jsx("p",{className:"text-sm text-bambu-gray mt-2",children:"Archives are created automatically when prints complete"})]})}):$==="calendar"?E.jsx(vi,{className:"p-6",children:E.jsx(Nle,{archives:be||[],onArchiveClick:ie=>{r(ie.print_name||ie.filename),I("grid")}})}):$==="grid"?E.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6",children:be?.map(ie=>E.jsx(kle,{archive:ie,printerName:ie.printer_id?re.get(ie.printer_id)||"Unknown":"No Printer",isSelected:C.has(ie.id),onSelect:he,selectionMode:Ne},ie.id))}):$==="list"?E.jsx(vi,{children:E.jsxs("div",{className:"divide-y divide-bambu-dark-tertiary",children:[E.jsxs("div",{className:"grid grid-cols-12 gap-4 px-4 py-3 text-xs text-bambu-gray font-medium",children:[E.jsx("div",{className:"col-span-1"}),E.jsx("div",{className:"col-span-4",children:"Name"}),E.jsx("div",{className:"col-span-2",children:"Printer"}),E.jsx("div",{className:"col-span-2",children:"Date"}),E.jsx("div",{className:"col-span-1",children:"Size"}),E.jsx("div",{className:"col-span-2 text-right",children:"Actions"})]}),be?.map(ie=>E.jsxs("div",{className:`grid grid-cols-12 gap-4 px-4 py-3 items-center hover:bg-bambu-dark-tertiary/30 ${C.has(ie.id)?"bg-bambu-green/10":""}`,children:[E.jsxs("div",{className:"col-span-1 flex items-center gap-2",children:[Ne&&E.jsx("button",{onClick:()=>he(ie.id),children:C.has(ie.id)?E.jsx(Zv,{className:"w-4 h-4 text-bambu-green"}):E.jsx(VE,{className:"w-4 h-4 text-bambu-gray"})}),ie.thumbnail_path?E.jsx("img",{src:Mt.getArchiveThumbnail(ie.id),alt:"",className:"w-10 h-10 object-cover rounded"}):E.jsx("div",{className:"w-10 h-10 bg-bambu-dark rounded flex items-center justify-center",children:E.jsx(pT,{className:"w-5 h-5 text-bambu-dark-tertiary"})})]}),E.jsxs("div",{className:"col-span-4",children:[E.jsxs("div",{className:"flex items-center gap-2",children:[E.jsx("p",{className:"text-white text-sm truncate",children:ie.print_name||ie.filename}),ie.timelapse_path&&E.jsx("span",{title:"Has timelapse",children:E.jsx(Ep,{className:"w-3.5 h-3.5 text-bambu-green flex-shrink-0"})})]}),ie.filament_type&&E.jsxs("div",{className:"flex items-center gap-1.5 mt-0.5",children:[E.jsx("span",{className:"text-xs text-bambu-gray",children:ie.filament_type}),ie.filament_color&&E.jsx("div",{className:"flex items-center gap-0.5 flex-wrap",children:ie.filament_color.split(",").map((we,ve)=>E.jsx("div",{className:"w-2.5 h-2.5 rounded-full border border-white/20",style:{backgroundColor:we},title:we},ve))})]})]}),E.jsx("div",{className:"col-span-2 text-sm text-bambu-gray truncate",children:ie.printer_id?re.get(ie.printer_id)||"Unknown":"No Printer"}),E.jsx("div",{className:"col-span-2 text-sm text-bambu-gray",children:new Date(ie.created_at).toLocaleDateString()}),E.jsx("div",{className:"col-span-1 text-sm text-bambu-gray",children:a5(ie.file_size)}),E.jsxs("div",{className:"col-span-2 flex justify-end gap-1",children:[E.jsx(At,{variant:"ghost",size:"sm",onClick:()=>{const we=ie.print_name||ie.filename||"model",ve=`${window.location.origin}${Mt.getArchiveForSlicer(ie.id,we)}`;window.location.href=`bambustudioopen://${encodeURIComponent(ve)}`},title:"Open in Slicer",children:E.jsx(qv,{className:"w-4 h-4"})}),ie.makerworld_url&&E.jsx(At,{variant:"ghost",size:"sm",onClick:()=>window.open(ie.makerworld_url,"_blank"),title:"MakerWorld",children:E.jsx(GE,{className:"w-4 h-4"})}),E.jsx(At,{variant:"ghost",size:"sm",onClick:()=>{const we=document.createElement("a");we.href=Mt.getArchiveDownload(ie.id),we.download=`${ie.print_name||ie.filename}.3mf`,we.click()},title:"Download",children:E.jsx(ou,{className:"w-4 h-4"})})]})]},ie.id))]})}):null,v&&E.jsx(wle,{onClose:()=>{w(!1),A([])},initialFiles:S}),P&&E.jsx(zf,{title:"Delete Archives",message:`Are you sure you want to delete ${C.size} archive${C.size>1?"s":""}? This action cannot be undone.`,confirmText:`Delete ${C.size}`,variant:"danger",onConfirm:()=>{q.mutate(Array.from(C)),L(!1)},onCancel:()=>L(!1)}),B&&E.jsx(Tle,{selectedIds:Array.from(C),existingTags:me,onClose:()=>U(!1)})]})}function Ble({printDates:t,months:e=3}){const{weeks:n,monthLabels:i,printCounts:r}=T.useMemo(()=>{const c={};t.forEach(v=>{const w=v.split("T")[0];c[w]=(c[w]||0)+1});const d=new Date,f=new Date(d);f.setMonth(f.getMonth()-e),f.setDate(f.getDate()-f.getDay());const h=[],g=[];let m=[],b=-1;const y=new Date(f);let x=0;for(;y<=d;)y.getDay()===0&&m.length>0&&(h.push(m),m=[],x++),y.getMonth()!==b&&(g.push({month:y.toLocaleDateString("en-US",{month:"short"}),weekIndex:x}),b=y.getMonth()),m.push(new Date(y)),y.setDate(y.getDate()+1);return m.length>0&&h.push(m),{weeks:h,monthLabels:g,printCounts:c}},[t,e]),a=Math.max(1,...Object.values(r)),s=c=>{if(c===0)return"bg-bambu-dark";const d=c/a;return d<=.25?"bg-bambu-green/30":d<=.5?"bg-bambu-green/50":d<=.75?"bg-bambu-green/75":"bg-bambu-green"},l=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];return E.jsxs("div",{className:"overflow-x-auto",children:[E.jsx("div",{className:"flex mb-1 ml-8",children:i.map(({month:c,weekIndex:d},f)=>E.jsx("div",{className:"text-xs text-bambu-gray",style:{marginLeft:f===0?0:`${(d-(i[f-1]?.weekIndex||0))*14-24}px`},children:c},f))}),E.jsxs("div",{className:"flex gap-0.5",children:[E.jsx("div",{className:"flex flex-col gap-0.5 mr-1",children:l.map((c,d)=>E.jsx("div",{className:"h-3 text-xs text-bambu-gray flex items-center",style:{visibility:d%2===1?"visible":"hidden"},children:c},c))}),n.map((c,d)=>E.jsx("div",{className:"flex flex-col gap-0.5",children:[0,1,2,3,4,5,6].map(f=>{const h=c.find(y=>y.getDay()===f);if(!h)return E.jsx("div",{className:"w-3 h-3"},f);const g=h.toISOString().split("T")[0],m=r[g]||0,b=g===new Date().toISOString().split("T")[0];return E.jsx("div",{className:`w-3 h-3 rounded-sm ${s(m)} ${b?"ring-1 ring-white":""}`,title:`${h.toLocaleDateString()}: ${m} print${m!==1?"s":""}`},f)})},d))]}),E.jsxs("div",{className:"flex items-center gap-2 mt-3 text-xs text-bambu-gray",children:[E.jsx("span",{children:"Less"}),E.jsxs("div",{className:"flex gap-0.5",children:[E.jsx("div",{className:"w-3 h-3 rounded-sm bg-bambu-dark"}),E.jsx("div",{className:"w-3 h-3 rounded-sm bg-bambu-green/30"}),E.jsx("div",{className:"w-3 h-3 rounded-sm bg-bambu-green/50"}),E.jsx("div",{className:"w-3 h-3 rounded-sm bg-bambu-green/75"}),E.jsx("div",{className:"w-3 h-3 rounded-sm bg-bambu-green"})]}),E.jsx("span",{children:"More"})]})]})}function s5(t){var e,n,i="";if(typeof t=="string"||typeof t=="number")i+=t;else if(typeof t=="object")if(Array.isArray(t)){var r=t.length;for(e=0;e<r;e++)t[e]&&(n=s5(t[e]))&&(i&&(i+=" "),i+=n)}else for(n in t)t[n]&&(i&&(i+=" "),i+=n);return i}function dn(){for(var t,e,n=0,i="",r=arguments.length;n<r;n++)(t=arguments[n])&&(e=s5(t))&&(i&&(i+=" "),i+=e);return i}var jle=["dangerouslySetInnerHTML","onCopy","onCopyCapture","onCut","onCutCapture","onPaste","onPasteCapture","onCompositionEnd","onCompositionEndCapture","onCompositionStart","onCompositionStartCapture","onCompositionUpdate","onCompositionUpdateCapture","onFocus","onFocusCapture","onBlur","onBlurCapture","onChange","onChangeCapture","onBeforeInput","onBeforeInputCapture","onInput","onInputCapture","onReset","onResetCapture","onSubmit","onSubmitCapture","onInvalid","onInvalidCapture","onLoad","onLoadCapture","onError","onErrorCapture","onKeyDown","onKeyDownCapture","onKeyPress","onKeyPressCapture","onKeyUp","onKeyUpCapture","onAbort","onAbortCapture","onCanPlay","onCanPlayCapture","onCanPlayThrough","onCanPlayThroughCapture","onDurationChange","onDurationChangeCapture","onEmptied","onEmptiedCapture","onEncrypted","onEncryptedCapture","onEnded","onEndedCapture","onLoadedData","onLoadedDataCapture","onLoadedMetadata","onLoadedMetadataCapture","onLoadStart","onLoadStartCapture","onPause","onPauseCapture","onPlay","onPlayCapture","onPlaying","onPlayingCapture","onProgress","onProgressCapture","onRateChange","onRateChangeCapture","onSeeked","onSeekedCapture","onSeeking","onSeekingCapture","onStalled","onStalledCapture","onSuspend","onSuspendCapture","onTimeUpdate","onTimeUpdateCapture","onVolumeChange","onVolumeChangeCapture","onWaiting","onWaitingCapture","onAuxClick","onAuxClickCapture","onClick","onClickCapture","onContextMenu","onContextMenuCapture","onDoubleClick","onDoubleClickCapture","onDrag","onDragCapture","onDragEnd","onDragEndCapture","onDragEnter","onDragEnterCapture","onDragExit","onDragExitCapture","onDragLeave","onDragLeaveCapture","onDragOver","onDragOverCapture","onDragStart","onDragStartCapture","onDrop","onDropCapture","onMouseDown","onMouseDownCapture","onMouseEnter","onMouseLeave","onMouseMove","onMouseMoveCapture","onMouseOut","onMouseOutCapture","onMouseOver","onMouseOverCapture","onMouseUp","onMouseUpCapture","onSelect","onSelectCapture","onTouchCancel","onTouchCancelCapture","onTouchEnd","onTouchEndCapture","onTouchMove","onTouchMoveCapture","onTouchStart","onTouchStartCapture","onPointerDown","onPointerDownCapture","onPointerMove","onPointerMoveCapture","onPointerUp","onPointerUpCapture","onPointerCancel","onPointerCancelCapture","onPointerEnter","onPointerEnterCapture","onPointerLeave","onPointerLeaveCapture","onPointerOver","onPointerOverCapture","onPointerOut","onPointerOutCapture","onGotPointerCapture","onGotPointerCaptureCapture","onLostPointerCapture","onLostPointerCaptureCapture","onScroll","onScrollCapture","onWheel","onWheelCapture","onAnimationStart","onAnimationStartCapture","onAnimationEnd","onAnimationEndCapture","onAnimationIteration","onAnimationIterationCapture","onTransitionEnd","onTransitionEndCapture"];function VT(t){if(typeof t!="string")return!1;var e=jle;return e.includes(t)}var Hle=["aria-activedescendant","aria-atomic","aria-autocomplete","aria-busy","aria-checked","aria-colcount","aria-colindex","aria-colspan","aria-controls","aria-current","aria-describedby","aria-details","aria-disabled","aria-errormessage","aria-expanded","aria-flowto","aria-haspopup","aria-hidden","aria-invalid","aria-keyshortcuts","aria-label","aria-labelledby","aria-level","aria-live","aria-modal","aria-multiline","aria-multiselectable","aria-orientation","aria-owns","aria-placeholder","aria-posinset","aria-pressed","aria-readonly","aria-relevant","aria-required","aria-roledescription","aria-rowcount","aria-rowindex","aria-rowspan","aria-selected","aria-setsize","aria-sort","aria-valuemax","aria-valuemin","aria-valuenow","aria-valuetext","className","color","height","id","lang","max","media","method","min","name","style","target","width","role","tabIndex","accentHeight","accumulate","additive","alignmentBaseline","allowReorder","alphabetic","amplitude","arabicForm","ascent","attributeName","attributeType","autoReverse","azimuth","baseFrequency","baselineShift","baseProfile","bbox","begin","bias","by","calcMode","capHeight","clip","clipPath","clipPathUnits","clipRule","colorInterpolation","colorInterpolationFilters","colorProfile","colorRendering","contentScriptType","contentStyleType","cursor","cx","cy","d","decelerate","descent","diffuseConstant","direction","display","divisor","dominantBaseline","dur","dx","dy","edgeMode","elevation","enableBackground","end","exponent","externalResourcesRequired","fill","fillOpacity","fillRule","filter","filterRes","filterUnits","floodColor","floodOpacity","focusable","fontFamily","fontSize","fontSizeAdjust","fontStretch","fontStyle","fontVariant","fontWeight","format","from","fx","fy","g1","g2","glyphName","glyphOrientationHorizontal","glyphOrientationVertical","glyphRef","gradientTransform","gradientUnits","hanging","horizAdvX","horizOriginX","href","ideographic","imageRendering","in2","in","intercept","k1","k2","k3","k4","k","kernelMatrix","kernelUnitLength","kerning","keyPoints","keySplines","keyTimes","lengthAdjust","letterSpacing","lightingColor","limitingConeAngle","local","markerEnd","markerHeight","markerMid","markerStart","markerUnits","markerWidth","mask","maskContentUnits","maskUnits","mathematical","mode","numOctaves","offset","opacity","operator","order","orient","orientation","origin","overflow","overlinePosition","overlineThickness","paintOrder","panose1","pathLength","patternContentUnits","patternTransform","patternUnits","pointerEvents","pointsAtX","pointsAtY","pointsAtZ","preserveAlpha","preserveAspectRatio","primitiveUnits","r","radius","refX","refY","renderingIntent","repeatCount","repeatDur","requiredExtensions","requiredFeatures","restart","result","rotate","rx","ry","seed","shapeRendering","slope","spacing","specularConstant","specularExponent","speed","spreadMethod","startOffset","stdDeviation","stemh","stemv","stitchTiles","stopColor","stopOpacity","strikethroughPosition","strikethroughThickness","string","stroke","strokeDasharray","strokeDashoffset","strokeLinecap","strokeLinejoin","strokeMiterlimit","strokeOpacity","strokeWidth","surfaceScale","systemLanguage","tableValues","targetX","targetY","textAnchor","textDecoration","textLength","textRendering","to","transform","u1","u2","underlinePosition","underlineThickness","unicode","unicodeBidi","unicodeRange","unitsPerEm","vAlphabetic","values","vectorEffect","version","vertAdvY","vertOriginX","vertOriginY","vHanging","vIdeographic","viewTarget","visibility","vMathematical","widths","wordSpacing","writingMode","x1","x2","x","xChannelSelector","xHeight","xlinkActuate","xlinkArcrole","xlinkHref","xlinkRole","xlinkShow","xlinkTitle","xlinkType","xmlBase","xmlLang","xmlns","xmlnsXlink","xmlSpace","y1","y2","y","yChannelSelector","z","zoomAndPan","ref","key","angle"],Gle=new Set(Hle);function o5(t){return typeof t!="string"?!1:Gle.has(t)}function l5(t){return typeof t=="string"&&t.startsWith("data-")}function Jr(t){if(typeof t!="object"||t===null)return{};var e={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(o5(n)||l5(n))&&(e[n]=t[n]);return e}function Au(t){if(t==null)return null;if(T.isValidElement(t)&&typeof t.props=="object"&&t.props!==null){var e=t.props;return Jr(e)}return typeof t=="object"&&!Array.isArray(t)?Jr(t):null}function kr(t){var e={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(o5(n)||l5(n)||VT(n))&&(e[n]=t[n]);return e}function Vle(t){return t==null?null:T.isValidElement(t)?kr(t.props):typeof t=="object"&&!Array.isArray(t)?kr(t):null}var $le=["children","width","height","viewBox","className","style","title","desc"];function qM(){return qM=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)({}).hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},qM.apply(null,arguments)}function Wle(t,e){if(t==null)return{};var n,i,r=Xle(t,e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(i=0;i<a.length;i++)n=a[i],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function Xle(t,e){if(t==null)return{};var n={};for(var i in t)if({}.hasOwnProperty.call(t,i)){if(e.indexOf(i)!==-1)continue;n[i]=t[i]}return n}var $T=T.forwardRef((t,e)=>{var{children:n,width:i,height:r,viewBox:a,className:s,style:l,title:c,desc:d}=t,f=Wle(t,$le),h=a||{width:i,height:r,x:0,y:0},g=dn("recharts-surface",s);return T.createElement("svg",qM({},kr(f),{className:g,width:i,height:r,style:l,viewBox:"".concat(h.x," ").concat(h.y," ").concat(h.width," ").concat(h.height),ref:e}),T.createElement("title",null,c),T.createElement("desc",null,d),n)}),qle=["children","className"];function YM(){return YM=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)({}).hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},YM.apply(null,arguments)}function Yle(t,e){if(t==null)return{};var n,i,r=Kle(t,e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(i=0;i<a.length;i++)n=a[i],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function Kle(t,e){if(t==null)return{};var n={};for(var i in t)if({}.hasOwnProperty.call(t,i)){if(e.indexOf(i)!==-1)continue;n[i]=t[i]}return n}var oi=T.forwardRef((t,e)=>{var{children:n,className:i}=t,r=Yle(t,qle),a=dn("recharts-layer",i);return T.createElement("g",YM({className:a},kr(r),{ref:e}),n)}),c5=T.createContext(null),Zle=()=>T.useContext(c5);function On(t){return function(){return t}}const u5=Math.cos,fx=Math.sin,ws=Math.sqrt,hx=Math.PI,Sy=2*hx,KM=Math.PI,ZM=2*KM,qc=1e-6,Qle=ZM-qc;function d5(t){this._+=t[0];for(let e=1,n=t.length;e<n;++e)this._+=arguments[e]+t[e]}function Jle(t){let e=Math.floor(t);if(!(e>=0))throw new Error(`invalid digits: ${t}`);if(e>15)return d5;const n=10**e;return function(i){this._+=i[0];for(let r=1,a=i.length;r<a;++r)this._+=Math.round(arguments[r]*n)/n+i[r]}}class ece{constructor(e){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=e==null?d5:Jle(e)}moveTo(e,n){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+n}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(e,n){this._append`L${this._x1=+e},${this._y1=+n}`}quadraticCurveTo(e,n,i,r){this._append`Q${+e},${+n},${this._x1=+i},${this._y1=+r}`}bezierCurveTo(e,n,i,r,a,s){this._append`C${+e},${+n},${+i},${+r},${this._x1=+a},${this._y1=+s}`}arcTo(e,n,i,r,a){if(e=+e,n=+n,i=+i,r=+r,a=+a,a<0)throw new Error(`negative radius: ${a}`);let s=this._x1,l=this._y1,c=i-e,d=r-n,f=s-e,h=l-n,g=f*f+h*h;if(this._x1===null)this._append`M${this._x1=e},${this._y1=n}`;else if(g>qc)if(!(Math.abs(h*c-d*f)>qc)||!a)this._append`L${this._x1=e},${this._y1=n}`;else{let m=i-s,b=r-l,y=c*c+d*d,x=m*m+b*b,v=Math.sqrt(y),w=Math.sqrt(g),S=a*Math.tan((KM-Math.acos((y+g-x)/(2*v*w)))/2),A=S/w,R=S/v;Math.abs(A-1)>qc&&this._append`L${e+A*f},${n+A*h}`,this._append`A${a},${a},0,0,${+(h*m>f*b)},${this._x1=e+R*c},${this._y1=n+R*d}`}}arc(e,n,i,r,a,s){if(e=+e,n=+n,i=+i,s=!!s,i<0)throw new Error(`negative radius: ${i}`);let l=i*Math.cos(r),c=i*Math.sin(r),d=e+l,f=n+c,h=1^s,g=s?r-a:a-r;this._x1===null?this._append`M${d},${f}`:(Math.abs(this._x1-d)>qc||Math.abs(this._y1-f)>qc)&&this._append`L${d},${f}`,i&&(g<0&&(g=g%ZM+ZM),g>Qle?this._append`A${i},${i},0,1,${h},${e-l},${n-c}A${i},${i},0,1,${h},${this._x1=d},${this._y1=f}`:g>qc&&this._append`A${i},${i},0,${+(g>=KM)},${h},${this._x1=e+i*Math.cos(a)},${this._y1=n+i*Math.sin(a)}`)}rect(e,n,i,r){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+n}h${i=+i}v${+r}h${-i}Z`}toString(){return this._}}function WT(t){let e=3;return t.digits=function(n){if(!arguments.length)return e;if(n==null)e=null;else{const i=Math.floor(n);if(!(i>=0))throw new RangeError(`invalid digits: ${n}`);e=i}return t},()=>new ece(e)}function XT(t){return typeof t=="object"&&"length"in t?t:Array.from(t)}function f5(t){this._context=t}f5.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:this._context.lineTo(t,e);break}}};function wy(t){return new f5(t)}function h5(t){return t[0]}function p5(t){return t[1]}function m5(t,e){var n=On(!0),i=null,r=wy,a=null,s=WT(l);t=typeof t=="function"?t:t===void 0?h5:On(t),e=typeof e=="function"?e:e===void 0?p5:On(e);function l(c){var d,f=(c=XT(c)).length,h,g=!1,m;for(i==null&&(a=r(m=s())),d=0;d<=f;++d)!(d<f&&n(h=c[d],d,c))===g&&((g=!g)?a.lineStart():a.lineEnd()),g&&a.point(+t(h,d,c),+e(h,d,c));if(m)return a=null,m+""||null}return l.x=function(c){return arguments.length?(t=typeof c=="function"?c:On(+c),l):t},l.y=function(c){return arguments.length?(e=typeof c=="function"?c:On(+c),l):e},l.defined=function(c){return arguments.length?(n=typeof c=="function"?c:On(!!c),l):n},l.curve=function(c){return arguments.length?(r=c,i!=null&&(a=r(i)),l):r},l.context=function(c){return arguments.length?(c==null?i=a=null:a=r(i=c),l):i},l}function cv(t,e,n){var i=null,r=On(!0),a=null,s=wy,l=null,c=WT(d);t=typeof t=="function"?t:t===void 0?h5:On(+t),e=typeof e=="function"?e:On(e===void 0?0:+e),n=typeof n=="function"?n:n===void 0?p5:On(+n);function d(h){var g,m,b,y=(h=XT(h)).length,x,v=!1,w,S=new Array(y),A=new Array(y);for(a==null&&(l=s(w=c())),g=0;g<=y;++g){if(!(g<y&&r(x=h[g],g,h))===v)if(v=!v)m=g,l.areaStart(),l.lineStart();else{for(l.lineEnd(),l.lineStart(),b=g-1;b>=m;--b)l.point(S[b],A[b]);l.lineEnd(),l.areaEnd()}v&&(S[g]=+t(x,g,h),A[g]=+e(x,g,h),l.point(i?+i(x,g,h):S[g],n?+n(x,g,h):A[g]))}if(w)return l=null,w+""||null}function f(){return m5().defined(r).curve(s).context(a)}return d.x=function(h){return arguments.length?(t=typeof h=="function"?h:On(+h),i=null,d):t},d.x0=function(h){return arguments.length?(t=typeof h=="function"?h:On(+h),d):t},d.x1=function(h){return arguments.length?(i=h==null?null:typeof h=="function"?h:On(+h),d):i},d.y=function(h){return arguments.length?(e=typeof h=="function"?h:On(+h),n=null,d):e},d.y0=function(h){return arguments.length?(e=typeof h=="function"?h:On(+h),d):e},d.y1=function(h){return arguments.length?(n=h==null?null:typeof h=="function"?h:On(+h),d):n},d.lineX0=d.lineY0=function(){return f().x(t).y(e)},d.lineY1=function(){return f().x(t).y(n)},d.lineX1=function(){return f().x(i).y(e)},d.defined=function(h){return arguments.length?(r=typeof h=="function"?h:On(!!h),d):r},d.curve=function(h){return arguments.length?(s=h,a!=null&&(l=s(a)),d):s},d.context=function(h){return arguments.length?(h==null?a=l=null:l=s(a=h),d):a},d}class g5{constructor(e,n){this._context=e,this._x=n}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(e,n){switch(e=+e,n=+n,this._point){case 0:{this._point=1,this._line?this._context.lineTo(e,n):this._context.moveTo(e,n);break}case 1:this._point=2;default:{this._x?this._context.bezierCurveTo(this._x0=(this._x0+e)/2,this._y0,this._x0,n,e,n):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+n)/2,e,this._y0,e,n);break}}this._x0=e,this._y0=n}}function tce(t){return new g5(t,!0)}function nce(t){return new g5(t,!1)}const qT={draw(t,e){const n=ws(e/hx);t.moveTo(n,0),t.arc(0,0,n,0,Sy)}},ice={draw(t,e){const n=ws(e/5)/2;t.moveTo(-3*n,-n),t.lineTo(-n,-n),t.lineTo(-n,-3*n),t.lineTo(n,-3*n),t.lineTo(n,-n),t.lineTo(3*n,-n),t.lineTo(3*n,n),t.lineTo(n,n),t.lineTo(n,3*n),t.lineTo(-n,3*n),t.lineTo(-n,n),t.lineTo(-3*n,n),t.closePath()}},v5=ws(1/3),rce=v5*2,ace={draw(t,e){const n=ws(e/rce),i=n*v5;t.moveTo(0,-n),t.lineTo(i,0),t.lineTo(0,n),t.lineTo(-i,0),t.closePath()}},sce={draw(t,e){const n=ws(e),i=-n/2;t.rect(i,i,n,n)}},oce=.8908130915292852,x5=fx(hx/10)/fx(7*hx/10),lce=fx(Sy/10)*x5,cce=-u5(Sy/10)*x5,uce={draw(t,e){const n=ws(e*oce),i=lce*n,r=cce*n;t.moveTo(0,-n),t.lineTo(i,r);for(let a=1;a<5;++a){const s=Sy*a/5,l=u5(s),c=fx(s);t.lineTo(c*n,-l*n),t.lineTo(l*i-c*r,c*i+l*r)}t.closePath()}},q1=ws(3),dce={draw(t,e){const n=-ws(e/(q1*3));t.moveTo(0,n*2),t.lineTo(-q1*n,-n),t.lineTo(q1*n,-n),t.closePath()}},La=-.5,Ia=ws(3)/2,QM=1/ws(12),fce=(QM/2+1)*3,hce={draw(t,e){const n=ws(e/fce),i=n/2,r=n*QM,a=i,s=n*QM+n,l=-a,c=s;t.moveTo(i,r),t.lineTo(a,s),t.lineTo(l,c),t.lineTo(La*i-Ia*r,Ia*i+La*r),t.lineTo(La*a-Ia*s,Ia*a+La*s),t.lineTo(La*l-Ia*c,Ia*l+La*c),t.lineTo(La*i+Ia*r,La*r-Ia*i),t.lineTo(La*a+Ia*s,La*s-Ia*a),t.lineTo(La*l+Ia*c,La*c-Ia*l),t.closePath()}};function pce(t,e){let n=null,i=WT(r);t=typeof t=="function"?t:On(t||qT),e=typeof e=="function"?e:On(e===void 0?64:+e);function r(){let a;if(n||(n=a=i()),t.apply(this,arguments).draw(n,+e.apply(this,arguments)),a)return n=null,a+""||null}return r.type=function(a){return arguments.length?(t=typeof a=="function"?a:On(a),r):t},r.size=function(a){return arguments.length?(e=typeof a=="function"?a:On(+a),r):e},r.context=function(a){return arguments.length?(n=a??null,r):n},r}function px(){}function mx(t,e,n){t._context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+e)/6,(t._y0+4*t._y1+n)/6)}function y5(t){this._context=t}y5.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:mx(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:mx(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function mce(t){return new y5(t)}function b5(t){this._context=t}b5.prototype={areaStart:px,areaEnd:px,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x2,this._y2),this._context.closePath();break}case 2:{this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break}case 3:{this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4);break}}},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._x2=t,this._y2=e;break;case 1:this._point=2,this._x3=t,this._y3=e;break;case 2:this._point=3,this._x4=t,this._y4=e,this._context.moveTo((this._x0+4*this._x1+t)/6,(this._y0+4*this._y1+e)/6);break;default:mx(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function gce(t){return new b5(t)}function _5(t){this._context=t}_5.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var n=(this._x0+4*this._x1+t)/6,i=(this._y0+4*this._y1+e)/6;this._line?this._context.lineTo(n,i):this._context.moveTo(n,i);break;case 3:this._point=4;default:mx(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function vce(t){return new _5(t)}function S5(t){this._context=t}S5.prototype={areaStart:px,areaEnd:px,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(t,e){t=+t,e=+e,this._point?this._context.lineTo(t,e):(this._point=1,this._context.moveTo(t,e))}};function xce(t){return new S5(t)}function hI(t){return t<0?-1:1}function pI(t,e,n){var i=t._x1-t._x0,r=e-t._x1,a=(t._y1-t._y0)/(i||r<0&&-0),s=(n-t._y1)/(r||i<0&&-0),l=(a*r+s*i)/(i+r);return(hI(a)+hI(s))*Math.min(Math.abs(a),Math.abs(s),.5*Math.abs(l))||0}function mI(t,e){var n=t._x1-t._x0;return n?(3*(t._y1-t._y0)/n-e)/2:e}function Y1(t,e,n){var i=t._x0,r=t._y0,a=t._x1,s=t._y1,l=(a-i)/3;t._context.bezierCurveTo(i+l,r+l*e,a-l,s-l*n,a,s)}function gx(t){this._context=t}gx.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:Y1(this,this._t0,mI(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){var n=NaN;if(t=+t,e=+e,!(t===this._x1&&e===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3,Y1(this,mI(this,n=pI(this,t,e)),n);break;default:Y1(this,this._t0,n=pI(this,t,e));break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e,this._t0=n}}};function w5(t){this._context=new E5(t)}(w5.prototype=Object.create(gx.prototype)).point=function(t,e){gx.prototype.point.call(this,e,t)};function E5(t){this._context=t}E5.prototype={moveTo:function(t,e){this._context.moveTo(e,t)},closePath:function(){this._context.closePath()},lineTo:function(t,e){this._context.lineTo(e,t)},bezierCurveTo:function(t,e,n,i,r,a){this._context.bezierCurveTo(e,t,i,n,a,r)}};function yce(t){return new gx(t)}function bce(t){return new w5(t)}function M5(t){this._context=t}M5.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var t=this._x,e=this._y,n=t.length;if(n)if(this._line?this._context.lineTo(t[0],e[0]):this._context.moveTo(t[0],e[0]),n===2)this._context.lineTo(t[1],e[1]);else for(var i=gI(t),r=gI(e),a=0,s=1;s<n;++a,++s)this._context.bezierCurveTo(i[0][a],r[0][a],i[1][a],r[1][a],t[s],e[s]);(this._line||this._line!==0&&n===1)&&this._context.closePath(),this._line=1-this._line,this._x=this._y=null},point:function(t,e){this._x.push(+t),this._y.push(+e)}};function gI(t){var e,n=t.length-1,i,r=new Array(n),a=new Array(n),s=new Array(n);for(r[0]=0,a[0]=2,s[0]=t[0]+2*t[1],e=1;e<n-1;++e)r[e]=1,a[e]=4,s[e]=4*t[e]+2*t[e+1];for(r[n-1]=2,a[n-1]=7,s[n-1]=8*t[n-1]+t[n],e=1;e<n;++e)i=r[e]/a[e-1],a[e]-=i,s[e]-=i*s[e-1];for(r[n-1]=s[n-1]/a[n-1],e=n-2;e>=0;--e)r[e]=(s[e]-r[e+1])/a[e];for(a[n-1]=(t[n]+r[n-1])/2,e=0;e<n-1;++e)a[e]=2*t[e+1]-r[e+1];return[r,a]}function _ce(t){return new M5(t)}function Ey(t,e){this._context=t,this._t=e}Ey.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=this._y=NaN,this._point=0},lineEnd:function(){0<this._t&&this._t<1&&this._point===2&&this._context.lineTo(this._x,this._y),(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line>=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:{if(this._t<=0)this._context.lineTo(this._x,e),this._context.lineTo(t,e);else{var n=this._x*(1-this._t)+t*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,e)}break}}this._x=t,this._y=e}};function Sce(t){return new Ey(t,.5)}function wce(t){return new Ey(t,0)}function Ece(t){return new Ey(t,1)}function Af(t,e){if((s=t.length)>1)for(var n=1,i,r,a=t[e[0]],s,l=a.length;n<s;++n)for(r=a,a=t[e[n]],i=0;i<l;++i)a[i][1]+=a[i][0]=isNaN(r[i][1])?r[i][0]:r[i][1]}function JM(t){for(var e=t.length,n=new Array(e);--e>=0;)n[e]=e;return n}function Mce(t,e){return t[e]}function Ace(t){const e=[];return e.key=t,e}function Tce(){var t=On([]),e=JM,n=Af,i=Mce;function r(a){var s=Array.from(t.apply(this,arguments),Ace),l,c=s.length,d=-1,f;for(const h of a)for(l=0,++d;l<c;++l)(s[l][d]=[0,+i(h,s[l].key,d,a)]).data=h;for(l=0,f=XT(e(s));l<c;++l)s[f[l]].index=l;return n(s,f),s}return r.keys=function(a){return arguments.length?(t=typeof a=="function"?a:On(Array.from(a)),r):t},r.value=function(a){return arguments.length?(i=typeof a=="function"?a:On(+a),r):i},r.order=function(a){return arguments.length?(e=a==null?JM:typeof a=="function"?a:On(Array.from(a)),r):e},r.offset=function(a){return arguments.length?(n=a??Af,r):n},r}function Cce(t,e){if((i=t.length)>0){for(var n,i,r=0,a=t[0].length,s;r<a;++r){for(s=n=0;n<i;++n)s+=t[n][r][1]||0;if(s)for(n=0;n<i;++n)t[n][r][1]/=s}Af(t,e)}}function Rce(t,e){if((r=t.length)>0){for(var n=0,i=t[e[0]],r,a=i.length;n<a;++n){for(var s=0,l=0;s<r;++s)l+=t[s][n][1]||0;i[n][1]+=i[n][0]=-l/2}Af(t,e)}}function Pce(t,e){if(!(!((s=t.length)>0)||!((a=(r=t[e[0]]).length)>0))){for(var n=0,i=1,r,a,s;i<a;++i){for(var l=0,c=0,d=0;l<s;++l){for(var f=t[e[l]],h=f[i][1]||0,g=f[i-1][1]||0,m=(h-g)/2,b=0;b<l;++b){var y=t[e[b]],x=y[i][1]||0,v=y[i-1][1]||0;m+=x-v}c+=h,d+=m*h}r[i-1][1]+=r[i-1][0]=n,c&&(n-=d/c)}r[i-1][1]+=r[i-1][0]=n,Af(t,e)}}var K1={},Z1={},vI;function Dce(){return vI||(vI=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});function e(n){return n==="__proto__"}t.isUnsafeProperty=e})(Z1)),Z1}var Q1={},xI;function A5(){return xI||(xI=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});function e(n){switch(typeof n){case"number":case"symbol":return!1;case"string":return n.includes(".")||n.includes("[")||n.includes("]")}}t.isDeepKey=e})(Q1)),Q1}var J1={},yI;function YT(){return yI||(yI=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});function e(n){return typeof n=="string"||typeof n=="symbol"?n:Object.is(n?.valueOf?.(),-0)?"-0":String(n)}t.toKey=e})(J1)),J1}var ew={},tw={},bI;function Nce(){return bI||(bI=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});function e(n){if(n==null)return"";if(typeof n=="string")return n;if(Array.isArray(n))return n.map(e).join(",");const i=String(n);return i==="0"&&Object.is(Number(n),-0)?"-0":i}t.toString=e})(tw)),tw}var _I;function KT(){return _I||(_I=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=Nce(),n=YT();function i(r){if(Array.isArray(r))return r.map(n.toKey);if(typeof r=="symbol")return[r];r=e.toString(r);const a=[],s=r.length;if(s===0)return a;let l=0,c="",d="",f=!1;for(r.charCodeAt(0)===46&&(a.push(""),l++);l<s;){const h=r[l];d?h==="\\"&&l+1<s?(l++,c+=r[l]):h===d?d="":c+=h:f?h==='"'||h==="'"?d=h:h==="]"?(f=!1,a.push(c),c=""):c+=h:h==="["?(f=!0,c&&(a.push(c),c="")):h==="."?c&&(a.push(c),c=""):c+=h,l++}return c&&a.push(c),a}t.toPath=i})(ew)),ew}var SI;function ZT(){return SI||(SI=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=Dce(),n=A5(),i=YT(),r=KT();function a(l,c,d){if(l==null)return d;switch(typeof c){case"string":{if(e.isUnsafeProperty(c))return d;const f=l[c];return f===void 0?n.isDeepKey(c)?a(l,r.toPath(c),d):d:f}case"number":case"symbol":{typeof c=="number"&&(c=i.toKey(c));const f=l[c];return f===void 0?d:f}default:{if(Array.isArray(c))return s(l,c,d);if(Object.is(c?.valueOf(),-0)?c="-0":c=String(c),e.isUnsafeProperty(c))return d;const f=l[c];return f===void 0?d:f}}}function s(l,c,d){if(c.length===0)return d;let f=l;for(let h=0;h<c.length;h++){if(f==null||e.isUnsafeProperty(c[h]))return d;f=f[c[h]]}return f===void 0?d:f}t.get=a})(K1)),K1}var nw,wI;function Oce(){return wI||(wI=1,nw=ZT().get),nw}var Lce=Oce();const Tu=Xs(Lce);var Zi=t=>t===0?0:t>0?1:-1,Ya=t=>typeof t=="number"&&t!=+t,Xo=t=>typeof t=="string"&&t.indexOf("%")===t.length-1,yt=t=>(typeof t=="number"||t instanceof Number)&&!Ya(t),Gs=t=>yt(t)||typeof t=="string",Ice=0,Yp=t=>{var e=++Ice;return"".concat(t||"").concat(e)},Er=function(e,n){var i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(!yt(e)&&typeof e!="string")return i;var a;if(Xo(e)){if(n==null)return i;var s=e.indexOf("%");a=n*parseFloat(e.slice(0,s))/100}else a=+e;return Ya(a)&&(a=i),r&&n!=null&&a>n&&(a=n),a},T5=t=>{if(!Array.isArray(t))return!1;for(var e=t.length,n={},i=0;i<e;i++)if(!n[t[i]])n[t[i]]=!0;else return!0;return!1};function Bn(t,e,n){return yt(t)&&yt(e)?t+n*(e-t):e}function C5(t,e,n){if(!(!t||!t.length))return t.find(i=>i&&(typeof e=="function"?e(i):Tu(i,e))===n)}var qn=t=>t===null||typeof t>"u",Sm=t=>qn(t)?t:"".concat(t.charAt(0).toUpperCase()).concat(t.slice(1));function Uce(t){return t!=null}function wm(){}var kce=["type","size","sizeType"];function eA(){return eA=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)({}).hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},eA.apply(null,arguments)}function EI(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),n.push.apply(n,i)}return n}function MI(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?EI(Object(n),!0).forEach(function(i){Fce(t,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):EI(Object(n)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(n,i))})}return t}function Fce(t,e,n){return(e=zce(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function zce(t){var e=Bce(t,"string");return typeof e=="symbol"?e:e+""}function Bce(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var i=n.call(t,e);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function jce(t,e){if(t==null)return{};var n,i,r=Hce(t,e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(i=0;i<a.length;i++)n=a[i],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function Hce(t,e){if(t==null)return{};var n={};for(var i in t)if({}.hasOwnProperty.call(t,i)){if(e.indexOf(i)!==-1)continue;n[i]=t[i]}return n}var R5={symbolCircle:qT,symbolCross:ice,symbolDiamond:ace,symbolSquare:sce,symbolStar:uce,symbolTriangle:dce,symbolWye:hce},Gce=Math.PI/180,Vce=t=>{var e="symbol".concat(Sm(t));return R5[e]||qT},$ce=(t,e,n)=>{if(e==="area")return t;switch(n){case"cross":return 5*t*t/9;case"diamond":return .5*t*t/Math.sqrt(3);case"square":return t*t;case"star":{var i=18*Gce;return 1.25*t*t*(Math.tan(i)-Math.tan(i*2)*Math.tan(i)**2)}case"triangle":return Math.sqrt(3)*t*t/4;case"wye":return(21-10*Math.sqrt(3))*t*t/8;default:return Math.PI*t*t/4}},Wce=(t,e)=>{R5["symbol".concat(Sm(t))]=e},QT=t=>{var{type:e="circle",size:n=64,sizeType:i="area"}=t,r=jce(t,kce),a=MI(MI({},r),{},{type:e,size:n,sizeType:i}),s="circle";typeof e=="string"&&(s=e);var l=()=>{var g=Vce(s),m=pce().type(g).size($ce(n,i,s)),b=m();if(b!==null)return b},{className:c,cx:d,cy:f}=a,h=kr(a);return yt(d)&&yt(f)&&yt(n)?T.createElement("path",eA({},h,{className:dn("recharts-symbols",c),transform:"translate(".concat(d,", ").concat(f,")"),d:l()})):null};QT.registerSymbol=Wce;var P5=t=>"radius"in t&&"startAngle"in t&&"endAngle"in t,JT=(t,e)=>{if(!t||typeof t=="function"||typeof t=="boolean")return null;var n=t;if(T.isValidElement(t)&&(n=t.props),typeof n!="object"&&typeof n!="function")return null;var i={};return Object.keys(n).forEach(r=>{VT(r)&&(i[r]=(a=>n[r](n,a)))}),i},Xce=(t,e,n)=>i=>(t(e,n,i),null),Em=(t,e,n)=>{if(t===null||typeof t!="object"&&typeof t!="function")return null;var i=null;return Object.keys(t).forEach(r=>{var a=t[r];VT(r)&&typeof a=="function"&&(i||(i={}),i[r]=Xce(a,e,n))}),i};function AI(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),n.push.apply(n,i)}return n}function qce(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?AI(Object(n),!0).forEach(function(i){Yce(t,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):AI(Object(n)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(n,i))})}return t}function Yce(t,e,n){return(e=Kce(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Kce(t){var e=Zce(t,"string");return typeof e=="symbol"?e:e+""}function Zce(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var i=n.call(t,e);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Si(t,e){var n=qce({},t),i=e,r=Object.keys(e),a=r.reduce((s,l)=>(s[l]===void 0&&i[l]!==void 0&&(s[l]=i[l]),s),n);return a}function vx(){return vx=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)({}).hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},vx.apply(null,arguments)}function TI(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),n.push.apply(n,i)}return n}function Qce(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?TI(Object(n),!0).forEach(function(i){Jce(t,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):TI(Object(n)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(n,i))})}return t}function Jce(t,e,n){return(e=eue(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function eue(t){var e=tue(t,"string");return typeof e=="symbol"?e:e+""}function tue(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var i=n.call(t,e);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var ka=32,nue={align:"center",iconSize:14,inactiveColor:"#ccc",layout:"horizontal",verticalAlign:"middle"};function iue(t){var{data:e,iconType:n,inactiveColor:i}=t,r=ka/2,a=ka/6,s=ka/3,l=e.inactive?i:e.color,c=n??e.type;if(c==="none")return null;if(c==="plainline"){var d;return T.createElement("line",{strokeWidth:4,fill:"none",stroke:l,strokeDasharray:(d=e.payload)===null||d===void 0?void 0:d.strokeDasharray,x1:0,y1:r,x2:ka,y2:r,className:"recharts-legend-icon"})}if(c==="line")return T.createElement("path",{strokeWidth:4,fill:"none",stroke:l,d:"M0,".concat(r,"h").concat(s,`
  8060. A`).concat(a,",").concat(a,",0,1,1,").concat(2*s,",").concat(r,`
  8061. H`).concat(ka,"M").concat(2*s,",").concat(r,`
  8062. A`).concat(a,",").concat(a,",0,1,1,").concat(s,",").concat(r),className:"recharts-legend-icon"});if(c==="rect")return T.createElement("path",{stroke:"none",fill:l,d:"M0,".concat(ka/8,"h").concat(ka,"v").concat(ka*3/4,"h").concat(-ka,"z"),className:"recharts-legend-icon"});if(T.isValidElement(e.legendIcon)){var f=Qce({},e);return delete f.legendIcon,T.cloneElement(e.legendIcon,f)}return T.createElement(QT,{fill:l,cx:r,cy:r,size:ka,sizeType:"diameter",type:c})}function rue(t){var{payload:e,iconSize:n,layout:i,formatter:r,inactiveColor:a,iconType:s}=t,l={x:0,y:0,width:ka,height:ka},c={display:i==="horizontal"?"inline-block":"block",marginRight:10},d={display:"inline-block",verticalAlign:"middle",marginRight:4};return e.map((f,h)=>{var g=f.formatter||r,m=dn({"recharts-legend-item":!0,["legend-item-".concat(h)]:!0,inactive:f.inactive});if(f.type==="none")return null;var b=f.inactive?a:f.color,y=g?g(f.value,f,h):f.value;return T.createElement("li",vx({className:m,style:c,key:"legend-item-".concat(h)},Em(t,f,h)),T.createElement($T,{width:n,height:n,viewBox:l,style:d,"aria-label":"".concat(y," legend icon")},T.createElement(iue,{data:f,iconType:s,inactiveColor:a})),T.createElement("span",{className:"recharts-legend-item-text",style:{color:b}},y))})}var aue=t=>{var e=Si(t,nue),{payload:n,layout:i,align:r}=e;if(!n||!n.length)return null;var a={padding:0,margin:0,textAlign:i==="horizontal"?r:"left"};return T.createElement("ul",{className:"recharts-default-legend",style:a},T.createElement(rue,vx({},e,{payload:n})))},iw={},rw={},CI;function sue(){return CI||(CI=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});function e(n,i){const r=new Map;for(let a=0;a<n.length;a++){const s=n[a],l=i(s);r.has(l)||r.set(l,s)}return Array.from(r.values())}t.uniqBy=e})(rw)),rw}var aw={},RI;function D5(){return RI||(RI=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});function e(n){return n}t.identity=e})(aw)),aw}var sw={},ow={},lw={},PI;function oue(){return PI||(PI=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});function e(n){return Number.isSafeInteger(n)&&n>=0}t.isLength=e})(lw)),lw}var DI;function e2(){return DI||(DI=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=oue();function n(i){return i!=null&&typeof i!="function"&&e.isLength(i.length)}t.isArrayLike=n})(ow)),ow}var cw={},NI;function lue(){return NI||(NI=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});function e(n){return typeof n=="object"&&n!==null}t.isObjectLike=e})(cw)),cw}var OI;function cue(){return OI||(OI=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=e2(),n=lue();function i(r){return n.isObjectLike(r)&&e.isArrayLike(r)}t.isArrayLikeObject=i})(sw)),sw}var uw={},dw={},LI;function uue(){return LI||(LI=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=ZT();function n(i){return function(r){return e.get(r,i)}}t.property=n})(dw)),dw}var fw={},hw={},pw={},mw={},II;function N5(){return II||(II=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});function e(n){return n!==null&&(typeof n=="object"||typeof n=="function")}t.isObject=e})(mw)),mw}var gw={},UI;function O5(){return UI||(UI=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});function e(n){return n==null||typeof n!="object"&&typeof n!="function"}t.isPrimitive=e})(gw)),gw}var vw={},kI;function L5(){return kI||(kI=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});function e(n,i){return n===i||Number.isNaN(n)&&Number.isNaN(i)}t.eq=e})(vw)),vw}var FI;function due(){return FI||(FI=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=N5(),n=O5(),i=L5();function r(f,h,g){return typeof g!="function"?r(f,h,()=>{}):a(f,h,function m(b,y,x,v,w,S){const A=g(b,y,x,v,w,S);return A!==void 0?!!A:a(b,y,m,S)},new Map)}function a(f,h,g,m){if(h===f)return!0;switch(typeof h){case"object":return s(f,h,g,m);case"function":return Object.keys(h).length>0?a(f,{...h},g,m):i.eq(f,h);default:return e.isObject(f)?typeof h=="string"?h==="":!0:i.eq(f,h)}}function s(f,h,g,m){if(h==null)return!0;if(Array.isArray(h))return c(f,h,g,m);if(h instanceof Map)return l(f,h,g,m);if(h instanceof Set)return d(f,h,g,m);const b=Object.keys(h);if(f==null)return b.length===0;if(b.length===0)return!0;if(m?.has(h))return m.get(h)===f;m?.set(h,f);try{for(let y=0;y<b.length;y++){const x=b[y];if(!n.isPrimitive(f)&&!(x in f)||h[x]===void 0&&f[x]!==void 0||h[x]===null&&f[x]!==null||!g(f[x],h[x],x,f,h,m))return!1}return!0}finally{m?.delete(h)}}function l(f,h,g,m){if(h.size===0)return!0;if(!(f instanceof Map))return!1;for(const[b,y]of h.entries()){const x=f.get(b);if(g(x,y,b,f,h,m)===!1)return!1}return!0}function c(f,h,g,m){if(h.length===0)return!0;if(!Array.isArray(f))return!1;const b=new Set;for(let y=0;y<h.length;y++){const x=h[y];let v=!1;for(let w=0;w<f.length;w++){if(b.has(w))continue;const S=f[w];let A=!1;if(g(S,x,y,f,h,m)&&(A=!0),A){b.add(w),v=!0;break}}if(!v)return!1}return!0}function d(f,h,g,m){return h.size===0?!0:f instanceof Set?c([...f],[...h],g,m):!1}t.isMatchWith=r,t.isSetMatch=d})(pw)),pw}var zI;function I5(){return zI||(zI=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=due();function n(i,r){return e.isMatchWith(i,r,()=>{})}t.isMatch=n})(hw)),hw}var xw={},yw={},bw={},BI;function fue(){return BI||(BI=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});function e(n){return Object.getOwnPropertySymbols(n).filter(i=>Object.prototype.propertyIsEnumerable.call(n,i))}t.getSymbols=e})(bw)),bw}var _w={},jI;function U5(){return jI||(jI=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});function e(n){return n==null?n===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(n)}t.getTag=e})(_w)),_w}var Sw={},HI;function k5(){return HI||(HI=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e="[object RegExp]",n="[object String]",i="[object Number]",r="[object Boolean]",a="[object Arguments]",s="[object Symbol]",l="[object Date]",c="[object Map]",d="[object Set]",f="[object Array]",h="[object Function]",g="[object ArrayBuffer]",m="[object Object]",b="[object Error]",y="[object DataView]",x="[object Uint8Array]",v="[object Uint8ClampedArray]",w="[object Uint16Array]",S="[object Uint32Array]",A="[object BigUint64Array]",R="[object Int8Array]",N="[object Int16Array]",C="[object Int32Array]",F="[object BigInt64Array]",P="[object Float32Array]",L="[object Float64Array]";t.argumentsTag=a,t.arrayBufferTag=g,t.arrayTag=f,t.bigInt64ArrayTag=F,t.bigUint64ArrayTag=A,t.booleanTag=r,t.dataViewTag=y,t.dateTag=l,t.errorTag=b,t.float32ArrayTag=P,t.float64ArrayTag=L,t.functionTag=h,t.int16ArrayTag=N,t.int32ArrayTag=C,t.int8ArrayTag=R,t.mapTag=c,t.numberTag=i,t.objectTag=m,t.regexpTag=e,t.setTag=d,t.stringTag=n,t.symbolTag=s,t.uint16ArrayTag=w,t.uint32ArrayTag=S,t.uint8ArrayTag=x,t.uint8ClampedArrayTag=v})(Sw)),Sw}var ww={},GI;function hue(){return GI||(GI=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});function e(n){return ArrayBuffer.isView(n)&&!(n instanceof DataView)}t.isTypedArray=e})(ww)),ww}var VI;function F5(){return VI||(VI=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=fue(),n=U5(),i=k5(),r=O5(),a=hue();function s(f,h){return l(f,void 0,f,new Map,h)}function l(f,h,g,m=new Map,b=void 0){const y=b?.(f,h,g,m);if(y!==void 0)return y;if(r.isPrimitive(f))return f;if(m.has(f))return m.get(f);if(Array.isArray(f)){const x=new Array(f.length);m.set(f,x);for(let v=0;v<f.length;v++)x[v]=l(f[v],v,g,m,b);return Object.hasOwn(f,"index")&&(x.index=f.index),Object.hasOwn(f,"input")&&(x.input=f.input),x}if(f instanceof Date)return new Date(f.getTime());if(f instanceof RegExp){const x=new RegExp(f.source,f.flags);return x.lastIndex=f.lastIndex,x}if(f instanceof Map){const x=new Map;m.set(f,x);for(const[v,w]of f)x.set(v,l(w,v,g,m,b));return x}if(f instanceof Set){const x=new Set;m.set(f,x);for(const v of f)x.add(l(v,void 0,g,m,b));return x}if(typeof Buffer<"u"&&Buffer.isBuffer(f))return f.subarray();if(a.isTypedArray(f)){const x=new(Object.getPrototypeOf(f)).constructor(f.length);m.set(f,x);for(let v=0;v<f.length;v++)x[v]=l(f[v],v,g,m,b);return x}if(f instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&f instanceof SharedArrayBuffer)return f.slice(0);if(f instanceof DataView){const x=new DataView(f.buffer.slice(0),f.byteOffset,f.byteLength);return m.set(f,x),c(x,f,g,m,b),x}if(typeof File<"u"&&f instanceof File){const x=new File([f],f.name,{type:f.type});return m.set(f,x),c(x,f,g,m,b),x}if(typeof Blob<"u"&&f instanceof Blob){const x=new Blob([f],{type:f.type});return m.set(f,x),c(x,f,g,m,b),x}if(f instanceof Error){const x=new f.constructor;return m.set(f,x),x.message=f.message,x.name=f.name,x.stack=f.stack,x.cause=f.cause,c(x,f,g,m,b),x}if(f instanceof Boolean){const x=new Boolean(f.valueOf());return m.set(f,x),c(x,f,g,m,b),x}if(f instanceof Number){const x=new Number(f.valueOf());return m.set(f,x),c(x,f,g,m,b),x}if(f instanceof String){const x=new String(f.valueOf());return m.set(f,x),c(x,f,g,m,b),x}if(typeof f=="object"&&d(f)){const x=Object.create(Object.getPrototypeOf(f));return m.set(f,x),c(x,f,g,m,b),x}return f}function c(f,h,g=f,m,b){const y=[...Object.keys(h),...e.getSymbols(h)];for(let x=0;x<y.length;x++){const v=y[x],w=Object.getOwnPropertyDescriptor(f,v);(w==null||w.writable)&&(f[v]=l(h[v],v,g,m,b))}}function d(f){switch(n.getTag(f)){case i.argumentsTag:case i.arrayTag:case i.arrayBufferTag:case i.dataViewTag:case i.booleanTag:case i.dateTag:case i.float32ArrayTag:case i.float64ArrayTag:case i.int8ArrayTag:case i.int16ArrayTag:case i.int32ArrayTag:case i.mapTag:case i.numberTag:case i.objectTag:case i.regexpTag:case i.setTag:case i.stringTag:case i.symbolTag:case i.uint8ArrayTag:case i.uint8ClampedArrayTag:case i.uint16ArrayTag:case i.uint32ArrayTag:return!0;default:return!1}}t.cloneDeepWith=s,t.cloneDeepWithImpl=l,t.copyProperties=c})(yw)),yw}var $I;function pue(){return $I||($I=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=F5();function n(i){return e.cloneDeepWithImpl(i,void 0,i,new Map,void 0)}t.cloneDeep=n})(xw)),xw}var WI;function mue(){return WI||(WI=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=I5(),n=pue();function i(r){return r=n.cloneDeep(r),a=>e.isMatch(a,r)}t.matches=i})(fw)),fw}var Ew={},Mw={},Aw={},XI;function gue(){return XI||(XI=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=F5(),n=k5();function i(r,a){return e.cloneDeepWith(r,(s,l,c,d)=>{const f=a?.(s,l,c,d);if(f!==void 0)return f;if(typeof r=="object")switch(Object.prototype.toString.call(r)){case n.numberTag:case n.stringTag:case n.booleanTag:{const h=new r.constructor(r?.valueOf());return e.copyProperties(h,r),h}case n.argumentsTag:{const h={};return e.copyProperties(h,r),h.length=r.length,h[Symbol.iterator]=r[Symbol.iterator],h}default:return}})}t.cloneDeepWith=i})(Aw)),Aw}var qI;function vue(){return qI||(qI=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=gue();function n(i){return e.cloneDeepWith(i)}t.cloneDeep=n})(Mw)),Mw}var Tw={},Cw={},YI;function z5(){return YI||(YI=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=/^(?:0|[1-9]\d*)$/;function n(i,r=Number.MAX_SAFE_INTEGER){switch(typeof i){case"number":return Number.isInteger(i)&&i>=0&&i<r;case"symbol":return!1;case"string":return e.test(i)}}t.isIndex=n})(Cw)),Cw}var Rw={},KI;function xue(){return KI||(KI=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=U5();function n(i){return i!==null&&typeof i=="object"&&e.getTag(i)==="[object Arguments]"}t.isArguments=n})(Rw)),Rw}var ZI;function yue(){return ZI||(ZI=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=A5(),n=z5(),i=xue(),r=KT();function a(s,l){let c;if(Array.isArray(l)?c=l:typeof l=="string"&&e.isDeepKey(l)&&s?.[l]==null?c=r.toPath(l):c=[l],c.length===0)return!1;let d=s;for(let f=0;f<c.length;f++){const h=c[f];if((d==null||!Object.hasOwn(d,h))&&!((Array.isArray(d)||i.isArguments(d))&&n.isIndex(h)&&h<d.length))return!1;d=d[h]}return!0}t.has=a})(Tw)),Tw}var QI;function bue(){return QI||(QI=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=I5(),n=YT(),i=vue(),r=ZT(),a=yue();function s(l,c){switch(typeof l){case"object":{Object.is(l?.valueOf(),-0)&&(l="-0");break}case"number":{l=n.toKey(l);break}}return c=i.cloneDeep(c),function(d){const f=r.get(d,l);return f===void 0?a.has(d,l):c===void 0?f===void 0:e.isMatch(f,c)}}t.matchesProperty=s})(Ew)),Ew}var JI;function _ue(){return JI||(JI=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=D5(),n=uue(),i=mue(),r=bue();function a(s){if(s==null)return e.identity;switch(typeof s){case"function":return s;case"object":return Array.isArray(s)&&s.length===2?r.matchesProperty(s[0],s[1]):i.matches(s);case"string":case"symbol":case"number":return n.property(s)}}t.iteratee=a})(uw)),uw}var eU;function Sue(){return eU||(eU=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=sue(),n=D5(),i=cue(),r=_ue();function a(s,l=n.identity){return i.isArrayLikeObject(s)?e.uniqBy(Array.from(s),r.iteratee(l)):[]}t.uniqBy=a})(iw)),iw}var Pw,tU;function wue(){return tU||(tU=1,Pw=Sue().uniqBy),Pw}var Eue=wue();const nU=Xs(Eue);function B5(t,e,n){return e===!0?nU(t,n):typeof e=="function"?nU(t,e):t}var Dw={exports:{}},Nw={},Ow={exports:{}},Lw={};var iU;function Mue(){if(iU)return Lw;iU=1;var t=If();function e(h,g){return h===g&&(h!==0||1/h===1/g)||h!==h&&g!==g}var n=typeof Object.is=="function"?Object.is:e,i=t.useState,r=t.useEffect,a=t.useLayoutEffect,s=t.useDebugValue;function l(h,g){var m=g(),b=i({inst:{value:m,getSnapshot:g}}),y=b[0].inst,x=b[1];return a(function(){y.value=m,y.getSnapshot=g,c(y)&&x({inst:y})},[h,m,g]),r(function(){return c(y)&&x({inst:y}),h(function(){c(y)&&x({inst:y})})},[h]),s(m),m}function c(h){var g=h.getSnapshot;h=h.value;try{var m=g();return!n(h,m)}catch{return!0}}function d(h,g){return g()}var f=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?d:l;return Lw.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:f,Lw}var rU;function Aue(){return rU||(rU=1,Ow.exports=Mue()),Ow.exports}var aU;function Tue(){if(aU)return Nw;aU=1;var t=If(),e=Aue();function n(d,f){return d===f&&(d!==0||1/d===1/f)||d!==d&&f!==f}var i=typeof Object.is=="function"?Object.is:n,r=e.useSyncExternalStore,a=t.useRef,s=t.useEffect,l=t.useMemo,c=t.useDebugValue;return Nw.useSyncExternalStoreWithSelector=function(d,f,h,g,m){var b=a(null);if(b.current===null){var y={hasValue:!1,value:null};b.current=y}else y=b.current;b=l(function(){function v(N){if(!w){if(w=!0,S=N,N=g(N),m!==void 0&&y.hasValue){var C=y.value;if(m(C,N))return A=C}return A=N}if(C=A,i(S,N))return C;var F=g(N);return m!==void 0&&m(C,F)?(S=N,C):(S=N,A=F)}var w=!1,S,A,R=h===void 0?null:h;return[function(){return v(f())},R===null?void 0:function(){return v(R())}]},[f,h,g,m]);var x=r(d,b[0],b[1]);return s(function(){y.hasValue=!0,y.value=x},[x]),c(x),x},Nw}var sU;function Cue(){return sU||(sU=1,Dw.exports=Tue()),Dw.exports}var Rue=Cue(),t2=T.createContext(null),Pue=t=>t,In=()=>{var t=T.useContext(t2);return t?t.store.dispatch:Pue},zv=()=>{},Due=()=>zv,Nue=(t,e)=>t===e;function bt(t){var e=T.useContext(t2);return Rue.useSyncExternalStoreWithSelector(e?e.subscription.addNestedSub:Due,e?e.store.getState:zv,e?e.store.getState:zv,e?t:zv,Nue)}function Oue(t,e=`expected a function, instead received ${typeof t}`){if(typeof t!="function")throw new TypeError(e)}function Lue(t,e=`expected an object, instead received ${typeof t}`){if(typeof t!="object")throw new TypeError(e)}function Iue(t,e="expected all items to be functions, instead received the following types: "){if(!t.every(n=>typeof n=="function")){const n=t.map(i=>typeof i=="function"?`function ${i.name||"unnamed"}()`:typeof i).join(", ");throw new TypeError(`${e}[${n}]`)}}var oU=t=>Array.isArray(t)?t:[t];function Uue(t){const e=Array.isArray(t[0])?t[0]:t;return Iue(e,"createSelector expects all input-selectors to be functions, but received the following types: "),e}function kue(t,e){const n=[],{length:i}=t;for(let r=0;r<i;r++)n.push(t[r].apply(null,e));return n}var Fue=class{constructor(t){this.value=t}deref(){return this.value}},zue=typeof WeakRef<"u"?WeakRef:Fue,Bue=0,lU=1;function uv(){return{s:Bue,v:void 0,o:null,p:null}}function j5(t,e={}){let n=uv();const{resultEqualityCheck:i}=e;let r,a=0;function s(){let l=n;const{length:c}=arguments;for(let h=0,g=c;h<g;h++){const m=arguments[h];if(typeof m=="function"||typeof m=="object"&&m!==null){let b=l.o;b===null&&(l.o=b=new WeakMap);const y=b.get(m);y===void 0?(l=uv(),b.set(m,l)):l=y}else{let b=l.p;b===null&&(l.p=b=new Map);const y=b.get(m);y===void 0?(l=uv(),b.set(m,l)):l=y}}const d=l;let f;if(l.s===lU)f=l.v;else if(f=t.apply(null,arguments),a++,i){const h=r?.deref?.()??r;h!=null&&i(h,f)&&(f=h,a!==0&&a--),r=typeof f=="object"&&f!==null||typeof f=="function"?new zue(f):f}return d.s=lU,d.v=f,f}return s.clearCache=()=>{n=uv(),s.resetResultsCount()},s.resultsCount=()=>a,s.resetResultsCount=()=>{a=0},s}function jue(t,...e){const n=typeof t=="function"?{memoize:t,memoizeOptions:e}:t,i=(...r)=>{let a=0,s=0,l,c={},d=r.pop();typeof d=="object"&&(c=d,d=r.pop()),Oue(d,`createSelector expects an output function after the inputs, but received: [${typeof d}]`);const f={...n,...c},{memoize:h,memoizeOptions:g=[],argsMemoize:m=j5,argsMemoizeOptions:b=[]}=f,y=oU(g),x=oU(b),v=Uue(r),w=h(function(){return a++,d.apply(null,arguments)},...y),S=m(function(){s++;const R=kue(v,arguments);return l=w.apply(null,R),l},...x);return Object.assign(S,{resultFunc:d,memoizedResultFunc:w,dependencies:v,dependencyRecomputations:()=>s,resetDependencyRecomputations:()=>{s=0},lastResult:()=>l,recomputations:()=>a,resetRecomputations:()=>{a=0},memoize:h,argsMemoize:m})};return Object.assign(i,{withTypes:()=>i}),i}var He=jue(j5),Hue=Object.assign((t,e=He)=>{Lue(t,`createStructuredSelector expects first argument to be an object where each property is a selector, instead received a ${typeof t}`);const n=Object.keys(t),i=n.map(a=>t[a]);return e(i,(...a)=>a.reduce((s,l,c)=>(s[n[c]]=l,s),{}))},{withTypes:()=>Hue}),Iw={},Uw={},kw={},cU;function Gue(){return cU||(cU=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});function e(i){return typeof i=="symbol"?1:i===null?2:i===void 0?3:i!==i?4:0}const n=(i,r,a)=>{if(i!==r){const s=e(i),l=e(r);if(s===l&&s===0){if(i<r)return a==="desc"?1:-1;if(i>r)return a==="desc"?-1:1}return a==="desc"?l-s:s-l}return 0};t.compareValues=n})(kw)),kw}var Fw={},zw={},uU;function H5(){return uU||(uU=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});function e(n){return typeof n=="symbol"||n instanceof Symbol}t.isSymbol=e})(zw)),zw}var dU;function Vue(){return dU||(dU=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=H5(),n=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,i=/^\w*$/;function r(a,s){return Array.isArray(a)?!1:typeof a=="number"||typeof a=="boolean"||a==null||e.isSymbol(a)?!0:typeof a=="string"&&(i.test(a)||!n.test(a))||s!=null&&Object.hasOwn(s,a)}t.isKey=r})(Fw)),Fw}var fU;function $ue(){return fU||(fU=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=Gue(),n=Vue(),i=KT();function r(a,s,l,c){if(a==null)return[];l=c?void 0:l,Array.isArray(a)||(a=Object.values(a)),Array.isArray(s)||(s=s==null?[null]:[s]),s.length===0&&(s=[null]),Array.isArray(l)||(l=l==null?[]:[l]),l=l.map(m=>String(m));const d=(m,b)=>{let y=m;for(let x=0;x<b.length&&y!=null;++x)y=y[b[x]];return y},f=(m,b)=>b==null||m==null?b:typeof m=="object"&&"key"in m?Object.hasOwn(b,m.key)?b[m.key]:d(b,m.path):typeof m=="function"?m(b):Array.isArray(m)?d(b,m):typeof b=="object"?b[m]:b,h=s.map(m=>(Array.isArray(m)&&m.length===1&&(m=m[0]),m==null||typeof m=="function"||Array.isArray(m)||n.isKey(m)?m:{key:m,path:i.toPath(m)}));return a.map(m=>({original:m,criteria:h.map(b=>f(b,m))})).slice().sort((m,b)=>{for(let y=0;y<h.length;y++){const x=e.compareValues(m.criteria[y],b.criteria[y],l[y]);if(x!==0)return x}return 0}).map(m=>m.original)}t.orderBy=r})(Uw)),Uw}var Bw={},hU;function Wue(){return hU||(hU=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});function e(n,i=1){const r=[],a=Math.floor(i),s=(l,c)=>{for(let d=0;d<l.length;d++){const f=l[d];Array.isArray(f)&&c<a?s(f,c+1):r.push(f)}};return s(n,0),r}t.flatten=e})(Bw)),Bw}var jw={},pU;function G5(){return pU||(pU=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=z5(),n=e2(),i=N5(),r=L5();function a(s,l,c){return i.isObject(c)&&(typeof l=="number"&&n.isArrayLike(c)&&e.isIndex(l)&&l<c.length||typeof l=="string"&&l in c)?r.eq(c[l],s):!1}t.isIterateeCall=a})(jw)),jw}var mU;function Xue(){return mU||(mU=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=$ue(),n=Wue(),i=G5();function r(a,...s){const l=s.length;return l>1&&i.isIterateeCall(a,s[0],s[1])?s=[]:l>2&&i.isIterateeCall(s[0],s[1],s[2])&&(s=[s[0]]),e.orderBy(a,n.flatten(s),["asc"])}t.sortBy=r})(Iw)),Iw}var Hw,gU;function que(){return gU||(gU=1,Hw=Xue().sortBy),Hw}var Yue=que();const My=Xs(Yue);var V5=t=>t.legend.settings,Kue=t=>t.legend.size,Zue=t=>t.legend.payload,Que=He([Zue,V5],(t,e)=>{var{itemSorter:n}=e,i=t.flat(1);return n?My(i,n):i});function Jue(){return bt(Que)}var dv=1;function $5(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],[e,n]=T.useState({height:0,left:0,top:0,width:0}),i=T.useCallback(r=>{if(r!=null){var a=r.getBoundingClientRect(),s={height:a.height,left:a.left,top:a.top,width:a.width};(Math.abs(s.height-e.height)>dv||Math.abs(s.left-e.left)>dv||Math.abs(s.top-e.top)>dv||Math.abs(s.width-e.width)>dv)&&n({height:s.height,left:s.left,top:s.top,width:s.width})}},[e.width,e.height,e.top,e.left,...t]);return[e,i]}function ur(t){return`Minified Redux error #${t}; visit https://redux.js.org/Errors?code=${t} for the full message or use the non-minified dev environment for full errors. `}var ede=typeof Symbol=="function"&&Symbol.observable||"@@observable",vU=ede,Gw=()=>Math.random().toString(36).substring(7).split("").join("."),tde={INIT:`@@redux/INIT${Gw()}`,REPLACE:`@@redux/REPLACE${Gw()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${Gw()}`},xx=tde;function n2(t){if(typeof t!="object"||t===null)return!1;let e=t;for(;Object.getPrototypeOf(e)!==null;)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e||Object.getPrototypeOf(t)===null}function W5(t,e,n){if(typeof t!="function")throw new Error(ur(2));if(typeof e=="function"&&typeof n=="function"||typeof n=="function"&&typeof arguments[3]=="function")throw new Error(ur(0));if(typeof e=="function"&&typeof n>"u"&&(n=e,e=void 0),typeof n<"u"){if(typeof n!="function")throw new Error(ur(1));return n(W5)(t,e)}let i=t,r=e,a=new Map,s=a,l=0,c=!1;function d(){s===a&&(s=new Map,a.forEach((x,v)=>{s.set(v,x)}))}function f(){if(c)throw new Error(ur(3));return r}function h(x){if(typeof x!="function")throw new Error(ur(4));if(c)throw new Error(ur(5));let v=!0;d();const w=l++;return s.set(w,x),function(){if(v){if(c)throw new Error(ur(6));v=!1,d(),s.delete(w),a=null}}}function g(x){if(!n2(x))throw new Error(ur(7));if(typeof x.type>"u")throw new Error(ur(8));if(typeof x.type!="string")throw new Error(ur(17));if(c)throw new Error(ur(9));try{c=!0,r=i(r,x)}finally{c=!1}return(a=s).forEach(w=>{w()}),x}function m(x){if(typeof x!="function")throw new Error(ur(10));i=x,g({type:xx.REPLACE})}function b(){const x=h;return{subscribe(v){if(typeof v!="object"||v===null)throw new Error(ur(11));function w(){const A=v;A.next&&A.next(f())}return w(),{unsubscribe:x(w)}},[vU](){return this}}}return g({type:xx.INIT}),{dispatch:g,subscribe:h,getState:f,replaceReducer:m,[vU]:b}}function nde(t){Object.keys(t).forEach(e=>{const n=t[e];if(typeof n(void 0,{type:xx.INIT})>"u")throw new Error(ur(12));if(typeof n(void 0,{type:xx.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(ur(13))})}function X5(t){const e=Object.keys(t),n={};for(let a=0;a<e.length;a++){const s=e[a];typeof t[s]=="function"&&(n[s]=t[s])}const i=Object.keys(n);let r;try{nde(n)}catch(a){r=a}return function(s={},l){if(r)throw r;let c=!1;const d={};for(let f=0;f<i.length;f++){const h=i[f],g=n[h],m=s[h],b=g(m,l);if(typeof b>"u")throw l&&l.type,new Error(ur(14));d[h]=b,c=c||b!==m}return c=c||i.length!==Object.keys(s).length,c?d:s}}function yx(...t){return t.length===0?e=>e:t.length===1?t[0]:t.reduce((e,n)=>(...i)=>e(n(...i)))}function ide(...t){return e=>(n,i)=>{const r=e(n,i);let a=()=>{throw new Error(ur(15))};const s={getState:r.getState,dispatch:(c,...d)=>a(c,...d)},l=t.map(c=>c(s));return a=yx(...l)(r.dispatch),{...r,dispatch:a}}}function q5(t){return n2(t)&&"type"in t&&typeof t.type=="string"}var Y5=Symbol.for("immer-nothing"),xU=Symbol.for("immer-draftable"),Fr=Symbol.for("immer-state");function fs(t,...e){throw new Error(`[Immer] minified error nr: ${t}. Full error at: https://bit.ly/3cXEKWf`)}var va=Object,Tf=va.getPrototypeOf,bx="constructor",Ay="prototype",tA="configurable",_x="enumerable",Bv="writable",Kp="value",qo=t=>!!t&&!!t[Fr];function bs(t){return t?K5(t)||Ty(t)||!!t[xU]||!!t[bx]?.[xU]||Cy(t)||Ry(t):!1}var rde=va[Ay][bx].toString(),yU=new WeakMap;function K5(t){if(!t||!i2(t))return!1;const e=Tf(t);if(e===null||e===va[Ay])return!0;const n=va.hasOwnProperty.call(e,bx)&&e[bx];if(n===Object)return!0;if(!Jd(n))return!1;let i=yU.get(n);return i===void 0&&(i=Function.toString.call(n),yU.set(n,i)),i===rde}function Mm(t,e,n=!0){Am(t)===0?(n?Reflect.ownKeys(t):va.keys(t)).forEach(r=>{e(r,t[r],t)}):t.forEach((i,r)=>e(r,i,t))}function Am(t){const e=t[Fr];return e?e.type_:Ty(t)?1:Cy(t)?2:Ry(t)?3:0}var bU=(t,e,n=Am(t))=>n===2?t.has(e):va[Ay].hasOwnProperty.call(t,e),nA=(t,e,n=Am(t))=>n===2?t.get(e):t[e],Sx=(t,e,n,i=Am(t))=>{i===2?t.set(e,n):i===3?t.add(n):t[e]=n};function ade(t,e){return t===e?t!==0||1/t===1/e:t!==t&&e!==e}var Ty=Array.isArray,Cy=t=>t instanceof Map,Ry=t=>t instanceof Set,i2=t=>typeof t=="object",Jd=t=>typeof t=="function",Vw=t=>typeof t=="boolean",Ro=t=>t.copy_||t.base_,r2=t=>t.modified_?t.copy_:t.base_;function iA(t,e){if(Cy(t))return new Map(t);if(Ry(t))return new Set(t);if(Ty(t))return Array[Ay].slice.call(t);const n=K5(t);if(e===!0||e==="class_only"&&!n){const i=va.getOwnPropertyDescriptors(t);delete i[Fr];let r=Reflect.ownKeys(i);for(let a=0;a<r.length;a++){const s=r[a],l=i[s];l[Bv]===!1&&(l[Bv]=!0,l[tA]=!0),(l.get||l.set)&&(i[s]={[tA]:!0,[Bv]:!0,[_x]:l[_x],[Kp]:t[s]})}return va.create(Tf(t),i)}else{const i=Tf(t);if(i!==null&&n)return{...t};const r=va.create(i);return va.assign(r,t)}}function a2(t,e=!1){return Py(t)||qo(t)||!bs(t)||(Am(t)>1&&va.defineProperties(t,{set:fv,add:fv,clear:fv,delete:fv}),va.freeze(t),e&&Mm(t,(n,i)=>{a2(i,!0)},!1)),t}function sde(){fs(2)}var fv={[Kp]:sde};function Py(t){return t===null||!i2(t)?!0:va.isFrozen(t)}var wx="MapSet",rA="Patches",Z5={};function Cf(t){const e=Z5[t];return e||fs(0,t),e}var ode=t=>!!Z5[t],Zp,Q5=()=>Zp,lde=(t,e)=>({drafts_:[],parent_:t,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:ode(wx)?Cf(wx):void 0});function _U(t,e){e&&(t.patchPlugin_=Cf(rA),t.patches_=[],t.inversePatches_=[],t.patchListener_=e)}function aA(t){sA(t),t.drafts_.forEach(cde),t.drafts_=null}function sA(t){t===Zp&&(Zp=t.parent_)}var SU=t=>Zp=lde(Zp,t);function cde(t){const e=t[Fr];e.type_===0||e.type_===1?e.revoke_():e.revoked_=!0}function wU(t,e){e.unfinalizedDrafts_=e.drafts_.length;const n=e.drafts_[0];if(t!==void 0&&t!==n){n[Fr].modified_&&(aA(e),fs(4)),bs(t)&&(t=EU(e,t));const{patchPlugin_:r}=e;r&&r.generateReplacementPatches_(n[Fr].base_,t,e)}else t=EU(e,n);return ude(e,t,!0),aA(e),e.patches_&&e.patchListener_(e.patches_,e.inversePatches_),t!==Y5?t:void 0}function EU(t,e){if(Py(e))return e;const n=e[Fr];if(!n)return s2(e,t.handledSet_,t);if(!Dy(n,t))return e;if(!n.modified_)return n.base_;if(!n.finalized_){const{callbacks_:i}=n;if(i)for(;i.length>0;)i.pop()(t);tj(n,t)}return n.copy_}function ude(t,e,n=!1){!t.parent_&&t.immer_.autoFreeze_&&t.canAutoFreeze_&&a2(e,n)}function J5(t){t.finalized_=!0,t.scope_.unfinalizedDrafts_--}var Dy=(t,e)=>t.scope_===e,dde=[];function ej(t,e,n,i){const r=Ro(t),a=t.type_;if(i!==void 0&&nA(r,i,a)===e){Sx(r,i,n,a);return}if(!t.draftLocations_){const l=t.draftLocations_=new Map;Mm(r,(c,d)=>{if(qo(d)){const f=l.get(d)||[];f.push(c),l.set(d,f)}})}const s=t.draftLocations_.get(e)??dde;for(const l of s)Sx(r,l,n,a)}function fde(t,e,n){t.callbacks_.push(function(r){const a=e;if(!a||!Dy(a,r))return;r.mapSetPlugin_?.fixSetContents(a);const s=r2(a);ej(t,a.draft_??a,s,n),tj(a,r)})}function tj(t,e){if(t.modified_&&!t.finalized_&&(t.type_===3||(t.assigned_?.size??0)>0)){const{patchPlugin_:i}=e;if(i){const r=i.getPath(t);r&&i.generatePatches_(t,r,e)}J5(t)}}function hde(t,e,n){const{scope_:i}=t;if(qo(n)){const r=n[Fr];Dy(r,i)&&r.callbacks_.push(function(){jv(t);const s=r2(r);ej(t,n,s,e)})}else bs(n)&&t.callbacks_.push(function(){const a=Ro(t);nA(a,e,t.type_)===n&&i.drafts_.length>1&&(t.assigned_.get(e)??!1)===!0&&t.copy_&&s2(nA(t.copy_,e,t.type_),i.handledSet_,i)})}function s2(t,e,n){return!n.immer_.autoFreeze_&&n.unfinalizedDrafts_<1||qo(t)||e.has(t)||!bs(t)||Py(t)||(e.add(t),Mm(t,(i,r)=>{if(qo(r)){const a=r[Fr];if(Dy(a,n)){const s=r2(a);Sx(t,i,s,t.type_),J5(a)}}else bs(r)&&s2(r,e,n)})),t}function pde(t,e){const n=Ty(t),i={type_:n?1:0,scope_:e?e.scope_:Q5(),modified_:!1,finalized_:!1,assigned_:void 0,parent_:e,base_:t,draft_:null,copy_:null,revoke_:null,isManual_:!1,callbacks_:void 0};let r=i,a=o2;n&&(r=[i],a=Qp);const{revoke:s,proxy:l}=Proxy.revocable(r,a);return i.draft_=l,i.revoke_=s,[l,i]}var o2={get(t,e){if(e===Fr)return t;const n=Ro(t);if(!bU(n,e,t.type_))return mde(t,n,e);const i=n[e];if(t.finalized_||!bs(i))return i;if(i===$w(t.base_,e)){jv(t);const r=t.type_===1?+e:e,a=lA(t.scope_,i,t,r);return t.copy_[r]=a}return i},has(t,e){return e in Ro(t)},ownKeys(t){return Reflect.ownKeys(Ro(t))},set(t,e,n){const i=nj(Ro(t),e);if(i?.set)return i.set.call(t.draft_,n),!0;if(!t.modified_){const r=$w(Ro(t),e),a=r?.[Fr];if(a&&a.base_===n)return t.copy_[e]=n,t.assigned_.set(e,!1),!0;if(ade(n,r)&&(n!==void 0||bU(t.base_,e,t.type_)))return!0;jv(t),oA(t)}return t.copy_[e]===n&&(n!==void 0||e in t.copy_)||Number.isNaN(n)&&Number.isNaN(t.copy_[e])||(t.copy_[e]=n,t.assigned_.set(e,!0),hde(t,e,n)),!0},deleteProperty(t,e){return jv(t),$w(t.base_,e)!==void 0||e in t.base_?(t.assigned_.set(e,!1),oA(t)):t.assigned_.delete(e),t.copy_&&delete t.copy_[e],!0},getOwnPropertyDescriptor(t,e){const n=Ro(t),i=Reflect.getOwnPropertyDescriptor(n,e);return i&&{[Bv]:!0,[tA]:t.type_!==1||e!=="length",[_x]:i[_x],[Kp]:n[e]}},defineProperty(){fs(11)},getPrototypeOf(t){return Tf(t.base_)},setPrototypeOf(){fs(12)}},Qp={};Mm(o2,(t,e)=>{Qp[t]=function(){const n=arguments;return n[0]=n[0][0],e.apply(this,n)}});Qp.deleteProperty=function(t,e){return Qp.set.call(this,t,e,void 0)};Qp.set=function(t,e,n){return o2.set.call(this,t[0],e,n,t[0])};function $w(t,e){const n=t[Fr];return(n?Ro(n):t)[e]}function mde(t,e,n){const i=nj(e,n);return i?Kp in i?i[Kp]:i.get?.call(t.draft_):void 0}function nj(t,e){if(!(e in t))return;let n=Tf(t);for(;n;){const i=Object.getOwnPropertyDescriptor(n,e);if(i)return i;n=Tf(n)}}function oA(t){t.modified_||(t.modified_=!0,t.parent_&&oA(t.parent_))}function jv(t){t.copy_||(t.assigned_=new Map,t.copy_=iA(t.base_,t.scope_.immer_.useStrictShallowCopy_))}var gde=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(n,i,r)=>{if(Jd(n)&&!Jd(i)){const s=i;i=n;const l=this;return function(d=s,...f){return l.produce(d,h=>i.call(this,h,...f))}}Jd(i)||fs(6),r!==void 0&&!Jd(r)&&fs(7);let a;if(bs(n)){const s=SU(this),l=lA(s,n,void 0);let c=!0;try{a=i(l),c=!1}finally{c?aA(s):sA(s)}return _U(s,r),wU(a,s)}else if(!n||!i2(n)){if(a=i(n),a===void 0&&(a=n),a===Y5&&(a=void 0),this.autoFreeze_&&a2(a,!0),r){const s=[],l=[];Cf(rA).generateReplacementPatches_(n,a,{patches_:s,inversePatches_:l}),r(s,l)}return a}else fs(1,n)},this.produceWithPatches=(n,i)=>{if(Jd(n))return(l,...c)=>this.produceWithPatches(l,d=>n(d,...c));let r,a;return[this.produce(n,i,(l,c)=>{r=l,a=c}),r,a]},Vw(e?.autoFreeze)&&this.setAutoFreeze(e.autoFreeze),Vw(e?.useStrictShallowCopy)&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),Vw(e?.useStrictIteration)&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){bs(e)||fs(8),qo(e)&&(e=xs(e));const n=SU(this),i=lA(n,e,void 0);return i[Fr].isManual_=!0,sA(n),i}finishDraft(e,n){const i=e&&e[Fr];(!i||!i.isManual_)&&fs(9);const{scope_:r}=i;return _U(r,n),wU(void 0,r)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}setUseStrictIteration(e){this.useStrictIteration_=e}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(e,n){let i;for(i=n.length-1;i>=0;i--){const a=n[i];if(a.path.length===0&&a.op==="replace"){e=a.value;break}}i>-1&&(n=n.slice(i+1));const r=Cf(rA).applyPatches_;return qo(e)?r(e,n):this.produce(e,a=>r(a,n))}};function lA(t,e,n,i){const[r,a]=Cy(e)?Cf(wx).proxyMap_(e,n):Ry(e)?Cf(wx).proxySet_(e,n):pde(e,n);return(n?.scope_??Q5()).drafts_.push(r),a.callbacks_=n?.callbacks_??[],a.key_=i,n&&i!==void 0?fde(n,a,i):a.callbacks_.push(function(c){c.mapSetPlugin_?.fixSetContents(a);const{patchPlugin_:d}=c;a.modified_&&d&&d.generatePatches_(a,[],c)}),r}function xs(t){return qo(t)||fs(10,t),ij(t)}function ij(t){if(!bs(t)||Py(t))return t;const e=t[Fr];let n,i=!0;if(e){if(!e.modified_)return e.base_;e.finalized_=!0,n=iA(t,e.scope_.immer_.useStrictShallowCopy_),i=e.scope_.immer_.shouldUseStrictIteration()}else n=iA(t,!0);return Mm(n,(r,a)=>{Sx(n,r,ij(a))},i),e&&(e.finalized_=!1),n}var vde=new gde,rj=vde.produce;function aj(t){return({dispatch:n,getState:i})=>r=>a=>typeof a=="function"?a(n,i,t):r(a)}var xde=aj(),yde=aj,bde=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]=="object"?yx:yx.apply(null,arguments)};function Ka(t,e){function n(...i){if(e){let r=e(...i);if(!r)throw new Error(ba(0));return{type:t,payload:r.payload,..."meta"in r&&{meta:r.meta},..."error"in r&&{error:r.error}}}return{type:t,payload:i[0]}}return n.toString=()=>`${t}`,n.type=t,n.match=i=>q5(i)&&i.type===t,n}var sj=class Sp extends Array{constructor(...e){super(...e),Object.setPrototypeOf(this,Sp.prototype)}static get[Symbol.species](){return Sp}concat(...e){return super.concat.apply(this,e)}prepend(...e){return e.length===1&&Array.isArray(e[0])?new Sp(...e[0].concat(this)):new Sp(...e.concat(this))}};function MU(t){return bs(t)?rj(t,()=>{}):t}function hv(t,e,n){return t.has(e)?t.get(e):t.set(e,n(e)).get(e)}function _de(t){return typeof t=="boolean"}var Sde=()=>function(e){const{thunk:n=!0,immutableCheck:i=!0,serializableCheck:r=!0,actionCreatorCheck:a=!0}=e??{};let s=new sj;return n&&(_de(n)?s.push(xde):s.push(yde(n.extraArgument))),s},oj="RTK_autoBatch",Gn=()=>t=>({payload:t,meta:{[oj]:!0}}),AU=t=>e=>{setTimeout(e,t)},lj=(t={type:"raf"})=>e=>(...n)=>{const i=e(...n);let r=!0,a=!1,s=!1;const l=new Set,c=t.type==="tick"?queueMicrotask:t.type==="raf"?typeof window<"u"&&window.requestAnimationFrame?window.requestAnimationFrame:AU(10):t.type==="callback"?t.queueNotification:AU(t.timeout),d=()=>{s=!1,a&&(a=!1,l.forEach(f=>f()))};return Object.assign({},i,{subscribe(f){const h=()=>r&&f(),g=i.subscribe(h);return l.add(f),()=>{g(),l.delete(f)}},dispatch(f){try{return r=!f?.meta?.[oj],a=!r,a&&(s||(s=!0,c(d))),i.dispatch(f)}finally{r=!0}}})},wde=t=>function(n){const{autoBatch:i=!0}=n??{};let r=new sj(t);return i&&r.push(lj(typeof i=="object"?i:void 0)),r};function Ede(t){const e=Sde(),{reducer:n=void 0,middleware:i,devTools:r=!0,preloadedState:a=void 0,enhancers:s=void 0}=t||{};let l;if(typeof n=="function")l=n;else if(n2(n))l=X5(n);else throw new Error(ba(1));let c;typeof i=="function"?c=i(e):c=e();let d=yx;r&&(d=bde({trace:!1,...typeof r=="object"&&r}));const f=ide(...c),h=wde(f);let g=typeof s=="function"?s(h):h();const m=d(...g);return W5(l,a,m)}function cj(t){const e={},n=[];let i;const r={addCase(a,s){const l=typeof a=="string"?a:a.type;if(!l)throw new Error(ba(28));if(l in e)throw new Error(ba(29));return e[l]=s,r},addAsyncThunk(a,s){return s.pending&&(e[a.pending.type]=s.pending),s.rejected&&(e[a.rejected.type]=s.rejected),s.fulfilled&&(e[a.fulfilled.type]=s.fulfilled),s.settled&&n.push({matcher:a.settled,reducer:s.settled}),r},addMatcher(a,s){return n.push({matcher:a,reducer:s}),r},addDefaultCase(a){return i=a,r}};return t(r),[e,n,i]}function Mde(t){return typeof t=="function"}function Ade(t,e){let[n,i,r]=cj(e),a;if(Mde(t))a=()=>MU(t());else{const l=MU(t);a=()=>l}function s(l=a(),c){let d=[n[c.type],...i.filter(({matcher:f})=>f(c)).map(({reducer:f})=>f)];return d.filter(f=>!!f).length===0&&(d=[r]),d.reduce((f,h)=>{if(h)if(qo(f)){const m=h(f,c);return m===void 0?f:m}else{if(bs(f))return rj(f,g=>h(g,c));{const g=h(f,c);if(g===void 0){if(f===null)return f;throw Error("A case reducer on a non-draftable value must not return undefined")}return g}}return f},l)}return s.getInitialState=a,s}var Tde="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW",Cde=(t=21)=>{let e="",n=t;for(;n--;)e+=Tde[Math.random()*64|0];return e},Rde=Symbol.for("rtk-slice-createasyncthunk");function Pde(t,e){return`${t}/${e}`}function Dde({creators:t}={}){const e=t?.asyncThunk?.[Rde];return function(i){const{name:r,reducerPath:a=r}=i;if(!r)throw new Error(ba(11));const s=(typeof i.reducers=="function"?i.reducers(Ode()):i.reducers)||{},l=Object.keys(s),c={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},d={addCase(S,A){const R=typeof S=="string"?S:S.type;if(!R)throw new Error(ba(12));if(R in c.sliceCaseReducersByType)throw new Error(ba(13));return c.sliceCaseReducersByType[R]=A,d},addMatcher(S,A){return c.sliceMatchers.push({matcher:S,reducer:A}),d},exposeAction(S,A){return c.actionCreators[S]=A,d},exposeCaseReducer(S,A){return c.sliceCaseReducersByName[S]=A,d}};l.forEach(S=>{const A=s[S],R={reducerName:S,type:Pde(r,S),createNotation:typeof i.reducers=="function"};Ide(A)?kde(R,A,d,e):Lde(R,A,d)});function f(){const[S={},A=[],R=void 0]=typeof i.extraReducers=="function"?cj(i.extraReducers):[i.extraReducers],N={...S,...c.sliceCaseReducersByType};return Ade(i.initialState,C=>{for(let F in N)C.addCase(F,N[F]);for(let F of c.sliceMatchers)C.addMatcher(F.matcher,F.reducer);for(let F of A)C.addMatcher(F.matcher,F.reducer);R&&C.addDefaultCase(R)})}const h=S=>S,g=new Map,m=new WeakMap;let b;function y(S,A){return b||(b=f()),b(S,A)}function x(){return b||(b=f()),b.getInitialState()}function v(S,A=!1){function R(C){let F=C[S];return typeof F>"u"&&A&&(F=hv(m,R,x)),F}function N(C=h){const F=hv(g,A,()=>new WeakMap);return hv(F,C,()=>{const P={};for(const[L,B]of Object.entries(i.selectors??{}))P[L]=Nde(B,C,()=>hv(m,C,x),A);return P})}return{reducerPath:S,getSelectors:N,get selectors(){return N(R)},selectSlice:R}}const w={name:r,reducer:y,actions:c.actionCreators,caseReducers:c.sliceCaseReducersByName,getInitialState:x,...v(a),injectInto(S,{reducerPath:A,...R}={}){const N=A??a;return S.inject({reducerPath:N,reducer:y},R),{...w,...v(N,!0)}}};return w}}function Nde(t,e,n,i){function r(a,...s){let l=e(a);return typeof l>"u"&&i&&(l=n()),t(l,...s)}return r.unwrapped=t,r}var ea=Dde();function Ode(){function t(e,n){return{_reducerDefinitionType:"asyncThunk",payloadCreator:e,...n}}return t.withTypes=()=>t,{reducer(e){return Object.assign({[e.name](...n){return e(...n)}}[e.name],{_reducerDefinitionType:"reducer"})},preparedReducer(e,n){return{_reducerDefinitionType:"reducerWithPrepare",prepare:e,reducer:n}},asyncThunk:t}}function Lde({type:t,reducerName:e,createNotation:n},i,r){let a,s;if("reducer"in i){if(n&&!Ude(i))throw new Error(ba(17));a=i.reducer,s=i.prepare}else a=i;r.addCase(t,a).exposeCaseReducer(e,a).exposeAction(e,s?Ka(t,s):Ka(t))}function Ide(t){return t._reducerDefinitionType==="asyncThunk"}function Ude(t){return t._reducerDefinitionType==="reducerWithPrepare"}function kde({type:t,reducerName:e},n,i,r){if(!r)throw new Error(ba(18));const{payloadCreator:a,fulfilled:s,pending:l,rejected:c,settled:d,options:f}=n,h=r(t,a,f);i.exposeAction(e,h),s&&i.addCase(h.fulfilled,s),l&&i.addCase(h.pending,l),c&&i.addCase(h.rejected,c),d&&i.addMatcher(h.settled,d),i.exposeCaseReducer(e,{fulfilled:s||pv,pending:l||pv,rejected:c||pv,settled:d||pv})}function pv(){}var Fde="task",uj="listener",dj="completed",l2="cancelled",zde=`task-${l2}`,Bde=`task-${dj}`,cA=`${uj}-${l2}`,jde=`${uj}-${dj}`,Ny=class{constructor(t){this.code=t,this.message=`${Fde} ${l2} (reason: ${t})`}name="TaskAbortError";message},c2=(t,e)=>{if(typeof t!="function")throw new TypeError(ba(32))},Ex=()=>{},fj=(t,e=Ex)=>(t.catch(e),t),hj=(t,e)=>(t.addEventListener("abort",e,{once:!0}),()=>t.removeEventListener("abort",e)),du=(t,e)=>{const n=t.signal;n.aborted||("reason"in n||Object.defineProperty(n,"reason",{enumerable:!0,value:e,configurable:!0,writable:!0}),t.abort(e))},fu=t=>{if(t.aborted){const{reason:e}=t;throw new Ny(e)}};function pj(t,e){let n=Ex;return new Promise((i,r)=>{const a=()=>r(new Ny(t.reason));if(t.aborted){a();return}n=hj(t,a),e.finally(()=>n()).then(i,r)}).finally(()=>{n=Ex})}var Hde=async(t,e)=>{try{return await Promise.resolve(),{status:"ok",value:await t()}}catch(n){return{status:n instanceof Ny?"cancelled":"rejected",error:n}}finally{e?.()}},Mx=t=>e=>fj(pj(t,e).then(n=>(fu(t),n))),mj=t=>{const e=Mx(t);return n=>e(new Promise(i=>setTimeout(i,n)))},{assign:ff}=Object,TU={},Oy="listenerMiddleware",Gde=(t,e)=>{const n=i=>hj(t,()=>du(i,t.reason));return(i,r)=>{c2(i);const a=new AbortController;n(a);const s=Hde(async()=>{fu(t),fu(a.signal);const l=await i({pause:Mx(a.signal),delay:mj(a.signal),signal:a.signal});return fu(a.signal),l},()=>du(a,Bde));return r?.autoJoin&&e.push(s.catch(Ex)),{result:Mx(t)(s),cancel(){du(a,zde)}}}},Vde=(t,e)=>{const n=async(i,r)=>{fu(e);let a=()=>{};const l=[new Promise((c,d)=>{let f=t({predicate:i,effect:(h,g)=>{g.unsubscribe(),c([h,g.getState(),g.getOriginalState()])}});a=()=>{f(),d()}})];r!=null&&l.push(new Promise(c=>setTimeout(c,r,null)));try{const c=await pj(e,Promise.race(l));return fu(e),c}finally{a()}};return(i,r)=>fj(n(i,r))},gj=t=>{let{type:e,actionCreator:n,matcher:i,predicate:r,effect:a}=t;if(e)r=Ka(e).match;else if(n)e=n.type,r=n.match;else if(i)r=i;else if(!r)throw new Error(ba(21));return c2(a),{predicate:r,type:e,effect:a}},vj=ff(t=>{const{type:e,predicate:n,effect:i}=gj(t);return{id:Cde(),effect:i,type:e,predicate:n,pending:new Set,unsubscribe:()=>{throw new Error(ba(22))}}},{withTypes:()=>vj}),CU=(t,e)=>{const{type:n,effect:i,predicate:r}=gj(e);return Array.from(t.values()).find(a=>(typeof n=="string"?a.type===n:a.predicate===r)&&a.effect===i)},uA=t=>{t.pending.forEach(e=>{du(e,cA)})},$de=(t,e)=>()=>{for(const n of e.keys())uA(n);t.clear()},RU=(t,e,n)=>{try{t(e,n)}catch(i){setTimeout(()=>{throw i},0)}},xj=ff(Ka(`${Oy}/add`),{withTypes:()=>xj}),Wde=Ka(`${Oy}/removeAll`),yj=ff(Ka(`${Oy}/remove`),{withTypes:()=>yj}),Xde=(...t)=>{console.error(`${Oy}/error`,...t)},Tm=(t={})=>{const e=new Map,n=new Map,i=m=>{const b=n.get(m)??0;n.set(m,b+1)},r=m=>{const b=n.get(m)??1;b===1?n.delete(m):n.set(m,b-1)},{extra:a,onError:s=Xde}=t;c2(s);const l=m=>(m.unsubscribe=()=>e.delete(m.id),e.set(m.id,m),b=>{m.unsubscribe(),b?.cancelActive&&uA(m)}),c=m=>{const b=CU(e,m)??vj(m);return l(b)};ff(c,{withTypes:()=>c});const d=m=>{const b=CU(e,m);return b&&(b.unsubscribe(),m.cancelActive&&uA(b)),!!b};ff(d,{withTypes:()=>d});const f=async(m,b,y,x)=>{const v=new AbortController,w=Vde(c,v.signal),S=[];try{m.pending.add(v),i(m),await Promise.resolve(m.effect(b,ff({},y,{getOriginalState:x,condition:(A,R)=>w(A,R).then(Boolean),take:w,delay:mj(v.signal),pause:Mx(v.signal),extra:a,signal:v.signal,fork:Gde(v.signal,S),unsubscribe:m.unsubscribe,subscribe:()=>{e.set(m.id,m)},cancelActiveListeners:()=>{m.pending.forEach((A,R,N)=>{A!==v&&(du(A,cA),N.delete(A))})},cancel:()=>{du(v,cA),m.pending.delete(v)},throwIfCancelled:()=>{fu(v.signal)}})))}catch(A){A instanceof Ny||RU(s,A,{raisedBy:"effect"})}finally{await Promise.all(S),du(v,jde),r(m),m.pending.delete(v)}},h=$de(e,n);return{middleware:m=>b=>y=>{if(!q5(y))return b(y);if(xj.match(y))return c(y.payload);if(Wde.match(y)){h();return}if(yj.match(y))return d(y.payload);let x=m.getState();const v=()=>{if(x===TU)throw new Error(ba(23));return x};let w;try{if(w=b(y),e.size>0){const S=m.getState(),A=Array.from(e.values());for(const R of A){let N=!1;try{N=R.predicate(y,S,x)}catch(C){N=!1,RU(s,C,{raisedBy:"predicate"})}N&&f(R,y,m,v)}}}finally{x=TU}return w},startListening:c,stopListening:d,clearListeners:h}};function ba(t){return`Minified Redux Toolkit error #${t}; visit https://redux-toolkit.js.org/Errors?code=${t} for the full message or use the non-minified dev environment for full errors. `}var qde={layoutType:"horizontal",width:0,height:0,margin:{top:5,right:5,bottom:5,left:5},scale:1},bj=ea({name:"chartLayout",initialState:qde,reducers:{setLayout(t,e){t.layoutType=e.payload},setChartSize(t,e){t.width=e.payload.width,t.height=e.payload.height},setMargin(t,e){var n,i,r,a;t.margin.top=(n=e.payload.top)!==null&&n!==void 0?n:0,t.margin.right=(i=e.payload.right)!==null&&i!==void 0?i:0,t.margin.bottom=(r=e.payload.bottom)!==null&&r!==void 0?r:0,t.margin.left=(a=e.payload.left)!==null&&a!==void 0?a:0},setScale(t,e){t.scale=e.payload}}}),{setMargin:Yde,setLayout:Kde,setChartSize:Zde,setScale:Qde}=bj.actions,Jde=bj.reducer;function _j(t,e,n){return Array.isArray(t)&&t&&e+n!==0?t.slice(e,n+1):t}function PU(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),n.push.apply(n,i)}return n}function nf(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?PU(Object(n),!0).forEach(function(i){efe(t,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):PU(Object(n)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(n,i))})}return t}function efe(t,e,n){return(e=tfe(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function tfe(t){var e=nfe(t,"string");return typeof e=="symbol"?e:e+""}function nfe(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var i=n.call(t,e);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Dn(t,e,n){return qn(t)||qn(e)?n:Gs(e)?Tu(t,e,n):typeof e=="function"?e(t):n}var ife=(t,e,n)=>{if(e&&n){var{width:i,height:r}=n,{align:a,verticalAlign:s,layout:l}=e;if((l==="vertical"||l==="horizontal"&&s==="middle")&&a!=="center"&&yt(t[a]))return nf(nf({},t),{},{[a]:t[a]+(i||0)});if((l==="horizontal"||l==="vertical"&&a==="center")&&s!=="middle"&&yt(t[s]))return nf(nf({},t),{},{[s]:t[s]+(r||0)})}return t},el=(t,e)=>t==="horizontal"&&e==="xAxis"||t==="vertical"&&e==="yAxis"||t==="centric"&&e==="angleAxis"||t==="radial"&&e==="radiusAxis",Sj=(t,e,n,i)=>{if(i)return t.map(l=>l.coordinate);var r,a,s=t.map(l=>(l.coordinate===e&&(r=!0),l.coordinate===n&&(a=!0),l.coordinate));return r||s.push(e),a||s.push(n),s},wj=(t,e,n)=>{if(!t)return null;var{duplicateDomain:i,type:r,range:a,scale:s,realScaleType:l,isCategorical:c,categoricalDomain:d,tickCount:f,ticks:h,niceTicks:g,axisType:m}=t;if(!s)return null;var b=l==="scaleBand"&&s.bandwidth?s.bandwidth()/2:2,y=r==="category"&&s.bandwidth?s.bandwidth()/b:0;if(y=m==="angleAxis"&&a&&a.length>=2?Zi(a[0]-a[1])*2*y:y,h||g){var x=(h||g||[]).map((v,w)=>{var S=i?i.indexOf(v):v;return{coordinate:s(S)+y,value:v,offset:y,index:w}});return x.filter(v=>!Ya(v.coordinate))}return c&&d?d.map((v,w)=>({coordinate:s(v)+y,value:v,index:w,offset:y})):s.ticks&&f!=null?s.ticks(f).map((v,w)=>({coordinate:s(v)+y,value:v,offset:y,index:w})):s.domain().map((v,w)=>({coordinate:s(v)+y,value:i?i[v]:v,index:w,offset:y}))},DU=1e-4,rfe=t=>{var e=t.domain();if(!(!e||e.length<=2)){var n=e.length,i=t.range(),r=Math.min(i[0],i[1])-DU,a=Math.max(i[0],i[1])+DU,s=t(e[0]),l=t(e[n-1]);(s<r||s>a||l<r||l>a)&&t.domain([e[0],e[n-1]])}},afe=(t,e)=>{if(!e||e.length!==2||!yt(e[0])||!yt(e[1]))return t;var n=Math.min(e[0],e[1]),i=Math.max(e[0],e[1]),r=[t[0],t[1]];return(!yt(t[0])||t[0]<n)&&(r[0]=n),(!yt(t[1])||t[1]>i)&&(r[1]=i),r[0]>i&&(r[0]=i),r[1]<n&&(r[1]=n),r},sfe=t=>{var e=t.length;if(!(e<=0))for(var n=0,i=t[0].length;n<i;++n)for(var r=0,a=0,s=0;s<e;++s){var l=Ya(t[s][n][1])?t[s][n][0]:t[s][n][1];l>=0?(t[s][n][0]=r,t[s][n][1]=r+l,r=t[s][n][1]):(t[s][n][0]=a,t[s][n][1]=a+l,a=t[s][n][1])}},ofe=t=>{var e=t.length;if(!(e<=0))for(var n=0,i=t[0].length;n<i;++n)for(var r=0,a=0;a<e;++a){var s=Ya(t[a][n][1])?t[a][n][0]:t[a][n][1];s>=0?(t[a][n][0]=r,t[a][n][1]=r+s,r=t[a][n][1]):(t[a][n][0]=0,t[a][n][1]=0)}},lfe={sign:sfe,expand:Cce,none:Af,silhouette:Rce,wiggle:Pce,positive:ofe},cfe=(t,e,n)=>{var i=lfe[n],r=Tce().keys(e).value((a,s)=>Number(Dn(a,s,0))).order(JM).offset(i);return r(t)};function Ej(t){return t==null?void 0:String(t)}function NU(t){var{axis:e,ticks:n,bandSize:i,entry:r,index:a,dataKey:s}=t;if(e.type==="category"){if(!e.allowDuplicatedCategory&&e.dataKey&&!qn(r[e.dataKey])){var l=C5(n,"value",r[e.dataKey]);if(l)return l.coordinate+i/2}return n[a]?n[a].coordinate+i/2:null}var c=Dn(r,qn(s)?e.dataKey:s);return qn(c)?null:e.scale(c)}var OU=t=>{var{axis:e,ticks:n,offset:i,bandSize:r,entry:a,index:s}=t;if(e.type==="category")return n[s]?n[s].coordinate+i:null;var l=Dn(a,e.dataKey,e.scale.domain()[s]);return qn(l)?null:e.scale(l)-r/2+i},ufe=t=>{var{numericAxis:e}=t,n=e.scale.domain();if(e.type==="number"){var i=Math.min(n[0],n[1]),r=Math.max(n[0],n[1]);return i<=0&&r>=0?0:r<0?r:i}return n[0]},dfe=t=>{var e=t.flat(2).filter(yt);return[Math.min(...e),Math.max(...e)]},ffe=t=>[t[0]===1/0?0:t[0],t[1]===-1/0?0:t[1]],hfe=(t,e,n)=>{if(t!=null)return ffe(Object.keys(t).reduce((i,r)=>{var a=t[r],{stackedData:s}=a,l=s.reduce((c,d)=>{var f=_j(d,e,n),h=dfe(f);return[Math.min(c[0],h[0]),Math.max(c[1],h[1])]},[1/0,-1/0]);return[Math.min(l[0],i[0]),Math.max(l[1],i[1])]},[1/0,-1/0]))},LU=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,IU=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,Rf=(t,e,n)=>{if(t&&t.scale&&t.scale.bandwidth){var i=t.scale.bandwidth();if(!n||i>0)return i}if(t&&e&&e.length>=2){for(var r=My(e,f=>f.coordinate),a=1/0,s=1,l=r.length;s<l;s++){var c=r[s],d=r[s-1];a=Math.min((c.coordinate||0)-(d.coordinate||0),a)}return a===1/0?0:a}return n?void 0:0};function UU(t){var{tooltipEntrySettings:e,dataKey:n,payload:i,value:r,name:a}=t;return nf(nf({},e),{},{dataKey:n,payload:i,value:r,name:a})}function $f(t,e){if(t)return String(t);if(typeof e=="string")return e}var pfe=(t,e)=>{if(e==="horizontal")return t.chartX;if(e==="vertical")return t.chartY},mfe=(t,e)=>e==="centric"?t.angle:t.radius,tl=t=>t.layout.width,nl=t=>t.layout.height,gfe=t=>t.layout.scale,Mj=t=>t.layout.margin,Ly=He(t=>t.cartesianAxis.xAxis,t=>Object.values(t)),Iy=He(t=>t.cartesianAxis.yAxis,t=>Object.values(t)),Aj="data-recharts-item-index",Tj="data-recharts-item-data-key",Cm=60;function kU(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),n.push.apply(n,i)}return n}function mv(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?kU(Object(n),!0).forEach(function(i){vfe(t,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):kU(Object(n)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(n,i))})}return t}function vfe(t,e,n){return(e=xfe(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function xfe(t){var e=yfe(t,"string");return typeof e=="symbol"?e:e+""}function yfe(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var i=n.call(t,e);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var bfe=t=>t.brush.height;function _fe(t){var e=Iy(t);return e.reduce((n,i)=>{if(i.orientation==="left"&&!i.mirror&&!i.hide){var r=typeof i.width=="number"?i.width:Cm;return n+r}return n},0)}function Sfe(t){var e=Iy(t);return e.reduce((n,i)=>{if(i.orientation==="right"&&!i.mirror&&!i.hide){var r=typeof i.width=="number"?i.width:Cm;return n+r}return n},0)}function wfe(t){var e=Ly(t);return e.reduce((n,i)=>i.orientation==="top"&&!i.mirror&&!i.hide?n+i.height:n,0)}function Efe(t){var e=Ly(t);return e.reduce((n,i)=>i.orientation==="bottom"&&!i.mirror&&!i.hide?n+i.height:n,0)}var Ii=He([tl,nl,Mj,bfe,_fe,Sfe,wfe,Efe,V5,Kue],(t,e,n,i,r,a,s,l,c,d)=>{var f={left:(n.left||0)+r,right:(n.right||0)+a},h={top:(n.top||0)+s,bottom:(n.bottom||0)+l},g=mv(mv({},h),f),m=g.bottom;g.bottom+=i,g=ife(g,c,d);var b=t-g.left-g.right,y=e-g.top-g.bottom;return mv(mv({brushBottom:m},g),{},{width:Math.max(b,0),height:Math.max(y,0)})}),Mfe=He(Ii,t=>({x:t.left,y:t.top,width:t.width,height:t.height})),u2=He(tl,nl,(t,e)=>({x:0,y:0,width:t,height:e})),Afe=T.createContext(null),Ar=()=>T.useContext(Afe)!=null,Uy=t=>t.brush,ky=He([Uy,Ii,Mj],(t,e,n)=>({height:t.height,x:yt(t.x)?t.x:e.left,y:yt(t.y)?t.y:e.top+e.height+e.brushBottom-(n?.bottom||0),width:yt(t.width)?t.width:e.width})),Ww={},Xw={},qw={},FU;function Tfe(){return FU||(FU=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});function e(n,i,{signal:r,edges:a}={}){let s,l=null;const c=a!=null&&a.includes("leading"),d=a==null||a.includes("trailing"),f=()=>{l!==null&&(n.apply(s,l),s=void 0,l=null)},h=()=>{d&&f(),y()};let g=null;const m=()=>{g!=null&&clearTimeout(g),g=setTimeout(()=>{g=null,h()},i)},b=()=>{g!==null&&(clearTimeout(g),g=null)},y=()=>{b(),s=void 0,l=null},x=()=>{f()},v=function(...w){if(r?.aborted)return;s=this,l=w;const S=g==null;m(),c&&S&&f()};return v.schedule=m,v.cancel=y,v.flush=x,r?.addEventListener("abort",y,{once:!0}),v}t.debounce=e})(qw)),qw}var zU;function Cfe(){return zU||(zU=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=Tfe();function n(i,r=0,a={}){typeof a!="object"&&(a={});const{leading:s=!1,trailing:l=!0,maxWait:c}=a,d=Array(2);s&&(d[0]="leading"),l&&(d[1]="trailing");let f,h=null;const g=e.debounce(function(...y){f=i.apply(this,y),h=null},r,{edges:d}),m=function(...y){return c!=null&&(h===null&&(h=Date.now()),Date.now()-h>=c)?(f=i.apply(this,y),h=Date.now(),g.cancel(),g.schedule(),f):(g.apply(this,y),f)},b=()=>(g.flush(),f);return m.cancel=g.cancel,m.flush=b,m}t.debounce=n})(Xw)),Xw}var BU;function Rfe(){return BU||(BU=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=Cfe();function n(i,r=0,a={}){const{leading:s=!0,trailing:l=!0}=a;return e.debounce(i,r,{leading:s,maxWait:r,trailing:l})}t.throttle=n})(Ww)),Ww}var Yw,jU;function Pfe(){return jU||(jU=1,Yw=Rfe().throttle),Yw}var Dfe=Pfe();const Nfe=Xs(Dfe);var Ax=function(e,n){for(var i=arguments.length,r=new Array(i>2?i-2:0),a=2;a<i;a++)r[a-2]=arguments[a];if(typeof console<"u"&&console.warn&&(n===void 0&&console.warn("LogUtils requires an error message argument"),!e))if(n===void 0)console.warn("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var s=0;console.warn(n.replace(/%s/g,()=>r[s++]))}},Cj=(t,e,n)=>{var{width:i="100%",height:r="100%",aspect:a,maxHeight:s}=n,l=Xo(i)?t:Number(i),c=Xo(r)?e:Number(r);return a&&a>0&&(l?c=l/a:c&&(l=c*a),s&&c!=null&&c>s&&(c=s)),{calculatedWidth:l,calculatedHeight:c}},Ofe={width:0,height:0,overflow:"visible"},Lfe={width:0,overflowX:"visible"},Ife={height:0,overflowY:"visible"},Ufe={},kfe=t=>{var{width:e,height:n}=t,i=Xo(e),r=Xo(n);return i&&r?Ofe:i?Lfe:r?Ife:Ufe};function Ffe(t){var{width:e,height:n,aspect:i}=t,r=e,a=n;return r===void 0&&a===void 0?(r="100%",a="100%"):r===void 0?r=i&&i>0?void 0:"100%":a===void 0&&(a=i&&i>0?void 0:"100%"),{width:r,height:a}}function jn(t){return Number.isFinite(t)}function Vs(t){return typeof t=="number"&&t>0&&Number.isFinite(t)}function dA(){return dA=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)({}).hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},dA.apply(null,arguments)}function HU(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),n.push.apply(n,i)}return n}function GU(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?HU(Object(n),!0).forEach(function(i){zfe(t,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):HU(Object(n)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(n,i))})}return t}function zfe(t,e,n){return(e=Bfe(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Bfe(t){var e=jfe(t,"string");return typeof e=="symbol"?e:e+""}function jfe(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var i=n.call(t,e);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Rj=T.createContext({width:-1,height:-1});function Hfe(t){return Vs(t.width)&&Vs(t.height)}function Pj(t){var{children:e,width:n,height:i}=t,r=T.useMemo(()=>({width:n,height:i}),[n,i]);return Hfe(r)?T.createElement(Rj.Provider,{value:r},e):null}var d2=()=>T.useContext(Rj),Gfe=T.forwardRef((t,e)=>{var{aspect:n,initialDimension:i={width:-1,height:-1},width:r,height:a,minWidth:s=0,minHeight:l,maxHeight:c,children:d,debounce:f=0,id:h,className:g,onResize:m,style:b={}}=t,y=T.useRef(null),x=T.useRef();x.current=m,T.useImperativeHandle(e,()=>y.current);var[v,w]=T.useState({containerWidth:i.width,containerHeight:i.height}),S=T.useCallback((F,P)=>{w(L=>{var B=Math.round(F),U=Math.round(P);return L.containerWidth===B&&L.containerHeight===U?L:{containerWidth:B,containerHeight:U}})},[]);T.useEffect(()=>{if(y.current==null||typeof ResizeObserver>"u")return wm;var F=U=>{var $,{width:I,height:W}=U[0].contentRect;S(I,W),($=x.current)===null||$===void 0||$.call(x,I,W)};f>0&&(F=Nfe(F,f,{trailing:!0,leading:!1}));var P=new ResizeObserver(F),{width:L,height:B}=y.current.getBoundingClientRect();return S(L,B),P.observe(y.current),()=>{P.disconnect()}},[S,f]);var{containerWidth:A,containerHeight:R}=v;Ax(!n||n>0,"The aspect(%s) must be greater than zero.",n);var{calculatedWidth:N,calculatedHeight:C}=Cj(A,R,{width:r,height:a,aspect:n,maxHeight:c});return Ax(N!=null&&N>0||C!=null&&C>0,`The width(%s) and height(%s) of chart should be greater than 0,
  8063. please check the style of container, or the props width(%s) and height(%s),
  8064. or add a minWidth(%s) or minHeight(%s) or use aspect(%s) to control the
  8065. height and width.`,N,C,r,a,s,l,n),T.createElement("div",{id:h?"".concat(h):void 0,className:dn("recharts-responsive-container",g),style:GU(GU({},b),{},{width:r,height:a,minWidth:s,minHeight:l,maxHeight:c}),ref:y},T.createElement("div",{style:kfe({width:r,height:a})},T.createElement(Pj,{width:N,height:C},d)))}),Kw=T.forwardRef((t,e)=>{var n=d2();if(Vs(n.width)&&Vs(n.height))return t.children;var{width:i,height:r}=Ffe({width:t.width,height:t.height,aspect:t.aspect}),{calculatedWidth:a,calculatedHeight:s}=Cj(void 0,void 0,{width:i,height:r,aspect:t.aspect,maxHeight:t.maxHeight});return yt(a)&&yt(s)?T.createElement(Pj,{width:a,height:s},t.children):T.createElement(Gfe,dA({},t,{width:i,height:r,ref:e}))});function Dj(t){if(t)return{x:t.x,y:t.y,upperWidth:"upperWidth"in t?t.upperWidth:t.width,lowerWidth:"lowerWidth"in t?t.lowerWidth:t.width,width:t.width,height:t.height}}var Fy=()=>{var t,e=Ar(),n=bt(Mfe),i=bt(ky),r=(t=bt(Uy))===null||t===void 0?void 0:t.padding;return!e||!i||!r?n:{width:i.width-r.left-r.right,height:i.height-r.top-r.bottom,x:r.left,y:r.top}},Vfe={top:0,bottom:0,left:0,right:0,width:0,height:0,brushBottom:0},Nj=()=>{var t;return(t=bt(Ii))!==null&&t!==void 0?t:Vfe},f2=()=>bt(tl),h2=()=>bt(nl),$fe=()=>bt(t=>t.layout.margin),sn=t=>t.layout.layoutType,Wf=()=>bt(sn),Wfe=()=>{var t=Wf();if(t==="horizontal"||t==="vertical")return t},Xfe=()=>{var t=Wf();return t!==void 0},zy=t=>{var e=In(),n=Ar(),{width:i,height:r}=t,a=d2(),s=i,l=r;return a&&(s=a.width>0?a.width:i,l=a.height>0?a.height:r),T.useEffect(()=>{!n&&Vs(s)&&Vs(l)&&e(Zde({width:s,height:l}))},[e,n,s,l]),null},Oj=Symbol.for("immer-nothing"),VU=Symbol.for("immer-draftable"),Sa=Symbol.for("immer-state");function hs(t,...e){throw new Error(`[Immer] minified error nr: ${t}. Full error at: https://bit.ly/3cXEKWf`)}var Jp=Object.getPrototypeOf;function Pf(t){return!!t&&!!t[Sa]}function Cu(t){return t?Lj(t)||Array.isArray(t)||!!t[VU]||!!t.constructor?.[VU]||Rm(t)||jy(t):!1}var qfe=Object.prototype.constructor.toString(),$U=new WeakMap;function Lj(t){if(!t||typeof t!="object")return!1;const e=Object.getPrototypeOf(t);if(e===null||e===Object.prototype)return!0;const n=Object.hasOwnProperty.call(e,"constructor")&&e.constructor;if(n===Object)return!0;if(typeof n!="function")return!1;let i=$U.get(n);return i===void 0&&(i=Function.toString.call(n),$U.set(n,i)),i===qfe}function Tx(t,e,n=!0){By(t)===0?(n?Reflect.ownKeys(t):Object.keys(t)).forEach(r=>{e(r,t[r],t)}):t.forEach((i,r)=>e(r,i,t))}function By(t){const e=t[Sa];return e?e.type_:Array.isArray(t)?1:Rm(t)?2:jy(t)?3:0}function fA(t,e){return By(t)===2?t.has(e):Object.prototype.hasOwnProperty.call(t,e)}function Ij(t,e,n){const i=By(t);i===2?t.set(e,n):i===3?t.add(n):t[e]=n}function Yfe(t,e){return t===e?t!==0||1/t===1/e:t!==t&&e!==e}function Rm(t){return t instanceof Map}function jy(t){return t instanceof Set}function Yc(t){return t.copy_||t.base_}function hA(t,e){if(Rm(t))return new Map(t);if(jy(t))return new Set(t);if(Array.isArray(t))return Array.prototype.slice.call(t);const n=Lj(t);if(e===!0||e==="class_only"&&!n){const i=Object.getOwnPropertyDescriptors(t);delete i[Sa];let r=Reflect.ownKeys(i);for(let a=0;a<r.length;a++){const s=r[a],l=i[s];l.writable===!1&&(l.writable=!0,l.configurable=!0),(l.get||l.set)&&(i[s]={configurable:!0,writable:!0,enumerable:l.enumerable,value:t[s]})}return Object.create(Jp(t),i)}else{const i=Jp(t);if(i!==null&&n)return{...t};const r=Object.create(i);return Object.assign(r,t)}}function p2(t,e=!1){return Hy(t)||Pf(t)||!Cu(t)||(By(t)>1&&Object.defineProperties(t,{set:gv,add:gv,clear:gv,delete:gv}),Object.freeze(t),e&&Object.values(t).forEach(n=>p2(n,!0))),t}function Kfe(){hs(2)}var gv={value:Kfe};function Hy(t){return t===null||typeof t!="object"?!0:Object.isFrozen(t)}var Zfe={};function Ru(t){const e=Zfe[t];return e||hs(0,t),e}var em;function Uj(){return em}function Qfe(t,e){return{drafts_:[],parent_:t,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function WU(t,e){e&&(Ru("Patches"),t.patches_=[],t.inversePatches_=[],t.patchListener_=e)}function pA(t){mA(t),t.drafts_.forEach(Jfe),t.drafts_=null}function mA(t){t===em&&(em=t.parent_)}function XU(t){return em=Qfe(em,t)}function Jfe(t){const e=t[Sa];e.type_===0||e.type_===1?e.revoke_():e.revoked_=!0}function qU(t,e){e.unfinalizedDrafts_=e.drafts_.length;const n=e.drafts_[0];return t!==void 0&&t!==n?(n[Sa].modified_&&(pA(e),hs(4)),Cu(t)&&(t=Cx(e,t),e.parent_||Rx(e,t)),e.patches_&&Ru("Patches").generateReplacementPatches_(n[Sa].base_,t,e.patches_,e.inversePatches_)):t=Cx(e,n,[]),pA(e),e.patches_&&e.patchListener_(e.patches_,e.inversePatches_),t!==Oj?t:void 0}function Cx(t,e,n){if(Hy(e))return e;const i=t.immer_.shouldUseStrictIteration(),r=e[Sa];if(!r)return Tx(e,(a,s)=>YU(t,r,e,a,s,n),i),e;if(r.scope_!==t)return e;if(!r.modified_)return Rx(t,r.base_,!0),r.base_;if(!r.finalized_){r.finalized_=!0,r.scope_.unfinalizedDrafts_--;const a=r.copy_;let s=a,l=!1;r.type_===3&&(s=new Set(a),a.clear(),l=!0),Tx(s,(c,d)=>YU(t,r,a,c,d,n,l),i),Rx(t,a,!1),n&&t.patches_&&Ru("Patches").generatePatches_(r,n,t.patches_,t.inversePatches_)}return r.copy_}function YU(t,e,n,i,r,a,s){if(r==null||typeof r!="object"&&!s)return;const l=Hy(r);if(!(l&&!s)){if(Pf(r)){const c=a&&e&&e.type_!==3&&!fA(e.assigned_,i)?a.concat(i):void 0,d=Cx(t,r,c);if(Ij(n,i,d),Pf(d))t.canAutoFreeze_=!1;else return}else s&&n.add(r);if(Cu(r)&&!l){if(!t.immer_.autoFreeze_&&t.unfinalizedDrafts_<1||e&&e.base_&&e.base_[i]===r&&l)return;Cx(t,r),(!e||!e.scope_.parent_)&&typeof i!="symbol"&&(Rm(n)?n.has(i):Object.prototype.propertyIsEnumerable.call(n,i))&&Rx(t,r)}}}function Rx(t,e,n=!1){!t.parent_&&t.immer_.autoFreeze_&&t.canAutoFreeze_&&p2(e,n)}function ehe(t,e){const n=Array.isArray(t),i={type_:n?1:0,scope_:e?e.scope_:Uj(),modified_:!1,finalized_:!1,assigned_:{},parent_:e,base_:t,draft_:null,copy_:null,revoke_:null,isManual_:!1};let r=i,a=m2;n&&(r=[i],a=tm);const{revoke:s,proxy:l}=Proxy.revocable(r,a);return i.draft_=l,i.revoke_=s,l}var m2={get(t,e){if(e===Sa)return t;const n=Yc(t);if(!fA(n,e))return the(t,n,e);const i=n[e];return t.finalized_||!Cu(i)?i:i===Zw(t.base_,e)?(Qw(t),t.copy_[e]=vA(i,t)):i},has(t,e){return e in Yc(t)},ownKeys(t){return Reflect.ownKeys(Yc(t))},set(t,e,n){const i=kj(Yc(t),e);if(i?.set)return i.set.call(t.draft_,n),!0;if(!t.modified_){const r=Zw(Yc(t),e),a=r?.[Sa];if(a&&a.base_===n)return t.copy_[e]=n,t.assigned_[e]=!1,!0;if(Yfe(n,r)&&(n!==void 0||fA(t.base_,e)))return!0;Qw(t),gA(t)}return t.copy_[e]===n&&(n!==void 0||e in t.copy_)||Number.isNaN(n)&&Number.isNaN(t.copy_[e])||(t.copy_[e]=n,t.assigned_[e]=!0),!0},deleteProperty(t,e){return Zw(t.base_,e)!==void 0||e in t.base_?(t.assigned_[e]=!1,Qw(t),gA(t)):delete t.assigned_[e],t.copy_&&delete t.copy_[e],!0},getOwnPropertyDescriptor(t,e){const n=Yc(t),i=Reflect.getOwnPropertyDescriptor(n,e);return i&&{writable:!0,configurable:t.type_!==1||e!=="length",enumerable:i.enumerable,value:n[e]}},defineProperty(){hs(11)},getPrototypeOf(t){return Jp(t.base_)},setPrototypeOf(){hs(12)}},tm={};Tx(m2,(t,e)=>{tm[t]=function(){return arguments[0]=arguments[0][0],e.apply(this,arguments)}});tm.deleteProperty=function(t,e){return tm.set.call(this,t,e,void 0)};tm.set=function(t,e,n){return m2.set.call(this,t[0],e,n,t[0])};function Zw(t,e){const n=t[Sa];return(n?Yc(n):t)[e]}function the(t,e,n){const i=kj(e,n);return i?"value"in i?i.value:i.get?.call(t.draft_):void 0}function kj(t,e){if(!(e in t))return;let n=Jp(t);for(;n;){const i=Object.getOwnPropertyDescriptor(n,e);if(i)return i;n=Jp(n)}}function gA(t){t.modified_||(t.modified_=!0,t.parent_&&gA(t.parent_))}function Qw(t){t.copy_||(t.copy_=hA(t.base_,t.scope_.immer_.useStrictShallowCopy_))}var nhe=class{constructor(t){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!0,this.produce=(e,n,i)=>{if(typeof e=="function"&&typeof n!="function"){const a=n;n=e;const s=this;return function(c=a,...d){return s.produce(c,f=>n.call(this,f,...d))}}typeof n!="function"&&hs(6),i!==void 0&&typeof i!="function"&&hs(7);let r;if(Cu(e)){const a=XU(this),s=vA(e,void 0);let l=!0;try{r=n(s),l=!1}finally{l?pA(a):mA(a)}return WU(a,i),qU(r,a)}else if(!e||typeof e!="object"){if(r=n(e),r===void 0&&(r=e),r===Oj&&(r=void 0),this.autoFreeze_&&p2(r,!0),i){const a=[],s=[];Ru("Patches").generateReplacementPatches_(e,r,a,s),i(a,s)}return r}else hs(1,e)},this.produceWithPatches=(e,n)=>{if(typeof e=="function")return(s,...l)=>this.produceWithPatches(s,c=>e(c,...l));let i,r;return[this.produce(e,n,(s,l)=>{i=s,r=l}),i,r]},typeof t?.autoFreeze=="boolean"&&this.setAutoFreeze(t.autoFreeze),typeof t?.useStrictShallowCopy=="boolean"&&this.setUseStrictShallowCopy(t.useStrictShallowCopy),typeof t?.useStrictIteration=="boolean"&&this.setUseStrictIteration(t.useStrictIteration)}createDraft(t){Cu(t)||hs(8),Pf(t)&&(t=ihe(t));const e=XU(this),n=vA(t,void 0);return n[Sa].isManual_=!0,mA(e),n}finishDraft(t,e){const n=t&&t[Sa];(!n||!n.isManual_)&&hs(9);const{scope_:i}=n;return WU(i,e),qU(void 0,i)}setAutoFreeze(t){this.autoFreeze_=t}setUseStrictShallowCopy(t){this.useStrictShallowCopy_=t}setUseStrictIteration(t){this.useStrictIteration_=t}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(t,e){let n;for(n=e.length-1;n>=0;n--){const r=e[n];if(r.path.length===0&&r.op==="replace"){t=r.value;break}}n>-1&&(e=e.slice(n+1));const i=Ru("Patches").applyPatches_;return Pf(t)?i(t,e):this.produce(t,r=>i(r,e))}};function vA(t,e){const n=Rm(t)?Ru("MapSet").proxyMap_(t,e):jy(t)?Ru("MapSet").proxySet_(t,e):ehe(t,e);return(e?e.scope_:Uj()).drafts_.push(n),n}function ihe(t){return Pf(t)||hs(10,t),Fj(t)}function Fj(t){if(!Cu(t)||Hy(t))return t;const e=t[Sa];let n,i=!0;if(e){if(!e.modified_)return e.base_;e.finalized_=!0,n=hA(t,e.scope_.immer_.useStrictShallowCopy_),i=e.scope_.immer_.shouldUseStrictIteration()}else n=hA(t,!0);return Tx(n,(r,a)=>{Ij(n,r,Fj(a))},i),e&&(e.finalized_=!1),n}var rhe=new nhe;rhe.produce;var ahe={settings:{layout:"horizontal",align:"center",verticalAlign:"middle",itemSorter:"value"},size:{width:0,height:0},payload:[]},zj=ea({name:"legend",initialState:ahe,reducers:{setLegendSize(t,e){t.size.width=e.payload.width,t.size.height=e.payload.height},setLegendSettings(t,e){t.settings.align=e.payload.align,t.settings.layout=e.payload.layout,t.settings.verticalAlign=e.payload.verticalAlign,t.settings.itemSorter=e.payload.itemSorter},addLegendPayload:{reducer(t,e){t.payload.push(e.payload)},prepare:Gn()},replaceLegendPayload:{reducer(t,e){var{prev:n,next:i}=e.payload,r=xs(t).payload.indexOf(n);r>-1&&(t.payload[r]=i)},prepare:Gn()},removeLegendPayload:{reducer(t,e){var n=xs(t).payload.indexOf(e.payload);n>-1&&t.payload.splice(n,1)},prepare:Gn()}}}),{setLegendSize:KU,setLegendSettings:she,addLegendPayload:Bj,replaceLegendPayload:jj,removeLegendPayload:Hj}=zj.actions,ohe=zj.reducer,lhe=["contextPayload"];function xA(){return xA=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)({}).hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},xA.apply(null,arguments)}function ZU(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),n.push.apply(n,i)}return n}function Df(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?ZU(Object(n),!0).forEach(function(i){che(t,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):ZU(Object(n)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(n,i))})}return t}function che(t,e,n){return(e=uhe(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function uhe(t){var e=dhe(t,"string");return typeof e=="symbol"?e:e+""}function dhe(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var i=n.call(t,e);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function fhe(t,e){if(t==null)return{};var n,i,r=hhe(t,e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(i=0;i<a.length;i++)n=a[i],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function hhe(t,e){if(t==null)return{};var n={};for(var i in t)if({}.hasOwnProperty.call(t,i)){if(e.indexOf(i)!==-1)continue;n[i]=t[i]}return n}function phe(t){return t.value}function mhe(t){var{contextPayload:e}=t,n=fhe(t,lhe),i=B5(e,t.payloadUniqBy,phe),r=Df(Df({},n),{},{payload:i});return T.isValidElement(t.content)?T.cloneElement(t.content,r):typeof t.content=="function"?T.createElement(t.content,r):T.createElement(aue,r)}function ghe(t,e,n,i,r,a){var{layout:s,align:l,verticalAlign:c}=e,d,f;return(!t||(t.left===void 0||t.left===null)&&(t.right===void 0||t.right===null))&&(l==="center"&&s==="vertical"?d={left:((i||0)-a.width)/2}:d=l==="right"?{right:n&&n.right||0}:{left:n&&n.left||0}),(!t||(t.top===void 0||t.top===null)&&(t.bottom===void 0||t.bottom===null))&&(c==="middle"?f={top:((r||0)-a.height)/2}:f=c==="bottom"?{bottom:n&&n.bottom||0}:{top:n&&n.top||0}),Df(Df({},d),f)}function vhe(t){var e=In();return T.useEffect(()=>{e(she(t))},[e,t]),null}function xhe(t){var e=In();return T.useEffect(()=>(e(KU(t)),()=>{e(KU({width:0,height:0}))}),[e,t]),null}function yhe(t,e,n,i){return t==="vertical"&&yt(e)?{height:e}:t==="horizontal"?{width:n||i}:null}var bhe={align:"center",iconSize:14,itemSorter:"value",layout:"horizontal",verticalAlign:"bottom"};function Gj(t){var e=Si(t,bhe),n=Jue(),i=Zle(),r=$fe(),{width:a,height:s,wrapperStyle:l,portal:c}=e,[d,f]=$5([n]),h=f2(),g=h2();if(h==null||g==null)return null;var m=h-(r?.left||0)-(r?.right||0),b=yhe(e.layout,s,a,m),y=c?l:Df(Df({position:"absolute",width:b?.width||a||"auto",height:b?.height||s||"auto"},ghe(l,e,r,h,g,d)),l),x=c??i;if(x==null||n==null)return null;var v=T.createElement("div",{className:"recharts-legend-wrapper",style:y,ref:f},T.createElement(vhe,{layout:e.layout,align:e.align,verticalAlign:e.verticalAlign,itemSorter:e.itemSorter}),!c&&T.createElement(xhe,{width:d.width,height:d.height}),T.createElement(mhe,xA({},e,b,{margin:r,chartWidth:h,chartHeight:g,contextPayload:n})));return Zl.createPortal(v,x)}Gj.displayName="Legend";function yA(){return yA=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)({}).hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},yA.apply(null,arguments)}function QU(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),n.push.apply(n,i)}return n}function Jw(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?QU(Object(n),!0).forEach(function(i){_he(t,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):QU(Object(n)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(n,i))})}return t}function _he(t,e,n){return(e=She(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function She(t){var e=whe(t,"string");return typeof e=="symbol"?e:e+""}function whe(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var i=n.call(t,e);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Ehe(t){return Array.isArray(t)&&Gs(t[0])&&Gs(t[1])?t.join(" ~ "):t}var Mhe=t=>{var{separator:e=" : ",contentStyle:n={},itemStyle:i={},labelStyle:r={},payload:a,formatter:s,itemSorter:l,wrapperClassName:c,labelClassName:d,label:f,labelFormatter:h,accessibilityLayer:g=!1}=t,m=()=>{if(a&&a.length){var R={padding:0,margin:0},N=(l?My(a,l):a).map((C,F)=>{if(C.type==="none")return null;var P=C.formatter||s||Ehe,{value:L,name:B}=C,U=L,$=B;if(P){var I=P(L,B,C,F,a);if(Array.isArray(I))[U,$]=I;else if(I!=null)U=I;else return null}var W=Jw({display:"block",paddingTop:4,paddingBottom:4,color:C.color||"#000"},i);return T.createElement("li",{className:"recharts-tooltip-item",key:"tooltip-item-".concat(F),style:W},Gs($)?T.createElement("span",{className:"recharts-tooltip-item-name"},$):null,Gs($)?T.createElement("span",{className:"recharts-tooltip-item-separator"},e):null,T.createElement("span",{className:"recharts-tooltip-item-value"},U),T.createElement("span",{className:"recharts-tooltip-item-unit"},C.unit||""))});return T.createElement("ul",{className:"recharts-tooltip-item-list",style:R},N)}return null},b=Jw({margin:0,padding:10,backgroundColor:"#fff",border:"1px solid #ccc",whiteSpace:"nowrap"},n),y=Jw({margin:0},r),x=!qn(f),v=x?f:"",w=dn("recharts-default-tooltip",c),S=dn("recharts-tooltip-label",d);x&&h&&a!==void 0&&a!==null&&(v=h(f,a));var A=g?{role:"status","aria-live":"assertive"}:{};return T.createElement("div",yA({className:w,style:b},A),T.createElement("p",{className:S,style:y},T.isValidElement(v)?v:"".concat(v)),m())},up="recharts-tooltip-wrapper",Ahe={visibility:"hidden"};function The(t){var{coordinate:e,translateX:n,translateY:i}=t;return dn(up,{["".concat(up,"-right")]:yt(n)&&e&&yt(e.x)&&n>=e.x,["".concat(up,"-left")]:yt(n)&&e&&yt(e.x)&&n<e.x,["".concat(up,"-bottom")]:yt(i)&&e&&yt(e.y)&&i>=e.y,["".concat(up,"-top")]:yt(i)&&e&&yt(e.y)&&i<e.y})}function JU(t){var{allowEscapeViewBox:e,coordinate:n,key:i,offsetTopLeft:r,position:a,reverseDirection:s,tooltipDimension:l,viewBox:c,viewBoxDimension:d}=t;if(a&&yt(a[i]))return a[i];var f=n[i]-l-(r>0?r:0),h=n[i]+r;if(e[i])return s[i]?f:h;var g=c[i];if(g==null)return 0;if(s[i]){var m=f,b=g;return m<b?Math.max(h,g):Math.max(f,g)}if(d==null)return 0;var y=h+l,x=g+d;return y>x?Math.max(f,g):Math.max(h,g)}function Che(t){var{translateX:e,translateY:n,useTranslate3d:i}=t;return{transform:i?"translate3d(".concat(e,"px, ").concat(n,"px, 0)"):"translate(".concat(e,"px, ").concat(n,"px)")}}function Rhe(t){var{allowEscapeViewBox:e,coordinate:n,offsetTopLeft:i,position:r,reverseDirection:a,tooltipBox:s,useTranslate3d:l,viewBox:c}=t,d,f,h;return s.height>0&&s.width>0&&n?(f=JU({allowEscapeViewBox:e,coordinate:n,key:"x",offsetTopLeft:i,position:r,reverseDirection:a,tooltipDimension:s.width,viewBox:c,viewBoxDimension:c.width}),h=JU({allowEscapeViewBox:e,coordinate:n,key:"y",offsetTopLeft:i,position:r,reverseDirection:a,tooltipDimension:s.height,viewBox:c,viewBoxDimension:c.height}),d=Che({translateX:f,translateY:h,useTranslate3d:l})):d=Ahe,{cssProperties:d,cssClasses:The({translateX:f,translateY:h,coordinate:n})}}function ek(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),n.push.apply(n,i)}return n}function vv(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?ek(Object(n),!0).forEach(function(i){bA(t,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):ek(Object(n)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(n,i))})}return t}function bA(t,e,n){return(e=Phe(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Phe(t){var e=Dhe(t,"string");return typeof e=="symbol"?e:e+""}function Dhe(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var i=n.call(t,e);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}class Nhe extends T.PureComponent{constructor(){super(...arguments),bA(this,"state",{dismissed:!1,dismissedAtCoordinate:{x:0,y:0}}),bA(this,"handleKeyDown",e=>{if(e.key==="Escape"){var n,i,r,a;this.setState({dismissed:!0,dismissedAtCoordinate:{x:(n=(i=this.props.coordinate)===null||i===void 0?void 0:i.x)!==null&&n!==void 0?n:0,y:(r=(a=this.props.coordinate)===null||a===void 0?void 0:a.y)!==null&&r!==void 0?r:0}})}})}componentDidMount(){document.addEventListener("keydown",this.handleKeyDown)}componentWillUnmount(){document.removeEventListener("keydown",this.handleKeyDown)}componentDidUpdate(){var e,n;this.state.dismissed&&(((e=this.props.coordinate)===null||e===void 0?void 0:e.x)!==this.state.dismissedAtCoordinate.x||((n=this.props.coordinate)===null||n===void 0?void 0:n.y)!==this.state.dismissedAtCoordinate.y)&&(this.state.dismissed=!1)}render(){var{active:e,allowEscapeViewBox:n,animationDuration:i,animationEasing:r,children:a,coordinate:s,hasPayload:l,isAnimationActive:c,offset:d,position:f,reverseDirection:h,useTranslate3d:g,viewBox:m,wrapperStyle:b,lastBoundingBox:y,innerRef:x,hasPortalFromProps:v}=this.props,{cssClasses:w,cssProperties:S}=Rhe({allowEscapeViewBox:n,coordinate:s,offsetTopLeft:d,position:f,reverseDirection:h,tooltipBox:{height:y.height,width:y.width},useTranslate3d:g,viewBox:m}),A=v?{}:vv(vv({transition:c&&e?"transform ".concat(i,"ms ").concat(r):void 0},S),{},{pointerEvents:"none",visibility:!this.state.dismissed&&e&&l?"visible":"hidden",position:"absolute",top:0,left:0}),R=vv(vv({},A),{},{visibility:!this.state.dismissed&&e&&l?"visible":"hidden"},b);return T.createElement("div",{xmlns:"http://www.w3.org/1999/xhtml",tabIndex:-1,className:w,style:R,ref:x},a)}}var Vj=()=>{var t;return(t=bt(e=>e.rootProps.accessibilityLayer))!==null&&t!==void 0?t:!0};function _A(){return _A=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)({}).hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},_A.apply(null,arguments)}function tk(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),n.push.apply(n,i)}return n}function nk(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?tk(Object(n),!0).forEach(function(i){Ohe(t,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):tk(Object(n)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(n,i))})}return t}function Ohe(t,e,n){return(e=Lhe(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Lhe(t){var e=Ihe(t,"string");return typeof e=="symbol"?e:e+""}function Ihe(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var i=n.call(t,e);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var ik={curveBasisClosed:gce,curveBasisOpen:vce,curveBasis:mce,curveBumpX:tce,curveBumpY:nce,curveLinearClosed:xce,curveLinear:wy,curveMonotoneX:yce,curveMonotoneY:bce,curveNatural:_ce,curveStep:Sce,curveStepAfter:Ece,curveStepBefore:wce},Px=t=>jn(t.x)&&jn(t.y),rk=t=>t.base!=null&&Px(t.base)&&Px(t),dp=t=>t.x,fp=t=>t.y,Uhe=(t,e)=>{if(typeof t=="function")return t;var n="curve".concat(Sm(t));return(n==="curveMonotone"||n==="curveBump")&&e?ik["".concat(n).concat(e==="vertical"?"Y":"X")]:ik[n]||wy},khe=t=>{var{type:e="linear",points:n=[],baseLine:i,layout:r,connectNulls:a=!1}=t,s=Uhe(e,r),l=a?n.filter(Px):n,c;if(Array.isArray(i)){var d=n.map((m,b)=>nk(nk({},m),{},{base:i[b]}));r==="vertical"?c=cv().y(fp).x1(dp).x0(m=>m.base.x):c=cv().x(dp).y1(fp).y0(m=>m.base.y);var f=c.defined(rk).curve(s),h=a?d.filter(rk):d;return f(h)}r==="vertical"&&yt(i)?c=cv().y(fp).x1(dp).x0(i):yt(i)?c=cv().x(dp).y1(fp).y0(i):c=m5().x(dp).y(fp);var g=c.defined(Px).curve(s);return g(l)},hf=t=>{var{className:e,points:n,path:i,pathRef:r}=t;if((!n||!n.length)&&!i)return null;var a=n&&n.length?khe(t):i;return T.createElement("path",_A({},Jr(t),JT(t),{className:dn("recharts-curve",e),d:a===null?void 0:a,ref:r}))},Fhe=["x","y","top","left","width","height","className"];function SA(){return SA=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)({}).hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},SA.apply(null,arguments)}function ak(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),n.push.apply(n,i)}return n}function zhe(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?ak(Object(n),!0).forEach(function(i){Bhe(t,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):ak(Object(n)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(n,i))})}return t}function Bhe(t,e,n){return(e=jhe(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function jhe(t){var e=Hhe(t,"string");return typeof e=="symbol"?e:e+""}function Hhe(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var i=n.call(t,e);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Ghe(t,e){if(t==null)return{};var n,i,r=Vhe(t,e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(i=0;i<a.length;i++)n=a[i],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function Vhe(t,e){if(t==null)return{};var n={};for(var i in t)if({}.hasOwnProperty.call(t,i)){if(e.indexOf(i)!==-1)continue;n[i]=t[i]}return n}var $he=(t,e,n,i,r,a)=>"M".concat(t,",").concat(r,"v").concat(i,"M").concat(a,",").concat(e,"h").concat(n),Whe=t=>{var{x:e=0,y:n=0,top:i=0,left:r=0,width:a=0,height:s=0,className:l}=t,c=Ghe(t,Fhe),d=zhe({x:e,y:n,top:i,left:r,width:a,height:s},c);return!yt(e)||!yt(n)||!yt(a)||!yt(s)||!yt(i)||!yt(r)?null:T.createElement("path",SA({},kr(d),{className:dn("recharts-cross",l),d:$he(e,n,a,s,i,r)}))};function Xhe(t,e,n,i){var r=i/2;return{stroke:"none",fill:"#ccc",x:t==="horizontal"?e.x-r:n.left+.5,y:t==="horizontal"?n.top+.5:e.y-r,width:t==="horizontal"?i:n.width-1,height:t==="horizontal"?n.height-1:i}}function sk(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),n.push.apply(n,i)}return n}function ok(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?sk(Object(n),!0).forEach(function(i){qhe(t,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):sk(Object(n)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(n,i))})}return t}function qhe(t,e,n){return(e=Yhe(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Yhe(t){var e=Khe(t,"string");return typeof e=="symbol"?e:e+""}function Khe(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var i=n.call(t,e);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Zhe=t=>t.replace(/([A-Z])/g,e=>"-".concat(e.toLowerCase())),$j=(t,e,n)=>t.map(i=>"".concat(Zhe(i)," ").concat(e,"ms ").concat(n)).join(","),Qhe=(t,e)=>[Object.keys(t),Object.keys(e)].reduce((n,i)=>n.filter(r=>i.includes(r))),nm=(t,e)=>Object.keys(e).reduce((n,i)=>ok(ok({},n),{},{[i]:t(i,e[i])}),{});function lk(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),n.push.apply(n,i)}return n}function Ti(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?lk(Object(n),!0).forEach(function(i){Jhe(t,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):lk(Object(n)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(n,i))})}return t}function Jhe(t,e,n){return(e=epe(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function epe(t){var e=tpe(t,"string");return typeof e=="symbol"?e:e+""}function tpe(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var i=n.call(t,e);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Dx=(t,e,n)=>t+(e-t)*n,wA=t=>{var{from:e,to:n}=t;return e!==n},Wj=(t,e,n)=>{var i=nm((r,a)=>{if(wA(a)){var[s,l]=t(a.from,a.to,a.velocity);return Ti(Ti({},a),{},{from:s,velocity:l})}return a},e);return n<1?nm((r,a)=>wA(a)?Ti(Ti({},a),{},{velocity:Dx(a.velocity,i[r].velocity,n),from:Dx(a.from,i[r].from,n)}):a,e):Wj(t,i,n-1)};function npe(t,e,n,i,r,a){var s,l=i.reduce((g,m)=>Ti(Ti({},g),{},{[m]:{from:t[m],velocity:0,to:e[m]}}),{}),c=()=>nm((g,m)=>m.from,l),d=()=>!Object.values(l).filter(wA).length,f=null,h=g=>{s||(s=g);var m=g-s,b=m/n.dt;l=Wj(n,l,b),r(Ti(Ti(Ti({},t),e),c())),s=g,d()||(f=a.setTimeout(h))};return()=>(f=a.setTimeout(h),()=>{var g;(g=f)===null||g===void 0||g()})}function ipe(t,e,n,i,r,a,s){var l=null,c=r.reduce((h,g)=>Ti(Ti({},h),{},{[g]:[t[g],e[g]]}),{}),d,f=h=>{d||(d=h);var g=(h-d)/i,m=nm((y,x)=>Dx(...x,n(g)),c);if(a(Ti(Ti(Ti({},t),e),m)),g<1)l=s.setTimeout(f);else{var b=nm((y,x)=>Dx(...x,n(1)),c);a(Ti(Ti(Ti({},t),e),b))}};return()=>(l=s.setTimeout(f),()=>{var h;(h=l)===null||h===void 0||h()})}const rpe=(t,e,n,i,r,a)=>{var s=Qhe(t,e);return n==null?()=>(r(Ti(Ti({},t),e)),()=>{}):n.isStepper===!0?npe(t,e,n,s,r,a):ipe(t,e,n,i,s,r,a)};var Nx=1e-4,Xj=(t,e)=>[0,3*t,3*e-6*t,3*t-3*e+1],qj=(t,e)=>t.map((n,i)=>n*e**i).reduce((n,i)=>n+i),ck=(t,e)=>n=>{var i=Xj(t,e);return qj(i,n)},ape=(t,e)=>n=>{var i=Xj(t,e),r=[...i.map((a,s)=>a*s).slice(1),0];return qj(r,n)},spe=function(){for(var e=arguments.length,n=new Array(e),i=0;i<e;i++)n[i]=arguments[i];if(n.length===1)switch(n[0]){case"linear":return[0,0,1,1];case"ease":return[.25,.1,.25,1];case"ease-in":return[.42,0,1,1];case"ease-out":return[.42,0,.58,1];case"ease-in-out":return[0,0,.58,1];default:{var r,a=n[0].split("(");if(a[0]==="cubic-bezier"&&((r=a[1])===null||r===void 0?void 0:r.split(")")[0].split(",").length)===4){var s=a[1].split(")")[0].split(",").map(l=>parseFloat(l));return[s[0],s[1],s[2],s[3]]}}}return n.length===4?n:[0,0,1,1]},ope=(t,e,n,i)=>{var r=ck(t,n),a=ck(e,i),s=ape(t,n),l=d=>d>1?1:d<0?0:d,c=d=>{for(var f=d>1?1:d,h=f,g=0;g<8;++g){var m=r(h)-f,b=s(h);if(Math.abs(m-f)<Nx||b<Nx)return a(h);h=l(h-m/b)}return a(h)};return c.isStepper=!1,c},uk=function(){return ope(...spe(...arguments))},lpe=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},{stiff:n=100,damping:i=8,dt:r=17}=e,a=(s,l,c)=>{var d=-(s-l)*n,f=c*i,h=c+(d-f)*r/1e3,g=c*r/1e3+s;return Math.abs(g-l)<Nx&&Math.abs(h)<Nx?[l,0]:[g,h]};return a.isStepper=!0,a.dt=r,a},cpe=t=>{if(typeof t=="string")switch(t){case"ease":case"ease-in-out":case"ease-out":case"ease-in":case"linear":return uk(t);case"spring":return lpe();default:if(t.split("(")[0]==="cubic-bezier")return uk(t)}return typeof t=="function"?t:null};function upe(t){var e,n=()=>null,i=!1,r=null,a=s=>{if(!i){if(Array.isArray(s)){if(!s.length)return;var l=s,[c,...d]=l;if(typeof c=="number"){r=t.setTimeout(a.bind(null,d),c);return}a(c),r=t.setTimeout(a.bind(null,d));return}typeof s=="string"&&(e=s,n(e)),typeof s=="object"&&(e=s,n(e)),typeof s=="function"&&s()}};return{stop:()=>{i=!0},start:s=>{i=!1,r&&(r(),r=null),a(s)},subscribe:s=>(n=s,()=>{n=()=>null}),getTimeoutController:()=>t}}class dpe{setTimeout(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,i=performance.now(),r=null,a=s=>{s-i>=n?e(s):typeof requestAnimationFrame=="function"&&(r=requestAnimationFrame(a))};return r=requestAnimationFrame(a),()=>{r!=null&&cancelAnimationFrame(r)}}}function fpe(){return upe(new dpe)}var hpe=T.createContext(fpe);function ppe(t,e){var n=T.useContext(hpe);return T.useMemo(()=>e??n(t),[t,e,n])}var mpe=()=>!(typeof window<"u"&&window.document&&window.document.createElement&&window.setTimeout),Xf={devToolsEnabled:!1,isSsr:mpe()},gpe={begin:0,duration:1e3,easing:"ease",isActive:!0,canBegin:!0,onAnimationEnd:()=>{},onAnimationStart:()=>{}},dk={t:0},eE={t:1};function Pm(t){var e=Si(t,gpe),{isActive:n,canBegin:i,duration:r,easing:a,begin:s,onAnimationEnd:l,onAnimationStart:c,children:d}=e,f=n==="auto"?!Xf.isSsr:n,h=ppe(e.animationId,e.animationManager),[g,m]=T.useState(f?dk:eE),b=T.useRef(null);return T.useEffect(()=>{f||m(eE)},[f]),T.useEffect(()=>{if(!f||!i)return wm;var y=rpe(dk,eE,cpe(a),r,m,h.getTimeoutController()),x=()=>{b.current=y()};return h.start([c,s,x,r,l]),()=>{h.stop(),b.current&&b.current(),l()}},[f,i,r,a,s,c,l,h]),d(g.t)}function Dm(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"animation-",n=T.useRef(Yp(e)),i=T.useRef(t);return i.current!==t&&(n.current=Yp(e),i.current=t),n.current}var vpe=["radius"],xpe=["radius"];function fk(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),n.push.apply(n,i)}return n}function hk(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?fk(Object(n),!0).forEach(function(i){ype(t,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):fk(Object(n)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(n,i))})}return t}function ype(t,e,n){return(e=bpe(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function bpe(t){var e=_pe(t,"string");return typeof e=="symbol"?e:e+""}function _pe(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var i=n.call(t,e);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Ox(){return Ox=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)({}).hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},Ox.apply(null,arguments)}function pk(t,e){if(t==null)return{};var n,i,r=Spe(t,e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(i=0;i<a.length;i++)n=a[i],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function Spe(t,e){if(t==null)return{};var n={};for(var i in t)if({}.hasOwnProperty.call(t,i)){if(e.indexOf(i)!==-1)continue;n[i]=t[i]}return n}var mk=(t,e,n,i,r)=>{var a=Math.min(Math.abs(n)/2,Math.abs(i)/2),s=i>=0?1:-1,l=n>=0?1:-1,c=i>=0&&n>=0||i<0&&n<0?1:0,d;if(a>0&&r instanceof Array){for(var f=[0,0,0,0],h=0,g=4;h<g;h++)f[h]=r[h]>a?a:r[h];d="M".concat(t,",").concat(e+s*f[0]),f[0]>0&&(d+="A ".concat(f[0],",").concat(f[0],",0,0,").concat(c,",").concat(t+l*f[0],",").concat(e)),d+="L ".concat(t+n-l*f[1],",").concat(e),f[1]>0&&(d+="A ".concat(f[1],",").concat(f[1],",0,0,").concat(c,`,
  8066. `).concat(t+n,",").concat(e+s*f[1])),d+="L ".concat(t+n,",").concat(e+i-s*f[2]),f[2]>0&&(d+="A ".concat(f[2],",").concat(f[2],",0,0,").concat(c,`,
  8067. `).concat(t+n-l*f[2],",").concat(e+i)),d+="L ".concat(t+l*f[3],",").concat(e+i),f[3]>0&&(d+="A ".concat(f[3],",").concat(f[3],",0,0,").concat(c,`,
  8068. `).concat(t,",").concat(e+i-s*f[3])),d+="Z"}else if(a>0&&r===+r&&r>0){var m=Math.min(a,r);d="M ".concat(t,",").concat(e+s*m,`
  8069. A `).concat(m,",").concat(m,",0,0,").concat(c,",").concat(t+l*m,",").concat(e,`
  8070. L `).concat(t+n-l*m,",").concat(e,`
  8071. A `).concat(m,",").concat(m,",0,0,").concat(c,",").concat(t+n,",").concat(e+s*m,`
  8072. L `).concat(t+n,",").concat(e+i-s*m,`
  8073. A `).concat(m,",").concat(m,",0,0,").concat(c,",").concat(t+n-l*m,",").concat(e+i,`
  8074. L `).concat(t+l*m,",").concat(e+i,`
  8075. A `).concat(m,",").concat(m,",0,0,").concat(c,",").concat(t,",").concat(e+i-s*m," Z")}else d="M ".concat(t,",").concat(e," h ").concat(n," v ").concat(i," h ").concat(-n," Z");return d},gk={x:0,y:0,width:0,height:0,radius:0,isAnimationActive:!1,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},Yj=t=>{var e=Si(t,gk),n=T.useRef(null),[i,r]=T.useState(-1);T.useEffect(()=>{if(n.current&&n.current.getTotalLength)try{var V=n.current.getTotalLength();V&&r(V)}catch{}},[]);var{x:a,y:s,width:l,height:c,radius:d,className:f}=e,{animationEasing:h,animationDuration:g,animationBegin:m,isAnimationActive:b,isUpdateAnimationActive:y}=e,x=T.useRef(l),v=T.useRef(c),w=T.useRef(a),S=T.useRef(s),A=T.useMemo(()=>({x:a,y:s,width:l,height:c,radius:d}),[a,s,l,c,d]),R=Dm(A,"rectangle-");if(a!==+a||s!==+s||l!==+l||c!==+c||l===0||c===0)return null;var N=dn("recharts-rectangle",f);if(!y){var C=kr(e),{radius:F}=C,P=pk(C,vpe);return T.createElement("path",Ox({},P,{radius:typeof d=="number"?d:void 0,className:N,d:mk(a,s,l,c,d)}))}var L=x.current,B=v.current,U=w.current,$=S.current,I="0px ".concat(i===-1?1:i,"px"),W="".concat(i,"px 0px"),X=$j(["strokeDasharray"],g,typeof h=="string"?h:gk.animationEasing);return T.createElement(Pm,{animationId:R,key:R,canBegin:i>0,duration:g,easing:h,isActive:y,begin:m},V=>{var Y=Bn(L,l,V),J=Bn(B,c,V),se=Bn(U,a,V),H=Bn($,s,V);n.current&&(x.current=Y,v.current=J,w.current=se,S.current=H);var q;b?V>0?q={transition:X,strokeDasharray:W}:q={strokeDasharray:I}:q={strokeDasharray:W};var re=kr(e),{radius:ce}=re,ye=pk(re,xpe);return T.createElement("path",Ox({},ye,{radius:typeof d=="number"?d:void 0,className:N,d:mk(se,H,Y,J,d),ref:n,style:hk(hk({},q),e.style)}))})};function vk(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),n.push.apply(n,i)}return n}function xk(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?vk(Object(n),!0).forEach(function(i){wpe(t,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):vk(Object(n)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(n,i))})}return t}function wpe(t,e,n){return(e=Epe(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Epe(t){var e=Mpe(t,"string");return typeof e=="symbol"?e:e+""}function Mpe(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var i=n.call(t,e);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Lx=Math.PI/180,Ape=t=>t*180/Math.PI,xi=(t,e,n,i)=>({x:t+Math.cos(-Lx*i)*n,y:e+Math.sin(-Lx*i)*n}),Kj=function(e,n){var i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{top:0,right:0,bottom:0,left:0};return Math.min(Math.abs(e-(i.left||0)-(i.right||0)),Math.abs(n-(i.top||0)-(i.bottom||0)))/2},Tpe=(t,e)=>{var{x:n,y:i}=t,{x:r,y:a}=e;return Math.sqrt((n-r)**2+(i-a)**2)},Cpe=(t,e)=>{var{x:n,y:i}=t,{cx:r,cy:a}=e,s=Tpe({x:n,y:i},{x:r,y:a});if(s<=0)return{radius:s,angle:0};var l=(n-r)/s,c=Math.acos(l);return i>a&&(c=2*Math.PI-c),{radius:s,angle:Ape(c),angleInRadian:c}},Rpe=t=>{var{startAngle:e,endAngle:n}=t,i=Math.floor(e/360),r=Math.floor(n/360),a=Math.min(i,r);return{startAngle:e-a*360,endAngle:n-a*360}},Ppe=(t,e)=>{var{startAngle:n,endAngle:i}=e,r=Math.floor(n/360),a=Math.floor(i/360),s=Math.min(r,a);return t+s*360},Dpe=(t,e)=>{var{chartX:n,chartY:i}=t,{radius:r,angle:a}=Cpe({x:n,y:i},e),{innerRadius:s,outerRadius:l}=e;if(r<s||r>l||r===0)return null;var{startAngle:c,endAngle:d}=Rpe(e),f=a,h;if(c<=d){for(;f>d;)f-=360;for(;f<c;)f+=360;h=f>=c&&f<=d}else{for(;f>c;)f-=360;for(;f<d;)f+=360;h=f>=d&&f<=c}return h?xk(xk({},e),{},{radius:r,angle:Ppe(f,e)}):null};function Zj(t){var{cx:e,cy:n,radius:i,startAngle:r,endAngle:a}=t,s=xi(e,n,i,r),l=xi(e,n,i,a);return{points:[s,l],cx:e,cy:n,radius:i,startAngle:r,endAngle:a}}function EA(){return EA=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)({}).hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},EA.apply(null,arguments)}var Npe=(t,e)=>{var n=Zi(e-t),i=Math.min(Math.abs(e-t),359.999);return n*i},xv=t=>{var{cx:e,cy:n,radius:i,angle:r,sign:a,isExternal:s,cornerRadius:l,cornerIsExternal:c}=t,d=l*(s?1:-1)+i,f=Math.asin(l/d)/Lx,h=c?r:r+a*f,g=xi(e,n,d,h),m=xi(e,n,i,h),b=c?r-a*f:r,y=xi(e,n,d*Math.cos(f*Lx),b);return{center:g,circleTangency:m,lineTangency:y,theta:f}},Qj=t=>{var{cx:e,cy:n,innerRadius:i,outerRadius:r,startAngle:a,endAngle:s}=t,l=Npe(a,s),c=a+l,d=xi(e,n,r,a),f=xi(e,n,r,c),h="M ".concat(d.x,",").concat(d.y,`
  8076. A `).concat(r,",").concat(r,`,0,
  8077. `).concat(+(Math.abs(l)>180),",").concat(+(a>c),`,
  8078. `).concat(f.x,",").concat(f.y,`
  8079. `);if(i>0){var g=xi(e,n,i,a),m=xi(e,n,i,c);h+="L ".concat(m.x,",").concat(m.y,`
  8080. A `).concat(i,",").concat(i,`,0,
  8081. `).concat(+(Math.abs(l)>180),",").concat(+(a<=c),`,
  8082. `).concat(g.x,",").concat(g.y," Z")}else h+="L ".concat(e,",").concat(n," Z");return h},Ope=t=>{var{cx:e,cy:n,innerRadius:i,outerRadius:r,cornerRadius:a,forceCornerRadius:s,cornerIsExternal:l,startAngle:c,endAngle:d}=t,f=Zi(d-c),{circleTangency:h,lineTangency:g,theta:m}=xv({cx:e,cy:n,radius:r,angle:c,sign:f,cornerRadius:a,cornerIsExternal:l}),{circleTangency:b,lineTangency:y,theta:x}=xv({cx:e,cy:n,radius:r,angle:d,sign:-f,cornerRadius:a,cornerIsExternal:l}),v=l?Math.abs(c-d):Math.abs(c-d)-m-x;if(v<0)return s?"M ".concat(g.x,",").concat(g.y,`
  8083. a`).concat(a,",").concat(a,",0,0,1,").concat(a*2,`,0
  8084. a`).concat(a,",").concat(a,",0,0,1,").concat(-a*2,`,0
  8085. `):Qj({cx:e,cy:n,innerRadius:i,outerRadius:r,startAngle:c,endAngle:d});var w="M ".concat(g.x,",").concat(g.y,`
  8086. A`).concat(a,",").concat(a,",0,0,").concat(+(f<0),",").concat(h.x,",").concat(h.y,`
  8087. A`).concat(r,",").concat(r,",0,").concat(+(v>180),",").concat(+(f<0),",").concat(b.x,",").concat(b.y,`
  8088. A`).concat(a,",").concat(a,",0,0,").concat(+(f<0),",").concat(y.x,",").concat(y.y,`
  8089. `);if(i>0){var{circleTangency:S,lineTangency:A,theta:R}=xv({cx:e,cy:n,radius:i,angle:c,sign:f,isExternal:!0,cornerRadius:a,cornerIsExternal:l}),{circleTangency:N,lineTangency:C,theta:F}=xv({cx:e,cy:n,radius:i,angle:d,sign:-f,isExternal:!0,cornerRadius:a,cornerIsExternal:l}),P=l?Math.abs(c-d):Math.abs(c-d)-R-F;if(P<0&&a===0)return"".concat(w,"L").concat(e,",").concat(n,"Z");w+="L".concat(C.x,",").concat(C.y,`
  8090. A`).concat(a,",").concat(a,",0,0,").concat(+(f<0),",").concat(N.x,",").concat(N.y,`
  8091. A`).concat(i,",").concat(i,",0,").concat(+(P>180),",").concat(+(f>0),",").concat(S.x,",").concat(S.y,`
  8092. A`).concat(a,",").concat(a,",0,0,").concat(+(f<0),",").concat(A.x,",").concat(A.y,"Z")}else w+="L".concat(e,",").concat(n,"Z");return w},Lpe={cx:0,cy:0,innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,cornerRadius:0,forceCornerRadius:!1,cornerIsExternal:!1},Jj=t=>{var e=Si(t,Lpe),{cx:n,cy:i,innerRadius:r,outerRadius:a,cornerRadius:s,forceCornerRadius:l,cornerIsExternal:c,startAngle:d,endAngle:f,className:h}=e;if(a<r||d===f)return null;var g=dn("recharts-sector",h),m=a-r,b=Er(s,m,0,!0),y;return b>0&&Math.abs(d-f)<360?y=Ope({cx:n,cy:i,innerRadius:r,outerRadius:a,cornerRadius:Math.min(b,m/2),forceCornerRadius:l,cornerIsExternal:c,startAngle:d,endAngle:f}):y=Qj({cx:n,cy:i,innerRadius:r,outerRadius:a,startAngle:d,endAngle:f}),T.createElement("path",EA({},kr(e),{className:g,d:y}))};function Ipe(t,e,n){if(t==="horizontal")return[{x:e.x,y:n.top},{x:e.x,y:n.top+n.height}];if(t==="vertical")return[{x:n.left,y:e.y},{x:n.left+n.width,y:e.y}];if(P5(e)){if(t==="centric"){var{cx:i,cy:r,innerRadius:a,outerRadius:s,angle:l}=e,c=xi(i,r,a,l),d=xi(i,r,s,l);return[{x:c.x,y:c.y},{x:d.x,y:d.y}]}return Zj(e)}}var tE={},nE={},iE={},yk;function Upe(){return yk||(yk=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=H5();function n(i){return e.isSymbol(i)?NaN:Number(i)}t.toNumber=n})(iE)),iE}var bk;function kpe(){return bk||(bk=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=Upe();function n(i){return i?(i=e.toNumber(i),i===1/0||i===-1/0?(i<0?-1:1)*Number.MAX_VALUE:i===i?i:0):i===0?i:0}t.toFinite=n})(nE)),nE}var _k;function Fpe(){return _k||(_k=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=G5(),n=kpe();function i(r,a,s){s&&typeof s!="number"&&e.isIterateeCall(r,a,s)&&(a=s=void 0),r=n.toFinite(r),a===void 0?(a=r,r=0):a=n.toFinite(a),s=s===void 0?r<a?1:-1:n.toFinite(s);const l=Math.max(Math.ceil((a-r)/(s||1)),0),c=new Array(l);for(let d=0;d<l;d++)c[d]=r,r+=s;return c}t.range=i})(tE)),tE}var rE,Sk;function zpe(){return Sk||(Sk=1,rE=Fpe().range),rE}var Bpe=zpe();const e8=Xs(Bpe);function sc(t,e){return t==null||e==null?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function jpe(t,e){return t==null||e==null?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function g2(t){let e,n,i;t.length!==2?(e=sc,n=(l,c)=>sc(t(l),c),i=(l,c)=>t(l)-c):(e=t===sc||t===jpe?t:Hpe,n=t,i=t);function r(l,c,d=0,f=l.length){if(d<f){if(e(c,c)!==0)return f;do{const h=d+f>>>1;n(l[h],c)<0?d=h+1:f=h}while(d<f)}return d}function a(l,c,d=0,f=l.length){if(d<f){if(e(c,c)!==0)return f;do{const h=d+f>>>1;n(l[h],c)<=0?d=h+1:f=h}while(d<f)}return d}function s(l,c,d=0,f=l.length){const h=r(l,c,d,f-1);return h>d&&i(l[h-1],c)>-i(l[h],c)?h-1:h}return{left:r,center:s,right:a}}function Hpe(){return 0}function t8(t){return t===null?NaN:+t}function*Gpe(t,e){for(let n of t)n!=null&&(n=+n)>=n&&(yield n)}const Vpe=g2(sc),Nm=Vpe.right;g2(t8).center;class wk extends Map{constructor(e,n=Xpe){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:n}}),e!=null)for(const[i,r]of e)this.set(i,r)}get(e){return super.get(Ek(this,e))}has(e){return super.has(Ek(this,e))}set(e,n){return super.set($pe(this,e),n)}delete(e){return super.delete(Wpe(this,e))}}function Ek({_intern:t,_key:e},n){const i=e(n);return t.has(i)?t.get(i):n}function $pe({_intern:t,_key:e},n){const i=e(n);return t.has(i)?t.get(i):(t.set(i,n),n)}function Wpe({_intern:t,_key:e},n){const i=e(n);return t.has(i)&&(n=t.get(i),t.delete(i)),n}function Xpe(t){return t!==null&&typeof t=="object"?t.valueOf():t}function qpe(t=sc){if(t===sc)return n8;if(typeof t!="function")throw new TypeError("compare is not a function");return(e,n)=>{const i=t(e,n);return i||i===0?i:(t(n,n)===0)-(t(e,e)===0)}}function n8(t,e){return(t==null||!(t>=t))-(e==null||!(e>=e))||(t<e?-1:t>e?1:0)}const Ype=Math.sqrt(50),Kpe=Math.sqrt(10),Zpe=Math.sqrt(2);function Ix(t,e,n){const i=(e-t)/Math.max(0,n),r=Math.floor(Math.log10(i)),a=i/Math.pow(10,r),s=a>=Ype?10:a>=Kpe?5:a>=Zpe?2:1;let l,c,d;return r<0?(d=Math.pow(10,-r)/s,l=Math.round(t*d),c=Math.round(e*d),l/d<t&&++l,c/d>e&&--c,d=-d):(d=Math.pow(10,r)*s,l=Math.round(t/d),c=Math.round(e/d),l*d<t&&++l,c*d>e&&--c),c<l&&.5<=n&&n<2?Ix(t,e,n*2):[l,c,d]}function MA(t,e,n){if(e=+e,t=+t,n=+n,!(n>0))return[];if(t===e)return[t];const i=e<t,[r,a,s]=i?Ix(e,t,n):Ix(t,e,n);if(!(a>=r))return[];const l=a-r+1,c=new Array(l);if(i)if(s<0)for(let d=0;d<l;++d)c[d]=(a-d)/-s;else for(let d=0;d<l;++d)c[d]=(a-d)*s;else if(s<0)for(let d=0;d<l;++d)c[d]=(r+d)/-s;else for(let d=0;d<l;++d)c[d]=(r+d)*s;return c}function AA(t,e,n){return e=+e,t=+t,n=+n,Ix(t,e,n)[2]}function TA(t,e,n){e=+e,t=+t,n=+n;const i=e<t,r=i?AA(e,t,n):AA(t,e,n);return(i?-1:1)*(r<0?1/-r:r)}function Mk(t,e){let n;for(const i of t)i!=null&&(n<i||n===void 0&&i>=i)&&(n=i);return n}function Ak(t,e){let n;for(const i of t)i!=null&&(n>i||n===void 0&&i>=i)&&(n=i);return n}function i8(t,e,n=0,i=1/0,r){if(e=Math.floor(e),n=Math.floor(Math.max(0,n)),i=Math.floor(Math.min(t.length-1,i)),!(n<=e&&e<=i))return t;for(r=r===void 0?n8:qpe(r);i>n;){if(i-n>600){const c=i-n+1,d=e-n+1,f=Math.log(c),h=.5*Math.exp(2*f/3),g=.5*Math.sqrt(f*h*(c-h)/c)*(d-c/2<0?-1:1),m=Math.max(n,Math.floor(e-d*h/c+g)),b=Math.min(i,Math.floor(e+(c-d)*h/c+g));i8(t,e,m,b,r)}const a=t[e];let s=n,l=i;for(hp(t,n,e),r(t[i],a)>0&&hp(t,n,i);s<l;){for(hp(t,s,l),++s,--l;r(t[s],a)<0;)++s;for(;r(t[l],a)>0;)--l}r(t[n],a)===0?hp(t,n,l):(++l,hp(t,l,i)),l<=e&&(n=l+1),e<=l&&(i=l-1)}return t}function hp(t,e,n){const i=t[e];t[e]=t[n],t[n]=i}function Qpe(t,e,n){if(t=Float64Array.from(Gpe(t)),!(!(i=t.length)||isNaN(e=+e))){if(e<=0||i<2)return Ak(t);if(e>=1)return Mk(t);var i,r=(i-1)*e,a=Math.floor(r),s=Mk(i8(t,a).subarray(0,a+1)),l=Ak(t.subarray(a+1));return s+(l-s)*(r-a)}}function Jpe(t,e,n=t8){if(!(!(i=t.length)||isNaN(e=+e))){if(e<=0||i<2)return+n(t[0],0,t);if(e>=1)return+n(t[i-1],i-1,t);var i,r=(i-1)*e,a=Math.floor(r),s=+n(t[a],a,t),l=+n(t[a+1],a+1,t);return s+(l-s)*(r-a)}}function eme(t,e,n){t=+t,e=+e,n=(r=arguments.length)<2?(e=t,t=0,1):r<3?1:+n;for(var i=-1,r=Math.max(0,Math.ceil((e-t)/n))|0,a=new Array(r);++i<r;)a[i]=t+i*n;return a}function Qa(t,e){switch(arguments.length){case 0:break;case 1:this.range(t);break;default:this.range(e).domain(t);break}return this}function il(t,e){switch(arguments.length){case 0:break;case 1:{typeof t=="function"?this.interpolator(t):this.range(t);break}default:{this.domain(t),typeof e=="function"?this.interpolator(e):this.range(e);break}}return this}const CA=Symbol("implicit");function v2(){var t=new wk,e=[],n=[],i=CA;function r(a){let s=t.get(a);if(s===void 0){if(i!==CA)return i;t.set(a,s=e.push(a)-1)}return n[s%n.length]}return r.domain=function(a){if(!arguments.length)return e.slice();e=[],t=new wk;for(const s of a)t.has(s)||t.set(s,e.push(s)-1);return r},r.range=function(a){return arguments.length?(n=Array.from(a),r):n.slice()},r.unknown=function(a){return arguments.length?(i=a,r):i},r.copy=function(){return v2(e,n).unknown(i)},Qa.apply(r,arguments),r}function x2(){var t=v2().unknown(void 0),e=t.domain,n=t.range,i=0,r=1,a,s,l=!1,c=0,d=0,f=.5;delete t.unknown;function h(){var g=e().length,m=r<i,b=m?r:i,y=m?i:r;a=(y-b)/Math.max(1,g-c+d*2),l&&(a=Math.floor(a)),b+=(y-b-a*(g-c))*f,s=a*(1-c),l&&(b=Math.round(b),s=Math.round(s));var x=eme(g).map(function(v){return b+a*v});return n(m?x.reverse():x)}return t.domain=function(g){return arguments.length?(e(g),h()):e()},t.range=function(g){return arguments.length?([i,r]=g,i=+i,r=+r,h()):[i,r]},t.rangeRound=function(g){return[i,r]=g,i=+i,r=+r,l=!0,h()},t.bandwidth=function(){return s},t.step=function(){return a},t.round=function(g){return arguments.length?(l=!!g,h()):l},t.padding=function(g){return arguments.length?(c=Math.min(1,d=+g),h()):c},t.paddingInner=function(g){return arguments.length?(c=Math.min(1,g),h()):c},t.paddingOuter=function(g){return arguments.length?(d=+g,h()):d},t.align=function(g){return arguments.length?(f=Math.max(0,Math.min(1,g)),h()):f},t.copy=function(){return x2(e(),[i,r]).round(l).paddingInner(c).paddingOuter(d).align(f)},Qa.apply(h(),arguments)}function r8(t){var e=t.copy;return t.padding=t.paddingOuter,delete t.paddingInner,delete t.paddingOuter,t.copy=function(){return r8(e())},t}function tme(){return r8(x2.apply(null,arguments).paddingInner(1))}function y2(t,e,n){t.prototype=e.prototype=n,n.constructor=t}function a8(t,e){var n=Object.create(t.prototype);for(var i in e)n[i]=e[i];return n}function Om(){}var im=.7,Ux=1/im,pf="\\s*([+-]?\\d+)\\s*",rm="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Bs="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",nme=/^#([0-9a-f]{3,8})$/,ime=new RegExp(`^rgb\\(${pf},${pf},${pf}\\)$`),rme=new RegExp(`^rgb\\(${Bs},${Bs},${Bs}\\)$`),ame=new RegExp(`^rgba\\(${pf},${pf},${pf},${rm}\\)$`),sme=new RegExp(`^rgba\\(${Bs},${Bs},${Bs},${rm}\\)$`),ome=new RegExp(`^hsl\\(${rm},${Bs},${Bs}\\)$`),lme=new RegExp(`^hsla\\(${rm},${Bs},${Bs},${rm}\\)$`),Tk={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};y2(Om,am,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:Ck,formatHex:Ck,formatHex8:cme,formatHsl:ume,formatRgb:Rk,toString:Rk});function Ck(){return this.rgb().formatHex()}function cme(){return this.rgb().formatHex8()}function ume(){return s8(this).formatHsl()}function Rk(){return this.rgb().formatRgb()}function am(t){var e,n;return t=(t+"").trim().toLowerCase(),(e=nme.exec(t))?(n=e[1].length,e=parseInt(e[1],16),n===6?Pk(e):n===3?new Yr(e>>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):n===8?yv(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):n===4?yv(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|e&240,((e&15)<<4|e&15)/255):null):(e=ime.exec(t))?new Yr(e[1],e[2],e[3],1):(e=rme.exec(t))?new Yr(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=ame.exec(t))?yv(e[1],e[2],e[3],e[4]):(e=sme.exec(t))?yv(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=ome.exec(t))?Ok(e[1],e[2]/100,e[3]/100,1):(e=lme.exec(t))?Ok(e[1],e[2]/100,e[3]/100,e[4]):Tk.hasOwnProperty(t)?Pk(Tk[t]):t==="transparent"?new Yr(NaN,NaN,NaN,0):null}function Pk(t){return new Yr(t>>16&255,t>>8&255,t&255,1)}function yv(t,e,n,i){return i<=0&&(t=e=n=NaN),new Yr(t,e,n,i)}function dme(t){return t instanceof Om||(t=am(t)),t?(t=t.rgb(),new Yr(t.r,t.g,t.b,t.opacity)):new Yr}function RA(t,e,n,i){return arguments.length===1?dme(t):new Yr(t,e,n,i??1)}function Yr(t,e,n,i){this.r=+t,this.g=+e,this.b=+n,this.opacity=+i}y2(Yr,RA,a8(Om,{brighter(t){return t=t==null?Ux:Math.pow(Ux,t),new Yr(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=t==null?im:Math.pow(im,t),new Yr(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new Yr(hu(this.r),hu(this.g),hu(this.b),kx(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Dk,formatHex:Dk,formatHex8:fme,formatRgb:Nk,toString:Nk}));function Dk(){return`#${ru(this.r)}${ru(this.g)}${ru(this.b)}`}function fme(){return`#${ru(this.r)}${ru(this.g)}${ru(this.b)}${ru((isNaN(this.opacity)?1:this.opacity)*255)}`}function Nk(){const t=kx(this.opacity);return`${t===1?"rgb(":"rgba("}${hu(this.r)}, ${hu(this.g)}, ${hu(this.b)}${t===1?")":`, ${t})`}`}function kx(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function hu(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function ru(t){return t=hu(t),(t<16?"0":"")+t.toString(16)}function Ok(t,e,n,i){return i<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new ps(t,e,n,i)}function s8(t){if(t instanceof ps)return new ps(t.h,t.s,t.l,t.opacity);if(t instanceof Om||(t=am(t)),!t)return new ps;if(t instanceof ps)return t;t=t.rgb();var e=t.r/255,n=t.g/255,i=t.b/255,r=Math.min(e,n,i),a=Math.max(e,n,i),s=NaN,l=a-r,c=(a+r)/2;return l?(e===a?s=(n-i)/l+(n<i)*6:n===a?s=(i-e)/l+2:s=(e-n)/l+4,l/=c<.5?a+r:2-a-r,s*=60):l=c>0&&c<1?0:s,new ps(s,l,c,t.opacity)}function hme(t,e,n,i){return arguments.length===1?s8(t):new ps(t,e,n,i??1)}function ps(t,e,n,i){this.h=+t,this.s=+e,this.l=+n,this.opacity=+i}y2(ps,hme,a8(Om,{brighter(t){return t=t==null?Ux:Math.pow(Ux,t),new ps(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=t==null?im:Math.pow(im,t),new ps(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+(this.h<0)*360,e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,i=n+(n<.5?n:1-n)*e,r=2*n-i;return new Yr(aE(t>=240?t-240:t+120,r,i),aE(t,r,i),aE(t<120?t+240:t-120,r,i),this.opacity)},clamp(){return new ps(Lk(this.h),bv(this.s),bv(this.l),kx(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const t=kx(this.opacity);return`${t===1?"hsl(":"hsla("}${Lk(this.h)}, ${bv(this.s)*100}%, ${bv(this.l)*100}%${t===1?")":`, ${t})`}`}}));function Lk(t){return t=(t||0)%360,t<0?t+360:t}function bv(t){return Math.max(0,Math.min(1,t||0))}function aE(t,e,n){return(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)*255}const b2=t=>()=>t;function pme(t,e){return function(n){return t+n*e}}function mme(t,e,n){return t=Math.pow(t,n),e=Math.pow(e,n)-t,n=1/n,function(i){return Math.pow(t+i*e,n)}}function gme(t){return(t=+t)==1?o8:function(e,n){return n-e?mme(e,n,t):b2(isNaN(e)?n:e)}}function o8(t,e){var n=e-t;return n?pme(t,n):b2(isNaN(t)?e:t)}const Ik=(function t(e){var n=gme(e);function i(r,a){var s=n((r=RA(r)).r,(a=RA(a)).r),l=n(r.g,a.g),c=n(r.b,a.b),d=o8(r.opacity,a.opacity);return function(f){return r.r=s(f),r.g=l(f),r.b=c(f),r.opacity=d(f),r+""}}return i.gamma=t,i})(1);function vme(t,e){e||(e=[]);var n=t?Math.min(e.length,t.length):0,i=e.slice(),r;return function(a){for(r=0;r<n;++r)i[r]=t[r]*(1-a)+e[r]*a;return i}}function xme(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function yme(t,e){var n=e?e.length:0,i=t?Math.min(n,t.length):0,r=new Array(i),a=new Array(n),s;for(s=0;s<i;++s)r[s]=qf(t[s],e[s]);for(;s<n;++s)a[s]=e[s];return function(l){for(s=0;s<i;++s)a[s]=r[s](l);return a}}function bme(t,e){var n=new Date;return t=+t,e=+e,function(i){return n.setTime(t*(1-i)+e*i),n}}function Fx(t,e){return t=+t,e=+e,function(n){return t*(1-n)+e*n}}function _me(t,e){var n={},i={},r;(t===null||typeof t!="object")&&(t={}),(e===null||typeof e!="object")&&(e={});for(r in e)r in t?n[r]=qf(t[r],e[r]):i[r]=e[r];return function(a){for(r in n)i[r]=n[r](a);return i}}var PA=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,sE=new RegExp(PA.source,"g");function Sme(t){return function(){return t}}function wme(t){return function(e){return t(e)+""}}function Eme(t,e){var n=PA.lastIndex=sE.lastIndex=0,i,r,a,s=-1,l=[],c=[];for(t=t+"",e=e+"";(i=PA.exec(t))&&(r=sE.exec(e));)(a=r.index)>n&&(a=e.slice(n,a),l[s]?l[s]+=a:l[++s]=a),(i=i[0])===(r=r[0])?l[s]?l[s]+=r:l[++s]=r:(l[++s]=null,c.push({i:s,x:Fx(i,r)})),n=sE.lastIndex;return n<e.length&&(a=e.slice(n),l[s]?l[s]+=a:l[++s]=a),l.length<2?c[0]?wme(c[0].x):Sme(e):(e=c.length,function(d){for(var f=0,h;f<e;++f)l[(h=c[f]).i]=h.x(d);return l.join("")})}function qf(t,e){var n=typeof e,i;return e==null||n==="boolean"?b2(e):(n==="number"?Fx:n==="string"?(i=am(e))?(e=i,Ik):Eme:e instanceof am?Ik:e instanceof Date?bme:xme(e)?vme:Array.isArray(e)?yme:typeof e.valueOf!="function"&&typeof e.toString!="function"||isNaN(e)?_me:Fx)(t,e)}function _2(t,e){return t=+t,e=+e,function(n){return Math.round(t*(1-n)+e*n)}}function Mme(t,e){e===void 0&&(e=t,t=qf);for(var n=0,i=e.length-1,r=e[0],a=new Array(i<0?0:i);n<i;)a[n]=t(r,r=e[++n]);return function(s){var l=Math.max(0,Math.min(i-1,Math.floor(s*=i)));return a[l](s-l)}}function Ame(t){return function(){return t}}function zx(t){return+t}var Uk=[0,1];function Ir(t){return t}function DA(t,e){return(e-=t=+t)?function(n){return(n-t)/e}:Ame(isNaN(e)?NaN:.5)}function Tme(t,e){var n;return t>e&&(n=t,t=e,e=n),function(i){return Math.max(t,Math.min(e,i))}}function Cme(t,e,n){var i=t[0],r=t[1],a=e[0],s=e[1];return r<i?(i=DA(r,i),a=n(s,a)):(i=DA(i,r),a=n(a,s)),function(l){return a(i(l))}}function Rme(t,e,n){var i=Math.min(t.length,e.length)-1,r=new Array(i),a=new Array(i),s=-1;for(t[i]<t[0]&&(t=t.slice().reverse(),e=e.slice().reverse());++s<i;)r[s]=DA(t[s],t[s+1]),a[s]=n(e[s],e[s+1]);return function(l){var c=Nm(t,l,1,i)-1;return a[c](r[c](l))}}function Lm(t,e){return e.domain(t.domain()).range(t.range()).interpolate(t.interpolate()).clamp(t.clamp()).unknown(t.unknown())}function Gy(){var t=Uk,e=Uk,n=qf,i,r,a,s=Ir,l,c,d;function f(){var g=Math.min(t.length,e.length);return s!==Ir&&(s=Tme(t[0],t[g-1])),l=g>2?Rme:Cme,c=d=null,h}function h(g){return g==null||isNaN(g=+g)?a:(c||(c=l(t.map(i),e,n)))(i(s(g)))}return h.invert=function(g){return s(r((d||(d=l(e,t.map(i),Fx)))(g)))},h.domain=function(g){return arguments.length?(t=Array.from(g,zx),f()):t.slice()},h.range=function(g){return arguments.length?(e=Array.from(g),f()):e.slice()},h.rangeRound=function(g){return e=Array.from(g),n=_2,f()},h.clamp=function(g){return arguments.length?(s=g?!0:Ir,f()):s!==Ir},h.interpolate=function(g){return arguments.length?(n=g,f()):n},h.unknown=function(g){return arguments.length?(a=g,h):a},function(g,m){return i=g,r=m,f()}}function S2(){return Gy()(Ir,Ir)}function Pme(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)}function Bx(t,e){if((n=(t=e?t.toExponential(e-1):t.toExponential()).indexOf("e"))<0)return null;var n,i=t.slice(0,n);return[i.length>1?i[0]+i.slice(2):i,+t.slice(n+1)]}function Nf(t){return t=Bx(Math.abs(t)),t?t[1]:NaN}function Dme(t,e){return function(n,i){for(var r=n.length,a=[],s=0,l=t[0],c=0;r>0&&l>0&&(c+l+1>i&&(l=Math.max(1,i-c)),a.push(n.substring(r-=l,r+l)),!((c+=l+1)>i));)l=t[s=(s+1)%t.length];return a.reverse().join(e)}}function Nme(t){return function(e){return e.replace(/[0-9]/g,function(n){return t[+n]})}}var Ome=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function sm(t){if(!(e=Ome.exec(t)))throw new Error("invalid format: "+t);var e;return new w2({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]})}sm.prototype=w2.prototype;function w2(t){this.fill=t.fill===void 0?" ":t.fill+"",this.align=t.align===void 0?">":t.align+"",this.sign=t.sign===void 0?"-":t.sign+"",this.symbol=t.symbol===void 0?"":t.symbol+"",this.zero=!!t.zero,this.width=t.width===void 0?void 0:+t.width,this.comma=!!t.comma,this.precision=t.precision===void 0?void 0:+t.precision,this.trim=!!t.trim,this.type=t.type===void 0?"":t.type+""}w2.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function Lme(t){e:for(var e=t.length,n=1,i=-1,r;n<e;++n)switch(t[n]){case".":i=r=n;break;case"0":i===0&&(i=n),r=n;break;default:if(!+t[n])break e;i>0&&(i=0);break}return i>0?t.slice(0,i)+t.slice(r+1):t}var l8;function Ime(t,e){var n=Bx(t,e);if(!n)return t+"";var i=n[0],r=n[1],a=r-(l8=Math.max(-8,Math.min(8,Math.floor(r/3)))*3)+1,s=i.length;return a===s?i:a>s?i+new Array(a-s+1).join("0"):a>0?i.slice(0,a)+"."+i.slice(a):"0."+new Array(1-a).join("0")+Bx(t,Math.max(0,e+a-1))[0]}function kk(t,e){var n=Bx(t,e);if(!n)return t+"";var i=n[0],r=n[1];return r<0?"0."+new Array(-r).join("0")+i:i.length>r+1?i.slice(0,r+1)+"."+i.slice(r+1):i+new Array(r-i.length+2).join("0")}const Fk={"%":(t,e)=>(t*100).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:Pme,e:(t,e)=>t.toExponential(e),f:(t,e)=>t.toFixed(e),g:(t,e)=>t.toPrecision(e),o:t=>Math.round(t).toString(8),p:(t,e)=>kk(t*100,e),r:kk,s:Ime,X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function zk(t){return t}var Bk=Array.prototype.map,jk=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function Ume(t){var e=t.grouping===void 0||t.thousands===void 0?zk:Dme(Bk.call(t.grouping,Number),t.thousands+""),n=t.currency===void 0?"":t.currency[0]+"",i=t.currency===void 0?"":t.currency[1]+"",r=t.decimal===void 0?".":t.decimal+"",a=t.numerals===void 0?zk:Nme(Bk.call(t.numerals,String)),s=t.percent===void 0?"%":t.percent+"",l=t.minus===void 0?"−":t.minus+"",c=t.nan===void 0?"NaN":t.nan+"";function d(h){h=sm(h);var g=h.fill,m=h.align,b=h.sign,y=h.symbol,x=h.zero,v=h.width,w=h.comma,S=h.precision,A=h.trim,R=h.type;R==="n"?(w=!0,R="g"):Fk[R]||(S===void 0&&(S=12),A=!0,R="g"),(x||g==="0"&&m==="=")&&(x=!0,g="0",m="=");var N=y==="$"?n:y==="#"&&/[boxX]/.test(R)?"0"+R.toLowerCase():"",C=y==="$"?i:/[%p]/.test(R)?s:"",F=Fk[R],P=/[defgprs%]/.test(R);S=S===void 0?6:/[gprs]/.test(R)?Math.max(1,Math.min(21,S)):Math.max(0,Math.min(20,S));function L(B){var U=N,$=C,I,W,X;if(R==="c")$=F(B)+$,B="";else{B=+B;var V=B<0||1/B<0;if(B=isNaN(B)?c:F(Math.abs(B),S),A&&(B=Lme(B)),V&&+B==0&&b!=="+"&&(V=!1),U=(V?b==="("?b:l:b==="-"||b==="("?"":b)+U,$=(R==="s"?jk[8+l8/3]:"")+$+(V&&b==="("?")":""),P){for(I=-1,W=B.length;++I<W;)if(X=B.charCodeAt(I),48>X||X>57){$=(X===46?r+B.slice(I+1):B.slice(I))+$,B=B.slice(0,I);break}}}w&&!x&&(B=e(B,1/0));var Y=U.length+B.length+$.length,J=Y<v?new Array(v-Y+1).join(g):"";switch(w&&x&&(B=e(J+B,J.length?v-$.length:1/0),J=""),m){case"<":B=U+B+$+J;break;case"=":B=U+J+B+$;break;case"^":B=J.slice(0,Y=J.length>>1)+U+B+$+J.slice(Y);break;default:B=J+U+B+$;break}return a(B)}return L.toString=function(){return h+""},L}function f(h,g){var m=d((h=sm(h),h.type="f",h)),b=Math.max(-8,Math.min(8,Math.floor(Nf(g)/3)))*3,y=Math.pow(10,-b),x=jk[8+b/3];return function(v){return m(y*v)+x}}return{format:d,formatPrefix:f}}var _v,E2,c8;kme({thousands:",",grouping:[3],currency:["$",""]});function kme(t){return _v=Ume(t),E2=_v.format,c8=_v.formatPrefix,_v}function Fme(t){return Math.max(0,-Nf(Math.abs(t)))}function zme(t,e){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(Nf(e)/3)))*3-Nf(Math.abs(t)))}function Bme(t,e){return t=Math.abs(t),e=Math.abs(e)-t,Math.max(0,Nf(e)-Nf(t))+1}function u8(t,e,n,i){var r=TA(t,e,n),a;switch(i=sm(i??",f"),i.type){case"s":{var s=Math.max(Math.abs(t),Math.abs(e));return i.precision==null&&!isNaN(a=zme(r,s))&&(i.precision=a),c8(i,s)}case"":case"e":case"g":case"p":case"r":{i.precision==null&&!isNaN(a=Bme(r,Math.max(Math.abs(t),Math.abs(e))))&&(i.precision=a-(i.type==="e"));break}case"f":case"%":{i.precision==null&&!isNaN(a=Fme(r))&&(i.precision=a-(i.type==="%")*2);break}}return E2(i)}function gc(t){var e=t.domain;return t.ticks=function(n){var i=e();return MA(i[0],i[i.length-1],n??10)},t.tickFormat=function(n,i){var r=e();return u8(r[0],r[r.length-1],n??10,i)},t.nice=function(n){n==null&&(n=10);var i=e(),r=0,a=i.length-1,s=i[r],l=i[a],c,d,f=10;for(l<s&&(d=s,s=l,l=d,d=r,r=a,a=d);f-- >0;){if(d=AA(s,l,n),d===c)return i[r]=s,i[a]=l,e(i);if(d>0)s=Math.floor(s/d)*d,l=Math.ceil(l/d)*d;else if(d<0)s=Math.ceil(s*d)/d,l=Math.floor(l*d)/d;else break;c=d}return t},t}function d8(){var t=S2();return t.copy=function(){return Lm(t,d8())},Qa.apply(t,arguments),gc(t)}function f8(t){var e;function n(i){return i==null||isNaN(i=+i)?e:i}return n.invert=n,n.domain=n.range=function(i){return arguments.length?(t=Array.from(i,zx),n):t.slice()},n.unknown=function(i){return arguments.length?(e=i,n):e},n.copy=function(){return f8(t).unknown(e)},t=arguments.length?Array.from(t,zx):[0,1],gc(n)}function h8(t,e){t=t.slice();var n=0,i=t.length-1,r=t[n],a=t[i],s;return a<r&&(s=n,n=i,i=s,s=r,r=a,a=s),t[n]=e.floor(r),t[i]=e.ceil(a),t}function Hk(t){return Math.log(t)}function Gk(t){return Math.exp(t)}function jme(t){return-Math.log(-t)}function Hme(t){return-Math.exp(-t)}function Gme(t){return isFinite(t)?+("1e"+t):t<0?0:t}function Vme(t){return t===10?Gme:t===Math.E?Math.exp:e=>Math.pow(t,e)}function $me(t){return t===Math.E?Math.log:t===10&&Math.log10||t===2&&Math.log2||(t=Math.log(t),e=>Math.log(e)/t)}function Vk(t){return(e,n)=>-t(-e,n)}function M2(t){const e=t(Hk,Gk),n=e.domain;let i=10,r,a;function s(){return r=$me(i),a=Vme(i),n()[0]<0?(r=Vk(r),a=Vk(a),t(jme,Hme)):t(Hk,Gk),e}return e.base=function(l){return arguments.length?(i=+l,s()):i},e.domain=function(l){return arguments.length?(n(l),s()):n()},e.ticks=l=>{const c=n();let d=c[0],f=c[c.length-1];const h=f<d;h&&([d,f]=[f,d]);let g=r(d),m=r(f),b,y;const x=l==null?10:+l;let v=[];if(!(i%1)&&m-g<x){if(g=Math.floor(g),m=Math.ceil(m),d>0){for(;g<=m;++g)for(b=1;b<i;++b)if(y=g<0?b/a(-g):b*a(g),!(y<d)){if(y>f)break;v.push(y)}}else for(;g<=m;++g)for(b=i-1;b>=1;--b)if(y=g>0?b/a(-g):b*a(g),!(y<d)){if(y>f)break;v.push(y)}v.length*2<x&&(v=MA(d,f,x))}else v=MA(g,m,Math.min(m-g,x)).map(a);return h?v.reverse():v},e.tickFormat=(l,c)=>{if(l==null&&(l=10),c==null&&(c=i===10?"s":","),typeof c!="function"&&(!(i%1)&&(c=sm(c)).precision==null&&(c.trim=!0),c=E2(c)),l===1/0)return c;const d=Math.max(1,i*l/e.ticks().length);return f=>{let h=f/a(Math.round(r(f)));return h*i<i-.5&&(h*=i),h<=d?c(f):""}},e.nice=()=>n(h8(n(),{floor:l=>a(Math.floor(r(l))),ceil:l=>a(Math.ceil(r(l)))})),e}function p8(){const t=M2(Gy()).domain([1,10]);return t.copy=()=>Lm(t,p8()).base(t.base()),Qa.apply(t,arguments),t}function $k(t){return function(e){return Math.sign(e)*Math.log1p(Math.abs(e/t))}}function Wk(t){return function(e){return Math.sign(e)*Math.expm1(Math.abs(e))*t}}function A2(t){var e=1,n=t($k(e),Wk(e));return n.constant=function(i){return arguments.length?t($k(e=+i),Wk(e)):e},gc(n)}function m8(){var t=A2(Gy());return t.copy=function(){return Lm(t,m8()).constant(t.constant())},Qa.apply(t,arguments)}function Xk(t){return function(e){return e<0?-Math.pow(-e,t):Math.pow(e,t)}}function Wme(t){return t<0?-Math.sqrt(-t):Math.sqrt(t)}function Xme(t){return t<0?-t*t:t*t}function T2(t){var e=t(Ir,Ir),n=1;function i(){return n===1?t(Ir,Ir):n===.5?t(Wme,Xme):t(Xk(n),Xk(1/n))}return e.exponent=function(r){return arguments.length?(n=+r,i()):n},gc(e)}function C2(){var t=T2(Gy());return t.copy=function(){return Lm(t,C2()).exponent(t.exponent())},Qa.apply(t,arguments),t}function qme(){return C2.apply(null,arguments).exponent(.5)}function qk(t){return Math.sign(t)*t*t}function Yme(t){return Math.sign(t)*Math.sqrt(Math.abs(t))}function g8(){var t=S2(),e=[0,1],n=!1,i;function r(a){var s=Yme(t(a));return isNaN(s)?i:n?Math.round(s):s}return r.invert=function(a){return t.invert(qk(a))},r.domain=function(a){return arguments.length?(t.domain(a),r):t.domain()},r.range=function(a){return arguments.length?(t.range((e=Array.from(a,zx)).map(qk)),r):e.slice()},r.rangeRound=function(a){return r.range(a).round(!0)},r.round=function(a){return arguments.length?(n=!!a,r):n},r.clamp=function(a){return arguments.length?(t.clamp(a),r):t.clamp()},r.unknown=function(a){return arguments.length?(i=a,r):i},r.copy=function(){return g8(t.domain(),e).round(n).clamp(t.clamp()).unknown(i)},Qa.apply(r,arguments),gc(r)}function v8(){var t=[],e=[],n=[],i;function r(){var s=0,l=Math.max(1,e.length);for(n=new Array(l-1);++s<l;)n[s-1]=Jpe(t,s/l);return a}function a(s){return s==null||isNaN(s=+s)?i:e[Nm(n,s)]}return a.invertExtent=function(s){var l=e.indexOf(s);return l<0?[NaN,NaN]:[l>0?n[l-1]:t[0],l<n.length?n[l]:t[t.length-1]]},a.domain=function(s){if(!arguments.length)return t.slice();t=[];for(let l of s)l!=null&&!isNaN(l=+l)&&t.push(l);return t.sort(sc),r()},a.range=function(s){return arguments.length?(e=Array.from(s),r()):e.slice()},a.unknown=function(s){return arguments.length?(i=s,a):i},a.quantiles=function(){return n.slice()},a.copy=function(){return v8().domain(t).range(e).unknown(i)},Qa.apply(a,arguments)}function x8(){var t=0,e=1,n=1,i=[.5],r=[0,1],a;function s(c){return c!=null&&c<=c?r[Nm(i,c,0,n)]:a}function l(){var c=-1;for(i=new Array(n);++c<n;)i[c]=((c+1)*e-(c-n)*t)/(n+1);return s}return s.domain=function(c){return arguments.length?([t,e]=c,t=+t,e=+e,l()):[t,e]},s.range=function(c){return arguments.length?(n=(r=Array.from(c)).length-1,l()):r.slice()},s.invertExtent=function(c){var d=r.indexOf(c);return d<0?[NaN,NaN]:d<1?[t,i[0]]:d>=n?[i[n-1],e]:[i[d-1],i[d]]},s.unknown=function(c){return arguments.length&&(a=c),s},s.thresholds=function(){return i.slice()},s.copy=function(){return x8().domain([t,e]).range(r).unknown(a)},Qa.apply(gc(s),arguments)}function y8(){var t=[.5],e=[0,1],n,i=1;function r(a){return a!=null&&a<=a?e[Nm(t,a,0,i)]:n}return r.domain=function(a){return arguments.length?(t=Array.from(a),i=Math.min(t.length,e.length-1),r):t.slice()},r.range=function(a){return arguments.length?(e=Array.from(a),i=Math.min(t.length,e.length-1),r):e.slice()},r.invertExtent=function(a){var s=e.indexOf(a);return[t[s-1],t[s]]},r.unknown=function(a){return arguments.length?(n=a,r):n},r.copy=function(){return y8().domain(t).range(e).unknown(n)},Qa.apply(r,arguments)}const oE=new Date,lE=new Date;function Ui(t,e,n,i){function r(a){return t(a=arguments.length===0?new Date:new Date(+a)),a}return r.floor=a=>(t(a=new Date(+a)),a),r.ceil=a=>(t(a=new Date(a-1)),e(a,1),t(a),a),r.round=a=>{const s=r(a),l=r.ceil(a);return a-s<l-a?s:l},r.offset=(a,s)=>(e(a=new Date(+a),s==null?1:Math.floor(s)),a),r.range=(a,s,l)=>{const c=[];if(a=r.ceil(a),l=l==null?1:Math.floor(l),!(a<s)||!(l>0))return c;let d;do c.push(d=new Date(+a)),e(a,l),t(a);while(d<a&&a<s);return c},r.filter=a=>Ui(s=>{if(s>=s)for(;t(s),!a(s);)s.setTime(s-1)},(s,l)=>{if(s>=s)if(l<0)for(;++l<=0;)for(;e(s,-1),!a(s););else for(;--l>=0;)for(;e(s,1),!a(s););}),n&&(r.count=(a,s)=>(oE.setTime(+a),lE.setTime(+s),t(oE),t(lE),Math.floor(n(oE,lE))),r.every=a=>(a=Math.floor(a),!isFinite(a)||!(a>0)?null:a>1?r.filter(i?s=>i(s)%a===0:s=>r.count(0,s)%a===0):r)),r}const jx=Ui(()=>{},(t,e)=>{t.setTime(+t+e)},(t,e)=>e-t);jx.every=t=>(t=Math.floor(t),!isFinite(t)||!(t>0)?null:t>1?Ui(e=>{e.setTime(Math.floor(e/t)*t)},(e,n)=>{e.setTime(+e+n*t)},(e,n)=>(n-e)/t):jx);jx.range;const Uo=1e3,Wa=Uo*60,ko=Wa*60,Yo=ko*24,R2=Yo*7,Yk=Yo*30,cE=Yo*365,au=Ui(t=>{t.setTime(t-t.getMilliseconds())},(t,e)=>{t.setTime(+t+e*Uo)},(t,e)=>(e-t)/Uo,t=>t.getUTCSeconds());au.range;const P2=Ui(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*Uo)},(t,e)=>{t.setTime(+t+e*Wa)},(t,e)=>(e-t)/Wa,t=>t.getMinutes());P2.range;const D2=Ui(t=>{t.setUTCSeconds(0,0)},(t,e)=>{t.setTime(+t+e*Wa)},(t,e)=>(e-t)/Wa,t=>t.getUTCMinutes());D2.range;const N2=Ui(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*Uo-t.getMinutes()*Wa)},(t,e)=>{t.setTime(+t+e*ko)},(t,e)=>(e-t)/ko,t=>t.getHours());N2.range;const O2=Ui(t=>{t.setUTCMinutes(0,0,0)},(t,e)=>{t.setTime(+t+e*ko)},(t,e)=>(e-t)/ko,t=>t.getUTCHours());O2.range;const Im=Ui(t=>t.setHours(0,0,0,0),(t,e)=>t.setDate(t.getDate()+e),(t,e)=>(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*Wa)/Yo,t=>t.getDate()-1);Im.range;const Vy=Ui(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/Yo,t=>t.getUTCDate()-1);Vy.range;const b8=Ui(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/Yo,t=>Math.floor(t/Yo));b8.range;function ku(t){return Ui(e=>{e.setDate(e.getDate()-(e.getDay()+7-t)%7),e.setHours(0,0,0,0)},(e,n)=>{e.setDate(e.getDate()+n*7)},(e,n)=>(n-e-(n.getTimezoneOffset()-e.getTimezoneOffset())*Wa)/R2)}const $y=ku(0),Hx=ku(1),Kme=ku(2),Zme=ku(3),Of=ku(4),Qme=ku(5),Jme=ku(6);$y.range;Hx.range;Kme.range;Zme.range;Of.range;Qme.range;Jme.range;function Fu(t){return Ui(e=>{e.setUTCDate(e.getUTCDate()-(e.getUTCDay()+7-t)%7),e.setUTCHours(0,0,0,0)},(e,n)=>{e.setUTCDate(e.getUTCDate()+n*7)},(e,n)=>(n-e)/R2)}const Wy=Fu(0),Gx=Fu(1),ege=Fu(2),tge=Fu(3),Lf=Fu(4),nge=Fu(5),ige=Fu(6);Wy.range;Gx.range;ege.range;tge.range;Lf.range;nge.range;ige.range;const L2=Ui(t=>{t.setDate(1),t.setHours(0,0,0,0)},(t,e)=>{t.setMonth(t.getMonth()+e)},(t,e)=>e.getMonth()-t.getMonth()+(e.getFullYear()-t.getFullYear())*12,t=>t.getMonth());L2.range;const I2=Ui(t=>{t.setUTCDate(1),t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCMonth(t.getUTCMonth()+e)},(t,e)=>e.getUTCMonth()-t.getUTCMonth()+(e.getUTCFullYear()-t.getUTCFullYear())*12,t=>t.getUTCMonth());I2.range;const Ko=Ui(t=>{t.setMonth(0,1),t.setHours(0,0,0,0)},(t,e)=>{t.setFullYear(t.getFullYear()+e)},(t,e)=>e.getFullYear()-t.getFullYear(),t=>t.getFullYear());Ko.every=t=>!isFinite(t=Math.floor(t))||!(t>0)?null:Ui(e=>{e.setFullYear(Math.floor(e.getFullYear()/t)*t),e.setMonth(0,1),e.setHours(0,0,0,0)},(e,n)=>{e.setFullYear(e.getFullYear()+n*t)});Ko.range;const Zo=Ui(t=>{t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCFullYear(t.getUTCFullYear()+e)},(t,e)=>e.getUTCFullYear()-t.getUTCFullYear(),t=>t.getUTCFullYear());Zo.every=t=>!isFinite(t=Math.floor(t))||!(t>0)?null:Ui(e=>{e.setUTCFullYear(Math.floor(e.getUTCFullYear()/t)*t),e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,n)=>{e.setUTCFullYear(e.getUTCFullYear()+n*t)});Zo.range;function _8(t,e,n,i,r,a){const s=[[au,1,Uo],[au,5,5*Uo],[au,15,15*Uo],[au,30,30*Uo],[a,1,Wa],[a,5,5*Wa],[a,15,15*Wa],[a,30,30*Wa],[r,1,ko],[r,3,3*ko],[r,6,6*ko],[r,12,12*ko],[i,1,Yo],[i,2,2*Yo],[n,1,R2],[e,1,Yk],[e,3,3*Yk],[t,1,cE]];function l(d,f,h){const g=f<d;g&&([d,f]=[f,d]);const m=h&&typeof h.range=="function"?h:c(d,f,h),b=m?m.range(d,+f+1):[];return g?b.reverse():b}function c(d,f,h){const g=Math.abs(f-d)/h,m=g2(([,,x])=>x).right(s,g);if(m===s.length)return t.every(TA(d/cE,f/cE,h));if(m===0)return jx.every(Math.max(TA(d,f,h),1));const[b,y]=s[g/s[m-1][2]<s[m][2]/g?m-1:m];return b.every(y)}return[l,c]}const[rge,age]=_8(Zo,I2,Wy,b8,O2,D2),[sge,oge]=_8(Ko,L2,$y,Im,N2,P2);function uE(t){if(0<=t.y&&t.y<100){var e=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);return e.setFullYear(t.y),e}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}function dE(t){if(0<=t.y&&t.y<100){var e=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));return e.setUTCFullYear(t.y),e}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}function pp(t,e,n){return{y:t,m:e,d:n,H:0,M:0,S:0,L:0}}function lge(t){var e=t.dateTime,n=t.date,i=t.time,r=t.periods,a=t.days,s=t.shortDays,l=t.months,c=t.shortMonths,d=mp(r),f=gp(r),h=mp(a),g=gp(a),m=mp(s),b=gp(s),y=mp(l),x=gp(l),v=mp(c),w=gp(c),S={a:V,A:Y,b:J,B:se,c:null,d:tF,e:tF,f:Dge,g:jge,G:Gge,H:Cge,I:Rge,j:Pge,L:S8,m:Nge,M:Oge,p:H,q,Q:rF,s:aF,S:Lge,u:Ige,U:Uge,V:kge,w:Fge,W:zge,x:null,X:null,y:Bge,Y:Hge,Z:Vge,"%":iF},A={a:re,A:ce,b:ye,B:me,c:null,d:nF,e:nF,f:qge,g:r0e,G:s0e,H:$ge,I:Wge,j:Xge,L:E8,m:Yge,M:Kge,p:be,q:Ne,Q:rF,s:aF,S:Zge,u:Qge,U:Jge,V:e0e,w:t0e,W:n0e,x:null,X:null,y:i0e,Y:a0e,Z:o0e,"%":iF},R={a:L,A:B,b:U,B:$,c:I,d:Jk,e:Jk,f:Ege,g:Qk,G:Zk,H:eF,I:eF,j:bge,L:wge,m:yge,M:_ge,p:P,q:xge,Q:Age,s:Tge,S:Sge,u:hge,U:pge,V:mge,w:fge,W:gge,x:W,X,y:Qk,Y:Zk,Z:vge,"%":Mge};S.x=N(n,S),S.X=N(i,S),S.c=N(e,S),A.x=N(n,A),A.X=N(i,A),A.c=N(e,A);function N(he,Ae){return function(Be){var le=[],lt=-1,z=0,G=he.length,ne,Q,ee;for(Be instanceof Date||(Be=new Date(+Be));++lt<G;)he.charCodeAt(lt)===37&&(le.push(he.slice(z,lt)),(Q=Kk[ne=he.charAt(++lt)])!=null?ne=he.charAt(++lt):Q=ne==="e"?" ":"0",(ee=Ae[ne])&&(ne=ee(Be,Q)),le.push(ne),z=lt+1);return le.push(he.slice(z,lt)),le.join("")}}function C(he,Ae){return function(Be){var le=pp(1900,void 0,1),lt=F(le,he,Be+="",0),z,G;if(lt!=Be.length)return null;if("Q"in le)return new Date(le.Q);if("s"in le)return new Date(le.s*1e3+("L"in le?le.L:0));if(Ae&&!("Z"in le)&&(le.Z=0),"p"in le&&(le.H=le.H%12+le.p*12),le.m===void 0&&(le.m="q"in le?le.q:0),"V"in le){if(le.V<1||le.V>53)return null;"w"in le||(le.w=1),"Z"in le?(z=dE(pp(le.y,0,1)),G=z.getUTCDay(),z=G>4||G===0?Gx.ceil(z):Gx(z),z=Vy.offset(z,(le.V-1)*7),le.y=z.getUTCFullYear(),le.m=z.getUTCMonth(),le.d=z.getUTCDate()+(le.w+6)%7):(z=uE(pp(le.y,0,1)),G=z.getDay(),z=G>4||G===0?Hx.ceil(z):Hx(z),z=Im.offset(z,(le.V-1)*7),le.y=z.getFullYear(),le.m=z.getMonth(),le.d=z.getDate()+(le.w+6)%7)}else("W"in le||"U"in le)&&("w"in le||(le.w="u"in le?le.u%7:"W"in le?1:0),G="Z"in le?dE(pp(le.y,0,1)).getUTCDay():uE(pp(le.y,0,1)).getDay(),le.m=0,le.d="W"in le?(le.w+6)%7+le.W*7-(G+5)%7:le.w+le.U*7-(G+6)%7);return"Z"in le?(le.H+=le.Z/100|0,le.M+=le.Z%100,dE(le)):uE(le)}}function F(he,Ae,Be,le){for(var lt=0,z=Ae.length,G=Be.length,ne,Q;lt<z;){if(le>=G)return-1;if(ne=Ae.charCodeAt(lt++),ne===37){if(ne=Ae.charAt(lt++),Q=R[ne in Kk?Ae.charAt(lt++):ne],!Q||(le=Q(he,Be,le))<0)return-1}else if(ne!=Be.charCodeAt(le++))return-1}return le}function P(he,Ae,Be){var le=d.exec(Ae.slice(Be));return le?(he.p=f.get(le[0].toLowerCase()),Be+le[0].length):-1}function L(he,Ae,Be){var le=m.exec(Ae.slice(Be));return le?(he.w=b.get(le[0].toLowerCase()),Be+le[0].length):-1}function B(he,Ae,Be){var le=h.exec(Ae.slice(Be));return le?(he.w=g.get(le[0].toLowerCase()),Be+le[0].length):-1}function U(he,Ae,Be){var le=v.exec(Ae.slice(Be));return le?(he.m=w.get(le[0].toLowerCase()),Be+le[0].length):-1}function $(he,Ae,Be){var le=y.exec(Ae.slice(Be));return le?(he.m=x.get(le[0].toLowerCase()),Be+le[0].length):-1}function I(he,Ae,Be){return F(he,e,Ae,Be)}function W(he,Ae,Be){return F(he,n,Ae,Be)}function X(he,Ae,Be){return F(he,i,Ae,Be)}function V(he){return s[he.getDay()]}function Y(he){return a[he.getDay()]}function J(he){return c[he.getMonth()]}function se(he){return l[he.getMonth()]}function H(he){return r[+(he.getHours()>=12)]}function q(he){return 1+~~(he.getMonth()/3)}function re(he){return s[he.getUTCDay()]}function ce(he){return a[he.getUTCDay()]}function ye(he){return c[he.getUTCMonth()]}function me(he){return l[he.getUTCMonth()]}function be(he){return r[+(he.getUTCHours()>=12)]}function Ne(he){return 1+~~(he.getUTCMonth()/3)}return{format:function(he){var Ae=N(he+="",S);return Ae.toString=function(){return he},Ae},parse:function(he){var Ae=C(he+="",!1);return Ae.toString=function(){return he},Ae},utcFormat:function(he){var Ae=N(he+="",A);return Ae.toString=function(){return he},Ae},utcParse:function(he){var Ae=C(he+="",!0);return Ae.toString=function(){return he},Ae}}}var Kk={"-":"",_:" ",0:"0"},er=/^\s*\d+/,cge=/^%/,uge=/[\\^$*+?|[\]().{}]/g;function fn(t,e,n){var i=t<0?"-":"",r=(i?-t:t)+"",a=r.length;return i+(a<n?new Array(n-a+1).join(e)+r:r)}function dge(t){return t.replace(uge,"\\$&")}function mp(t){return new RegExp("^(?:"+t.map(dge).join("|")+")","i")}function gp(t){return new Map(t.map((e,n)=>[e.toLowerCase(),n]))}function fge(t,e,n){var i=er.exec(e.slice(n,n+1));return i?(t.w=+i[0],n+i[0].length):-1}function hge(t,e,n){var i=er.exec(e.slice(n,n+1));return i?(t.u=+i[0],n+i[0].length):-1}function pge(t,e,n){var i=er.exec(e.slice(n,n+2));return i?(t.U=+i[0],n+i[0].length):-1}function mge(t,e,n){var i=er.exec(e.slice(n,n+2));return i?(t.V=+i[0],n+i[0].length):-1}function gge(t,e,n){var i=er.exec(e.slice(n,n+2));return i?(t.W=+i[0],n+i[0].length):-1}function Zk(t,e,n){var i=er.exec(e.slice(n,n+4));return i?(t.y=+i[0],n+i[0].length):-1}function Qk(t,e,n){var i=er.exec(e.slice(n,n+2));return i?(t.y=+i[0]+(+i[0]>68?1900:2e3),n+i[0].length):-1}function vge(t,e,n){var i=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(e.slice(n,n+6));return i?(t.Z=i[1]?0:-(i[2]+(i[3]||"00")),n+i[0].length):-1}function xge(t,e,n){var i=er.exec(e.slice(n,n+1));return i?(t.q=i[0]*3-3,n+i[0].length):-1}function yge(t,e,n){var i=er.exec(e.slice(n,n+2));return i?(t.m=i[0]-1,n+i[0].length):-1}function Jk(t,e,n){var i=er.exec(e.slice(n,n+2));return i?(t.d=+i[0],n+i[0].length):-1}function bge(t,e,n){var i=er.exec(e.slice(n,n+3));return i?(t.m=0,t.d=+i[0],n+i[0].length):-1}function eF(t,e,n){var i=er.exec(e.slice(n,n+2));return i?(t.H=+i[0],n+i[0].length):-1}function _ge(t,e,n){var i=er.exec(e.slice(n,n+2));return i?(t.M=+i[0],n+i[0].length):-1}function Sge(t,e,n){var i=er.exec(e.slice(n,n+2));return i?(t.S=+i[0],n+i[0].length):-1}function wge(t,e,n){var i=er.exec(e.slice(n,n+3));return i?(t.L=+i[0],n+i[0].length):-1}function Ege(t,e,n){var i=er.exec(e.slice(n,n+6));return i?(t.L=Math.floor(i[0]/1e3),n+i[0].length):-1}function Mge(t,e,n){var i=cge.exec(e.slice(n,n+1));return i?n+i[0].length:-1}function Age(t,e,n){var i=er.exec(e.slice(n));return i?(t.Q=+i[0],n+i[0].length):-1}function Tge(t,e,n){var i=er.exec(e.slice(n));return i?(t.s=+i[0],n+i[0].length):-1}function tF(t,e){return fn(t.getDate(),e,2)}function Cge(t,e){return fn(t.getHours(),e,2)}function Rge(t,e){return fn(t.getHours()%12||12,e,2)}function Pge(t,e){return fn(1+Im.count(Ko(t),t),e,3)}function S8(t,e){return fn(t.getMilliseconds(),e,3)}function Dge(t,e){return S8(t,e)+"000"}function Nge(t,e){return fn(t.getMonth()+1,e,2)}function Oge(t,e){return fn(t.getMinutes(),e,2)}function Lge(t,e){return fn(t.getSeconds(),e,2)}function Ige(t){var e=t.getDay();return e===0?7:e}function Uge(t,e){return fn($y.count(Ko(t)-1,t),e,2)}function w8(t){var e=t.getDay();return e>=4||e===0?Of(t):Of.ceil(t)}function kge(t,e){return t=w8(t),fn(Of.count(Ko(t),t)+(Ko(t).getDay()===4),e,2)}function Fge(t){return t.getDay()}function zge(t,e){return fn(Hx.count(Ko(t)-1,t),e,2)}function Bge(t,e){return fn(t.getFullYear()%100,e,2)}function jge(t,e){return t=w8(t),fn(t.getFullYear()%100,e,2)}function Hge(t,e){return fn(t.getFullYear()%1e4,e,4)}function Gge(t,e){var n=t.getDay();return t=n>=4||n===0?Of(t):Of.ceil(t),fn(t.getFullYear()%1e4,e,4)}function Vge(t){var e=t.getTimezoneOffset();return(e>0?"-":(e*=-1,"+"))+fn(e/60|0,"0",2)+fn(e%60,"0",2)}function nF(t,e){return fn(t.getUTCDate(),e,2)}function $ge(t,e){return fn(t.getUTCHours(),e,2)}function Wge(t,e){return fn(t.getUTCHours()%12||12,e,2)}function Xge(t,e){return fn(1+Vy.count(Zo(t),t),e,3)}function E8(t,e){return fn(t.getUTCMilliseconds(),e,3)}function qge(t,e){return E8(t,e)+"000"}function Yge(t,e){return fn(t.getUTCMonth()+1,e,2)}function Kge(t,e){return fn(t.getUTCMinutes(),e,2)}function Zge(t,e){return fn(t.getUTCSeconds(),e,2)}function Qge(t){var e=t.getUTCDay();return e===0?7:e}function Jge(t,e){return fn(Wy.count(Zo(t)-1,t),e,2)}function M8(t){var e=t.getUTCDay();return e>=4||e===0?Lf(t):Lf.ceil(t)}function e0e(t,e){return t=M8(t),fn(Lf.count(Zo(t),t)+(Zo(t).getUTCDay()===4),e,2)}function t0e(t){return t.getUTCDay()}function n0e(t,e){return fn(Gx.count(Zo(t)-1,t),e,2)}function i0e(t,e){return fn(t.getUTCFullYear()%100,e,2)}function r0e(t,e){return t=M8(t),fn(t.getUTCFullYear()%100,e,2)}function a0e(t,e){return fn(t.getUTCFullYear()%1e4,e,4)}function s0e(t,e){var n=t.getUTCDay();return t=n>=4||n===0?Lf(t):Lf.ceil(t),fn(t.getUTCFullYear()%1e4,e,4)}function o0e(){return"+0000"}function iF(){return"%"}function rF(t){return+t}function aF(t){return Math.floor(+t/1e3)}var Yd,A8,T8;l0e({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});function l0e(t){return Yd=lge(t),A8=Yd.format,Yd.parse,T8=Yd.utcFormat,Yd.utcParse,Yd}function c0e(t){return new Date(t)}function u0e(t){return t instanceof Date?+t:+new Date(+t)}function U2(t,e,n,i,r,a,s,l,c,d){var f=S2(),h=f.invert,g=f.domain,m=d(".%L"),b=d(":%S"),y=d("%I:%M"),x=d("%I %p"),v=d("%a %d"),w=d("%b %d"),S=d("%B"),A=d("%Y");function R(N){return(c(N)<N?m:l(N)<N?b:s(N)<N?y:a(N)<N?x:i(N)<N?r(N)<N?v:w:n(N)<N?S:A)(N)}return f.invert=function(N){return new Date(h(N))},f.domain=function(N){return arguments.length?g(Array.from(N,u0e)):g().map(c0e)},f.ticks=function(N){var C=g();return t(C[0],C[C.length-1],N??10)},f.tickFormat=function(N,C){return C==null?R:d(C)},f.nice=function(N){var C=g();return(!N||typeof N.range!="function")&&(N=e(C[0],C[C.length-1],N??10)),N?g(h8(C,N)):f},f.copy=function(){return Lm(f,U2(t,e,n,i,r,a,s,l,c,d))},f}function d0e(){return Qa.apply(U2(sge,oge,Ko,L2,$y,Im,N2,P2,au,A8).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}function f0e(){return Qa.apply(U2(rge,age,Zo,I2,Wy,Vy,O2,D2,au,T8).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)}function Xy(){var t=0,e=1,n,i,r,a,s=Ir,l=!1,c;function d(h){return h==null||isNaN(h=+h)?c:s(r===0?.5:(h=(a(h)-n)*r,l?Math.max(0,Math.min(1,h)):h))}d.domain=function(h){return arguments.length?([t,e]=h,n=a(t=+t),i=a(e=+e),r=n===i?0:1/(i-n),d):[t,e]},d.clamp=function(h){return arguments.length?(l=!!h,d):l},d.interpolator=function(h){return arguments.length?(s=h,d):s};function f(h){return function(g){var m,b;return arguments.length?([m,b]=g,s=h(m,b),d):[s(0),s(1)]}}return d.range=f(qf),d.rangeRound=f(_2),d.unknown=function(h){return arguments.length?(c=h,d):c},function(h){return a=h,n=h(t),i=h(e),r=n===i?0:1/(i-n),d}}function vc(t,e){return e.domain(t.domain()).interpolator(t.interpolator()).clamp(t.clamp()).unknown(t.unknown())}function C8(){var t=gc(Xy()(Ir));return t.copy=function(){return vc(t,C8())},il.apply(t,arguments)}function R8(){var t=M2(Xy()).domain([1,10]);return t.copy=function(){return vc(t,R8()).base(t.base())},il.apply(t,arguments)}function P8(){var t=A2(Xy());return t.copy=function(){return vc(t,P8()).constant(t.constant())},il.apply(t,arguments)}function k2(){var t=T2(Xy());return t.copy=function(){return vc(t,k2()).exponent(t.exponent())},il.apply(t,arguments)}function h0e(){return k2.apply(null,arguments).exponent(.5)}function D8(){var t=[],e=Ir;function n(i){if(i!=null&&!isNaN(i=+i))return e((Nm(t,i,1)-1)/(t.length-1))}return n.domain=function(i){if(!arguments.length)return t.slice();t=[];for(let r of i)r!=null&&!isNaN(r=+r)&&t.push(r);return t.sort(sc),n},n.interpolator=function(i){return arguments.length?(e=i,n):e},n.range=function(){return t.map((i,r)=>e(r/(t.length-1)))},n.quantiles=function(i){return Array.from({length:i+1},(r,a)=>Qpe(t,a/i))},n.copy=function(){return D8(e).domain(t)},il.apply(n,arguments)}function qy(){var t=0,e=.5,n=1,i=1,r,a,s,l,c,d=Ir,f,h=!1,g;function m(y){return isNaN(y=+y)?g:(y=.5+((y=+f(y))-a)*(i*y<i*a?l:c),d(h?Math.max(0,Math.min(1,y)):y))}m.domain=function(y){return arguments.length?([t,e,n]=y,r=f(t=+t),a=f(e=+e),s=f(n=+n),l=r===a?0:.5/(a-r),c=a===s?0:.5/(s-a),i=a<r?-1:1,m):[t,e,n]},m.clamp=function(y){return arguments.length?(h=!!y,m):h},m.interpolator=function(y){return arguments.length?(d=y,m):d};function b(y){return function(x){var v,w,S;return arguments.length?([v,w,S]=x,d=Mme(y,[v,w,S]),m):[d(0),d(.5),d(1)]}}return m.range=b(qf),m.rangeRound=b(_2),m.unknown=function(y){return arguments.length?(g=y,m):g},function(y){return f=y,r=y(t),a=y(e),s=y(n),l=r===a?0:.5/(a-r),c=a===s?0:.5/(s-a),i=a<r?-1:1,m}}function N8(){var t=gc(qy()(Ir));return t.copy=function(){return vc(t,N8())},il.apply(t,arguments)}function O8(){var t=M2(qy()).domain([.1,1,10]);return t.copy=function(){return vc(t,O8()).base(t.base())},il.apply(t,arguments)}function L8(){var t=A2(qy());return t.copy=function(){return vc(t,L8()).constant(t.constant())},il.apply(t,arguments)}function F2(){var t=T2(qy());return t.copy=function(){return vc(t,F2()).exponent(t.exponent())},il.apply(t,arguments)}function p0e(){return F2.apply(null,arguments).exponent(.5)}const wp=Object.freeze(Object.defineProperty({__proto__:null,scaleBand:x2,scaleDiverging:N8,scaleDivergingLog:O8,scaleDivergingPow:F2,scaleDivergingSqrt:p0e,scaleDivergingSymlog:L8,scaleIdentity:f8,scaleImplicit:CA,scaleLinear:d8,scaleLog:p8,scaleOrdinal:v2,scalePoint:tme,scalePow:C2,scaleQuantile:v8,scaleQuantize:x8,scaleRadial:g8,scaleSequential:C8,scaleSequentialLog:R8,scaleSequentialPow:k2,scaleSequentialQuantile:D8,scaleSequentialSqrt:h0e,scaleSequentialSymlog:P8,scaleSqrt:qme,scaleSymlog:m8,scaleThreshold:y8,scaleTime:d0e,scaleUtc:f0e,tickFormat:u8},Symbol.toStringTag,{value:"Module"}));var xc=t=>t.chartData,z2=He([xc],t=>{var e=t.chartData!=null?t.chartData.length-1:0;return{chartData:t.chartData,computedData:t.computedData,dataEndIndex:e,dataStartIndex:0}}),Yy=(t,e,n,i)=>i?z2(t):xc(t);function dc(t){if(Array.isArray(t)&&t.length===2){var[e,n]=t;if(jn(e)&&jn(n))return!0}return!1}function sF(t,e,n){return n?t:[Math.min(t[0],e[0]),Math.max(t[1],e[1])]}function I8(t,e){if(e&&typeof t!="function"&&Array.isArray(t)&&t.length===2){var[n,i]=t,r,a;if(jn(n))r=n;else if(typeof n=="function")return;if(jn(i))a=i;else if(typeof i=="function")return;var s=[r,a];if(dc(s))return s}}function m0e(t,e,n){if(!(!n&&e==null)){if(typeof t=="function"&&e!=null)try{var i=t(e,n);if(dc(i))return sF(i,e,n)}catch{}if(Array.isArray(t)&&t.length===2){var[r,a]=t,s,l;if(r==="auto")e!=null&&(s=Math.min(...e));else if(yt(r))s=r;else if(typeof r=="function")try{e!=null&&(s=r(e?.[0]))}catch{}else if(typeof r=="string"&&LU.test(r)){var c=LU.exec(r);if(c==null||e==null)s=void 0;else{var d=+c[1];s=e[0]-d}}else s=e?.[0];if(a==="auto")e!=null&&(l=Math.max(...e));else if(yt(a))l=a;else if(typeof a=="function")try{e!=null&&(l=a(e?.[1]))}catch{}else if(typeof a=="string"&&IU.test(a)){var f=IU.exec(a);if(f==null||e==null)l=void 0;else{var h=+f[1];l=e[1]+h}}else l=e?.[1];var g=[s,l];if(dc(g))return e==null?g:sF(g,e,n)}}}var Yf=1e9,g0e={precision:20,rounding:4,toExpNeg:-7,toExpPos:21,LN10:"2.302585092994045684017991454684364207601101488628772976033327900967572609677352480235997205089598298341967784042286"},j2,Vn=!0,Za="[DecimalError] ",pu=Za+"Invalid argument: ",B2=Za+"Exponent out of range: ",Kf=Math.floor,Kc=Math.pow,v0e=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,ga,qi=1e7,zn=7,U8=9007199254740991,Vx=Kf(U8/zn),_t={};_t.absoluteValue=_t.abs=function(){var t=new this.constructor(this);return t.s&&(t.s=1),t};_t.comparedTo=_t.cmp=function(t){var e,n,i,r,a=this;if(t=new a.constructor(t),a.s!==t.s)return a.s||-t.s;if(a.e!==t.e)return a.e>t.e^a.s<0?1:-1;for(i=a.d.length,r=t.d.length,e=0,n=i<r?i:r;e<n;++e)if(a.d[e]!==t.d[e])return a.d[e]>t.d[e]^a.s<0?1:-1;return i===r?0:i>r^a.s<0?1:-1};_t.decimalPlaces=_t.dp=function(){var t=this,e=t.d.length-1,n=(e-t.e)*zn;if(e=t.d[e],e)for(;e%10==0;e/=10)n--;return n<0?0:n};_t.dividedBy=_t.div=function(t){return Ho(this,new this.constructor(t))};_t.dividedToIntegerBy=_t.idiv=function(t){var e=this,n=e.constructor;return Nn(Ho(e,new n(t),0,1),n.precision)};_t.equals=_t.eq=function(t){return!this.cmp(t)};_t.exponent=function(){return _i(this)};_t.greaterThan=_t.gt=function(t){return this.cmp(t)>0};_t.greaterThanOrEqualTo=_t.gte=function(t){return this.cmp(t)>=0};_t.isInteger=_t.isint=function(){return this.e>this.d.length-2};_t.isNegative=_t.isneg=function(){return this.s<0};_t.isPositive=_t.ispos=function(){return this.s>0};_t.isZero=function(){return this.s===0};_t.lessThan=_t.lt=function(t){return this.cmp(t)<0};_t.lessThanOrEqualTo=_t.lte=function(t){return this.cmp(t)<1};_t.logarithm=_t.log=function(t){var e,n=this,i=n.constructor,r=i.precision,a=r+5;if(t===void 0)t=new i(10);else if(t=new i(t),t.s<1||t.eq(ga))throw Error(Za+"NaN");if(n.s<1)throw Error(Za+(n.s?"NaN":"-Infinity"));return n.eq(ga)?new i(0):(Vn=!1,e=Ho(om(n,a),om(t,a),a),Vn=!0,Nn(e,r))};_t.minus=_t.sub=function(t){var e=this;return t=new e.constructor(t),e.s==t.s?z8(e,t):k8(e,(t.s=-t.s,t))};_t.modulo=_t.mod=function(t){var e,n=this,i=n.constructor,r=i.precision;if(t=new i(t),!t.s)throw Error(Za+"NaN");return n.s?(Vn=!1,e=Ho(n,t,0,1).times(t),Vn=!0,n.minus(e)):Nn(new i(n),r)};_t.naturalExponential=_t.exp=function(){return F8(this)};_t.naturalLogarithm=_t.ln=function(){return om(this)};_t.negated=_t.neg=function(){var t=new this.constructor(this);return t.s=-t.s||0,t};_t.plus=_t.add=function(t){var e=this;return t=new e.constructor(t),e.s==t.s?k8(e,t):z8(e,(t.s=-t.s,t))};_t.precision=_t.sd=function(t){var e,n,i,r=this;if(t!==void 0&&t!==!!t&&t!==1&&t!==0)throw Error(pu+t);if(e=_i(r)+1,i=r.d.length-1,n=i*zn+1,i=r.d[i],i){for(;i%10==0;i/=10)n--;for(i=r.d[0];i>=10;i/=10)n++}return t&&e>n?e:n};_t.squareRoot=_t.sqrt=function(){var t,e,n,i,r,a,s,l=this,c=l.constructor;if(l.s<1){if(!l.s)return new c(0);throw Error(Za+"NaN")}for(t=_i(l),Vn=!1,r=Math.sqrt(+l),r==0||r==1/0?(e=ks(l.d),(e.length+t)%2==0&&(e+="0"),r=Math.sqrt(e),t=Kf((t+1)/2)-(t<0||t%2),r==1/0?e="5e"+t:(e=r.toExponential(),e=e.slice(0,e.indexOf("e")+1)+t),i=new c(e)):i=new c(r.toString()),n=c.precision,r=s=n+3;;)if(a=i,i=a.plus(Ho(l,a,s+2)).times(.5),ks(a.d).slice(0,s)===(e=ks(i.d)).slice(0,s)){if(e=e.slice(s-3,s+1),r==s&&e=="4999"){if(Nn(a,n+1,0),a.times(a).eq(l)){i=a;break}}else if(e!="9999")break;s+=4}return Vn=!0,Nn(i,n)};_t.times=_t.mul=function(t){var e,n,i,r,a,s,l,c,d,f=this,h=f.constructor,g=f.d,m=(t=new h(t)).d;if(!f.s||!t.s)return new h(0);for(t.s*=f.s,n=f.e+t.e,c=g.length,d=m.length,c<d&&(a=g,g=m,m=a,s=c,c=d,d=s),a=[],s=c+d,i=s;i--;)a.push(0);for(i=d;--i>=0;){for(e=0,r=c+i;r>i;)l=a[r]+m[i]*g[r-i-1]+e,a[r--]=l%qi|0,e=l/qi|0;a[r]=(a[r]+e)%qi|0}for(;!a[--s];)a.pop();return e?++n:a.shift(),t.d=a,t.e=n,Vn?Nn(t,h.precision):t};_t.toDecimalPlaces=_t.todp=function(t,e){var n=this,i=n.constructor;return n=new i(n),t===void 0?n:($s(t,0,Yf),e===void 0?e=i.rounding:$s(e,0,8),Nn(n,t+_i(n)+1,e))};_t.toExponential=function(t,e){var n,i=this,r=i.constructor;return t===void 0?n=Pu(i,!0):($s(t,0,Yf),e===void 0?e=r.rounding:$s(e,0,8),i=Nn(new r(i),t+1,e),n=Pu(i,!0,t+1)),n};_t.toFixed=function(t,e){var n,i,r=this,a=r.constructor;return t===void 0?Pu(r):($s(t,0,Yf),e===void 0?e=a.rounding:$s(e,0,8),i=Nn(new a(r),t+_i(r)+1,e),n=Pu(i.abs(),!1,t+_i(i)+1),r.isneg()&&!r.isZero()?"-"+n:n)};_t.toInteger=_t.toint=function(){var t=this,e=t.constructor;return Nn(new e(t),_i(t)+1,e.rounding)};_t.toNumber=function(){return+this};_t.toPower=_t.pow=function(t){var e,n,i,r,a,s,l=this,c=l.constructor,d=12,f=+(t=new c(t));if(!t.s)return new c(ga);if(l=new c(l),!l.s){if(t.s<1)throw Error(Za+"Infinity");return l}if(l.eq(ga))return l;if(i=c.precision,t.eq(ga))return Nn(l,i);if(e=t.e,n=t.d.length-1,s=e>=n,a=l.s,s){if((n=f<0?-f:f)<=U8){for(r=new c(ga),e=Math.ceil(i/zn+4),Vn=!1;n%2&&(r=r.times(l),lF(r.d,e)),n=Kf(n/2),n!==0;)l=l.times(l),lF(l.d,e);return Vn=!0,t.s<0?new c(ga).div(r):Nn(r,i)}}else if(a<0)throw Error(Za+"NaN");return a=a<0&&t.d[Math.max(e,n)]&1?-1:1,l.s=1,Vn=!1,r=t.times(om(l,i+d)),Vn=!0,r=F8(r),r.s=a,r};_t.toPrecision=function(t,e){var n,i,r=this,a=r.constructor;return t===void 0?(n=_i(r),i=Pu(r,n<=a.toExpNeg||n>=a.toExpPos)):($s(t,1,Yf),e===void 0?e=a.rounding:$s(e,0,8),r=Nn(new a(r),t,e),n=_i(r),i=Pu(r,t<=n||n<=a.toExpNeg,t)),i};_t.toSignificantDigits=_t.tosd=function(t,e){var n=this,i=n.constructor;return t===void 0?(t=i.precision,e=i.rounding):($s(t,1,Yf),e===void 0?e=i.rounding:$s(e,0,8)),Nn(new i(n),t,e)};_t.toString=_t.valueOf=_t.val=_t.toJSON=_t[Symbol.for("nodejs.util.inspect.custom")]=function(){var t=this,e=_i(t),n=t.constructor;return Pu(t,e<=n.toExpNeg||e>=n.toExpPos)};function k8(t,e){var n,i,r,a,s,l,c,d,f=t.constructor,h=f.precision;if(!t.s||!e.s)return e.s||(e=new f(t)),Vn?Nn(e,h):e;if(c=t.d,d=e.d,s=t.e,r=e.e,c=c.slice(),a=s-r,a){for(a<0?(i=c,a=-a,l=d.length):(i=d,r=s,l=c.length),s=Math.ceil(h/zn),l=s>l?s+1:l+1,a>l&&(a=l,i.length=1),i.reverse();a--;)i.push(0);i.reverse()}for(l=c.length,a=d.length,l-a<0&&(a=l,i=d,d=c,c=i),n=0;a;)n=(c[--a]=c[a]+d[a]+n)/qi|0,c[a]%=qi;for(n&&(c.unshift(n),++r),l=c.length;c[--l]==0;)c.pop();return e.d=c,e.e=r,Vn?Nn(e,h):e}function $s(t,e,n){if(t!==~~t||t<e||t>n)throw Error(pu+t)}function ks(t){var e,n,i,r=t.length-1,a="",s=t[0];if(r>0){for(a+=s,e=1;e<r;e++)i=t[e]+"",n=zn-i.length,n&&(a+=Wl(n)),a+=i;s=t[e],i=s+"",n=zn-i.length,n&&(a+=Wl(n))}else if(s===0)return"0";for(;s%10===0;)s/=10;return a+s}var Ho=(function(){function t(i,r){var a,s=0,l=i.length;for(i=i.slice();l--;)a=i[l]*r+s,i[l]=a%qi|0,s=a/qi|0;return s&&i.unshift(s),i}function e(i,r,a,s){var l,c;if(a!=s)c=a>s?1:-1;else for(l=c=0;l<a;l++)if(i[l]!=r[l]){c=i[l]>r[l]?1:-1;break}return c}function n(i,r,a){for(var s=0;a--;)i[a]-=s,s=i[a]<r[a]?1:0,i[a]=s*qi+i[a]-r[a];for(;!i[0]&&i.length>1;)i.shift()}return function(i,r,a,s){var l,c,d,f,h,g,m,b,y,x,v,w,S,A,R,N,C,F,P=i.constructor,L=i.s==r.s?1:-1,B=i.d,U=r.d;if(!i.s)return new P(i);if(!r.s)throw Error(Za+"Division by zero");for(c=i.e-r.e,C=U.length,R=B.length,m=new P(L),b=m.d=[],d=0;U[d]==(B[d]||0);)++d;if(U[d]>(B[d]||0)&&--c,a==null?w=a=P.precision:s?w=a+(_i(i)-_i(r))+1:w=a,w<0)return new P(0);if(w=w/zn+2|0,d=0,C==1)for(f=0,U=U[0],w++;(d<R||f)&&w--;d++)S=f*qi+(B[d]||0),b[d]=S/U|0,f=S%U|0;else{for(f=qi/(U[0]+1)|0,f>1&&(U=t(U,f),B=t(B,f),C=U.length,R=B.length),A=C,y=B.slice(0,C),x=y.length;x<C;)y[x++]=0;F=U.slice(),F.unshift(0),N=U[0],U[1]>=qi/2&&++N;do f=0,l=e(U,y,C,x),l<0?(v=y[0],C!=x&&(v=v*qi+(y[1]||0)),f=v/N|0,f>1?(f>=qi&&(f=qi-1),h=t(U,f),g=h.length,x=y.length,l=e(h,y,g,x),l==1&&(f--,n(h,C<g?F:U,g))):(f==0&&(l=f=1),h=U.slice()),g=h.length,g<x&&h.unshift(0),n(y,h,x),l==-1&&(x=y.length,l=e(U,y,C,x),l<1&&(f++,n(y,C<x?F:U,x))),x=y.length):l===0&&(f++,y=[0]),b[d++]=f,l&&y[0]?y[x++]=B[A]||0:(y=[B[A]],x=1);while((A++<R||y[0]!==void 0)&&w--)}return b[0]||b.shift(),m.e=c,Nn(m,s?a+_i(m)+1:a)}})();function F8(t,e){var n,i,r,a,s,l,c=0,d=0,f=t.constructor,h=f.precision;if(_i(t)>16)throw Error(B2+_i(t));if(!t.s)return new f(ga);for(Vn=!1,l=h,s=new f(.03125);t.abs().gte(.1);)t=t.times(s),d+=5;for(i=Math.log(Kc(2,d))/Math.LN10*2+5|0,l+=i,n=r=a=new f(ga),f.precision=l;;){if(r=Nn(r.times(t),l),n=n.times(++c),s=a.plus(Ho(r,n,l)),ks(s.d).slice(0,l)===ks(a.d).slice(0,l)){for(;d--;)a=Nn(a.times(a),l);return f.precision=h,e==null?(Vn=!0,Nn(a,h)):a}a=s}}function _i(t){for(var e=t.e*zn,n=t.d[0];n>=10;n/=10)e++;return e}function fE(t,e,n){if(e>t.LN10.sd())throw Vn=!0,n&&(t.precision=n),Error(Za+"LN10 precision limit exceeded");return Nn(new t(t.LN10),e)}function Wl(t){for(var e="";t--;)e+="0";return e}function om(t,e){var n,i,r,a,s,l,c,d,f,h=1,g=10,m=t,b=m.d,y=m.constructor,x=y.precision;if(m.s<1)throw Error(Za+(m.s?"NaN":"-Infinity"));if(m.eq(ga))return new y(0);if(e==null?(Vn=!1,d=x):d=e,m.eq(10))return e==null&&(Vn=!0),fE(y,d);if(d+=g,y.precision=d,n=ks(b),i=n.charAt(0),a=_i(m),Math.abs(a)<15e14){for(;i<7&&i!=1||i==1&&n.charAt(1)>3;)m=m.times(t),n=ks(m.d),i=n.charAt(0),h++;a=_i(m),i>1?(m=new y("0."+n),a++):m=new y(i+"."+n.slice(1))}else return c=fE(y,d+2,x).times(a+""),m=om(new y(i+"."+n.slice(1)),d-g).plus(c),y.precision=x,e==null?(Vn=!0,Nn(m,x)):m;for(l=s=m=Ho(m.minus(ga),m.plus(ga),d),f=Nn(m.times(m),d),r=3;;){if(s=Nn(s.times(f),d),c=l.plus(Ho(s,new y(r),d)),ks(c.d).slice(0,d)===ks(l.d).slice(0,d))return l=l.times(2),a!==0&&(l=l.plus(fE(y,d+2,x).times(a+""))),l=Ho(l,new y(h),d),y.precision=x,e==null?(Vn=!0,Nn(l,x)):l;l=c,r+=2}}function oF(t,e){var n,i,r;for((n=e.indexOf("."))>-1&&(e=e.replace(".","")),(i=e.search(/e/i))>0?(n<0&&(n=i),n+=+e.slice(i+1),e=e.substring(0,i)):n<0&&(n=e.length),i=0;e.charCodeAt(i)===48;)++i;for(r=e.length;e.charCodeAt(r-1)===48;)--r;if(e=e.slice(i,r),e){if(r-=i,n=n-i-1,t.e=Kf(n/zn),t.d=[],i=(n+1)%zn,n<0&&(i+=zn),i<r){for(i&&t.d.push(+e.slice(0,i)),r-=zn;i<r;)t.d.push(+e.slice(i,i+=zn));e=e.slice(i),i=zn-e.length}else i-=r;for(;i--;)e+="0";if(t.d.push(+e),Vn&&(t.e>Vx||t.e<-Vx))throw Error(B2+n)}else t.s=0,t.e=0,t.d=[0];return t}function Nn(t,e,n){var i,r,a,s,l,c,d,f,h=t.d;for(s=1,a=h[0];a>=10;a/=10)s++;if(i=e-s,i<0)i+=zn,r=e,d=h[f=0];else{if(f=Math.ceil((i+1)/zn),a=h.length,f>=a)return t;for(d=a=h[f],s=1;a>=10;a/=10)s++;i%=zn,r=i-zn+s}if(n!==void 0&&(a=Kc(10,s-r-1),l=d/a%10|0,c=e<0||h[f+1]!==void 0||d%a,c=n<4?(l||c)&&(n==0||n==(t.s<0?3:2)):l>5||l==5&&(n==4||c||n==6&&(i>0?r>0?d/Kc(10,s-r):0:h[f-1])%10&1||n==(t.s<0?8:7))),e<1||!h[0])return c?(a=_i(t),h.length=1,e=e-a-1,h[0]=Kc(10,(zn-e%zn)%zn),t.e=Kf(-e/zn)||0):(h.length=1,h[0]=t.e=t.s=0),t;if(i==0?(h.length=f,a=1,f--):(h.length=f+1,a=Kc(10,zn-i),h[f]=r>0?(d/Kc(10,s-r)%Kc(10,r)|0)*a:0),c)for(;;)if(f==0){(h[0]+=a)==qi&&(h[0]=1,++t.e);break}else{if(h[f]+=a,h[f]!=qi)break;h[f--]=0,a=1}for(i=h.length;h[--i]===0;)h.pop();if(Vn&&(t.e>Vx||t.e<-Vx))throw Error(B2+_i(t));return t}function z8(t,e){var n,i,r,a,s,l,c,d,f,h,g=t.constructor,m=g.precision;if(!t.s||!e.s)return e.s?e.s=-e.s:e=new g(t),Vn?Nn(e,m):e;if(c=t.d,h=e.d,i=e.e,d=t.e,c=c.slice(),s=d-i,s){for(f=s<0,f?(n=c,s=-s,l=h.length):(n=h,i=d,l=c.length),r=Math.max(Math.ceil(m/zn),l)+2,s>r&&(s=r,n.length=1),n.reverse(),r=s;r--;)n.push(0);n.reverse()}else{for(r=c.length,l=h.length,f=r<l,f&&(l=r),r=0;r<l;r++)if(c[r]!=h[r]){f=c[r]<h[r];break}s=0}for(f&&(n=c,c=h,h=n,e.s=-e.s),l=c.length,r=h.length-l;r>0;--r)c[l++]=0;for(r=h.length;r>s;){if(c[--r]<h[r]){for(a=r;a&&c[--a]===0;)c[a]=qi-1;--c[a],c[r]+=qi}c[r]-=h[r]}for(;c[--l]===0;)c.pop();for(;c[0]===0;c.shift())--i;return c[0]?(e.d=c,e.e=i,Vn?Nn(e,m):e):new g(0)}function Pu(t,e,n){var i,r=_i(t),a=ks(t.d),s=a.length;return e?(n&&(i=n-s)>0?a=a.charAt(0)+"."+a.slice(1)+Wl(i):s>1&&(a=a.charAt(0)+"."+a.slice(1)),a=a+(r<0?"e":"e+")+r):r<0?(a="0."+Wl(-r-1)+a,n&&(i=n-s)>0&&(a+=Wl(i))):r>=s?(a+=Wl(r+1-s),n&&(i=n-r-1)>0&&(a=a+"."+Wl(i))):((i=r+1)<s&&(a=a.slice(0,i)+"."+a.slice(i)),n&&(i=n-s)>0&&(r+1===s&&(a+="."),a+=Wl(i))),t.s<0?"-"+a:a}function lF(t,e){if(t.length>e)return t.length=e,!0}function B8(t){var e,n,i;function r(a){var s=this;if(!(s instanceof r))return new r(a);if(s.constructor=r,a instanceof r){s.s=a.s,s.e=a.e,s.d=(a=a.d)?a.slice():a;return}if(typeof a=="number"){if(a*0!==0)throw Error(pu+a);if(a>0)s.s=1;else if(a<0)a=-a,s.s=-1;else{s.s=0,s.e=0,s.d=[0];return}if(a===~~a&&a<1e7){s.e=0,s.d=[a];return}return oF(s,a.toString())}else if(typeof a!="string")throw Error(pu+a);if(a.charCodeAt(0)===45?(a=a.slice(1),s.s=-1):s.s=1,v0e.test(a))oF(s,a);else throw Error(pu+a)}if(r.prototype=_t,r.ROUND_UP=0,r.ROUND_DOWN=1,r.ROUND_CEIL=2,r.ROUND_FLOOR=3,r.ROUND_HALF_UP=4,r.ROUND_HALF_DOWN=5,r.ROUND_HALF_EVEN=6,r.ROUND_HALF_CEIL=7,r.ROUND_HALF_FLOOR=8,r.clone=B8,r.config=r.set=x0e,t===void 0&&(t={}),t)for(i=["precision","rounding","toExpNeg","toExpPos","LN10"],e=0;e<i.length;)t.hasOwnProperty(n=i[e++])||(t[n]=this[n]);return r.config(t),r}function x0e(t){if(!t||typeof t!="object")throw Error(Za+"Object expected");var e,n,i,r=["precision",1,Yf,"rounding",0,8,"toExpNeg",-1/0,0,"toExpPos",0,1/0];for(e=0;e<r.length;e+=3)if((i=t[n=r[e]])!==void 0)if(Kf(i)===i&&i>=r[e+1]&&i<=r[e+2])this[n]=i;else throw Error(pu+n+": "+i);if((i=t[n="LN10"])!==void 0)if(i==Math.LN10)this[n]=new this(i);else throw Error(pu+n+": "+i);return this}var j2=B8(g0e);ga=new j2(1);const yn=j2;var y0e=t=>t,j8={},H8=t=>t===j8,cF=t=>function e(){return arguments.length===0||arguments.length===1&&H8(arguments.length<=0?void 0:arguments[0])?e:t(...arguments)},G8=(t,e)=>t===1?e:cF(function(){for(var n=arguments.length,i=new Array(n),r=0;r<n;r++)i[r]=arguments[r];var a=i.filter(s=>s!==j8).length;return a>=t?e(...i):G8(t-a,cF(function(){for(var s=arguments.length,l=new Array(s),c=0;c<s;c++)l[c]=arguments[c];var d=i.map(f=>H8(f)?l.shift():f);return e(...d,...l)}))}),b0e=t=>G8(t.length,t),NA=(t,e)=>{for(var n=[],i=t;i<e;++i)n[i-t]=i;return n},_0e=b0e((t,e)=>Array.isArray(e)?e.map(t):Object.keys(e).map(n=>e[n]).map(t)),S0e=function(){for(var e=arguments.length,n=new Array(e),i=0;i<e;i++)n[i]=arguments[i];if(!n.length)return y0e;var r=n.reverse(),a=r[0],s=r.slice(1);return function(){return s.reduce((l,c)=>c(l),a(...arguments))}},OA=t=>Array.isArray(t)?t.reverse():t.split("").reverse().join("");function V8(t){var e;return t===0?e=1:e=Math.floor(new yn(t).abs().log(10).toNumber())+1,e}function $8(t,e,n){for(var i=new yn(t),r=0,a=[];i.lt(e)&&r<1e5;)a.push(i.toNumber()),i=i.add(n),r++;return a}var W8=t=>{var[e,n]=t,[i,r]=[e,n];return e>n&&([i,r]=[n,e]),[i,r]},X8=(t,e,n)=>{if(t.lte(0))return new yn(0);var i=V8(t.toNumber()),r=new yn(10).pow(i),a=t.div(r),s=i!==1?.05:.1,l=new yn(Math.ceil(a.div(s).toNumber())).add(n).mul(s),c=l.mul(r);return e?new yn(c.toNumber()):new yn(Math.ceil(c.toNumber()))},w0e=(t,e,n)=>{var i=new yn(1),r=new yn(t);if(!r.isint()&&n){var a=Math.abs(t);a<1?(i=new yn(10).pow(V8(t)-1),r=new yn(Math.floor(r.div(i).toNumber())).mul(i)):a>1&&(r=new yn(Math.floor(t)))}else t===0?r=new yn(Math.floor((e-1)/2)):n||(r=new yn(Math.floor(t)));var s=Math.floor((e-1)/2),l=S0e(_0e(c=>r.add(new yn(c-s).mul(i)).toNumber()),NA);return l(0,e)},q8=function(e,n,i,r){var a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0;if(!Number.isFinite((n-e)/(i-1)))return{step:new yn(0),tickMin:new yn(0),tickMax:new yn(0)};var s=X8(new yn(n).sub(e).div(i-1),r,a),l;e<=0&&n>=0?l=new yn(0):(l=new yn(e).add(n).div(2),l=l.sub(new yn(l).mod(s)));var c=Math.ceil(l.sub(e).div(s).toNumber()),d=Math.ceil(new yn(n).sub(l).div(s).toNumber()),f=c+d+1;return f>i?q8(e,n,i,r,a+1):(f<i&&(d=n>0?d+(i-f):d,c=n>0?c:c+(i-f)),{step:s,tickMin:l.sub(new yn(c).mul(s)),tickMax:l.add(new yn(d).mul(s))})},E0e=function(e){var[n,i]=e,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:6,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,s=Math.max(r,2),[l,c]=W8([n,i]);if(l===-1/0||c===1/0){var d=c===1/0?[l,...NA(0,r-1).map(()=>1/0)]:[...NA(0,r-1).map(()=>-1/0),c];return n>i?OA(d):d}if(l===c)return w0e(l,r,a);var{step:f,tickMin:h,tickMax:g}=q8(l,c,s,a,0),m=$8(h,g.add(new yn(.1).mul(f)),f);return n>i?OA(m):m},M0e=function(e,n){var[i,r]=e,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,[s,l]=W8([i,r]);if(s===-1/0||l===1/0)return[i,r];if(s===l)return[s];var c=Math.max(n,2),d=X8(new yn(l).sub(s).div(c-1),a,0),f=[...$8(new yn(s),new yn(l),d),l];return a===!1&&(f=f.map(h=>Math.round(h))),i>r?OA(f):f},Y8=t=>t.rootProps.maxBarSize,A0e=t=>t.rootProps.barGap,K8=t=>t.rootProps.barCategoryGap,T0e=t=>t.rootProps.barSize,Um=t=>t.rootProps.stackOffset,Z8=t=>t.rootProps.reverseStackOrder,H2=t=>t.options.chartName,G2=t=>t.rootProps.syncId,Q8=t=>t.rootProps.syncMethod,V2=t=>t.options.eventEmitter,C0e=t=>t.rootProps.baseValue,yi={grid:-100,barBackground:-50,area:100,cursorRectangle:200,bar:300,line:400,axis:500,scatter:600,activeBar:1e3,cursorLine:1100,activeDot:1200,label:2e3},Do={allowDuplicatedCategory:!0,angleAxisId:0,reversed:!1,scale:"auto",tick:!0,type:"category"},pa={allowDataOverflow:!1,allowDuplicatedCategory:!0,radiusAxisId:0,scale:"auto",tick:!0,tickCount:5,type:"number"},Ky=(t,e)=>{if(!(!t||!e))return t!=null&&t.reversed?[e[1],e[0]]:e},R0e={allowDataOverflow:!1,allowDecimals:!1,allowDuplicatedCategory:!1,dataKey:void 0,domain:void 0,id:Do.angleAxisId,includeHidden:!1,name:void 0,reversed:Do.reversed,scale:Do.scale,tick:Do.tick,tickCount:void 0,ticks:void 0,type:Do.type,unit:void 0},P0e={allowDataOverflow:pa.allowDataOverflow,allowDecimals:!1,allowDuplicatedCategory:pa.allowDuplicatedCategory,dataKey:void 0,domain:void 0,id:pa.radiusAxisId,includeHidden:!1,name:void 0,reversed:!1,scale:pa.scale,tick:pa.tick,tickCount:pa.tickCount,ticks:void 0,type:pa.type,unit:void 0},D0e={allowDataOverflow:!1,allowDecimals:!1,allowDuplicatedCategory:Do.allowDuplicatedCategory,dataKey:void 0,domain:void 0,id:Do.angleAxisId,includeHidden:!1,name:void 0,reversed:!1,scale:Do.scale,tick:Do.tick,tickCount:void 0,ticks:void 0,type:"number",unit:void 0},N0e={allowDataOverflow:pa.allowDataOverflow,allowDecimals:!1,allowDuplicatedCategory:pa.allowDuplicatedCategory,dataKey:void 0,domain:void 0,id:pa.radiusAxisId,includeHidden:!1,name:void 0,reversed:!1,scale:pa.scale,tick:pa.tick,tickCount:pa.tickCount,ticks:void 0,type:"category",unit:void 0},$2=(t,e)=>t.polarAxis.angleAxis[e]!=null?t.polarAxis.angleAxis[e]:t.layout.layoutType==="radial"?D0e:R0e,W2=(t,e)=>t.polarAxis.radiusAxis[e]!=null?t.polarAxis.radiusAxis[e]:t.layout.layoutType==="radial"?N0e:P0e,Zy=t=>t.polarOptions,X2=He([tl,nl,Ii],Kj),J8=He([Zy,X2],(t,e)=>{if(t!=null)return Er(t.innerRadius,e,0)}),e6=He([Zy,X2],(t,e)=>{if(t!=null)return Er(t.outerRadius,e,e*.8)}),O0e=t=>{if(t==null)return[0,0];var{startAngle:e,endAngle:n}=t;return[e,n]},t6=He([Zy],O0e);He([$2,t6],Ky);var n6=He([X2,J8,e6],(t,e,n)=>{if(!(t==null||e==null||n==null))return[e,n]});He([W2,n6],Ky);var i6=He([sn,Zy,J8,e6,tl,nl],(t,e,n,i,r,a)=>{if(!(t!=="centric"&&t!=="radial"||e==null||n==null||i==null)){var{cx:s,cy:l,startAngle:c,endAngle:d}=e;return{cx:Er(s,r,r/2),cy:Er(l,a,a/2),innerRadius:n,outerRadius:i,startAngle:c,endAngle:d,clockWise:!1}}}),$n=(t,e)=>e,km=(t,e,n)=>n;function Qy(t){return t?.id}function r6(t,e,n){var{chartData:i=[]}=e,{allowDuplicatedCategory:r,dataKey:a}=n,s=new Map;return t.forEach(l=>{var c,d=(c=l.data)!==null&&c!==void 0?c:i;if(!(d==null||d.length===0)){var f=Qy(l);d.forEach((h,g)=>{var m=a==null||r?g:String(Dn(h,a,null)),b=Dn(h,l.dataKey,0),y;s.has(m)?y=s.get(m):y={},Object.assign(y,{[f]:b}),s.set(m,y)})}}),Array.from(s.values())}function Jy(t){return t.stackId!=null&&t.dataKey!=null}var eb=(t,e)=>t===e?!0:t==null||e==null?!1:t[0]===e[0]&&t[1]===e[1];function tb(t,e){return Array.isArray(t)&&Array.isArray(e)&&t.length===0&&e.length===0?!0:t===e}function L0e(t,e){if(t.length===e.length){for(var n=0;n<t.length;n++)if(t[n]!==e[n])return!1;return!0}return!1}var ki=t=>{var e=sn(t);return e==="horizontal"?"xAxis":e==="vertical"?"yAxis":e==="centric"?"angleAxis":"radiusAxis"},Zf=t=>t.tooltip.settings.axisId;function uF(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),n.push.apply(n,i)}return n}function $x(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?uF(Object(n),!0).forEach(function(i){I0e(t,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):uF(Object(n)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(n,i))})}return t}function I0e(t,e,n){return(e=U0e(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function U0e(t){var e=k0e(t,"string");return typeof e=="symbol"?e:e+""}function k0e(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var i=n.call(t,e);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var LA=[0,"auto"],Wi={allowDataOverflow:!1,allowDecimals:!0,allowDuplicatedCategory:!0,angle:0,dataKey:void 0,domain:void 0,height:30,hide:!0,id:0,includeHidden:!1,interval:"preserveEnd",minTickGap:5,mirror:!1,name:void 0,orientation:"bottom",padding:{left:0,right:0},reversed:!1,scale:"auto",tick:!0,tickCount:5,tickFormatter:void 0,ticks:void 0,type:"category",unit:void 0},a6=(t,e)=>t.cartesianAxis.xAxis[e],rl=(t,e)=>{var n=a6(t,e);return n??Wi},Xi={allowDataOverflow:!1,allowDecimals:!0,allowDuplicatedCategory:!0,angle:0,dataKey:void 0,domain:LA,hide:!0,id:0,includeHidden:!1,interval:"preserveEnd",minTickGap:5,mirror:!1,name:void 0,orientation:"left",padding:{top:0,bottom:0},reversed:!1,scale:"auto",tick:!0,tickCount:5,tickFormatter:void 0,ticks:void 0,type:"number",unit:void 0,width:Cm},s6=(t,e)=>t.cartesianAxis.yAxis[e],al=(t,e)=>{var n=s6(t,e);return n??Xi},F0e={domain:[0,"auto"],includeHidden:!1,reversed:!1,allowDataOverflow:!1,allowDuplicatedCategory:!1,dataKey:void 0,id:0,name:"",range:[64,64],scale:"auto",type:"number",unit:""},q2=(t,e)=>{var n=t.cartesianAxis.zAxis[e];return n??F0e},Yn=(t,e,n)=>{switch(e){case"xAxis":return rl(t,n);case"yAxis":return al(t,n);case"zAxis":return q2(t,n);case"angleAxis":return $2(t,n);case"radiusAxis":return W2(t,n);default:throw new Error("Unexpected axis type: ".concat(e))}},z0e=(t,e,n)=>{switch(e){case"xAxis":return rl(t,n);case"yAxis":return al(t,n);default:throw new Error("Unexpected axis type: ".concat(e))}},Fm=(t,e,n)=>{switch(e){case"xAxis":return rl(t,n);case"yAxis":return al(t,n);case"angleAxis":return $2(t,n);case"radiusAxis":return W2(t,n);default:throw new Error("Unexpected axis type: ".concat(e))}},o6=t=>t.graphicalItems.cartesianItems.some(e=>e.type==="bar")||t.graphicalItems.polarItems.some(e=>e.type==="radialBar");function Y2(t,e){return n=>{switch(t){case"xAxis":return"xAxisId"in n&&n.xAxisId===e;case"yAxis":return"yAxisId"in n&&n.yAxisId===e;case"zAxis":return"zAxisId"in n&&n.zAxisId===e;case"angleAxis":return"angleAxisId"in n&&n.angleAxisId===e;case"radiusAxis":return"radiusAxisId"in n&&n.radiusAxisId===e;default:return!1}}}var nb=t=>t.graphicalItems.cartesianItems,B0e=He([$n,km],Y2),K2=(t,e,n)=>t.filter(n).filter(i=>e?.includeHidden===!0?!0:!i.hide),zm=He([nb,Yn,B0e],K2,{memoizeOptions:{resultEqualityCheck:tb}}),l6=He([zm],t=>t.filter(e=>e.type==="area"||e.type==="bar").filter(Jy)),c6=t=>t.filter(e=>!("stackId"in e)||e.stackId===void 0),j0e=He([zm],c6),Z2=t=>t.map(e=>e.data).filter(Boolean).flat(1),H0e=He([zm],Z2,{memoizeOptions:{resultEqualityCheck:tb}}),Q2=(t,e)=>{var{chartData:n=[],dataStartIndex:i,dataEndIndex:r}=e;return t.length>0?t:n.slice(i,r+1)},J2=He([H0e,Yy],Q2),eC=(t,e,n)=>e?.dataKey!=null?t.map(i=>({value:Dn(i,e.dataKey)})):n.length>0?n.map(i=>i.dataKey).flatMap(i=>t.map(r=>({value:Dn(r,i)}))):t.map(i=>({value:i})),ib=He([J2,Yn,zm],eC);function u6(t,e){switch(t){case"xAxis":return e.direction==="x";case"yAxis":return e.direction==="y";default:return!1}}function Hv(t){if(Gs(t)||t instanceof Date){var e=Number(t);if(jn(e))return e}}function dF(t){if(Array.isArray(t)){var e=[Hv(t[0]),Hv(t[1])];return dc(e)?e:void 0}var n=Hv(t);if(n!=null)return[n,n]}function Qo(t){return t.map(Hv).filter(Uce)}function G0e(t,e,n){return!n||typeof e!="number"||Ya(e)?[]:n.length?Qo(n.flatMap(i=>{var r=Dn(t,i.dataKey),a,s;if(Array.isArray(r)?[a,s]=r:a=s=r,!(!jn(a)||!jn(s)))return[e-a,e+s]})):[]}var Fi=t=>{var e=ki(t),n=Zf(t);return Fm(t,e,n)},Bm=He([Fi],t=>t?.dataKey),V0e=He([l6,Yy,Fi],r6),d6=(t,e,n,i)=>{var r={},a=e.reduce((s,l)=>(l.stackId==null||(s[l.stackId]==null&&(s[l.stackId]=[]),s[l.stackId].push(l)),s),r);return Object.fromEntries(Object.entries(a).map(s=>{var[l,c]=s,d=i?[...c].reverse():c,f=d.map(Qy);return[l,{stackedData:cfe(t,f,n),graphicalItems:d}]}))},lm=He([V0e,l6,Um,Z8],d6),f6=(t,e,n,i)=>{var{dataStartIndex:r,dataEndIndex:a}=e;if(i==null&&n!=="zAxis"){var s=hfe(t,r,a);if(!(s!=null&&s[0]===0&&s[1]===0))return s}},$0e=He([Yn],t=>t.allowDataOverflow),tC=t=>{var e;if(t==null||!("domain"in t))return LA;if(t.domain!=null)return t.domain;if(t.ticks!=null){if(t.type==="number"){var n=Qo(t.ticks);return[Math.min(...n),Math.max(...n)]}if(t.type==="category")return t.ticks.map(String)}return(e=t?.domain)!==null&&e!==void 0?e:LA},nC=He([Yn],tC),iC=He([nC,$0e],I8),W0e=He([lm,xc,$n,iC],f6,{memoizeOptions:{resultEqualityCheck:eb}}),rb=t=>t.errorBars,X0e=(t,e,n)=>t.flatMap(i=>e[i.id]).filter(Boolean).filter(i=>u6(n,i)),Wx=function(){for(var e=arguments.length,n=new Array(e),i=0;i<e;i++)n[i]=arguments[i];var r=n.filter(Boolean);if(r.length!==0){var a=r.flat(),s=Math.min(...a),l=Math.max(...a);return[s,l]}},rC=(t,e,n,i,r)=>{var a,s;if(n.length>0&&t.forEach(l=>{n.forEach(c=>{var d,f,h=(d=i[c.id])===null||d===void 0?void 0:d.filter(v=>u6(r,v)),g=Dn(l,(f=e.dataKey)!==null&&f!==void 0?f:c.dataKey),m=G0e(l,g,h);if(m.length>=2){var b=Math.min(...m),y=Math.max(...m);(a==null||b<a)&&(a=b),(s==null||y>s)&&(s=y)}var x=dF(g);x!=null&&(a=a==null?x[0]:Math.min(a,x[0]),s=s==null?x[1]:Math.max(s,x[1]))})}),e?.dataKey!=null&&t.forEach(l=>{var c=dF(Dn(l,e.dataKey));c!=null&&(a=a==null?c[0]:Math.min(a,c[0]),s=s==null?c[1]:Math.max(s,c[1]))}),jn(a)&&jn(s))return[a,s]},q0e=He([J2,Yn,j0e,rb,$n],rC,{memoizeOptions:{resultEqualityCheck:eb}});function Y0e(t){var{value:e}=t;if(Gs(e)||e instanceof Date)return e}var K0e=(t,e,n)=>{var i=t.map(Y0e).filter(r=>r!=null);return n&&(e.dataKey==null||e.allowDuplicatedCategory&&T5(i))?e8(0,t.length):e.allowDuplicatedCategory?i:Array.from(new Set(i))},h6=t=>t.referenceElements.dots,Qf=(t,e,n)=>t.filter(i=>i.ifOverflow==="extendDomain").filter(i=>e==="xAxis"?i.xAxisId===n:i.yAxisId===n),Z0e=He([h6,$n,km],Qf),p6=t=>t.referenceElements.areas,Q0e=He([p6,$n,km],Qf),m6=t=>t.referenceElements.lines,J0e=He([m6,$n,km],Qf),g6=(t,e)=>{var n=Qo(t.map(i=>e==="xAxis"?i.x:i.y));if(n.length!==0)return[Math.min(...n),Math.max(...n)]},eve=He(Z0e,$n,g6),v6=(t,e)=>{var n=Qo(t.flatMap(i=>[e==="xAxis"?i.x1:i.y1,e==="xAxis"?i.x2:i.y2]));if(n.length!==0)return[Math.min(...n),Math.max(...n)]},tve=He([Q0e,$n],v6);function nve(t){var e;if(t.x!=null)return Qo([t.x]);var n=(e=t.segment)===null||e===void 0?void 0:e.map(i=>i.x);return n==null||n.length===0?[]:Qo(n)}function ive(t){var e;if(t.y!=null)return Qo([t.y]);var n=(e=t.segment)===null||e===void 0?void 0:e.map(i=>i.y);return n==null||n.length===0?[]:Qo(n)}var x6=(t,e)=>{var n=t.flatMap(i=>e==="xAxis"?nve(i):ive(i));if(n.length!==0)return[Math.min(...n),Math.max(...n)]},rve=He([J0e,$n],x6),ave=He(eve,rve,tve,(t,e,n)=>Wx(t,n,e)),aC=(t,e,n,i,r,a,s,l)=>{if(n!=null)return n;var c=s==="vertical"&&l==="xAxis"||s==="horizontal"&&l==="yAxis",d=c?Wx(i,a,r):Wx(a,r);return m0e(e,d,t.allowDataOverflow)},sve=He([Yn,nC,iC,W0e,q0e,ave,sn,$n],aC,{memoizeOptions:{resultEqualityCheck:eb}}),ove=[0,1],sC=(t,e,n,i,r,a,s)=>{if(!((t==null||n==null||n.length===0)&&s===void 0)){var{dataKey:l,type:c}=t,d=el(e,a);if(d&&l==null){var f;return e8(0,(f=n?.length)!==null&&f!==void 0?f:0)}return c==="category"?K0e(i,t,d):r==="expand"?ove:s}},oC=He([Yn,sn,J2,ib,Um,$n,sve],sC),y6=(t,e,n,i,r)=>{if(t!=null){var{scale:a,type:s}=t;if(a==="auto")return e==="radial"&&r==="radiusAxis"?"band":e==="radial"&&r==="angleAxis"?"linear":s==="category"&&i&&(i.indexOf("LineChart")>=0||i.indexOf("AreaChart")>=0||i.indexOf("ComposedChart")>=0&&!n)?"point":s==="category"?"band":"linear";if(typeof a=="string"){var l="scale".concat(Sm(a));return l in wp?l:"point"}}},Jf=He([Yn,sn,o6,H2,$n],y6);function lve(t){if(t!=null){if(t in wp)return wp[t]();var e="scale".concat(Sm(t));if(e in wp)return wp[e]()}}function lC(t,e,n,i){if(!(n==null||i==null)){if(typeof t.scale=="function")return t.scale.copy().domain(n).range(i);var r=lve(e);if(r!=null){var a=r.domain(n).range(i);return rfe(a),a}}}var cC=(t,e,n)=>{var i=tC(e);if(!(n!=="auto"&&n!=="linear")){if(e!=null&&e.tickCount&&Array.isArray(i)&&(i[0]==="auto"||i[1]==="auto")&&dc(t))return E0e(t,e.tickCount,e.allowDecimals);if(e!=null&&e.tickCount&&e.type==="number"&&dc(t))return M0e(t,e.tickCount,e.allowDecimals)}},uC=He([oC,Fm,Jf],cC),dC=(t,e,n,i)=>{if(i!=="angleAxis"&&t?.type==="number"&&dc(e)&&Array.isArray(n)&&n.length>0){var r=e[0],a=n[0],s=e[1],l=n[n.length-1];return[Math.min(r,a),Math.max(s,l)]}return e},cve=He([Yn,oC,uC,$n],dC),uve=He(ib,Yn,(t,e)=>{if(!(!e||e.type!=="number")){var n=1/0,i=Array.from(Qo(t.map(l=>l.value))).sort((l,c)=>l-c);if(i.length<2)return 1/0;var r=i[i.length-1]-i[0];if(r===0)return 1/0;for(var a=0;a<i.length-1;a++){var s=i[a+1]-i[a];n=Math.min(n,s)}return n/r}}),b6=He(uve,sn,K8,Ii,(t,e,n,i)=>i,(t,e,n,i,r)=>{if(!jn(t))return 0;var a=e==="vertical"?i.height:i.width;if(r==="gap")return t*a/2;if(r==="no-gap"){var s=Er(n,t*a),l=t*a/2;return l-s-(l-s)/a*s}return 0}),dve=(t,e)=>{var n=rl(t,e);return n==null||typeof n.padding!="string"?0:b6(t,"xAxis",e,n.padding)},fve=(t,e)=>{var n=al(t,e);return n==null||typeof n.padding!="string"?0:b6(t,"yAxis",e,n.padding)},hve=He(rl,dve,(t,e)=>{var n,i;if(t==null)return{left:0,right:0};var{padding:r}=t;return typeof r=="string"?{left:e,right:e}:{left:((n=r.left)!==null&&n!==void 0?n:0)+e,right:((i=r.right)!==null&&i!==void 0?i:0)+e}}),pve=He(al,fve,(t,e)=>{var n,i;if(t==null)return{top:0,bottom:0};var{padding:r}=t;return typeof r=="string"?{top:e,bottom:e}:{top:((n=r.top)!==null&&n!==void 0?n:0)+e,bottom:((i=r.bottom)!==null&&i!==void 0?i:0)+e}}),mve=He([Ii,hve,ky,Uy,(t,e,n)=>n],(t,e,n,i,r)=>{var{padding:a}=i;return r?[a.left,n.width-a.right]:[t.left+e.left,t.left+t.width-e.right]}),gve=He([Ii,sn,pve,ky,Uy,(t,e,n)=>n],(t,e,n,i,r,a)=>{var{padding:s}=r;return a?[i.height-s.bottom,s.top]:e==="horizontal"?[t.top+t.height-n.bottom,t.top+n.top]:[t.top+n.top,t.top+t.height-n.bottom]}),jm=(t,e,n,i)=>{var r;switch(e){case"xAxis":return mve(t,n,i);case"yAxis":return gve(t,n,i);case"zAxis":return(r=q2(t,n))===null||r===void 0?void 0:r.range;case"angleAxis":return t6(t);case"radiusAxis":return n6(t,n);default:return}},_6=He([Yn,jm],Ky),eh=He([Yn,Jf,cve,_6],lC);He([zm,rb,$n],X0e);function S6(t,e){return t.id<e.id?-1:t.id>e.id?1:0}var ab=(t,e)=>e,sb=(t,e,n)=>n,vve=He(Ly,ab,sb,(t,e,n)=>t.filter(i=>i.orientation===e).filter(i=>i.mirror===n).sort(S6)),xve=He(Iy,ab,sb,(t,e,n)=>t.filter(i=>i.orientation===e).filter(i=>i.mirror===n).sort(S6)),w6=(t,e)=>({width:t.width,height:e.height}),yve=(t,e)=>{var n=typeof e.width=="number"?e.width:Cm;return{width:n,height:t.height}},E6=He(Ii,rl,w6),bve=(t,e,n)=>{switch(e){case"top":return t.top;case"bottom":return n-t.bottom;default:return 0}},_ve=(t,e,n)=>{switch(e){case"left":return t.left;case"right":return n-t.right;default:return 0}},Sve=He(nl,Ii,vve,ab,sb,(t,e,n,i,r)=>{var a={},s;return n.forEach(l=>{var c=w6(e,l);s==null&&(s=bve(e,i,t));var d=i==="top"&&!r||i==="bottom"&&r;a[l.id]=s-Number(d)*c.height,s+=(d?-1:1)*c.height}),a}),wve=He(tl,Ii,xve,ab,sb,(t,e,n,i,r)=>{var a={},s;return n.forEach(l=>{var c=yve(e,l);s==null&&(s=_ve(e,i,t));var d=i==="left"&&!r||i==="right"&&r;a[l.id]=s-Number(d)*c.width,s+=(d?-1:1)*c.width}),a}),Eve=(t,e)=>{var n=rl(t,e);if(n!=null)return Sve(t,n.orientation,n.mirror)},Mve=He([Ii,rl,Eve,(t,e)=>e],(t,e,n,i)=>{if(e!=null){var r=n?.[i];return r==null?{x:t.left,y:0}:{x:t.left,y:r}}}),Ave=(t,e)=>{var n=al(t,e);if(n!=null)return wve(t,n.orientation,n.mirror)},Tve=He([Ii,al,Ave,(t,e)=>e],(t,e,n,i)=>{if(e!=null){var r=n?.[i];return r==null?{x:0,y:t.top}:{x:r,y:t.top}}}),M6=He(Ii,al,(t,e)=>{var n=typeof e.width=="number"?e.width:Cm;return{width:n,height:t.height}}),fF=(t,e,n)=>{switch(e){case"xAxis":return E6(t,n).width;case"yAxis":return M6(t,n).height;default:return}},A6=(t,e,n,i)=>{if(n!=null){var{allowDuplicatedCategory:r,type:a,dataKey:s}=n,l=el(t,i),c=e.map(d=>d.value);if(s&&l&&a==="category"&&r&&T5(c))return c}},fC=He([sn,ib,Yn,$n],A6),T6=(t,e,n,i)=>{if(!(n==null||n.dataKey==null)){var{type:r,scale:a}=n,s=el(t,i);if(s&&(r==="number"||a!=="auto"))return e.map(l=>l.value)}},hC=He([sn,ib,Fm,$n],T6),hF=He([sn,z0e,Jf,eh,fC,hC,jm,uC,$n],(t,e,n,i,r,a,s,l,c)=>{if(e!=null){var d=el(t,c);return{angle:e.angle,interval:e.interval,minTickGap:e.minTickGap,orientation:e.orientation,tick:e.tick,tickCount:e.tickCount,tickFormatter:e.tickFormatter,ticks:e.ticks,type:e.type,unit:e.unit,axisType:c,categoricalDomain:a,duplicateDomain:r,isCategorical:d,niceTicks:l,range:s,realScaleType:n,scale:i}}}),Cve=(t,e,n,i,r,a,s,l,c)=>{if(!(e==null||i==null)){var d=el(t,c),{type:f,ticks:h,tickCount:g}=e,m=n==="scaleBand"&&typeof i.bandwidth=="function"?i.bandwidth()/2:2,b=f==="category"&&i.bandwidth?i.bandwidth()/m:0;b=c==="angleAxis"&&a!=null&&a.length>=2?Zi(a[0]-a[1])*2*b:b;var y=h||r;if(y){var x=y.map((v,w)=>{var S=s?s.indexOf(v):v;return{index:w,coordinate:i(S)+b,value:v,offset:b}});return x.filter(v=>jn(v.coordinate))}return d&&l?l.map((v,w)=>({coordinate:i(v)+b,value:v,index:w,offset:b})).filter(v=>jn(v.coordinate)):i.ticks?i.ticks(g).map(v=>({coordinate:i(v)+b,value:v,offset:b})):i.domain().map((v,w)=>({coordinate:i(v)+b,value:s?s[v]:v,index:w,offset:b}))}},C6=He([sn,Fm,Jf,eh,uC,jm,fC,hC,$n],Cve),Rve=(t,e,n,i,r,a,s)=>{if(!(e==null||n==null||i==null||i[0]===i[1])){var l=el(t,s),{tickCount:c}=e,d=0;return d=s==="angleAxis"&&i?.length>=2?Zi(i[0]-i[1])*2*d:d,l&&a?a.map((f,h)=>({coordinate:n(f)+d,value:f,index:h,offset:d})):n.ticks?n.ticks(c).map(f=>({coordinate:n(f)+d,value:f,offset:d})):n.domain().map((f,h)=>({coordinate:n(f)+d,value:r?r[f]:f,index:h,offset:d}))}},fc=He([sn,Fm,eh,jm,fC,hC,$n],Rve),hc=He(Yn,eh,(t,e)=>{if(!(t==null||e==null))return $x($x({},t),{},{scale:e})}),Pve=He([Yn,Jf,oC,_6],lC);He((t,e,n)=>q2(t,n),Pve,(t,e)=>{if(!(t==null||e==null))return $x($x({},t),{},{scale:e})});var Dve=He([sn,Ly,Iy],(t,e,n)=>{switch(t){case"horizontal":return e.some(i=>i.reversed)?"right-to-left":"left-to-right";case"vertical":return n.some(i=>i.reversed)?"bottom-to-top":"top-to-bottom";case"centric":case"radial":return"left-to-right";default:return}}),R6=t=>t.options.defaultTooltipEventType,P6=t=>t.options.validateTooltipEventTypes;function D6(t,e,n){if(t==null)return e;var i=t?"axis":"item";return n==null?e:n.includes(i)?i:e}function pC(t,e){var n=R6(t),i=P6(t);return D6(e,n,i)}function Nve(t){return bt(e=>pC(e,t))}var N6=(t,e)=>{var n,i=Number(e);if(!(Ya(i)||e==null))return i>=0?t==null||(n=t[i])===null||n===void 0?void 0:n.value:void 0},Ove=t=>t.tooltip.settings,Kl={active:!1,index:null,dataKey:void 0,graphicalItemId:void 0,coordinate:void 0},Lve={itemInteraction:{click:Kl,hover:Kl},axisInteraction:{click:Kl,hover:Kl},keyboardInteraction:Kl,syncInteraction:{active:!1,index:null,dataKey:void 0,label:void 0,coordinate:void 0,sourceViewBox:void 0,graphicalItemId:void 0},tooltipItemPayloads:[],settings:{shared:void 0,trigger:"hover",axisId:0,active:!1,defaultIndex:void 0}},O6=ea({name:"tooltip",initialState:Lve,reducers:{addTooltipEntrySettings:{reducer(t,e){t.tooltipItemPayloads.push(e.payload)},prepare:Gn()},replaceTooltipEntrySettings:{reducer(t,e){var{prev:n,next:i}=e.payload,r=xs(t).tooltipItemPayloads.indexOf(n);r>-1&&(t.tooltipItemPayloads[r]=i)},prepare:Gn()},removeTooltipEntrySettings:{reducer(t,e){var n=xs(t).tooltipItemPayloads.indexOf(e.payload);n>-1&&t.tooltipItemPayloads.splice(n,1)},prepare:Gn()},setTooltipSettingsState(t,e){t.settings=e.payload},setActiveMouseOverItemIndex(t,e){t.syncInteraction.active=!1,t.keyboardInteraction.active=!1,t.itemInteraction.hover.active=!0,t.itemInteraction.hover.index=e.payload.activeIndex,t.itemInteraction.hover.dataKey=e.payload.activeDataKey,t.itemInteraction.hover.graphicalItemId=e.payload.activeGraphicalItemId,t.itemInteraction.hover.coordinate=e.payload.activeCoordinate},mouseLeaveChart(t){t.itemInteraction.hover.active=!1,t.axisInteraction.hover.active=!1},mouseLeaveItem(t){t.itemInteraction.hover.active=!1},setActiveClickItemIndex(t,e){t.syncInteraction.active=!1,t.itemInteraction.click.active=!0,t.keyboardInteraction.active=!1,t.itemInteraction.click.index=e.payload.activeIndex,t.itemInteraction.click.dataKey=e.payload.activeDataKey,t.itemInteraction.click.graphicalItemId=e.payload.activeGraphicalItemId,t.itemInteraction.click.coordinate=e.payload.activeCoordinate},setMouseOverAxisIndex(t,e){t.syncInteraction.active=!1,t.axisInteraction.hover.active=!0,t.keyboardInteraction.active=!1,t.axisInteraction.hover.index=e.payload.activeIndex,t.axisInteraction.hover.dataKey=e.payload.activeDataKey,t.axisInteraction.hover.coordinate=e.payload.activeCoordinate},setMouseClickAxisIndex(t,e){t.syncInteraction.active=!1,t.keyboardInteraction.active=!1,t.axisInteraction.click.active=!0,t.axisInteraction.click.index=e.payload.activeIndex,t.axisInteraction.click.dataKey=e.payload.activeDataKey,t.axisInteraction.click.coordinate=e.payload.activeCoordinate},setSyncInteraction(t,e){t.syncInteraction=e.payload},setKeyboardInteraction(t,e){t.keyboardInteraction.active=e.payload.active,t.keyboardInteraction.index=e.payload.activeIndex,t.keyboardInteraction.coordinate=e.payload.activeCoordinate,t.keyboardInteraction.dataKey=e.payload.activeDataKey}}}),{addTooltipEntrySettings:Ive,replaceTooltipEntrySettings:Uve,removeTooltipEntrySettings:kve,setTooltipSettingsState:Fve,setActiveMouseOverItemIndex:L6,mouseLeaveItem:zve,mouseLeaveChart:I6,setActiveClickItemIndex:Bve,setMouseOverAxisIndex:U6,setMouseClickAxisIndex:jve,setSyncInteraction:IA,setKeyboardInteraction:UA}=O6.actions,Hve=O6.reducer;function pF(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),n.push.apply(n,i)}return n}function Sv(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?pF(Object(n),!0).forEach(function(i){Gve(t,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):pF(Object(n)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(n,i))})}return t}function Gve(t,e,n){return(e=Vve(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Vve(t){var e=$ve(t,"string");return typeof e=="symbol"?e:e+""}function $ve(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var i=n.call(t,e);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Wve(t,e,n){return e==="axis"?n==="click"?t.axisInteraction.click:t.axisInteraction.hover:n==="click"?t.itemInteraction.click:t.itemInteraction.hover}function Xve(t){return t.index!=null}var k6=(t,e,n,i)=>{if(e==null)return Kl;var r=Wve(t,e,n);if(r==null)return Kl;if(r.active)return r;if(t.keyboardInteraction.active)return t.keyboardInteraction;if(t.syncInteraction.active&&t.syncInteraction.index!=null)return t.syncInteraction;var a=t.settings.active===!0;if(Xve(r)){if(a)return Sv(Sv({},r),{},{active:!0})}else if(i!=null)return{active:!0,coordinate:void 0,dataKey:void 0,index:i,graphicalItemId:void 0};return Sv(Sv({},Kl),{},{coordinate:r.coordinate})};function qve(t){if(typeof t=="number")return Number.isFinite(t)?t:void 0;if(t instanceof Date){var e=t.valueOf();return Number.isFinite(e)?e:void 0}var n=Number(t);return Number.isFinite(n)?n:void 0}function Yve(t,e){var n=qve(t),i=e[0],r=e[1];if(n===void 0)return!1;var a=Math.min(i,r),s=Math.max(i,r);return n>=a&&n<=s}function Kve(t,e,n){if(n==null||e==null)return!0;var i=Dn(t,e);return i==null||!dc(n)?!0:Yve(i,n)}var mC=(t,e,n,i)=>{var r=t?.index;if(r==null)return null;var a=Number(r);if(!jn(a))return r;var s=0,l=1/0;e.length>0&&(l=e.length-1);var c=Math.max(s,Math.min(a,l)),d=e[c];return d==null||Kve(d,n,i)?String(c):null},F6=(t,e,n,i,r,a,s,l)=>{if(!(a==null||l==null)){var c=s[0],d=c==null?void 0:l(c.positions,a);if(d!=null)return d;var f=r?.[Number(a)];if(f)switch(n){case"horizontal":return{x:f.coordinate,y:(i.top+e)/2};default:return{x:(i.left+t)/2,y:f.coordinate}}}},z6=(t,e,n,i)=>{if(e==="axis")return t.tooltipItemPayloads;if(t.tooltipItemPayloads.length===0)return[];var r;return n==="hover"?r=t.itemInteraction.hover.dataKey:r=t.itemInteraction.click.dataKey,r==null&&i!=null?[t.tooltipItemPayloads[0]]:t.tooltipItemPayloads.filter(a=>{var s;return((s=a.settings)===null||s===void 0?void 0:s.dataKey)===r})},Hm=t=>t.options.tooltipPayloadSearcher,th=t=>t.tooltip;function mF(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),n.push.apply(n,i)}return n}function gF(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?mF(Object(n),!0).forEach(function(i){Zve(t,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):mF(Object(n)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(n,i))})}return t}function Zve(t,e,n){return(e=Qve(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Qve(t){var e=Jve(t,"string");return typeof e=="symbol"?e:e+""}function Jve(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var i=n.call(t,e);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function exe(t,e){return t??e}var B6=(t,e,n,i,r,a,s)=>{if(!(e==null||a==null)){var{chartData:l,computedData:c,dataStartIndex:d,dataEndIndex:f}=n,h=[];return t.reduce((g,m)=>{var b,{dataDefinedOnItem:y,settings:x}=m,v=exe(y,l),w=Array.isArray(v)?_j(v,d,f):v,S=(b=x?.dataKey)!==null&&b!==void 0?b:i,A=x?.nameKey,R;if(i&&Array.isArray(w)&&!Array.isArray(w[0])&&s==="axis"?R=C5(w,i,r):R=a(w,e,c,A),Array.isArray(R))R.forEach(C=>{var F=gF(gF({},x),{},{name:C.name,unit:C.unit,color:void 0,fill:void 0});g.push(UU({tooltipEntrySettings:F,dataKey:C.dataKey,payload:C.payload,value:Dn(C.payload,C.dataKey),name:C.name}))});else{var N;g.push(UU({tooltipEntrySettings:x,dataKey:S,payload:R,value:Dn(R,S),name:(N=Dn(R,A))!==null&&N!==void 0?N:x?.name}))}return g},h)}},gC=He([Fi,sn,o6,H2,ki],y6),txe=He([t=>t.graphicalItems.cartesianItems,t=>t.graphicalItems.polarItems],(t,e)=>[...t,...e]),nxe=He([ki,Zf],Y2),Gm=He([txe,Fi,nxe],K2,{memoizeOptions:{resultEqualityCheck:tb}}),ixe=He([Gm],t=>t.filter(Jy)),rxe=He([Gm],Z2,{memoizeOptions:{resultEqualityCheck:tb}}),nh=He([rxe,xc],Q2),axe=He([ixe,xc,Fi],r6),vC=He([nh,Fi,Gm],eC),j6=He([Fi],tC),sxe=He([Fi],t=>t.allowDataOverflow),H6=He([j6,sxe],I8),oxe=He([Gm],t=>t.filter(Jy)),lxe=He([axe,oxe,Um,Z8],d6),cxe=He([lxe,xc,ki,H6],f6),uxe=He([Gm],c6),dxe=He([nh,Fi,uxe,rb,ki],rC,{memoizeOptions:{resultEqualityCheck:eb}}),fxe=He([h6,ki,Zf],Qf),hxe=He([fxe,ki],g6),pxe=He([p6,ki,Zf],Qf),mxe=He([pxe,ki],v6),gxe=He([m6,ki,Zf],Qf),vxe=He([gxe,ki],x6),xxe=He([hxe,vxe,mxe],Wx),yxe=He([Fi,j6,H6,cxe,dxe,xxe,sn,ki],aC),Vm=He([Fi,sn,nh,vC,Um,ki,yxe],sC),bxe=He([Vm,Fi,gC],cC),_xe=He([Fi,Vm,bxe,ki],dC),G6=t=>{var e=ki(t),n=Zf(t),i=!1;return jm(t,e,n,i)},V6=He([Fi,G6],Ky),$6=He([Fi,gC,_xe,V6],lC),Sxe=He([sn,vC,Fi,ki],A6),wxe=He([sn,vC,Fi,ki],T6),Exe=(t,e,n,i,r,a,s,l)=>{if(e){var{type:c}=e,d=el(t,l);if(i){var f=n==="scaleBand"&&i.bandwidth?i.bandwidth()/2:2,h=c==="category"&&i.bandwidth?i.bandwidth()/f:0;return h=l==="angleAxis"&&r!=null&&r?.length>=2?Zi(r[0]-r[1])*2*h:h,d&&s?s.map((g,m)=>({coordinate:i(g)+h,value:g,index:m,offset:h})):i.domain().map((g,m)=>({coordinate:i(g)+h,value:a?a[g]:g,index:m,offset:h}))}}},sl=He([sn,Fi,gC,$6,G6,Sxe,wxe,ki],Exe),xC=He([R6,P6,Ove],(t,e,n)=>D6(n.shared,t,e)),W6=t=>t.tooltip.settings.trigger,yC=t=>t.tooltip.settings.defaultIndex,$m=He([th,xC,W6,yC],k6),pc=He([$m,nh,Bm,Vm],mC),X6=He([sl,pc],N6),bC=He([$m],t=>{if(t)return t.dataKey}),Mxe=He([$m],t=>{if(t)return t.graphicalItemId}),q6=He([th,xC,W6,yC],z6),Axe=He([tl,nl,sn,Ii,sl,yC,q6,Hm],F6),Txe=He([$m,Axe],(t,e)=>t!=null&&t.coordinate?t.coordinate:e),Cxe=He([$m],t=>t.active),Rxe=He([q6,pc,xc,Bm,X6,Hm,xC],B6),Pxe=He([Rxe],t=>{if(t!=null){var e=t.map(n=>n.payload).filter(n=>n!=null);return Array.from(new Set(e))}});function vF(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),n.push.apply(n,i)}return n}function xF(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?vF(Object(n),!0).forEach(function(i){Dxe(t,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):vF(Object(n)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(n,i))})}return t}function Dxe(t,e,n){return(e=Nxe(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Nxe(t){var e=Oxe(t,"string");return typeof e=="symbol"?e:e+""}function Oxe(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var i=n.call(t,e);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Lxe=()=>bt(Fi),Ixe=()=>{var t=Lxe(),e=bt(sl),n=bt($6);return Rf(!t||!n?void 0:xF(xF({},t),{},{scale:n}),e)};function yF(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),n.push.apply(n,i)}return n}function Kd(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?yF(Object(n),!0).forEach(function(i){Uxe(t,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):yF(Object(n)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(n,i))})}return t}function Uxe(t,e,n){return(e=kxe(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function kxe(t){var e=Fxe(t,"string");return typeof e=="symbol"?e:e+""}function Fxe(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var i=n.call(t,e);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var zxe=(t,e,n,i)=>{var r=e.find(a=>a&&a.index===n);if(r){if(t==="horizontal")return{x:r.coordinate,y:i.chartY};if(t==="vertical")return{x:i.chartX,y:r.coordinate}}return{x:0,y:0}},Bxe=(t,e,n,i)=>{var r=e.find(d=>d&&d.index===n);if(r){if(t==="centric"){var a=r.coordinate,{radius:s}=i;return Kd(Kd(Kd({},i),xi(i.cx,i.cy,s,a)),{},{angle:a,radius:s})}var l=r.coordinate,{angle:c}=i;return Kd(Kd(Kd({},i),xi(i.cx,i.cy,l,c)),{},{angle:c,radius:l})}return{angle:0,clockWise:!1,cx:0,cy:0,endAngle:0,innerRadius:0,outerRadius:0,radius:0,startAngle:0,x:0,y:0}};function jxe(t,e){var{chartX:n,chartY:i}=t;return n>=e.left&&n<=e.left+e.width&&i>=e.top&&i<=e.top+e.height}var Y6=(t,e,n,i,r)=>{var a,s=-1,l=(a=e?.length)!==null&&a!==void 0?a:0;if(l<=1||t==null)return 0;if(i==="angleAxis"&&r!=null&&Math.abs(Math.abs(r[1]-r[0])-360)<=1e-6)for(var c=0;c<l;c++){var d=c>0?n[c-1].coordinate:n[l-1].coordinate,f=n[c].coordinate,h=c>=l-1?n[0].coordinate:n[c+1].coordinate,g=void 0;if(Zi(f-d)!==Zi(h-f)){var m=[];if(Zi(h-f)===Zi(r[1]-r[0])){g=h;var b=f+r[1]-r[0];m[0]=Math.min(b,(b+d)/2),m[1]=Math.max(b,(b+d)/2)}else{g=d;var y=h+r[1]-r[0];m[0]=Math.min(f,(y+f)/2),m[1]=Math.max(f,(y+f)/2)}var x=[Math.min(f,(g+f)/2),Math.max(f,(g+f)/2)];if(t>x[0]&&t<=x[1]||t>=m[0]&&t<=m[1]){({index:s}=n[c]);break}}else{var v=Math.min(d,h),w=Math.max(d,h);if(t>(v+f)/2&&t<=(w+f)/2){({index:s}=n[c]);break}}}else if(e){for(var S=0;S<l;S++)if(S===0&&t<=(e[S].coordinate+e[S+1].coordinate)/2||S>0&&S<l-1&&t>(e[S].coordinate+e[S-1].coordinate)/2&&t<=(e[S].coordinate+e[S+1].coordinate)/2||S===l-1&&t>(e[S].coordinate+e[S-1].coordinate)/2){({index:s}=e[S]);break}}return s},K6=()=>bt(H2),_C=(t,e)=>e,Z6=(t,e,n)=>n,SC=(t,e,n,i)=>i,Hxe=He(sl,t=>My(t,e=>e.coordinate)),wC=He([th,_C,Z6,SC],k6),EC=He([wC,nh,Bm,Vm],mC),Gxe=(t,e,n)=>{if(e!=null){var i=th(t);return e==="axis"?n==="hover"?i.axisInteraction.hover.dataKey:i.axisInteraction.click.dataKey:n==="hover"?i.itemInteraction.hover.dataKey:i.itemInteraction.click.dataKey}},Q6=He([th,_C,Z6,SC],z6),Xx=He([tl,nl,sn,Ii,sl,SC,Q6,Hm],F6),Vxe=He([wC,Xx],(t,e)=>{var n;return(n=t.coordinate)!==null&&n!==void 0?n:e}),J6=He([sl,EC],N6),$xe=He([Q6,EC,xc,Bm,J6,Hm,_C],B6),Wxe=He([wC,EC],(t,e)=>({isActive:t.active&&e!=null,activeIndex:e})),Xxe=(t,e,n,i,r,a,s)=>{if(!(!t||!n||!i||!r)&&jxe(t,s)){var l=pfe(t,e),c=Y6(l,a,r,n,i),d=zxe(e,r,c,t);return{activeIndex:String(c),activeCoordinate:d}}},qxe=(t,e,n,i,r,a,s)=>{if(!(!t||!i||!r||!a||!n)){var l=Dpe(t,n);if(l){var c=mfe(l,e),d=Y6(c,s,a,i,r),f=Bxe(e,a,d,l);return{activeIndex:String(d),activeCoordinate:f}}}},Yxe=(t,e,n,i,r,a,s,l)=>{if(!(!t||!e||!i||!r||!a))return e==="horizontal"||e==="vertical"?Xxe(t,e,i,r,a,s,l):qxe(t,e,n,i,r,a,s)},Kxe=He(t=>t.zIndex.zIndexMap,(t,e)=>e,(t,e,n)=>n,(t,e,n)=>{if(e!=null){var i=t[e];if(i!=null)return n?i.panoramaElementId:i.elementId}}),Zxe=He(t=>t.zIndex.zIndexMap,t=>{var e=Object.keys(t).map(i=>parseInt(i,10)).concat(Object.values(yi)),n=Array.from(new Set(e));return n.sort((i,r)=>i-r)},{memoizeOptions:{resultEqualityCheck:L0e}});function bF(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),n.push.apply(n,i)}return n}function _F(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?bF(Object(n),!0).forEach(function(i){Qxe(t,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):bF(Object(n)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(n,i))})}return t}function Qxe(t,e,n){return(e=Jxe(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Jxe(t){var e=eye(t,"string");return typeof e=="symbol"?e:e+""}function eye(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var i=n.call(t,e);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var tye={},nye={zIndexMap:Object.values(yi).reduce((t,e)=>_F(_F({},t),{},{[e]:{elementId:void 0,panoramaElementId:void 0,consumers:0}}),tye)},iye=new Set(Object.values(yi));function rye(t){return iye.has(t)}var eH=ea({name:"zIndex",initialState:nye,reducers:{registerZIndexPortal:{reducer:(t,e)=>{var{zIndex:n}=e.payload;t.zIndexMap[n]?t.zIndexMap[n].consumers+=1:t.zIndexMap[n]={consumers:1,elementId:void 0,panoramaElementId:void 0}},prepare:Gn()},unregisterZIndexPortal:{reducer:(t,e)=>{var{zIndex:n}=e.payload;t.zIndexMap[n]&&(t.zIndexMap[n].consumers-=1,t.zIndexMap[n].consumers<=0&&!rye(n)&&delete t.zIndexMap[n])},prepare:Gn()},registerZIndexPortalId:{reducer:(t,e)=>{var{zIndex:n,elementId:i,isPanorama:r}=e.payload;t.zIndexMap[n]?r?t.zIndexMap[n].panoramaElementId=i:t.zIndexMap[n].elementId=i:t.zIndexMap[n]={consumers:0,elementId:r?void 0:i,panoramaElementId:r?i:void 0}},prepare:Gn()},unregisterZIndexPortalId:{reducer:(t,e)=>{var{zIndex:n}=e.payload;t.zIndexMap[n]&&(e.payload.isPanorama?t.zIndexMap[n].panoramaElementId=void 0:t.zIndexMap[n].elementId=void 0)},prepare:Gn()}}}),{registerZIndexPortal:aye,unregisterZIndexPortal:sye,registerZIndexPortalId:oye,unregisterZIndexPortalId:lye}=eH.actions,cye=eH.reducer;function ta(t){var{zIndex:e,children:n}=t,i=Xfe(),r=i&&e!==void 0&&e!==0,a=Ar(),s=In();T.useLayoutEffect(()=>r?(s(aye({zIndex:e})),()=>{s(sye({zIndex:e}))}):wm,[s,e,r]);var l=bt(d=>Kxe(d,e,a));if(!r)return n;if(!l)return null;var c=document.getElementById(l);return c?Zl.createPortal(n,c):null}function kA(){return kA=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)({}).hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},kA.apply(null,arguments)}function SF(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),n.push.apply(n,i)}return n}function wv(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?SF(Object(n),!0).forEach(function(i){uye(t,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):SF(Object(n)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(n,i))})}return t}function uye(t,e,n){return(e=dye(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function dye(t){var e=fye(t,"string");return typeof e=="symbol"?e:e+""}function fye(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var i=n.call(t,e);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function hye(t){var{cursor:e,cursorComp:n,cursorProps:i}=t;return T.isValidElement(e)?T.cloneElement(e,i):T.createElement(n,i)}function pye(t){var e,{coordinate:n,payload:i,index:r,offset:a,tooltipAxisBandSize:s,layout:l,cursor:c,tooltipEventType:d,chartName:f}=t,h=n,g=i,m=r;if(!c||!h||f!=="ScatterChart"&&d!=="axis")return null;var b,y,x;if(f==="ScatterChart")b=h,y=Whe,x=yi.cursorLine;else if(f==="BarChart")b=Xhe(l,h,a,s),y=Yj,x=yi.cursorRectangle;else if(l==="radial"&&P5(h)){var{cx:v,cy:w,radius:S,startAngle:A,endAngle:R}=Zj(h);b={cx:v,cy:w,startAngle:A,endAngle:R,innerRadius:S,outerRadius:S},y=Jj,x=yi.cursorLine}else b={points:Ipe(l,h,a)},y=hf,x=yi.cursorLine;var N=typeof c=="object"&&"className"in c?c.className:void 0,C=wv(wv(wv(wv({stroke:"#ccc",pointerEvents:"none"},a),b),Au(c)),{},{payload:g,payloadIndex:m,className:dn("recharts-tooltip-cursor",N)});return T.createElement(ta,{zIndex:(e=t.zIndex)!==null&&e!==void 0?e:x},T.createElement(hye,{cursor:c,cursorComp:y,cursorProps:C}))}function mye(t){var e=Ixe(),n=Nj(),i=Wf(),r=K6();return e==null||n==null||i==null||r==null?null:T.createElement(pye,kA({},t,{offset:n,layout:i,tooltipAxisBandSize:e,chartName:r}))}var tH=T.createContext(null),gye=()=>T.useContext(tH),hE={exports:{}},wF;function vye(){return wF||(wF=1,(function(t){var e=Object.prototype.hasOwnProperty,n="~";function i(){}Object.create&&(i.prototype=Object.create(null),new i().__proto__||(n=!1));function r(c,d,f){this.fn=c,this.context=d,this.once=f||!1}function a(c,d,f,h,g){if(typeof f!="function")throw new TypeError("The listener must be a function");var m=new r(f,h||c,g),b=n?n+d:d;return c._events[b]?c._events[b].fn?c._events[b]=[c._events[b],m]:c._events[b].push(m):(c._events[b]=m,c._eventsCount++),c}function s(c,d){--c._eventsCount===0?c._events=new i:delete c._events[d]}function l(){this._events=new i,this._eventsCount=0}l.prototype.eventNames=function(){var d=[],f,h;if(this._eventsCount===0)return d;for(h in f=this._events)e.call(f,h)&&d.push(n?h.slice(1):h);return Object.getOwnPropertySymbols?d.concat(Object.getOwnPropertySymbols(f)):d},l.prototype.listeners=function(d){var f=n?n+d:d,h=this._events[f];if(!h)return[];if(h.fn)return[h.fn];for(var g=0,m=h.length,b=new Array(m);g<m;g++)b[g]=h[g].fn;return b},l.prototype.listenerCount=function(d){var f=n?n+d:d,h=this._events[f];return h?h.fn?1:h.length:0},l.prototype.emit=function(d,f,h,g,m,b){var y=n?n+d:d;if(!this._events[y])return!1;var x=this._events[y],v=arguments.length,w,S;if(x.fn){switch(x.once&&this.removeListener(d,x.fn,void 0,!0),v){case 1:return x.fn.call(x.context),!0;case 2:return x.fn.call(x.context,f),!0;case 3:return x.fn.call(x.context,f,h),!0;case 4:return x.fn.call(x.context,f,h,g),!0;case 5:return x.fn.call(x.context,f,h,g,m),!0;case 6:return x.fn.call(x.context,f,h,g,m,b),!0}for(S=1,w=new Array(v-1);S<v;S++)w[S-1]=arguments[S];x.fn.apply(x.context,w)}else{var A=x.length,R;for(S=0;S<A;S++)switch(x[S].once&&this.removeListener(d,x[S].fn,void 0,!0),v){case 1:x[S].fn.call(x[S].context);break;case 2:x[S].fn.call(x[S].context,f);break;case 3:x[S].fn.call(x[S].context,f,h);break;case 4:x[S].fn.call(x[S].context,f,h,g);break;default:if(!w)for(R=1,w=new Array(v-1);R<v;R++)w[R-1]=arguments[R];x[S].fn.apply(x[S].context,w)}}return!0},l.prototype.on=function(d,f,h){return a(this,d,f,h,!1)},l.prototype.once=function(d,f,h){return a(this,d,f,h,!0)},l.prototype.removeListener=function(d,f,h,g){var m=n?n+d:d;if(!this._events[m])return this;if(!f)return s(this,m),this;var b=this._events[m];if(b.fn)b.fn===f&&(!g||b.once)&&(!h||b.context===h)&&s(this,m);else{for(var y=0,x=[],v=b.length;y<v;y++)(b[y].fn!==f||g&&!b[y].once||h&&b[y].context!==h)&&x.push(b[y]);x.length?this._events[m]=x.length===1?x[0]:x:s(this,m)}return this},l.prototype.removeAllListeners=function(d){var f;return d?(f=n?n+d:d,this._events[f]&&s(this,f)):(this._events=new i,this._eventsCount=0),this},l.prototype.off=l.prototype.removeListener,l.prototype.addListener=l.prototype.on,l.prefixed=n,l.EventEmitter=l,t.exports=l})(hE)),hE.exports}var xye=vye();const yye=Xs(xye);var cm=new yye,FA="recharts.syncEvent.tooltip",EF="recharts.syncEvent.brush";function MC(t,e){if(e){var n=Number.parseInt(e,10);if(!Ya(n))return t?.[n]}}var bye={chartName:"",tooltipPayloadSearcher:void 0,eventEmitter:void 0,defaultTooltipEventType:"axis"},nH=ea({name:"options",initialState:bye,reducers:{createEventEmitter:t=>{t.eventEmitter==null&&(t.eventEmitter=Symbol("rechartsEventEmitter"))}}}),_ye=nH.reducer,{createEventEmitter:Sye}=nH.actions;function wye(t){return t.tooltip.syncInteraction}var Eye={chartData:void 0,computedData:void 0,dataStartIndex:0,dataEndIndex:0},iH=ea({name:"chartData",initialState:Eye,reducers:{setChartData(t,e){if(t.chartData=e.payload,e.payload==null){t.dataStartIndex=0,t.dataEndIndex=0;return}e.payload.length>0&&t.dataEndIndex!==e.payload.length-1&&(t.dataEndIndex=e.payload.length-1)},setComputedData(t,e){t.computedData=e.payload},setDataStartEndIndexes(t,e){var{startIndex:n,endIndex:i}=e.payload;n!=null&&(t.dataStartIndex=n),i!=null&&(t.dataEndIndex=i)}}}),{setChartData:MF,setDataStartEndIndexes:Mye,setComputedData:aCe}=iH.actions,Aye=iH.reducer,Tye=["x","y"];function AF(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),n.push.apply(n,i)}return n}function Zd(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?AF(Object(n),!0).forEach(function(i){Cye(t,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):AF(Object(n)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(n,i))})}return t}function Cye(t,e,n){return(e=Rye(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Rye(t){var e=Pye(t,"string");return typeof e=="symbol"?e:e+""}function Pye(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var i=n.call(t,e);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Dye(t,e){if(t==null)return{};var n,i,r=Nye(t,e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(i=0;i<a.length;i++)n=a[i],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function Nye(t,e){if(t==null)return{};var n={};for(var i in t)if({}.hasOwnProperty.call(t,i)){if(e.indexOf(i)!==-1)continue;n[i]=t[i]}return n}function Oye(){var t=bt(G2),e=bt(V2),n=In(),i=bt(Q8),r=bt(sl),a=Wf(),s=Fy(),l=bt(c=>c.rootProps.className);T.useEffect(()=>{if(t==null)return wm;var c=(d,f,h)=>{if(e!==h&&t===d){if(i==="index"){var g;if(s&&f!==null&&f!==void 0&&(g=f.payload)!==null&&g!==void 0&&g.coordinate&&f.payload.sourceViewBox){var m=f.payload.coordinate,{x:b,y}=m,x=Dye(m,Tye),{x:v,y:w,width:S,height:A}=f.payload.sourceViewBox,R=Zd(Zd({},x),{},{x:s.x+(S?(b-v)/S:0)*s.width,y:s.y+(A?(y-w)/A:0)*s.height});n(Zd(Zd({},f),{},{payload:Zd(Zd({},f.payload),{},{coordinate:R})}))}else n(f);return}if(r!=null){var N;if(typeof i=="function"){var C={activeTooltipIndex:f.payload.index==null?void 0:Number(f.payload.index),isTooltipActive:f.payload.active,activeIndex:f.payload.index==null?void 0:Number(f.payload.index),activeLabel:f.payload.label,activeDataKey:f.payload.dataKey,activeCoordinate:f.payload.coordinate},F=i(r,C);N=r[F]}else i==="value"&&(N=r.find(X=>String(X.value)===f.payload.label));var{coordinate:P}=f.payload;if(N==null||f.payload.active===!1||P==null||s==null){n(IA({active:!1,coordinate:void 0,dataKey:void 0,index:null,label:void 0,sourceViewBox:void 0,graphicalItemId:void 0}));return}var{x:L,y:B}=P,U=Math.min(L,s.x+s.width),$=Math.min(B,s.y+s.height),I={x:a==="horizontal"?N.coordinate:U,y:a==="horizontal"?$:N.coordinate},W=IA({active:f.payload.active,coordinate:I,dataKey:f.payload.dataKey,index:String(N.index),label:f.payload.label,sourceViewBox:f.payload.sourceViewBox,graphicalItemId:f.payload.graphicalItemId});n(W)}}};return cm.on(FA,c),()=>{cm.off(FA,c)}},[l,n,e,t,i,r,a,s])}function Lye(){var t=bt(G2),e=bt(V2),n=In();T.useEffect(()=>{if(t==null)return wm;var i=(r,a,s)=>{e!==s&&t===r&&n(Mye(a))};return cm.on(EF,i),()=>{cm.off(EF,i)}},[n,e,t])}function Iye(){var t=In();T.useEffect(()=>{t(Sye())},[t]),Oye(),Lye()}function Uye(t,e,n,i,r,a){var s=bt(m=>Gxe(m,t,e)),l=bt(V2),c=bt(G2),d=bt(Q8),f=bt(wye),h=f?.active,g=Fy();T.useEffect(()=>{if(!h&&c!=null&&l!=null){var m=IA({active:a,coordinate:n,dataKey:s,index:r,label:typeof i=="number"?String(i):i,sourceViewBox:g,graphicalItemId:void 0});cm.emit(FA,c,m,l)}},[h,n,s,r,i,l,c,d,a,g])}function TF(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),n.push.apply(n,i)}return n}function CF(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?TF(Object(n),!0).forEach(function(i){kye(t,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):TF(Object(n)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(n,i))})}return t}function kye(t,e,n){return(e=Fye(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Fye(t){var e=zye(t,"string");return typeof e=="symbol"?e:e+""}function zye(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var i=n.call(t,e);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Bye(t){return t.dataKey}function jye(t,e){return T.isValidElement(t)?T.cloneElement(t,e):typeof t=="function"?T.createElement(t,e):T.createElement(Mhe,e)}var RF=[],Hye={allowEscapeViewBox:{x:!1,y:!1},animationDuration:400,animationEasing:"ease",axisId:0,contentStyle:{},cursor:!0,filterNull:!0,isAnimationActive:"auto",itemSorter:"name",itemStyle:{},labelStyle:{},offset:10,reverseDirection:{x:!1,y:!1},separator:" : ",trigger:"hover",useTranslate3d:!1,wrapperStyle:{}};function pE(t){var e,n,i=Si(t,Hye),{active:r,allowEscapeViewBox:a,animationDuration:s,animationEasing:l,content:c,filterNull:d,isAnimationActive:f,offset:h,payloadUniqBy:g,position:m,reverseDirection:b,useTranslate3d:y,wrapperStyle:x,cursor:v,shared:w,trigger:S,defaultIndex:A,portal:R,axisId:N}=i,C=In(),F=typeof A=="number"?String(A):A;T.useEffect(()=>{C(Fve({shared:w,trigger:S,axisId:N,active:r,defaultIndex:F}))},[C,w,S,N,r,F]);var P=Fy(),L=Vj(),B=Nve(w),{activeIndex:U,isActive:$}=(e=bt(be=>Wxe(be,B,S,F)))!==null&&e!==void 0?e:{},I=bt(be=>$xe(be,B,S,F)),W=bt(be=>J6(be,B,S,F)),X=bt(be=>Vxe(be,B,S,F)),V=I,Y=gye(),J=(n=r??$)!==null&&n!==void 0?n:!1,[se,H]=$5([V,J]),q=B==="axis"?W:void 0;Uye(B,S,X,q,U,J);var re=R??Y;if(re==null||P==null||B==null)return null;var ce=V??RF;J||(ce=RF),d&&ce.length&&(ce=B5(ce.filter(be=>be.value!=null&&(be.hide!==!0||i.includeHidden)),g,Bye));var ye=ce.length>0,me=T.createElement(Nhe,{allowEscapeViewBox:a,animationDuration:s,animationEasing:l,isAnimationActive:f,active:J,coordinate:X,hasPayload:ye,offset:h,position:m,reverseDirection:b,useTranslate3d:y,viewBox:P,wrapperStyle:x,lastBoundingBox:se,innerRef:H,hasPortalFromProps:!!R},jye(c,CF(CF({},i),{},{payload:ce,label:q,active:J,activeIndex:U,coordinate:X,accessibilityLayer:L})));return T.createElement(T.Fragment,null,Zl.createPortal(me,re),J&&T.createElement(mye,{cursor:v,tooltipEventType:B,coordinate:X,payload:ce,index:U}))}var Wm=t=>null;Wm.displayName="Cell";function Gye(t,e,n){return(e=Vye(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Vye(t){var e=$ye(t,"string");return typeof e=="symbol"?e:e+""}function $ye(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var i=n.call(t,e);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}class Wye{constructor(e){Gye(this,"cache",new Map),this.maxSize=e}get(e){var n=this.cache.get(e);return n!==void 0&&(this.cache.delete(e),this.cache.set(e,n)),n}set(e,n){if(this.cache.has(e))this.cache.delete(e);else if(this.cache.size>=this.maxSize){var i=this.cache.keys().next().value;i!=null&&this.cache.delete(i)}this.cache.set(e,n)}clear(){this.cache.clear()}size(){return this.cache.size}}function PF(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),n.push.apply(n,i)}return n}function Xye(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?PF(Object(n),!0).forEach(function(i){qye(t,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):PF(Object(n)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(n,i))})}return t}function qye(t,e,n){return(e=Yye(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Yye(t){var e=Kye(t,"string");return typeof e=="symbol"?e:e+""}function Kye(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var i=n.call(t,e);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Zye={cacheSize:2e3,enableCache:!0},rH=Xye({},Zye),DF=new Wye(rH.cacheSize),Qye={position:"absolute",top:"-20000px",left:0,padding:0,margin:0,border:"none",whiteSpace:"pre"},NF="recharts_measurement_span";function Jye(t,e){var n=e.fontSize||"",i=e.fontFamily||"",r=e.fontWeight||"",a=e.fontStyle||"",s=e.letterSpacing||"",l=e.textTransform||"";return"".concat(t,"|").concat(n,"|").concat(i,"|").concat(r,"|").concat(a,"|").concat(s,"|").concat(l)}var OF=(t,e)=>{try{var n=document.getElementById(NF);n||(n=document.createElement("span"),n.setAttribute("id",NF),n.setAttribute("aria-hidden","true"),document.body.appendChild(n)),Object.assign(n.style,Qye,e),n.textContent="".concat(t);var i=n.getBoundingClientRect();return{width:i.width,height:i.height}}catch{return{width:0,height:0}}},Pp=function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(e==null||Xf.isSsr)return{width:0,height:0};if(!rH.enableCache)return OF(e,n);var i=Jye(e,n),r=DF.get(i);if(r)return r;var a=OF(e,n);return DF.set(i,a),a},LF=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([*/])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,IF=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([+-])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,ebe=/^px|cm|vh|vw|em|rem|%|mm|in|pt|pc|ex|ch|vmin|vmax|Q$/,tbe=/(-?\d+(?:\.\d+)?)([a-zA-Z%]+)?/,aH={cm:96/2.54,mm:96/25.4,pt:96/72,pc:96/6,in:96,Q:96/(2.54*40),px:1},nbe=Object.keys(aH),rf="NaN";function ibe(t,e){return t*aH[e]}class Xr{static parse(e){var n,[,i,r]=(n=tbe.exec(e))!==null&&n!==void 0?n:[];return new Xr(parseFloat(i),r??"")}constructor(e,n){this.num=e,this.unit=n,this.num=e,this.unit=n,Ya(e)&&(this.unit=""),n!==""&&!ebe.test(n)&&(this.num=NaN,this.unit=""),nbe.includes(n)&&(this.num=ibe(e,n),this.unit="px")}add(e){return this.unit!==e.unit?new Xr(NaN,""):new Xr(this.num+e.num,this.unit)}subtract(e){return this.unit!==e.unit?new Xr(NaN,""):new Xr(this.num-e.num,this.unit)}multiply(e){return this.unit!==""&&e.unit!==""&&this.unit!==e.unit?new Xr(NaN,""):new Xr(this.num*e.num,this.unit||e.unit)}divide(e){return this.unit!==""&&e.unit!==""&&this.unit!==e.unit?new Xr(NaN,""):new Xr(this.num/e.num,this.unit||e.unit)}toString(){return"".concat(this.num).concat(this.unit)}isNaN(){return Ya(this.num)}}function sH(t){if(t.includes(rf))return rf;for(var e=t;e.includes("*")||e.includes("/");){var n,[,i,r,a]=(n=LF.exec(e))!==null&&n!==void 0?n:[],s=Xr.parse(i??""),l=Xr.parse(a??""),c=r==="*"?s.multiply(l):s.divide(l);if(c.isNaN())return rf;e=e.replace(LF,c.toString())}for(;e.includes("+")||/.-\d+(?:\.\d+)?/.test(e);){var d,[,f,h,g]=(d=IF.exec(e))!==null&&d!==void 0?d:[],m=Xr.parse(f??""),b=Xr.parse(g??""),y=h==="+"?m.add(b):m.subtract(b);if(y.isNaN())return rf;e=e.replace(IF,y.toString())}return e}var UF=/\(([^()]*)\)/;function rbe(t){for(var e=t,n;(n=UF.exec(e))!=null;){var[,i]=n;e=e.replace(UF,sH(i))}return e}function abe(t){var e=t.replace(/\s+/g,"");return e=rbe(e),e=sH(e),e}function sbe(t){try{return abe(t)}catch{return rf}}function mE(t){var e=sbe(t.slice(5,-1));return e===rf?"":e}var obe=["x","y","lineHeight","capHeight","fill","scaleToFit","textAnchor","verticalAnchor"],lbe=["dx","dy","angle","className","breakAll"];function zA(){return zA=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)({}).hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},zA.apply(null,arguments)}function kF(t,e){if(t==null)return{};var n,i,r=cbe(t,e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(i=0;i<a.length;i++)n=a[i],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function cbe(t,e){if(t==null)return{};var n={};for(var i in t)if({}.hasOwnProperty.call(t,i)){if(e.indexOf(i)!==-1)continue;n[i]=t[i]}return n}var oH=/[ \f\n\r\t\v\u2028\u2029]+/,lH=t=>{var{children:e,breakAll:n,style:i}=t;try{var r=[];qn(e)||(n?r=e.toString().split(""):r=e.toString().split(oH));var a=r.map(l=>({word:l,width:Pp(l,i).width})),s=n?0:Pp(" ",i).width;return{wordsWithComputedWidth:a,spaceWidth:s}}catch{return null}};function ube(t){return t==="start"||t==="middle"||t==="end"||t==="inherit"}var cH=(t,e,n,i)=>t.reduce((r,a)=>{var{word:s,width:l}=a,c=r[r.length-1];if(c&&l!=null&&(e==null||i||c.width+l+n<Number(e)))c.words.push(s),c.width+=l+n;else{var d={words:[s],width:l};r.push(d)}return r},[]),uH=t=>t.reduce((e,n)=>e.width>n.width?e:n),dbe="…",FF=(t,e,n,i,r,a,s,l)=>{var c=t.slice(0,e),d=lH({breakAll:n,style:i,children:c+dbe});if(!d)return[!1,[]];var f=cH(d.wordsWithComputedWidth,a,s,l),h=f.length>r||uH(f).width>Number(a);return[h,f]},fbe=(t,e,n,i,r)=>{var{maxLines:a,children:s,style:l,breakAll:c}=t,d=yt(a),f=String(s),h=cH(e,i,n,r);if(!d||r)return h;var g=h.length>a||uH(h).width>Number(i);if(!g)return h;for(var m=0,b=f.length-1,y=0,x;m<=b&&y<=f.length-1;){var v=Math.floor((m+b)/2),w=v-1,[S,A]=FF(f,w,c,l,a,i,n,r),[R]=FF(f,v,c,l,a,i,n,r);if(!S&&!R&&(m=v+1),S&&R&&(b=v-1),!S&&R){x=A;break}y++}return x||h},zF=t=>{var e=qn(t)?[]:t.toString().split(oH);return[{words:e,width:void 0}]},hbe=t=>{var{width:e,scaleToFit:n,children:i,style:r,breakAll:a,maxLines:s}=t;if((e||n)&&!Xf.isSsr){var l,c,d=lH({breakAll:a,children:i,style:r});if(d){var{wordsWithComputedWidth:f,spaceWidth:h}=d;l=f,c=h}else return zF(i);return fbe({breakAll:a,children:i,maxLines:s,style:r},l,c,e,!!n)}return zF(i)},dH="#808080",pbe={angle:0,breakAll:!1,capHeight:"0.71em",fill:dH,lineHeight:"1em",scaleToFit:!1,textAnchor:"start",verticalAnchor:"end",x:0,y:0},ob=T.forwardRef((t,e)=>{var n=Si(t,pbe),{x:i,y:r,lineHeight:a,capHeight:s,fill:l,scaleToFit:c,textAnchor:d,verticalAnchor:f}=n,h=kF(n,obe),g=T.useMemo(()=>hbe({breakAll:h.breakAll,children:h.children,maxLines:h.maxLines,scaleToFit:c,style:h.style,width:h.width}),[h.breakAll,h.children,h.maxLines,c,h.style,h.width]),{dx:m,dy:b,angle:y,className:x,breakAll:v}=h,w=kF(h,lbe);if(!Gs(i)||!Gs(r)||g.length===0)return null;var S=Number(i)+(yt(m)?m:0),A=Number(r)+(yt(b)?b:0);if(!jn(S)||!jn(A))return null;var R;switch(f){case"start":R=mE("calc(".concat(s,")"));break;case"middle":R=mE("calc(".concat((g.length-1)/2," * -").concat(a," + (").concat(s," / 2))"));break;default:R=mE("calc(".concat(g.length-1," * -").concat(a,")"));break}var N=[];if(c){var C=g[0].width,{width:F}=h;N.push("scale(".concat(yt(F)&&yt(C)?F/C:1,")"))}return y&&N.push("rotate(".concat(y,", ").concat(S,", ").concat(A,")")),N.length&&(w.transform=N.join(" ")),T.createElement("text",zA({},kr(w),{ref:e,x:S,y:A,className:dn("recharts-text",x),textAnchor:d,fill:l.includes("url")?dH:l}),g.map((P,L)=>{var B=P.words.join(v?"":" ");return T.createElement("tspan",{x:S,dy:L===0?R:a,key:"".concat(B,"-").concat(L)},B)}))});ob.displayName="Text";var mbe=["labelRef"];function gbe(t,e){if(t==null)return{};var n,i,r=vbe(t,e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(i=0;i<a.length;i++)n=a[i],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function vbe(t,e){if(t==null)return{};var n={};for(var i in t)if({}.hasOwnProperty.call(t,i)){if(e.indexOf(i)!==-1)continue;n[i]=t[i]}return n}function BF(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),n.push.apply(n,i)}return n}function ri(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?BF(Object(n),!0).forEach(function(i){xbe(t,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):BF(Object(n)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(n,i))})}return t}function xbe(t,e,n){return(e=ybe(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function ybe(t){var e=bbe(t,"string");return typeof e=="symbol"?e:e+""}function bbe(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var i=n.call(t,e);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function No(){return No=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)({}).hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},No.apply(null,arguments)}var fH=T.createContext(null),_be=t=>{var{x:e,y:n,upperWidth:i,lowerWidth:r,width:a,height:s,children:l}=t,c=T.useMemo(()=>({x:e,y:n,upperWidth:i,lowerWidth:r,width:a,height:s}),[e,n,i,r,a,s]);return T.createElement(fH.Provider,{value:c},l)},hH=()=>{var t=T.useContext(fH),e=Fy();return t||Dj(e)},Sbe=T.createContext(null),wbe=()=>{var t=T.useContext(Sbe),e=bt(i6);return t||e},Ebe=t=>{var{value:e,formatter:n}=t,i=qn(t.children)?e:t.children;return typeof n=="function"?n(i):i},AC=t=>t!=null&&typeof t=="function",Mbe=(t,e)=>{var n=Zi(e-t),i=Math.min(Math.abs(e-t),360);return n*i},Abe=(t,e,n,i,r)=>{var{offset:a,className:s}=t,{cx:l,cy:c,innerRadius:d,outerRadius:f,startAngle:h,endAngle:g,clockWise:m}=r,b=(d+f)/2,y=Mbe(h,g),x=y>=0?1:-1,v,w;switch(e){case"insideStart":v=h+x*a,w=m;break;case"insideEnd":v=g-x*a,w=!m;break;case"end":v=g+x*a,w=m;break;default:throw new Error("Unsupported position ".concat(e))}w=y<=0?w:!w;var S=xi(l,c,b,v),A=xi(l,c,b,v+(w?1:-1)*359),R="M".concat(S.x,",").concat(S.y,`
  8093. A`).concat(b,",").concat(b,",0,1,").concat(w?0:1,`,
  8094. `).concat(A.x,",").concat(A.y),N=qn(t.id)?Yp("recharts-radial-line-"):t.id;return T.createElement("text",No({},i,{dominantBaseline:"central",className:dn("recharts-radial-bar-label",s)}),T.createElement("defs",null,T.createElement("path",{id:N,d:R})),T.createElement("textPath",{xlinkHref:"#".concat(N)},n))},Tbe=(t,e,n)=>{var{cx:i,cy:r,innerRadius:a,outerRadius:s,startAngle:l,endAngle:c}=t,d=(l+c)/2;if(n==="outside"){var{x:f,y:h}=xi(i,r,s+e,d);return{x:f,y:h,textAnchor:f>=i?"start":"end",verticalAnchor:"middle"}}if(n==="center")return{x:i,y:r,textAnchor:"middle",verticalAnchor:"middle"};if(n==="centerTop")return{x:i,y:r,textAnchor:"middle",verticalAnchor:"start"};if(n==="centerBottom")return{x:i,y:r,textAnchor:"middle",verticalAnchor:"end"};var g=(a+s)/2,{x:m,y:b}=xi(i,r,g,d);return{x:m,y:b,textAnchor:"middle",verticalAnchor:"middle"}},BA=t=>"cx"in t&&yt(t.cx),Cbe=(t,e)=>{var{parentViewBox:n,offset:i,position:r}=t,a;n!=null&&!BA(n)&&(a=n);var{x:s,y:l,upperWidth:c,lowerWidth:d,height:f}=e,h=s,g=s+(c-d)/2,m=(h+g)/2,b=(c+d)/2,y=h+c/2,x=f>=0?1:-1,v=x*i,w=x>0?"end":"start",S=x>0?"start":"end",A=c>=0?1:-1,R=A*i,N=A>0?"end":"start",C=A>0?"start":"end";if(r==="top"){var F={x:h+c/2,y:l-v,textAnchor:"middle",verticalAnchor:w};return ri(ri({},F),a?{height:Math.max(l-a.y,0),width:c}:{})}if(r==="bottom"){var P={x:g+d/2,y:l+f+v,textAnchor:"middle",verticalAnchor:S};return ri(ri({},P),a?{height:Math.max(a.y+a.height-(l+f),0),width:d}:{})}if(r==="left"){var L={x:m-R,y:l+f/2,textAnchor:N,verticalAnchor:"middle"};return ri(ri({},L),a?{width:Math.max(L.x-a.x,0),height:f}:{})}if(r==="right"){var B={x:m+b+R,y:l+f/2,textAnchor:C,verticalAnchor:"middle"};return ri(ri({},B),a?{width:Math.max(a.x+a.width-B.x,0),height:f}:{})}var U=a?{width:b,height:f}:{};return r==="insideLeft"?ri({x:m+R,y:l+f/2,textAnchor:C,verticalAnchor:"middle"},U):r==="insideRight"?ri({x:m+b-R,y:l+f/2,textAnchor:N,verticalAnchor:"middle"},U):r==="insideTop"?ri({x:h+c/2,y:l+v,textAnchor:"middle",verticalAnchor:S},U):r==="insideBottom"?ri({x:g+d/2,y:l+f-v,textAnchor:"middle",verticalAnchor:w},U):r==="insideTopLeft"?ri({x:h+R,y:l+v,textAnchor:C,verticalAnchor:S},U):r==="insideTopRight"?ri({x:h+c-R,y:l+v,textAnchor:N,verticalAnchor:S},U):r==="insideBottomLeft"?ri({x:g+R,y:l+f-v,textAnchor:C,verticalAnchor:w},U):r==="insideBottomRight"?ri({x:g+d-R,y:l+f-v,textAnchor:N,verticalAnchor:w},U):r&&typeof r=="object"&&(yt(r.x)||Xo(r.x))&&(yt(r.y)||Xo(r.y))?ri({x:s+Er(r.x,b),y:l+Er(r.y,f),textAnchor:"end",verticalAnchor:"end"},U):ri({x:y,y:l+f/2,textAnchor:"middle",verticalAnchor:"middle"},U)},Rbe={angle:0,offset:5,zIndex:yi.label,position:"middle",textBreakAll:!1};function Xl(t){var e=Si(t,Rbe),{viewBox:n,position:i,value:r,children:a,content:s,className:l="",textBreakAll:c,labelRef:d}=e,f=wbe(),h=hH(),g=i==="center"?h:f??h,m,b,y;if(n==null?m=g:BA(n)?m=n:m=Dj(n),!m||qn(r)&&qn(a)&&!T.isValidElement(s)&&typeof s!="function")return null;var x=ri(ri({},e),{},{viewBox:m});if(T.isValidElement(s)){var{labelRef:v}=x,w=gbe(x,mbe);return T.cloneElement(s,w)}if(typeof s=="function"){if(b=T.createElement(s,x),T.isValidElement(b))return b}else b=Ebe(e);var S=kr(e);if(BA(m)){if(i==="insideStart"||i==="insideEnd"||i==="end")return Abe(e,i,b,S,m);y=Tbe(m,e.offset,e.position)}else y=Cbe(e,m);return T.createElement(ta,{zIndex:e.zIndex},T.createElement(ob,No({ref:d,className:dn("recharts-label",l)},S,y,{textAnchor:ube(S.textAnchor)?S.textAnchor:y.textAnchor,breakAll:c}),b))}Xl.displayName="Label";var Pbe=(t,e,n)=>{if(!t)return null;var i={viewBox:e,labelRef:n};return t===!0?T.createElement(Xl,No({key:"label-implicit"},i)):Gs(t)?T.createElement(Xl,No({key:"label-implicit",value:t},i)):T.isValidElement(t)?t.type===Xl?T.cloneElement(t,ri({key:"label-implicit"},i)):T.createElement(Xl,No({key:"label-implicit",content:t},i)):AC(t)?T.createElement(Xl,No({key:"label-implicit",content:t},i)):t&&typeof t=="object"?T.createElement(Xl,No({},t,{key:"label-implicit"},i)):null};function Dbe(t){var{label:e,labelRef:n}=t,i=hH();return Pbe(e,i,n)||null}var gE={},vE={},jF;function Nbe(){return jF||(jF=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});function e(n){return n[n.length-1]}t.last=e})(vE)),vE}var xE={},HF;function Obe(){return HF||(HF=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});function e(n){return Array.isArray(n)?n:Array.from(n)}t.toArray=e})(xE)),xE}var GF;function Lbe(){return GF||(GF=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=Nbe(),n=Obe(),i=e2();function r(a){if(i.isArrayLike(a))return e.last(n.toArray(a))}t.last=r})(gE)),gE}var yE,VF;function Ibe(){return VF||(VF=1,yE=Lbe().last),yE}var Ube=Ibe();const kbe=Xs(Ube);var Fbe=["valueAccessor"],zbe=["dataKey","clockWise","id","textBreakAll","zIndex"];function qx(){return qx=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)({}).hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},qx.apply(null,arguments)}function $F(t,e){if(t==null)return{};var n,i,r=Bbe(t,e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(i=0;i<a.length;i++)n=a[i],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function Bbe(t,e){if(t==null)return{};var n={};for(var i in t)if({}.hasOwnProperty.call(t,i)){if(e.indexOf(i)!==-1)continue;n[i]=t[i]}return n}var jbe=t=>Array.isArray(t.value)?kbe(t.value):t.value,pH=T.createContext(void 0),mH=pH.Provider,gH=T.createContext(void 0),Hbe=gH.Provider;function Gbe(){return T.useContext(pH)}function Vbe(){return T.useContext(gH)}function Gv(t){var{valueAccessor:e=jbe}=t,n=$F(t,Fbe),{dataKey:i,clockWise:r,id:a,textBreakAll:s,zIndex:l}=n,c=$F(n,zbe),d=Gbe(),f=Vbe(),h=d||f;return!h||!h.length?null:T.createElement(ta,{zIndex:l??yi.label},T.createElement(oi,{className:"recharts-label-list"},h.map((g,m)=>{var b,y=qn(i)?e(g,m):Dn(g&&g.payload,i),x=qn(a)?{}:{id:"".concat(a,"-").concat(m)};return T.createElement(Xl,qx({key:"label-".concat(m)},kr(g),c,x,{fill:(b=n.fill)!==null&&b!==void 0?b:g.fill,parentViewBox:g.parentViewBox,value:y,textBreakAll:s,viewBox:g.viewBox,index:m,zIndex:0}))})))}Gv.displayName="LabelList";function TC(t){var{label:e}=t;return e?e===!0?T.createElement(Gv,{key:"labelList-implicit"}):T.isValidElement(e)||AC(e)?T.createElement(Gv,{key:"labelList-implicit",content:e}):typeof e=="object"?T.createElement(Gv,qx({key:"labelList-implicit"},e,{type:String(e.type)})):null:null}function jA(){return jA=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)({}).hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},jA.apply(null,arguments)}var vH=t=>{var{cx:e,cy:n,r:i,className:r}=t,a=dn("recharts-dot",r);return yt(e)&&yt(n)&&yt(i)?T.createElement("circle",jA({},Jr(t),JT(t),{className:a,cx:e,cy:n,r:i})):null},xH=t=>t.graphicalItems.polarItems,$be=He([$n,km],Y2),lb=He([xH,Yn,$be],K2),Wbe=He([lb],Z2),cb=He([Wbe,z2],Q2),Xbe=He([cb,Yn,lb],eC);He([cb,Yn,lb],(t,e,n)=>n.length>0?t.flatMap(i=>n.flatMap(r=>{var a,s=Dn(i,(a=e.dataKey)!==null&&a!==void 0?a:r.dataKey);return{value:s,errorDomain:[]}})).filter(Boolean):e?.dataKey!=null?t.map(i=>({value:Dn(i,e.dataKey),errorDomain:[]})):t.map(i=>({value:i,errorDomain:[]})));var WF=()=>{},qbe=He([cb,Yn,lb,rb,$n],rC),Ybe=He([Yn,nC,iC,WF,qbe,WF,sn,$n],aC),yH=He([Yn,sn,cb,Xbe,Um,$n,Ybe],sC),Kbe=He([yH,Yn,Jf],cC);He([Yn,yH,Kbe,$n],dC);var Zbe={radiusAxis:{},angleAxis:{}},bH=ea({name:"polarAxis",initialState:Zbe,reducers:{addRadiusAxis(t,e){t.radiusAxis[e.payload.id]=e.payload},removeRadiusAxis(t,e){delete t.radiusAxis[e.payload.id]},addAngleAxis(t,e){t.angleAxis[e.payload.id]=e.payload},removeAngleAxis(t,e){delete t.angleAxis[e.payload.id]}}}),{addRadiusAxis:sCe,removeRadiusAxis:oCe,addAngleAxis:lCe,removeAngleAxis:cCe}=bH.actions,Qbe=bH.reducer;function XF(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),n.push.apply(n,i)}return n}function qF(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?XF(Object(n),!0).forEach(function(i){Jbe(t,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):XF(Object(n)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(n,i))})}return t}function Jbe(t,e,n){return(e=e_e(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function e_e(t){var e=t_e(t,"string");return typeof e=="symbol"?e:e+""}function t_e(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var i=n.call(t,e);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var n_e=(t,e)=>e,CC=He([xH,n_e],(t,e)=>t.filter(n=>n.type==="pie").find(n=>n.id===e)),i_e=[],RC=(t,e,n)=>n?.length===0?i_e:n,_H=He([z2,CC,RC],(t,e,n)=>{var{chartData:i}=t;if(e!=null){var r;if(e?.data!=null&&e.data.length>0?r=e.data:r=i,(!r||!r.length)&&n!=null&&(r=n.map(a=>qF(qF({},e.presentationProps),a.props))),r!=null)return r}}),r_e=He([_H,CC,RC],(t,e,n)=>{if(!(t==null||e==null))return t.map((i,r)=>{var a,s=Dn(i,e.nameKey,e.name),l;return n!=null&&(a=n[r])!==null&&a!==void 0&&(a=a.props)!==null&&a!==void 0&&a.fill?l=n[r].props.fill:typeof i=="object"&&i!=null&&"fill"in i?l=i.fill:l=e.fill,{value:$f(s,e.dataKey),color:l,payload:i,type:e.legendType}})}),a_e=He([_H,CC,RC,Ii],(t,e,n,i)=>{if(!(e==null||t==null))return sSe({offset:i,pieSettings:e,displayedData:t,cells:n})}),bE={exports:{}},wn={};var YF;function s_e(){if(YF)return wn;YF=1;var t=Symbol.for("react.transitional.element"),e=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),r=Symbol.for("react.profiler"),a=Symbol.for("react.consumer"),s=Symbol.for("react.context"),l=Symbol.for("react.forward_ref"),c=Symbol.for("react.suspense"),d=Symbol.for("react.suspense_list"),f=Symbol.for("react.memo"),h=Symbol.for("react.lazy"),g=Symbol.for("react.view_transition"),m=Symbol.for("react.client.reference");function b(y){if(typeof y=="object"&&y!==null){var x=y.$$typeof;switch(x){case t:switch(y=y.type,y){case n:case r:case i:case c:case d:case g:return y;default:switch(y=y&&y.$$typeof,y){case s:case l:case h:case f:return y;case a:return y;default:return x}}case e:return x}}}return wn.ContextConsumer=a,wn.ContextProvider=s,wn.Element=t,wn.ForwardRef=l,wn.Fragment=n,wn.Lazy=h,wn.Memo=f,wn.Portal=e,wn.Profiler=r,wn.StrictMode=i,wn.Suspense=c,wn.SuspenseList=d,wn.isContextConsumer=function(y){return b(y)===a},wn.isContextProvider=function(y){return b(y)===s},wn.isElement=function(y){return typeof y=="object"&&y!==null&&y.$$typeof===t},wn.isForwardRef=function(y){return b(y)===l},wn.isFragment=function(y){return b(y)===n},wn.isLazy=function(y){return b(y)===h},wn.isMemo=function(y){return b(y)===f},wn.isPortal=function(y){return b(y)===e},wn.isProfiler=function(y){return b(y)===r},wn.isStrictMode=function(y){return b(y)===i},wn.isSuspense=function(y){return b(y)===c},wn.isSuspenseList=function(y){return b(y)===d},wn.isValidElementType=function(y){return typeof y=="string"||typeof y=="function"||y===n||y===r||y===i||y===c||y===d||typeof y=="object"&&y!==null&&(y.$$typeof===h||y.$$typeof===f||y.$$typeof===s||y.$$typeof===a||y.$$typeof===l||y.$$typeof===m||y.getModuleId!==void 0)},wn.typeOf=b,wn}var KF;function o_e(){return KF||(KF=1,bE.exports=s_e()),bE.exports}var l_e=o_e(),ZF=t=>typeof t=="string"?t:t?t.displayName||t.name||"Component":"",QF=null,_E=null,SH=t=>{if(t===QF&&Array.isArray(_E))return _E;var e=[];return T.Children.forEach(t,n=>{qn(n)||(l_e.isFragment(n)?e=e.concat(SH(n.props.children)):e.push(n))}),_E=e,QF=t,e};function PC(t,e){var n=[],i=[];return Array.isArray(e)?i=e.map(r=>ZF(r)):i=[ZF(e)],SH(t).forEach(r=>{var a=Tu(r,"type.displayName")||Tu(r,"type.name");a&&i.indexOf(a)!==-1&&n.push(r)}),n}var wH=t=>t&&typeof t=="object"&&"clipDot"in t?!!t.clipDot:!0,SE={},JF;function c_e(){return JF||(JF=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});function e(n){if(typeof n!="object"||n==null)return!1;if(Object.getPrototypeOf(n)===null)return!0;if(Object.prototype.toString.call(n)!=="[object Object]"){const r=n[Symbol.toStringTag];return r==null||!Object.getOwnPropertyDescriptor(n,Symbol.toStringTag)?.writable?!1:n.toString()===`[object ${r}]`}let i=n;for(;Object.getPrototypeOf(i)!==null;)i=Object.getPrototypeOf(i);return Object.getPrototypeOf(n)===i}t.isPlainObject=e})(SE)),SE}var wE,e4;function u_e(){return e4||(e4=1,wE=c_e().isPlainObject),wE}var d_e=u_e();const f_e=Xs(d_e);function t4(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),n.push.apply(n,i)}return n}function n4(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?t4(Object(n),!0).forEach(function(i){h_e(t,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):t4(Object(n)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(n,i))})}return t}function h_e(t,e,n){return(e=p_e(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function p_e(t){var e=m_e(t,"string");return typeof e=="symbol"?e:e+""}function m_e(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var i=n.call(t,e);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Yx(){return Yx=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)({}).hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},Yx.apply(null,arguments)}var i4=(t,e,n,i,r)=>{var a=n-i,s;return s="M ".concat(t,",").concat(e),s+="L ".concat(t+n,",").concat(e),s+="L ".concat(t+n-a/2,",").concat(e+r),s+="L ".concat(t+n-a/2-i,",").concat(e+r),s+="L ".concat(t,",").concat(e," Z"),s},g_e={x:0,y:0,upperWidth:0,lowerWidth:0,height:0,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},v_e=t=>{var e=Si(t,g_e),{x:n,y:i,upperWidth:r,lowerWidth:a,height:s,className:l}=e,{animationEasing:c,animationDuration:d,animationBegin:f,isUpdateAnimationActive:h}=e,g=T.useRef(null),[m,b]=T.useState(-1),y=T.useRef(r),x=T.useRef(a),v=T.useRef(s),w=T.useRef(n),S=T.useRef(i),A=Dm(t,"trapezoid-");if(T.useEffect(()=>{if(g.current&&g.current.getTotalLength)try{var I=g.current.getTotalLength();I&&b(I)}catch{}},[]),n!==+n||i!==+i||r!==+r||a!==+a||s!==+s||r===0&&a===0||s===0)return null;var R=dn("recharts-trapezoid",l);if(!h)return T.createElement("g",null,T.createElement("path",Yx({},kr(e),{className:R,d:i4(n,i,r,a,s)})));var N=y.current,C=x.current,F=v.current,P=w.current,L=S.current,B="0px ".concat(m===-1?1:m,"px"),U="".concat(m,"px 0px"),$=$j(["strokeDasharray"],d,c);return T.createElement(Pm,{animationId:A,key:A,canBegin:m>0,duration:d,easing:c,isActive:h,begin:f},I=>{var W=Bn(N,r,I),X=Bn(C,a,I),V=Bn(F,s,I),Y=Bn(P,n,I),J=Bn(L,i,I);g.current&&(y.current=W,x.current=X,v.current=V,w.current=Y,S.current=J);var se=I>0?{transition:$,strokeDasharray:U}:{strokeDasharray:B};return T.createElement("path",Yx({},kr(e),{className:R,d:i4(Y,J,W,X,V),ref:g,style:n4(n4({},se),e.style)}))})},x_e=["option","shapeType","propTransformer","activeClassName"];function y_e(t,e){if(t==null)return{};var n,i,r=b_e(t,e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(i=0;i<a.length;i++)n=a[i],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function b_e(t,e){if(t==null)return{};var n={};for(var i in t)if({}.hasOwnProperty.call(t,i)){if(e.indexOf(i)!==-1)continue;n[i]=t[i]}return n}function r4(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),n.push.apply(n,i)}return n}function Kx(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?r4(Object(n),!0).forEach(function(i){__e(t,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):r4(Object(n)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(n,i))})}return t}function __e(t,e,n){return(e=S_e(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function S_e(t){var e=w_e(t,"string");return typeof e=="symbol"?e:e+""}function w_e(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var i=n.call(t,e);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function E_e(t,e){return Kx(Kx({},e),t)}function M_e(t,e){return t==="symbols"}function a4(t){var{shapeType:e,elementProps:n}=t;switch(e){case"rectangle":return T.createElement(Yj,n);case"trapezoid":return T.createElement(v_e,n);case"sector":return T.createElement(Jj,n);case"symbols":if(M_e(e))return T.createElement(QT,n);break;case"curve":return T.createElement(hf,n);default:return null}}function A_e(t){return T.isValidElement(t)?t.props:t}function EH(t){var{option:e,shapeType:n,propTransformer:i=E_e,activeClassName:r="recharts-active-shape"}=t,a=y_e(t,x_e),s;if(T.isValidElement(e))s=T.cloneElement(e,Kx(Kx({},a),A_e(e)));else if(typeof e=="function")s=e(a,a.index);else if(f_e(e)&&typeof e!="boolean"){var l=i(e,a);s=T.createElement(a4,{shapeType:n,elementProps:l})}else{var c=a;s=T.createElement(a4,{shapeType:n,elementProps:c})}return a.isActive?T.createElement(oi,{className:r},s):s}var DC=(t,e,n)=>{var i=In();return(r,a)=>s=>{t?.(r,a,s),i(L6({activeIndex:String(a),activeDataKey:e,activeCoordinate:r.tooltipPosition,activeGraphicalItemId:n}))}},NC=t=>{var e=In();return(n,i)=>r=>{t?.(n,i,r),e(zve())}},OC=(t,e,n)=>{var i=In();return(r,a)=>s=>{t?.(r,a,s),i(Bve({activeIndex:String(a),activeDataKey:e,activeCoordinate:r.tooltipPosition,activeGraphicalItemId:n}))}};function LC(t){var{tooltipEntrySettings:e}=t,n=In(),i=Ar(),r=T.useRef(null);return T.useLayoutEffect(()=>{i||(r.current===null?n(Ive(e)):r.current!==e&&n(Uve({prev:r.current,next:e})),r.current=e)},[e,n,i]),T.useLayoutEffect(()=>()=>{r.current&&(n(kve(r.current)),r.current=null)},[n]),null}function MH(t){var{legendPayload:e}=t,n=In(),i=Ar(),r=T.useRef(null);return T.useLayoutEffect(()=>{i||(r.current===null?n(Bj(e)):r.current!==e&&n(jj({prev:r.current,next:e})),r.current=e)},[n,i,e]),T.useLayoutEffect(()=>()=>{r.current&&(n(Hj(r.current)),r.current=null)},[n]),null}function T_e(t){var{legendPayload:e}=t,n=In(),i=bt(sn),r=T.useRef(null);return T.useLayoutEffect(()=>{i!=="centric"&&i!=="radial"||(r.current===null?n(Bj(e)):r.current!==e&&n(jj({prev:r.current,next:e})),r.current=e)},[n,i,e]),T.useLayoutEffect(()=>()=>{r.current&&(n(Hj(r.current)),r.current=null)},[n]),null}var EE,C_e=()=>{var[t]=T.useState(()=>Yp("uid-"));return t},R_e=(EE=H9.useId)!==null&&EE!==void 0?EE:C_e;function AH(t,e){var n=R_e();return e||(t?"".concat(t,"-").concat(n):n)}var P_e=T.createContext(void 0),IC=t=>{var{id:e,type:n,children:i}=t,r=AH("recharts-".concat(n),e);return T.createElement(P_e.Provider,{value:r},i(r))},D_e={cartesianItems:[],polarItems:[]},TH=ea({name:"graphicalItems",initialState:D_e,reducers:{addCartesianGraphicalItem:{reducer(t,e){t.cartesianItems.push(e.payload)},prepare:Gn()},replaceCartesianGraphicalItem:{reducer(t,e){var{prev:n,next:i}=e.payload,r=xs(t).cartesianItems.indexOf(n);r>-1&&(t.cartesianItems[r]=i)},prepare:Gn()},removeCartesianGraphicalItem:{reducer(t,e){var n=xs(t).cartesianItems.indexOf(e.payload);n>-1&&t.cartesianItems.splice(n,1)},prepare:Gn()},addPolarGraphicalItem:{reducer(t,e){t.polarItems.push(e.payload)},prepare:Gn()},removePolarGraphicalItem:{reducer(t,e){var n=xs(t).polarItems.indexOf(e.payload);n>-1&&t.polarItems.splice(n,1)},prepare:Gn()}}}),{addCartesianGraphicalItem:N_e,replaceCartesianGraphicalItem:O_e,removeCartesianGraphicalItem:L_e,addPolarGraphicalItem:I_e,removePolarGraphicalItem:U_e}=TH.actions,k_e=TH.reducer,F_e=t=>{var e=In(),n=T.useRef(null);return T.useLayoutEffect(()=>{n.current===null?e(N_e(t)):n.current!==t&&e(O_e({prev:n.current,next:t})),n.current=t},[e,t]),T.useLayoutEffect(()=>()=>{n.current&&(e(L_e(n.current)),n.current=null)},[e]),null},CH=T.memo(F_e);function z_e(t){var e=In();return T.useLayoutEffect(()=>(e(I_e(t)),()=>{e(U_e(t))}),[e,t]),null}var B_e=["key"],j_e=["onMouseEnter","onClick","onMouseLeave"],H_e=["id"],G_e=["id"];function s4(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),n.push.apply(n,i)}return n}function Jn(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?s4(Object(n),!0).forEach(function(i){V_e(t,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):s4(Object(n)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(n,i))})}return t}function V_e(t,e,n){return(e=$_e(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function $_e(t){var e=W_e(t,"string");return typeof e=="symbol"?e:e+""}function W_e(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var i=n.call(t,e);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function mc(){return mc=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)({}).hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},mc.apply(null,arguments)}function ub(t,e){if(t==null)return{};var n,i,r=X_e(t,e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(i=0;i<a.length;i++)n=a[i],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function X_e(t,e){if(t==null)return{};var n={};for(var i in t)if({}.hasOwnProperty.call(t,i)){if(e.indexOf(i)!==-1)continue;n[i]=t[i]}return n}function q_e(t){var e=T.useMemo(()=>PC(t.children,Wm),[t.children]),n=bt(i=>r_e(i,t.id,e));return n==null?null:T.createElement(T_e,{legendPayload:n})}var Y_e=T.memo(t=>{var{dataKey:e,nameKey:n,sectors:i,stroke:r,strokeWidth:a,fill:s,name:l,hide:c,tooltipType:d}=t,f={dataDefinedOnItem:i.map(h=>h.tooltipPayload),positions:i.map(h=>h.tooltipPosition),settings:{stroke:r,strokeWidth:a,fill:s,dataKey:e,nameKey:n,name:$f(l,e),hide:c,type:d,color:s,unit:""}};return T.createElement(LC,{tooltipEntrySettings:f})}),K_e=(t,e)=>t>e?"start":t<e?"end":"middle",Z_e=(t,e,n)=>Er(typeof e=="function"?e(t):e,n,n*.8),Q_e=(t,e,n)=>{var{top:i,left:r,width:a,height:s}=e,l=Kj(a,s),c=r+Er(t.cx,a,a/2),d=i+Er(t.cy,s,s/2),f=Er(t.innerRadius,l,0),h=Z_e(n,t.outerRadius,l),g=t.maxRadius||Math.sqrt(a*a+s*s)/2;return{cx:c,cy:d,innerRadius:f,outerRadius:h,maxRadius:g}},J_e=(t,e)=>{var n=Zi(e-t),i=Math.min(Math.abs(e-t),360);return n*i};function eSe(t){return t&&typeof t=="object"&&"className"in t&&typeof t.className=="string"?t.className:""}var tSe=(t,e)=>{if(T.isValidElement(t))return T.cloneElement(t,e);if(typeof t=="function")return t(e);var n=dn("recharts-pie-label-line",typeof t!="boolean"?t.className:""),{key:i}=e,r=ub(e,B_e);return T.createElement(hf,mc({},r,{type:"linear",className:n}))},nSe=(t,e,n)=>{if(T.isValidElement(t))return T.cloneElement(t,e);var i=n;if(typeof t=="function"&&(i=t(e),T.isValidElement(i)))return i;var r=dn("recharts-pie-label-text",eSe(t));return T.createElement(ob,mc({},e,{alignmentBaseline:"middle",className:r}),i)};function iSe(t){var{sectors:e,props:n,showLabels:i}=t,{label:r,labelLine:a,dataKey:s}=n;if(!i||!r||!e)return null;var l=Jr(n),c=Au(r),d=Au(a),f=typeof r=="object"&&"offsetRadius"in r&&typeof r.offsetRadius=="number"&&r.offsetRadius||20,h=e.map((g,m)=>{var b=(g.startAngle+g.endAngle)/2,y=xi(g.cx,g.cy,g.outerRadius+f,b),x=Jn(Jn(Jn(Jn({},l),g),{},{stroke:"none"},c),{},{index:m,textAnchor:K_e(y.x,g.cx)},y),v=Jn(Jn(Jn(Jn({},l),g),{},{fill:"none",stroke:g.fill},d),{},{index:m,points:[xi(g.cx,g.cy,g.outerRadius,b),y],key:"line"});return T.createElement(ta,{zIndex:yi.label,key:"label-".concat(g.startAngle,"-").concat(g.endAngle,"-").concat(g.midAngle,"-").concat(m)},T.createElement(oi,null,a&&tSe(a,v),nSe(r,x,Dn(g,s))))});return T.createElement(oi,{className:"recharts-pie-labels"},h)}function rSe(t){var{sectors:e,props:n,showLabels:i}=t,{label:r}=n;return typeof r=="object"&&r!=null&&"position"in r?T.createElement(TC,{label:r}):T.createElement(iSe,{sectors:e,props:n,showLabels:i})}function aSe(t){var{sectors:e,activeShape:n,inactiveShape:i,allOtherPieProps:r,shape:a,id:s}=t,l=bt(pc),c=bt(bC),d=bt(Mxe),{onMouseEnter:f,onClick:h,onMouseLeave:g}=r,m=ub(r,j_e),b=DC(f,r.dataKey,s),y=NC(g),x=OC(h,r.dataKey,s);return e==null||e.length===0?null:T.createElement(T.Fragment,null,e.map((v,w)=>{if(v?.startAngle===0&&v?.endAngle===0&&e.length!==1)return null;var S=d==null||d===s,A=String(w)===l&&(c==null||r.dataKey===c)&&S,R=l?i:null,N=n&&A?n:R,C=Jn(Jn({},v),{},{stroke:v.stroke,tabIndex:-1,[Aj]:w,[Tj]:r.dataKey});return T.createElement(oi,mc({key:"sector-".concat(v?.startAngle,"-").concat(v?.endAngle,"-").concat(v.midAngle,"-").concat(w),tabIndex:-1,className:"recharts-pie-sector"},Em(m,v,w),{onMouseEnter:b(v,w),onMouseLeave:y(v,w),onClick:x(v,w)}),T.createElement(EH,mc({option:a??N,index:w,shapeType:"sector",isActive:A},C)))}))}function sSe(t){var e,{pieSettings:n,displayedData:i,cells:r,offset:a}=t,{cornerRadius:s,startAngle:l,endAngle:c,dataKey:d,nameKey:f,tooltipType:h}=n,g=Math.abs(n.minAngle),m=J_e(l,c),b=Math.abs(m),y=i.length<=1?0:(e=n.paddingAngle)!==null&&e!==void 0?e:0,x=i.filter(N=>Dn(N,d,0)!==0).length,v=(b>=360?x:x-1)*y,w=b-x*g-v,S=i.reduce((N,C)=>{var F=Dn(C,d,0);return N+(yt(F)?F:0)},0),A;if(S>0){var R;A=i.map((N,C)=>{var F=Dn(N,d,0),P=Dn(N,f,C),L=Q_e(n,a,N),B=(yt(F)?F:0)/S,U,$=Jn(Jn({},N),r&&r[C]&&r[C].props);C?U=R.endAngle+Zi(m)*y*(F!==0?1:0):U=l;var I=U+Zi(m)*((F!==0?g:0)+B*w),W=(U+I)/2,X=(L.innerRadius+L.outerRadius)/2,V=[{name:P,value:F,payload:$,dataKey:d,type:h}],Y=xi(L.cx,L.cy,X,W);return R=Jn(Jn(Jn(Jn({},n.presentationProps),{},{percent:B,cornerRadius:typeof s=="string"?parseFloat(s):s,name:P,tooltipPayload:V,midAngle:W,middleRadius:X,tooltipPosition:Y},$),L),{},{value:F,dataKey:d,startAngle:U,endAngle:I,payload:$,paddingAngle:Zi(m)*y}),R})}return A}function oSe(t){var{showLabels:e,sectors:n,children:i}=t,r=T.useMemo(()=>!e||!n?[]:n.map(a=>({value:a.value,payload:a.payload,clockWise:!1,parentViewBox:void 0,viewBox:{cx:a.cx,cy:a.cy,innerRadius:a.innerRadius,outerRadius:a.outerRadius,startAngle:a.startAngle,endAngle:a.endAngle,clockWise:!1},fill:a.fill})),[n,e]);return T.createElement(Hbe,{value:e?r:void 0},i)}function lSe(t){var{props:e,previousSectorsRef:n,id:i}=t,{sectors:r,isAnimationActive:a,animationBegin:s,animationDuration:l,animationEasing:c,activeShape:d,inactiveShape:f,onAnimationStart:h,onAnimationEnd:g}=e,m=Dm(e,"recharts-pie-"),b=n.current,[y,x]=T.useState(!1),v=T.useCallback(()=>{typeof g=="function"&&g(),x(!1)},[g]),w=T.useCallback(()=>{typeof h=="function"&&h(),x(!0)},[h]);return T.createElement(oSe,{showLabels:!y,sectors:r},T.createElement(Pm,{animationId:m,begin:s,duration:l,isActive:a,easing:c,onAnimationStart:w,onAnimationEnd:v,key:m},S=>{var A=[],R=r&&r[0],N=R?.startAngle;return r?.forEach((C,F)=>{var P=b&&b[F],L=F>0?Tu(C,"paddingAngle",0):0;if(P){var B=Bn(P.endAngle-P.startAngle,C.endAngle-C.startAngle,S),U=Jn(Jn({},C),{},{startAngle:N+L,endAngle:N+B+L});A.push(U),N=U.endAngle}else{var{endAngle:$,startAngle:I}=C,W=Bn(0,$-I,S),X=Jn(Jn({},C),{},{startAngle:N+L,endAngle:N+W+L});A.push(X),N=X.endAngle}}),n.current=A,T.createElement(oi,null,T.createElement(aSe,{sectors:A,activeShape:d,inactiveShape:f,allOtherPieProps:e,shape:e.shape,id:i}))}),T.createElement(rSe,{showLabels:!y,sectors:r,props:e}),e.children)}var cSe={animationBegin:400,animationDuration:1500,animationEasing:"ease",cx:"50%",cy:"50%",dataKey:"value",endAngle:360,fill:"#808080",hide:!1,innerRadius:0,isAnimationActive:"auto",label:!1,labelLine:!0,legendType:"rect",minAngle:0,nameKey:"name",outerRadius:"80%",paddingAngle:0,rootTabIndex:0,startAngle:0,stroke:"#fff",zIndex:yi.area};function uSe(t){var{id:e}=t,n=ub(t,H_e),{hide:i,className:r,rootTabIndex:a}=t,s=T.useMemo(()=>PC(t.children,Wm),[t.children]),l=bt(f=>a_e(f,e,s)),c=T.useRef(null),d=dn("recharts-pie",r);return i||l==null?(c.current=null,T.createElement(oi,{tabIndex:a,className:d})):T.createElement(ta,{zIndex:t.zIndex},T.createElement(Y_e,{dataKey:t.dataKey,nameKey:t.nameKey,sectors:l,stroke:t.stroke,strokeWidth:t.strokeWidth,fill:t.fill,name:t.name,hide:t.hide,tooltipType:t.tooltipType}),T.createElement(oi,{tabIndex:a,className:d},T.createElement(lSe,{props:Jn(Jn({},n),{},{sectors:l}),previousSectorsRef:c,id:e})))}function RH(t){var e=Si(t,cSe),{id:n}=e,i=ub(e,G_e),r=Jr(i);return T.createElement(IC,{id:n,type:"pie"},a=>T.createElement(T.Fragment,null,T.createElement(z_e,{type:"pie",id:a,data:i.data,dataKey:i.dataKey,hide:i.hide,angleAxisId:0,radiusAxisId:0,name:i.name,nameKey:i.nameKey,tooltipType:i.tooltipType,legendType:i.legendType,fill:i.fill,cx:i.cx,cy:i.cy,startAngle:i.startAngle,endAngle:i.endAngle,paddingAngle:i.paddingAngle,minAngle:i.minAngle,innerRadius:i.innerRadius,outerRadius:i.outerRadius,cornerRadius:i.cornerRadius,presentationProps:r,maxRadius:e.maxRadius}),T.createElement(q_e,mc({},i,{id:a})),T.createElement(uSe,mc({},i,{id:a}))))}RH.displayName="Pie";var dSe=["points"];function o4(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),n.push.apply(n,i)}return n}function ME(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?o4(Object(n),!0).forEach(function(i){fSe(t,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):o4(Object(n)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(n,i))})}return t}function fSe(t,e,n){return(e=hSe(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function hSe(t){var e=pSe(t,"string");return typeof e=="symbol"?e:e+""}function pSe(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var i=n.call(t,e);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Zx(){return Zx=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)({}).hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},Zx.apply(null,arguments)}function mSe(t,e){if(t==null)return{};var n,i,r=gSe(t,e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(i=0;i<a.length;i++)n=a[i],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function gSe(t,e){if(t==null)return{};var n={};for(var i in t)if({}.hasOwnProperty.call(t,i)){if(e.indexOf(i)!==-1)continue;n[i]=t[i]}return n}function vSe(t){var{option:e,dotProps:n,className:i}=t;if(T.isValidElement(e))return T.cloneElement(e,n);if(typeof e=="function")return e(n);var r=dn(i,typeof e!="boolean"?e.className:""),a=n??{},{points:s}=a,l=mSe(a,dSe);return T.createElement(vH,Zx({},l,{className:r}))}function xSe(t,e){return t==null?!1:e?!0:t.length===1}function ySe(t){var{points:e,dot:n,className:i,dotClassName:r,dataKey:a,baseProps:s,needClip:l,clipPathId:c,zIndex:d=yi.scatter}=t;if(!xSe(e,n))return null;var f=wH(n),h=Vle(n),g=e.map((b,y)=>{var x,v,w=ME(ME(ME({r:3},s),h),{},{index:y,cx:(x=b.x)!==null&&x!==void 0?x:void 0,cy:(v=b.y)!==null&&v!==void 0?v:void 0,dataKey:a,value:b.value,payload:b.payload,points:e});return T.createElement(vSe,{key:"dot-".concat(y),option:n,dotProps:w,className:r})}),m={};return l&&c!=null&&(m.clipPath="url(#clipPath-".concat(f?"":"dots-").concat(c,")")),T.createElement(ta,{zIndex:d},T.createElement(oi,Zx({className:i},m),g))}function l4(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),n.push.apply(n,i)}return n}function c4(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?l4(Object(n),!0).forEach(function(i){bSe(t,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):l4(Object(n)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(n,i))})}return t}function bSe(t,e,n){return(e=_Se(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function _Se(t){var e=SSe(t,"string");return typeof e=="symbol"?e:e+""}function SSe(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var i=n.call(t,e);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var wSe={xAxis:{},yAxis:{},zAxis:{}},PH=ea({name:"cartesianAxis",initialState:wSe,reducers:{addXAxis:{reducer(t,e){t.xAxis[e.payload.id]=e.payload},prepare:Gn()},replaceXAxis:{reducer(t,e){var{prev:n,next:i}=e.payload;t.xAxis[n.id]!==void 0&&(n.id!==i.id&&delete t.xAxis[n.id],t.xAxis[i.id]=i)},prepare:Gn()},removeXAxis:{reducer(t,e){delete t.xAxis[e.payload.id]},prepare:Gn()},addYAxis:{reducer(t,e){t.yAxis[e.payload.id]=e.payload},prepare:Gn()},replaceYAxis:{reducer(t,e){var{prev:n,next:i}=e.payload;t.yAxis[n.id]!==void 0&&(n.id!==i.id&&delete t.yAxis[n.id],t.yAxis[i.id]=i)},prepare:Gn()},removeYAxis:{reducer(t,e){delete t.yAxis[e.payload.id]},prepare:Gn()},addZAxis:{reducer(t,e){t.zAxis[e.payload.id]=e.payload},prepare:Gn()},replaceZAxis:{reducer(t,e){var{prev:n,next:i}=e.payload;t.zAxis[n.id]!==void 0&&(n.id!==i.id&&delete t.zAxis[n.id],t.zAxis[i.id]=i)},prepare:Gn()},removeZAxis:{reducer(t,e){delete t.zAxis[e.payload.id]},prepare:Gn()},updateYAxisWidth(t,e){var{id:n,width:i}=e.payload,r=t.yAxis[n];if(r){var a=r.widthHistory||[];if(a.length===3&&a[0]===a[2]&&i===a[1]&&i!==r.width&&Math.abs(i-a[0])<=1)return;var s=[...a,i].slice(-3);t.yAxis[n]=c4(c4({},t.yAxis[n]),{},{width:i,widthHistory:s})}}}}),{addXAxis:ESe,replaceXAxis:MSe,removeXAxis:ASe,addYAxis:TSe,replaceYAxis:CSe,removeYAxis:RSe,addZAxis:uCe,replaceZAxis:dCe,removeZAxis:fCe,updateYAxisWidth:PSe}=PH.actions,DSe=PH.reducer,NSe=He([Ii],t=>({top:t.top,bottom:t.bottom,left:t.left,right:t.right})),OSe=He([NSe,tl,nl],(t,e,n)=>{if(!(!t||e==null||n==null))return{x:t.left,y:t.top,width:Math.max(0,e-t.left-t.right),height:Math.max(0,n-t.top-t.bottom)}}),UC=()=>bt(OSe),LSe=()=>bt(Pxe);function u4(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),n.push.apply(n,i)}return n}function AE(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?u4(Object(n),!0).forEach(function(i){ISe(t,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):u4(Object(n)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(n,i))})}return t}function ISe(t,e,n){return(e=USe(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function USe(t){var e=kSe(t,"string");return typeof e=="symbol"?e:e+""}function kSe(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var i=n.call(t,e);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var FSe=t=>{var{point:e,childIndex:n,mainColor:i,activeDot:r,dataKey:a,clipPath:s}=t;if(r===!1||e.x==null||e.y==null)return null;var l={index:n,dataKey:a,cx:e.x,cy:e.y,r:4,fill:i??"none",strokeWidth:2,stroke:"#fff",payload:e.payload,value:e.value},c=AE(AE(AE({},l),Au(r)),JT(r)),d;return T.isValidElement(r)?d=T.cloneElement(r,c):typeof r=="function"?d=r(c):d=T.createElement(vH,c),T.createElement(oi,{className:"recharts-active-dot",clipPath:s},d)};function d4(t){var{points:e,mainColor:n,activeDot:i,itemDataKey:r,clipPath:a,zIndex:s=yi.activeDot}=t,l=bt(pc),c=LSe();if(e==null||c==null)return null;var d=e.find(f=>c.includes(f.payload));return qn(d)?null:T.createElement(ta,{zIndex:s},T.createElement(FSe,{point:d,childIndex:Number(l),mainColor:n,dataKey:r,activeDot:i,clipPath:a}))}var zSe="Invariant failed";function BSe(t,e){throw new Error(zSe)}var jSe=["x","y"];function HA(){return HA=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)({}).hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},HA.apply(null,arguments)}function f4(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),n.push.apply(n,i)}return n}function vp(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?f4(Object(n),!0).forEach(function(i){HSe(t,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):f4(Object(n)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(n,i))})}return t}function HSe(t,e,n){return(e=GSe(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function GSe(t){var e=VSe(t,"string");return typeof e=="symbol"?e:e+""}function VSe(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var i=n.call(t,e);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function $Se(t,e){if(t==null)return{};var n,i,r=WSe(t,e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(i=0;i<a.length;i++)n=a[i],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function WSe(t,e){if(t==null)return{};var n={};for(var i in t)if({}.hasOwnProperty.call(t,i)){if(e.indexOf(i)!==-1)continue;n[i]=t[i]}return n}function XSe(t,e){var{x:n,y:i}=t,r=$Se(t,jSe),a="".concat(n),s=parseInt(a,10),l="".concat(i),c=parseInt(l,10),d="".concat(e.height||r.height),f=parseInt(d,10),h="".concat(e.width||r.width),g=parseInt(h,10);return vp(vp(vp(vp(vp({},e),r),s?{x:s}:{}),c?{y:c}:{}),{},{height:f,width:g,name:e.name,radius:e.radius})}function Qx(t){return T.createElement(EH,HA({shapeType:"rectangle",propTransformer:XSe,activeClassName:"recharts-active-bar"},t))}var qSe=function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return(i,r)=>{if(yt(e))return e;var a=yt(i)||qn(i);return a?e(i,r):(a||BSe(),n)}},YSe={},DH=ea({name:"errorBars",initialState:YSe,reducers:{addErrorBar:(t,e)=>{var{itemId:n,errorBar:i}=e.payload;t[n]||(t[n]=[]),t[n].push(i)},replaceErrorBar:(t,e)=>{var{itemId:n,prev:i,next:r}=e.payload;t[n]&&(t[n]=t[n].map(a=>a.dataKey===i.dataKey&&a.direction===i.direction?r:a))},removeErrorBar:(t,e)=>{var{itemId:n,errorBar:i}=e.payload;t[n]&&(t[n]=t[n].filter(r=>r.dataKey!==i.dataKey||r.direction!==i.direction))}}}),{addErrorBar:hCe,replaceErrorBar:pCe,removeErrorBar:mCe}=DH.actions,KSe=DH.reducer,ZSe=["children"];function QSe(t,e){if(t==null)return{};var n,i,r=JSe(t,e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(i=0;i<a.length;i++)n=a[i],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function JSe(t,e){if(t==null)return{};var n={};for(var i in t)if({}.hasOwnProperty.call(t,i)){if(e.indexOf(i)!==-1)continue;n[i]=t[i]}return n}var e1e={data:[],xAxisId:"xAxis-0",yAxisId:"yAxis-0",dataPointFormatter:()=>({x:0,y:0,value:0}),errorBarOffset:0},t1e=T.createContext(e1e);function n1e(t){var{children:e}=t,n=QSe(t,ZSe);return T.createElement(t1e.Provider,{value:n},e)}function kC(t,e){var n,i,r=bt(d=>rl(d,t)),a=bt(d=>al(d,e)),s=(n=r?.allowDataOverflow)!==null&&n!==void 0?n:Wi.allowDataOverflow,l=(i=a?.allowDataOverflow)!==null&&i!==void 0?i:Xi.allowDataOverflow,c=s||l;return{needClip:c,needClipX:s,needClipY:l}}function NH(t){var{xAxisId:e,yAxisId:n,clipPathId:i}=t,r=UC(),{needClipX:a,needClipY:s,needClip:l}=kC(e,n);if(!l||!r)return null;var{x:c,y:d,width:f,height:h}=r;return T.createElement("clipPath",{id:"clipPath-".concat(i)},T.createElement("rect",{x:a?c:c-f/2,y:s?d:d-h/2,width:a?f:f*2,height:s?h:h*2}))}function i1e(t,e){return t&&typeof t=="object"&&"zIndex"in t&&typeof t.zIndex=="number"&&jn(t.zIndex)?t.zIndex:e}var TE={exports:{}},CE={};var h4;function r1e(){if(h4)return CE;h4=1;var t=If();function e(c,d){return c===d&&(c!==0||1/c===1/d)||c!==c&&d!==d}var n=typeof Object.is=="function"?Object.is:e,i=t.useSyncExternalStore,r=t.useRef,a=t.useEffect,s=t.useMemo,l=t.useDebugValue;return CE.useSyncExternalStoreWithSelector=function(c,d,f,h,g){var m=r(null);if(m.current===null){var b={hasValue:!1,value:null};m.current=b}else b=m.current;m=s(function(){function x(R){if(!v){if(v=!0,w=R,R=h(R),g!==void 0&&b.hasValue){var N=b.value;if(g(N,R))return S=N}return S=R}if(N=S,n(w,R))return N;var C=h(R);return g!==void 0&&g(N,C)?(w=R,N):(w=R,S=C)}var v=!1,w,S,A=f===void 0?null:f;return[function(){return x(d())},A===null?void 0:function(){return x(A())}]},[d,f,h,g]);var y=i(c,m[0],m[1]);return a(function(){b.hasValue=!0,b.value=y},[y]),l(y),y},CE}var p4;function a1e(){return p4||(p4=1,TE.exports=r1e()),TE.exports}a1e();function s1e(t){t()}function o1e(){let t=null,e=null;return{clear(){t=null,e=null},notify(){s1e(()=>{let n=t;for(;n;)n.callback(),n=n.next})},get(){const n=[];let i=t;for(;i;)n.push(i),i=i.next;return n},subscribe(n){let i=!0;const r=e={callback:n,next:null,prev:e};return r.prev?r.prev.next=r:t=r,function(){!i||t===null||(i=!1,r.next?r.next.prev=r.prev:e=r.prev,r.prev?r.prev.next=r.next:t=r.next)}}}}var m4={notify(){},get:()=>[]};function l1e(t,e){let n,i=m4,r=0,a=!1;function s(y){f();const x=i.subscribe(y);let v=!1;return()=>{v||(v=!0,x(),h())}}function l(){i.notify()}function c(){b.onStateChange&&b.onStateChange()}function d(){return a}function f(){r++,n||(n=t.subscribe(c),i=o1e())}function h(){r--,n&&r===0&&(n(),n=void 0,i.clear(),i=m4)}function g(){a||(a=!0,f())}function m(){a&&(a=!1,h())}const b={addNestedSub:s,notifyNestedSubs:l,handleChangeWrapper:c,isSubscribed:d,trySubscribe:g,tryUnsubscribe:m,getListeners:()=>i};return b}var c1e=()=>typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",u1e=c1e(),d1e=()=>typeof navigator<"u"&&navigator.product==="ReactNative",f1e=d1e(),h1e=()=>u1e||f1e?T.useLayoutEffect:T.useEffect,p1e=h1e();function g4(t,e){return t===e?t!==0||e!==0||1/t===1/e:t!==t&&e!==e}function m1e(t,e){if(g4(t,e))return!0;if(typeof t!="object"||t===null||typeof e!="object"||e===null)return!1;const n=Object.keys(t),i=Object.keys(e);if(n.length!==i.length)return!1;for(let r=0;r<n.length;r++)if(!Object.prototype.hasOwnProperty.call(e,n[r])||!g4(t[n[r]],e[n[r]]))return!1;return!0}var g1e=Symbol.for("react-redux-context"),v1e=typeof globalThis<"u"?globalThis:{};function x1e(){if(!T.createContext)return{};const t=v1e[g1e]??=new Map;let e=t.get(T.createContext);return e||(e=T.createContext(null),t.set(T.createContext,e)),e}var y1e=x1e();function b1e(t){const{children:e,context:n,serverState:i,store:r}=t,a=T.useMemo(()=>{const c=l1e(r);return{store:r,subscription:c,getServerState:i?()=>i:void 0}},[r,i]),s=T.useMemo(()=>r.getState(),[r]);p1e(()=>{const{subscription:c}=a;return c.onStateChange=c.notifyNestedSubs,c.trySubscribe(),s!==r.getState()&&c.notifyNestedSubs(),()=>{c.tryUnsubscribe(),c.onStateChange=void 0}},[a,s]);const l=n||y1e;return T.createElement(l.Provider,{value:a},e)}var _1e=b1e,S1e=new Set(["axisLine","tickLine","activeBar","activeDot","activeLabel","activeShape","allowEscapeViewBox","background","cursor","dot","label","line","margin","padding","position","shape","style","tick","wrapperStyle"]);function w1e(t,e){return t==null&&e==null?!0:typeof t=="number"&&typeof e=="number"?t===e||t!==t&&e!==e:t===e}function db(t,e){var n=new Set([...Object.keys(t),...Object.keys(e)]);for(var i of n)if(S1e.has(i)){if(t[i]==null&&e[i]==null)continue;if(!m1e(t[i],e[i]))return!1}else if(!w1e(t[i],e[i]))return!1;return!0}var E1e=["onMouseEnter","onMouseLeave","onClick"],M1e=["value","background","tooltipPosition"],A1e=["id"],T1e=["onMouseEnter","onClick","onMouseLeave"];function Jo(){return Jo=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)({}).hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},Jo.apply(null,arguments)}function v4(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),n.push.apply(n,i)}return n}function Lr(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?v4(Object(n),!0).forEach(function(i){C1e(t,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):v4(Object(n)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(n,i))})}return t}function C1e(t,e,n){return(e=R1e(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function R1e(t){var e=P1e(t,"string");return typeof e=="symbol"?e:e+""}function P1e(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var i=n.call(t,e);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Jx(t,e){if(t==null)return{};var n,i,r=D1e(t,e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(i=0;i<a.length;i++)n=a[i],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function D1e(t,e){if(t==null)return{};var n={};for(var i in t)if({}.hasOwnProperty.call(t,i)){if(e.indexOf(i)!==-1)continue;n[i]=t[i]}return n}var N1e=t=>{var{dataKey:e,name:n,fill:i,legendType:r,hide:a}=t;return[{inactive:a,dataKey:e,type:r,color:i,value:$f(n,e),payload:t}]},O1e=T.memo(t=>{var{dataKey:e,stroke:n,strokeWidth:i,fill:r,name:a,hide:s,unit:l,tooltipType:c}=t,d={dataDefinedOnItem:void 0,positions:void 0,settings:{stroke:n,strokeWidth:i,fill:r,dataKey:e,nameKey:void 0,name:$f(a,e),hide:s,type:c,color:r,unit:l}};return T.createElement(LC,{tooltipEntrySettings:d})});function L1e(t){var e=bt(pc),{data:n,dataKey:i,background:r,allOtherBarProps:a}=t,{onMouseEnter:s,onMouseLeave:l,onClick:c}=a,d=Jx(a,E1e),f=DC(s,i),h=NC(l),g=OC(c,i);if(!r||n==null)return null;var m=Au(r);return T.createElement(ta,{zIndex:i1e(r,yi.barBackground)},n.map((b,y)=>{var{value:x,background:v,tooltipPosition:w}=b,S=Jx(b,M1e);if(!v)return null;var A=f(b,y),R=h(b,y),N=g(b,y),C=Lr(Lr(Lr(Lr(Lr({option:r,isActive:String(y)===e},S),{},{fill:"#eee"},v),m),Em(d,b,y)),{},{onMouseEnter:A,onMouseLeave:R,onClick:N,dataKey:i,index:y,className:"recharts-bar-background-rectangle"});return T.createElement(Qx,Jo({key:"background-bar-".concat(y)},C))}))}function I1e(t){var{showLabels:e,children:n,rects:i}=t,r=i?.map(a=>{var s={x:a.x,y:a.y,width:a.width,lowerWidth:a.width,upperWidth:a.width,height:a.height};return Lr(Lr({},s),{},{value:a.value,payload:a.payload,parentViewBox:a.parentViewBox,viewBox:s,fill:a.fill})});return T.createElement(mH,{value:e?r:void 0},n)}function U1e(t){var{shape:e,activeBar:n,baseProps:i,entry:r,index:a,dataKey:s}=t,l=bt(pc),c=bt(bC),d=n&&String(a)===l&&(c==null||s===c),f=d?n:e;return d?T.createElement(ta,{zIndex:yi.activeBar},T.createElement(Qx,Jo({},i,{name:String(i.name)},r,{isActive:d,option:f,index:a,dataKey:s}))):T.createElement(Qx,Jo({},i,{name:String(i.name)},r,{isActive:d,option:f,index:a,dataKey:s}))}function k1e(t){var{shape:e,baseProps:n,entry:i,index:r,dataKey:a}=t;return T.createElement(Qx,Jo({},n,{name:String(n.name)},i,{isActive:!1,option:e,index:r,dataKey:a}))}function F1e(t){var e,{data:n,props:i}=t,r=(e=Jr(i))!==null&&e!==void 0?e:{},{id:a}=r,s=Jx(r,A1e),{shape:l,dataKey:c,activeBar:d}=i,{onMouseEnter:f,onClick:h,onMouseLeave:g}=i,m=Jx(i,T1e),b=DC(f,c),y=NC(g),x=OC(h,c);return n?T.createElement(T.Fragment,null,n.map((v,w)=>T.createElement(oi,Jo({key:"rectangle-".concat(v?.x,"-").concat(v?.y,"-").concat(v?.value,"-").concat(w),className:"recharts-bar-rectangle"},Em(m,v,w),{onMouseEnter:b(v,w),onMouseLeave:y(v,w),onClick:x(v,w)}),d?T.createElement(U1e,{shape:l,activeBar:d,baseProps:s,entry:v,index:w,dataKey:c}):T.createElement(k1e,{shape:l,baseProps:s,entry:v,index:w,dataKey:c})))):null}function z1e(t){var{props:e,previousRectanglesRef:n}=t,{data:i,layout:r,isAnimationActive:a,animationBegin:s,animationDuration:l,animationEasing:c,onAnimationEnd:d,onAnimationStart:f}=e,h=n.current,g=Dm(e,"recharts-bar-"),[m,b]=T.useState(!1),y=!m,x=T.useCallback(()=>{typeof d=="function"&&d(),b(!1)},[d]),v=T.useCallback(()=>{typeof f=="function"&&f(),b(!0)},[f]);return T.createElement(I1e,{showLabels:y,rects:i},T.createElement(Pm,{animationId:g,begin:s,duration:l,isActive:a,easing:c,onAnimationEnd:x,onAnimationStart:v,key:g},w=>{var S=w===1?i:i?.map((A,R)=>{var N=h&&h[R];if(N)return Lr(Lr({},A),{},{x:Bn(N.x,A.x,w),y:Bn(N.y,A.y,w),width:Bn(N.width,A.width,w),height:Bn(N.height,A.height,w)});if(r==="horizontal"){var C=Bn(0,A.height,w),F=Bn(A.stackedBarStart,A.y,w);return Lr(Lr({},A),{},{y:F,height:C})}var P=Bn(0,A.width,w),L=Bn(A.stackedBarStart,A.x,w);return Lr(Lr({},A),{},{width:P,x:L})});return w>0&&(n.current=S??null),S==null?null:T.createElement(oi,null,T.createElement(F1e,{props:e,data:S}))}),T.createElement(TC,{label:e.label}),e.children)}function B1e(t){var e=T.useRef(null);return T.createElement(z1e,{previousRectanglesRef:e,props:t})}var OH=0,j1e=(t,e)=>{var n=Array.isArray(t.value)?t.value[1]:t.value;return{x:t.x,y:t.y,value:n,errorVal:Dn(t,e)}};class H1e extends T.PureComponent{render(){var{hide:e,data:n,dataKey:i,className:r,xAxisId:a,yAxisId:s,needClip:l,background:c,id:d}=this.props;if(e||n==null)return null;var f=dn("recharts-bar",r),h=d;return T.createElement(oi,{className:f,id:d},l&&T.createElement("defs",null,T.createElement(NH,{clipPathId:h,xAxisId:a,yAxisId:s})),T.createElement(oi,{className:"recharts-bar-rectangles",clipPath:l?"url(#clipPath-".concat(h,")"):void 0},T.createElement(L1e,{data:n,dataKey:i,background:c,allOtherBarProps:this.props}),T.createElement(B1e,this.props)))}}var G1e={activeBar:!1,animationBegin:0,animationDuration:400,animationEasing:"ease",background:!1,hide:!1,isAnimationActive:"auto",label:!1,legendType:"rect",minPointSize:OH,xAxisId:0,yAxisId:0,zIndex:yi.bar};function V1e(t){var{xAxisId:e,yAxisId:n,hide:i,legendType:r,minPointSize:a,activeBar:s,animationBegin:l,animationDuration:c,animationEasing:d,isAnimationActive:f}=t,{needClip:h}=kC(e,n),g=Wf(),m=Ar(),b=PC(t.children,Wm),y=bt(w=>xwe(w,e,n,m,t.id,b));if(g!=="vertical"&&g!=="horizontal")return null;var x,v=y?.[0];return v==null||v.height==null||v.width==null?x=0:x=g==="vertical"?v.height/2:v.width/2,T.createElement(n1e,{xAxisId:e,yAxisId:n,data:y,dataPointFormatter:j1e,errorBarOffset:x},T.createElement(H1e,Jo({},t,{layout:g,needClip:h,data:y,xAxisId:e,yAxisId:n,hide:i,legendType:r,minPointSize:a,activeBar:s,animationBegin:l,animationDuration:c,animationEasing:d,isAnimationActive:f})))}function $1e(t){var{layout:e,barSettings:{dataKey:n,minPointSize:i},pos:r,bandSize:a,xAxis:s,yAxis:l,xAxisTicks:c,yAxisTicks:d,stackedData:f,displayedData:h,offset:g,cells:m,parentViewBox:b,dataStartIndex:y}=t,x=e==="horizontal"?l:s,v=f?x.scale.domain():null,w=ufe({numericAxis:x}),S=x.scale(w);return h.map((A,R)=>{var N,C,F,P,L,B;f?N=afe(f[R+y],v):(N=Dn(A,n),Array.isArray(N)||(N=[w,N]));var U=qSe(i,OH)(N[1],R);if(e==="horizontal"){var $,[I,W]=[l.scale(N[0]),l.scale(N[1])];C=OU({axis:s,ticks:c,bandSize:a,offset:r.offset,entry:A,index:R}),F=($=W??I)!==null&&$!==void 0?$:void 0,P=r.size;var X=I-W;if(L=Ya(X)?0:X,B={x:C,y:g.top,width:P,height:g.height},Math.abs(U)>0&&Math.abs(L)<Math.abs(U)){var V=Zi(L||U)*(Math.abs(U)-Math.abs(L));F-=V,L+=V}}else{var[Y,J]=[s.scale(N[0]),s.scale(N[1])];if(C=Y,F=OU({axis:l,ticks:d,bandSize:a,offset:r.offset,entry:A,index:R}),P=J-Y,L=r.size,B={x:g.left,y:F,width:g.width,height:L},Math.abs(U)>0&&Math.abs(P)<Math.abs(U)){var se=Zi(P||U)*(Math.abs(U)-Math.abs(P));P+=se}}if(C==null||F==null||P==null||L==null)return null;var H=Lr(Lr({},A),{},{stackedBarStart:S,x:C,y:F,width:P,height:L,value:f?N:N[1],payload:A,background:B,tooltipPosition:{x:C+P/2,y:F+L/2},parentViewBox:b},m&&m[R]&&m[R].props);return H}).filter(Boolean)}function W1e(t){var e=Si(t,G1e),n=Ar();return T.createElement(IC,{id:e.id,type:"bar"},i=>T.createElement(T.Fragment,null,T.createElement(MH,{legendPayload:N1e(e)}),T.createElement(O1e,{dataKey:e.dataKey,stroke:e.stroke,strokeWidth:e.strokeWidth,fill:e.fill,name:e.name,hide:e.hide,unit:e.unit,tooltipType:e.tooltipType}),T.createElement(CH,{type:"bar",id:i,data:void 0,xAxisId:e.xAxisId,yAxisId:e.yAxisId,zAxisId:0,dataKey:e.dataKey,stackId:Ej(e.stackId),hide:e.hide,barSize:e.barSize,minPointSize:e.minPointSize,maxBarSize:e.maxBarSize,isPanorama:n}),T.createElement(ta,{zIndex:e.zIndex},T.createElement(V1e,Jo({},e,{id:i})))))}var LH=T.memo(W1e,db);LH.displayName="Bar";function x4(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),n.push.apply(n,i)}return n}function Ev(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?x4(Object(n),!0).forEach(function(i){X1e(t,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):x4(Object(n)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(n,i))})}return t}function X1e(t,e,n){return(e=q1e(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function q1e(t){var e=Y1e(t,"string");return typeof e=="symbol"?e:e+""}function Y1e(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var i=n.call(t,e);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var K1e=(t,e)=>e,Z1e=(t,e,n)=>n,Q1e=(t,e,n,i)=>i,J1e=(t,e,n,i,r)=>r,Xm=He([nb,J1e],(t,e)=>t.filter(n=>n.type==="bar").find(n=>n.id===e)),ewe=He([Xm],t=>t?.maxBarSize),twe=(t,e,n,i,r,a)=>a,y4=(t,e,n)=>{var i=n??t;if(!qn(i))return Er(i,e,0)},nwe=He([sn,nb,K1e,Z1e,Q1e],(t,e,n,i,r)=>e.filter(a=>t==="horizontal"?a.xAxisId===n:a.yAxisId===i).filter(a=>a.isPanorama===r).filter(a=>a.hide===!1).filter(a=>a.type==="bar")),iwe=(t,e,n,i)=>{var r=sn(t);return r==="horizontal"?lm(t,"yAxis",n,i):lm(t,"xAxis",e,i)},rwe=(t,e,n)=>{var i=sn(t);return i==="horizontal"?fF(t,"xAxis",e):fF(t,"yAxis",n)},awe=(t,e,n)=>{var i={},r=t.filter(Jy),a=t.filter(d=>d.stackId==null),s=r.reduce((d,f)=>(d[f.stackId]||(d[f.stackId]=[]),d[f.stackId].push(f),d),i),l=Object.entries(s).map(d=>{var[f,h]=d,g=h.map(b=>b.dataKey),m=y4(e,n,h[0].barSize);return{stackId:f,dataKeys:g,barSize:m}}),c=a.map(d=>{var f=[d.dataKey].filter(g=>g!=null),h=y4(e,n,d.barSize);return{stackId:void 0,dataKeys:f,barSize:h}});return[...l,...c]},swe=He([nwe,T0e,rwe],awe),owe=(t,e,n,i,r)=>{var a,s,l=Xm(t,e,n,i,r);if(l!=null){var c=sn(t),d=Y8(t),{maxBarSize:f}=l,h=qn(f)?d:f,g,m;return c==="horizontal"?(g=hc(t,"xAxis",e,i),m=fc(t,"xAxis",e,i)):(g=hc(t,"yAxis",n,i),m=fc(t,"yAxis",n,i)),(a=(s=Rf(g,m,!0))!==null&&s!==void 0?s:h)!==null&&a!==void 0?a:0}},IH=(t,e,n,i)=>{var r=sn(t),a,s;return r==="horizontal"?(a=hc(t,"xAxis",e,i),s=fc(t,"xAxis",e,i)):(a=hc(t,"yAxis",n,i),s=fc(t,"yAxis",n,i)),Rf(a,s)};function lwe(t,e,n,i,r){var a=i.length;if(!(a<1)){var s=Er(t,n,0,!0),l,c=[];if(jn(i[0].barSize)){var d=!1,f=n/a,h=i.reduce((v,w)=>v+(w.barSize||0),0);h+=(a-1)*s,h>=n&&(h-=(a-1)*s,s=0),h>=n&&f>0&&(d=!0,f*=.9,h=a*f);var g=(n-h)/2>>0,m={offset:g-s,size:0};l=i.reduce((v,w)=>{var S,A={stackId:w.stackId,dataKeys:w.dataKeys,position:{offset:m.offset+m.size+s,size:d?f:(S=w.barSize)!==null&&S!==void 0?S:0}},R=[...v,A];return m=R[R.length-1].position,R},c)}else{var b=Er(e,n,0,!0);n-2*b-(a-1)*s<=0&&(s=0);var y=(n-2*b-(a-1)*s)/a;y>1&&(y>>=0);var x=jn(r)?Math.min(y,r):y;l=i.reduce((v,w,S)=>[...v,{stackId:w.stackId,dataKeys:w.dataKeys,position:{offset:b+(y+s)*S+(y-x)/2,size:x}}],c)}return l}}var cwe=(t,e,n,i,r,a,s)=>{var l=qn(s)?e:s,c=lwe(n,i,r!==a?r:a,t,l);return r!==a&&c!=null&&(c=c.map(d=>Ev(Ev({},d),{},{position:Ev(Ev({},d.position),{},{offset:d.position.offset-r/2})}))),c},uwe=He([swe,Y8,A0e,K8,owe,IH,ewe],cwe),dwe=(t,e,n,i)=>hc(t,"xAxis",e,i),fwe=(t,e,n,i)=>hc(t,"yAxis",n,i),hwe=(t,e,n,i)=>fc(t,"xAxis",e,i),pwe=(t,e,n,i)=>fc(t,"yAxis",n,i),mwe=He([uwe,Xm],(t,e)=>{if(!(t==null||e==null)){var n=t.find(i=>i.stackId===e.stackId&&e.dataKey!=null&&i.dataKeys.includes(e.dataKey));if(n!=null)return n.position}}),gwe=(t,e)=>{var n=Qy(e);if(!(!t||n==null||e==null)){var{stackId:i}=e;if(i!=null){var r=t[i];if(r){var{stackedData:a}=r;if(a)return a.find(s=>s.key===n)}}}},vwe=He([iwe,Xm],gwe),xwe=He([Ii,u2,dwe,fwe,hwe,pwe,mwe,sn,Yy,IH,vwe,Xm,twe],(t,e,n,i,r,a,s,l,c,d,f,h,g)=>{var{chartData:m,dataStartIndex:b,dataEndIndex:y}=c;if(!(h==null||s==null||e==null||l!=="horizontal"&&l!=="vertical"||n==null||i==null||r==null||a==null||d==null)){var{data:x}=h,v;if(x!=null&&x.length>0?v=x:v=m?.slice(b,y+1),v!=null)return $1e({layout:l,barSettings:h,pos:s,parentViewBox:e,bandSize:d,xAxis:n,yAxis:i,xAxisTicks:r,yAxisTicks:a,stackedData:f,displayedData:v,offset:t,cells:g,dataStartIndex:b})}}),UH=t=>{var{chartData:e}=t,n=In(),i=Ar();return T.useEffect(()=>i?()=>{}:(n(MF(e)),()=>{n(MF(void 0))}),[e,n,i]),null},b4={x:0,y:0,width:0,height:0,padding:{top:0,right:0,bottom:0,left:0}},kH=ea({name:"brush",initialState:b4,reducers:{setBrushSettings(t,e){return e.payload==null?b4:e.payload}}}),{setBrushSettings:gCe}=kH.actions,ywe=kH.reducer;function bwe(t,e,n){return(e=_we(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function _we(t){var e=Swe(t,"string");return typeof e=="symbol"?e:e+""}function Swe(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var i=n.call(t,e);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}class FC{static create(e){return new FC(e)}constructor(e){this.scale=e}get domain(){return this.scale.domain}get range(){return this.scale.range}get rangeMin(){return this.range()[0]}get rangeMax(){return this.range()[1]}get bandwidth(){return this.scale.bandwidth}apply(e){var{bandAware:n,position:i}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(e!==void 0){if(i)switch(i){case"start":return this.scale(e);case"middle":{var r=this.bandwidth?this.bandwidth()/2:0;return this.scale(e)+r}case"end":{var a=this.bandwidth?this.bandwidth():0;return this.scale(e)+a}default:return this.scale(e)}if(n){var s=this.bandwidth?this.bandwidth()/2:0;return this.scale(e)+s}return this.scale(e)}}isInRange(e){var n=this.range(),i=n[0],r=n[n.length-1];return i<=r?e>=i&&e<=r:e>=r&&e<=i}}bwe(FC,"EPS",1e-4);function wwe(t){return(t%180+180)%180}var Ewe=function(e){var{width:n,height:i}=e,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a=wwe(r),s=a*Math.PI/180,l=Math.atan(i/n),c=s>l&&s<Math.PI-l?i/Math.sin(s):n/Math.cos(s);return Math.abs(c)},Mwe={dots:[],areas:[],lines:[]},FH=ea({name:"referenceElements",initialState:Mwe,reducers:{addDot:(t,e)=>{t.dots.push(e.payload)},removeDot:(t,e)=>{var n=xs(t).dots.findIndex(i=>i===e.payload);n!==-1&&t.dots.splice(n,1)},addArea:(t,e)=>{t.areas.push(e.payload)},removeArea:(t,e)=>{var n=xs(t).areas.findIndex(i=>i===e.payload);n!==-1&&t.areas.splice(n,1)},addLine:(t,e)=>{t.lines.push(e.payload)},removeLine:(t,e)=>{var n=xs(t).lines.findIndex(i=>i===e.payload);n!==-1&&t.lines.splice(n,1)}}}),{addDot:vCe,removeDot:xCe,addArea:yCe,removeArea:bCe,addLine:_Ce,removeLine:SCe}=FH.actions,Awe=FH.reducer,Twe=T.createContext(void 0),Cwe=t=>{var{children:e}=t,[n]=T.useState("".concat(Yp("recharts"),"-clip")),i=UC();if(i==null)return null;var{x:r,y:a,width:s,height:l}=i;return T.createElement(Twe.Provider,{value:n},T.createElement("defs",null,T.createElement("clipPath",{id:n},T.createElement("rect",{x:r,y:a,height:l,width:s}))),e)};function zH(t,e){if(e<1)return[];if(e===1)return t;for(var n=[],i=0;i<t.length;i+=e)n.push(t[i]);return n}function Rwe(t,e,n){var i={width:t.width+e.width,height:t.height+e.height};return Ewe(i,n)}function Pwe(t,e,n){var i=n==="width",{x:r,y:a,width:s,height:l}=t;return e===1?{start:i?r:a,end:i?r+s:a+l}:{start:i?r+s:a+l,end:i?r:a}}function ey(t,e,n,i,r){if(t*e<t*i||t*e>t*r)return!1;var a=n();return t*(e-t*a/2-i)>=0&&t*(e+t*a/2-r)<=0}function Dwe(t,e){return zH(t,e+1)}function Nwe(t,e,n,i,r){for(var a=(i||[]).slice(),{start:s,end:l}=e,c=0,d=1,f=s,h=function(){var b=i?.[c];if(b===void 0)return{v:zH(i,d)};var y=c,x,v=()=>(x===void 0&&(x=n(b,y)),x),w=b.coordinate,S=c===0||ey(t,w,v,f,l);S||(c=0,f=s,d+=1),S&&(f=w+t*(v()/2+r),c+=d)},g;d<=a.length;)if(g=h(),g)return g.v;return[]}function _4(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),n.push.apply(n,i)}return n}function Sr(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?_4(Object(n),!0).forEach(function(i){Owe(t,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):_4(Object(n)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(n,i))})}return t}function Owe(t,e,n){return(e=Lwe(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Lwe(t){var e=Iwe(t,"string");return typeof e=="symbol"?e:e+""}function Iwe(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var i=n.call(t,e);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Uwe(t,e,n,i,r){for(var a=(i||[]).slice(),s=a.length,{start:l}=e,{end:c}=e,d=function(g){var m=a[g],b,y=()=>(b===void 0&&(b=n(m,g)),b);if(g===s-1){var x=t*(m.coordinate+t*y()/2-c);a[g]=m=Sr(Sr({},m),{},{tickCoord:x>0?m.coordinate-x*t:m.coordinate})}else a[g]=m=Sr(Sr({},m),{},{tickCoord:m.coordinate});if(m.tickCoord!=null){var v=ey(t,m.tickCoord,y,l,c);v&&(c=m.tickCoord-t*(y()/2+r),a[g]=Sr(Sr({},m),{},{isShow:!0}))}},f=s-1;f>=0;f--)d(f);return a}function kwe(t,e,n,i,r,a){var s=(i||[]).slice(),l=s.length,{start:c,end:d}=e;if(a){var f=i[l-1],h=n(f,l-1),g=t*(f.coordinate+t*h/2-d);if(s[l-1]=f=Sr(Sr({},f),{},{tickCoord:g>0?f.coordinate-g*t:f.coordinate}),f.tickCoord!=null){var m=ey(t,f.tickCoord,()=>h,c,d);m&&(d=f.tickCoord-t*(h/2+r),s[l-1]=Sr(Sr({},f),{},{isShow:!0}))}}for(var b=a?l-1:l,y=function(w){var S=s[w],A,R=()=>(A===void 0&&(A=n(S,w)),A);if(w===0){var N=t*(S.coordinate-t*R()/2-c);s[w]=S=Sr(Sr({},S),{},{tickCoord:N<0?S.coordinate-N*t:S.coordinate})}else s[w]=S=Sr(Sr({},S),{},{tickCoord:S.coordinate});if(S.tickCoord!=null){var C=ey(t,S.tickCoord,R,c,d);C&&(c=S.tickCoord+t*(R()/2+r),s[w]=Sr(Sr({},S),{},{isShow:!0}))}},x=0;x<b;x++)y(x);return s}function zC(t,e,n){var{tick:i,ticks:r,viewBox:a,minTickGap:s,orientation:l,interval:c,tickFormatter:d,unit:f,angle:h}=t;if(!r||!r.length||!i)return[];if(yt(c)||Xf.isSsr){var g;return(g=Dwe(r,yt(c)?c:0))!==null&&g!==void 0?g:[]}var m=[],b=l==="top"||l==="bottom"?"width":"height",y=f&&b==="width"?Pp(f,{fontSize:e,letterSpacing:n}):{width:0,height:0},x=(S,A)=>{var R=typeof d=="function"?d(S.value,A):S.value;return b==="width"?Rwe(Pp(R,{fontSize:e,letterSpacing:n}),y,h):Pp(R,{fontSize:e,letterSpacing:n})[b]},v=r.length>=2?Zi(r[1].coordinate-r[0].coordinate):1,w=Pwe(a,v,b);return c==="equidistantPreserveStart"?Nwe(v,w,x,r,s):(c==="preserveStart"||c==="preserveStartEnd"?m=kwe(v,w,x,r,s,c==="preserveStartEnd"):m=Uwe(v,w,x,r,s),m.filter(S=>S.isShow))}var Fwe=t=>{var{ticks:e,label:n,labelGapWithTick:i=5,tickSize:r=0,tickMargin:a=0}=t,s=0;if(e){Array.from(e).forEach(f=>{if(f){var h=f.getBoundingClientRect();h.width>s&&(s=h.width)}});var l=n?n.getBoundingClientRect().width:0,c=r+a,d=s+c+l+(n?i:0);return Math.round(d)}return 0},zwe=["axisLine","width","height","className","hide","ticks","axisType"];function Bwe(t,e){if(t==null)return{};var n,i,r=jwe(t,e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(i=0;i<a.length;i++)n=a[i],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function jwe(t,e){if(t==null)return{};var n={};for(var i in t)if({}.hasOwnProperty.call(t,i)){if(e.indexOf(i)!==-1)continue;n[i]=t[i]}return n}function Du(){return Du=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)({}).hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},Du.apply(null,arguments)}function S4(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),n.push.apply(n,i)}return n}function mi(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?S4(Object(n),!0).forEach(function(i){Hwe(t,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):S4(Object(n)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(n,i))})}return t}function Hwe(t,e,n){return(e=Gwe(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Gwe(t){var e=Vwe(t,"string");return typeof e=="symbol"?e:e+""}function Vwe(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var i=n.call(t,e);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Go={x:0,y:0,width:0,height:0,viewBox:{x:0,y:0,width:0,height:0},orientation:"bottom",ticks:[],stroke:"#666",tickLine:!0,axisLine:!0,tick:!0,mirror:!1,minTickGap:5,tickSize:6,tickMargin:2,interval:"preserveEnd",zIndex:yi.axis};function $we(t){var{x:e,y:n,width:i,height:r,orientation:a,mirror:s,axisLine:l,otherSvgProps:c}=t;if(!l)return null;var d=mi(mi(mi({},c),Jr(l)),{},{fill:"none"});if(a==="top"||a==="bottom"){var f=+(a==="top"&&!s||a==="bottom"&&s);d=mi(mi({},d),{},{x1:e,y1:n+f*r,x2:e+i,y2:n+f*r})}else{var h=+(a==="left"&&!s||a==="right"&&s);d=mi(mi({},d),{},{x1:e+h*i,y1:n,x2:e+h*i,y2:n+r})}return T.createElement("line",Du({},d,{className:dn("recharts-cartesian-axis-line",Tu(l,"className"))}))}function Wwe(t,e,n,i,r,a,s,l,c){var d,f,h,g,m,b,y=l?-1:1,x=t.tickSize||s,v=yt(t.tickCoord)?t.tickCoord:t.coordinate;switch(a){case"top":d=f=t.coordinate,g=n+ +!l*r,h=g-y*x,b=h-y*c,m=v;break;case"left":h=g=t.coordinate,f=e+ +!l*i,d=f-y*x,m=d-y*c,b=v;break;case"right":h=g=t.coordinate,f=e+ +l*i,d=f+y*x,m=d+y*c,b=v;break;default:d=f=t.coordinate,g=n+ +l*r,h=g+y*x,b=h+y*c,m=v;break}return{line:{x1:d,y1:h,x2:f,y2:g},tick:{x:m,y:b}}}function Xwe(t,e){switch(t){case"left":return e?"start":"end";case"right":return e?"end":"start";default:return"middle"}}function qwe(t,e){switch(t){case"left":case"right":return"middle";case"top":return e?"start":"end";default:return e?"end":"start"}}function Ywe(t){var{option:e,tickProps:n,value:i}=t,r,a=dn(n.className,"recharts-cartesian-axis-tick-value");if(T.isValidElement(e))r=T.cloneElement(e,mi(mi({},n),{},{className:a}));else if(typeof e=="function")r=e(mi(mi({},n),{},{className:a}));else{var s="recharts-cartesian-axis-tick-value";typeof e!="boolean"&&(s=dn(s,e?.className)),r=T.createElement(ob,Du({},n,{className:s}),i)}return r}var Kwe=T.forwardRef((t,e)=>{var{ticks:n=[],tick:i,tickLine:r,stroke:a,tickFormatter:s,unit:l,padding:c,tickTextProps:d,orientation:f,mirror:h,x:g,y:m,width:b,height:y,tickSize:x,tickMargin:v,fontSize:w,letterSpacing:S,getTicksConfig:A,events:R,axisType:N}=t,C=zC(mi(mi({},A),{},{ticks:n}),w,S),F=Xwe(f,h),P=qwe(f,h),L=Jr(A),B=Au(i),U={};typeof r=="object"&&(U=r);var $=mi(mi({},L),{},{fill:"none"},U),I=C.map(V=>mi({entry:V},Wwe(V,g,m,b,y,f,x,h,v))),W=I.map(V=>{var{entry:Y,line:J}=V;return T.createElement(oi,{className:"recharts-cartesian-axis-tick",key:"tick-".concat(Y.value,"-").concat(Y.coordinate,"-").concat(Y.tickCoord)},r&&T.createElement("line",Du({},$,J,{className:dn("recharts-cartesian-axis-tick-line",Tu(r,"className"))})))}),X=I.map((V,Y)=>{var{entry:J,tick:se}=V,H=mi(mi(mi(mi({textAnchor:F,verticalAnchor:P},L),{},{stroke:"none",fill:a},B),se),{},{index:Y,payload:J,visibleTicksCount:C.length,tickFormatter:s,padding:c},d);return T.createElement(oi,Du({className:"recharts-cartesian-axis-tick-label",key:"tick-label-".concat(J.value,"-").concat(J.coordinate,"-").concat(J.tickCoord)},Em(R,J,Y)),i&&T.createElement(Ywe,{option:i,tickProps:H,value:"".concat(typeof s=="function"?s(J.value,Y):J.value).concat(l||"")}))});return T.createElement("g",{className:"recharts-cartesian-axis-ticks recharts-".concat(N,"-ticks")},X.length>0&&T.createElement(ta,{zIndex:yi.label},T.createElement("g",{className:"recharts-cartesian-axis-tick-labels recharts-".concat(N,"-tick-labels"),ref:e},X)),W.length>0&&T.createElement("g",{className:"recharts-cartesian-axis-tick-lines recharts-".concat(N,"-tick-lines")},W))}),Zwe=T.forwardRef((t,e)=>{var{axisLine:n,width:i,height:r,className:a,hide:s,ticks:l,axisType:c}=t,d=Bwe(t,zwe),[f,h]=T.useState(""),[g,m]=T.useState(""),b=T.useRef(null);T.useImperativeHandle(e,()=>({getCalculatedWidth:()=>{var x;return Fwe({ticks:b.current,label:(x=t.labelRef)===null||x===void 0?void 0:x.current,labelGapWithTick:5,tickSize:t.tickSize,tickMargin:t.tickMargin})}}));var y=T.useCallback(x=>{if(x){var v=x.getElementsByClassName("recharts-cartesian-axis-tick-value");b.current=v;var w=v[0];if(w){var S=window.getComputedStyle(w),A=S.fontSize,R=S.letterSpacing;(A!==f||R!==g)&&(h(A),m(R))}}},[f,g]);return s||i!=null&&i<=0||r!=null&&r<=0?null:T.createElement(ta,{zIndex:t.zIndex},T.createElement(oi,{className:dn("recharts-cartesian-axis",a)},T.createElement($we,{x:t.x,y:t.y,width:i,height:r,orientation:t.orientation,mirror:t.mirror,axisLine:n,otherSvgProps:Jr(t)}),T.createElement(Kwe,{ref:y,axisType:c,events:d,fontSize:f,getTicksConfig:t,height:t.height,letterSpacing:g,mirror:t.mirror,orientation:t.orientation,padding:t.padding,stroke:t.stroke,tick:t.tick,tickFormatter:t.tickFormatter,tickLine:t.tickLine,tickMargin:t.tickMargin,tickSize:t.tickSize,tickTextProps:t.tickTextProps,ticks:l,unit:t.unit,width:t.width,x:t.x,y:t.y}),T.createElement(_be,{x:t.x,y:t.y,width:t.width,height:t.height,lowerWidth:t.width,upperWidth:t.width},T.createElement(Dbe,{label:t.label,labelRef:t.labelRef}),t.children)))}),BC=T.forwardRef((t,e)=>{var n=Si(t,Go);return T.createElement(Zwe,Du({},n,{ref:e}))});BC.displayName="CartesianAxis";var Qwe=["x1","y1","x2","y2","key"],Jwe=["offset"],eEe=["xAxisId","yAxisId"],tEe=["xAxisId","yAxisId"];function w4(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),n.push.apply(n,i)}return n}function wr(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?w4(Object(n),!0).forEach(function(i){nEe(t,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):w4(Object(n)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(n,i))})}return t}function nEe(t,e,n){return(e=iEe(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function iEe(t){var e=rEe(t,"string");return typeof e=="symbol"?e:e+""}function rEe(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var i=n.call(t,e);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function su(){return su=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)({}).hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},su.apply(null,arguments)}function ty(t,e){if(t==null)return{};var n,i,r=aEe(t,e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(i=0;i<a.length;i++)n=a[i],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function aEe(t,e){if(t==null)return{};var n={};for(var i in t)if({}.hasOwnProperty.call(t,i)){if(e.indexOf(i)!==-1)continue;n[i]=t[i]}return n}var sEe=t=>{var{fill:e}=t;if(!e||e==="none")return null;var{fillOpacity:n,x:i,y:r,width:a,height:s,ry:l}=t;return T.createElement("rect",{x:i,y:r,ry:l,width:a,height:s,stroke:"none",fill:e,fillOpacity:n,className:"recharts-cartesian-grid-bg"})};function BH(t){var{option:e,lineItemProps:n}=t,i;if(T.isValidElement(e))i=T.cloneElement(e,n);else if(typeof e=="function")i=e(n);else{var r,{x1:a,y1:s,x2:l,y2:c,key:d}=n,f=ty(n,Qwe),h=(r=Jr(f))!==null&&r!==void 0?r:{},{offset:g}=h,m=ty(h,Jwe);i=T.createElement("line",su({},m,{x1:a,y1:s,x2:l,y2:c,fill:"none",key:d}))}return i}function oEe(t){var{x:e,width:n,horizontal:i=!0,horizontalPoints:r}=t;if(!i||!r||!r.length)return null;var{xAxisId:a,yAxisId:s}=t,l=ty(t,eEe),c=r.map((d,f)=>{var h=wr(wr({},l),{},{x1:e,y1:d,x2:e+n,y2:d,key:"line-".concat(f),index:f});return T.createElement(BH,{key:"line-".concat(f),option:i,lineItemProps:h})});return T.createElement("g",{className:"recharts-cartesian-grid-horizontal"},c)}function lEe(t){var{y:e,height:n,vertical:i=!0,verticalPoints:r}=t;if(!i||!r||!r.length)return null;var{xAxisId:a,yAxisId:s}=t,l=ty(t,tEe),c=r.map((d,f)=>{var h=wr(wr({},l),{},{x1:d,y1:e,x2:d,y2:e+n,key:"line-".concat(f),index:f});return T.createElement(BH,{option:i,lineItemProps:h,key:"line-".concat(f)})});return T.createElement("g",{className:"recharts-cartesian-grid-vertical"},c)}function cEe(t){var{horizontalFill:e,fillOpacity:n,x:i,y:r,width:a,height:s,horizontalPoints:l,horizontal:c=!0}=t;if(!c||!e||!e.length||l==null)return null;var d=l.map(h=>Math.round(h+r-r)).sort((h,g)=>h-g);r!==d[0]&&d.unshift(0);var f=d.map((h,g)=>{var m=!d[g+1],b=m?r+s-h:d[g+1]-h;if(b<=0)return null;var y=g%e.length;return T.createElement("rect",{key:"react-".concat(g),y:h,x:i,height:b,width:a,stroke:"none",fill:e[y],fillOpacity:n,className:"recharts-cartesian-grid-bg"})});return T.createElement("g",{className:"recharts-cartesian-gridstripes-horizontal"},f)}function uEe(t){var{vertical:e=!0,verticalFill:n,fillOpacity:i,x:r,y:a,width:s,height:l,verticalPoints:c}=t;if(!e||!n||!n.length)return null;var d=c.map(h=>Math.round(h+r-r)).sort((h,g)=>h-g);r!==d[0]&&d.unshift(0);var f=d.map((h,g)=>{var m=!d[g+1],b=m?r+s-h:d[g+1]-h;if(b<=0)return null;var y=g%n.length;return T.createElement("rect",{key:"react-".concat(g),x:h,y:a,width:b,height:l,stroke:"none",fill:n[y],fillOpacity:i,className:"recharts-cartesian-grid-bg"})});return T.createElement("g",{className:"recharts-cartesian-gridstripes-vertical"},f)}var dEe=(t,e)=>{var{xAxis:n,width:i,height:r,offset:a}=t;return Sj(zC(wr(wr(wr({},Go),n),{},{ticks:wj(n),viewBox:{x:0,y:0,width:i,height:r}})),a.left,a.left+a.width,e)},fEe=(t,e)=>{var{yAxis:n,width:i,height:r,offset:a}=t;return Sj(zC(wr(wr(wr({},Go),n),{},{ticks:wj(n),viewBox:{x:0,y:0,width:i,height:r}})),a.top,a.top+a.height,e)},hEe={horizontal:!0,vertical:!0,horizontalPoints:[],verticalPoints:[],stroke:"#ccc",fill:"none",verticalFill:[],horizontalFill:[],xAxisId:0,yAxisId:0,syncWithTicks:!1,zIndex:yi.grid};function GA(t){var e=f2(),n=h2(),i=Nj(),r=wr(wr({},Si(t,hEe)),{},{x:yt(t.x)?t.x:i.left,y:yt(t.y)?t.y:i.top,width:yt(t.width)?t.width:i.width,height:yt(t.height)?t.height:i.height}),{xAxisId:a,yAxisId:s,x:l,y:c,width:d,height:f,syncWithTicks:h,horizontalValues:g,verticalValues:m}=r,b=Ar(),y=bt(P=>hF(P,"xAxis",a,b)),x=bt(P=>hF(P,"yAxis",s,b));if(!Vs(d)||!Vs(f)||!yt(l)||!yt(c))return null;var v=r.verticalCoordinatesGenerator||dEe,w=r.horizontalCoordinatesGenerator||fEe,{horizontalPoints:S,verticalPoints:A}=r;if((!S||!S.length)&&typeof w=="function"){var R=g&&g.length,N=w({yAxis:x?wr(wr({},x),{},{ticks:R?g:x.ticks}):void 0,width:e??d,height:n??f,offset:i},R?!0:h);Ax(Array.isArray(N),"horizontalCoordinatesGenerator should return Array but instead it returned [".concat(typeof N,"]")),Array.isArray(N)&&(S=N)}if((!A||!A.length)&&typeof v=="function"){var C=m&&m.length,F=v({xAxis:y?wr(wr({},y),{},{ticks:C?m:y.ticks}):void 0,width:e??d,height:n??f,offset:i},C?!0:h);Ax(Array.isArray(F),"verticalCoordinatesGenerator should return Array but instead it returned [".concat(typeof F,"]")),Array.isArray(F)&&(A=F)}return T.createElement(ta,{zIndex:r.zIndex},T.createElement("g",{className:"recharts-cartesian-grid"},T.createElement(sEe,{fill:r.fill,fillOpacity:r.fillOpacity,x:r.x,y:r.y,width:r.width,height:r.height,ry:r.ry}),T.createElement(cEe,su({},r,{horizontalPoints:S})),T.createElement(uEe,su({},r,{verticalPoints:A})),T.createElement(oEe,su({},r,{offset:i,horizontalPoints:S,xAxis:y,yAxis:x})),T.createElement(lEe,su({},r,{offset:i,verticalPoints:A,xAxis:y,yAxis:x}))))}GA.displayName="CartesianGrid";function pEe(t){var e=Au(t),n=3,i=2;if(e!=null){var{r,strokeWidth:a}=e,s=Number(r),l=Number(a);return(Number.isNaN(s)||s<0)&&(s=n),(Number.isNaN(l)||l<0)&&(l=i),{r:s,strokeWidth:l}}return{r:n,strokeWidth:i}}var jH=(t,e,n,i)=>hc(t,"xAxis",e,i),HH=(t,e,n,i)=>fc(t,"xAxis",e,i),GH=(t,e,n,i)=>hc(t,"yAxis",n,i),VH=(t,e,n,i)=>fc(t,"yAxis",n,i),mEe=He([sn,jH,GH,HH,VH],(t,e,n,i,r)=>el(t,"xAxis")?Rf(e,i,!1):Rf(n,r,!1)),gEe=(t,e,n,i,r)=>r,$H=He([nb,gEe],(t,e)=>t.filter(n=>n.type==="area").find(n=>n.id===e)),vEe=(t,e,n,i,r)=>{var a,s=$H(t,e,n,i,r);if(s!=null){var l=sn(t),c=el(l,"xAxis"),d;if(c?d=lm(t,"yAxis",n,i):d=lm(t,"xAxis",e,i),d!=null){var{stackId:f}=s,h=Qy(s);if(!(f==null||h==null)){var g=(a=d[f])===null||a===void 0?void 0:a.stackedData;return g?.find(m=>m.key===h)}}}},xEe=He([sn,jH,GH,HH,VH,vEe,Yy,mEe,$H,C0e],(t,e,n,i,r,a,s,l,c,d)=>{var{chartData:f,dataStartIndex:h,dataEndIndex:g}=s;if(!(c==null||t!=="horizontal"&&t!=="vertical"||e==null||n==null||i==null||r==null||i.length===0||r.length===0||l==null)){var{data:m}=c,b;if(m&&m.length>0?b=m:b=f?.slice(h,g+1),b!=null)return kEe({layout:t,xAxis:e,yAxis:n,xAxisTicks:i,yAxisTicks:r,dataStartIndex:h,areaSettings:c,stackedData:a,displayedData:b,chartBaseValue:d,bandSize:l})}}),yEe=["id"],bEe=["activeDot","animationBegin","animationDuration","animationEasing","connectNulls","dot","fill","fillOpacity","hide","isAnimationActive","legendType","stroke","xAxisId","yAxisId"];function mu(){return mu=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)({}).hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},mu.apply(null,arguments)}function WH(t,e){if(t==null)return{};var n,i,r=_Ee(t,e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(i=0;i<a.length;i++)n=a[i],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function _Ee(t,e){if(t==null)return{};var n={};for(var i in t)if({}.hasOwnProperty.call(t,i)){if(e.indexOf(i)!==-1)continue;n[i]=t[i]}return n}function E4(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),n.push.apply(n,i)}return n}function af(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?E4(Object(n),!0).forEach(function(i){SEe(t,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):E4(Object(n)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(n,i))})}return t}function SEe(t,e,n){return(e=wEe(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function wEe(t){var e=EEe(t,"string");return typeof e=="symbol"?e:e+""}function EEe(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var i=n.call(t,e);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function ny(t,e){return t&&t!=="none"?t:e}var MEe=t=>{var{dataKey:e,name:n,stroke:i,fill:r,legendType:a,hide:s}=t;return[{inactive:s,dataKey:e,type:a,color:ny(i,r),value:$f(n,e),payload:t}]},AEe=T.memo(t=>{var{dataKey:e,data:n,stroke:i,strokeWidth:r,fill:a,name:s,hide:l,unit:c,tooltipType:d}=t,f={dataDefinedOnItem:n,positions:void 0,settings:{stroke:i,strokeWidth:r,fill:a,dataKey:e,nameKey:void 0,name:$f(s,e),hide:l,type:d,color:ny(i,a),unit:c}};return T.createElement(LC,{tooltipEntrySettings:f})});function TEe(t){var{clipPathId:e,points:n,props:i}=t,{needClip:r,dot:a,dataKey:s}=i,l=Jr(i);return T.createElement(ySe,{points:n,dot:a,className:"recharts-area-dots",dotClassName:"recharts-area-dot",dataKey:s,baseProps:l,needClip:r,clipPathId:e})}function CEe(t){var{showLabels:e,children:n,points:i}=t,r=i.map(a=>{var s,l,c={x:(s=a.x)!==null&&s!==void 0?s:0,y:(l=a.y)!==null&&l!==void 0?l:0,width:0,lowerWidth:0,upperWidth:0,height:0};return af(af({},c),{},{value:a.value,payload:a.payload,parentViewBox:void 0,viewBox:c,fill:void 0})});return T.createElement(mH,{value:e?r:void 0},n)}function M4(t){var{points:e,baseLine:n,needClip:i,clipPathId:r,props:a}=t,{layout:s,type:l,stroke:c,connectNulls:d,isRange:f}=a,{id:h}=a,g=WH(a,yEe),m=Jr(g),b=kr(g);return T.createElement(T.Fragment,null,e?.length>1&&T.createElement(oi,{clipPath:i?"url(#clipPath-".concat(r,")"):void 0},T.createElement(hf,mu({},b,{id:h,points:e,connectNulls:d,type:l,baseLine:n,layout:s,stroke:"none",className:"recharts-area-area"})),c!=="none"&&T.createElement(hf,mu({},m,{className:"recharts-area-curve",layout:s,type:l,connectNulls:d,fill:"none",points:e})),c!=="none"&&f&&T.createElement(hf,mu({},m,{className:"recharts-area-curve",layout:s,type:l,connectNulls:d,fill:"none",points:n}))),T.createElement(TEe,{points:e,props:g,clipPathId:r}))}function REe(t){var{alpha:e,baseLine:n,points:i,strokeWidth:r}=t,a=i[0].y,s=i[i.length-1].y;if(!jn(a)||!jn(s))return null;var l=e*Math.abs(a-s),c=Math.max(...i.map(d=>d.x||0));return yt(n)?c=Math.max(n,c):n&&Array.isArray(n)&&n.length&&(c=Math.max(...n.map(d=>d.x||0),c)),yt(c)?T.createElement("rect",{x:0,y:a<s?a:a-l,width:c+(r?parseInt("".concat(r),10):1),height:Math.floor(l)}):null}function PEe(t){var{alpha:e,baseLine:n,points:i,strokeWidth:r}=t,a=i[0].x,s=i[i.length-1].x;if(!jn(a)||!jn(s))return null;var l=e*Math.abs(a-s),c=Math.max(...i.map(d=>d.y||0));return yt(n)?c=Math.max(n,c):n&&Array.isArray(n)&&n.length&&(c=Math.max(...n.map(d=>d.y||0),c)),yt(c)?T.createElement("rect",{x:a<s?a:a-l,y:0,width:l,height:Math.floor(c+(r?parseInt("".concat(r),10):1))}):null}function DEe(t){var{alpha:e,layout:n,points:i,baseLine:r,strokeWidth:a}=t;return n==="vertical"?T.createElement(REe,{alpha:e,points:i,baseLine:r,strokeWidth:a}):T.createElement(PEe,{alpha:e,points:i,baseLine:r,strokeWidth:a})}function NEe(t){var{needClip:e,clipPathId:n,props:i,previousPointsRef:r,previousBaselineRef:a}=t,{points:s,baseLine:l,isAnimationActive:c,animationBegin:d,animationDuration:f,animationEasing:h,onAnimationStart:g,onAnimationEnd:m}=i,b=T.useMemo(()=>({points:s,baseLine:l}),[s,l]),y=Dm(b,"recharts-area-"),x=Wfe(),[v,w]=T.useState(!1),S=!v,A=T.useCallback(()=>{typeof m=="function"&&m(),w(!1)},[m]),R=T.useCallback(()=>{typeof g=="function"&&g(),w(!0)},[g]);if(x==null)return null;var N=r.current,C=a.current;return T.createElement(CEe,{showLabels:S,points:s},i.children,T.createElement(Pm,{animationId:y,begin:d,duration:f,isActive:c,easing:h,onAnimationEnd:A,onAnimationStart:R,key:y},F=>{if(N){var P=N.length/s.length,L=F===1?s:s.map((U,$)=>{var I=Math.floor($*P);if(N[I]){var W=N[I];return af(af({},U),{},{x:Bn(W.x,U.x,F),y:Bn(W.y,U.y,F)})}return U}),B;return yt(l)?B=Bn(C,l,F):qn(l)||Ya(l)?B=Bn(C,0,F):B=l.map((U,$)=>{var I=Math.floor($*P);if(Array.isArray(C)&&C[I]){var W=C[I];return af(af({},U),{},{x:Bn(W.x,U.x,F),y:Bn(W.y,U.y,F)})}return U}),F>0&&(r.current=L,a.current=B),T.createElement(M4,{points:L,baseLine:B,needClip:e,clipPathId:n,props:i})}return F>0&&(r.current=s,a.current=l),T.createElement(oi,null,c&&T.createElement("defs",null,T.createElement("clipPath",{id:"animationClipPath-".concat(n)},T.createElement(DEe,{alpha:F,points:s,baseLine:l,layout:x,strokeWidth:i.strokeWidth}))),T.createElement(oi,{clipPath:"url(#animationClipPath-".concat(n,")")},T.createElement(M4,{points:s,baseLine:l,needClip:e,clipPathId:n,props:i})))}),T.createElement(TC,{label:i.label}))}function OEe(t){var{needClip:e,clipPathId:n,props:i}=t,r=T.useRef(null),a=T.useRef();return T.createElement(NEe,{needClip:e,clipPathId:n,props:i,previousPointsRef:r,previousBaselineRef:a})}class LEe extends T.PureComponent{render(){var{hide:e,dot:n,points:i,className:r,top:a,left:s,needClip:l,xAxisId:c,yAxisId:d,width:f,height:h,id:g,baseLine:m,zIndex:b}=this.props;if(e)return null;var y=dn("recharts-area",r),x=g,{r:v,strokeWidth:w}=pEe(n),S=wH(n),A=v*2+w,R=l?"url(#clipPath-".concat(S?"":"dots-").concat(x,")"):void 0;return T.createElement(ta,{zIndex:b},T.createElement(oi,{className:y},l&&T.createElement("defs",null,T.createElement(NH,{clipPathId:x,xAxisId:c,yAxisId:d}),!S&&T.createElement("clipPath",{id:"clipPath-dots-".concat(x)},T.createElement("rect",{x:s-A/2,y:a-A/2,width:f+A,height:h+A}))),T.createElement(OEe,{needClip:l,clipPathId:x,props:this.props})),T.createElement(d4,{points:i,mainColor:ny(this.props.stroke,this.props.fill),itemDataKey:this.props.dataKey,activeDot:this.props.activeDot,clipPath:R}),this.props.isRange&&Array.isArray(m)&&T.createElement(d4,{points:m,mainColor:ny(this.props.stroke,this.props.fill),itemDataKey:this.props.dataKey,activeDot:this.props.activeDot,clipPath:R}))}}var XH={activeDot:!0,animationBegin:0,animationDuration:1500,animationEasing:"ease",connectNulls:!1,dot:!1,fill:"#3182bd",fillOpacity:.6,hide:!1,isAnimationActive:"auto",legendType:"line",stroke:"#3182bd",strokeWidth:1,type:"linear",label:!1,xAxisId:0,yAxisId:0,zIndex:yi.area};function IEe(t){var e,n=Si(t,XH),{activeDot:i,animationBegin:r,animationDuration:a,animationEasing:s,connectNulls:l,dot:c,fill:d,fillOpacity:f,hide:h,isAnimationActive:g,legendType:m,stroke:b,xAxisId:y,yAxisId:x}=n,v=WH(n,bEe),w=Wf(),S=K6(),{needClip:A}=kC(y,x),R=Ar(),{points:N,isRange:C,baseLine:F}=(e=bt(I=>xEe(I,y,x,R,t.id)))!==null&&e!==void 0?e:{},P=UC();if(w!=="horizontal"&&w!=="vertical"||P==null||S!=="AreaChart"&&S!=="ComposedChart")return null;var{height:L,width:B,x:U,y:$}=P;return!N||!N.length?null:T.createElement(LEe,mu({},v,{activeDot:i,animationBegin:r,animationDuration:a,animationEasing:s,baseLine:F,connectNulls:l,dot:c,fill:d,fillOpacity:f,height:L,hide:h,layout:w,isAnimationActive:g==="auto"?!Xf.isSsr:g,isRange:C,legendType:m,needClip:A,points:N,stroke:b,width:B,left:U,top:$,xAxisId:y,yAxisId:x}))}var UEe=(t,e,n,i,r)=>{var a=n??e;if(yt(a))return a;var s=t==="horizontal"?r:i,l=s.scale.domain();if(s.type==="number"){var c=Math.max(l[0],l[1]),d=Math.min(l[0],l[1]);return a==="dataMin"?d:a==="dataMax"||c<0?c:Math.max(Math.min(l[0],l[1]),0)}return a==="dataMin"?l[0]:a==="dataMax"?l[1]:l[0]};function kEe(t){var{areaSettings:{connectNulls:e,baseValue:n,dataKey:i},stackedData:r,layout:a,chartBaseValue:s,xAxis:l,yAxis:c,displayedData:d,dataStartIndex:f,xAxisTicks:h,yAxisTicks:g,bandSize:m}=t,b=r&&r.length,y=UEe(a,s,n,l,c),x=a==="horizontal",v=!1,w=d.map((A,R)=>{var N;b?N=r[f+R]:(N=Dn(A,i),Array.isArray(N)?v=!0:N=[y,N]);var C=N[1]==null||b&&!e&&Dn(A,i)==null;return x?{x:NU({axis:l,ticks:h,bandSize:m,entry:A,index:R}),y:C?null:c.scale(N[1]),value:N,payload:A}:{x:C?null:l.scale(N[1]),y:NU({axis:c,ticks:g,bandSize:m,entry:A,index:R}),value:N,payload:A}}),S;return b||v?S=w.map(A=>{var R=Array.isArray(A.value)?A.value[0]:null;return x?{x:A.x,y:R!=null&&A.y!=null?c.scale(R):null,payload:A.payload}:{x:R!=null?l.scale(R):null,y:A.y,payload:A.payload}}):S=x?c.scale(y):l.scale(y),{points:w,baseLine:S,isRange:v}}function FEe(t){var e=Si(t,XH),n=Ar();return T.createElement(IC,{id:e.id,type:"area"},i=>T.createElement(T.Fragment,null,T.createElement(MH,{legendPayload:MEe(e)}),T.createElement(AEe,{dataKey:e.dataKey,data:e.data,stroke:e.stroke,strokeWidth:e.strokeWidth,fill:e.fill,name:e.name,hide:e.hide,unit:e.unit,tooltipType:e.tooltipType}),T.createElement(CH,{type:"area",id:i,data:e.data,dataKey:e.dataKey,xAxisId:e.xAxisId,yAxisId:e.yAxisId,zAxisId:0,stackId:Ej(e.stackId),hide:e.hide,barSize:void 0,baseValue:e.baseValue,isPanorama:n,connectNulls:e.connectNulls}),T.createElement(IEe,mu({},e,{id:i}))))}var qH=T.memo(FEe,db);qH.displayName="Area";var zEe=["domain","range"],BEe=["domain","range"];function A4(t,e){if(t==null)return{};var n,i,r=jEe(t,e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(i=0;i<a.length;i++)n=a[i],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function jEe(t,e){if(t==null)return{};var n={};for(var i in t)if({}.hasOwnProperty.call(t,i)){if(e.indexOf(i)!==-1)continue;n[i]=t[i]}return n}function T4(t,e){return t===e?!0:Array.isArray(t)&&t.length===2&&Array.isArray(e)&&e.length===2?t[0]===e[0]&&t[1]===e[1]:!1}function YH(t,e){if(t===e)return!0;var{domain:n,range:i}=t,r=A4(t,zEe),{domain:a,range:s}=e,l=A4(e,BEe);return!T4(n,a)||!T4(i,s)?!1:db(r,l)}var HEe=["dangerouslySetInnerHTML","ticks"],GEe=["id"];function VA(){return VA=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)({}).hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},VA.apply(null,arguments)}function C4(t,e){if(t==null)return{};var n,i,r=VEe(t,e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(i=0;i<a.length;i++)n=a[i],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function VEe(t,e){if(t==null)return{};var n={};for(var i in t)if({}.hasOwnProperty.call(t,i)){if(e.indexOf(i)!==-1)continue;n[i]=t[i]}return n}function $Ee(t){var e=In(),n=T.useRef(null);return T.useLayoutEffect(()=>{n.current===null?e(ESe(t)):n.current!==t&&e(MSe({prev:n.current,next:t})),n.current=t},[t,e]),T.useLayoutEffect(()=>()=>{n.current&&(e(ASe(n.current)),n.current=null)},[e]),null}var WEe=t=>{var{xAxisId:e,className:n}=t,i=bt(u2),r=Ar(),a="xAxis",s=bt(x=>eh(x,a,e,r)),l=bt(x=>C6(x,a,e,r)),c=bt(x=>E6(x,e)),d=bt(x=>Mve(x,e)),f=bt(x=>a6(x,e));if(c==null||d==null||f==null)return null;var{dangerouslySetInnerHTML:h,ticks:g}=t,m=C4(t,HEe),{id:b}=f,y=C4(f,GEe);return T.createElement(BC,VA({},m,y,{scale:s,x:d.x,y:d.y,width:c.width,height:c.height,className:dn("recharts-".concat(a," ").concat(a),n),viewBox:i,ticks:l,axisType:a}))},XEe={allowDataOverflow:Wi.allowDataOverflow,allowDecimals:Wi.allowDecimals,allowDuplicatedCategory:Wi.allowDuplicatedCategory,angle:Wi.angle,axisLine:Go.axisLine,height:Wi.height,hide:!1,includeHidden:Wi.includeHidden,interval:Wi.interval,minTickGap:Wi.minTickGap,mirror:Wi.mirror,orientation:Wi.orientation,padding:Wi.padding,reversed:Wi.reversed,scale:Wi.scale,tick:Wi.tick,tickCount:Wi.tickCount,tickLine:Go.tickLine,tickSize:Go.tickSize,type:Wi.type,xAxisId:0},qEe=t=>{var e=Si(t,XEe);return T.createElement(T.Fragment,null,T.createElement($Ee,{allowDataOverflow:e.allowDataOverflow,allowDecimals:e.allowDecimals,allowDuplicatedCategory:e.allowDuplicatedCategory,angle:e.angle,dataKey:e.dataKey,domain:e.domain,height:e.height,hide:e.hide,id:e.xAxisId,includeHidden:e.includeHidden,interval:e.interval,minTickGap:e.minTickGap,mirror:e.mirror,name:e.name,orientation:e.orientation,padding:e.padding,reversed:e.reversed,scale:e.scale,tick:e.tick,tickCount:e.tickCount,tickFormatter:e.tickFormatter,ticks:e.ticks,type:e.type,unit:e.unit}),T.createElement(WEe,e))},$A=T.memo(qEe,YH);$A.displayName="XAxis";var YEe=["dangerouslySetInnerHTML","ticks"],KEe=["id"];function WA(){return WA=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)({}).hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},WA.apply(null,arguments)}function R4(t,e){if(t==null)return{};var n,i,r=ZEe(t,e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(i=0;i<a.length;i++)n=a[i],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function ZEe(t,e){if(t==null)return{};var n={};for(var i in t)if({}.hasOwnProperty.call(t,i)){if(e.indexOf(i)!==-1)continue;n[i]=t[i]}return n}function QEe(t){var e=In(),n=T.useRef(null);return T.useLayoutEffect(()=>{n.current===null?e(TSe(t)):n.current!==t&&e(CSe({prev:n.current,next:t})),n.current=t},[t,e]),T.useLayoutEffect(()=>()=>{n.current&&(e(RSe(n.current)),n.current=null)},[e]),null}var JEe=t=>{var{yAxisId:e,className:n,width:i,label:r}=t,a=T.useRef(null),s=T.useRef(null),l=bt(u2),c=Ar(),d=In(),f="yAxis",h=bt(R=>eh(R,f,e,c)),g=bt(R=>M6(R,e)),m=bt(R=>Tve(R,e)),b=bt(R=>C6(R,f,e,c)),y=bt(R=>s6(R,e));if(T.useLayoutEffect(()=>{if(!(i!=="auto"||!g||AC(r)||T.isValidElement(r)||y==null)){var R=a.current;if(R){var N=R.getCalculatedWidth();Math.round(g.width)!==Math.round(N)&&d(PSe({id:e,width:N}))}}},[b,g,d,r,e,i,y]),g==null||m==null||y==null)return null;var{dangerouslySetInnerHTML:x,ticks:v}=t,w=R4(t,YEe),{id:S}=y,A=R4(y,KEe);return T.createElement(BC,WA({},w,A,{ref:a,labelRef:s,scale:h,x:m.x,y:m.y,tickTextProps:i==="auto"?{width:void 0}:{width:i},width:g.width,height:g.height,className:dn("recharts-".concat(f," ").concat(f),n),viewBox:l,ticks:b,axisType:f}))},eMe={allowDataOverflow:Xi.allowDataOverflow,allowDecimals:Xi.allowDecimals,allowDuplicatedCategory:Xi.allowDuplicatedCategory,angle:Xi.angle,axisLine:Go.axisLine,hide:!1,includeHidden:Xi.includeHidden,interval:Xi.interval,minTickGap:Xi.minTickGap,mirror:Xi.mirror,orientation:Xi.orientation,padding:Xi.padding,reversed:Xi.reversed,scale:Xi.scale,tick:Xi.tick,tickCount:Xi.tickCount,tickLine:Go.tickLine,tickSize:Go.tickSize,type:Xi.type,width:Xi.width,yAxisId:0},tMe=t=>{var e=Si(t,eMe);return T.createElement(T.Fragment,null,T.createElement(QEe,{interval:e.interval,id:e.yAxisId,scale:e.scale,type:e.type,domain:e.domain,allowDataOverflow:e.allowDataOverflow,dataKey:e.dataKey,allowDuplicatedCategory:e.allowDuplicatedCategory,allowDecimals:e.allowDecimals,tickCount:e.tickCount,padding:e.padding,includeHidden:e.includeHidden,reversed:e.reversed,ticks:e.ticks,width:e.width,orientation:e.orientation,mirror:e.mirror,hide:e.hide,unit:e.unit,name:e.name,angle:e.angle,minTickGap:e.minTickGap,tick:e.tick,tickFormatter:e.tickFormatter}),T.createElement(JEe,e))},XA=T.memo(tMe,YH);XA.displayName="YAxis";var nMe=(t,e)=>e,jC=He([nMe,sn,i6,ki,V6,sl,Hxe,Ii],Yxe),HC=t=>{var e=t.currentTarget.getBoundingClientRect(),n=e.width/t.currentTarget.offsetWidth,i=e.height/t.currentTarget.offsetHeight;return{chartX:Math.round((t.clientX-e.left)/n),chartY:Math.round((t.clientY-e.top)/i)}},KH=Ka("mouseClick"),ZH=Tm();ZH.startListening({actionCreator:KH,effect:(t,e)=>{var n=t.payload,i=jC(e.getState(),HC(n));i?.activeIndex!=null&&e.dispatch(jve({activeIndex:i.activeIndex,activeDataKey:void 0,activeCoordinate:i.activeCoordinate}))}});var qA=Ka("mouseMove"),QH=Tm(),Mv=null;QH.startListening({actionCreator:qA,effect:(t,e)=>{var n=t.payload;Mv!==null&&cancelAnimationFrame(Mv);var i=HC(n);Mv=requestAnimationFrame(()=>{var r=e.getState(),a=pC(r,r.tooltip.settings.shared);if(a==="axis"){var s=jC(r,i);s?.activeIndex!=null?e.dispatch(U6({activeIndex:s.activeIndex,activeDataKey:void 0,activeCoordinate:s.activeCoordinate})):e.dispatch(I6())}Mv=null})}});var P4={accessibilityLayer:!0,barCategoryGap:"10%",barGap:4,barSize:void 0,className:void 0,maxBarSize:void 0,stackOffset:"none",syncId:void 0,syncMethod:"index",baseValue:void 0,reverseStackOrder:!1},JH=ea({name:"rootProps",initialState:P4,reducers:{updateOptions:(t,e)=>{var n;t.accessibilityLayer=e.payload.accessibilityLayer,t.barCategoryGap=e.payload.barCategoryGap,t.barGap=(n=e.payload.barGap)!==null&&n!==void 0?n:P4.barGap,t.barSize=e.payload.barSize,t.maxBarSize=e.payload.maxBarSize,t.stackOffset=e.payload.stackOffset,t.syncId=e.payload.syncId,t.syncMethod=e.payload.syncMethod,t.className=e.payload.className,t.baseValue=e.payload.baseValue,t.reverseStackOrder=e.payload.reverseStackOrder}}}),iMe=JH.reducer,{updateOptions:rMe}=JH.actions,eG=ea({name:"polarOptions",initialState:null,reducers:{updatePolarOptions:(t,e)=>e.payload}}),{updatePolarOptions:aMe}=eG.actions,sMe=eG.reducer,tG=Ka("keyDown"),nG=Ka("focus"),GC=Tm();GC.startListening({actionCreator:tG,effect:(t,e)=>{var n=e.getState(),i=n.rootProps.accessibilityLayer!==!1;if(i){var{keyboardInteraction:r}=n.tooltip,a=t.payload;if(!(a!=="ArrowRight"&&a!=="ArrowLeft"&&a!=="Enter")){var s=mC(r,nh(n),Bm(n),Vm(n)),l=s==null?-1:Number(s);if(!(!Number.isFinite(l)||l<0)){var c=sl(n);if(a==="Enter"){var d=Xx(n,"axis","hover",String(r.index));e.dispatch(UA({active:!r.active,activeIndex:r.index,activeDataKey:r.dataKey,activeCoordinate:d}));return}var f=Dve(n),h=f==="left-to-right"?1:-1,g=a==="ArrowRight"?1:-1,m=l+g*h;if(!(c==null||m>=c.length||m<0)){var b=Xx(n,"axis","hover",String(m));e.dispatch(UA({active:!0,activeIndex:m.toString(),activeDataKey:void 0,activeCoordinate:b}))}}}}}});GC.startListening({actionCreator:nG,effect:(t,e)=>{var n=e.getState(),i=n.rootProps.accessibilityLayer!==!1;if(i){var{keyboardInteraction:r}=n.tooltip;if(!r.active&&r.index==null){var a="0",s=Xx(n,"axis","hover",String(a));e.dispatch(UA({activeDataKey:void 0,active:!0,activeIndex:a,activeCoordinate:s}))}}}});var Ua=Ka("externalEvent"),iG=Tm(),RE=new Map;iG.startListening({actionCreator:Ua,effect:(t,e)=>{var{handler:n,reactEvent:i}=t.payload;if(n!=null){i.persist();var r=i.type,a=RE.get(r);a!==void 0&&cancelAnimationFrame(a);var s=requestAnimationFrame(()=>{try{var l=e.getState(),c={activeCoordinate:Txe(l),activeDataKey:bC(l),activeIndex:pc(l),activeLabel:X6(l),activeTooltipIndex:pc(l),isTooltipActive:Cxe(l)};n(c,i)}finally{RE.delete(r)}});RE.set(r,s)}}});var oMe=He([th],t=>t.tooltipItemPayloads),lMe=He([oMe,Hm,(t,e,n)=>e,(t,e,n)=>n],(t,e,n,i)=>{var r=t.find(l=>l.settings.dataKey===i);if(r!=null){var{positions:a}=r;if(a!=null){var s=e(a,n);return s}}}),rG=Ka("touchMove"),aG=Tm();aG.startListening({actionCreator:rG,effect:(t,e)=>{var n=t.payload;if(!(n.touches==null||n.touches.length===0)){var i=e.getState(),r=pC(i,i.tooltip.settings.shared);if(r==="axis"){var a=jC(i,HC({clientX:n.touches[0].clientX,clientY:n.touches[0].clientY,currentTarget:n.currentTarget}));a?.activeIndex!=null&&e.dispatch(U6({activeIndex:a.activeIndex,activeDataKey:void 0,activeCoordinate:a.activeCoordinate}))}else if(r==="item"){var s,l=n.touches[0];if(document.elementFromPoint==null)return;var c=document.elementFromPoint(l.clientX,l.clientY);if(!c||!c.getAttribute)return;var d=c.getAttribute(Aj),f=(s=c.getAttribute(Tj))!==null&&s!==void 0?s:void 0,h=lMe(e.getState(),d,f);e.dispatch(L6({activeDataKey:f,activeIndex:d,activeCoordinate:h}))}}}});var cMe=X5({brush:ywe,cartesianAxis:DSe,chartData:Aye,errorBars:KSe,graphicalItems:k_e,layout:Jde,legend:ohe,options:_ye,polarAxis:Qbe,polarOptions:sMe,referenceElements:Awe,rootProps:iMe,tooltip:Hve,zIndex:cye}),uMe=function(e){return Ede({reducer:cMe,preloadedState:e,middleware:n=>{var i;return n({serializableCheck:!1,immutableCheck:!["commonjs","es6","production"].includes((i="es6")!==null&&i!==void 0?i:"")}).concat([ZH.middleware,QH.middleware,GC.middleware,iG.middleware,aG.middleware])},enhancers:n=>{var i=n;return typeof n=="function"&&(i=n()),i.concat(lj({type:"raf"}))},devTools:Xf.devToolsEnabled})};function sG(t){var{preloadedState:e,children:n,reduxStoreName:i}=t,r=Ar(),a=T.useRef(null);if(r)return n;a.current==null&&(a.current=uMe(e));var s=t2;return T.createElement(_1e,{context:s,store:a.current},n)}function dMe(t){var{layout:e,margin:n}=t,i=In(),r=Ar();return T.useEffect(()=>{r||(i(Kde(e)),i(Yde(n)))},[i,r,e,n]),null}var oG=T.memo(dMe,db);function lG(t){var e=In();return T.useEffect(()=>{e(rMe(t))},[e,t]),null}function D4(t){var{zIndex:e,isPanorama:n}=t,i=n?"recharts-zindex-panorama-":"recharts-zindex-",r=AH("".concat(i).concat(e)),a=In();return T.useLayoutEffect(()=>(a(oye({zIndex:e,elementId:r,isPanorama:n})),()=>{a(lye({zIndex:e,isPanorama:n}))}),[a,e,r,n]),T.createElement("g",{tabIndex:-1,id:r})}function N4(t){var{children:e,isPanorama:n}=t,i=bt(Zxe);if(!i||i.length===0)return e;var r=i.filter(s=>s<0),a=i.filter(s=>s>0);return T.createElement(T.Fragment,null,r.map(s=>T.createElement(D4,{key:s,zIndex:s,isPanorama:n})),e,a.map(s=>T.createElement(D4,{key:s,zIndex:s,isPanorama:n})))}var fMe=["children"];function hMe(t,e){if(t==null)return{};var n,i,r=pMe(t,e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(i=0;i<a.length;i++)n=a[i],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function pMe(t,e){if(t==null)return{};var n={};for(var i in t)if({}.hasOwnProperty.call(t,i)){if(e.indexOf(i)!==-1)continue;n[i]=t[i]}return n}function iy(){return iy=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)({}).hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},iy.apply(null,arguments)}var mMe={width:"100%",height:"100%",display:"block"},gMe=T.forwardRef((t,e)=>{var n=f2(),i=h2(),r=Vj();if(!Vs(n)||!Vs(i))return null;var{children:a,otherAttributes:s,title:l,desc:c}=t,d,f;return s!=null&&(typeof s.tabIndex=="number"?d=s.tabIndex:d=r?0:void 0,typeof s.role=="string"?f=s.role:f=r?"application":void 0),T.createElement($T,iy({},s,{title:l,desc:c,role:f,tabIndex:d,width:n,height:i,style:mMe,ref:e}),a)}),vMe=t=>{var{children:e}=t,n=bt(ky);if(!n)return null;var{width:i,height:r,y:a,x:s}=n;return T.createElement($T,{width:i,height:r,x:s,y:a},e)},O4=T.forwardRef((t,e)=>{var{children:n}=t,i=hMe(t,fMe),r=Ar();return r?T.createElement(vMe,null,T.createElement(N4,{isPanorama:!0},n)):T.createElement(gMe,iy({ref:e},i),T.createElement(N4,{isPanorama:!1},n))});function xMe(){var t=In(),[e,n]=T.useState(null),i=bt(gfe);return T.useEffect(()=>{if(e!=null){var r=e.getBoundingClientRect(),a=r.width/e.offsetWidth;jn(a)&&a!==i&&t(Qde(a))}},[e,t,i]),n}function L4(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),n.push.apply(n,i)}return n}function yMe(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?L4(Object(n),!0).forEach(function(i){bMe(t,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):L4(Object(n)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(n,i))})}return t}function bMe(t,e,n){return(e=_Me(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function _Me(t){var e=SMe(t,"string");return typeof e=="symbol"?e:e+""}function SMe(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var i=n.call(t,e);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Nu(){return Nu=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)({}).hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},Nu.apply(null,arguments)}var wMe=()=>(Iye(),null);function ry(t){if(typeof t=="number")return t;if(typeof t=="string"){var e=parseFloat(t);if(!Number.isNaN(e))return e}return 0}var EMe=T.forwardRef((t,e)=>{var n,i,r=T.useRef(null),[a,s]=T.useState({containerWidth:ry((n=t.style)===null||n===void 0?void 0:n.width),containerHeight:ry((i=t.style)===null||i===void 0?void 0:i.height)}),l=T.useCallback((d,f)=>{s(h=>{var g=Math.round(d),m=Math.round(f);return h.containerWidth===g&&h.containerHeight===m?h:{containerWidth:g,containerHeight:m}})},[]),c=T.useCallback(d=>{if(typeof e=="function"&&e(d),d!=null&&typeof ResizeObserver<"u"){var{width:f,height:h}=d.getBoundingClientRect();l(f,h);var g=b=>{var{width:y,height:x}=b[0].contentRect;l(y,x)},m=new ResizeObserver(g);m.observe(d),r.current=m}},[e,l]);return T.useEffect(()=>()=>{var d=r.current;d?.disconnect()},[l]),T.createElement(T.Fragment,null,T.createElement(zy,{width:a.containerWidth,height:a.containerHeight}),T.createElement("div",Nu({ref:c},t)))}),MMe=T.forwardRef((t,e)=>{var{width:n,height:i}=t,[r,a]=T.useState({containerWidth:ry(n),containerHeight:ry(i)}),s=T.useCallback((c,d)=>{a(f=>{var h=Math.round(c),g=Math.round(d);return f.containerWidth===h&&f.containerHeight===g?f:{containerWidth:h,containerHeight:g}})},[]),l=T.useCallback(c=>{if(typeof e=="function"&&e(c),c!=null){var{width:d,height:f}=c.getBoundingClientRect();s(d,f)}},[e,s]);return T.createElement(T.Fragment,null,T.createElement(zy,{width:r.containerWidth,height:r.containerHeight}),T.createElement("div",Nu({ref:l},t)))}),AMe=T.forwardRef((t,e)=>{var{width:n,height:i}=t;return T.createElement(T.Fragment,null,T.createElement(zy,{width:n,height:i}),T.createElement("div",Nu({ref:e},t)))}),TMe=T.forwardRef((t,e)=>{var{width:n,height:i}=t;return Xo(n)||Xo(i)?T.createElement(MMe,Nu({},t,{ref:e})):T.createElement(AMe,Nu({},t,{ref:e}))});function CMe(t){return t===!0?EMe:TMe}var RMe=T.forwardRef((t,e)=>{var{children:n,className:i,height:r,onClick:a,onContextMenu:s,onDoubleClick:l,onMouseDown:c,onMouseEnter:d,onMouseLeave:f,onMouseMove:h,onMouseUp:g,onTouchEnd:m,onTouchMove:b,onTouchStart:y,style:x,width:v,responsive:w,dispatchTouchEvents:S=!0}=t,A=T.useRef(null),R=In(),[N,C]=T.useState(null),[F,P]=T.useState(null),L=xMe(),B=d2(),U=B?.width>0?B.width:v,$=B?.height>0?B.height:r,I=T.useCallback(he=>{L(he),typeof e=="function"&&e(he),C(he),P(he),he!=null&&(A.current=he)},[L,e,C,P]),W=T.useCallback(he=>{R(KH(he)),R(Ua({handler:a,reactEvent:he}))},[R,a]),X=T.useCallback(he=>{R(qA(he)),R(Ua({handler:d,reactEvent:he}))},[R,d]),V=T.useCallback(he=>{R(I6()),R(Ua({handler:f,reactEvent:he}))},[R,f]),Y=T.useCallback(he=>{R(qA(he)),R(Ua({handler:h,reactEvent:he}))},[R,h]),J=T.useCallback(()=>{R(nG())},[R]),se=T.useCallback(he=>{R(tG(he.key))},[R]),H=T.useCallback(he=>{R(Ua({handler:s,reactEvent:he}))},[R,s]),q=T.useCallback(he=>{R(Ua({handler:l,reactEvent:he}))},[R,l]),re=T.useCallback(he=>{R(Ua({handler:c,reactEvent:he}))},[R,c]),ce=T.useCallback(he=>{R(Ua({handler:g,reactEvent:he}))},[R,g]),ye=T.useCallback(he=>{R(Ua({handler:y,reactEvent:he}))},[R,y]),me=T.useCallback(he=>{S&&R(rG(he)),R(Ua({handler:b,reactEvent:he}))},[R,S,b]),be=T.useCallback(he=>{R(Ua({handler:m,reactEvent:he}))},[R,m]),Ne=CMe(w);return T.createElement(tH.Provider,{value:N},T.createElement(c5.Provider,{value:F},T.createElement(Ne,{width:U??x?.width,height:$??x?.height,className:dn("recharts-wrapper",i),style:yMe({position:"relative",cursor:"default",width:U,height:$},x),onClick:W,onContextMenu:H,onDoubleClick:q,onFocus:J,onKeyDown:se,onMouseDown:re,onMouseEnter:X,onMouseLeave:V,onMouseMove:Y,onMouseUp:ce,onTouchEnd:be,onTouchMove:me,onTouchStart:ye,ref:I},T.createElement(wMe,null),n)))}),PMe=["width","height","responsive","children","className","style","compact","title","desc"];function DMe(t,e){if(t==null)return{};var n,i,r=NMe(t,e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(i=0;i<a.length;i++)n=a[i],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function NMe(t,e){if(t==null)return{};var n={};for(var i in t)if({}.hasOwnProperty.call(t,i)){if(e.indexOf(i)!==-1)continue;n[i]=t[i]}return n}var cG=T.forwardRef((t,e)=>{var{width:n,height:i,responsive:r,children:a,className:s,style:l,compact:c,title:d,desc:f}=t,h=DMe(t,PMe),g=Jr(h);return c?T.createElement(T.Fragment,null,T.createElement(zy,{width:n,height:i}),T.createElement(O4,{otherAttributes:g,title:d,desc:f},a)):T.createElement(RMe,{className:s,style:l,width:n,height:i,responsive:r??!1,onClick:t.onClick,onMouseLeave:t.onMouseLeave,onMouseEnter:t.onMouseEnter,onMouseMove:t.onMouseMove,onMouseDown:t.onMouseDown,onMouseUp:t.onMouseUp,onContextMenu:t.onContextMenu,onDoubleClick:t.onDoubleClick,onTouchStart:t.onTouchStart,onTouchMove:t.onTouchMove,onTouchEnd:t.onTouchEnd},T.createElement(O4,{otherAttributes:g,title:d,desc:f,ref:e},T.createElement(Cwe,null,a)))});function YA(){return YA=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)({}).hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},YA.apply(null,arguments)}var OMe={top:5,right:5,bottom:5,left:5},LMe={accessibilityLayer:!0,barCategoryGap:"10%",barGap:4,layout:"horizontal",margin:OMe,responsive:!1,reverseStackOrder:!1,stackOffset:"none",syncMethod:"index"},uG=T.forwardRef(function(e,n){var i,r=Si(e.categoricalChartProps,LMe),{chartName:a,defaultTooltipEventType:s,validateTooltipEventTypes:l,tooltipPayloadSearcher:c,categoricalChartProps:d}=e,f={chartName:a,defaultTooltipEventType:s,validateTooltipEventTypes:l,tooltipPayloadSearcher:c,eventEmitter:void 0};return T.createElement(sG,{preloadedState:{options:f},reduxStoreName:(i=d.id)!==null&&i!==void 0?i:a},T.createElement(UH,{chartData:d.data}),T.createElement(oG,{layout:r.layout,margin:r.margin}),T.createElement(lG,{baseValue:r.baseValue,accessibilityLayer:r.accessibilityLayer,barCategoryGap:r.barCategoryGap,maxBarSize:r.maxBarSize,stackOffset:r.stackOffset,barGap:r.barGap,barSize:r.barSize,syncId:r.syncId,syncMethod:r.syncMethod,className:r.className,reverseStackOrder:r.reverseStackOrder}),T.createElement(cG,YA({},r,{ref:n})))}),IMe=["axis","item"],UMe=T.forwardRef((t,e)=>T.createElement(uG,{chartName:"BarChart",defaultTooltipEventType:"axis",validateTooltipEventTypes:IMe,tooltipPayloadSearcher:MC,categoricalChartProps:t,ref:e}));function kMe(t){var e=In();return T.useEffect(()=>{e(aMe(t))},[e,t]),null}var FMe=["layout"];function KA(){return KA=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)({}).hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},KA.apply(null,arguments)}function zMe(t,e){if(t==null)return{};var n,i,r=BMe(t,e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(i=0;i<a.length;i++)n=a[i],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function BMe(t,e){if(t==null)return{};var n={};for(var i in t)if({}.hasOwnProperty.call(t,i)){if(e.indexOf(i)!==-1)continue;n[i]=t[i]}return n}var jMe={top:5,right:5,bottom:5,left:5},dG={accessibilityLayer:!0,stackOffset:"none",barCategoryGap:"10%",barGap:4,margin:jMe,reverseStackOrder:!1,syncMethod:"index",layout:"radial",responsive:!1,cx:"50%",cy:"50%",innerRadius:0,outerRadius:"80%"},HMe=T.forwardRef(function(e,n){var i,r=Si(e.categoricalChartProps,dG),{layout:a}=r,s=zMe(r,FMe),{chartName:l,defaultTooltipEventType:c,validateTooltipEventTypes:d,tooltipPayloadSearcher:f}=e,h={chartName:l,defaultTooltipEventType:c,validateTooltipEventTypes:d,tooltipPayloadSearcher:f,eventEmitter:void 0};return T.createElement(sG,{preloadedState:{options:h},reduxStoreName:(i=r.id)!==null&&i!==void 0?i:l},T.createElement(UH,{chartData:r.data}),T.createElement(oG,{layout:a,margin:r.margin}),T.createElement(lG,{baseValue:void 0,accessibilityLayer:r.accessibilityLayer,barCategoryGap:r.barCategoryGap,maxBarSize:r.maxBarSize,stackOffset:r.stackOffset,barGap:r.barGap,barSize:r.barSize,syncId:r.syncId,syncMethod:r.syncMethod,className:r.className,reverseStackOrder:r.reverseStackOrder}),T.createElement(kMe,{cx:r.cx,cy:r.cy,startAngle:r.startAngle,endAngle:r.endAngle,innerRadius:r.innerRadius,outerRadius:r.outerRadius}),T.createElement(cG,KA({},s,{ref:n})))});function I4(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),n.push.apply(n,i)}return n}function U4(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?I4(Object(n),!0).forEach(function(i){GMe(t,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):I4(Object(n)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(n,i))})}return t}function GMe(t,e,n){return(e=VMe(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function VMe(t){var e=$Me(t,"string");return typeof e=="symbol"?e:e+""}function $Me(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var i=n.call(t,e);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var WMe=["item"],XMe=U4(U4({},dG),{},{layout:"centric",startAngle:0,endAngle:360}),qMe=T.forwardRef((t,e)=>{var n=Si(t,XMe);return T.createElement(HMe,{chartName:"PieChart",defaultTooltipEventType:"item",validateTooltipEventTypes:WMe,tooltipPayloadSearcher:MC,categoricalChartProps:n,ref:e})}),YMe=["axis"],KMe=T.forwardRef((t,e)=>T.createElement(uG,{chartName:"AreaChart",defaultTooltipEventType:"axis",validateTooltipEventTypes:YMe,tooltipPayloadSearcher:MC,categoricalChartProps:t,ref:e}));const k4=["#00ae42","#3b82f6","#f59e0b","#ef4444","#8b5cf6","#ec4899","#14b8a6","#f97316"];function ZMe(t){const e=new Date;switch(t){case"7d":return new Date(e.getTime()-10080*60*1e3);case"30d":return new Date(e.getTime()-720*60*60*1e3);case"90d":return new Date(e.getTime()-2160*60*60*1e3);case"365d":return new Date(e.getTime()-365*24*60*60*1e3);case"all":return new Date(0)}}function QMe({archives:t,currency:e="$"}){const[n,i]=T.useState("30d"),r=T.useMemo(()=>{const g=ZMe(n);return t.filter(m=>new Date(m.completed_at||m.created_at)>=g)},[t,n]),a=T.useMemo(()=>{const g=new Map;return r.forEach(m=>{const y=new Date(m.completed_at||m.created_at).toISOString().split("T")[0],x=g.get(y)||{date:y,filament:0,cost:0,prints:0};x.filament+=m.filament_used_grams||0,x.cost+=m.cost||0,x.prints+=1,g.set(y,x)}),Array.from(g.values()).sort((m,b)=>m.date.localeCompare(b.date)).map(m=>({...m,dateLabel:new Date(m.date).toLocaleDateString("en-US",{month:"short",day:"numeric"})}))},[r]),s=T.useMemo(()=>{if(n==="7d"||n==="30d")return a;const g=new Map;return r.forEach(m=>{const b=new Date(m.completed_at||m.created_at),y=new Date(b);y.setDate(b.getDate()-b.getDay());const x=y.toISOString().split("T")[0],v=g.get(x)||{week:x,filament:0,cost:0,prints:0};v.filament+=m.filament_used_grams||0,v.cost+=m.cost||0,v.prints+=1,g.set(x,v)}),Array.from(g.values()).sort((m,b)=>m.week.localeCompare(b.week)).map(m=>({date:m.week,dateLabel:`Week of ${new Date(m.week).toLocaleDateString("en-US",{month:"short",day:"numeric"})}`,...m}))},[r,a,n]),l=T.useMemo(()=>{const g=new Map;return r.forEach(m=>{const y=(m.filament_type||"Unknown").split(", ");y.forEach(x=>{const v=(m.filament_used_grams||0)/y.length;g.set(x,(g.get(x)||0)+v)})}),Array.from(g.entries()).map(([m,b])=>({name:m,value:Math.round(b)})).sort((m,b)=>b.value-m.value)},[r]),c=T.useMemo(()=>{const g=new Date,m=[];for(let b=5;b>=0;b--){const y=new Date(g.getFullYear(),g.getMonth()-b,1),x=new Date(g.getFullYear(),g.getMonth()-b+1,0),v=y.toLocaleDateString("en-US",{month:"short",year:"2-digit"}),w=t.filter(S=>{const A=new Date(S.completed_at||S.created_at);return A>=y&&A<=x});m.push({month:v,filament:Math.round(w.reduce((S,A)=>S+(A.filament_used_grams||0),0)),cost:w.reduce((S,A)=>S+(A.cost||0),0),prints:w.length})}return m},[t]),d=n==="7d"||n==="30d"?a:s,f=r.reduce((g,m)=>g+(m.filament_used_grams||0),0),h=r.reduce((g,m)=>g+(m.cost||0),0);return E.jsxs("div",{className:"space-y-6",children:[E.jsxs("div",{className:"flex items-center justify-between",children:[E.jsx("h3",{className:"text-lg font-semibold text-white",children:"Filament Usage Trends"}),E.jsx("div",{className:"flex gap-1 bg-bambu-dark rounded-lg p-1",children:["7d","30d","90d","365d","all"].map(g=>E.jsx("button",{onClick:()=>i(g),className:`px-3 py-1 text-sm rounded-md transition-colors ${n===g?"bg-bambu-green text-white":"text-bambu-gray hover:text-white"}`,children:g==="all"?"All":g.replace("d","D")},g))})]}),E.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[E.jsxs("div",{className:"bg-bambu-dark rounded-lg p-4",children:[E.jsx("p",{className:"text-sm text-bambu-gray",children:"Period Filament"}),E.jsxs("p",{className:"text-2xl font-bold text-white",children:[(f/1e3).toFixed(2),"kg"]}),E.jsxs("p",{className:"text-xs text-bambu-gray",children:[f.toFixed(0),"g total"]})]}),E.jsxs("div",{className:"bg-bambu-dark rounded-lg p-4",children:[E.jsx("p",{className:"text-sm text-bambu-gray",children:"Period Cost"}),E.jsxs("p",{className:"text-2xl font-bold text-white",children:[e,h.toFixed(2)]}),E.jsxs("p",{className:"text-xs text-bambu-gray",children:[r.length," prints"]})]}),E.jsxs("div",{className:"bg-bambu-dark rounded-lg p-4",children:[E.jsx("p",{className:"text-sm text-bambu-gray",children:"Avg per Print"}),E.jsxs("p",{className:"text-2xl font-bold text-white",children:[r.length>0?(f/r.length).toFixed(0):0,"g"]}),E.jsxs("p",{className:"text-xs text-bambu-gray",children:[e,r.length>0?(h/r.length).toFixed(2):"0.00"," avg"]})]})]}),d.length>0?E.jsxs("div",{className:"bg-bambu-dark rounded-lg p-4",children:[E.jsx("h4",{className:"text-sm font-medium text-bambu-gray mb-4",children:"Usage Over Time"}),E.jsx(Kw,{width:"100%",height:250,children:E.jsxs(KMe,{data:d,children:[E.jsx("defs",{children:E.jsxs("linearGradient",{id:"colorFilament",x1:"0",y1:"0",x2:"0",y2:"1",children:[E.jsx("stop",{offset:"5%",stopColor:"#00ae42",stopOpacity:.3}),E.jsx("stop",{offset:"95%",stopColor:"#00ae42",stopOpacity:0})]})}),E.jsx(GA,{strokeDasharray:"3 3",stroke:"#3d3d3d"}),E.jsx($A,{dataKey:"dateLabel",stroke:"#9ca3af",tick:{fontSize:12},interval:"preserveStartEnd"}),E.jsx(XA,{stroke:"#9ca3af",tick:{fontSize:12},tickFormatter:g=>`${g}g`}),E.jsx(pE,{contentStyle:{backgroundColor:"#2d2d2d",border:"1px solid #3d3d3d",borderRadius:"8px"},labelStyle:{color:"#fff"},formatter:g=>[`${g.toFixed(0)}g`,"Filament"]}),E.jsx(qH,{type:"monotone",dataKey:"filament",stroke:"#00ae42",strokeWidth:2,fillOpacity:1,fill:"url(#colorFilament)"})]})})]}):E.jsx("div",{className:"bg-bambu-dark rounded-lg p-8 text-center text-bambu-gray",children:"No data for selected time range"}),E.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[E.jsxs("div",{className:"bg-bambu-dark rounded-lg p-4",children:[E.jsx("h4",{className:"text-sm font-medium text-bambu-gray mb-4",children:"By Filament Type"}),l.length>0?E.jsx(Kw,{width:"100%",height:200,children:E.jsxs(qMe,{children:[E.jsx(RH,{data:l,cx:"50%",cy:"50%",innerRadius:50,outerRadius:80,paddingAngle:2,dataKey:"value",label:({name:g,percent:m})=>`${g} ${((m||0)*100).toFixed(0)}%`,labelLine:!1,children:l.map((g,m)=>E.jsx(Wm,{fill:k4[m%k4.length]},`cell-${m}`))}),E.jsx(pE,{contentStyle:{backgroundColor:"#2d2d2d",border:"1px solid #3d3d3d",borderRadius:"8px"},formatter:g=>[`${g}g`,"Usage"]})]})}):E.jsx("div",{className:"h-[200px] flex items-center justify-center text-bambu-gray",children:"No filament data"})]}),E.jsxs("div",{className:"bg-bambu-dark rounded-lg p-4",children:[E.jsx("h4",{className:"text-sm font-medium text-bambu-gray mb-4",children:"Monthly Comparison"}),E.jsx(Kw,{width:"100%",height:200,children:E.jsxs(UMe,{data:c,children:[E.jsx(GA,{strokeDasharray:"3 3",stroke:"#3d3d3d"}),E.jsx($A,{dataKey:"month",stroke:"#9ca3af",tick:{fontSize:12}}),E.jsx(XA,{stroke:"#9ca3af",tick:{fontSize:12},tickFormatter:g=>`${g}g`}),E.jsx(pE,{contentStyle:{backgroundColor:"#2d2d2d",border:"1px solid #3d3d3d",borderRadius:"8px"},formatter:(g,m)=>[m==="filament"?`${g}g`:m==="cost"?`${e}${g.toFixed(2)}`:g,m==="filament"?"Filament":m==="cost"?"Cost":"Prints"]}),E.jsx(Gj,{}),E.jsx(LH,{dataKey:"filament",name:"Filament (g)",fill:"#00ae42",radius:[4,4,0,0]})]})})]})]})]})}function JMe(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return T.useMemo(()=>i=>{e.forEach(r=>r(i))},e)}const fb=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function ih(t){const e=Object.prototype.toString.call(t);return e==="[object Window]"||e==="[object global]"}function VC(t){return"nodeType"in t}function na(t){var e,n;return t?ih(t)?t:VC(t)&&(e=(n=t.ownerDocument)==null?void 0:n.defaultView)!=null?e:window:window}function $C(t){const{Document:e}=na(t);return t instanceof e}function qm(t){return ih(t)?!1:t instanceof na(t).HTMLElement}function fG(t){return t instanceof na(t).SVGElement}function rh(t){return t?ih(t)?t.document:VC(t)?$C(t)?t:qm(t)||fG(t)?t.ownerDocument:document:document:document}const Ws=fb?T.useLayoutEffect:T.useEffect;function WC(t){const e=T.useRef(t);return Ws(()=>{e.current=t}),T.useCallback(function(){for(var n=arguments.length,i=new Array(n),r=0;r<n;r++)i[r]=arguments[r];return e.current==null?void 0:e.current(...i)},[])}function eAe(){const t=T.useRef(null),e=T.useCallback((i,r)=>{t.current=setInterval(i,r)},[]),n=T.useCallback(()=>{t.current!==null&&(clearInterval(t.current),t.current=null)},[]);return[e,n]}function um(t,e){e===void 0&&(e=[t]);const n=T.useRef(t);return Ws(()=>{n.current!==t&&(n.current=t)},e),n}function Ym(t,e){const n=T.useRef();return T.useMemo(()=>{const i=t(n.current);return n.current=i,i},[...e])}function ay(t){const e=WC(t),n=T.useRef(null),i=T.useCallback(r=>{r!==n.current&&e?.(r,n.current),n.current=r},[]);return[n,i]}function ZA(t){const e=T.useRef();return T.useEffect(()=>{e.current=t},[t]),e.current}let PE={};function Km(t,e){return T.useMemo(()=>{if(e)return e;const n=PE[t]==null?0:PE[t]+1;return PE[t]=n,t+"-"+n},[t,e])}function hG(t){return function(e){for(var n=arguments.length,i=new Array(n>1?n-1:0),r=1;r<n;r++)i[r-1]=arguments[r];return i.reduce((a,s)=>{const l=Object.entries(s);for(const[c,d]of l){const f=a[c];f!=null&&(a[c]=f+t*d)}return a},{...e})}}const mf=hG(1),dm=hG(-1);function tAe(t){return"clientX"in t&&"clientY"in t}function XC(t){if(!t)return!1;const{KeyboardEvent:e}=na(t.target);return e&&t instanceof e}function nAe(t){if(!t)return!1;const{TouchEvent:e}=na(t.target);return e&&t instanceof e}function QA(t){if(nAe(t)){if(t.touches&&t.touches.length){const{clientX:e,clientY:n}=t.touches[0];return{x:e,y:n}}else if(t.changedTouches&&t.changedTouches.length){const{clientX:e,clientY:n}=t.changedTouches[0];return{x:e,y:n}}}return tAe(t)?{x:t.clientX,y:t.clientY}:null}const fm=Object.freeze({Translate:{toString(t){if(!t)return;const{x:e,y:n}=t;return"translate3d("+(e?Math.round(e):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(t){if(!t)return;const{scaleX:e,scaleY:n}=t;return"scaleX("+e+") scaleY("+n+")"}},Transform:{toString(t){if(t)return[fm.Translate.toString(t),fm.Scale.toString(t)].join(" ")}},Transition:{toString(t){let{property:e,duration:n,easing:i}=t;return e+" "+n+"ms "+i}}}),F4="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function iAe(t){return t.matches(F4)?t:t.querySelector(F4)}const rAe={display:"none"};function aAe(t){let{id:e,value:n}=t;return Or.createElement("div",{id:e,style:rAe},n)}function sAe(t){let{id:e,announcement:n,ariaLiveType:i="assertive"}=t;const r={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return Or.createElement("div",{id:e,style:r,role:"status","aria-live":i,"aria-atomic":!0},n)}function oAe(){const[t,e]=T.useState("");return{announce:T.useCallback(i=>{i!=null&&e(i)},[]),announcement:t}}const pG=T.createContext(null);function lAe(t){const e=T.useContext(pG);T.useEffect(()=>{if(!e)throw new Error("useDndMonitor must be used within a children of <DndContext>");return e(t)},[t,e])}function cAe(){const[t]=T.useState(()=>new Set),e=T.useCallback(i=>(t.add(i),()=>t.delete(i)),[t]);return[T.useCallback(i=>{let{type:r,event:a}=i;t.forEach(s=>{var l;return(l=s[r])==null?void 0:l.call(s,a)})},[t]),e]}const uAe={draggable:`
  8095. To pick up a draggable item, press the space bar.
  8096. While dragging, use the arrow keys to move the item.
  8097. Press space again to drop the item in its new position, or press escape to cancel.
  8098. `},dAe={onDragStart(t){let{active:e}=t;return"Picked up draggable item "+e.id+"."},onDragOver(t){let{active:e,over:n}=t;return n?"Draggable item "+e.id+" was moved over droppable area "+n.id+".":"Draggable item "+e.id+" is no longer over a droppable area."},onDragEnd(t){let{active:e,over:n}=t;return n?"Draggable item "+e.id+" was dropped over droppable area "+n.id:"Draggable item "+e.id+" was dropped."},onDragCancel(t){let{active:e}=t;return"Dragging was cancelled. Draggable item "+e.id+" was dropped."}};function fAe(t){let{announcements:e=dAe,container:n,hiddenTextDescribedById:i,screenReaderInstructions:r=uAe}=t;const{announce:a,announcement:s}=oAe(),l=Km("DndLiveRegion"),[c,d]=T.useState(!1);if(T.useEffect(()=>{d(!0)},[]),lAe(T.useMemo(()=>({onDragStart(h){let{active:g}=h;a(e.onDragStart({active:g}))},onDragMove(h){let{active:g,over:m}=h;e.onDragMove&&a(e.onDragMove({active:g,over:m}))},onDragOver(h){let{active:g,over:m}=h;a(e.onDragOver({active:g,over:m}))},onDragEnd(h){let{active:g,over:m}=h;a(e.onDragEnd({active:g,over:m}))},onDragCancel(h){let{active:g,over:m}=h;a(e.onDragCancel({active:g,over:m}))}}),[a,e])),!c)return null;const f=Or.createElement(Or.Fragment,null,Or.createElement(aAe,{id:i,value:r.draggable}),Or.createElement(sAe,{id:l,announcement:s}));return n?Zl.createPortal(f,n):f}var Ci;(function(t){t.DragStart="dragStart",t.DragMove="dragMove",t.DragEnd="dragEnd",t.DragCancel="dragCancel",t.DragOver="dragOver",t.RegisterDroppable="registerDroppable",t.SetDroppableDisabled="setDroppableDisabled",t.UnregisterDroppable="unregisterDroppable"})(Ci||(Ci={}));function sy(){}function z4(t,e){return T.useMemo(()=>({sensor:t,options:e??{}}),[t,e])}function hAe(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return T.useMemo(()=>[...e].filter(i=>i!=null),[...e])}const _s=Object.freeze({x:0,y:0});function mG(t,e){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))}function gG(t,e){let{data:{value:n}}=t,{data:{value:i}}=e;return n-i}function pAe(t,e){let{data:{value:n}}=t,{data:{value:i}}=e;return i-n}function B4(t){let{left:e,top:n,height:i,width:r}=t;return[{x:e,y:n},{x:e+r,y:n},{x:e,y:n+i},{x:e+r,y:n+i}]}function vG(t,e){if(!t||t.length===0)return null;const[n]=t;return n[e]}function j4(t,e,n){return e===void 0&&(e=t.left),n===void 0&&(n=t.top),{x:e+t.width*.5,y:n+t.height*.5}}const mAe=t=>{let{collisionRect:e,droppableRects:n,droppableContainers:i}=t;const r=j4(e,e.left,e.top),a=[];for(const s of i){const{id:l}=s,c=n.get(l);if(c){const d=mG(j4(c),r);a.push({id:l,data:{droppableContainer:s,value:d}})}}return a.sort(gG)},gAe=t=>{let{collisionRect:e,droppableRects:n,droppableContainers:i}=t;const r=B4(e),a=[];for(const s of i){const{id:l}=s,c=n.get(l);if(c){const d=B4(c),f=r.reduce((g,m,b)=>g+mG(d[b],m),0),h=Number((f/4).toFixed(4));a.push({id:l,data:{droppableContainer:s,value:h}})}}return a.sort(gG)};function vAe(t,e){const n=Math.max(e.top,t.top),i=Math.max(e.left,t.left),r=Math.min(e.left+e.width,t.left+t.width),a=Math.min(e.top+e.height,t.top+t.height),s=r-i,l=a-n;if(i<r&&n<a){const c=e.width*e.height,d=t.width*t.height,f=s*l,h=f/(c+d-f);return Number(h.toFixed(4))}return 0}const xAe=t=>{let{collisionRect:e,droppableRects:n,droppableContainers:i}=t;const r=[];for(const a of i){const{id:s}=a,l=n.get(s);if(l){const c=vAe(l,e);c>0&&r.push({id:s,data:{droppableContainer:a,value:c}})}}return r.sort(pAe)};function yAe(t,e,n){return{...t,scaleX:e&&n?e.width/n.width:1,scaleY:e&&n?e.height/n.height:1}}function xG(t,e){return t&&e?{x:t.left-e.left,y:t.top-e.top}:_s}function bAe(t){return function(n){for(var i=arguments.length,r=new Array(i>1?i-1:0),a=1;a<i;a++)r[a-1]=arguments[a];return r.reduce((s,l)=>({...s,top:s.top+t*l.y,bottom:s.bottom+t*l.y,left:s.left+t*l.x,right:s.right+t*l.x}),{...n})}}const _Ae=bAe(1);function SAe(t){if(t.startsWith("matrix3d(")){const e=t.slice(9,-1).split(/, /);return{x:+e[12],y:+e[13],scaleX:+e[0],scaleY:+e[5]}}else if(t.startsWith("matrix(")){const e=t.slice(7,-1).split(/, /);return{x:+e[4],y:+e[5],scaleX:+e[0],scaleY:+e[3]}}return null}function wAe(t,e,n){const i=SAe(e);if(!i)return t;const{scaleX:r,scaleY:a,x:s,y:l}=i,c=t.left-s-(1-r)*parseFloat(n),d=t.top-l-(1-a)*parseFloat(n.slice(n.indexOf(" ")+1)),f=r?t.width/r:t.width,h=a?t.height/a:t.height;return{width:f,height:h,top:d,right:c+f,bottom:d+h,left:c}}const EAe={ignoreTransform:!1};function ah(t,e){e===void 0&&(e=EAe);let n=t.getBoundingClientRect();if(e.ignoreTransform){const{transform:d,transformOrigin:f}=na(t).getComputedStyle(t);d&&(n=wAe(n,d,f))}const{top:i,left:r,width:a,height:s,bottom:l,right:c}=n;return{top:i,left:r,width:a,height:s,bottom:l,right:c}}function H4(t){return ah(t,{ignoreTransform:!0})}function MAe(t){const e=t.innerWidth,n=t.innerHeight;return{top:0,left:0,right:e,bottom:n,width:e,height:n}}function AAe(t,e){return e===void 0&&(e=na(t).getComputedStyle(t)),e.position==="fixed"}function TAe(t,e){e===void 0&&(e=na(t).getComputedStyle(t));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(r=>{const a=e[r];return typeof a=="string"?n.test(a):!1})}function hb(t,e){const n=[];function i(r){if(e!=null&&n.length>=e||!r)return n;if($C(r)&&r.scrollingElement!=null&&!n.includes(r.scrollingElement))return n.push(r.scrollingElement),n;if(!qm(r)||fG(r)||n.includes(r))return n;const a=na(t).getComputedStyle(r);return r!==t&&TAe(r,a)&&n.push(r),AAe(r,a)?n:i(r.parentNode)}return t?i(t):n}function yG(t){const[e]=hb(t,1);return e??null}function DE(t){return!fb||!t?null:ih(t)?t:VC(t)?$C(t)||t===rh(t).scrollingElement?window:qm(t)?t:null:null}function bG(t){return ih(t)?t.scrollX:t.scrollLeft}function _G(t){return ih(t)?t.scrollY:t.scrollTop}function JA(t){return{x:bG(t),y:_G(t)}}var Yi;(function(t){t[t.Forward=1]="Forward",t[t.Backward=-1]="Backward"})(Yi||(Yi={}));function SG(t){return!fb||!t?!1:t===document.scrollingElement}function wG(t){const e={x:0,y:0},n=SG(t)?{height:window.innerHeight,width:window.innerWidth}:{height:t.clientHeight,width:t.clientWidth},i={x:t.scrollWidth-n.width,y:t.scrollHeight-n.height},r=t.scrollTop<=e.y,a=t.scrollLeft<=e.x,s=t.scrollTop>=i.y,l=t.scrollLeft>=i.x;return{isTop:r,isLeft:a,isBottom:s,isRight:l,maxScroll:i,minScroll:e}}const CAe={x:.2,y:.2};function RAe(t,e,n,i,r){let{top:a,left:s,right:l,bottom:c}=n;i===void 0&&(i=10),r===void 0&&(r=CAe);const{isTop:d,isBottom:f,isLeft:h,isRight:g}=wG(t),m={x:0,y:0},b={x:0,y:0},y={height:e.height*r.y,width:e.width*r.x};return!d&&a<=e.top+y.height?(m.y=Yi.Backward,b.y=i*Math.abs((e.top+y.height-a)/y.height)):!f&&c>=e.bottom-y.height&&(m.y=Yi.Forward,b.y=i*Math.abs((e.bottom-y.height-c)/y.height)),!g&&l>=e.right-y.width?(m.x=Yi.Forward,b.x=i*Math.abs((e.right-y.width-l)/y.width)):!h&&s<=e.left+y.width&&(m.x=Yi.Backward,b.x=i*Math.abs((e.left+y.width-s)/y.width)),{direction:m,speed:b}}function PAe(t){if(t===document.scrollingElement){const{innerWidth:a,innerHeight:s}=window;return{top:0,left:0,right:a,bottom:s,width:a,height:s}}const{top:e,left:n,right:i,bottom:r}=t.getBoundingClientRect();return{top:e,left:n,right:i,bottom:r,width:t.clientWidth,height:t.clientHeight}}function EG(t){return t.reduce((e,n)=>mf(e,JA(n)),_s)}function DAe(t){return t.reduce((e,n)=>e+bG(n),0)}function NAe(t){return t.reduce((e,n)=>e+_G(n),0)}function OAe(t,e){if(e===void 0&&(e=ah),!t)return;const{top:n,left:i,bottom:r,right:a}=e(t);yG(t)&&(r<=0||a<=0||n>=window.innerHeight||i>=window.innerWidth)&&t.scrollIntoView({block:"center",inline:"center"})}const LAe=[["x",["left","right"],DAe],["y",["top","bottom"],NAe]];class qC{constructor(e,n){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const i=hb(n),r=EG(i);this.rect={...e},this.width=e.width,this.height=e.height;for(const[a,s,l]of LAe)for(const c of s)Object.defineProperty(this,c,{get:()=>{const d=l(i),f=r[a]-d;return this.rect[c]+f},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Dp{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var i;return(i=this.target)==null?void 0:i.removeEventListener(...n)})},this.target=e}add(e,n,i){var r;(r=this.target)==null||r.addEventListener(e,n,i),this.listeners.push([e,n,i])}}function IAe(t){const{EventTarget:e}=na(t);return t instanceof e?t:rh(t)}function NE(t,e){const n=Math.abs(t.x),i=Math.abs(t.y);return typeof e=="number"?Math.sqrt(n**2+i**2)>e:"x"in e&&"y"in e?n>e.x&&i>e.y:"x"in e?n>e.x:"y"in e?i>e.y:!1}var Ba;(function(t){t.Click="click",t.DragStart="dragstart",t.Keydown="keydown",t.ContextMenu="contextmenu",t.Resize="resize",t.SelectionChange="selectionchange",t.VisibilityChange="visibilitychange"})(Ba||(Ba={}));function G4(t){t.preventDefault()}function UAe(t){t.stopPropagation()}var an;(function(t){t.Space="Space",t.Down="ArrowDown",t.Right="ArrowRight",t.Left="ArrowLeft",t.Up="ArrowUp",t.Esc="Escape",t.Enter="Enter",t.Tab="Tab"})(an||(an={}));const MG={start:[an.Space,an.Enter],cancel:[an.Esc],end:[an.Space,an.Enter,an.Tab]},kAe=(t,e)=>{let{currentCoordinates:n}=e;switch(t.code){case an.Right:return{...n,x:n.x+25};case an.Left:return{...n,x:n.x-25};case an.Down:return{...n,y:n.y+25};case an.Up:return{...n,y:n.y-25}}};class YC{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=e;const{event:{target:n}}=e;this.props=e,this.listeners=new Dp(rh(n)),this.windowListeners=new Dp(na(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Ba.Resize,this.handleCancel),this.windowListeners.add(Ba.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Ba.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:e,onStart:n}=this.props,i=e.node.current;i&&OAe(i),n(_s)}handleKeyDown(e){if(XC(e)){const{active:n,context:i,options:r}=this.props,{keyboardCodes:a=MG,coordinateGetter:s=kAe,scrollBehavior:l="smooth"}=r,{code:c}=e;if(a.end.includes(c)){this.handleEnd(e);return}if(a.cancel.includes(c)){this.handleCancel(e);return}const{collisionRect:d}=i.current,f=d?{x:d.left,y:d.top}:_s;this.referenceCoordinates||(this.referenceCoordinates=f);const h=s(e,{active:n,context:i.current,currentCoordinates:f});if(h){const g=dm(h,f),m={x:0,y:0},{scrollableAncestors:b}=i.current;for(const y of b){const x=e.code,{isTop:v,isRight:w,isLeft:S,isBottom:A,maxScroll:R,minScroll:N}=wG(y),C=PAe(y),F={x:Math.min(x===an.Right?C.right-C.width/2:C.right,Math.max(x===an.Right?C.left:C.left+C.width/2,h.x)),y:Math.min(x===an.Down?C.bottom-C.height/2:C.bottom,Math.max(x===an.Down?C.top:C.top+C.height/2,h.y))},P=x===an.Right&&!w||x===an.Left&&!S,L=x===an.Down&&!A||x===an.Up&&!v;if(P&&F.x!==h.x){const B=y.scrollLeft+g.x,U=x===an.Right&&B<=R.x||x===an.Left&&B>=N.x;if(U&&!g.y){y.scrollTo({left:B,behavior:l});return}U?m.x=y.scrollLeft-B:m.x=x===an.Right?y.scrollLeft-R.x:y.scrollLeft-N.x,m.x&&y.scrollBy({left:-m.x,behavior:l});break}else if(L&&F.y!==h.y){const B=y.scrollTop+g.y,U=x===an.Down&&B<=R.y||x===an.Up&&B>=N.y;if(U&&!g.x){y.scrollTo({top:B,behavior:l});return}U?m.y=y.scrollTop-B:m.y=x===an.Down?y.scrollTop-R.y:y.scrollTop-N.y,m.y&&y.scrollBy({top:-m.y,behavior:l});break}}this.handleMove(e,mf(dm(h,this.referenceCoordinates),m))}}}handleMove(e,n){const{onMove:i}=this.props;e.preventDefault(),i(n)}handleEnd(e){const{onEnd:n}=this.props;e.preventDefault(),this.detach(),n()}handleCancel(e){const{onCancel:n}=this.props;e.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}YC.activators=[{eventName:"onKeyDown",handler:(t,e,n)=>{let{keyboardCodes:i=MG,onActivation:r}=e,{active:a}=n;const{code:s}=t.nativeEvent;if(i.start.includes(s)){const l=a.activatorNode.current;return l&&t.target!==l?!1:(t.preventDefault(),r?.({event:t.nativeEvent}),!0)}return!1}}];function V4(t){return!!(t&&"distance"in t)}function $4(t){return!!(t&&"delay"in t)}class KC{constructor(e,n,i){var r;i===void 0&&(i=IAe(e.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=e,this.events=n;const{event:a}=e,{target:s}=a;this.props=e,this.events=n,this.document=rh(s),this.documentListeners=new Dp(this.document),this.listeners=new Dp(i),this.windowListeners=new Dp(na(s)),this.initialCoordinates=(r=QA(a))!=null?r:_s,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:e,props:{options:{activationConstraint:n,bypassActivationConstraint:i}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),e.cancel&&this.listeners.add(e.cancel.name,this.handleCancel),this.windowListeners.add(Ba.Resize,this.handleCancel),this.windowListeners.add(Ba.DragStart,G4),this.windowListeners.add(Ba.VisibilityChange,this.handleCancel),this.windowListeners.add(Ba.ContextMenu,G4),this.documentListeners.add(Ba.Keydown,this.handleKeydown),n){if(i!=null&&i({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if($4(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(V4(n)){this.handlePending(n);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(e,n){const{active:i,onPending:r}=this.props;r(i,e,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:e}=this,{onStart:n}=this.props;e&&(this.activated=!0,this.documentListeners.add(Ba.Click,UAe,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Ba.SelectionChange,this.removeTextSelection),n(e))}handleMove(e){var n;const{activated:i,initialCoordinates:r,props:a}=this,{onMove:s,options:{activationConstraint:l}}=a;if(!r)return;const c=(n=QA(e))!=null?n:_s,d=dm(r,c);if(!i&&l){if(V4(l)){if(l.tolerance!=null&&NE(d,l.tolerance))return this.handleCancel();if(NE(d,l.distance))return this.handleStart()}if($4(l)&&NE(d,l.tolerance))return this.handleCancel();this.handlePending(l,d);return}e.cancelable&&e.preventDefault(),s(c)}handleEnd(){const{onAbort:e,onEnd:n}=this.props;this.detach(),this.activated||e(this.props.active),n()}handleCancel(){const{onAbort:e,onCancel:n}=this.props;this.detach(),this.activated||e(this.props.active),n()}handleKeydown(e){e.code===an.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}}const FAe={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class ZC extends KC{constructor(e){const{event:n}=e,i=rh(n.target);super(e,FAe,i)}}ZC.activators=[{eventName:"onPointerDown",handler:(t,e)=>{let{nativeEvent:n}=t,{onActivation:i}=e;return!n.isPrimary||n.button!==0?!1:(i?.({event:n}),!0)}}];const zAe={move:{name:"mousemove"},end:{name:"mouseup"}};var eT;(function(t){t[t.RightClick=2]="RightClick"})(eT||(eT={}));class BAe extends KC{constructor(e){super(e,zAe,rh(e.event.target))}}BAe.activators=[{eventName:"onMouseDown",handler:(t,e)=>{let{nativeEvent:n}=t,{onActivation:i}=e;return n.button===eT.RightClick?!1:(i?.({event:n}),!0)}}];const OE={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class jAe extends KC{constructor(e){super(e,OE)}static setup(){return window.addEventListener(OE.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(OE.move.name,e)};function e(){}}}jAe.activators=[{eventName:"onTouchStart",handler:(t,e)=>{let{nativeEvent:n}=t,{onActivation:i}=e;const{touches:r}=n;return r.length>1?!1:(i?.({event:n}),!0)}}];var Np;(function(t){t[t.Pointer=0]="Pointer",t[t.DraggableRect=1]="DraggableRect"})(Np||(Np={}));var oy;(function(t){t[t.TreeOrder=0]="TreeOrder",t[t.ReversedTreeOrder=1]="ReversedTreeOrder"})(oy||(oy={}));function HAe(t){let{acceleration:e,activator:n=Np.Pointer,canScroll:i,draggingRect:r,enabled:a,interval:s=5,order:l=oy.TreeOrder,pointerCoordinates:c,scrollableAncestors:d,scrollableAncestorRects:f,delta:h,threshold:g}=t;const m=VAe({delta:h,disabled:!a}),[b,y]=eAe(),x=T.useRef({x:0,y:0}),v=T.useRef({x:0,y:0}),w=T.useMemo(()=>{switch(n){case Np.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case Np.DraggableRect:return r}},[n,r,c]),S=T.useRef(null),A=T.useCallback(()=>{const N=S.current;if(!N)return;const C=x.current.x*v.current.x,F=x.current.y*v.current.y;N.scrollBy(C,F)},[]),R=T.useMemo(()=>l===oy.TreeOrder?[...d].reverse():d,[l,d]);T.useEffect(()=>{if(!a||!d.length||!w){y();return}for(const N of R){if(i?.(N)===!1)continue;const C=d.indexOf(N),F=f[C];if(!F)continue;const{direction:P,speed:L}=RAe(N,F,w,e,g);for(const B of["x","y"])m[B][P[B]]||(L[B]=0,P[B]=0);if(L.x>0||L.y>0){y(),S.current=N,b(A,s),x.current=L,v.current=P;return}}x.current={x:0,y:0},v.current={x:0,y:0},y()},[e,A,i,y,a,s,JSON.stringify(w),JSON.stringify(m),b,d,R,f,JSON.stringify(g)])}const GAe={x:{[Yi.Backward]:!1,[Yi.Forward]:!1},y:{[Yi.Backward]:!1,[Yi.Forward]:!1}};function VAe(t){let{delta:e,disabled:n}=t;const i=ZA(e);return Ym(r=>{if(n||!i||!r)return GAe;const a={x:Math.sign(e.x-i.x),y:Math.sign(e.y-i.y)};return{x:{[Yi.Backward]:r.x[Yi.Backward]||a.x===-1,[Yi.Forward]:r.x[Yi.Forward]||a.x===1},y:{[Yi.Backward]:r.y[Yi.Backward]||a.y===-1,[Yi.Forward]:r.y[Yi.Forward]||a.y===1}}},[n,e,i])}function $Ae(t,e){const n=e!=null?t.get(e):void 0,i=n?n.node.current:null;return Ym(r=>{var a;return e==null?null:(a=i??r)!=null?a:null},[i,e])}function WAe(t,e){return T.useMemo(()=>t.reduce((n,i)=>{const{sensor:r}=i,a=r.activators.map(s=>({eventName:s.eventName,handler:e(s.handler,i)}));return[...n,...a]},[]),[t,e])}var hm;(function(t){t[t.Always=0]="Always",t[t.BeforeDragging=1]="BeforeDragging",t[t.WhileDragging=2]="WhileDragging"})(hm||(hm={}));var tT;(function(t){t.Optimized="optimized"})(tT||(tT={}));const W4=new Map;function XAe(t,e){let{dragging:n,dependencies:i,config:r}=e;const[a,s]=T.useState(null),{frequency:l,measure:c,strategy:d}=r,f=T.useRef(t),h=x(),g=um(h),m=T.useCallback(function(v){v===void 0&&(v=[]),!g.current&&s(w=>w===null?v:w.concat(v.filter(S=>!w.includes(S))))},[g]),b=T.useRef(null),y=Ym(v=>{if(h&&!n)return W4;if(!v||v===W4||f.current!==t||a!=null){const w=new Map;for(let S of t){if(!S)continue;if(a&&a.length>0&&!a.includes(S.id)&&S.rect.current){w.set(S.id,S.rect.current);continue}const A=S.node.current,R=A?new qC(c(A),A):null;S.rect.current=R,R&&w.set(S.id,R)}return w}return v},[t,a,n,h,c]);return T.useEffect(()=>{f.current=t},[t]),T.useEffect(()=>{h||m()},[n,h]),T.useEffect(()=>{a&&a.length>0&&s(null)},[JSON.stringify(a)]),T.useEffect(()=>{h||typeof l!="number"||b.current!==null||(b.current=setTimeout(()=>{m(),b.current=null},l))},[l,h,m,...i]),{droppableRects:y,measureDroppableContainers:m,measuringScheduled:a!=null};function x(){switch(d){case hm.Always:return!1;case hm.BeforeDragging:return n;default:return!n}}}function AG(t,e){return Ym(n=>t?n||(typeof e=="function"?e(t):t):null,[e,t])}function qAe(t,e){return AG(t,e)}function YAe(t){let{callback:e,disabled:n}=t;const i=WC(e),r=T.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:a}=window;return new a(i)},[i,n]);return T.useEffect(()=>()=>r?.disconnect(),[r]),r}function pb(t){let{callback:e,disabled:n}=t;const i=WC(e),r=T.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:a}=window;return new a(i)},[n]);return T.useEffect(()=>()=>r?.disconnect(),[r]),r}function KAe(t){return new qC(ah(t),t)}function X4(t,e,n){e===void 0&&(e=KAe);const[i,r]=T.useState(null);function a(){r(c=>{if(!t)return null;if(t.isConnected===!1){var d;return(d=c??n)!=null?d:null}const f=e(t);return JSON.stringify(c)===JSON.stringify(f)?c:f})}const s=YAe({callback(c){if(t)for(const d of c){const{type:f,target:h}=d;if(f==="childList"&&h instanceof HTMLElement&&h.contains(t)){a();break}}}}),l=pb({callback:a});return Ws(()=>{a(),t?(l?.observe(t),s?.observe(document.body,{childList:!0,subtree:!0})):(l?.disconnect(),s?.disconnect())},[t]),i}function ZAe(t){const e=AG(t);return xG(t,e)}const q4=[];function QAe(t){const e=T.useRef(t),n=Ym(i=>t?i&&i!==q4&&t&&e.current&&t.parentNode===e.current.parentNode?i:hb(t):q4,[t]);return T.useEffect(()=>{e.current=t},[t]),n}function JAe(t){const[e,n]=T.useState(null),i=T.useRef(t),r=T.useCallback(a=>{const s=DE(a.target);s&&n(l=>l?(l.set(s,JA(s)),new Map(l)):null)},[]);return T.useEffect(()=>{const a=i.current;if(t!==a){s(a);const l=t.map(c=>{const d=DE(c);return d?(d.addEventListener("scroll",r,{passive:!0}),[d,JA(d)]):null}).filter(c=>c!=null);n(l.length?new Map(l):null),i.current=t}return()=>{s(t),s(a)};function s(l){l.forEach(c=>{const d=DE(c);d?.removeEventListener("scroll",r)})}},[r,t]),T.useMemo(()=>t.length?e?Array.from(e.values()).reduce((a,s)=>mf(a,s),_s):EG(t):_s,[t,e])}function Y4(t,e){e===void 0&&(e=[]);const n=T.useRef(null);return T.useEffect(()=>{n.current=null},e),T.useEffect(()=>{const i=t!==_s;i&&!n.current&&(n.current=t),!i&&n.current&&(n.current=null)},[t]),n.current?dm(t,n.current):_s}function eTe(t){T.useEffect(()=>{if(!fb)return;const e=t.map(n=>{let{sensor:i}=n;return i.setup==null?void 0:i.setup()});return()=>{for(const n of e)n?.()}},t.map(e=>{let{sensor:n}=e;return n}))}function tTe(t,e){return T.useMemo(()=>t.reduce((n,i)=>{let{eventName:r,handler:a}=i;return n[r]=s=>{a(s,e)},n},{}),[t,e])}function TG(t){return T.useMemo(()=>t?MAe(t):null,[t])}const K4=[];function nTe(t,e){e===void 0&&(e=ah);const[n]=t,i=TG(n?na(n):null),[r,a]=T.useState(K4);function s(){a(()=>t.length?t.map(c=>SG(c)?i:new qC(e(c),c)):K4)}const l=pb({callback:s});return Ws(()=>{l?.disconnect(),s(),t.forEach(c=>l?.observe(c))},[t]),r}function iTe(t){if(!t)return null;if(t.children.length>1)return t;const e=t.children[0];return qm(e)?e:t}function rTe(t){let{measure:e}=t;const[n,i]=T.useState(null),r=T.useCallback(d=>{for(const{target:f}of d)if(qm(f)){i(h=>{const g=e(f);return h?{...h,width:g.width,height:g.height}:g});break}},[e]),a=pb({callback:r}),s=T.useCallback(d=>{const f=iTe(d);a?.disconnect(),f&&a?.observe(f),i(f?e(f):null)},[e,a]),[l,c]=ay(s);return T.useMemo(()=>({nodeRef:l,rect:n,setRef:c}),[n,l,c])}const aTe=[{sensor:ZC,options:{}},{sensor:YC,options:{}}],sTe={current:{}},Vv={draggable:{measure:H4},droppable:{measure:H4,strategy:hm.WhileDragging,frequency:tT.Optimized},dragOverlay:{measure:ah}};class Op extends Map{get(e){var n;return e!=null&&(n=super.get(e))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(e=>{let{disabled:n}=e;return!n})}getNodeFor(e){var n,i;return(n=(i=this.get(e))==null?void 0:i.node.current)!=null?n:void 0}}const oTe={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Op,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:sy},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Vv,measureDroppableContainers:sy,windowRect:null,measuringScheduled:!1},lTe={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:sy,draggableNodes:new Map,over:null,measureDroppableContainers:sy},mb=T.createContext(lTe),CG=T.createContext(oTe);function cTe(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Op}}}function uTe(t,e){switch(e.type){case Ci.DragStart:return{...t,draggable:{...t.draggable,initialCoordinates:e.initialCoordinates,active:e.active}};case Ci.DragMove:return t.draggable.active==null?t:{...t,draggable:{...t.draggable,translate:{x:e.coordinates.x-t.draggable.initialCoordinates.x,y:e.coordinates.y-t.draggable.initialCoordinates.y}}};case Ci.DragEnd:case Ci.DragCancel:return{...t,draggable:{...t.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Ci.RegisterDroppable:{const{element:n}=e,{id:i}=n,r=new Op(t.droppable.containers);return r.set(i,n),{...t,droppable:{...t.droppable,containers:r}}}case Ci.SetDroppableDisabled:{const{id:n,key:i,disabled:r}=e,a=t.droppable.containers.get(n);if(!a||i!==a.key)return t;const s=new Op(t.droppable.containers);return s.set(n,{...a,disabled:r}),{...t,droppable:{...t.droppable,containers:s}}}case Ci.UnregisterDroppable:{const{id:n,key:i}=e,r=t.droppable.containers.get(n);if(!r||i!==r.key)return t;const a=new Op(t.droppable.containers);return a.delete(n),{...t,droppable:{...t.droppable,containers:a}}}default:return t}}function dTe(t){let{disabled:e}=t;const{active:n,activatorEvent:i,draggableNodes:r}=T.useContext(mb),a=ZA(i),s=ZA(n?.id);return T.useEffect(()=>{if(!e&&!i&&a&&s!=null){if(!XC(a)||document.activeElement===a.target)return;const l=r.get(s);if(!l)return;const{activatorNode:c,node:d}=l;if(!c.current&&!d.current)return;requestAnimationFrame(()=>{for(const f of[c.current,d.current]){if(!f)continue;const h=iAe(f);if(h){h.focus();break}}})}},[i,e,r,s,a]),null}function fTe(t,e){let{transform:n,...i}=e;return t!=null&&t.length?t.reduce((r,a)=>a({transform:r,...i}),n):n}function hTe(t){return T.useMemo(()=>({draggable:{...Vv.draggable,...t?.draggable},droppable:{...Vv.droppable,...t?.droppable},dragOverlay:{...Vv.dragOverlay,...t?.dragOverlay}}),[t?.draggable,t?.droppable,t?.dragOverlay])}function pTe(t){let{activeNode:e,measure:n,initialRect:i,config:r=!0}=t;const a=T.useRef(!1),{x:s,y:l}=typeof r=="boolean"?{x:r,y:r}:r;Ws(()=>{if(!s&&!l||!e){a.current=!1;return}if(a.current||!i)return;const d=e?.node.current;if(!d||d.isConnected===!1)return;const f=n(d),h=xG(f,i);if(s||(h.x=0),l||(h.y=0),a.current=!0,Math.abs(h.x)>0||Math.abs(h.y)>0){const g=yG(d);g&&g.scrollBy({top:h.y,left:h.x})}},[e,s,l,i,n])}const RG=T.createContext({..._s,scaleX:1,scaleY:1});var ql;(function(t){t[t.Uninitialized=0]="Uninitialized",t[t.Initializing=1]="Initializing",t[t.Initialized=2]="Initialized"})(ql||(ql={}));const mTe=T.memo(function(e){var n,i,r,a;let{id:s,accessibility:l,autoScroll:c=!0,children:d,sensors:f=aTe,collisionDetection:h=xAe,measuring:g,modifiers:m,...b}=e;const y=T.useReducer(uTe,void 0,cTe),[x,v]=y,[w,S]=cAe(),[A,R]=T.useState(ql.Uninitialized),N=A===ql.Initialized,{draggable:{active:C,nodes:F,translate:P},droppable:{containers:L}}=x,B=C!=null?F.get(C):null,U=T.useRef({initial:null,translated:null}),$=T.useMemo(()=>{var Le;return C!=null?{id:C,data:(Le=B?.data)!=null?Le:sTe,rect:U}:null},[C,B]),I=T.useRef(null),[W,X]=T.useState(null),[V,Y]=T.useState(null),J=um(b,Object.values(b)),se=Km("DndDescribedBy",s),H=T.useMemo(()=>L.getEnabled(),[L]),q=hTe(g),{droppableRects:re,measureDroppableContainers:ce,measuringScheduled:ye}=XAe(H,{dragging:N,dependencies:[P.x,P.y],config:q.droppable}),me=$Ae(F,C),be=T.useMemo(()=>V?QA(V):null,[V]),Ne=de(),he=qAe(me,q.draggable.measure);pTe({activeNode:C!=null?F.get(C):null,config:Ne.layoutShiftCompensation,initialRect:he,measure:q.draggable.measure});const Ae=X4(me,q.draggable.measure,he),Be=X4(me?me.parentElement:null),le=T.useRef({activatorEvent:null,active:null,activeNode:me,collisionRect:null,collisions:null,droppableRects:re,draggableNodes:F,draggingNode:null,draggingNodeRect:null,droppableContainers:L,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),lt=L.getNodeFor((n=le.current.over)==null?void 0:n.id),z=rTe({measure:q.dragOverlay.measure}),G=(i=z.nodeRef.current)!=null?i:me,ne=N?(r=z.rect)!=null?r:Ae:null,Q=!!(z.nodeRef.current&&z.rect),ee=ZAe(Q?null:Ae),ae=TG(G?na(G):null),ie=QAe(N?lt??me:null),we=nTe(ie),ve=fTe(m,{transform:{x:P.x-ee.x,y:P.y-ee.y,scaleX:1,scaleY:1},activatorEvent:V,active:$,activeNodeRect:Ae,containerNodeRect:Be,draggingNodeRect:ne,over:le.current.over,overlayNodeRect:z.rect,scrollableAncestors:ie,scrollableAncestorRects:we,windowRect:ae}),k=be?mf(be,P):null,O=JAe(ie),K=Y4(O),pe=Y4(O,[Ae]),xe=mf(ve,K),fe=ne?_Ae(ne,ve):null,Ke=$&&fe?h({active:$,collisionRect:fe,droppableRects:re,droppableContainers:H,pointerCoordinates:k}):null,Ie=vG(Ke,"id"),[$e,rt]=T.useState(null),ke=Q?ve:mf(ve,pe),De=yAe(ke,(a=$e?.rect)!=null?a:null,Ae),ct=T.useRef(null),et=T.useCallback((Le,Me)=>{let{sensor:ge,options:je}=Me;if(I.current==null)return;const at=F.get(I.current);if(!at)return;const mt=Le.nativeEvent,wt=new ge({active:I.current,activeNode:at,event:mt,options:je,context:le,onAbort(Ct){if(!F.get(Ct))return;const{onDragAbort:Rn}=J.current,zi={id:Ct};Rn?.(zi),w({type:"onDragAbort",event:zi})},onPending(Ct,mn,Rn,zi){if(!F.get(Ct))return;const{onDragPending:Bi}=J.current,tr={id:Ct,constraint:mn,initialCoordinates:Rn,offset:zi};Bi?.(tr),w({type:"onDragPending",event:tr})},onStart(Ct){const mn=I.current;if(mn==null)return;const Rn=F.get(mn);if(!Rn)return;const{onDragStart:zi}=J.current,wi={activatorEvent:mt,active:{id:mn,data:Rn.data,rect:U}};Zl.unstable_batchedUpdates(()=>{zi?.(wi),R(ql.Initializing),v({type:Ci.DragStart,initialCoordinates:Ct,active:mn}),w({type:"onDragStart",event:wi}),X(ct.current),Y(mt)})},onMove(Ct){v({type:Ci.DragMove,coordinates:Ct})},onEnd:Wt(Ci.DragEnd),onCancel:Wt(Ci.DragCancel)});ct.current=wt;function Wt(Ct){return async function(){const{active:Rn,collisions:zi,over:wi,scrollAdjustedTranslate:Bi}=le.current;let tr=null;if(Rn&&Bi){const{cancelDrop:mr}=J.current;tr={activatorEvent:mt,active:Rn,collisions:zi,delta:Bi,over:wi},Ct===Ci.DragEnd&&typeof mr=="function"&&await Promise.resolve(mr(tr))&&(Ct=Ci.DragCancel)}I.current=null,Zl.unstable_batchedUpdates(()=>{v({type:Ct}),R(ql.Uninitialized),rt(null),X(null),Y(null),ct.current=null;const mr=Ct===Ci.DragEnd?"onDragEnd":"onDragCancel";if(tr){const li=J.current[mr];li?.(tr),w({type:mr,event:tr})}})}}},[F]),Je=T.useCallback((Le,Me)=>(ge,je)=>{const at=ge.nativeEvent,mt=F.get(je);if(I.current!==null||!mt||at.dndKit||at.defaultPrevented)return;const wt={active:mt};Le(ge,Me.options,wt)===!0&&(at.dndKit={capturedBy:Me.sensor},I.current=je,et(ge,Me))},[F,et]),st=WAe(f,Je);eTe(f),Ws(()=>{Ae&&A===ql.Initializing&&R(ql.Initialized)},[Ae,A]),T.useEffect(()=>{const{onDragMove:Le}=J.current,{active:Me,activatorEvent:ge,collisions:je,over:at}=le.current;if(!Me||!ge)return;const mt={active:Me,activatorEvent:ge,collisions:je,delta:{x:xe.x,y:xe.y},over:at};Zl.unstable_batchedUpdates(()=>{Le?.(mt),w({type:"onDragMove",event:mt})})},[xe.x,xe.y]),T.useEffect(()=>{const{active:Le,activatorEvent:Me,collisions:ge,droppableContainers:je,scrollAdjustedTranslate:at}=le.current;if(!Le||I.current==null||!Me||!at)return;const{onDragOver:mt}=J.current,wt=je.get(Ie),Wt=wt&&wt.rect.current?{id:wt.id,rect:wt.rect.current,data:wt.data,disabled:wt.disabled}:null,Ct={active:Le,activatorEvent:Me,collisions:ge,delta:{x:at.x,y:at.y},over:Wt};Zl.unstable_batchedUpdates(()=>{rt(Wt),mt?.(Ct),w({type:"onDragOver",event:Ct})})},[Ie]),Ws(()=>{le.current={activatorEvent:V,active:$,activeNode:me,collisionRect:fe,collisions:Ke,droppableRects:re,draggableNodes:F,draggingNode:G,draggingNodeRect:ne,droppableContainers:L,over:$e,scrollableAncestors:ie,scrollAdjustedTranslate:xe},U.current={initial:ne,translated:fe}},[$,me,Ke,fe,F,G,ne,re,L,$e,ie,xe]),HAe({...Ne,delta:P,draggingRect:fe,pointerCoordinates:k,scrollableAncestors:ie,scrollableAncestorRects:we});const ue=T.useMemo(()=>({active:$,activeNode:me,activeNodeRect:Ae,activatorEvent:V,collisions:Ke,containerNodeRect:Be,dragOverlay:z,draggableNodes:F,droppableContainers:L,droppableRects:re,over:$e,measureDroppableContainers:ce,scrollableAncestors:ie,scrollableAncestorRects:we,measuringConfiguration:q,measuringScheduled:ye,windowRect:ae}),[$,me,Ae,V,Ke,Be,z,F,L,re,$e,ce,ie,we,q,ye,ae]),tt=T.useMemo(()=>({activatorEvent:V,activators:st,active:$,activeNodeRect:Ae,ariaDescribedById:{draggable:se},dispatch:v,draggableNodes:F,over:$e,measureDroppableContainers:ce}),[V,st,$,Ae,v,se,F,$e,ce]);return Or.createElement(pG.Provider,{value:S},Or.createElement(mb.Provider,{value:tt},Or.createElement(CG.Provider,{value:ue},Or.createElement(RG.Provider,{value:De},d)),Or.createElement(dTe,{disabled:l?.restoreFocus===!1})),Or.createElement(fAe,{...l,hiddenTextDescribedById:se}));function de(){const Le=W?.autoScrollEnabled===!1,Me=typeof c=="object"?c.enabled===!1:c===!1,ge=N&&!Le&&!Me;return typeof c=="object"?{...c,enabled:ge}:{enabled:ge}}}),gTe=T.createContext(null),Z4="button",vTe="Draggable";function xTe(t){let{id:e,data:n,disabled:i=!1,attributes:r}=t;const a=Km(vTe),{activators:s,activatorEvent:l,active:c,activeNodeRect:d,ariaDescribedById:f,draggableNodes:h,over:g}=T.useContext(mb),{role:m=Z4,roleDescription:b="draggable",tabIndex:y=0}=r??{},x=c?.id===e,v=T.useContext(x?RG:gTe),[w,S]=ay(),[A,R]=ay(),N=tTe(s,e),C=um(n);Ws(()=>(h.set(e,{id:e,key:a,node:w,activatorNode:A,data:C}),()=>{const P=h.get(e);P&&P.key===a&&h.delete(e)}),[h,e]);const F=T.useMemo(()=>({role:m,tabIndex:y,"aria-disabled":i,"aria-pressed":x&&m===Z4?!0:void 0,"aria-roledescription":b,"aria-describedby":f.draggable}),[i,m,y,x,b,f.draggable]);return{active:c,activatorEvent:l,activeNodeRect:d,attributes:F,isDragging:x,listeners:i?void 0:N,node:w,over:g,setNodeRef:S,setActivatorNodeRef:R,transform:v}}function yTe(){return T.useContext(CG)}const bTe="Droppable",_Te={timeout:25};function STe(t){let{data:e,disabled:n=!1,id:i,resizeObserverConfig:r}=t;const a=Km(bTe),{active:s,dispatch:l,over:c,measureDroppableContainers:d}=T.useContext(mb),f=T.useRef({disabled:n}),h=T.useRef(!1),g=T.useRef(null),m=T.useRef(null),{disabled:b,updateMeasurementsFor:y,timeout:x}={..._Te,...r},v=um(y??i),w=T.useCallback(()=>{if(!h.current){h.current=!0;return}m.current!=null&&clearTimeout(m.current),m.current=setTimeout(()=>{d(Array.isArray(v.current)?v.current:[v.current]),m.current=null},x)},[x]),S=pb({callback:w,disabled:b||!s}),A=T.useCallback((F,P)=>{S&&(P&&(S.unobserve(P),h.current=!1),F&&S.observe(F))},[S]),[R,N]=ay(A),C=um(e);return T.useEffect(()=>{!S||!R.current||(S.disconnect(),h.current=!1,S.observe(R.current))},[R,S]),T.useEffect(()=>(l({type:Ci.RegisterDroppable,element:{id:i,key:a,disabled:n,node:R,rect:g,data:C}}),()=>l({type:Ci.UnregisterDroppable,key:a,id:i})),[i]),T.useEffect(()=>{n!==f.current.disabled&&(l({type:Ci.SetDroppableDisabled,id:i,key:a,disabled:n}),f.current.disabled=n)},[i,a,n,l]),{active:s,rect:g,isOver:c?.id===i,node:R,over:c,setNodeRef:N}}function QC(t,e,n){const i=t.slice();return i.splice(n<0?i.length+n:n,0,i.splice(e,1)[0]),i}function wTe(t,e){return t.reduce((n,i,r)=>{const a=e.get(i);return a&&(n[r]=a),n},Array(t.length))}function Av(t){return t!==null&&t>=0}function ETe(t,e){if(t===e)return!0;if(t.length!==e.length)return!1;for(let n=0;n<t.length;n++)if(t[n]!==e[n])return!1;return!0}function MTe(t){return typeof t=="boolean"?{draggable:t,droppable:t}:t}const JC=t=>{let{rects:e,activeIndex:n,overIndex:i,index:r}=t;const a=QC(e,i,n),s=e[r],l=a[r];return!l||!s?null:{x:l.left-s.left,y:l.top-s.top,scaleX:l.width/s.width,scaleY:l.height/s.height}},PG="Sortable",DG=Or.createContext({activeIndex:-1,containerId:PG,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:JC,disabled:{draggable:!1,droppable:!1}});function ATe(t){let{children:e,id:n,items:i,strategy:r=JC,disabled:a=!1}=t;const{active:s,dragOverlay:l,droppableRects:c,over:d,measureDroppableContainers:f}=yTe(),h=Km(PG,n),g=l.rect!==null,m=T.useMemo(()=>i.map(N=>typeof N=="object"&&"id"in N?N.id:N),[i]),b=s!=null,y=s?m.indexOf(s.id):-1,x=d?m.indexOf(d.id):-1,v=T.useRef(m),w=!ETe(m,v.current),S=x!==-1&&y===-1||w,A=MTe(a);Ws(()=>{w&&b&&f(m)},[w,m,b,f]),T.useEffect(()=>{v.current=m},[m]);const R=T.useMemo(()=>({activeIndex:y,containerId:h,disabled:A,disableTransforms:S,items:m,overIndex:x,useDragOverlay:g,sortedRects:wTe(m,c),strategy:r}),[y,h,A.draggable,A.droppable,S,m,x,c,g,r]);return Or.createElement(DG.Provider,{value:R},e)}const TTe=t=>{let{id:e,items:n,activeIndex:i,overIndex:r}=t;return QC(n,i,r).indexOf(e)},CTe=t=>{let{containerId:e,isSorting:n,wasDragging:i,index:r,items:a,newIndex:s,previousItems:l,previousContainerId:c,transition:d}=t;return!d||!i||l!==a&&r===s?!1:n?!0:s!==r&&e===c},RTe={duration:200,easing:"ease"},NG="transform",PTe=fm.Transition.toString({property:NG,duration:0,easing:"linear"}),DTe={roleDescription:"sortable"};function NTe(t){let{disabled:e,index:n,node:i,rect:r}=t;const[a,s]=T.useState(null),l=T.useRef(n);return Ws(()=>{if(!e&&n!==l.current&&i.current){const c=r.current;if(c){const d=ah(i.current,{ignoreTransform:!0}),f={x:c.left-d.left,y:c.top-d.top,scaleX:c.width/d.width,scaleY:c.height/d.height};(f.x||f.y)&&s(f)}}n!==l.current&&(l.current=n)},[e,n,i,r]),T.useEffect(()=>{a&&s(null)},[a]),a}function OTe(t){let{animateLayoutChanges:e=CTe,attributes:n,disabled:i,data:r,getNewIndex:a=TTe,id:s,strategy:l,resizeObserverConfig:c,transition:d=RTe}=t;const{items:f,containerId:h,activeIndex:g,disabled:m,disableTransforms:b,sortedRects:y,overIndex:x,useDragOverlay:v,strategy:w}=T.useContext(DG),S=LTe(i,m),A=f.indexOf(s),R=T.useMemo(()=>({sortable:{containerId:h,index:A,items:f},...r}),[h,r,A,f]),N=T.useMemo(()=>f.slice(f.indexOf(s)),[f,s]),{rect:C,node:F,isOver:P,setNodeRef:L}=STe({id:s,data:R,disabled:S.droppable,resizeObserverConfig:{updateMeasurementsFor:N,...c}}),{active:B,activatorEvent:U,activeNodeRect:$,attributes:I,setNodeRef:W,listeners:X,isDragging:V,over:Y,setActivatorNodeRef:J,transform:se}=xTe({id:s,data:R,attributes:{...DTe,...n},disabled:S.draggable}),H=JMe(L,W),q=!!B,re=q&&!b&&Av(g)&&Av(x),ce=!v&&V,ye=ce&&re?se:null,be=re?ye??(l??w)({rects:y,activeNodeRect:$,activeIndex:g,overIndex:x,index:A}):null,Ne=Av(g)&&Av(x)?a({id:s,items:f,activeIndex:g,overIndex:x}):A,he=B?.id,Ae=T.useRef({activeId:he,items:f,newIndex:Ne,containerId:h}),Be=f!==Ae.current.items,le=e({active:B,containerId:h,isDragging:V,isSorting:q,id:s,index:A,items:f,newIndex:Ae.current.newIndex,previousItems:Ae.current.items,previousContainerId:Ae.current.containerId,transition:d,wasDragging:Ae.current.activeId!=null}),lt=NTe({disabled:!le,index:A,node:F,rect:C});return T.useEffect(()=>{q&&Ae.current.newIndex!==Ne&&(Ae.current.newIndex=Ne),h!==Ae.current.containerId&&(Ae.current.containerId=h),f!==Ae.current.items&&(Ae.current.items=f)},[q,Ne,h,f]),T.useEffect(()=>{if(he===Ae.current.activeId)return;if(he!=null&&Ae.current.activeId==null){Ae.current.activeId=he;return}const G=setTimeout(()=>{Ae.current.activeId=he},50);return()=>clearTimeout(G)},[he]),{active:B,activeIndex:g,attributes:I,data:R,rect:C,index:A,newIndex:Ne,items:f,isOver:P,isSorting:q,isDragging:V,listeners:X,node:F,overIndex:x,over:Y,setNodeRef:H,setActivatorNodeRef:J,setDroppableNodeRef:L,setDraggableNodeRef:W,transform:lt??be,transition:z()};function z(){if(lt||Be&&Ae.current.newIndex===A)return PTe;if(!(ce&&!XC(U)||!d)&&(q||le))return fm.Transition.toString({...d,property:NG})}}function LTe(t,e){var n,i;return typeof t=="boolean"?{draggable:t,droppable:!1}:{draggable:(n=t?.draggable)!=null?n:e.draggable,droppable:(i=t?.droppable)!=null?i:e.droppable}}function ly(t){if(!t)return!1;const e=t.data.current;return!!(e&&"sortable"in e&&typeof e.sortable=="object"&&"containerId"in e.sortable&&"items"in e.sortable&&"index"in e.sortable)}const ITe=[an.Down,an.Right,an.Up,an.Left],UTe=(t,e)=>{let{context:{active:n,collisionRect:i,droppableRects:r,droppableContainers:a,over:s,scrollableAncestors:l}}=e;if(ITe.includes(t.code)){if(t.preventDefault(),!n||!i)return;const c=[];a.getEnabled().forEach(h=>{if(!h||h!=null&&h.disabled)return;const g=r.get(h.id);if(g)switch(t.code){case an.Down:i.top<g.top&&c.push(h);break;case an.Up:i.top>g.top&&c.push(h);break;case an.Left:i.left>g.left&&c.push(h);break;case an.Right:i.left<g.left&&c.push(h);break}});const d=gAe({collisionRect:i,droppableRects:r,droppableContainers:c});let f=vG(d,"id");if(f===s?.id&&d.length>1&&(f=d[1].id),f!=null){const h=a.get(n.id),g=a.get(f),m=g?r.get(g.id):null,b=g?.node.current;if(b&&m&&h&&g){const x=hb(b).some((N,C)=>l[C]!==N),v=OG(h,g),w=kTe(h,g),S=x||!v?{x:0,y:0}:{x:w?i.width-m.width:0,y:w?i.height-m.height:0},A={x:m.left,y:m.top};return S.x&&S.y?A:dm(A,S)}}}};function OG(t,e){return!ly(t)||!ly(e)?!1:t.data.current.sortable.containerId===e.data.current.sortable.containerId}function kTe(t,e){return!ly(t)||!ly(e)||!OG(t,e)?!1:t.data.current.sortable.index<e.data.current.sortable.index}function FTe({id:t,title:e,children:n,isHidden:i,size:r,onToggleVisibility:a,onToggleSize:s}){const{attributes:l,listeners:c,setNodeRef:d,transform:f,transition:h,isDragging:g}=OTe({id:t}),m={transform:fm.Transform.toString(f),transition:h,opacity:g?.5:1};return i?null:E.jsxs("div",{ref:d,style:{...m,gridColumn:`span ${r}`},className:`bg-bambu-dark-secondary rounded-xl border border-bambu-dark-tertiary overflow-hidden ${g?"ring-2 ring-bambu-green shadow-lg":""}`,children:[E.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-bambu-dark-tertiary bg-bambu-dark/30",children:[E.jsxs("div",{className:"flex items-center gap-2",children:[E.jsx("button",{...l,...c,className:"cursor-grab active:cursor-grabbing p-1 hover:bg-bambu-dark-tertiary rounded transition-colors",title:"Drag to reorder",children:E.jsx(oX,{className:"w-4 h-4 text-bambu-gray"})}),E.jsx("h3",{className:"text-sm font-medium text-white",children:e})]}),E.jsxs("div",{className:"flex items-center gap-1",children:[E.jsx("button",{onClick:s,className:"p-1 hover:bg-bambu-dark-tertiary rounded transition-colors",title:`Size: ${r===1?"1/4":r===2?"1/2":"Full"} - Click to cycle`,children:r===4?E.jsx(TX,{className:"w-4 h-4 text-bambu-gray hover:text-white"}):E.jsx(MX,{className:"w-4 h-4 text-bambu-gray hover:text-white"})}),E.jsx("button",{onClick:a,className:"p-1 hover:bg-bambu-dark-tertiary rounded transition-colors",title:"Hide widget",children:E.jsx(jW,{className:"w-4 h-4 text-bambu-gray hover:text-white"})})]})]}),E.jsx("div",{className:"p-4",children:n})]})}function zTe({widgets:t,storageKey:e,columns:n=4}){const i=()=>{const x={};return t.forEach(v=>{x[v.id]=v.defaultSize||4}),x},[r,a]=T.useState(()=>{const x=localStorage.getItem(e);if(x)try{const v=JSON.parse(x);return v.sizes||(v.sizes=i()),v}catch{}return{order:t.map(v=>v.id),hidden:t.filter(v=>v.defaultVisible===!1).map(v=>v.id),sizes:i()}}),[s,l]=T.useState(!1);T.useEffect(()=>{localStorage.setItem(e,JSON.stringify(r))},[r,e]),T.useEffect(()=>{const v=t.map(w=>w.id).filter(w=>!r.order.includes(w));v.length>0&&a(w=>({...w,order:[...w.order,...v]}))},[t,r.order]);const c=hAe(z4(ZC,{activationConstraint:{distance:8}}),z4(YC,{coordinateGetter:UTe})),d=x=>{const{active:v,over:w}=x;w&&v.id!==w.id&&a(S=>{const A=S.order.indexOf(v.id),R=S.order.indexOf(w.id);return{...S,order:QC(S.order,A,R)}})},f=x=>{a(v=>({...v,hidden:v.hidden.includes(x)?v.hidden.filter(w=>w!==x):[...v.hidden,x]}))},h=x=>{a(v=>{const w=v.sizes[x]||4,S=w===1?2:w===2?4:1;return{...v,sizes:{...v.sizes,[x]:S}}})},g=()=>{const x={order:t.map(v=>v.id),hidden:t.filter(v=>v.defaultVisible===!1).map(v=>v.id),sizes:i()};a(x)},m=r.order.map(x=>t.find(v=>v.id===x)).filter(Boolean),b=m.filter(x=>!r.hidden.includes(x.id)),y=m.filter(x=>r.hidden.includes(x.id));return E.jsxs("div",{className:"space-y-4",children:[E.jsxs("div",{className:"flex items-center justify-end gap-2",children:[y.length>0&&E.jsxs(At,{variant:"secondary",size:"sm",onClick:()=>l(!s),children:[E.jsx(cN,{className:"w-4 h-4"}),y.length," Hidden"]}),E.jsxs(At,{variant:"secondary",size:"sm",onClick:g,children:[E.jsx(gT,{className:"w-4 h-4"}),"Reset Layout"]})]}),s&&y.length>0&&E.jsxs("div",{className:"p-4 bg-bambu-dark rounded-xl border border-bambu-dark-tertiary",children:[E.jsx("p",{className:"text-sm text-bambu-gray mb-3",children:"Hidden widgets (click to show):"}),E.jsx("div",{className:"flex flex-wrap gap-2",children:y.map(x=>E.jsxs("button",{onClick:()=>f(x.id),className:"px-3 py-1.5 bg-bambu-dark-tertiary hover:bg-bambu-green/20 rounded-lg text-sm text-white transition-colors flex items-center gap-2",children:[E.jsx(cN,{className:"w-3 h-3"}),x.title]},x.id))})]}),E.jsx(mTe,{sensors:c,collisionDetection:mAe,onDragEnd:d,children:E.jsx(ATe,{items:b.map(x=>x.id),strategy:JC,children:E.jsx("div",{className:"grid gap-6",style:{gridTemplateColumns:`repeat(${n}, minmax(0, 1fr))`},children:b.map(x=>E.jsx(FTe,{id:x.id,title:x.title,isHidden:r.hidden.includes(x.id),size:r.sizes[x.id]||2,onToggleVisibility:()=>f(x.id),onToggleSize:()=>h(x.id),children:x.component},x.id))})})}),b.length===0&&E.jsxs("div",{className:"text-center py-12 text-bambu-gray",children:[E.jsx("p",{children:"All widgets are hidden."}),E.jsx(At,{className:"mt-4",onClick:g,children:"Reset Layout"})]})]})}function BTe({stats:t,currency:e}){return E.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[E.jsxs("div",{className:"flex items-start gap-3",children:[E.jsx("div",{className:"p-2 rounded-lg bg-bambu-dark text-bambu-green",children:E.jsx(Yv,{className:"w-5 h-5"})}),E.jsxs("div",{children:[E.jsx("p",{className:"text-xs text-bambu-gray",children:"Total Prints"}),E.jsx("p",{className:"text-xl font-bold text-white",children:t?.total_prints||0})]})]}),E.jsxs("div",{className:"flex items-start gap-3",children:[E.jsx("div",{className:"p-2 rounded-lg bg-bambu-dark text-blue-400",children:E.jsx(dy,{className:"w-5 h-5"})}),E.jsxs("div",{children:[E.jsx("p",{className:"text-xs text-bambu-gray",children:"Print Time"}),E.jsxs("p",{className:"text-xl font-bold text-white",children:[t?.total_print_time_hours.toFixed(1)||0,"h"]})]})]}),E.jsxs("div",{className:"flex items-start gap-3",children:[E.jsx("div",{className:"p-2 rounded-lg bg-bambu-dark text-orange-400",children:E.jsx(Yv,{className:"w-5 h-5"})}),E.jsxs("div",{children:[E.jsx("p",{className:"text-xs text-bambu-gray",children:"Filament Used"}),E.jsxs("p",{className:"text-xl font-bold text-white",children:[((t?.total_filament_grams||0)/1e3).toFixed(2),"kg"]})]})]}),E.jsxs("div",{className:"flex items-start gap-3",children:[E.jsx("div",{className:"p-2 rounded-lg bg-bambu-dark text-green-400",children:E.jsx(OW,{className:"w-5 h-5"})}),E.jsxs("div",{children:[E.jsx("p",{className:"text-xs text-bambu-gray",children:"Total Cost"}),E.jsxs("p",{className:"text-xl font-bold text-white",children:[e," ",t?.total_cost.toFixed(2)||"0.00"]})]})]})]})}function jTe({stats:t}){const e=t?.total_prints?Math.round(t.successful_prints/t.total_prints*100):0;return E.jsxs("div",{className:"flex items-center gap-6",children:[E.jsxs("div",{className:"relative w-28 h-28",children:[E.jsxs("svg",{className:"w-full h-full -rotate-90",children:[E.jsx("circle",{cx:"56",cy:"56",r:"48",fill:"none",stroke:"#3d3d3d",strokeWidth:"10"}),E.jsx("circle",{cx:"56",cy:"56",r:"48",fill:"none",stroke:"#00ae42",strokeWidth:"10",strokeLinecap:"round",strokeDasharray:`${e*3.02} 302`})]}),E.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:E.jsxs("span",{className:"text-xl font-bold text-white",children:[e,"%"]})})]}),E.jsxs("div",{className:"space-y-2",children:[E.jsxs("div",{className:"flex items-center gap-2",children:[E.jsx(fT,{className:"w-4 h-4 text-bambu-green"}),E.jsx("span",{className:"text-sm text-bambu-gray",children:"Successful:"}),E.jsx("span",{className:"text-sm text-white font-medium",children:t?.successful_prints||0})]}),E.jsxs("div",{className:"flex items-center gap-2",children:[E.jsx(Pz,{className:"w-4 h-4 text-red-400"}),E.jsx("span",{className:"text-sm text-bambu-gray",children:"Failed:"}),E.jsx("span",{className:"text-sm text-white font-medium",children:t?.failed_prints||0})]})]})]})}function HTe({stats:t}){if(!t?.prints_by_filament_type||Object.keys(t.prints_by_filament_type).length===0)return E.jsx("p",{className:"text-bambu-gray text-center py-4",children:"No filament data available"});const e=Object.entries(t.prints_by_filament_type).sort(([,n],[,i])=>i-n);return E.jsx("div",{className:"space-y-3",children:e.map(([n,i])=>{const r=Math.round(i/(t.total_prints||1)*100);return E.jsxs("div",{children:[E.jsxs("div",{className:"flex justify-between text-sm mb-1",children:[E.jsx("span",{className:"text-white",children:n}),E.jsxs("span",{className:"text-bambu-gray",children:[i," prints"]})]}),E.jsx("div",{className:"h-2 bg-bambu-dark rounded-full",children:E.jsx("div",{className:"h-full bg-bambu-green rounded-full transition-all",style:{width:`${r}%`}})})]},n)})})}function GTe({printDates:t}){return E.jsx(Ble,{printDates:t,months:4})}function VTe({stats:t,printerMap:e}){return!t?.prints_by_printer||Object.keys(t.prints_by_printer).length===0?E.jsx("p",{className:"text-bambu-gray text-center py-4",children:"No printer data available"}):E.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:Object.entries(t.prints_by_printer).map(([n,i])=>E.jsxs("div",{className:"flex items-center gap-3 p-3 bg-bambu-dark rounded-lg",children:[E.jsx("div",{className:"p-2 bg-bambu-dark-tertiary rounded-lg",children:E.jsx(xu,{className:"w-4 h-4 text-bambu-green"})}),E.jsxs("div",{children:[E.jsx("p",{className:"text-white font-medium text-sm",children:e.get(n)||`Printer ${n}`}),E.jsxs("p",{className:"text-xs text-bambu-gray",children:[i," prints"]})]})]},n))})}function $Te({archives:t,currency:e}){return!t||t.length===0?E.jsx("p",{className:"text-bambu-gray text-center py-4",children:"No print data available"}):E.jsx(QMe,{archives:t,currency:e})}function WTe(){const{data:t,isLoading:e}=Ki({queryKey:["archiveStats"],queryFn:Mt.getArchiveStats}),{data:n}=Ki({queryKey:["printers"],queryFn:Mt.getPrinters}),{data:i}=Ki({queryKey:["archives"],queryFn:()=>Mt.getArchives(void 0,1e3,0)}),{data:r}=Ki({queryKey:["settings"],queryFn:Mt.getSettings}),a=r?.currency||"$",s=new Map(n?.map(d=>[String(d.id),d.name])||[]),l=i?.map(d=>d.created_at)||[];if(e)return E.jsx("div",{className:"p-8",children:E.jsx("div",{className:"text-center py-12 text-bambu-gray",children:"Loading statistics..."})});const c=[{id:"quick-stats",title:"Quick Stats",component:E.jsx(BTe,{stats:t,currency:a}),defaultSize:2},{id:"success-rate",title:"Success Rate",component:E.jsx(jTe,{stats:t}),defaultSize:1},{id:"filament-types",title:"Filament Types",component:E.jsx(HTe,{stats:t}),defaultSize:1},{id:"print-activity",title:"Print Activity",component:E.jsx(GTe,{printDates:l}),defaultSize:2},{id:"prints-by-printer",title:"Prints by Printer",component:E.jsx(VTe,{stats:t,printerMap:s}),defaultSize:2},{id:"filament-trends",title:"Filament Usage Trends",component:E.jsx($Te,{archives:i||[],currency:a}),defaultSize:4}];return E.jsxs("div",{className:"p-8",children:[E.jsxs("div",{className:"mb-6",children:[E.jsx("h1",{className:"text-2xl font-bold text-white",children:"Dashboard"}),E.jsx("p",{className:"text-bambu-gray",children:"Drag widgets to rearrange. Click the eye icon to hide."})]}),E.jsx(zTe,{widgets:c,storageKey:"bambusy-dashboard-layout"})]})}function XTe(){const t=wa(),[e,n]=T.useState(null),[i,r]=T.useState(!1),[a,s]=T.useState(!1),[l,c]=T.useState(!1),{data:d,isLoading:f}=Ki({queryKey:["settings"],queryFn:Mt.getSettings});T.useEffect(()=>{d&&!e&&n(d)},[d,e]),T.useEffect(()=>{if(d&&e){const x=d.auto_archive!==e.auto_archive||d.save_thumbnails!==e.save_thumbnails||d.default_filament_cost!==e.default_filament_cost||d.currency!==e.currency;r(x)}},[d,e]);const h=Qi({mutationFn:Mt.updateSettings,onSuccess:x=>{t.setQueryData(["settings"],x),n(x),r(!1),s(!0),setTimeout(()=>s(!1),2e3)}}),g=Qi({mutationFn:Mt.resetSettings,onSuccess:x=>{t.setQueryData(["settings"],x),n(x),r(!1)}}),m=()=>{e&&h.mutate(e)},b=()=>{c(!0)},y=(x,v)=>{e&&n({...e,[x]:v})};return f||!e?E.jsx("div",{className:"p-8 flex justify-center",children:E.jsx(pr,{className:"w-8 h-8 text-bambu-green animate-spin"})}):E.jsxs("div",{className:"p-8",children:[E.jsxs("div",{className:"mb-8 flex items-center justify-between",children:[E.jsxs("div",{children:[E.jsx("h1",{className:"text-2xl font-bold text-white",children:"Settings"}),E.jsx("p",{className:"text-bambu-gray",children:"Configure Bambusy"})]}),E.jsxs("div",{className:"flex gap-3",children:[E.jsxs(At,{variant:"secondary",onClick:b,disabled:g.isPending,children:[E.jsx(gT,{className:"w-4 h-4"}),"Reset"]}),E.jsxs(At,{onClick:m,disabled:!i||h.isPending,children:[h.isPending?E.jsx(pr,{className:"w-4 h-4 animate-spin"}):a?E.jsx(xW,{className:"w-4 h-4"}):E.jsx(Iz,{className:"w-4 h-4"}),a?"Saved!":"Save"]})]})]}),h.isError&&E.jsxs("div",{className:"mb-6 p-3 bg-red-500/20 border border-red-500/50 rounded-lg text-sm text-red-400",children:["Failed to save settings: ",h.error.message]}),E.jsxs("div",{className:"space-y-6 max-w-2xl",children:[E.jsxs(vi,{children:[E.jsx(Rv,{children:E.jsx("h2",{className:"text-lg font-semibold text-white",children:"Archive Settings"})}),E.jsxs(Pi,{className:"space-y-4",children:[E.jsxs("div",{className:"flex items-center justify-between",children:[E.jsxs("div",{children:[E.jsx("p",{className:"text-white",children:"Auto-archive prints"}),E.jsx("p",{className:"text-sm text-bambu-gray",children:"Automatically save 3MF files when prints complete"})]}),E.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[E.jsx("input",{type:"checkbox",checked:e.auto_archive,onChange:x=>y("auto_archive",x.target.checked),className:"sr-only peer"}),E.jsx("div",{className:"w-11 h-6 bg-bambu-dark-tertiary peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-bambu-green"})]})]}),E.jsxs("div",{className:"flex items-center justify-between",children:[E.jsxs("div",{children:[E.jsx("p",{className:"text-white",children:"Save thumbnails"}),E.jsx("p",{className:"text-sm text-bambu-gray",children:"Extract and save preview images from 3MF files"})]}),E.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[E.jsx("input",{type:"checkbox",checked:e.save_thumbnails,onChange:x=>y("save_thumbnails",x.target.checked),className:"sr-only peer"}),E.jsx("div",{className:"w-11 h-6 bg-bambu-dark-tertiary peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-bambu-green"})]})]})]})]}),E.jsxs(vi,{children:[E.jsx(Rv,{children:E.jsx("h2",{className:"text-lg font-semibold text-white",children:"Cost Tracking"})}),E.jsxs(Pi,{className:"space-y-4",children:[E.jsxs("div",{children:[E.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:"Default filament cost (per kg)"}),E.jsx("input",{type:"number",step:"0.01",min:"0",value:e.default_filament_cost,onChange:x=>y("default_filament_cost",parseFloat(x.target.value)||0),className:"w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none"})]}),E.jsxs("div",{children:[E.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:"Currency"}),E.jsxs("select",{value:e.currency,onChange:x=>y("currency",x.target.value),className:"w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none",children:[E.jsx("option",{value:"USD",children:"USD ($)"}),E.jsx("option",{value:"EUR",children:"EUR (€)"}),E.jsx("option",{value:"GBP",children:"GBP (£)"}),E.jsx("option",{value:"CHF",children:"CHF (Fr.)"}),E.jsx("option",{value:"JPY",children:"JPY (¥)"}),E.jsx("option",{value:"CNY",children:"CNY (¥)"}),E.jsx("option",{value:"CAD",children:"CAD ($)"}),E.jsx("option",{value:"AUD",children:"AUD ($)"})]})]})]})]}),E.jsxs(vi,{children:[E.jsx(Rv,{children:E.jsx("h2",{className:"text-lg font-semibold text-white",children:"About"})}),E.jsx(Pi,{children:E.jsxs("div",{className:"space-y-2 text-sm",children:[E.jsx("p",{className:"text-white",children:"Bambusy v0.1.0"}),E.jsx("p",{className:"text-bambu-gray",children:"Archive and manage your Bambu Lab 3MF files"}),E.jsx("p",{className:"text-bambu-gray",children:"Connect to printers via LAN mode (developer mode required)"})]})})]})]}),l&&E.jsx(zf,{title:"Reset Settings",message:"Reset all settings to defaults? This cannot be undone.",confirmText:"Reset",variant:"danger",onConfirm:()=>{g.mutate(),c(!1)},onCancel:()=>c(!1)})]})}function qTe({onSuccess:t}){const{showToast:e}=Lu(),[n,i]=T.useState("email"),[r,a]=T.useState(""),[s,l]=T.useState(""),[c,d]=T.useState(""),[f,h]=T.useState(""),[g,m]=T.useState("global"),b=Qi({mutationFn:()=>Mt.cloudLogin(r,s,g),onSuccess:S=>{S.success?(e("Logged in successfully"),t()):S.needs_verification?(e("Verification code sent to your email"),i("code")):e(S.message,"error")},onError:S=>{e(S.message,"error")}}),y=Qi({mutationFn:()=>Mt.cloudVerify(r,c),onSuccess:S=>{S.success?(e("Logged in successfully"),t()):e(S.message,"error")},onError:S=>{e(S.message,"error")}}),x=Qi({mutationFn:()=>Mt.cloudSetToken(f),onSuccess:()=>{e("Token set successfully"),t()},onError:S=>{e(S.message,"error")}}),v=S=>{S.preventDefault(),n==="email"?b.mutate():n==="code"?y.mutate():n==="token"&&x.mutate()},w=b.isPending||y.isPending||x.isPending;return E.jsxs(vi,{className:"max-w-md mx-auto",children:[E.jsx(Rv,{children:E.jsxs("div",{className:"flex items-center gap-2",children:[E.jsx(hT,{className:"w-5 h-5 text-bambu-green"}),E.jsx("h2",{className:"text-xl font-semibold text-white",children:"Connect to Bambu Cloud"})]})}),E.jsx(Pi,{children:E.jsxs("form",{onSubmit:v,className:"space-y-4",children:[n==="email"&&E.jsxs(E.Fragment,{children:[E.jsxs("div",{children:[E.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:"Email"}),E.jsx("input",{type:"email",value:r,onChange:S=>a(S.target.value),className:"w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none",placeholder:"your@email.com",required:!0})]}),E.jsxs("div",{children:[E.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:"Password"}),E.jsx("input",{type:"password",value:s,onChange:S=>l(S.target.value),className:"w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none",placeholder:"••••••••",required:!0})]}),E.jsxs("div",{children:[E.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:"Region"}),E.jsxs("select",{value:g,onChange:S=>m(S.target.value),className:"w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none",children:[E.jsx("option",{value:"global",children:"Global"}),E.jsx("option",{value:"china",children:"China"})]})]})]}),n==="code"&&E.jsxs("div",{children:[E.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:"Verification Code"}),E.jsxs("p",{className:"text-xs text-bambu-gray mb-2",children:["Check your email (",r,") for a 6-digit code"]}),E.jsx("input",{type:"text",value:c,onChange:S=>d(S.target.value.replace(/\D/g,"").slice(0,6)),className:"w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-center text-2xl tracking-widest focus:border-bambu-green focus:outline-none",placeholder:"000000",maxLength:6,required:!0})]}),n==="token"&&E.jsxs("div",{children:[E.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:"Access Token"}),E.jsx("p",{className:"text-xs text-bambu-gray mb-2",children:"Paste your Bambu Lab access token (from Bambu Studio)"}),E.jsx("textarea",{value:f,onChange:S=>h(S.target.value),className:"w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-xs font-mono focus:border-bambu-green focus:outline-none resize-none",placeholder:"eyJ...",rows:3,required:!0})]}),E.jsxs("div",{className:"flex gap-2",children:[n==="code"&&E.jsx(At,{type:"button",variant:"secondary",onClick:()=>i("email"),className:"flex-1",children:"Back"}),E.jsxs(At,{type:"submit",disabled:w,className:"flex-1",children:[w?E.jsx(pr,{className:"w-4 h-4 animate-spin"}):E.jsx(uN,{className:"w-4 h-4"}),n==="email"?"Login":n==="code"?"Verify":"Set Token"]})]}),n==="email"&&E.jsx("div",{className:"pt-4 border-t border-bambu-dark-tertiary",children:E.jsxs("button",{type:"button",onClick:()=>i("token"),className:"text-sm text-bambu-gray hover:text-white flex items-center gap-1",children:[E.jsx(hX,{className:"w-3 h-3"}),"Use access token instead"]})}),n==="token"&&E.jsx("div",{className:"pt-4 border-t border-bambu-dark-tertiary",children:E.jsxs("button",{type:"button",onClick:()=>i("email"),className:"text-sm text-bambu-gray hover:text-white flex items-center gap-1",children:[E.jsx(uN,{className:"w-3 h-3"}),"Login with email instead"]})})]})})]})}function YTe({setting:t,onClick:e}){return E.jsxs("button",{onClick:e,className:"w-full text-left p-3 bg-bambu-dark rounded-lg hover:bg-bambu-dark-tertiary transition-colors",children:[E.jsx("p",{className:"text-white font-medium truncate",children:t.name}),t.updated_time&&E.jsxs("p",{className:"text-xs text-bambu-gray mt-1",children:["Updated: ",new Date(t.updated_time).toLocaleDateString()]})]})}function KTe({setting:t,onClose:e}){const{data:n,isLoading:i}=Ki({queryKey:["cloudSettingDetail",t.setting_id],queryFn:()=>Mt.getCloudSettingDetail(t.setting_id)});return E.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4",children:E.jsx(vi,{className:"w-full max-w-2xl max-h-[90vh] flex flex-col",children:E.jsxs(Pi,{className:"p-0 flex flex-col h-full",children:[E.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-bambu-dark-tertiary",children:[E.jsxs("div",{children:[E.jsx("h2",{className:"text-xl font-semibold text-white",children:t.name}),E.jsxs("p",{className:"text-sm text-bambu-gray capitalize",children:[t.type," preset"]})]}),E.jsx("button",{onClick:e,className:"text-bambu-gray hover:text-white transition-colors",children:E.jsx(Ji,{className:"w-5 h-5"})})]}),E.jsx("div",{className:"flex-1 overflow-y-auto p-4",children:i?E.jsx("div",{className:"flex justify-center py-8",children:E.jsx(pr,{className:"w-8 h-8 text-bambu-green animate-spin"})}):n?E.jsx("pre",{className:"text-xs text-bambu-gray font-mono whitespace-pre-wrap overflow-x-auto bg-bambu-dark p-4 rounded-lg",children:JSON.stringify(n,null,2)}):E.jsx("p",{className:"text-bambu-gray text-center py-8",children:"Failed to load preset details"})}),E.jsx("div",{className:"p-4 border-t border-bambu-dark-tertiary",children:E.jsx(At,{variant:"secondary",onClick:e,className:"w-full",children:"Close"})})]})})})}function ZTe({settings:t}){const[e,n]=T.useState(new Set),[i,r]=T.useState(null),a=c=>[...c].sort((d,f)=>d.name.localeCompare(f.name)),s=c=>{n(d=>{const f=new Set(d);return f.has(c)?f.delete(c):f.add(c),f})},l=[{key:"filament",label:"Filament Presets",icon:UW,items:a(t.filament)},{key:"printer",label:"Printer Presets",icon:xu,items:a(t.printer)},{key:"process",label:"Process Presets",icon:GX,items:a(t.process)}];return E.jsxs(E.Fragment,{children:[E.jsx("div",{className:"space-y-4",children:l.map(({key:c,label:d,icon:f,items:h})=>E.jsxs(vi,{children:[E.jsxs("button",{onClick:()=>s(c),className:"w-full flex items-center justify-between p-4",children:[E.jsxs("div",{className:"flex items-center gap-3",children:[E.jsx(f,{className:"w-5 h-5 text-bambu-green"}),E.jsx("span",{className:"text-lg font-semibold text-white",children:d}),E.jsxs("span",{className:"text-sm text-bambu-gray",children:["(",h.length,")"]})]}),e.has(c)?E.jsx(bW,{className:"w-5 h-5 text-bambu-gray"}):E.jsx(vm,{className:"w-5 h-5 text-bambu-gray"})]}),e.has(c)&&h.length>0&&E.jsx(Pi,{className:"pt-0",children:E.jsx("div",{className:"grid gap-2 sm:grid-cols-2 lg:grid-cols-3",children:h.map(g=>E.jsx(YTe,{setting:g,onClick:()=>r(g)},g.setting_id))})}),e.has(c)&&h.length===0&&E.jsx(Pi,{className:"pt-0",children:E.jsx("p",{className:"text-bambu-gray text-sm",children:"No presets found"})})]},c))}),i&&E.jsx(KTe,{setting:i,onClose:()=>r(null)})]})}function QTe(){const t=wa(),{showToast:e}=Lu(),{data:n,isLoading:i}=Ki({queryKey:["cloudStatus"],queryFn:Mt.getCloudStatus}),{data:r,isLoading:a,refetch:s}=Ki({queryKey:["cloudSettings"],queryFn:()=>Mt.getCloudSettings(),enabled:!!n?.is_authenticated,retry:!1,staleTime:1e3*60*5}),l=Qi({mutationFn:Mt.cloudLogout,onSuccess:()=>{t.invalidateQueries({queryKey:["cloudStatus"]}),t.removeQueries({queryKey:["cloudSettings"]}),e("Logged out")}}),c=()=>{t.invalidateQueries({queryKey:["cloudStatus"]})};return i?E.jsx("div",{className:"p-8 flex justify-center",children:E.jsx(pr,{className:"w-8 h-8 text-bambu-green animate-spin"})}):E.jsxs("div",{className:"p-8",children:[E.jsxs("div",{className:"mb-8 flex items-center justify-between",children:[E.jsxs("div",{children:[E.jsxs("h1",{className:"text-2xl font-bold text-white flex items-center gap-2",children:[E.jsx(hT,{className:"w-6 h-6 text-bambu-green"}),"Cloud Profiles"]}),E.jsx("p",{className:"text-bambu-gray",children:n?.is_authenticated?`Connected as ${n.email}`:"Manage your Bambu Cloud slicer presets"})]}),n?.is_authenticated&&E.jsxs("div",{className:"flex gap-2",children:[E.jsxs(At,{variant:"secondary",onClick:()=>s(),disabled:a,children:[E.jsx(mT,{className:`w-4 h-4 ${a?"animate-spin":""}`}),"Refresh"]}),E.jsxs(At,{variant:"secondary",onClick:()=>l.mutate(),disabled:l.isPending,children:[E.jsx(wX,{className:"w-4 h-4"}),"Logout"]})]})]}),n?.is_authenticated?a?E.jsx("div",{className:"flex justify-center py-12",children:E.jsx(pr,{className:"w-8 h-8 text-bambu-green animate-spin"})}):r?E.jsx(ZTe,{settings:r}):E.jsx(vi,{children:E.jsxs(Pi,{className:"py-8 text-center",children:[E.jsx("p",{className:"text-bambu-gray",children:"Failed to load profiles"}),E.jsx(At,{className:"mt-4",onClick:()=>s(),children:"Retry"})]})}):E.jsx(qTe,{onSuccess:c})]})}function JTe(){const t=T.useRef(null),e=T.useRef(null),n=wa(),[i,r]=T.useState(!1),a=T.useCallback(()=>{if(t.current?.readyState===WebSocket.OPEN)return;const d=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/api/v1/ws`,f=new WebSocket(d);f.onopen=()=>{r(!0);const h=setInterval(()=>{f.readyState===WebSocket.OPEN&&f.send(JSON.stringify({type:"ping"}))},3e4);f.onclose=()=>{clearInterval(h)}},f.onmessage=h=>{try{const g=JSON.parse(h.data);s(g)}catch{}},f.onclose=()=>{r(!1),t.current=null,e.current=window.setTimeout(()=>{a()},3e3)},f.onerror=()=>{f.close()},t.current=f},[]),s=T.useCallback(c=>{switch(c.type){case"printer_status":c.printer_id!==void 0&&n.setQueryData(["printerStatus",c.printer_id],d=>({...d,...c.data}));break;case"print_complete":n.invalidateQueries({queryKey:["archives"]}),n.invalidateQueries({queryKey:["archiveStats"]});break;case"archive_created":n.invalidateQueries({queryKey:["archives"]}),n.invalidateQueries({queryKey:["archiveStats"]});break}},[n]);T.useEffect(()=>(a(),()=>{e.current&&clearTimeout(e.current),t.current&&t.current.close()}),[a]);const l=T.useCallback(c=>{t.current?.readyState===WebSocket.OPEN&&t.current.send(JSON.stringify(c))},[]);return{isConnected:i,sendMessage:l}}const e2e=new H7({defaultOptions:{queries:{staleTime:1e3*60,retry:1}}});function t2e({children:t}){return JTe(),E.jsx(E.Fragment,{children:t})}function n2e(){return E.jsx(pq,{children:E.jsx(Sq,{children:E.jsx(G7,{client:e2e,children:E.jsx(t2e,{children:E.jsx(d7,{children:E.jsx(H$,{children:E.jsxs(Wc,{path:"/",element:E.jsx(yq,{}),children:[E.jsx(Wc,{index:!0,element:E.jsx(Dq,{})}),E.jsx(Wc,{path:"archives",element:E.jsx(zle,{})}),E.jsx(Wc,{path:"stats",element:E.jsx(WTe,{})}),E.jsx(Wc,{path:"cloud",element:E.jsx(QTe,{})}),E.jsx(Wc,{path:"settings",element:E.jsx(XTe,{})})]})})})})})})})}q9.createRoot(document.getElementById("root")).render(E.jsx(T.StrictMode,{children:E.jsx(n2e,{})}));