index-CUSzovgk.js 2.5 MB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594
  1. function Hte(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 wy=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Ks(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var hA={exports:{}},_g={};var IU;function Vte(){if(IU)return _g;IU=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 o in r)o!=="key"&&(a[o]=r[o])}else a=r;return r=a.ref,{$$typeof:t,type:i,key:s,ref:r!==void 0?r:null,props:a}}return _g.Fragment=e,_g.jsx=n,_g.jsxs=n,_g}var UU;function $te(){return UU||(UU=1,hA.exports=Vte()),hA.exports}var p=$te(),pA={exports:{}},Xt={};var jU;function Gte(){if(jU)return Xt;jU=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"),o=Symbol.for("react.forward_ref"),l=Symbol.for("react.suspense"),c=Symbol.for("react.memo"),d=Symbol.for("react.lazy"),f=Symbol.for("react.activity"),m=Symbol.iterator;function g(V){return V===null||typeof V!="object"?null:(V=m&&V[m]||V["@@iterator"],typeof V=="function"?V:null)}var y={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},_=Object.assign,v={};function x(V,X,ae){this.props=V,this.context=X,this.refs=v,this.updater=ae||y}x.prototype.isReactComponent={},x.prototype.setState=function(V,X){if(typeof V!="object"&&typeof V!="function"&&V!=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,V,X,"setState")},x.prototype.forceUpdate=function(V){this.updater.enqueueForceUpdate(this,V,"forceUpdate")};function M(){}M.prototype=x.prototype;function w(V,X,ae){this.props=V,this.context=X,this.refs=v,this.updater=ae||y}var T=w.prototype=new M;T.constructor=w,_(T,x.prototype),T.isPureReactComponent=!0;var C=Array.isArray;function P(){}var A={H:null,A:null,T:null,S:null},U=Object.prototype.hasOwnProperty;function N(V,X,ae){var ce=ae.ref;return{$$typeof:t,type:V,key:X,ref:ce!==void 0?ce:null,props:ae}}function D(V,X){return N(V.type,X,V.props)}function F(V){return typeof V=="object"&&V!==null&&V.$$typeof===t}function I(V){var X={"=":"=0",":":"=2"};return"$"+V.replace(/[=:]/g,function(ae){return X[ae]})}var W=/\/+/g;function O(V,X){return typeof V=="object"&&V!==null&&V.key!=null?I(""+V.key):X.toString(36)}function B(V){switch(V.status){case"fulfilled":return V.value;case"rejected":throw V.reason;default:switch(typeof V.status=="string"?V.then(P,P):(V.status="pending",V.then(function(X){V.status==="pending"&&(V.status="fulfilled",V.value=X)},function(X){V.status==="pending"&&(V.status="rejected",V.reason=X)})),V.status){case"fulfilled":return V.value;case"rejected":throw V.reason}}throw V}function H(V,X,ae,ce,ge){var ne=typeof V;(ne==="undefined"||ne==="boolean")&&(V=null);var ve=!1;if(V===null)ve=!0;else switch(ne){case"bigint":case"string":case"number":ve=!0;break;case"object":switch(V.$$typeof){case t:case e:ve=!0;break;case d:return ve=V._init,H(ve(V._payload),X,ae,ce,ge)}}if(ve)return ge=ge(V),ve=ce===""?"."+O(V,0):ce,C(ge)?(ae="",ve!=null&&(ae=ve.replace(W,"$&/")+"/"),H(ge,X,ae,"",function(we){return we})):ge!=null&&(F(ge)&&(ge=D(ge,ae+(ge.key==null||V&&V.key===ge.key?"":(""+ge.key).replace(W,"$&/")+"/")+ve)),X.push(ge)),1;ve=0;var Pe=ce===""?".":ce+":";if(C(V))for(var he=0;he<V.length;he++)ce=V[he],ne=Pe+O(ce,he),ve+=H(ce,X,ae,ne,ge);else if(he=g(V),typeof he=="function")for(V=he.call(V),he=0;!(ce=V.next()).done;)ce=ce.value,ne=Pe+O(ce,he++),ve+=H(ce,X,ae,ne,ge);else if(ne==="object"){if(typeof V.then=="function")return H(B(V),X,ae,ce,ge);throw X=String(V),Error("Objects are not valid as a React child (found: "+(X==="[object Object]"?"object with keys {"+Object.keys(V).join(", ")+"}":X)+"). If you meant to render a collection of children, use an array instead.")}return ve}function $(V,X,ae){if(V==null)return V;var ce=[],ge=0;return H(V,ce,"","",function(ne){return X.call(ae,ne,ge++)}),ce}function K(V){if(V._status===-1){var X=V._result;X=X(),X.then(function(ae){(V._status===0||V._status===-1)&&(V._status=1,V._result=ae)},function(ae){(V._status===0||V._status===-1)&&(V._status=2,V._result=ae)}),V._status===-1&&(V._status=0,V._result=X)}if(V._status===1)return V._result.default;throw V._result}var Z=typeof reportError=="function"?reportError:function(V){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var X=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof V=="object"&&V!==null&&typeof V.message=="string"?String(V.message):String(V),error:V});if(!window.dispatchEvent(X))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",V);return}console.error(V)},se={map:$,forEach:function(V,X,ae){$(V,function(){X.apply(this,arguments)},ae)},count:function(V){var X=0;return $(V,function(){X++}),X},toArray:function(V){return $(V,function(X){return X})||[]},only:function(V){if(!F(V))throw Error("React.Children.only expected to receive a single React element child.");return V}};return Xt.Activity=f,Xt.Children=se,Xt.Component=x,Xt.Fragment=n,Xt.Profiler=r,Xt.PureComponent=w,Xt.StrictMode=i,Xt.Suspense=l,Xt.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=A,Xt.__COMPILER_RUNTIME={__proto__:null,c:function(V){return A.H.useMemoCache(V)}},Xt.cache=function(V){return function(){return V.apply(null,arguments)}},Xt.cacheSignal=function(){return null},Xt.cloneElement=function(V,X,ae){if(V==null)throw Error("The argument must be a React element, but you passed "+V+".");var ce=_({},V.props),ge=V.key;if(X!=null)for(ne in X.key!==void 0&&(ge=""+X.key),X)!U.call(X,ne)||ne==="key"||ne==="__self"||ne==="__source"||ne==="ref"&&X.ref===void 0||(ce[ne]=X[ne]);var ne=arguments.length-2;if(ne===1)ce.children=ae;else if(1<ne){for(var ve=Array(ne),Pe=0;Pe<ne;Pe++)ve[Pe]=arguments[Pe+2];ce.children=ve}return N(V.type,ge,ce)},Xt.createContext=function(V){return V={$$typeof:s,_currentValue:V,_currentValue2:V,_threadCount:0,Provider:null,Consumer:null},V.Provider=V,V.Consumer={$$typeof:a,_context:V},V},Xt.createElement=function(V,X,ae){var ce,ge={},ne=null;if(X!=null)for(ce in X.key!==void 0&&(ne=""+X.key),X)U.call(X,ce)&&ce!=="key"&&ce!=="__self"&&ce!=="__source"&&(ge[ce]=X[ce]);var ve=arguments.length-2;if(ve===1)ge.children=ae;else if(1<ve){for(var Pe=Array(ve),he=0;he<ve;he++)Pe[he]=arguments[he+2];ge.children=Pe}if(V&&V.defaultProps)for(ce in ve=V.defaultProps,ve)ge[ce]===void 0&&(ge[ce]=ve[ce]);return N(V,ne,ge)},Xt.createRef=function(){return{current:null}},Xt.forwardRef=function(V){return{$$typeof:o,render:V}},Xt.isValidElement=F,Xt.lazy=function(V){return{$$typeof:d,_payload:{_status:-1,_result:V},_init:K}},Xt.memo=function(V,X){return{$$typeof:c,type:V,compare:X===void 0?null:X}},Xt.startTransition=function(V){var X=A.T,ae={};A.T=ae;try{var ce=V(),ge=A.S;ge!==null&&ge(ae,ce),typeof ce=="object"&&ce!==null&&typeof ce.then=="function"&&ce.then(P,Z)}catch(ne){Z(ne)}finally{X!==null&&ae.types!==null&&(X.types=ae.types),A.T=X}},Xt.unstable_useCacheRefresh=function(){return A.H.useCacheRefresh()},Xt.use=function(V){return A.H.use(V)},Xt.useActionState=function(V,X,ae){return A.H.useActionState(V,X,ae)},Xt.useCallback=function(V,X){return A.H.useCallback(V,X)},Xt.useContext=function(V){return A.H.useContext(V)},Xt.useDebugValue=function(){},Xt.useDeferredValue=function(V,X){return A.H.useDeferredValue(V,X)},Xt.useEffect=function(V,X){return A.H.useEffect(V,X)},Xt.useEffectEvent=function(V){return A.H.useEffectEvent(V)},Xt.useId=function(){return A.H.useId()},Xt.useImperativeHandle=function(V,X,ae){return A.H.useImperativeHandle(V,X,ae)},Xt.useInsertionEffect=function(V,X){return A.H.useInsertionEffect(V,X)},Xt.useLayoutEffect=function(V,X){return A.H.useLayoutEffect(V,X)},Xt.useMemo=function(V,X){return A.H.useMemo(V,X)},Xt.useOptimistic=function(V,X){return A.H.useOptimistic(V,X)},Xt.useReducer=function(V,X,ae){return A.H.useReducer(V,X,ae)},Xt.useRef=function(V){return A.H.useRef(V)},Xt.useState=function(V){return A.H.useState(V)},Xt.useSyncExternalStore=function(V,X,ae){return A.H.useSyncExternalStore(V,X,ae)},Xt.useTransition=function(){return A.H.useTransition()},Xt.version="19.2.0",Xt}var FU;function lm(){return FU||(FU=1,pA.exports=Gte()),pA.exports}var E=lm();const ui=Ks(E),Wte=Hte({__proto__:null,default:ui},[E]);var mA={exports:{}},Sg={},gA={exports:{}},xA={};var zU;function qte(){return zU||(zU=1,(function(t){function e(H,$){var K=H.length;H.push($);e:for(;0<K;){var Z=K-1>>>1,se=H[Z];if(0<r(se,$))H[Z]=$,H[K]=se,K=Z;else break e}}function n(H){return H.length===0?null:H[0]}function i(H){if(H.length===0)return null;var $=H[0],K=H.pop();if(K!==$){H[0]=K;e:for(var Z=0,se=H.length,V=se>>>1;Z<V;){var X=2*(Z+1)-1,ae=H[X],ce=X+1,ge=H[ce];if(0>r(ae,K))ce<se&&0>r(ge,ae)?(H[Z]=ge,H[ce]=K,Z=ce):(H[Z]=ae,H[X]=K,Z=X);else if(ce<se&&0>r(ge,K))H[Z]=ge,H[ce]=K,Z=ce;else break e}}return $}function r(H,$){var K=H.sortIndex-$.sortIndex;return K!==0?K:H.id-$.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,o=s.now();t.unstable_now=function(){return s.now()-o}}var l=[],c=[],d=1,f=null,m=3,g=!1,y=!1,_=!1,v=!1,x=typeof setTimeout=="function"?setTimeout:null,M=typeof clearTimeout=="function"?clearTimeout:null,w=typeof setImmediate<"u"?setImmediate:null;function T(H){for(var $=n(c);$!==null;){if($.callback===null)i(c);else if($.startTime<=H)i(c),$.sortIndex=$.expirationTime,e(l,$);else break;$=n(c)}}function C(H){if(_=!1,T(H),!y)if(n(l)!==null)y=!0,P||(P=!0,I());else{var $=n(c);$!==null&&B(C,$.startTime-H)}}var P=!1,A=-1,U=5,N=-1;function D(){return v?!0:!(t.unstable_now()-N<U)}function F(){if(v=!1,P){var H=t.unstable_now();N=H;var $=!0;try{e:{y=!1,_&&(_=!1,M(A),A=-1),g=!0;var K=m;try{t:{for(T(H),f=n(l);f!==null&&!(f.expirationTime>H&&D());){var Z=f.callback;if(typeof Z=="function"){f.callback=null,m=f.priorityLevel;var se=Z(f.expirationTime<=H);if(H=t.unstable_now(),typeof se=="function"){f.callback=se,T(H),$=!0;break t}f===n(l)&&i(l),T(H)}else i(l);f=n(l)}if(f!==null)$=!0;else{var V=n(c);V!==null&&B(C,V.startTime-H),$=!1}}break e}finally{f=null,m=K,g=!1}$=void 0}}finally{$?I():P=!1}}}var I;if(typeof w=="function")I=function(){w(F)};else if(typeof MessageChannel<"u"){var W=new MessageChannel,O=W.port2;W.port1.onmessage=F,I=function(){O.postMessage(null)}}else I=function(){x(F,0)};function B(H,$){A=x(function(){H(t.unstable_now())},$)}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(H){H.callback=null},t.unstable_forceFrameRate=function(H){0>H||125<H?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):U=0<H?Math.floor(1e3/H):5},t.unstable_getCurrentPriorityLevel=function(){return m},t.unstable_next=function(H){switch(m){case 1:case 2:case 3:var $=3;break;default:$=m}var K=m;m=$;try{return H()}finally{m=K}},t.unstable_requestPaint=function(){v=!0},t.unstable_runWithPriority=function(H,$){switch(H){case 1:case 2:case 3:case 4:case 5:break;default:H=3}var K=m;m=H;try{return $()}finally{m=K}},t.unstable_scheduleCallback=function(H,$,K){var Z=t.unstable_now();switch(typeof K=="object"&&K!==null?(K=K.delay,K=typeof K=="number"&&0<K?Z+K:Z):K=Z,H){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=K+se,H={id:d++,callback:$,priorityLevel:H,startTime:K,expirationTime:se,sortIndex:-1},K>Z?(H.sortIndex=K,e(c,H),n(l)===null&&H===n(c)&&(_?(M(A),A=-1):_=!0,B(C,K-Z))):(H.sortIndex=se,e(l,H),y||g||(y=!0,P||(P=!0,I()))),H},t.unstable_shouldYield=D,t.unstable_wrapCallback=function(H){var $=m;return function(){var K=m;m=$;try{return H.apply(this,arguments)}finally{m=K}}}})(xA)),xA}var BU;function Xte(){return BU||(BU=1,gA.exports=qte()),gA.exports}var vA={exports:{}},Wr={};var HU;function Kte(){if(HU)return Wr;HU=1;var t=lm();function e(l){var c="https://react.dev/errors/"+l;if(1<arguments.length){c+="?args[]="+encodeURIComponent(arguments[1]);for(var d=2;d<arguments.length;d++)c+="&args[]="+encodeURIComponent(arguments[d])}return"Minified React error #"+l+"; visit "+c+" 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(l,c,d){var f=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:r,key:f==null?null:""+f,children:l,containerInfo:c,implementation:d}}var s=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function o(l,c){if(l==="font")return"";if(typeof c=="string")return c==="use-credentials"?c:""}return Wr.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=i,Wr.createPortal=function(l,c){var d=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!c||c.nodeType!==1&&c.nodeType!==9&&c.nodeType!==11)throw Error(e(299));return a(l,c,null,d)},Wr.flushSync=function(l){var c=s.T,d=i.p;try{if(s.T=null,i.p=2,l)return l()}finally{s.T=c,i.p=d,i.d.f()}},Wr.preconnect=function(l,c){typeof l=="string"&&(c?(c=c.crossOrigin,c=typeof c=="string"?c==="use-credentials"?c:"":void 0):c=null,i.d.C(l,c))},Wr.prefetchDNS=function(l){typeof l=="string"&&i.d.D(l)},Wr.preinit=function(l,c){if(typeof l=="string"&&c&&typeof c.as=="string"){var d=c.as,f=o(d,c.crossOrigin),m=typeof c.integrity=="string"?c.integrity:void 0,g=typeof c.fetchPriority=="string"?c.fetchPriority:void 0;d==="style"?i.d.S(l,typeof c.precedence=="string"?c.precedence:void 0,{crossOrigin:f,integrity:m,fetchPriority:g}):d==="script"&&i.d.X(l,{crossOrigin:f,integrity:m,fetchPriority:g,nonce:typeof c.nonce=="string"?c.nonce:void 0})}},Wr.preinitModule=function(l,c){if(typeof l=="string")if(typeof c=="object"&&c!==null){if(c.as==null||c.as==="script"){var d=o(c.as,c.crossOrigin);i.d.M(l,{crossOrigin:d,integrity:typeof c.integrity=="string"?c.integrity:void 0,nonce:typeof c.nonce=="string"?c.nonce:void 0})}}else c==null&&i.d.M(l)},Wr.preload=function(l,c){if(typeof l=="string"&&typeof c=="object"&&c!==null&&typeof c.as=="string"){var d=c.as,f=o(d,c.crossOrigin);i.d.L(l,d,{crossOrigin:f,integrity:typeof c.integrity=="string"?c.integrity:void 0,nonce:typeof c.nonce=="string"?c.nonce:void 0,type:typeof c.type=="string"?c.type:void 0,fetchPriority:typeof c.fetchPriority=="string"?c.fetchPriority:void 0,referrerPolicy:typeof c.referrerPolicy=="string"?c.referrerPolicy:void 0,imageSrcSet:typeof c.imageSrcSet=="string"?c.imageSrcSet:void 0,imageSizes:typeof c.imageSizes=="string"?c.imageSizes:void 0,media:typeof c.media=="string"?c.media:void 0})}},Wr.preloadModule=function(l,c){if(typeof l=="string")if(c){var d=o(c.as,c.crossOrigin);i.d.m(l,{as:typeof c.as=="string"&&c.as!=="script"?c.as:void 0,crossOrigin:d,integrity:typeof c.integrity=="string"?c.integrity:void 0})}else i.d.m(l)},Wr.requestFormReset=function(l){i.d.r(l)},Wr.unstable_batchedUpdates=function(l,c){return l(c)},Wr.useFormState=function(l,c,d){return s.H.useFormState(l,c,d)},Wr.useFormStatus=function(){return s.H.useHostTransitionStatus()},Wr.version="19.2.0",Wr}var VU;function eG(){if(VU)return vA.exports;VU=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(),vA.exports=Kte(),vA.exports}var $U;function Yte(){if($U)return Sg;$U=1;var t=Xte(),e=lm(),n=eG();function i(u){var h="https://react.dev/errors/"+u;if(1<arguments.length){h+="?args[]="+encodeURIComponent(arguments[1]);for(var b=2;b<arguments.length;b++)h+="&args[]="+encodeURIComponent(arguments[b])}return"Minified React error #"+u+"; visit "+h+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function r(u){return!(!u||u.nodeType!==1&&u.nodeType!==9&&u.nodeType!==11)}function a(u){var h=u,b=u;if(u.alternate)for(;h.return;)h=h.return;else{u=h;do h=u,(h.flags&4098)!==0&&(b=h.return),u=h.return;while(u)}return h.tag===3?b:null}function s(u){if(u.tag===13){var h=u.memoizedState;if(h===null&&(u=u.alternate,u!==null&&(h=u.memoizedState)),h!==null)return h.dehydrated}return null}function o(u){if(u.tag===31){var h=u.memoizedState;if(h===null&&(u=u.alternate,u!==null&&(h=u.memoizedState)),h!==null)return h.dehydrated}return null}function l(u){if(a(u)!==u)throw Error(i(188))}function c(u){var h=u.alternate;if(!h){if(h=a(u),h===null)throw Error(i(188));return h!==u?null:u}for(var b=u,S=h;;){var R=b.return;if(R===null)break;var k=R.alternate;if(k===null){if(S=R.return,S!==null){b=S;continue}break}if(R.child===k.child){for(k=R.child;k;){if(k===b)return l(R),u;if(k===S)return l(R),h;k=k.sibling}throw Error(i(188))}if(b.return!==S.return)b=R,S=k;else{for(var G=!1,ie=R.child;ie;){if(ie===b){G=!0,b=R,S=k;break}if(ie===S){G=!0,S=R,b=k;break}ie=ie.sibling}if(!G){for(ie=k.child;ie;){if(ie===b){G=!0,b=k,S=R;break}if(ie===S){G=!0,S=k,b=R;break}ie=ie.sibling}if(!G)throw Error(i(189))}}if(b.alternate!==S)throw Error(i(190))}if(b.tag!==3)throw Error(i(188));return b.stateNode.current===b?u:h}function d(u){var h=u.tag;if(h===5||h===26||h===27||h===6)return u;for(u=u.child;u!==null;){if(h=d(u),h!==null)return h;u=u.sibling}return null}var f=Object.assign,m=Symbol.for("react.element"),g=Symbol.for("react.transitional.element"),y=Symbol.for("react.portal"),_=Symbol.for("react.fragment"),v=Symbol.for("react.strict_mode"),x=Symbol.for("react.profiler"),M=Symbol.for("react.consumer"),w=Symbol.for("react.context"),T=Symbol.for("react.forward_ref"),C=Symbol.for("react.suspense"),P=Symbol.for("react.suspense_list"),A=Symbol.for("react.memo"),U=Symbol.for("react.lazy"),N=Symbol.for("react.activity"),D=Symbol.for("react.memo_cache_sentinel"),F=Symbol.iterator;function I(u){return u===null||typeof u!="object"?null:(u=F&&u[F]||u["@@iterator"],typeof u=="function"?u:null)}var W=Symbol.for("react.client.reference");function O(u){if(u==null)return null;if(typeof u=="function")return u.$$typeof===W?null:u.displayName||u.name||null;if(typeof u=="string")return u;switch(u){case _:return"Fragment";case x:return"Profiler";case v:return"StrictMode";case C:return"Suspense";case P:return"SuspenseList";case N:return"Activity"}if(typeof u=="object")switch(u.$$typeof){case y:return"Portal";case w:return u.displayName||"Context";case M:return(u._context.displayName||"Context")+".Consumer";case T:var h=u.render;return u=u.displayName,u||(u=h.displayName||h.name||"",u=u!==""?"ForwardRef("+u+")":"ForwardRef"),u;case A:return h=u.displayName||null,h!==null?h:O(u.type)||"Memo";case U:h=u._payload,u=u._init;try{return O(u(h))}catch{}}return null}var B=Array.isArray,H=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,$=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,K={pending:!1,data:null,method:null,action:null},Z=[],se=-1;function V(u){return{current:u}}function X(u){0>se||(u.current=Z[se],Z[se]=null,se--)}function ae(u,h){se++,Z[se]=u.current,u.current=h}var ce=V(null),ge=V(null),ne=V(null),ve=V(null);function Pe(u,h){switch(ae(ne,h),ae(ge,u),ae(ce,null),h.nodeType){case 9:case 11:u=(u=h.documentElement)&&(u=u.namespaceURI)?aU(u):0;break;default:if(u=h.tagName,h=h.namespaceURI)h=aU(h),u=sU(h,u);else switch(u){case"svg":u=1;break;case"math":u=2;break;default:u=0}}X(ce),ae(ce,u)}function he(){X(ce),X(ge),X(ne)}function we(u){u.memoizedState!==null&&ae(ve,u);var h=ce.current,b=sU(h,u.type);h!==b&&(ae(ge,u),ae(ce,b))}function je(u){ge.current===u&&(X(ce),X(ge)),ve.current===u&&(X(ve),xg._currentValue=K)}var ue,lt;function z(u){if(ue===void 0)try{throw Error()}catch(b){var h=b.stack.trim().match(/\n( *(at )?)/);ue=h&&h[1]||"",lt=-1<b.stack.indexOf(`
  2. at`)?" (<anonymous>)":-1<b.stack.indexOf("@")?"@unknown:0:0":""}return`
  3. `+ue+u+lt}var q=!1;function re(u,h){if(!u||q)return"";q=!0;var b=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var S={DetermineComponentFrameRoot:function(){try{if(h){var ot=function(){throw Error()};if(Object.defineProperty(ot.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ot,[])}catch(Ke){var Ve=Ke}Reflect.construct(u,[],ot)}else{try{ot.call()}catch(Ke){Ve=Ke}u.call(ot.prototype)}}else{try{throw Error()}catch(Ke){Ve=Ke}(ot=u())&&typeof ot.catch=="function"&&ot.catch(function(){})}}catch(Ke){if(Ke&&Ve&&typeof Ke.stack=="string")return[Ke.stack,Ve.stack]}return[null,null]}};S.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var R=Object.getOwnPropertyDescriptor(S.DetermineComponentFrameRoot,"name");R&&R.configurable&&Object.defineProperty(S.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var k=S.DetermineComponentFrameRoot(),G=k[0],ie=k[1];if(G&&ie){var _e=G.split(`
  4. `),ze=ie.split(`
  5. `);for(R=S=0;S<_e.length&&!_e[S].includes("DetermineComponentFrameRoot");)S++;for(;R<ze.length&&!ze[R].includes("DetermineComponentFrameRoot");)R++;if(S===_e.length||R===ze.length)for(S=_e.length-1,R=ze.length-1;1<=S&&0<=R&&_e[S]!==ze[R];)R--;for(;1<=S&&0<=R;S--,R--)if(_e[S]!==ze[R]){if(S!==1||R!==1)do if(S--,R--,0>R||_e[S]!==ze[R]){var Je=`
  6. `+_e[S].replace(" at new "," at ");return u.displayName&&Je.includes("<anonymous>")&&(Je=Je.replace("<anonymous>",u.displayName)),Je}while(1<=S&&0<=R);break}}}finally{q=!1,Error.prepareStackTrace=b}return(b=u?u.displayName||u.name:"")?z(b):""}function J(u,h){switch(u.tag){case 26:case 27:case 5:return z(u.type);case 16:return z("Lazy");case 13:return u.child!==h&&h!==null?z("Suspense Fallback"):z("Suspense");case 19:return z("SuspenseList");case 0:case 15:return re(u.type,!1);case 11:return re(u.type.render,!1);case 1:return re(u.type,!0);case 31:return z("Activity");default:return""}}function ee(u){try{var h="",b=null;do h+=J(u,b),b=u,u=u.return;while(u);return h}catch(S){return`
  7. Error generating stack: `+S.message+`
  8. `+S.stack}}var oe=Object.prototype.hasOwnProperty,De=t.unstable_scheduleCallback,Ne=t.unstable_cancelCallback,te=t.unstable_shouldYield,j=t.unstable_requestPaint,L=t.unstable_now,Y=t.unstable_getCurrentPriorityLevel,me=t.unstable_ImmediatePriority,ye=t.unstable_UserBlockingPriority,pe=t.unstable_NormalPriority,Ze=t.unstable_LowPriority,Le=t.unstable_IdlePriority,qe=t.log,at=t.unstable_setDisableYieldValue,Ie=null,Re=null;function pt(u){if(typeof qe=="function"&&at(u),Re&&typeof Re.setStrictMode=="function")try{Re.setStrictMode(Ie,u)}catch{}}var nt=Math.clz32?Math.clz32:de,tt=Math.log,ut=Math.LN2;function de(u){return u>>>=0,u===0?32:31-(tt(u)/ut|0)|0}var it=256,fe=262144,Oe=4194304;function Me(u){var h=u&42;if(h!==0)return h;switch(u&-u){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 u&261888;case 262144:case 524288:case 1048576:case 2097152:return u&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return u&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return u}}function xe(u,h,b){var S=u.pendingLanes;if(S===0)return 0;var R=0,k=u.suspendedLanes,G=u.pingedLanes;u=u.warmLanes;var ie=S&134217727;return ie!==0?(S=ie&~k,S!==0?R=Me(S):(G&=ie,G!==0?R=Me(G):b||(b=ie&~u,b!==0&&(R=Me(b))))):(ie=S&~k,ie!==0?R=Me(ie):G!==0?R=Me(G):b||(b=S&~u,b!==0&&(R=Me(b)))),R===0?0:h!==0&&h!==R&&(h&k)===0&&(k=R&-R,b=h&-h,k>=b||k===32&&(b&4194048)!==0)?h:R}function Be(u,h){return(u.pendingLanes&~(u.suspendedLanes&~u.pingedLanes)&h)===0}function ct(u,h){switch(u){case 1:case 2:case 4:case 8:case 64:return h+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 h+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 bt(){var u=Oe;return Oe<<=1,(Oe&62914560)===0&&(Oe=4194304),u}function Nt(u){for(var h=[],b=0;31>b;b++)h.push(u);return h}function on(u,h){u.pendingLanes|=h,h!==268435456&&(u.suspendedLanes=0,u.pingedLanes=0,u.warmLanes=0)}function Dt(u,h,b,S,R,k){var G=u.pendingLanes;u.pendingLanes=b,u.suspendedLanes=0,u.pingedLanes=0,u.warmLanes=0,u.expiredLanes&=b,u.entangledLanes&=b,u.errorRecoveryDisabledLanes&=b,u.shellSuspendCounter=0;var ie=u.entanglements,_e=u.expirationTimes,ze=u.hiddenUpdates;for(b=G&~b;0<b;){var Je=31-nt(b),ot=1<<Je;ie[Je]=0,_e[Je]=-1;var Ve=ze[Je];if(Ve!==null)for(ze[Je]=null,Je=0;Je<Ve.length;Je++){var Ke=Ve[Je];Ke!==null&&(Ke.lane&=-536870913)}b&=~ot}S!==0&&Rn(u,S,0),k!==0&&R===0&&u.tag!==0&&(u.suspendedLanes|=k&~(G&~h))}function Rn(u,h,b){u.pendingLanes|=h,u.suspendedLanes&=~h;var S=31-nt(h);u.entangledLanes|=h,u.entanglements[S]=u.entanglements[S]|1073741824|b&261930}function Wn(u,h){var b=u.entangledLanes|=h;for(u=u.entanglements;b;){var S=31-nt(b),R=1<<S;R&h|u[S]&h&&(u[S]|=h),b&=~R}}function hr(u,h){var b=h&-h;return b=(b&42)!==0?1:Zi(b),(b&(u.suspendedLanes|h))!==0?0:b}function Zi(u){switch(u){case 2:u=1;break;case 8:u=4;break;case 32:u=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:u=128;break;case 268435456:u=134217728;break;default:u=0}return u}function pr(u){return u&=-u,2<u?8<u?(u&134217727)!==0?32:268435456:8:2}function Nr(){var u=$.p;return u!==0?u:(u=window.event,u===void 0?32:NU(u.type))}function Gr(u,h){var b=$.p;try{return $.p=u,h()}finally{$.p=b}}var Li=Math.random().toString(36).slice(2),hi="__reactFiber$"+Li,Ai="__reactProps$"+Li,Zs="__reactContainer$"+Li,Pc="__reactEvents$"+Li,le="__reactListeners$"+Li,Ue="__reactHandles$"+Li,We="__reactResources$"+Li,Xe="__reactMarker$"+Li;function Ge(u){delete u[hi],delete u[Ai],delete u[Pc],delete u[le],delete u[Ue]}function _t(u){var h=u[hi];if(h)return h;for(var b=u.parentNode;b;){if(h=b[Zs]||b[hi]){if(b=h.alternate,h.child!==null||b!==null&&b.child!==null)for(u=hU(u);u!==null;){if(b=u[hi])return b;u=hU(u)}return h}u=b,b=u.parentNode}return null}function Q(u){if(u=u[hi]||u[Zs]){var h=u.tag;if(h===5||h===6||h===13||h===31||h===26||h===27||h===3)return u}return null}function be(u){var h=u.tag;if(h===5||h===26||h===27||h===6)return u.stateNode;throw Error(i(33))}function Ce(u){var h=u[We];return h||(h=u[We]={hoistableStyles:new Map,hoistableScripts:new Map}),h}function Te(u){u[Xe]=!0}var Se=new Set,Qe={};function dt(u,h){vt(u,h),vt(u+"Capture",h)}function vt(u,h){for(Qe[u]=h,u=0;u<h.length;u++)Se.add(h[u])}var xt=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]*$"),Rt={},wt={};function mt(u){return oe.call(wt,u)?!0:oe.call(Rt,u)?!1:xt.test(u)?wt[u]=!0:(Rt[u]=!0,!1)}function $t(u,h,b){if(mt(h))if(b===null)u.removeAttribute(h);else{switch(typeof b){case"undefined":case"function":case"symbol":u.removeAttribute(h);return;case"boolean":var S=h.toLowerCase().slice(0,5);if(S!=="data-"&&S!=="aria-"){u.removeAttribute(h);return}}u.setAttribute(h,""+b)}}function Lt(u,h,b){if(b===null)u.removeAttribute(h);else{switch(typeof b){case"undefined":case"function":case"symbol":case"boolean":u.removeAttribute(h);return}u.setAttribute(h,""+b)}}function en(u,h,b,S){if(S===null)u.removeAttribute(b);else{switch(typeof S){case"undefined":case"function":case"symbol":case"boolean":u.removeAttribute(b);return}u.setAttributeNS(h,b,""+S)}}function un(u){switch(typeof u){case"bigint":case"boolean":case"number":case"string":case"undefined":return u;case"object":return u;default:return""}}function mn(u){var h=u.type;return(u=u.nodeName)&&u.toLowerCase()==="input"&&(h==="checkbox"||h==="radio")}function kt(u,h,b){var S=Object.getOwnPropertyDescriptor(u.constructor.prototype,h);if(!u.hasOwnProperty(h)&&typeof S<"u"&&typeof S.get=="function"&&typeof S.set=="function"){var R=S.get,k=S.set;return Object.defineProperty(u,h,{configurable:!0,get:function(){return R.call(this)},set:function(G){b=""+G,k.call(this,G)}}),Object.defineProperty(u,h,{enumerable:S.enumerable}),{getValue:function(){return b},setValue:function(G){b=""+G},stopTracking:function(){u._valueTracker=null,delete u[h]}}}}function qt(u){if(!u._valueTracker){var h=mn(u)?"checked":"value";u._valueTracker=kt(u,h,""+u[h])}}function Kt(u){if(!u)return!1;var h=u._valueTracker;if(!h)return!0;var b=h.getValue(),S="";return u&&(S=mn(u)?u.checked?"true":"false":u.value),u=S,u!==b?(h.setValue(u),!0):!1}function yi(u){if(u=u||(typeof document<"u"?document:void 0),typeof u>"u")return null;try{return u.activeElement||u.body}catch{return u.body}}var Ti=/[\n"\\]/g;function Nn(u){return u.replace(Ti,function(h){return"\\"+h.charCodeAt(0).toString(16)+" "})}function Qs(u,h,b,S,R,k,G,ie){u.name="",G!=null&&typeof G!="function"&&typeof G!="symbol"&&typeof G!="boolean"?u.type=G:u.removeAttribute("type"),h!=null?G==="number"?(h===0&&u.value===""||u.value!=h)&&(u.value=""+un(h)):u.value!==""+un(h)&&(u.value=""+un(h)):G!=="submit"&&G!=="reset"||u.removeAttribute("value"),h!=null?mr(u,G,un(h)):b!=null?mr(u,G,un(b)):S!=null&&u.removeAttribute("value"),R==null&&k!=null&&(u.defaultChecked=!!k),R!=null&&(u.checked=R&&typeof R!="function"&&typeof R!="symbol"),ie!=null&&typeof ie!="function"&&typeof ie!="symbol"&&typeof ie!="boolean"?u.name=""+un(ie):u.removeAttribute("name")}function Pn(u,h,b,S,R,k,G,ie){if(k!=null&&typeof k!="function"&&typeof k!="symbol"&&typeof k!="boolean"&&(u.type=k),h!=null||b!=null){if(!(k!=="submit"&&k!=="reset"||h!=null)){qt(u);return}b=b!=null?""+un(b):"",h=h!=null?""+un(h):b,ie||h===u.value||(u.value=h),u.defaultValue=h}S=S??R,S=typeof S!="function"&&typeof S!="symbol"&&!!S,u.checked=ie?u.checked:!!S,u.defaultChecked=!!S,G!=null&&typeof G!="function"&&typeof G!="symbol"&&typeof G!="boolean"&&(u.name=G),qt(u)}function mr(u,h,b){h==="number"&&yi(u.ownerDocument)===u||u.defaultValue===""+b||(u.defaultValue=""+b)}function Qi(u,h,b,S){if(u=u.options,h){h={};for(var R=0;R<b.length;R++)h["$"+b[R]]=!0;for(b=0;b<u.length;b++)R=h.hasOwnProperty("$"+u[b].value),u[b].selected!==R&&(u[b].selected=R),R&&S&&(u[b].defaultSelected=!0)}else{for(b=""+un(b),h=null,R=0;R<u.length;R++){if(u[R].value===b){u[R].selected=!0,S&&(u[R].defaultSelected=!0);return}h!==null||u[R].disabled||(h=u[R])}h!==null&&(h.selected=!0)}}function gr(u,h,b){if(h!=null&&(h=""+un(h),h!==u.value&&(u.value=h),b==null)){u.defaultValue!==h&&(u.defaultValue=h);return}u.defaultValue=b!=null?""+un(b):""}function Rr(u,h,b,S){if(h==null){if(S!=null){if(b!=null)throw Error(i(92));if(B(S)){if(1<S.length)throw Error(i(93));S=S[0]}b=S}b==null&&(b=""),h=b}b=un(h),u.defaultValue=b,S=u.textContent,S===b&&S!==""&&S!==null&&(u.value=S),qt(u)}function To(u,h){if(h){var b=u.firstChild;if(b&&b===u.lastChild&&b.nodeType===3){b.nodeValue=h;return}}u.textContent=h}var ll=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 nL(u,h,b){var S=h.indexOf("--")===0;b==null||typeof b=="boolean"||b===""?S?u.setProperty(h,""):h==="float"?u.cssFloat="":u[h]="":S?u.setProperty(h,b):typeof b!="number"||b===0||ll.has(h)?h==="float"?u.cssFloat=b:u[h]=(""+b).trim():u[h]=b+"px"}function iL(u,h,b){if(h!=null&&typeof h!="object")throw Error(i(62));if(u=u.style,b!=null){for(var S in b)!b.hasOwnProperty(S)||h!=null&&h.hasOwnProperty(S)||(S.indexOf("--")===0?u.setProperty(S,""):S==="float"?u.cssFloat="":u[S]="");for(var R in h)S=h[R],h.hasOwnProperty(R)&&b[R]!==S&&nL(u,R,S)}else for(var k in h)h.hasOwnProperty(k)&&nL(u,k,h[k])}function cM(u){if(u.indexOf("-")===-1)return!1;switch(u){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 jJ=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"]]),FJ=/^[\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 pv(u){return FJ.test(""+u)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":u}function cl(){}var uM=null;function dM(u){return u=u.target||u.srcElement||window,u.correspondingUseElement&&(u=u.correspondingUseElement),u.nodeType===3?u.parentNode:u}var Wf=null,qf=null;function rL(u){var h=Q(u);if(h&&(u=h.stateNode)){var b=u[Ai]||null;e:switch(u=h.stateNode,h.type){case"input":if(Qs(u,b.value,b.defaultValue,b.defaultValue,b.checked,b.defaultChecked,b.type,b.name),h=b.name,b.type==="radio"&&h!=null){for(b=u;b.parentNode;)b=b.parentNode;for(b=b.querySelectorAll('input[name="'+Nn(""+h)+'"][type="radio"]'),h=0;h<b.length;h++){var S=b[h];if(S!==u&&S.form===u.form){var R=S[Ai]||null;if(!R)throw Error(i(90));Qs(S,R.value,R.defaultValue,R.defaultValue,R.checked,R.defaultChecked,R.type,R.name)}}for(h=0;h<b.length;h++)S=b[h],S.form===u.form&&Kt(S)}break e;case"textarea":gr(u,b.value,b.defaultValue);break e;case"select":h=b.value,h!=null&&Qi(u,!!b.multiple,h,!1)}}}var fM=!1;function aL(u,h,b){if(fM)return u(h,b);fM=!0;try{var S=u(h);return S}finally{if(fM=!1,(Wf!==null||qf!==null)&&(ty(),Wf&&(h=Wf,u=qf,qf=Wf=null,rL(h),u)))for(h=0;h<u.length;h++)rL(u[h])}}function Om(u,h){var b=u.stateNode;if(b===null)return null;var S=b[Ai]||null;if(S===null)return null;b=S[h];e:switch(h){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(S=!S.disabled)||(u=u.type,S=!(u==="button"||u==="input"||u==="select"||u==="textarea")),u=!S;break e;default:u=!1}if(u)return null;if(b&&typeof b!="function")throw Error(i(231,h,typeof b));return b}var ul=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),hM=!1;if(ul)try{var Lm={};Object.defineProperty(Lm,"passive",{get:function(){hM=!0}}),window.addEventListener("test",Lm,Lm),window.removeEventListener("test",Lm,Lm)}catch{hM=!1}var Dc=null,pM=null,mv=null;function sL(){if(mv)return mv;var u,h=pM,b=h.length,S,R="value"in Dc?Dc.value:Dc.textContent,k=R.length;for(u=0;u<b&&h[u]===R[u];u++);var G=b-u;for(S=1;S<=G&&h[b-S]===R[k-S];S++);return mv=R.slice(u,1<S?1-S:void 0)}function gv(u){var h=u.keyCode;return"charCode"in u?(u=u.charCode,u===0&&h===13&&(u=13)):u=h,u===10&&(u=13),32<=u||u===13?u:0}function xv(){return!0}function oL(){return!1}function Ma(u){function h(b,S,R,k,G){this._reactName=b,this._targetInst=R,this.type=S,this.nativeEvent=k,this.target=G,this.currentTarget=null;for(var ie in u)u.hasOwnProperty(ie)&&(b=u[ie],this[ie]=b?b(k):k[ie]);return this.isDefaultPrevented=(k.defaultPrevented!=null?k.defaultPrevented:k.returnValue===!1)?xv:oL,this.isPropagationStopped=oL,this}return f(h.prototype,{preventDefault:function(){this.defaultPrevented=!0;var b=this.nativeEvent;b&&(b.preventDefault?b.preventDefault():typeof b.returnValue!="unknown"&&(b.returnValue=!1),this.isDefaultPrevented=xv)},stopPropagation:function(){var b=this.nativeEvent;b&&(b.stopPropagation?b.stopPropagation():typeof b.cancelBubble!="unknown"&&(b.cancelBubble=!0),this.isPropagationStopped=xv)},persist:function(){},isPersistent:xv}),h}var dd={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(u){return u.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},vv=Ma(dd),Im=f({},dd,{view:0,detail:0}),zJ=Ma(Im),mM,gM,Um,yv=f({},Im,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:vM,button:0,buttons:0,relatedTarget:function(u){return u.relatedTarget===void 0?u.fromElement===u.srcElement?u.toElement:u.fromElement:u.relatedTarget},movementX:function(u){return"movementX"in u?u.movementX:(u!==Um&&(Um&&u.type==="mousemove"?(mM=u.screenX-Um.screenX,gM=u.screenY-Um.screenY):gM=mM=0,Um=u),mM)},movementY:function(u){return"movementY"in u?u.movementY:gM}}),lL=Ma(yv),BJ=f({},yv,{dataTransfer:0}),HJ=Ma(BJ),VJ=f({},Im,{relatedTarget:0}),xM=Ma(VJ),$J=f({},dd,{animationName:0,elapsedTime:0,pseudoElement:0}),GJ=Ma($J),WJ=f({},dd,{clipboardData:function(u){return"clipboardData"in u?u.clipboardData:window.clipboardData}}),qJ=Ma(WJ),XJ=f({},dd,{data:0}),cL=Ma(XJ),KJ={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},YJ={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"},ZJ={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function QJ(u){var h=this.nativeEvent;return h.getModifierState?h.getModifierState(u):(u=ZJ[u])?!!h[u]:!1}function vM(){return QJ}var JJ=f({},Im,{key:function(u){if(u.key){var h=KJ[u.key]||u.key;if(h!=="Unidentified")return h}return u.type==="keypress"?(u=gv(u),u===13?"Enter":String.fromCharCode(u)):u.type==="keydown"||u.type==="keyup"?YJ[u.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:vM,charCode:function(u){return u.type==="keypress"?gv(u):0},keyCode:function(u){return u.type==="keydown"||u.type==="keyup"?u.keyCode:0},which:function(u){return u.type==="keypress"?gv(u):u.type==="keydown"||u.type==="keyup"?u.keyCode:0}}),eee=Ma(JJ),tee=f({},yv,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),uL=Ma(tee),nee=f({},Im,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:vM}),iee=Ma(nee),ree=f({},dd,{propertyName:0,elapsedTime:0,pseudoElement:0}),aee=Ma(ree),see=f({},yv,{deltaX:function(u){return"deltaX"in u?u.deltaX:"wheelDeltaX"in u?-u.wheelDeltaX:0},deltaY:function(u){return"deltaY"in u?u.deltaY:"wheelDeltaY"in u?-u.wheelDeltaY:"wheelDelta"in u?-u.wheelDelta:0},deltaZ:0,deltaMode:0}),oee=Ma(see),lee=f({},dd,{newState:0,oldState:0}),cee=Ma(lee),uee=[9,13,27,32],yM=ul&&"CompositionEvent"in window,jm=null;ul&&"documentMode"in document&&(jm=document.documentMode);var dee=ul&&"TextEvent"in window&&!jm,dL=ul&&(!yM||jm&&8<jm&&11>=jm),fL=" ",hL=!1;function pL(u,h){switch(u){case"keyup":return uee.indexOf(h.keyCode)!==-1;case"keydown":return h.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function mL(u){return u=u.detail,typeof u=="object"&&"data"in u?u.data:null}var Xf=!1;function fee(u,h){switch(u){case"compositionend":return mL(h);case"keypress":return h.which!==32?null:(hL=!0,fL);case"textInput":return u=h.data,u===fL&&hL?null:u;default:return null}}function hee(u,h){if(Xf)return u==="compositionend"||!yM&&pL(u,h)?(u=sL(),mv=pM=Dc=null,Xf=!1,u):null;switch(u){case"paste":return null;case"keypress":if(!(h.ctrlKey||h.altKey||h.metaKey)||h.ctrlKey&&h.altKey){if(h.char&&1<h.char.length)return h.char;if(h.which)return String.fromCharCode(h.which)}return null;case"compositionend":return dL&&h.locale!=="ko"?null:h.data;default:return null}}var pee={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 gL(u){var h=u&&u.nodeName&&u.nodeName.toLowerCase();return h==="input"?!!pee[u.type]:h==="textarea"}function xL(u,h,b,S){Wf?qf?qf.push(S):qf=[S]:Wf=S,h=ly(h,"onChange"),0<h.length&&(b=new vv("onChange","change",null,b,S),u.push({event:b,listeners:h}))}var Fm=null,zm=null;function mee(u){J4(u,0)}function bv(u){var h=be(u);if(Kt(h))return u}function vL(u,h){if(u==="change")return h}var yL=!1;if(ul){var bM;if(ul){var _M="oninput"in document;if(!_M){var bL=document.createElement("div");bL.setAttribute("oninput","return;"),_M=typeof bL.oninput=="function"}bM=_M}else bM=!1;yL=bM&&(!document.documentMode||9<document.documentMode)}function _L(){Fm&&(Fm.detachEvent("onpropertychange",SL),zm=Fm=null)}function SL(u){if(u.propertyName==="value"&&bv(zm)){var h=[];xL(h,zm,u,dM(u)),aL(mee,h)}}function gee(u,h,b){u==="focusin"?(_L(),Fm=h,zm=b,Fm.attachEvent("onpropertychange",SL)):u==="focusout"&&_L()}function xee(u){if(u==="selectionchange"||u==="keyup"||u==="keydown")return bv(zm)}function vee(u,h){if(u==="click")return bv(h)}function yee(u,h){if(u==="input"||u==="change")return bv(h)}function bee(u,h){return u===h&&(u!==0||1/u===1/h)||u!==u&&h!==h}var Ga=typeof Object.is=="function"?Object.is:bee;function Bm(u,h){if(Ga(u,h))return!0;if(typeof u!="object"||u===null||typeof h!="object"||h===null)return!1;var b=Object.keys(u),S=Object.keys(h);if(b.length!==S.length)return!1;for(S=0;S<b.length;S++){var R=b[S];if(!oe.call(h,R)||!Ga(u[R],h[R]))return!1}return!0}function wL(u){for(;u&&u.firstChild;)u=u.firstChild;return u}function ML(u,h){var b=wL(u);u=0;for(var S;b;){if(b.nodeType===3){if(S=u+b.textContent.length,u<=h&&S>=h)return{node:b,offset:h-u};u=S}e:{for(;b;){if(b.nextSibling){b=b.nextSibling;break e}b=b.parentNode}b=void 0}b=wL(b)}}function EL(u,h){return u&&h?u===h?!0:u&&u.nodeType===3?!1:h&&h.nodeType===3?EL(u,h.parentNode):"contains"in u?u.contains(h):u.compareDocumentPosition?!!(u.compareDocumentPosition(h)&16):!1:!1}function AL(u){u=u!=null&&u.ownerDocument!=null&&u.ownerDocument.defaultView!=null?u.ownerDocument.defaultView:window;for(var h=yi(u.document);h instanceof u.HTMLIFrameElement;){try{var b=typeof h.contentWindow.location.href=="string"}catch{b=!1}if(b)u=h.contentWindow;else break;h=yi(u.document)}return h}function SM(u){var h=u&&u.nodeName&&u.nodeName.toLowerCase();return h&&(h==="input"&&(u.type==="text"||u.type==="search"||u.type==="tel"||u.type==="url"||u.type==="password")||h==="textarea"||u.contentEditable==="true")}var _ee=ul&&"documentMode"in document&&11>=document.documentMode,Kf=null,wM=null,Hm=null,MM=!1;function TL(u,h,b){var S=b.window===b?b.document:b.nodeType===9?b:b.ownerDocument;MM||Kf==null||Kf!==yi(S)||(S=Kf,"selectionStart"in S&&SM(S)?S={start:S.selectionStart,end:S.selectionEnd}:(S=(S.ownerDocument&&S.ownerDocument.defaultView||window).getSelection(),S={anchorNode:S.anchorNode,anchorOffset:S.anchorOffset,focusNode:S.focusNode,focusOffset:S.focusOffset}),Hm&&Bm(Hm,S)||(Hm=S,S=ly(wM,"onSelect"),0<S.length&&(h=new vv("onSelect","select",null,h,b),u.push({event:h,listeners:S}),h.target=Kf)))}function fd(u,h){var b={};return b[u.toLowerCase()]=h.toLowerCase(),b["Webkit"+u]="webkit"+h,b["Moz"+u]="moz"+h,b}var Yf={animationend:fd("Animation","AnimationEnd"),animationiteration:fd("Animation","AnimationIteration"),animationstart:fd("Animation","AnimationStart"),transitionrun:fd("Transition","TransitionRun"),transitionstart:fd("Transition","TransitionStart"),transitioncancel:fd("Transition","TransitionCancel"),transitionend:fd("Transition","TransitionEnd")},EM={},CL={};ul&&(CL=document.createElement("div").style,"AnimationEvent"in window||(delete Yf.animationend.animation,delete Yf.animationiteration.animation,delete Yf.animationstart.animation),"TransitionEvent"in window||delete Yf.transitionend.transition);function hd(u){if(EM[u])return EM[u];if(!Yf[u])return u;var h=Yf[u],b;for(b in h)if(h.hasOwnProperty(b)&&b in CL)return EM[u]=h[b];return u}var NL=hd("animationend"),RL=hd("animationiteration"),PL=hd("animationstart"),See=hd("transitionrun"),wee=hd("transitionstart"),Mee=hd("transitioncancel"),DL=hd("transitionend"),kL=new Map,AM="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(" ");AM.push("scrollEnd");function Js(u,h){kL.set(u,h),dt(h,[u])}var _v=typeof reportError=="function"?reportError:function(u){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var h=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof u=="object"&&u!==null&&typeof u.message=="string"?String(u.message):String(u),error:u});if(!window.dispatchEvent(h))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",u);return}console.error(u)},ms=[],Zf=0,TM=0;function Sv(){for(var u=Zf,h=TM=Zf=0;h<u;){var b=ms[h];ms[h++]=null;var S=ms[h];ms[h++]=null;var R=ms[h];ms[h++]=null;var k=ms[h];if(ms[h++]=null,S!==null&&R!==null){var G=S.pending;G===null?R.next=R:(R.next=G.next,G.next=R),S.pending=R}k!==0&&OL(b,R,k)}}function wv(u,h,b,S){ms[Zf++]=u,ms[Zf++]=h,ms[Zf++]=b,ms[Zf++]=S,TM|=S,u.lanes|=S,u=u.alternate,u!==null&&(u.lanes|=S)}function CM(u,h,b,S){return wv(u,h,b,S),Mv(u)}function pd(u,h){return wv(u,null,null,h),Mv(u)}function OL(u,h,b){u.lanes|=b;var S=u.alternate;S!==null&&(S.lanes|=b);for(var R=!1,k=u.return;k!==null;)k.childLanes|=b,S=k.alternate,S!==null&&(S.childLanes|=b),k.tag===22&&(u=k.stateNode,u===null||u._visibility&1||(R=!0)),u=k,k=k.return;return u.tag===3?(k=u.stateNode,R&&h!==null&&(R=31-nt(b),u=k.hiddenUpdates,S=u[R],S===null?u[R]=[h]:S.push(h),h.lane=b|536870912),k):null}function Mv(u){if(50<ug)throw ug=0,UE=null,Error(i(185));for(var h=u.return;h!==null;)u=h,h=u.return;return u.tag===3?u.stateNode:null}var Qf={};function Eee(u,h,b,S){this.tag=u,this.key=b,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=h,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=S,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Wa(u,h,b,S){return new Eee(u,h,b,S)}function NM(u){return u=u.prototype,!(!u||!u.isReactComponent)}function dl(u,h){var b=u.alternate;return b===null?(b=Wa(u.tag,h,u.key,u.mode),b.elementType=u.elementType,b.type=u.type,b.stateNode=u.stateNode,b.alternate=u,u.alternate=b):(b.pendingProps=h,b.type=u.type,b.flags=0,b.subtreeFlags=0,b.deletions=null),b.flags=u.flags&65011712,b.childLanes=u.childLanes,b.lanes=u.lanes,b.child=u.child,b.memoizedProps=u.memoizedProps,b.memoizedState=u.memoizedState,b.updateQueue=u.updateQueue,h=u.dependencies,b.dependencies=h===null?null:{lanes:h.lanes,firstContext:h.firstContext},b.sibling=u.sibling,b.index=u.index,b.ref=u.ref,b.refCleanup=u.refCleanup,b}function LL(u,h){u.flags&=65011714;var b=u.alternate;return b===null?(u.childLanes=0,u.lanes=h,u.child=null,u.subtreeFlags=0,u.memoizedProps=null,u.memoizedState=null,u.updateQueue=null,u.dependencies=null,u.stateNode=null):(u.childLanes=b.childLanes,u.lanes=b.lanes,u.child=b.child,u.subtreeFlags=0,u.deletions=null,u.memoizedProps=b.memoizedProps,u.memoizedState=b.memoizedState,u.updateQueue=b.updateQueue,u.type=b.type,h=b.dependencies,u.dependencies=h===null?null:{lanes:h.lanes,firstContext:h.firstContext}),u}function Ev(u,h,b,S,R,k){var G=0;if(S=u,typeof u=="function")NM(u)&&(G=1);else if(typeof u=="string")G=Rte(u,b,ce.current)?26:u==="html"||u==="head"||u==="body"?27:5;else e:switch(u){case N:return u=Wa(31,b,h,R),u.elementType=N,u.lanes=k,u;case _:return md(b.children,R,k,h);case v:G=8,R|=24;break;case x:return u=Wa(12,b,h,R|2),u.elementType=x,u.lanes=k,u;case C:return u=Wa(13,b,h,R),u.elementType=C,u.lanes=k,u;case P:return u=Wa(19,b,h,R),u.elementType=P,u.lanes=k,u;default:if(typeof u=="object"&&u!==null)switch(u.$$typeof){case w:G=10;break e;case M:G=9;break e;case T:G=11;break e;case A:G=14;break e;case U:G=16,S=null;break e}G=29,b=Error(i(130,u===null?"null":typeof u,"")),S=null}return h=Wa(G,b,h,R),h.elementType=u,h.type=S,h.lanes=k,h}function md(u,h,b,S){return u=Wa(7,u,S,h),u.lanes=b,u}function RM(u,h,b){return u=Wa(6,u,null,h),u.lanes=b,u}function IL(u){var h=Wa(18,null,null,0);return h.stateNode=u,h}function PM(u,h,b){return h=Wa(4,u.children!==null?u.children:[],u.key,h),h.lanes=b,h.stateNode={containerInfo:u.containerInfo,pendingChildren:null,implementation:u.implementation},h}var UL=new WeakMap;function gs(u,h){if(typeof u=="object"&&u!==null){var b=UL.get(u);return b!==void 0?b:(h={value:u,source:h,stack:ee(h)},UL.set(u,h),h)}return{value:u,source:h,stack:ee(h)}}var Jf=[],eh=0,Av=null,Vm=0,xs=[],vs=0,kc=null,Co=1,No="";function fl(u,h){Jf[eh++]=Vm,Jf[eh++]=Av,Av=u,Vm=h}function jL(u,h,b){xs[vs++]=Co,xs[vs++]=No,xs[vs++]=kc,kc=u;var S=Co;u=No;var R=32-nt(S)-1;S&=~(1<<R),b+=1;var k=32-nt(h)+R;if(30<k){var G=R-R%5;k=(S&(1<<G)-1).toString(32),S>>=G,R-=G,Co=1<<32-nt(h)+R|b<<R|S,No=k+u}else Co=1<<k|b<<R|S,No=u}function DM(u){u.return!==null&&(fl(u,1),jL(u,1,0))}function kM(u){for(;u===Av;)Av=Jf[--eh],Jf[eh]=null,Vm=Jf[--eh],Jf[eh]=null;for(;u===kc;)kc=xs[--vs],xs[vs]=null,No=xs[--vs],xs[vs]=null,Co=xs[--vs],xs[vs]=null}function FL(u,h){xs[vs++]=Co,xs[vs++]=No,xs[vs++]=kc,Co=h.id,No=h.overflow,kc=u}var Pr=null,ti=null,yn=!1,Oc=null,ys=!1,OM=Error(i(519));function Lc(u){var h=Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw $m(gs(h,u)),OM}function zL(u){var h=u.stateNode,b=u.type,S=u.memoizedProps;switch(h[hi]=u,h[Ai]=S,b){case"dialog":hn("cancel",h),hn("close",h);break;case"iframe":case"object":case"embed":hn("load",h);break;case"video":case"audio":for(b=0;b<fg.length;b++)hn(fg[b],h);break;case"source":hn("error",h);break;case"img":case"image":case"link":hn("error",h),hn("load",h);break;case"details":hn("toggle",h);break;case"input":hn("invalid",h),Pn(h,S.value,S.defaultValue,S.checked,S.defaultChecked,S.type,S.name,!0);break;case"select":hn("invalid",h);break;case"textarea":hn("invalid",h),Rr(h,S.value,S.defaultValue,S.children)}b=S.children,typeof b!="string"&&typeof b!="number"&&typeof b!="bigint"||h.textContent===""+b||S.suppressHydrationWarning===!0||iU(h.textContent,b)?(S.popover!=null&&(hn("beforetoggle",h),hn("toggle",h)),S.onScroll!=null&&hn("scroll",h),S.onScrollEnd!=null&&hn("scrollend",h),S.onClick!=null&&(h.onclick=cl),h=!0):h=!1,h||Lc(u,!0)}function BL(u){for(Pr=u.return;Pr;)switch(Pr.tag){case 5:case 31:case 13:ys=!1;return;case 27:case 3:ys=!0;return;default:Pr=Pr.return}}function th(u){if(u!==Pr)return!1;if(!yn)return BL(u),yn=!0,!1;var h=u.tag,b;if((b=h!==3&&h!==27)&&((b=h===5)&&(b=u.type,b=!(b!=="form"&&b!=="button")||QE(u.type,u.memoizedProps)),b=!b),b&&ti&&Lc(u),BL(u),h===13){if(u=u.memoizedState,u=u!==null?u.dehydrated:null,!u)throw Error(i(317));ti=fU(u)}else if(h===31){if(u=u.memoizedState,u=u!==null?u.dehydrated:null,!u)throw Error(i(317));ti=fU(u)}else h===27?(h=ti,Kc(u.type)?(u=iA,iA=null,ti=u):ti=h):ti=Pr?_s(u.stateNode.nextSibling):null;return!0}function gd(){ti=Pr=null,yn=!1}function LM(){var u=Oc;return u!==null&&(Ca===null?Ca=u:Ca.push.apply(Ca,u),Oc=null),u}function $m(u){Oc===null?Oc=[u]:Oc.push(u)}var IM=V(null),xd=null,hl=null;function Ic(u,h,b){ae(IM,h._currentValue),h._currentValue=b}function pl(u){u._currentValue=IM.current,X(IM)}function UM(u,h,b){for(;u!==null;){var S=u.alternate;if((u.childLanes&h)!==h?(u.childLanes|=h,S!==null&&(S.childLanes|=h)):S!==null&&(S.childLanes&h)!==h&&(S.childLanes|=h),u===b)break;u=u.return}}function jM(u,h,b,S){var R=u.child;for(R!==null&&(R.return=u);R!==null;){var k=R.dependencies;if(k!==null){var G=R.child;k=k.firstContext;e:for(;k!==null;){var ie=k;k=R;for(var _e=0;_e<h.length;_e++)if(ie.context===h[_e]){k.lanes|=b,ie=k.alternate,ie!==null&&(ie.lanes|=b),UM(k.return,b,u),S||(G=null);break e}k=ie.next}}else if(R.tag===18){if(G=R.return,G===null)throw Error(i(341));G.lanes|=b,k=G.alternate,k!==null&&(k.lanes|=b),UM(G,b,u),G=null}else G=R.child;if(G!==null)G.return=R;else for(G=R;G!==null;){if(G===u){G=null;break}if(R=G.sibling,R!==null){R.return=G.return,G=R;break}G=G.return}R=G}}function nh(u,h,b,S){u=null;for(var R=h,k=!1;R!==null;){if(!k){if((R.flags&524288)!==0)k=!0;else if((R.flags&262144)!==0)break}if(R.tag===10){var G=R.alternate;if(G===null)throw Error(i(387));if(G=G.memoizedProps,G!==null){var ie=R.type;Ga(R.pendingProps.value,G.value)||(u!==null?u.push(ie):u=[ie])}}else if(R===ve.current){if(G=R.alternate,G===null)throw Error(i(387));G.memoizedState.memoizedState!==R.memoizedState.memoizedState&&(u!==null?u.push(xg):u=[xg])}R=R.return}u!==null&&jM(h,u,b,S),h.flags|=262144}function Tv(u){for(u=u.firstContext;u!==null;){if(!Ga(u.context._currentValue,u.memoizedValue))return!0;u=u.next}return!1}function vd(u){xd=u,hl=null,u=u.dependencies,u!==null&&(u.firstContext=null)}function Dr(u){return HL(xd,u)}function Cv(u,h){return xd===null&&vd(u),HL(u,h)}function HL(u,h){var b=h._currentValue;if(h={context:h,memoizedValue:b,next:null},hl===null){if(u===null)throw Error(i(308));hl=h,u.dependencies={lanes:0,firstContext:h},u.flags|=524288}else hl=hl.next=h;return b}var Aee=typeof AbortController<"u"?AbortController:function(){var u=[],h=this.signal={aborted:!1,addEventListener:function(b,S){u.push(S)}};this.abort=function(){h.aborted=!0,u.forEach(function(b){return b()})}},Tee=t.unstable_scheduleCallback,Cee=t.unstable_NormalPriority,Ii={$$typeof:w,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function FM(){return{controller:new Aee,data:new Map,refCount:0}}function Gm(u){u.refCount--,u.refCount===0&&Tee(Cee,function(){u.controller.abort()})}var Wm=null,zM=0,ih=0,rh=null;function Nee(u,h){if(Wm===null){var b=Wm=[];zM=0,ih=VE(),rh={status:"pending",value:void 0,then:function(S){b.push(S)}}}return zM++,h.then(VL,VL),h}function VL(){if(--zM===0&&Wm!==null){rh!==null&&(rh.status="fulfilled");var u=Wm;Wm=null,ih=0,rh=null;for(var h=0;h<u.length;h++)(0,u[h])()}}function Ree(u,h){var b=[],S={status:"pending",value:null,reason:null,then:function(R){b.push(R)}};return u.then(function(){S.status="fulfilled",S.value=h;for(var R=0;R<b.length;R++)(0,b[R])(h)},function(R){for(S.status="rejected",S.reason=R,R=0;R<b.length;R++)(0,b[R])(void 0)}),S}var $L=H.S;H.S=function(u,h){T4=L(),typeof h=="object"&&h!==null&&typeof h.then=="function"&&Nee(u,h),$L!==null&&$L(u,h)};var yd=V(null);function BM(){var u=yd.current;return u!==null?u:qn.pooledCache}function Nv(u,h){h===null?ae(yd,yd.current):ae(yd,h.pool)}function GL(){var u=BM();return u===null?null:{parent:Ii._currentValue,pool:u}}var ah=Error(i(460)),HM=Error(i(474)),Rv=Error(i(542)),Pv={then:function(){}};function WL(u){return u=u.status,u==="fulfilled"||u==="rejected"}function qL(u,h,b){switch(b=u[b],b===void 0?u.push(h):b!==h&&(h.then(cl,cl),h=b),h.status){case"fulfilled":return h.value;case"rejected":throw u=h.reason,KL(u),u;default:if(typeof h.status=="string")h.then(cl,cl);else{if(u=qn,u!==null&&100<u.shellSuspendCounter)throw Error(i(482));u=h,u.status="pending",u.then(function(S){if(h.status==="pending"){var R=h;R.status="fulfilled",R.value=S}},function(S){if(h.status==="pending"){var R=h;R.status="rejected",R.reason=S}})}switch(h.status){case"fulfilled":return h.value;case"rejected":throw u=h.reason,KL(u),u}throw _d=h,ah}}function bd(u){try{var h=u._init;return h(u._payload)}catch(b){throw b!==null&&typeof b=="object"&&typeof b.then=="function"?(_d=b,ah):b}}var _d=null;function XL(){if(_d===null)throw Error(i(459));var u=_d;return _d=null,u}function KL(u){if(u===ah||u===Rv)throw Error(i(483))}var sh=null,qm=0;function Dv(u){var h=qm;return qm+=1,sh===null&&(sh=[]),qL(sh,u,h)}function Xm(u,h){h=h.props.ref,u.ref=h!==void 0?h:null}function kv(u,h){throw h.$$typeof===m?Error(i(525)):(u=Object.prototype.toString.call(h),Error(i(31,u==="[object Object]"?"object with keys {"+Object.keys(h).join(", ")+"}":u)))}function YL(u){function h(ke,Ee){if(u){var Fe=ke.deletions;Fe===null?(ke.deletions=[Ee],ke.flags|=16):Fe.push(Ee)}}function b(ke,Ee){if(!u)return null;for(;Ee!==null;)h(ke,Ee),Ee=Ee.sibling;return null}function S(ke){for(var Ee=new Map;ke!==null;)ke.key!==null?Ee.set(ke.key,ke):Ee.set(ke.index,ke),ke=ke.sibling;return Ee}function R(ke,Ee){return ke=dl(ke,Ee),ke.index=0,ke.sibling=null,ke}function k(ke,Ee,Fe){return ke.index=Fe,u?(Fe=ke.alternate,Fe!==null?(Fe=Fe.index,Fe<Ee?(ke.flags|=67108866,Ee):Fe):(ke.flags|=67108866,Ee)):(ke.flags|=1048576,Ee)}function G(ke){return u&&ke.alternate===null&&(ke.flags|=67108866),ke}function ie(ke,Ee,Fe,rt){return Ee===null||Ee.tag!==6?(Ee=RM(Fe,ke.mode,rt),Ee.return=ke,Ee):(Ee=R(Ee,Fe),Ee.return=ke,Ee)}function _e(ke,Ee,Fe,rt){var Ut=Fe.type;return Ut===_?Je(ke,Ee,Fe.props.children,rt,Fe.key):Ee!==null&&(Ee.elementType===Ut||typeof Ut=="object"&&Ut!==null&&Ut.$$typeof===U&&bd(Ut)===Ee.type)?(Ee=R(Ee,Fe.props),Xm(Ee,Fe),Ee.return=ke,Ee):(Ee=Ev(Fe.type,Fe.key,Fe.props,null,ke.mode,rt),Xm(Ee,Fe),Ee.return=ke,Ee)}function ze(ke,Ee,Fe,rt){return Ee===null||Ee.tag!==4||Ee.stateNode.containerInfo!==Fe.containerInfo||Ee.stateNode.implementation!==Fe.implementation?(Ee=PM(Fe,ke.mode,rt),Ee.return=ke,Ee):(Ee=R(Ee,Fe.children||[]),Ee.return=ke,Ee)}function Je(ke,Ee,Fe,rt,Ut){return Ee===null||Ee.tag!==7?(Ee=md(Fe,ke.mode,rt,Ut),Ee.return=ke,Ee):(Ee=R(Ee,Fe),Ee.return=ke,Ee)}function ot(ke,Ee,Fe){if(typeof Ee=="string"&&Ee!==""||typeof Ee=="number"||typeof Ee=="bigint")return Ee=RM(""+Ee,ke.mode,Fe),Ee.return=ke,Ee;if(typeof Ee=="object"&&Ee!==null){switch(Ee.$$typeof){case g:return Fe=Ev(Ee.type,Ee.key,Ee.props,null,ke.mode,Fe),Xm(Fe,Ee),Fe.return=ke,Fe;case y:return Ee=PM(Ee,ke.mode,Fe),Ee.return=ke,Ee;case U:return Ee=bd(Ee),ot(ke,Ee,Fe)}if(B(Ee)||I(Ee))return Ee=md(Ee,ke.mode,Fe,null),Ee.return=ke,Ee;if(typeof Ee.then=="function")return ot(ke,Dv(Ee),Fe);if(Ee.$$typeof===w)return ot(ke,Cv(ke,Ee),Fe);kv(ke,Ee)}return null}function Ve(ke,Ee,Fe,rt){var Ut=Ee!==null?Ee.key:null;if(typeof Fe=="string"&&Fe!==""||typeof Fe=="number"||typeof Fe=="bigint")return Ut!==null?null:ie(ke,Ee,""+Fe,rt);if(typeof Fe=="object"&&Fe!==null){switch(Fe.$$typeof){case g:return Fe.key===Ut?_e(ke,Ee,Fe,rt):null;case y:return Fe.key===Ut?ze(ke,Ee,Fe,rt):null;case U:return Fe=bd(Fe),Ve(ke,Ee,Fe,rt)}if(B(Fe)||I(Fe))return Ut!==null?null:Je(ke,Ee,Fe,rt,null);if(typeof Fe.then=="function")return Ve(ke,Ee,Dv(Fe),rt);if(Fe.$$typeof===w)return Ve(ke,Ee,Cv(ke,Fe),rt);kv(ke,Fe)}return null}function Ke(ke,Ee,Fe,rt,Ut){if(typeof rt=="string"&&rt!==""||typeof rt=="number"||typeof rt=="bigint")return ke=ke.get(Fe)||null,ie(Ee,ke,""+rt,Ut);if(typeof rt=="object"&&rt!==null){switch(rt.$$typeof){case g:return ke=ke.get(rt.key===null?Fe:rt.key)||null,_e(Ee,ke,rt,Ut);case y:return ke=ke.get(rt.key===null?Fe:rt.key)||null,ze(Ee,ke,rt,Ut);case U:return rt=bd(rt),Ke(ke,Ee,Fe,rt,Ut)}if(B(rt)||I(rt))return ke=ke.get(Fe)||null,Je(Ee,ke,rt,Ut,null);if(typeof rt.then=="function")return Ke(ke,Ee,Fe,Dv(rt),Ut);if(rt.$$typeof===w)return Ke(ke,Ee,Fe,Cv(Ee,rt),Ut);kv(Ee,rt)}return null}function Ct(ke,Ee,Fe,rt){for(var Ut=null,Sn=null,Pt=Ee,Jt=Ee=0,xn=null;Pt!==null&&Jt<Fe.length;Jt++){Pt.index>Jt?(xn=Pt,Pt=null):xn=Pt.sibling;var wn=Ve(ke,Pt,Fe[Jt],rt);if(wn===null){Pt===null&&(Pt=xn);break}u&&Pt&&wn.alternate===null&&h(ke,Pt),Ee=k(wn,Ee,Jt),Sn===null?Ut=wn:Sn.sibling=wn,Sn=wn,Pt=xn}if(Jt===Fe.length)return b(ke,Pt),yn&&fl(ke,Jt),Ut;if(Pt===null){for(;Jt<Fe.length;Jt++)Pt=ot(ke,Fe[Jt],rt),Pt!==null&&(Ee=k(Pt,Ee,Jt),Sn===null?Ut=Pt:Sn.sibling=Pt,Sn=Pt);return yn&&fl(ke,Jt),Ut}for(Pt=S(Pt);Jt<Fe.length;Jt++)xn=Ke(Pt,ke,Jt,Fe[Jt],rt),xn!==null&&(u&&xn.alternate!==null&&Pt.delete(xn.key===null?Jt:xn.key),Ee=k(xn,Ee,Jt),Sn===null?Ut=xn:Sn.sibling=xn,Sn=xn);return u&&Pt.forEach(function(eu){return h(ke,eu)}),yn&&fl(ke,Jt),Ut}function Bt(ke,Ee,Fe,rt){if(Fe==null)throw Error(i(151));for(var Ut=null,Sn=null,Pt=Ee,Jt=Ee=0,xn=null,wn=Fe.next();Pt!==null&&!wn.done;Jt++,wn=Fe.next()){Pt.index>Jt?(xn=Pt,Pt=null):xn=Pt.sibling;var eu=Ve(ke,Pt,wn.value,rt);if(eu===null){Pt===null&&(Pt=xn);break}u&&Pt&&eu.alternate===null&&h(ke,Pt),Ee=k(eu,Ee,Jt),Sn===null?Ut=eu:Sn.sibling=eu,Sn=eu,Pt=xn}if(wn.done)return b(ke,Pt),yn&&fl(ke,Jt),Ut;if(Pt===null){for(;!wn.done;Jt++,wn=Fe.next())wn=ot(ke,wn.value,rt),wn!==null&&(Ee=k(wn,Ee,Jt),Sn===null?Ut=wn:Sn.sibling=wn,Sn=wn);return yn&&fl(ke,Jt),Ut}for(Pt=S(Pt);!wn.done;Jt++,wn=Fe.next())wn=Ke(Pt,ke,Jt,wn.value,rt),wn!==null&&(u&&wn.alternate!==null&&Pt.delete(wn.key===null?Jt:wn.key),Ee=k(wn,Ee,Jt),Sn===null?Ut=wn:Sn.sibling=wn,Sn=wn);return u&&Pt.forEach(function(Bte){return h(ke,Bte)}),yn&&fl(ke,Jt),Ut}function jn(ke,Ee,Fe,rt){if(typeof Fe=="object"&&Fe!==null&&Fe.type===_&&Fe.key===null&&(Fe=Fe.props.children),typeof Fe=="object"&&Fe!==null){switch(Fe.$$typeof){case g:e:{for(var Ut=Fe.key;Ee!==null;){if(Ee.key===Ut){if(Ut=Fe.type,Ut===_){if(Ee.tag===7){b(ke,Ee.sibling),rt=R(Ee,Fe.props.children),rt.return=ke,ke=rt;break e}}else if(Ee.elementType===Ut||typeof Ut=="object"&&Ut!==null&&Ut.$$typeof===U&&bd(Ut)===Ee.type){b(ke,Ee.sibling),rt=R(Ee,Fe.props),Xm(rt,Fe),rt.return=ke,ke=rt;break e}b(ke,Ee);break}else h(ke,Ee);Ee=Ee.sibling}Fe.type===_?(rt=md(Fe.props.children,ke.mode,rt,Fe.key),rt.return=ke,ke=rt):(rt=Ev(Fe.type,Fe.key,Fe.props,null,ke.mode,rt),Xm(rt,Fe),rt.return=ke,ke=rt)}return G(ke);case y:e:{for(Ut=Fe.key;Ee!==null;){if(Ee.key===Ut)if(Ee.tag===4&&Ee.stateNode.containerInfo===Fe.containerInfo&&Ee.stateNode.implementation===Fe.implementation){b(ke,Ee.sibling),rt=R(Ee,Fe.children||[]),rt.return=ke,ke=rt;break e}else{b(ke,Ee);break}else h(ke,Ee);Ee=Ee.sibling}rt=PM(Fe,ke.mode,rt),rt.return=ke,ke=rt}return G(ke);case U:return Fe=bd(Fe),jn(ke,Ee,Fe,rt)}if(B(Fe))return Ct(ke,Ee,Fe,rt);if(I(Fe)){if(Ut=I(Fe),typeof Ut!="function")throw Error(i(150));return Fe=Ut.call(Fe),Bt(ke,Ee,Fe,rt)}if(typeof Fe.then=="function")return jn(ke,Ee,Dv(Fe),rt);if(Fe.$$typeof===w)return jn(ke,Ee,Cv(ke,Fe),rt);kv(ke,Fe)}return typeof Fe=="string"&&Fe!==""||typeof Fe=="number"||typeof Fe=="bigint"?(Fe=""+Fe,Ee!==null&&Ee.tag===6?(b(ke,Ee.sibling),rt=R(Ee,Fe),rt.return=ke,ke=rt):(b(ke,Ee),rt=RM(Fe,ke.mode,rt),rt.return=ke,ke=rt),G(ke)):b(ke,Ee)}return function(ke,Ee,Fe,rt){try{qm=0;var Ut=jn(ke,Ee,Fe,rt);return sh=null,Ut}catch(Pt){if(Pt===ah||Pt===Rv)throw Pt;var Sn=Wa(29,Pt,null,ke.mode);return Sn.lanes=rt,Sn.return=ke,Sn}finally{}}}var Sd=YL(!0),ZL=YL(!1),Uc=!1;function VM(u){u.updateQueue={baseState:u.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function $M(u,h){u=u.updateQueue,h.updateQueue===u&&(h.updateQueue={baseState:u.baseState,firstBaseUpdate:u.firstBaseUpdate,lastBaseUpdate:u.lastBaseUpdate,shared:u.shared,callbacks:null})}function jc(u){return{lane:u,tag:0,payload:null,callback:null,next:null}}function Fc(u,h,b){var S=u.updateQueue;if(S===null)return null;if(S=S.shared,(Tn&2)!==0){var R=S.pending;return R===null?h.next=h:(h.next=R.next,R.next=h),S.pending=h,h=Mv(u),OL(u,null,b),h}return wv(u,S,h,b),Mv(u)}function Km(u,h,b){if(h=h.updateQueue,h!==null&&(h=h.shared,(b&4194048)!==0)){var S=h.lanes;S&=u.pendingLanes,b|=S,h.lanes=b,Wn(u,b)}}function GM(u,h){var b=u.updateQueue,S=u.alternate;if(S!==null&&(S=S.updateQueue,b===S)){var R=null,k=null;if(b=b.firstBaseUpdate,b!==null){do{var G={lane:b.lane,tag:b.tag,payload:b.payload,callback:null,next:null};k===null?R=k=G:k=k.next=G,b=b.next}while(b!==null);k===null?R=k=h:k=k.next=h}else R=k=h;b={baseState:S.baseState,firstBaseUpdate:R,lastBaseUpdate:k,shared:S.shared,callbacks:S.callbacks},u.updateQueue=b;return}u=b.lastBaseUpdate,u===null?b.firstBaseUpdate=h:u.next=h,b.lastBaseUpdate=h}var WM=!1;function Ym(){if(WM){var u=rh;if(u!==null)throw u}}function Zm(u,h,b,S){WM=!1;var R=u.updateQueue;Uc=!1;var k=R.firstBaseUpdate,G=R.lastBaseUpdate,ie=R.shared.pending;if(ie!==null){R.shared.pending=null;var _e=ie,ze=_e.next;_e.next=null,G===null?k=ze:G.next=ze,G=_e;var Je=u.alternate;Je!==null&&(Je=Je.updateQueue,ie=Je.lastBaseUpdate,ie!==G&&(ie===null?Je.firstBaseUpdate=ze:ie.next=ze,Je.lastBaseUpdate=_e))}if(k!==null){var ot=R.baseState;G=0,Je=ze=_e=null,ie=k;do{var Ve=ie.lane&-536870913,Ke=Ve!==ie.lane;if(Ke?(gn&Ve)===Ve:(S&Ve)===Ve){Ve!==0&&Ve===ih&&(WM=!0),Je!==null&&(Je=Je.next={lane:0,tag:ie.tag,payload:ie.payload,callback:null,next:null});e:{var Ct=u,Bt=ie;Ve=h;var jn=b;switch(Bt.tag){case 1:if(Ct=Bt.payload,typeof Ct=="function"){ot=Ct.call(jn,ot,Ve);break e}ot=Ct;break e;case 3:Ct.flags=Ct.flags&-65537|128;case 0:if(Ct=Bt.payload,Ve=typeof Ct=="function"?Ct.call(jn,ot,Ve):Ct,Ve==null)break e;ot=f({},ot,Ve);break e;case 2:Uc=!0}}Ve=ie.callback,Ve!==null&&(u.flags|=64,Ke&&(u.flags|=8192),Ke=R.callbacks,Ke===null?R.callbacks=[Ve]:Ke.push(Ve))}else Ke={lane:Ve,tag:ie.tag,payload:ie.payload,callback:ie.callback,next:null},Je===null?(ze=Je=Ke,_e=ot):Je=Je.next=Ke,G|=Ve;if(ie=ie.next,ie===null){if(ie=R.shared.pending,ie===null)break;Ke=ie,ie=Ke.next,Ke.next=null,R.lastBaseUpdate=Ke,R.shared.pending=null}}while(!0);Je===null&&(_e=ot),R.baseState=_e,R.firstBaseUpdate=ze,R.lastBaseUpdate=Je,k===null&&(R.shared.lanes=0),$c|=G,u.lanes=G,u.memoizedState=ot}}function QL(u,h){if(typeof u!="function")throw Error(i(191,u));u.call(h)}function JL(u,h){var b=u.callbacks;if(b!==null)for(u.callbacks=null,u=0;u<b.length;u++)QL(b[u],h)}var oh=V(null),Ov=V(0);function eI(u,h){u=wl,ae(Ov,u),ae(oh,h),wl=u|h.baseLanes}function qM(){ae(Ov,wl),ae(oh,oh.current)}function XM(){wl=Ov.current,X(oh),X(Ov)}var qa=V(null),bs=null;function zc(u){var h=u.alternate;ae(Ci,Ci.current&1),ae(qa,u),bs===null&&(h===null||oh.current!==null||h.memoizedState!==null)&&(bs=u)}function KM(u){ae(Ci,Ci.current),ae(qa,u),bs===null&&(bs=u)}function tI(u){u.tag===22?(ae(Ci,Ci.current),ae(qa,u),bs===null&&(bs=u)):Bc()}function Bc(){ae(Ci,Ci.current),ae(qa,qa.current)}function Xa(u){X(qa),bs===u&&(bs=null),X(Ci)}var Ci=V(0);function Lv(u){for(var h=u;h!==null;){if(h.tag===13){var b=h.memoizedState;if(b!==null&&(b=b.dehydrated,b===null||tA(b)||nA(b)))return h}else if(h.tag===19&&(h.memoizedProps.revealOrder==="forwards"||h.memoizedProps.revealOrder==="backwards"||h.memoizedProps.revealOrder==="unstable_legacy-backwards"||h.memoizedProps.revealOrder==="together")){if((h.flags&128)!==0)return h}else if(h.child!==null){h.child.return=h,h=h.child;continue}if(h===u)break;for(;h.sibling===null;){if(h.return===null||h.return===u)return null;h=h.return}h.sibling.return=h.return,h=h.sibling}return null}var ml=0,Qt=null,In=null,Ui=null,Iv=!1,lh=!1,wd=!1,Uv=0,Qm=0,ch=null,Pee=0;function bi(){throw Error(i(321))}function YM(u,h){if(h===null)return!1;for(var b=0;b<h.length&&b<u.length;b++)if(!Ga(u[b],h[b]))return!1;return!0}function ZM(u,h,b,S,R,k){return ml=k,Qt=h,h.memoizedState=null,h.updateQueue=null,h.lanes=0,H.H=u===null||u.memoizedState===null?jI:fE,wd=!1,k=b(S,R),wd=!1,lh&&(k=iI(h,b,S,R)),nI(u),k}function nI(u){H.H=tg;var h=In!==null&&In.next!==null;if(ml=0,Ui=In=Qt=null,Iv=!1,Qm=0,ch=null,h)throw Error(i(300));u===null||ji||(u=u.dependencies,u!==null&&Tv(u)&&(ji=!0))}function iI(u,h,b,S){Qt=u;var R=0;do{if(lh&&(ch=null),Qm=0,lh=!1,25<=R)throw Error(i(301));if(R+=1,Ui=In=null,u.updateQueue!=null){var k=u.updateQueue;k.lastEffect=null,k.events=null,k.stores=null,k.memoCache!=null&&(k.memoCache.index=0)}H.H=FI,k=h(b,S)}while(lh);return k}function Dee(){var u=H.H,h=u.useState()[0];return h=typeof h.then=="function"?Jm(h):h,u=u.useState()[0],(In!==null?In.memoizedState:null)!==u&&(Qt.flags|=1024),h}function QM(){var u=Uv!==0;return Uv=0,u}function JM(u,h,b){h.updateQueue=u.updateQueue,h.flags&=-2053,u.lanes&=~b}function eE(u){if(Iv){for(u=u.memoizedState;u!==null;){var h=u.queue;h!==null&&(h.pending=null),u=u.next}Iv=!1}ml=0,Ui=In=Qt=null,lh=!1,Qm=Uv=0,ch=null}function oa(){var u={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Ui===null?Qt.memoizedState=Ui=u:Ui=Ui.next=u,Ui}function Ni(){if(In===null){var u=Qt.alternate;u=u!==null?u.memoizedState:null}else u=In.next;var h=Ui===null?Qt.memoizedState:Ui.next;if(h!==null)Ui=h,In=u;else{if(u===null)throw Qt.alternate===null?Error(i(467)):Error(i(310));In=u,u={memoizedState:In.memoizedState,baseState:In.baseState,baseQueue:In.baseQueue,queue:In.queue,next:null},Ui===null?Qt.memoizedState=Ui=u:Ui=Ui.next=u}return Ui}function jv(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Jm(u){var h=Qm;return Qm+=1,ch===null&&(ch=[]),u=qL(ch,u,h),h=Qt,(Ui===null?h.memoizedState:Ui.next)===null&&(h=h.alternate,H.H=h===null||h.memoizedState===null?jI:fE),u}function Fv(u){if(u!==null&&typeof u=="object"){if(typeof u.then=="function")return Jm(u);if(u.$$typeof===w)return Dr(u)}throw Error(i(438,String(u)))}function tE(u){var h=null,b=Qt.updateQueue;if(b!==null&&(h=b.memoCache),h==null){var S=Qt.alternate;S!==null&&(S=S.updateQueue,S!==null&&(S=S.memoCache,S!=null&&(h={data:S.data.map(function(R){return R.slice()}),index:0})))}if(h==null&&(h={data:[],index:0}),b===null&&(b=jv(),Qt.updateQueue=b),b.memoCache=h,b=h.data[h.index],b===void 0)for(b=h.data[h.index]=Array(u),S=0;S<u;S++)b[S]=D;return h.index++,b}function gl(u,h){return typeof h=="function"?h(u):h}function zv(u){var h=Ni();return nE(h,In,u)}function nE(u,h,b){var S=u.queue;if(S===null)throw Error(i(311));S.lastRenderedReducer=b;var R=u.baseQueue,k=S.pending;if(k!==null){if(R!==null){var G=R.next;R.next=k.next,k.next=G}h.baseQueue=R=k,S.pending=null}if(k=u.baseState,R===null)u.memoizedState=k;else{h=R.next;var ie=G=null,_e=null,ze=h,Je=!1;do{var ot=ze.lane&-536870913;if(ot!==ze.lane?(gn&ot)===ot:(ml&ot)===ot){var Ve=ze.revertLane;if(Ve===0)_e!==null&&(_e=_e.next={lane:0,revertLane:0,gesture:null,action:ze.action,hasEagerState:ze.hasEagerState,eagerState:ze.eagerState,next:null}),ot===ih&&(Je=!0);else if((ml&Ve)===Ve){ze=ze.next,Ve===ih&&(Je=!0);continue}else ot={lane:0,revertLane:ze.revertLane,gesture:null,action:ze.action,hasEagerState:ze.hasEagerState,eagerState:ze.eagerState,next:null},_e===null?(ie=_e=ot,G=k):_e=_e.next=ot,Qt.lanes|=Ve,$c|=Ve;ot=ze.action,wd&&b(k,ot),k=ze.hasEagerState?ze.eagerState:b(k,ot)}else Ve={lane:ot,revertLane:ze.revertLane,gesture:ze.gesture,action:ze.action,hasEagerState:ze.hasEagerState,eagerState:ze.eagerState,next:null},_e===null?(ie=_e=Ve,G=k):_e=_e.next=Ve,Qt.lanes|=ot,$c|=ot;ze=ze.next}while(ze!==null&&ze!==h);if(_e===null?G=k:_e.next=ie,!Ga(k,u.memoizedState)&&(ji=!0,Je&&(b=rh,b!==null)))throw b;u.memoizedState=k,u.baseState=G,u.baseQueue=_e,S.lastRenderedState=k}return R===null&&(S.lanes=0),[u.memoizedState,S.dispatch]}function iE(u){var h=Ni(),b=h.queue;if(b===null)throw Error(i(311));b.lastRenderedReducer=u;var S=b.dispatch,R=b.pending,k=h.memoizedState;if(R!==null){b.pending=null;var G=R=R.next;do k=u(k,G.action),G=G.next;while(G!==R);Ga(k,h.memoizedState)||(ji=!0),h.memoizedState=k,h.baseQueue===null&&(h.baseState=k),b.lastRenderedState=k}return[k,S]}function rI(u,h,b){var S=Qt,R=Ni(),k=yn;if(k){if(b===void 0)throw Error(i(407));b=b()}else b=h();var G=!Ga((In||R).memoizedState,b);if(G&&(R.memoizedState=b,ji=!0),R=R.queue,sE(oI.bind(null,S,R,u),[u]),R.getSnapshot!==h||G||Ui!==null&&Ui.memoizedState.tag&1){if(S.flags|=2048,uh(9,{destroy:void 0},sI.bind(null,S,R,b,h),null),qn===null)throw Error(i(349));k||(ml&127)!==0||aI(S,h,b)}return b}function aI(u,h,b){u.flags|=16384,u={getSnapshot:h,value:b},h=Qt.updateQueue,h===null?(h=jv(),Qt.updateQueue=h,h.stores=[u]):(b=h.stores,b===null?h.stores=[u]:b.push(u))}function sI(u,h,b,S){h.value=b,h.getSnapshot=S,lI(h)&&cI(u)}function oI(u,h,b){return b(function(){lI(h)&&cI(u)})}function lI(u){var h=u.getSnapshot;u=u.value;try{var b=h();return!Ga(u,b)}catch{return!0}}function cI(u){var h=pd(u,2);h!==null&&Na(h,u,2)}function rE(u){var h=oa();if(typeof u=="function"){var b=u;if(u=b(),wd){pt(!0);try{b()}finally{pt(!1)}}}return h.memoizedState=h.baseState=u,h.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:gl,lastRenderedState:u},h}function uI(u,h,b,S){return u.baseState=b,nE(u,In,typeof S=="function"?S:gl)}function kee(u,h,b,S,R){if(Vv(u))throw Error(i(485));if(u=h.action,u!==null){var k={payload:R,action:u,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(G){k.listeners.push(G)}};H.T!==null?b(!0):k.isTransition=!1,S(k),b=h.pending,b===null?(k.next=h.pending=k,dI(h,k)):(k.next=b.next,h.pending=b.next=k)}}function dI(u,h){var b=h.action,S=h.payload,R=u.state;if(h.isTransition){var k=H.T,G={};H.T=G;try{var ie=b(R,S),_e=H.S;_e!==null&&_e(G,ie),fI(u,h,ie)}catch(ze){aE(u,h,ze)}finally{k!==null&&G.types!==null&&(k.types=G.types),H.T=k}}else try{k=b(R,S),fI(u,h,k)}catch(ze){aE(u,h,ze)}}function fI(u,h,b){b!==null&&typeof b=="object"&&typeof b.then=="function"?b.then(function(S){hI(u,h,S)},function(S){return aE(u,h,S)}):hI(u,h,b)}function hI(u,h,b){h.status="fulfilled",h.value=b,pI(h),u.state=b,h=u.pending,h!==null&&(b=h.next,b===h?u.pending=null:(b=b.next,h.next=b,dI(u,b)))}function aE(u,h,b){var S=u.pending;if(u.pending=null,S!==null){S=S.next;do h.status="rejected",h.reason=b,pI(h),h=h.next;while(h!==S)}u.action=null}function pI(u){u=u.listeners;for(var h=0;h<u.length;h++)(0,u[h])()}function mI(u,h){return h}function gI(u,h){if(yn){var b=qn.formState;if(b!==null){e:{var S=Qt;if(yn){if(ti){t:{for(var R=ti,k=ys;R.nodeType!==8;){if(!k){R=null;break t}if(R=_s(R.nextSibling),R===null){R=null;break t}}k=R.data,R=k==="F!"||k==="F"?R:null}if(R){ti=_s(R.nextSibling),S=R.data==="F!";break e}}Lc(S)}S=!1}S&&(h=b[0])}}return b=oa(),b.memoizedState=b.baseState=h,S={pending:null,lanes:0,dispatch:null,lastRenderedReducer:mI,lastRenderedState:h},b.queue=S,b=LI.bind(null,Qt,S),S.dispatch=b,S=rE(!1),k=dE.bind(null,Qt,!1,S.queue),S=oa(),R={state:h,dispatch:null,action:u,pending:null},S.queue=R,b=kee.bind(null,Qt,R,k,b),R.dispatch=b,S.memoizedState=u,[h,b,!1]}function xI(u){var h=Ni();return vI(h,In,u)}function vI(u,h,b){if(h=nE(u,h,mI)[0],u=zv(gl)[0],typeof h=="object"&&h!==null&&typeof h.then=="function")try{var S=Jm(h)}catch(G){throw G===ah?Rv:G}else S=h;h=Ni();var R=h.queue,k=R.dispatch;return b!==h.memoizedState&&(Qt.flags|=2048,uh(9,{destroy:void 0},Oee.bind(null,R,b),null)),[S,k,u]}function Oee(u,h){u.action=h}function yI(u){var h=Ni(),b=In;if(b!==null)return vI(h,b,u);Ni(),h=h.memoizedState,b=Ni();var S=b.queue.dispatch;return b.memoizedState=u,[h,S,!1]}function uh(u,h,b,S){return u={tag:u,create:b,deps:S,inst:h,next:null},h=Qt.updateQueue,h===null&&(h=jv(),Qt.updateQueue=h),b=h.lastEffect,b===null?h.lastEffect=u.next=u:(S=b.next,b.next=u,u.next=S,h.lastEffect=u),u}function bI(){return Ni().memoizedState}function Bv(u,h,b,S){var R=oa();Qt.flags|=u,R.memoizedState=uh(1|h,{destroy:void 0},b,S===void 0?null:S)}function Hv(u,h,b,S){var R=Ni();S=S===void 0?null:S;var k=R.memoizedState.inst;In!==null&&S!==null&&YM(S,In.memoizedState.deps)?R.memoizedState=uh(h,k,b,S):(Qt.flags|=u,R.memoizedState=uh(1|h,k,b,S))}function _I(u,h){Bv(8390656,8,u,h)}function sE(u,h){Hv(2048,8,u,h)}function Lee(u){Qt.flags|=4;var h=Qt.updateQueue;if(h===null)h=jv(),Qt.updateQueue=h,h.events=[u];else{var b=h.events;b===null?h.events=[u]:b.push(u)}}function SI(u){var h=Ni().memoizedState;return Lee({ref:h,nextImpl:u}),function(){if((Tn&2)!==0)throw Error(i(440));return h.impl.apply(void 0,arguments)}}function wI(u,h){return Hv(4,2,u,h)}function MI(u,h){return Hv(4,4,u,h)}function EI(u,h){if(typeof h=="function"){u=u();var b=h(u);return function(){typeof b=="function"?b():h(null)}}if(h!=null)return u=u(),h.current=u,function(){h.current=null}}function AI(u,h,b){b=b!=null?b.concat([u]):null,Hv(4,4,EI.bind(null,h,u),b)}function oE(){}function TI(u,h){var b=Ni();h=h===void 0?null:h;var S=b.memoizedState;return h!==null&&YM(h,S[1])?S[0]:(b.memoizedState=[u,h],u)}function CI(u,h){var b=Ni();h=h===void 0?null:h;var S=b.memoizedState;if(h!==null&&YM(h,S[1]))return S[0];if(S=u(),wd){pt(!0);try{u()}finally{pt(!1)}}return b.memoizedState=[S,h],S}function lE(u,h,b){return b===void 0||(ml&1073741824)!==0&&(gn&261930)===0?u.memoizedState=h:(u.memoizedState=b,u=N4(),Qt.lanes|=u,$c|=u,b)}function NI(u,h,b,S){return Ga(b,h)?b:oh.current!==null?(u=lE(u,b,S),Ga(u,h)||(ji=!0),u):(ml&42)===0||(ml&1073741824)!==0&&(gn&261930)===0?(ji=!0,u.memoizedState=b):(u=N4(),Qt.lanes|=u,$c|=u,h)}function RI(u,h,b,S,R){var k=$.p;$.p=k!==0&&8>k?k:8;var G=H.T,ie={};H.T=ie,dE(u,!1,h,b);try{var _e=R(),ze=H.S;if(ze!==null&&ze(ie,_e),_e!==null&&typeof _e=="object"&&typeof _e.then=="function"){var Je=Ree(_e,S);eg(u,h,Je,Za(u))}else eg(u,h,S,Za(u))}catch(ot){eg(u,h,{then:function(){},status:"rejected",reason:ot},Za())}finally{$.p=k,G!==null&&ie.types!==null&&(G.types=ie.types),H.T=G}}function Iee(){}function cE(u,h,b,S){if(u.tag!==5)throw Error(i(476));var R=PI(u).queue;RI(u,R,h,K,b===null?Iee:function(){return DI(u),b(S)})}function PI(u){var h=u.memoizedState;if(h!==null)return h;h={memoizedState:K,baseState:K,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:gl,lastRenderedState:K},next:null};var b={};return h.next={memoizedState:b,baseState:b,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:gl,lastRenderedState:b},next:null},u.memoizedState=h,u=u.alternate,u!==null&&(u.memoizedState=h),h}function DI(u){var h=PI(u);h.next===null&&(h=u.alternate.memoizedState),eg(u,h.next.queue,{},Za())}function uE(){return Dr(xg)}function kI(){return Ni().memoizedState}function OI(){return Ni().memoizedState}function Uee(u){for(var h=u.return;h!==null;){switch(h.tag){case 24:case 3:var b=Za();u=jc(b);var S=Fc(h,u,b);S!==null&&(Na(S,h,b),Km(S,h,b)),h={cache:FM()},u.payload=h;return}h=h.return}}function jee(u,h,b){var S=Za();b={lane:S,revertLane:0,gesture:null,action:b,hasEagerState:!1,eagerState:null,next:null},Vv(u)?II(h,b):(b=CM(u,h,b,S),b!==null&&(Na(b,u,S),UI(b,h,S)))}function LI(u,h,b){var S=Za();eg(u,h,b,S)}function eg(u,h,b,S){var R={lane:S,revertLane:0,gesture:null,action:b,hasEagerState:!1,eagerState:null,next:null};if(Vv(u))II(h,R);else{var k=u.alternate;if(u.lanes===0&&(k===null||k.lanes===0)&&(k=h.lastRenderedReducer,k!==null))try{var G=h.lastRenderedState,ie=k(G,b);if(R.hasEagerState=!0,R.eagerState=ie,Ga(ie,G))return wv(u,h,R,0),qn===null&&Sv(),!1}catch{}finally{}if(b=CM(u,h,R,S),b!==null)return Na(b,u,S),UI(b,h,S),!0}return!1}function dE(u,h,b,S){if(S={lane:2,revertLane:VE(),gesture:null,action:S,hasEagerState:!1,eagerState:null,next:null},Vv(u)){if(h)throw Error(i(479))}else h=CM(u,b,S,2),h!==null&&Na(h,u,2)}function Vv(u){var h=u.alternate;return u===Qt||h!==null&&h===Qt}function II(u,h){lh=Iv=!0;var b=u.pending;b===null?h.next=h:(h.next=b.next,b.next=h),u.pending=h}function UI(u,h,b){if((b&4194048)!==0){var S=h.lanes;S&=u.pendingLanes,b|=S,h.lanes=b,Wn(u,b)}}var tg={readContext:Dr,use:Fv,useCallback:bi,useContext:bi,useEffect:bi,useImperativeHandle:bi,useLayoutEffect:bi,useInsertionEffect:bi,useMemo:bi,useReducer:bi,useRef:bi,useState:bi,useDebugValue:bi,useDeferredValue:bi,useTransition:bi,useSyncExternalStore:bi,useId:bi,useHostTransitionStatus:bi,useFormState:bi,useActionState:bi,useOptimistic:bi,useMemoCache:bi,useCacheRefresh:bi};tg.useEffectEvent=bi;var jI={readContext:Dr,use:Fv,useCallback:function(u,h){return oa().memoizedState=[u,h===void 0?null:h],u},useContext:Dr,useEffect:_I,useImperativeHandle:function(u,h,b){b=b!=null?b.concat([u]):null,Bv(4194308,4,EI.bind(null,h,u),b)},useLayoutEffect:function(u,h){return Bv(4194308,4,u,h)},useInsertionEffect:function(u,h){Bv(4,2,u,h)},useMemo:function(u,h){var b=oa();h=h===void 0?null:h;var S=u();if(wd){pt(!0);try{u()}finally{pt(!1)}}return b.memoizedState=[S,h],S},useReducer:function(u,h,b){var S=oa();if(b!==void 0){var R=b(h);if(wd){pt(!0);try{b(h)}finally{pt(!1)}}}else R=h;return S.memoizedState=S.baseState=R,u={pending:null,lanes:0,dispatch:null,lastRenderedReducer:u,lastRenderedState:R},S.queue=u,u=u.dispatch=jee.bind(null,Qt,u),[S.memoizedState,u]},useRef:function(u){var h=oa();return u={current:u},h.memoizedState=u},useState:function(u){u=rE(u);var h=u.queue,b=LI.bind(null,Qt,h);return h.dispatch=b,[u.memoizedState,b]},useDebugValue:oE,useDeferredValue:function(u,h){var b=oa();return lE(b,u,h)},useTransition:function(){var u=rE(!1);return u=RI.bind(null,Qt,u.queue,!0,!1),oa().memoizedState=u,[!1,u]},useSyncExternalStore:function(u,h,b){var S=Qt,R=oa();if(yn){if(b===void 0)throw Error(i(407));b=b()}else{if(b=h(),qn===null)throw Error(i(349));(gn&127)!==0||aI(S,h,b)}R.memoizedState=b;var k={value:b,getSnapshot:h};return R.queue=k,_I(oI.bind(null,S,k,u),[u]),S.flags|=2048,uh(9,{destroy:void 0},sI.bind(null,S,k,b,h),null),b},useId:function(){var u=oa(),h=qn.identifierPrefix;if(yn){var b=No,S=Co;b=(S&~(1<<32-nt(S)-1)).toString(32)+b,h="_"+h+"R_"+b,b=Uv++,0<b&&(h+="H"+b.toString(32)),h+="_"}else b=Pee++,h="_"+h+"r_"+b.toString(32)+"_";return u.memoizedState=h},useHostTransitionStatus:uE,useFormState:gI,useActionState:gI,useOptimistic:function(u){var h=oa();h.memoizedState=h.baseState=u;var b={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return h.queue=b,h=dE.bind(null,Qt,!0,b),b.dispatch=h,[u,h]},useMemoCache:tE,useCacheRefresh:function(){return oa().memoizedState=Uee.bind(null,Qt)},useEffectEvent:function(u){var h=oa(),b={impl:u};return h.memoizedState=b,function(){if((Tn&2)!==0)throw Error(i(440));return b.impl.apply(void 0,arguments)}}},fE={readContext:Dr,use:Fv,useCallback:TI,useContext:Dr,useEffect:sE,useImperativeHandle:AI,useInsertionEffect:wI,useLayoutEffect:MI,useMemo:CI,useReducer:zv,useRef:bI,useState:function(){return zv(gl)},useDebugValue:oE,useDeferredValue:function(u,h){var b=Ni();return NI(b,In.memoizedState,u,h)},useTransition:function(){var u=zv(gl)[0],h=Ni().memoizedState;return[typeof u=="boolean"?u:Jm(u),h]},useSyncExternalStore:rI,useId:kI,useHostTransitionStatus:uE,useFormState:xI,useActionState:xI,useOptimistic:function(u,h){var b=Ni();return uI(b,In,u,h)},useMemoCache:tE,useCacheRefresh:OI};fE.useEffectEvent=SI;var FI={readContext:Dr,use:Fv,useCallback:TI,useContext:Dr,useEffect:sE,useImperativeHandle:AI,useInsertionEffect:wI,useLayoutEffect:MI,useMemo:CI,useReducer:iE,useRef:bI,useState:function(){return iE(gl)},useDebugValue:oE,useDeferredValue:function(u,h){var b=Ni();return In===null?lE(b,u,h):NI(b,In.memoizedState,u,h)},useTransition:function(){var u=iE(gl)[0],h=Ni().memoizedState;return[typeof u=="boolean"?u:Jm(u),h]},useSyncExternalStore:rI,useId:kI,useHostTransitionStatus:uE,useFormState:yI,useActionState:yI,useOptimistic:function(u,h){var b=Ni();return In!==null?uI(b,In,u,h):(b.baseState=u,[u,b.queue.dispatch])},useMemoCache:tE,useCacheRefresh:OI};FI.useEffectEvent=SI;function hE(u,h,b,S){h=u.memoizedState,b=b(S,h),b=b==null?h:f({},h,b),u.memoizedState=b,u.lanes===0&&(u.updateQueue.baseState=b)}var pE={enqueueSetState:function(u,h,b){u=u._reactInternals;var S=Za(),R=jc(S);R.payload=h,b!=null&&(R.callback=b),h=Fc(u,R,S),h!==null&&(Na(h,u,S),Km(h,u,S))},enqueueReplaceState:function(u,h,b){u=u._reactInternals;var S=Za(),R=jc(S);R.tag=1,R.payload=h,b!=null&&(R.callback=b),h=Fc(u,R,S),h!==null&&(Na(h,u,S),Km(h,u,S))},enqueueForceUpdate:function(u,h){u=u._reactInternals;var b=Za(),S=jc(b);S.tag=2,h!=null&&(S.callback=h),h=Fc(u,S,b),h!==null&&(Na(h,u,b),Km(h,u,b))}};function zI(u,h,b,S,R,k,G){return u=u.stateNode,typeof u.shouldComponentUpdate=="function"?u.shouldComponentUpdate(S,k,G):h.prototype&&h.prototype.isPureReactComponent?!Bm(b,S)||!Bm(R,k):!0}function BI(u,h,b,S){u=h.state,typeof h.componentWillReceiveProps=="function"&&h.componentWillReceiveProps(b,S),typeof h.UNSAFE_componentWillReceiveProps=="function"&&h.UNSAFE_componentWillReceiveProps(b,S),h.state!==u&&pE.enqueueReplaceState(h,h.state,null)}function Md(u,h){var b=h;if("ref"in h){b={};for(var S in h)S!=="ref"&&(b[S]=h[S])}if(u=u.defaultProps){b===h&&(b=f({},b));for(var R in u)b[R]===void 0&&(b[R]=u[R])}return b}function HI(u){_v(u)}function VI(u){console.error(u)}function $I(u){_v(u)}function $v(u,h){try{var b=u.onUncaughtError;b(h.value,{componentStack:h.stack})}catch(S){setTimeout(function(){throw S})}}function GI(u,h,b){try{var S=u.onCaughtError;S(b.value,{componentStack:b.stack,errorBoundary:h.tag===1?h.stateNode:null})}catch(R){setTimeout(function(){throw R})}}function mE(u,h,b){return b=jc(b),b.tag=3,b.payload={element:null},b.callback=function(){$v(u,h)},b}function WI(u){return u=jc(u),u.tag=3,u}function qI(u,h,b,S){var R=b.type.getDerivedStateFromError;if(typeof R=="function"){var k=S.value;u.payload=function(){return R(k)},u.callback=function(){GI(h,b,S)}}var G=b.stateNode;G!==null&&typeof G.componentDidCatch=="function"&&(u.callback=function(){GI(h,b,S),typeof R!="function"&&(Gc===null?Gc=new Set([this]):Gc.add(this));var ie=S.stack;this.componentDidCatch(S.value,{componentStack:ie!==null?ie:""})})}function Fee(u,h,b,S,R){if(b.flags|=32768,S!==null&&typeof S=="object"&&typeof S.then=="function"){if(h=b.alternate,h!==null&&nh(h,b,R,!0),b=qa.current,b!==null){switch(b.tag){case 31:case 13:return bs===null?ny():b.alternate===null&&_i===0&&(_i=3),b.flags&=-257,b.flags|=65536,b.lanes=R,S===Pv?b.flags|=16384:(h=b.updateQueue,h===null?b.updateQueue=new Set([S]):h.add(S),zE(u,S,R)),!1;case 22:return b.flags|=65536,S===Pv?b.flags|=16384:(h=b.updateQueue,h===null?(h={transitions:null,markerInstances:null,retryQueue:new Set([S])},b.updateQueue=h):(b=h.retryQueue,b===null?h.retryQueue=new Set([S]):b.add(S)),zE(u,S,R)),!1}throw Error(i(435,b.tag))}return zE(u,S,R),ny(),!1}if(yn)return h=qa.current,h!==null?((h.flags&65536)===0&&(h.flags|=256),h.flags|=65536,h.lanes=R,S!==OM&&(u=Error(i(422),{cause:S}),$m(gs(u,b)))):(S!==OM&&(h=Error(i(423),{cause:S}),$m(gs(h,b))),u=u.current.alternate,u.flags|=65536,R&=-R,u.lanes|=R,S=gs(S,b),R=mE(u.stateNode,S,R),GM(u,R),_i!==4&&(_i=2)),!1;var k=Error(i(520),{cause:S});if(k=gs(k,b),cg===null?cg=[k]:cg.push(k),_i!==4&&(_i=2),h===null)return!0;S=gs(S,b),b=h;do{switch(b.tag){case 3:return b.flags|=65536,u=R&-R,b.lanes|=u,u=mE(b.stateNode,S,u),GM(b,u),!1;case 1:if(h=b.type,k=b.stateNode,(b.flags&128)===0&&(typeof h.getDerivedStateFromError=="function"||k!==null&&typeof k.componentDidCatch=="function"&&(Gc===null||!Gc.has(k))))return b.flags|=65536,R&=-R,b.lanes|=R,R=WI(R),qI(R,u,b,S),GM(b,R),!1}b=b.return}while(b!==null);return!1}var gE=Error(i(461)),ji=!1;function kr(u,h,b,S){h.child=u===null?ZL(h,null,b,S):Sd(h,u.child,b,S)}function XI(u,h,b,S,R){b=b.render;var k=h.ref;if("ref"in S){var G={};for(var ie in S)ie!=="ref"&&(G[ie]=S[ie])}else G=S;return vd(h),S=ZM(u,h,b,G,k,R),ie=QM(),u!==null&&!ji?(JM(u,h,R),xl(u,h,R)):(yn&&ie&&DM(h),h.flags|=1,kr(u,h,S,R),h.child)}function KI(u,h,b,S,R){if(u===null){var k=b.type;return typeof k=="function"&&!NM(k)&&k.defaultProps===void 0&&b.compare===null?(h.tag=15,h.type=k,YI(u,h,k,S,R)):(u=Ev(b.type,null,S,h,h.mode,R),u.ref=h.ref,u.return=h,h.child=u)}if(k=u.child,!ME(u,R)){var G=k.memoizedProps;if(b=b.compare,b=b!==null?b:Bm,b(G,S)&&u.ref===h.ref)return xl(u,h,R)}return h.flags|=1,u=dl(k,S),u.ref=h.ref,u.return=h,h.child=u}function YI(u,h,b,S,R){if(u!==null){var k=u.memoizedProps;if(Bm(k,S)&&u.ref===h.ref)if(ji=!1,h.pendingProps=S=k,ME(u,R))(u.flags&131072)!==0&&(ji=!0);else return h.lanes=u.lanes,xl(u,h,R)}return xE(u,h,b,S,R)}function ZI(u,h,b,S){var R=S.children,k=u!==null?u.memoizedState:null;if(u===null&&h.stateNode===null&&(h.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),S.mode==="hidden"){if((h.flags&128)!==0){if(k=k!==null?k.baseLanes|b:b,u!==null){for(S=h.child=u.child,R=0;S!==null;)R=R|S.lanes|S.childLanes,S=S.sibling;S=R&~k}else S=0,h.child=null;return QI(u,h,k,b,S)}if((b&536870912)!==0)h.memoizedState={baseLanes:0,cachePool:null},u!==null&&Nv(h,k!==null?k.cachePool:null),k!==null?eI(h,k):qM(),tI(h);else return S=h.lanes=536870912,QI(u,h,k!==null?k.baseLanes|b:b,b,S)}else k!==null?(Nv(h,k.cachePool),eI(h,k),Bc(),h.memoizedState=null):(u!==null&&Nv(h,null),qM(),Bc());return kr(u,h,R,b),h.child}function ng(u,h){return u!==null&&u.tag===22||h.stateNode!==null||(h.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),h.sibling}function QI(u,h,b,S,R){var k=BM();return k=k===null?null:{parent:Ii._currentValue,pool:k},h.memoizedState={baseLanes:b,cachePool:k},u!==null&&Nv(h,null),qM(),tI(h),u!==null&&nh(u,h,S,!0),h.childLanes=R,null}function Gv(u,h){return h=qv({mode:h.mode,children:h.children},u.mode),h.ref=u.ref,u.child=h,h.return=u,h}function JI(u,h,b){return Sd(h,u.child,null,b),u=Gv(h,h.pendingProps),u.flags|=2,Xa(h),h.memoizedState=null,u}function zee(u,h,b){var S=h.pendingProps,R=(h.flags&128)!==0;if(h.flags&=-129,u===null){if(yn){if(S.mode==="hidden")return u=Gv(h,S),h.lanes=536870912,ng(null,u);if(KM(h),(u=ti)?(u=dU(u,ys),u=u!==null&&u.data==="&"?u:null,u!==null&&(h.memoizedState={dehydrated:u,treeContext:kc!==null?{id:Co,overflow:No}:null,retryLane:536870912,hydrationErrors:null},b=IL(u),b.return=h,h.child=b,Pr=h,ti=null)):u=null,u===null)throw Lc(h);return h.lanes=536870912,null}return Gv(h,S)}var k=u.memoizedState;if(k!==null){var G=k.dehydrated;if(KM(h),R)if(h.flags&256)h.flags&=-257,h=JI(u,h,b);else if(h.memoizedState!==null)h.child=u.child,h.flags|=128,h=null;else throw Error(i(558));else if(ji||nh(u,h,b,!1),R=(b&u.childLanes)!==0,ji||R){if(S=qn,S!==null&&(G=hr(S,b),G!==0&&G!==k.retryLane))throw k.retryLane=G,pd(u,G),Na(S,u,G),gE;ny(),h=JI(u,h,b)}else u=k.treeContext,ti=_s(G.nextSibling),Pr=h,yn=!0,Oc=null,ys=!1,u!==null&&FL(h,u),h=Gv(h,S),h.flags|=4096;return h}return u=dl(u.child,{mode:S.mode,children:S.children}),u.ref=h.ref,h.child=u,u.return=h,u}function Wv(u,h){var b=h.ref;if(b===null)u!==null&&u.ref!==null&&(h.flags|=4194816);else{if(typeof b!="function"&&typeof b!="object")throw Error(i(284));(u===null||u.ref!==b)&&(h.flags|=4194816)}}function xE(u,h,b,S,R){return vd(h),b=ZM(u,h,b,S,void 0,R),S=QM(),u!==null&&!ji?(JM(u,h,R),xl(u,h,R)):(yn&&S&&DM(h),h.flags|=1,kr(u,h,b,R),h.child)}function e4(u,h,b,S,R,k){return vd(h),h.updateQueue=null,b=iI(h,S,b,R),nI(u),S=QM(),u!==null&&!ji?(JM(u,h,k),xl(u,h,k)):(yn&&S&&DM(h),h.flags|=1,kr(u,h,b,k),h.child)}function t4(u,h,b,S,R){if(vd(h),h.stateNode===null){var k=Qf,G=b.contextType;typeof G=="object"&&G!==null&&(k=Dr(G)),k=new b(S,k),h.memoizedState=k.state!==null&&k.state!==void 0?k.state:null,k.updater=pE,h.stateNode=k,k._reactInternals=h,k=h.stateNode,k.props=S,k.state=h.memoizedState,k.refs={},VM(h),G=b.contextType,k.context=typeof G=="object"&&G!==null?Dr(G):Qf,k.state=h.memoizedState,G=b.getDerivedStateFromProps,typeof G=="function"&&(hE(h,b,G,S),k.state=h.memoizedState),typeof b.getDerivedStateFromProps=="function"||typeof k.getSnapshotBeforeUpdate=="function"||typeof k.UNSAFE_componentWillMount!="function"&&typeof k.componentWillMount!="function"||(G=k.state,typeof k.componentWillMount=="function"&&k.componentWillMount(),typeof k.UNSAFE_componentWillMount=="function"&&k.UNSAFE_componentWillMount(),G!==k.state&&pE.enqueueReplaceState(k,k.state,null),Zm(h,S,k,R),Ym(),k.state=h.memoizedState),typeof k.componentDidMount=="function"&&(h.flags|=4194308),S=!0}else if(u===null){k=h.stateNode;var ie=h.memoizedProps,_e=Md(b,ie);k.props=_e;var ze=k.context,Je=b.contextType;G=Qf,typeof Je=="object"&&Je!==null&&(G=Dr(Je));var ot=b.getDerivedStateFromProps;Je=typeof ot=="function"||typeof k.getSnapshotBeforeUpdate=="function",ie=h.pendingProps!==ie,Je||typeof k.UNSAFE_componentWillReceiveProps!="function"&&typeof k.componentWillReceiveProps!="function"||(ie||ze!==G)&&BI(h,k,S,G),Uc=!1;var Ve=h.memoizedState;k.state=Ve,Zm(h,S,k,R),Ym(),ze=h.memoizedState,ie||Ve!==ze||Uc?(typeof ot=="function"&&(hE(h,b,ot,S),ze=h.memoizedState),(_e=Uc||zI(h,b,_e,S,Ve,ze,G))?(Je||typeof k.UNSAFE_componentWillMount!="function"&&typeof k.componentWillMount!="function"||(typeof k.componentWillMount=="function"&&k.componentWillMount(),typeof k.UNSAFE_componentWillMount=="function"&&k.UNSAFE_componentWillMount()),typeof k.componentDidMount=="function"&&(h.flags|=4194308)):(typeof k.componentDidMount=="function"&&(h.flags|=4194308),h.memoizedProps=S,h.memoizedState=ze),k.props=S,k.state=ze,k.context=G,S=_e):(typeof k.componentDidMount=="function"&&(h.flags|=4194308),S=!1)}else{k=h.stateNode,$M(u,h),G=h.memoizedProps,Je=Md(b,G),k.props=Je,ot=h.pendingProps,Ve=k.context,ze=b.contextType,_e=Qf,typeof ze=="object"&&ze!==null&&(_e=Dr(ze)),ie=b.getDerivedStateFromProps,(ze=typeof ie=="function"||typeof k.getSnapshotBeforeUpdate=="function")||typeof k.UNSAFE_componentWillReceiveProps!="function"&&typeof k.componentWillReceiveProps!="function"||(G!==ot||Ve!==_e)&&BI(h,k,S,_e),Uc=!1,Ve=h.memoizedState,k.state=Ve,Zm(h,S,k,R),Ym();var Ke=h.memoizedState;G!==ot||Ve!==Ke||Uc||u!==null&&u.dependencies!==null&&Tv(u.dependencies)?(typeof ie=="function"&&(hE(h,b,ie,S),Ke=h.memoizedState),(Je=Uc||zI(h,b,Je,S,Ve,Ke,_e)||u!==null&&u.dependencies!==null&&Tv(u.dependencies))?(ze||typeof k.UNSAFE_componentWillUpdate!="function"&&typeof k.componentWillUpdate!="function"||(typeof k.componentWillUpdate=="function"&&k.componentWillUpdate(S,Ke,_e),typeof k.UNSAFE_componentWillUpdate=="function"&&k.UNSAFE_componentWillUpdate(S,Ke,_e)),typeof k.componentDidUpdate=="function"&&(h.flags|=4),typeof k.getSnapshotBeforeUpdate=="function"&&(h.flags|=1024)):(typeof k.componentDidUpdate!="function"||G===u.memoizedProps&&Ve===u.memoizedState||(h.flags|=4),typeof k.getSnapshotBeforeUpdate!="function"||G===u.memoizedProps&&Ve===u.memoizedState||(h.flags|=1024),h.memoizedProps=S,h.memoizedState=Ke),k.props=S,k.state=Ke,k.context=_e,S=Je):(typeof k.componentDidUpdate!="function"||G===u.memoizedProps&&Ve===u.memoizedState||(h.flags|=4),typeof k.getSnapshotBeforeUpdate!="function"||G===u.memoizedProps&&Ve===u.memoizedState||(h.flags|=1024),S=!1)}return k=S,Wv(u,h),S=(h.flags&128)!==0,k||S?(k=h.stateNode,b=S&&typeof b.getDerivedStateFromError!="function"?null:k.render(),h.flags|=1,u!==null&&S?(h.child=Sd(h,u.child,null,R),h.child=Sd(h,null,b,R)):kr(u,h,b,R),h.memoizedState=k.state,u=h.child):u=xl(u,h,R),u}function n4(u,h,b,S){return gd(),h.flags|=256,kr(u,h,b,S),h.child}var vE={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function yE(u){return{baseLanes:u,cachePool:GL()}}function bE(u,h,b){return u=u!==null?u.childLanes&~b:0,h&&(u|=Ya),u}function i4(u,h,b){var S=h.pendingProps,R=!1,k=(h.flags&128)!==0,G;if((G=k)||(G=u!==null&&u.memoizedState===null?!1:(Ci.current&2)!==0),G&&(R=!0,h.flags&=-129),G=(h.flags&32)!==0,h.flags&=-33,u===null){if(yn){if(R?zc(h):Bc(),(u=ti)?(u=dU(u,ys),u=u!==null&&u.data!=="&"?u:null,u!==null&&(h.memoizedState={dehydrated:u,treeContext:kc!==null?{id:Co,overflow:No}:null,retryLane:536870912,hydrationErrors:null},b=IL(u),b.return=h,h.child=b,Pr=h,ti=null)):u=null,u===null)throw Lc(h);return nA(u)?h.lanes=32:h.lanes=536870912,null}var ie=S.children;return S=S.fallback,R?(Bc(),R=h.mode,ie=qv({mode:"hidden",children:ie},R),S=md(S,R,b,null),ie.return=h,S.return=h,ie.sibling=S,h.child=ie,S=h.child,S.memoizedState=yE(b),S.childLanes=bE(u,G,b),h.memoizedState=vE,ng(null,S)):(zc(h),_E(h,ie))}var _e=u.memoizedState;if(_e!==null&&(ie=_e.dehydrated,ie!==null)){if(k)h.flags&256?(zc(h),h.flags&=-257,h=SE(u,h,b)):h.memoizedState!==null?(Bc(),h.child=u.child,h.flags|=128,h=null):(Bc(),ie=S.fallback,R=h.mode,S=qv({mode:"visible",children:S.children},R),ie=md(ie,R,b,null),ie.flags|=2,S.return=h,ie.return=h,S.sibling=ie,h.child=S,Sd(h,u.child,null,b),S=h.child,S.memoizedState=yE(b),S.childLanes=bE(u,G,b),h.memoizedState=vE,h=ng(null,S));else if(zc(h),nA(ie)){if(G=ie.nextSibling&&ie.nextSibling.dataset,G)var ze=G.dgst;G=ze,S=Error(i(419)),S.stack="",S.digest=G,$m({value:S,source:null,stack:null}),h=SE(u,h,b)}else if(ji||nh(u,h,b,!1),G=(b&u.childLanes)!==0,ji||G){if(G=qn,G!==null&&(S=hr(G,b),S!==0&&S!==_e.retryLane))throw _e.retryLane=S,pd(u,S),Na(G,u,S),gE;tA(ie)||ny(),h=SE(u,h,b)}else tA(ie)?(h.flags|=192,h.child=u.child,h=null):(u=_e.treeContext,ti=_s(ie.nextSibling),Pr=h,yn=!0,Oc=null,ys=!1,u!==null&&FL(h,u),h=_E(h,S.children),h.flags|=4096);return h}return R?(Bc(),ie=S.fallback,R=h.mode,_e=u.child,ze=_e.sibling,S=dl(_e,{mode:"hidden",children:S.children}),S.subtreeFlags=_e.subtreeFlags&65011712,ze!==null?ie=dl(ze,ie):(ie=md(ie,R,b,null),ie.flags|=2),ie.return=h,S.return=h,S.sibling=ie,h.child=S,ng(null,S),S=h.child,ie=u.child.memoizedState,ie===null?ie=yE(b):(R=ie.cachePool,R!==null?(_e=Ii._currentValue,R=R.parent!==_e?{parent:_e,pool:_e}:R):R=GL(),ie={baseLanes:ie.baseLanes|b,cachePool:R}),S.memoizedState=ie,S.childLanes=bE(u,G,b),h.memoizedState=vE,ng(u.child,S)):(zc(h),b=u.child,u=b.sibling,b=dl(b,{mode:"visible",children:S.children}),b.return=h,b.sibling=null,u!==null&&(G=h.deletions,G===null?(h.deletions=[u],h.flags|=16):G.push(u)),h.child=b,h.memoizedState=null,b)}function _E(u,h){return h=qv({mode:"visible",children:h},u.mode),h.return=u,u.child=h}function qv(u,h){return u=Wa(22,u,null,h),u.lanes=0,u}function SE(u,h,b){return Sd(h,u.child,null,b),u=_E(h,h.pendingProps.children),u.flags|=2,h.memoizedState=null,u}function r4(u,h,b){u.lanes|=h;var S=u.alternate;S!==null&&(S.lanes|=h),UM(u.return,h,b)}function wE(u,h,b,S,R,k){var G=u.memoizedState;G===null?u.memoizedState={isBackwards:h,rendering:null,renderingStartTime:0,last:S,tail:b,tailMode:R,treeForkCount:k}:(G.isBackwards=h,G.rendering=null,G.renderingStartTime=0,G.last=S,G.tail=b,G.tailMode=R,G.treeForkCount=k)}function a4(u,h,b){var S=h.pendingProps,R=S.revealOrder,k=S.tail;S=S.children;var G=Ci.current,ie=(G&2)!==0;if(ie?(G=G&1|2,h.flags|=128):G&=1,ae(Ci,G),kr(u,h,S,b),S=yn?Vm:0,!ie&&u!==null&&(u.flags&128)!==0)e:for(u=h.child;u!==null;){if(u.tag===13)u.memoizedState!==null&&r4(u,b,h);else if(u.tag===19)r4(u,b,h);else if(u.child!==null){u.child.return=u,u=u.child;continue}if(u===h)break e;for(;u.sibling===null;){if(u.return===null||u.return===h)break e;u=u.return}u.sibling.return=u.return,u=u.sibling}switch(R){case"forwards":for(b=h.child,R=null;b!==null;)u=b.alternate,u!==null&&Lv(u)===null&&(R=b),b=b.sibling;b=R,b===null?(R=h.child,h.child=null):(R=b.sibling,b.sibling=null),wE(h,!1,R,b,k,S);break;case"backwards":case"unstable_legacy-backwards":for(b=null,R=h.child,h.child=null;R!==null;){if(u=R.alternate,u!==null&&Lv(u)===null){h.child=R;break}u=R.sibling,R.sibling=b,b=R,R=u}wE(h,!0,b,null,k,S);break;case"together":wE(h,!1,null,null,void 0,S);break;default:h.memoizedState=null}return h.child}function xl(u,h,b){if(u!==null&&(h.dependencies=u.dependencies),$c|=h.lanes,(b&h.childLanes)===0)if(u!==null){if(nh(u,h,b,!1),(b&h.childLanes)===0)return null}else return null;if(u!==null&&h.child!==u.child)throw Error(i(153));if(h.child!==null){for(u=h.child,b=dl(u,u.pendingProps),h.child=b,b.return=h;u.sibling!==null;)u=u.sibling,b=b.sibling=dl(u,u.pendingProps),b.return=h;b.sibling=null}return h.child}function ME(u,h){return(u.lanes&h)!==0?!0:(u=u.dependencies,!!(u!==null&&Tv(u)))}function Bee(u,h,b){switch(h.tag){case 3:Pe(h,h.stateNode.containerInfo),Ic(h,Ii,u.memoizedState.cache),gd();break;case 27:case 5:we(h);break;case 4:Pe(h,h.stateNode.containerInfo);break;case 10:Ic(h,h.type,h.memoizedProps.value);break;case 31:if(h.memoizedState!==null)return h.flags|=128,KM(h),null;break;case 13:var S=h.memoizedState;if(S!==null)return S.dehydrated!==null?(zc(h),h.flags|=128,null):(b&h.child.childLanes)!==0?i4(u,h,b):(zc(h),u=xl(u,h,b),u!==null?u.sibling:null);zc(h);break;case 19:var R=(u.flags&128)!==0;if(S=(b&h.childLanes)!==0,S||(nh(u,h,b,!1),S=(b&h.childLanes)!==0),R){if(S)return a4(u,h,b);h.flags|=128}if(R=h.memoizedState,R!==null&&(R.rendering=null,R.tail=null,R.lastEffect=null),ae(Ci,Ci.current),S)break;return null;case 22:return h.lanes=0,ZI(u,h,b,h.pendingProps);case 24:Ic(h,Ii,u.memoizedState.cache)}return xl(u,h,b)}function s4(u,h,b){if(u!==null)if(u.memoizedProps!==h.pendingProps)ji=!0;else{if(!ME(u,b)&&(h.flags&128)===0)return ji=!1,Bee(u,h,b);ji=(u.flags&131072)!==0}else ji=!1,yn&&(h.flags&1048576)!==0&&jL(h,Vm,h.index);switch(h.lanes=0,h.tag){case 16:e:{var S=h.pendingProps;if(u=bd(h.elementType),h.type=u,typeof u=="function")NM(u)?(S=Md(u,S),h.tag=1,h=t4(null,h,u,S,b)):(h.tag=0,h=xE(null,h,u,S,b));else{if(u!=null){var R=u.$$typeof;if(R===T){h.tag=11,h=XI(null,h,u,S,b);break e}else if(R===A){h.tag=14,h=KI(null,h,u,S,b);break e}}throw h=O(u)||u,Error(i(306,h,""))}}return h;case 0:return xE(u,h,h.type,h.pendingProps,b);case 1:return S=h.type,R=Md(S,h.pendingProps),t4(u,h,S,R,b);case 3:e:{if(Pe(h,h.stateNode.containerInfo),u===null)throw Error(i(387));S=h.pendingProps;var k=h.memoizedState;R=k.element,$M(u,h),Zm(h,S,null,b);var G=h.memoizedState;if(S=G.cache,Ic(h,Ii,S),S!==k.cache&&jM(h,[Ii],b,!0),Ym(),S=G.element,k.isDehydrated)if(k={element:S,isDehydrated:!1,cache:G.cache},h.updateQueue.baseState=k,h.memoizedState=k,h.flags&256){h=n4(u,h,S,b);break e}else if(S!==R){R=gs(Error(i(424)),h),$m(R),h=n4(u,h,S,b);break e}else{switch(u=h.stateNode.containerInfo,u.nodeType){case 9:u=u.body;break;default:u=u.nodeName==="HTML"?u.ownerDocument.body:u}for(ti=_s(u.firstChild),Pr=h,yn=!0,Oc=null,ys=!0,b=ZL(h,null,S,b),h.child=b;b;)b.flags=b.flags&-3|4096,b=b.sibling}else{if(gd(),S===R){h=xl(u,h,b);break e}kr(u,h,S,b)}h=h.child}return h;case 26:return Wv(u,h),u===null?(b=xU(h.type,null,h.pendingProps,null))?h.memoizedState=b:yn||(b=h.type,u=h.pendingProps,S=cy(ne.current).createElement(b),S[hi]=h,S[Ai]=u,Or(S,b,u),Te(S),h.stateNode=S):h.memoizedState=xU(h.type,u.memoizedProps,h.pendingProps,u.memoizedState),null;case 27:return we(h),u===null&&yn&&(S=h.stateNode=pU(h.type,h.pendingProps,ne.current),Pr=h,ys=!0,R=ti,Kc(h.type)?(iA=R,ti=_s(S.firstChild)):ti=R),kr(u,h,h.pendingProps.children,b),Wv(u,h),u===null&&(h.flags|=4194304),h.child;case 5:return u===null&&yn&&((R=S=ti)&&(S=xte(S,h.type,h.pendingProps,ys),S!==null?(h.stateNode=S,Pr=h,ti=_s(S.firstChild),ys=!1,R=!0):R=!1),R||Lc(h)),we(h),R=h.type,k=h.pendingProps,G=u!==null?u.memoizedProps:null,S=k.children,QE(R,k)?S=null:G!==null&&QE(R,G)&&(h.flags|=32),h.memoizedState!==null&&(R=ZM(u,h,Dee,null,null,b),xg._currentValue=R),Wv(u,h),kr(u,h,S,b),h.child;case 6:return u===null&&yn&&((u=b=ti)&&(b=vte(b,h.pendingProps,ys),b!==null?(h.stateNode=b,Pr=h,ti=null,u=!0):u=!1),u||Lc(h)),null;case 13:return i4(u,h,b);case 4:return Pe(h,h.stateNode.containerInfo),S=h.pendingProps,u===null?h.child=Sd(h,null,S,b):kr(u,h,S,b),h.child;case 11:return XI(u,h,h.type,h.pendingProps,b);case 7:return kr(u,h,h.pendingProps,b),h.child;case 8:return kr(u,h,h.pendingProps.children,b),h.child;case 12:return kr(u,h,h.pendingProps.children,b),h.child;case 10:return S=h.pendingProps,Ic(h,h.type,S.value),kr(u,h,S.children,b),h.child;case 9:return R=h.type._context,S=h.pendingProps.children,vd(h),R=Dr(R),S=S(R),h.flags|=1,kr(u,h,S,b),h.child;case 14:return KI(u,h,h.type,h.pendingProps,b);case 15:return YI(u,h,h.type,h.pendingProps,b);case 19:return a4(u,h,b);case 31:return zee(u,h,b);case 22:return ZI(u,h,b,h.pendingProps);case 24:return vd(h),S=Dr(Ii),u===null?(R=BM(),R===null&&(R=qn,k=FM(),R.pooledCache=k,k.refCount++,k!==null&&(R.pooledCacheLanes|=b),R=k),h.memoizedState={parent:S,cache:R},VM(h),Ic(h,Ii,R)):((u.lanes&b)!==0&&($M(u,h),Zm(h,null,null,b),Ym()),R=u.memoizedState,k=h.memoizedState,R.parent!==S?(R={parent:S,cache:S},h.memoizedState=R,h.lanes===0&&(h.memoizedState=h.updateQueue.baseState=R),Ic(h,Ii,S)):(S=k.cache,Ic(h,Ii,S),S!==R.cache&&jM(h,[Ii],b,!0))),kr(u,h,h.pendingProps.children,b),h.child;case 29:throw h.pendingProps}throw Error(i(156,h.tag))}function vl(u){u.flags|=4}function EE(u,h,b,S,R){if((h=(u.mode&32)!==0)&&(h=!1),h){if(u.flags|=16777216,(R&335544128)===R)if(u.stateNode.complete)u.flags|=8192;else if(k4())u.flags|=8192;else throw _d=Pv,HM}else u.flags&=-16777217}function o4(u,h){if(h.type!=="stylesheet"||(h.state.loading&4)!==0)u.flags&=-16777217;else if(u.flags|=16777216,!SU(h))if(k4())u.flags|=8192;else throw _d=Pv,HM}function Xv(u,h){h!==null&&(u.flags|=4),u.flags&16384&&(h=u.tag!==22?bt():536870912,u.lanes|=h,ph|=h)}function ig(u,h){if(!yn)switch(u.tailMode){case"hidden":h=u.tail;for(var b=null;h!==null;)h.alternate!==null&&(b=h),h=h.sibling;b===null?u.tail=null:b.sibling=null;break;case"collapsed":b=u.tail;for(var S=null;b!==null;)b.alternate!==null&&(S=b),b=b.sibling;S===null?h||u.tail===null?u.tail=null:u.tail.sibling=null:S.sibling=null}}function ni(u){var h=u.alternate!==null&&u.alternate.child===u.child,b=0,S=0;if(h)for(var R=u.child;R!==null;)b|=R.lanes|R.childLanes,S|=R.subtreeFlags&65011712,S|=R.flags&65011712,R.return=u,R=R.sibling;else for(R=u.child;R!==null;)b|=R.lanes|R.childLanes,S|=R.subtreeFlags,S|=R.flags,R.return=u,R=R.sibling;return u.subtreeFlags|=S,u.childLanes=b,h}function Hee(u,h,b){var S=h.pendingProps;switch(kM(h),h.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return ni(h),null;case 1:return ni(h),null;case 3:return b=h.stateNode,S=null,u!==null&&(S=u.memoizedState.cache),h.memoizedState.cache!==S&&(h.flags|=2048),pl(Ii),he(),b.pendingContext&&(b.context=b.pendingContext,b.pendingContext=null),(u===null||u.child===null)&&(th(h)?vl(h):u===null||u.memoizedState.isDehydrated&&(h.flags&256)===0||(h.flags|=1024,LM())),ni(h),null;case 26:var R=h.type,k=h.memoizedState;return u===null?(vl(h),k!==null?(ni(h),o4(h,k)):(ni(h),EE(h,R,null,S,b))):k?k!==u.memoizedState?(vl(h),ni(h),o4(h,k)):(ni(h),h.flags&=-16777217):(u=u.memoizedProps,u!==S&&vl(h),ni(h),EE(h,R,u,S,b)),null;case 27:if(je(h),b=ne.current,R=h.type,u!==null&&h.stateNode!=null)u.memoizedProps!==S&&vl(h);else{if(!S){if(h.stateNode===null)throw Error(i(166));return ni(h),null}u=ce.current,th(h)?zL(h):(u=pU(R,S,b),h.stateNode=u,vl(h))}return ni(h),null;case 5:if(je(h),R=h.type,u!==null&&h.stateNode!=null)u.memoizedProps!==S&&vl(h);else{if(!S){if(h.stateNode===null)throw Error(i(166));return ni(h),null}if(k=ce.current,th(h))zL(h);else{var G=cy(ne.current);switch(k){case 1:k=G.createElementNS("http://www.w3.org/2000/svg",R);break;case 2:k=G.createElementNS("http://www.w3.org/1998/Math/MathML",R);break;default:switch(R){case"svg":k=G.createElementNS("http://www.w3.org/2000/svg",R);break;case"math":k=G.createElementNS("http://www.w3.org/1998/Math/MathML",R);break;case"script":k=G.createElement("div"),k.innerHTML="<script><\/script>",k=k.removeChild(k.firstChild);break;case"select":k=typeof S.is=="string"?G.createElement("select",{is:S.is}):G.createElement("select"),S.multiple?k.multiple=!0:S.size&&(k.size=S.size);break;default:k=typeof S.is=="string"?G.createElement(R,{is:S.is}):G.createElement(R)}}k[hi]=h,k[Ai]=S;e:for(G=h.child;G!==null;){if(G.tag===5||G.tag===6)k.appendChild(G.stateNode);else if(G.tag!==4&&G.tag!==27&&G.child!==null){G.child.return=G,G=G.child;continue}if(G===h)break e;for(;G.sibling===null;){if(G.return===null||G.return===h)break e;G=G.return}G.sibling.return=G.return,G=G.sibling}h.stateNode=k;e:switch(Or(k,R,S),R){case"button":case"input":case"select":case"textarea":S=!!S.autoFocus;break e;case"img":S=!0;break e;default:S=!1}S&&vl(h)}}return ni(h),EE(h,h.type,u===null?null:u.memoizedProps,h.pendingProps,b),null;case 6:if(u&&h.stateNode!=null)u.memoizedProps!==S&&vl(h);else{if(typeof S!="string"&&h.stateNode===null)throw Error(i(166));if(u=ne.current,th(h)){if(u=h.stateNode,b=h.memoizedProps,S=null,R=Pr,R!==null)switch(R.tag){case 27:case 5:S=R.memoizedProps}u[hi]=h,u=!!(u.nodeValue===b||S!==null&&S.suppressHydrationWarning===!0||iU(u.nodeValue,b)),u||Lc(h,!0)}else u=cy(u).createTextNode(S),u[hi]=h,h.stateNode=u}return ni(h),null;case 31:if(b=h.memoizedState,u===null||u.memoizedState!==null){if(S=th(h),b!==null){if(u===null){if(!S)throw Error(i(318));if(u=h.memoizedState,u=u!==null?u.dehydrated:null,!u)throw Error(i(557));u[hi]=h}else gd(),(h.flags&128)===0&&(h.memoizedState=null),h.flags|=4;ni(h),u=!1}else b=LM(),u!==null&&u.memoizedState!==null&&(u.memoizedState.hydrationErrors=b),u=!0;if(!u)return h.flags&256?(Xa(h),h):(Xa(h),null);if((h.flags&128)!==0)throw Error(i(558))}return ni(h),null;case 13:if(S=h.memoizedState,u===null||u.memoizedState!==null&&u.memoizedState.dehydrated!==null){if(R=th(h),S!==null&&S.dehydrated!==null){if(u===null){if(!R)throw Error(i(318));if(R=h.memoizedState,R=R!==null?R.dehydrated:null,!R)throw Error(i(317));R[hi]=h}else gd(),(h.flags&128)===0&&(h.memoizedState=null),h.flags|=4;ni(h),R=!1}else R=LM(),u!==null&&u.memoizedState!==null&&(u.memoizedState.hydrationErrors=R),R=!0;if(!R)return h.flags&256?(Xa(h),h):(Xa(h),null)}return Xa(h),(h.flags&128)!==0?(h.lanes=b,h):(b=S!==null,u=u!==null&&u.memoizedState!==null,b&&(S=h.child,R=null,S.alternate!==null&&S.alternate.memoizedState!==null&&S.alternate.memoizedState.cachePool!==null&&(R=S.alternate.memoizedState.cachePool.pool),k=null,S.memoizedState!==null&&S.memoizedState.cachePool!==null&&(k=S.memoizedState.cachePool.pool),k!==R&&(S.flags|=2048)),b!==u&&b&&(h.child.flags|=8192),Xv(h,h.updateQueue),ni(h),null);case 4:return he(),u===null&&qE(h.stateNode.containerInfo),ni(h),null;case 10:return pl(h.type),ni(h),null;case 19:if(X(Ci),S=h.memoizedState,S===null)return ni(h),null;if(R=(h.flags&128)!==0,k=S.rendering,k===null)if(R)ig(S,!1);else{if(_i!==0||u!==null&&(u.flags&128)!==0)for(u=h.child;u!==null;){if(k=Lv(u),k!==null){for(h.flags|=128,ig(S,!1),u=k.updateQueue,h.updateQueue=u,Xv(h,u),h.subtreeFlags=0,u=b,b=h.child;b!==null;)LL(b,u),b=b.sibling;return ae(Ci,Ci.current&1|2),yn&&fl(h,S.treeForkCount),h.child}u=u.sibling}S.tail!==null&&L()>Jv&&(h.flags|=128,R=!0,ig(S,!1),h.lanes=4194304)}else{if(!R)if(u=Lv(k),u!==null){if(h.flags|=128,R=!0,u=u.updateQueue,h.updateQueue=u,Xv(h,u),ig(S,!0),S.tail===null&&S.tailMode==="hidden"&&!k.alternate&&!yn)return ni(h),null}else 2*L()-S.renderingStartTime>Jv&&b!==536870912&&(h.flags|=128,R=!0,ig(S,!1),h.lanes=4194304);S.isBackwards?(k.sibling=h.child,h.child=k):(u=S.last,u!==null?u.sibling=k:h.child=k,S.last=k)}return S.tail!==null?(u=S.tail,S.rendering=u,S.tail=u.sibling,S.renderingStartTime=L(),u.sibling=null,b=Ci.current,ae(Ci,R?b&1|2:b&1),yn&&fl(h,S.treeForkCount),u):(ni(h),null);case 22:case 23:return Xa(h),XM(),S=h.memoizedState!==null,u!==null?u.memoizedState!==null!==S&&(h.flags|=8192):S&&(h.flags|=8192),S?(b&536870912)!==0&&(h.flags&128)===0&&(ni(h),h.subtreeFlags&6&&(h.flags|=8192)):ni(h),b=h.updateQueue,b!==null&&Xv(h,b.retryQueue),b=null,u!==null&&u.memoizedState!==null&&u.memoizedState.cachePool!==null&&(b=u.memoizedState.cachePool.pool),S=null,h.memoizedState!==null&&h.memoizedState.cachePool!==null&&(S=h.memoizedState.cachePool.pool),S!==b&&(h.flags|=2048),u!==null&&X(yd),null;case 24:return b=null,u!==null&&(b=u.memoizedState.cache),h.memoizedState.cache!==b&&(h.flags|=2048),pl(Ii),ni(h),null;case 25:return null;case 30:return null}throw Error(i(156,h.tag))}function Vee(u,h){switch(kM(h),h.tag){case 1:return u=h.flags,u&65536?(h.flags=u&-65537|128,h):null;case 3:return pl(Ii),he(),u=h.flags,(u&65536)!==0&&(u&128)===0?(h.flags=u&-65537|128,h):null;case 26:case 27:case 5:return je(h),null;case 31:if(h.memoizedState!==null){if(Xa(h),h.alternate===null)throw Error(i(340));gd()}return u=h.flags,u&65536?(h.flags=u&-65537|128,h):null;case 13:if(Xa(h),u=h.memoizedState,u!==null&&u.dehydrated!==null){if(h.alternate===null)throw Error(i(340));gd()}return u=h.flags,u&65536?(h.flags=u&-65537|128,h):null;case 19:return X(Ci),null;case 4:return he(),null;case 10:return pl(h.type),null;case 22:case 23:return Xa(h),XM(),u!==null&&X(yd),u=h.flags,u&65536?(h.flags=u&-65537|128,h):null;case 24:return pl(Ii),null;case 25:return null;default:return null}}function l4(u,h){switch(kM(h),h.tag){case 3:pl(Ii),he();break;case 26:case 27:case 5:je(h);break;case 4:he();break;case 31:h.memoizedState!==null&&Xa(h);break;case 13:Xa(h);break;case 19:X(Ci);break;case 10:pl(h.type);break;case 22:case 23:Xa(h),XM(),u!==null&&X(yd);break;case 24:pl(Ii)}}function rg(u,h){try{var b=h.updateQueue,S=b!==null?b.lastEffect:null;if(S!==null){var R=S.next;b=R;do{if((b.tag&u)===u){S=void 0;var k=b.create,G=b.inst;S=k(),G.destroy=S}b=b.next}while(b!==R)}}catch(ie){kn(h,h.return,ie)}}function Hc(u,h,b){try{var S=h.updateQueue,R=S!==null?S.lastEffect:null;if(R!==null){var k=R.next;S=k;do{if((S.tag&u)===u){var G=S.inst,ie=G.destroy;if(ie!==void 0){G.destroy=void 0,R=h;var _e=b,ze=ie;try{ze()}catch(Je){kn(R,_e,Je)}}}S=S.next}while(S!==k)}}catch(Je){kn(h,h.return,Je)}}function c4(u){var h=u.updateQueue;if(h!==null){var b=u.stateNode;try{JL(h,b)}catch(S){kn(u,u.return,S)}}}function u4(u,h,b){b.props=Md(u.type,u.memoizedProps),b.state=u.memoizedState;try{b.componentWillUnmount()}catch(S){kn(u,h,S)}}function ag(u,h){try{var b=u.ref;if(b!==null){switch(u.tag){case 26:case 27:case 5:var S=u.stateNode;break;case 30:S=u.stateNode;break;default:S=u.stateNode}typeof b=="function"?u.refCleanup=b(S):b.current=S}}catch(R){kn(u,h,R)}}function Ro(u,h){var b=u.ref,S=u.refCleanup;if(b!==null)if(typeof S=="function")try{S()}catch(R){kn(u,h,R)}finally{u.refCleanup=null,u=u.alternate,u!=null&&(u.refCleanup=null)}else if(typeof b=="function")try{b(null)}catch(R){kn(u,h,R)}else b.current=null}function d4(u){var h=u.type,b=u.memoizedProps,S=u.stateNode;try{e:switch(h){case"button":case"input":case"select":case"textarea":b.autoFocus&&S.focus();break e;case"img":b.src?S.src=b.src:b.srcSet&&(S.srcset=b.srcSet)}}catch(R){kn(u,u.return,R)}}function AE(u,h,b){try{var S=u.stateNode;dte(S,u.type,b,h),S[Ai]=h}catch(R){kn(u,u.return,R)}}function f4(u){return u.tag===5||u.tag===3||u.tag===26||u.tag===27&&Kc(u.type)||u.tag===4}function TE(u){e:for(;;){for(;u.sibling===null;){if(u.return===null||f4(u.return))return null;u=u.return}for(u.sibling.return=u.return,u=u.sibling;u.tag!==5&&u.tag!==6&&u.tag!==18;){if(u.tag===27&&Kc(u.type)||u.flags&2||u.child===null||u.tag===4)continue e;u.child.return=u,u=u.child}if(!(u.flags&2))return u.stateNode}}function CE(u,h,b){var S=u.tag;if(S===5||S===6)u=u.stateNode,h?(b.nodeType===9?b.body:b.nodeName==="HTML"?b.ownerDocument.body:b).insertBefore(u,h):(h=b.nodeType===9?b.body:b.nodeName==="HTML"?b.ownerDocument.body:b,h.appendChild(u),b=b._reactRootContainer,b!=null||h.onclick!==null||(h.onclick=cl));else if(S!==4&&(S===27&&Kc(u.type)&&(b=u.stateNode,h=null),u=u.child,u!==null))for(CE(u,h,b),u=u.sibling;u!==null;)CE(u,h,b),u=u.sibling}function Kv(u,h,b){var S=u.tag;if(S===5||S===6)u=u.stateNode,h?b.insertBefore(u,h):b.appendChild(u);else if(S!==4&&(S===27&&Kc(u.type)&&(b=u.stateNode),u=u.child,u!==null))for(Kv(u,h,b),u=u.sibling;u!==null;)Kv(u,h,b),u=u.sibling}function h4(u){var h=u.stateNode,b=u.memoizedProps;try{for(var S=u.type,R=h.attributes;R.length;)h.removeAttributeNode(R[0]);Or(h,S,b),h[hi]=u,h[Ai]=b}catch(k){kn(u,u.return,k)}}var yl=!1,Fi=!1,NE=!1,p4=typeof WeakSet=="function"?WeakSet:Set,xr=null;function $ee(u,h){if(u=u.containerInfo,YE=gy,u=AL(u),SM(u)){if("selectionStart"in u)var b={start:u.selectionStart,end:u.selectionEnd};else e:{b=(b=u.ownerDocument)&&b.defaultView||window;var S=b.getSelection&&b.getSelection();if(S&&S.rangeCount!==0){b=S.anchorNode;var R=S.anchorOffset,k=S.focusNode;S=S.focusOffset;try{b.nodeType,k.nodeType}catch{b=null;break e}var G=0,ie=-1,_e=-1,ze=0,Je=0,ot=u,Ve=null;t:for(;;){for(var Ke;ot!==b||R!==0&&ot.nodeType!==3||(ie=G+R),ot!==k||S!==0&&ot.nodeType!==3||(_e=G+S),ot.nodeType===3&&(G+=ot.nodeValue.length),(Ke=ot.firstChild)!==null;)Ve=ot,ot=Ke;for(;;){if(ot===u)break t;if(Ve===b&&++ze===R&&(ie=G),Ve===k&&++Je===S&&(_e=G),(Ke=ot.nextSibling)!==null)break;ot=Ve,Ve=ot.parentNode}ot=Ke}b=ie===-1||_e===-1?null:{start:ie,end:_e}}else b=null}b=b||{start:0,end:0}}else b=null;for(ZE={focusedElem:u,selectionRange:b},gy=!1,xr=h;xr!==null;)if(h=xr,u=h.child,(h.subtreeFlags&1028)!==0&&u!==null)u.return=h,xr=u;else for(;xr!==null;){switch(h=xr,k=h.alternate,u=h.flags,h.tag){case 0:if((u&4)!==0&&(u=h.updateQueue,u=u!==null?u.events:null,u!==null))for(b=0;b<u.length;b++)R=u[b],R.ref.impl=R.nextImpl;break;case 11:case 15:break;case 1:if((u&1024)!==0&&k!==null){u=void 0,b=h,R=k.memoizedProps,k=k.memoizedState,S=b.stateNode;try{var Ct=Md(b.type,R);u=S.getSnapshotBeforeUpdate(Ct,k),S.__reactInternalSnapshotBeforeUpdate=u}catch(Bt){kn(b,b.return,Bt)}}break;case 3:if((u&1024)!==0){if(u=h.stateNode.containerInfo,b=u.nodeType,b===9)eA(u);else if(b===1)switch(u.nodeName){case"HEAD":case"HTML":case"BODY":eA(u);break;default:u.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((u&1024)!==0)throw Error(i(163))}if(u=h.sibling,u!==null){u.return=h.return,xr=u;break}xr=h.return}}function m4(u,h,b){var S=b.flags;switch(b.tag){case 0:case 11:case 15:_l(u,b),S&4&&rg(5,b);break;case 1:if(_l(u,b),S&4)if(u=b.stateNode,h===null)try{u.componentDidMount()}catch(G){kn(b,b.return,G)}else{var R=Md(b.type,h.memoizedProps);h=h.memoizedState;try{u.componentDidUpdate(R,h,u.__reactInternalSnapshotBeforeUpdate)}catch(G){kn(b,b.return,G)}}S&64&&c4(b),S&512&&ag(b,b.return);break;case 3:if(_l(u,b),S&64&&(u=b.updateQueue,u!==null)){if(h=null,b.child!==null)switch(b.child.tag){case 27:case 5:h=b.child.stateNode;break;case 1:h=b.child.stateNode}try{JL(u,h)}catch(G){kn(b,b.return,G)}}break;case 27:h===null&&S&4&&h4(b);case 26:case 5:_l(u,b),h===null&&S&4&&d4(b),S&512&&ag(b,b.return);break;case 12:_l(u,b);break;case 31:_l(u,b),S&4&&v4(u,b);break;case 13:_l(u,b),S&4&&y4(u,b),S&64&&(u=b.memoizedState,u!==null&&(u=u.dehydrated,u!==null&&(b=Jee.bind(null,b),yte(u,b))));break;case 22:if(S=b.memoizedState!==null||yl,!S){h=h!==null&&h.memoizedState!==null||Fi,R=yl;var k=Fi;yl=S,(Fi=h)&&!k?Sl(u,b,(b.subtreeFlags&8772)!==0):_l(u,b),yl=R,Fi=k}break;case 30:break;default:_l(u,b)}}function g4(u){var h=u.alternate;h!==null&&(u.alternate=null,g4(h)),u.child=null,u.deletions=null,u.sibling=null,u.tag===5&&(h=u.stateNode,h!==null&&Ge(h)),u.stateNode=null,u.return=null,u.dependencies=null,u.memoizedProps=null,u.memoizedState=null,u.pendingProps=null,u.stateNode=null,u.updateQueue=null}var li=null,Ea=!1;function bl(u,h,b){for(b=b.child;b!==null;)x4(u,h,b),b=b.sibling}function x4(u,h,b){if(Re&&typeof Re.onCommitFiberUnmount=="function")try{Re.onCommitFiberUnmount(Ie,b)}catch{}switch(b.tag){case 26:Fi||Ro(b,h),bl(u,h,b),b.memoizedState?b.memoizedState.count--:b.stateNode&&(b=b.stateNode,b.parentNode.removeChild(b));break;case 27:Fi||Ro(b,h);var S=li,R=Ea;Kc(b.type)&&(li=b.stateNode,Ea=!1),bl(u,h,b),pg(b.stateNode),li=S,Ea=R;break;case 5:Fi||Ro(b,h);case 6:if(S=li,R=Ea,li=null,bl(u,h,b),li=S,Ea=R,li!==null)if(Ea)try{(li.nodeType===9?li.body:li.nodeName==="HTML"?li.ownerDocument.body:li).removeChild(b.stateNode)}catch(k){kn(b,h,k)}else try{li.removeChild(b.stateNode)}catch(k){kn(b,h,k)}break;case 18:li!==null&&(Ea?(u=li,cU(u.nodeType===9?u.body:u.nodeName==="HTML"?u.ownerDocument.body:u,b.stateNode),Sh(u)):cU(li,b.stateNode));break;case 4:S=li,R=Ea,li=b.stateNode.containerInfo,Ea=!0,bl(u,h,b),li=S,Ea=R;break;case 0:case 11:case 14:case 15:Hc(2,b,h),Fi||Hc(4,b,h),bl(u,h,b);break;case 1:Fi||(Ro(b,h),S=b.stateNode,typeof S.componentWillUnmount=="function"&&u4(b,h,S)),bl(u,h,b);break;case 21:bl(u,h,b);break;case 22:Fi=(S=Fi)||b.memoizedState!==null,bl(u,h,b),Fi=S;break;default:bl(u,h,b)}}function v4(u,h){if(h.memoizedState===null&&(u=h.alternate,u!==null&&(u=u.memoizedState,u!==null))){u=u.dehydrated;try{Sh(u)}catch(b){kn(h,h.return,b)}}}function y4(u,h){if(h.memoizedState===null&&(u=h.alternate,u!==null&&(u=u.memoizedState,u!==null&&(u=u.dehydrated,u!==null))))try{Sh(u)}catch(b){kn(h,h.return,b)}}function Gee(u){switch(u.tag){case 31:case 13:case 19:var h=u.stateNode;return h===null&&(h=u.stateNode=new p4),h;case 22:return u=u.stateNode,h=u._retryCache,h===null&&(h=u._retryCache=new p4),h;default:throw Error(i(435,u.tag))}}function Yv(u,h){var b=Gee(u);h.forEach(function(S){if(!b.has(S)){b.add(S);var R=ete.bind(null,u,S);S.then(R,R)}})}function Aa(u,h){var b=h.deletions;if(b!==null)for(var S=0;S<b.length;S++){var R=b[S],k=u,G=h,ie=G;e:for(;ie!==null;){switch(ie.tag){case 27:if(Kc(ie.type)){li=ie.stateNode,Ea=!1;break e}break;case 5:li=ie.stateNode,Ea=!1;break e;case 3:case 4:li=ie.stateNode.containerInfo,Ea=!0;break e}ie=ie.return}if(li===null)throw Error(i(160));x4(k,G,R),li=null,Ea=!1,k=R.alternate,k!==null&&(k.return=null),R.return=null}if(h.subtreeFlags&13886)for(h=h.child;h!==null;)b4(h,u),h=h.sibling}var eo=null;function b4(u,h){var b=u.alternate,S=u.flags;switch(u.tag){case 0:case 11:case 14:case 15:Aa(h,u),Ta(u),S&4&&(Hc(3,u,u.return),rg(3,u),Hc(5,u,u.return));break;case 1:Aa(h,u),Ta(u),S&512&&(Fi||b===null||Ro(b,b.return)),S&64&&yl&&(u=u.updateQueue,u!==null&&(S=u.callbacks,S!==null&&(b=u.shared.hiddenCallbacks,u.shared.hiddenCallbacks=b===null?S:b.concat(S))));break;case 26:var R=eo;if(Aa(h,u),Ta(u),S&512&&(Fi||b===null||Ro(b,b.return)),S&4){var k=b!==null?b.memoizedState:null;if(S=u.memoizedState,b===null)if(S===null)if(u.stateNode===null){e:{S=u.type,b=u.memoizedProps,R=R.ownerDocument||R;t:switch(S){case"title":k=R.getElementsByTagName("title")[0],(!k||k[Xe]||k[hi]||k.namespaceURI==="http://www.w3.org/2000/svg"||k.hasAttribute("itemprop"))&&(k=R.createElement(S),R.head.insertBefore(k,R.querySelector("head > title"))),Or(k,S,b),k[hi]=u,Te(k),S=k;break e;case"link":var G=bU("link","href",R).get(S+(b.href||""));if(G){for(var ie=0;ie<G.length;ie++)if(k=G[ie],k.getAttribute("href")===(b.href==null||b.href===""?null:b.href)&&k.getAttribute("rel")===(b.rel==null?null:b.rel)&&k.getAttribute("title")===(b.title==null?null:b.title)&&k.getAttribute("crossorigin")===(b.crossOrigin==null?null:b.crossOrigin)){G.splice(ie,1);break t}}k=R.createElement(S),Or(k,S,b),R.head.appendChild(k);break;case"meta":if(G=bU("meta","content",R).get(S+(b.content||""))){for(ie=0;ie<G.length;ie++)if(k=G[ie],k.getAttribute("content")===(b.content==null?null:""+b.content)&&k.getAttribute("name")===(b.name==null?null:b.name)&&k.getAttribute("property")===(b.property==null?null:b.property)&&k.getAttribute("http-equiv")===(b.httpEquiv==null?null:b.httpEquiv)&&k.getAttribute("charset")===(b.charSet==null?null:b.charSet)){G.splice(ie,1);break t}}k=R.createElement(S),Or(k,S,b),R.head.appendChild(k);break;default:throw Error(i(468,S))}k[hi]=u,Te(k),S=k}u.stateNode=S}else _U(R,u.type,u.stateNode);else u.stateNode=yU(R,S,u.memoizedProps);else k!==S?(k===null?b.stateNode!==null&&(b=b.stateNode,b.parentNode.removeChild(b)):k.count--,S===null?_U(R,u.type,u.stateNode):yU(R,S,u.memoizedProps)):S===null&&u.stateNode!==null&&AE(u,u.memoizedProps,b.memoizedProps)}break;case 27:Aa(h,u),Ta(u),S&512&&(Fi||b===null||Ro(b,b.return)),b!==null&&S&4&&AE(u,u.memoizedProps,b.memoizedProps);break;case 5:if(Aa(h,u),Ta(u),S&512&&(Fi||b===null||Ro(b,b.return)),u.flags&32){R=u.stateNode;try{To(R,"")}catch(Ct){kn(u,u.return,Ct)}}S&4&&u.stateNode!=null&&(R=u.memoizedProps,AE(u,R,b!==null?b.memoizedProps:R)),S&1024&&(NE=!0);break;case 6:if(Aa(h,u),Ta(u),S&4){if(u.stateNode===null)throw Error(i(162));S=u.memoizedProps,b=u.stateNode;try{b.nodeValue=S}catch(Ct){kn(u,u.return,Ct)}}break;case 3:if(fy=null,R=eo,eo=uy(h.containerInfo),Aa(h,u),eo=R,Ta(u),S&4&&b!==null&&b.memoizedState.isDehydrated)try{Sh(h.containerInfo)}catch(Ct){kn(u,u.return,Ct)}NE&&(NE=!1,_4(u));break;case 4:S=eo,eo=uy(u.stateNode.containerInfo),Aa(h,u),Ta(u),eo=S;break;case 12:Aa(h,u),Ta(u);break;case 31:Aa(h,u),Ta(u),S&4&&(S=u.updateQueue,S!==null&&(u.updateQueue=null,Yv(u,S)));break;case 13:Aa(h,u),Ta(u),u.child.flags&8192&&u.memoizedState!==null!=(b!==null&&b.memoizedState!==null)&&(Qv=L()),S&4&&(S=u.updateQueue,S!==null&&(u.updateQueue=null,Yv(u,S)));break;case 22:R=u.memoizedState!==null;var _e=b!==null&&b.memoizedState!==null,ze=yl,Je=Fi;if(yl=ze||R,Fi=Je||_e,Aa(h,u),Fi=Je,yl=ze,Ta(u),S&8192)e:for(h=u.stateNode,h._visibility=R?h._visibility&-2:h._visibility|1,R&&(b===null||_e||yl||Fi||Ed(u)),b=null,h=u;;){if(h.tag===5||h.tag===26){if(b===null){_e=b=h;try{if(k=_e.stateNode,R)G=k.style,typeof G.setProperty=="function"?G.setProperty("display","none","important"):G.display="none";else{ie=_e.stateNode;var ot=_e.memoizedProps.style,Ve=ot!=null&&ot.hasOwnProperty("display")?ot.display:null;ie.style.display=Ve==null||typeof Ve=="boolean"?"":(""+Ve).trim()}}catch(Ct){kn(_e,_e.return,Ct)}}}else if(h.tag===6){if(b===null){_e=h;try{_e.stateNode.nodeValue=R?"":_e.memoizedProps}catch(Ct){kn(_e,_e.return,Ct)}}}else if(h.tag===18){if(b===null){_e=h;try{var Ke=_e.stateNode;R?uU(Ke,!0):uU(_e.stateNode,!1)}catch(Ct){kn(_e,_e.return,Ct)}}}else if((h.tag!==22&&h.tag!==23||h.memoizedState===null||h===u)&&h.child!==null){h.child.return=h,h=h.child;continue}if(h===u)break e;for(;h.sibling===null;){if(h.return===null||h.return===u)break e;b===h&&(b=null),h=h.return}b===h&&(b=null),h.sibling.return=h.return,h=h.sibling}S&4&&(S=u.updateQueue,S!==null&&(b=S.retryQueue,b!==null&&(S.retryQueue=null,Yv(u,b))));break;case 19:Aa(h,u),Ta(u),S&4&&(S=u.updateQueue,S!==null&&(u.updateQueue=null,Yv(u,S)));break;case 30:break;case 21:break;default:Aa(h,u),Ta(u)}}function Ta(u){var h=u.flags;if(h&2){try{for(var b,S=u.return;S!==null;){if(f4(S)){b=S;break}S=S.return}if(b==null)throw Error(i(160));switch(b.tag){case 27:var R=b.stateNode,k=TE(u);Kv(u,k,R);break;case 5:var G=b.stateNode;b.flags&32&&(To(G,""),b.flags&=-33);var ie=TE(u);Kv(u,ie,G);break;case 3:case 4:var _e=b.stateNode.containerInfo,ze=TE(u);CE(u,ze,_e);break;default:throw Error(i(161))}}catch(Je){kn(u,u.return,Je)}u.flags&=-3}h&4096&&(u.flags&=-4097)}function _4(u){if(u.subtreeFlags&1024)for(u=u.child;u!==null;){var h=u;_4(h),h.tag===5&&h.flags&1024&&h.stateNode.reset(),u=u.sibling}}function _l(u,h){if(h.subtreeFlags&8772)for(h=h.child;h!==null;)m4(u,h.alternate,h),h=h.sibling}function Ed(u){for(u=u.child;u!==null;){var h=u;switch(h.tag){case 0:case 11:case 14:case 15:Hc(4,h,h.return),Ed(h);break;case 1:Ro(h,h.return);var b=h.stateNode;typeof b.componentWillUnmount=="function"&&u4(h,h.return,b),Ed(h);break;case 27:pg(h.stateNode);case 26:case 5:Ro(h,h.return),Ed(h);break;case 22:h.memoizedState===null&&Ed(h);break;case 30:Ed(h);break;default:Ed(h)}u=u.sibling}}function Sl(u,h,b){for(b=b&&(h.subtreeFlags&8772)!==0,h=h.child;h!==null;){var S=h.alternate,R=u,k=h,G=k.flags;switch(k.tag){case 0:case 11:case 15:Sl(R,k,b),rg(4,k);break;case 1:if(Sl(R,k,b),S=k,R=S.stateNode,typeof R.componentDidMount=="function")try{R.componentDidMount()}catch(ze){kn(S,S.return,ze)}if(S=k,R=S.updateQueue,R!==null){var ie=S.stateNode;try{var _e=R.shared.hiddenCallbacks;if(_e!==null)for(R.shared.hiddenCallbacks=null,R=0;R<_e.length;R++)QL(_e[R],ie)}catch(ze){kn(S,S.return,ze)}}b&&G&64&&c4(k),ag(k,k.return);break;case 27:h4(k);case 26:case 5:Sl(R,k,b),b&&S===null&&G&4&&d4(k),ag(k,k.return);break;case 12:Sl(R,k,b);break;case 31:Sl(R,k,b),b&&G&4&&v4(R,k);break;case 13:Sl(R,k,b),b&&G&4&&y4(R,k);break;case 22:k.memoizedState===null&&Sl(R,k,b),ag(k,k.return);break;case 30:break;default:Sl(R,k,b)}h=h.sibling}}function RE(u,h){var b=null;u!==null&&u.memoizedState!==null&&u.memoizedState.cachePool!==null&&(b=u.memoizedState.cachePool.pool),u=null,h.memoizedState!==null&&h.memoizedState.cachePool!==null&&(u=h.memoizedState.cachePool.pool),u!==b&&(u!=null&&u.refCount++,b!=null&&Gm(b))}function PE(u,h){u=null,h.alternate!==null&&(u=h.alternate.memoizedState.cache),h=h.memoizedState.cache,h!==u&&(h.refCount++,u!=null&&Gm(u))}function to(u,h,b,S){if(h.subtreeFlags&10256)for(h=h.child;h!==null;)S4(u,h,b,S),h=h.sibling}function S4(u,h,b,S){var R=h.flags;switch(h.tag){case 0:case 11:case 15:to(u,h,b,S),R&2048&&rg(9,h);break;case 1:to(u,h,b,S);break;case 3:to(u,h,b,S),R&2048&&(u=null,h.alternate!==null&&(u=h.alternate.memoizedState.cache),h=h.memoizedState.cache,h!==u&&(h.refCount++,u!=null&&Gm(u)));break;case 12:if(R&2048){to(u,h,b,S),u=h.stateNode;try{var k=h.memoizedProps,G=k.id,ie=k.onPostCommit;typeof ie=="function"&&ie(G,h.alternate===null?"mount":"update",u.passiveEffectDuration,-0)}catch(_e){kn(h,h.return,_e)}}else to(u,h,b,S);break;case 31:to(u,h,b,S);break;case 13:to(u,h,b,S);break;case 23:break;case 22:k=h.stateNode,G=h.alternate,h.memoizedState!==null?k._visibility&2?to(u,h,b,S):sg(u,h):k._visibility&2?to(u,h,b,S):(k._visibility|=2,dh(u,h,b,S,(h.subtreeFlags&10256)!==0||!1)),R&2048&&RE(G,h);break;case 24:to(u,h,b,S),R&2048&&PE(h.alternate,h);break;default:to(u,h,b,S)}}function dh(u,h,b,S,R){for(R=R&&((h.subtreeFlags&10256)!==0||!1),h=h.child;h!==null;){var k=u,G=h,ie=b,_e=S,ze=G.flags;switch(G.tag){case 0:case 11:case 15:dh(k,G,ie,_e,R),rg(8,G);break;case 23:break;case 22:var Je=G.stateNode;G.memoizedState!==null?Je._visibility&2?dh(k,G,ie,_e,R):sg(k,G):(Je._visibility|=2,dh(k,G,ie,_e,R)),R&&ze&2048&&RE(G.alternate,G);break;case 24:dh(k,G,ie,_e,R),R&&ze&2048&&PE(G.alternate,G);break;default:dh(k,G,ie,_e,R)}h=h.sibling}}function sg(u,h){if(h.subtreeFlags&10256)for(h=h.child;h!==null;){var b=u,S=h,R=S.flags;switch(S.tag){case 22:sg(b,S),R&2048&&RE(S.alternate,S);break;case 24:sg(b,S),R&2048&&PE(S.alternate,S);break;default:sg(b,S)}h=h.sibling}}var og=8192;function fh(u,h,b){if(u.subtreeFlags&og)for(u=u.child;u!==null;)w4(u,h,b),u=u.sibling}function w4(u,h,b){switch(u.tag){case 26:fh(u,h,b),u.flags&og&&u.memoizedState!==null&&Pte(b,eo,u.memoizedState,u.memoizedProps);break;case 5:fh(u,h,b);break;case 3:case 4:var S=eo;eo=uy(u.stateNode.containerInfo),fh(u,h,b),eo=S;break;case 22:u.memoizedState===null&&(S=u.alternate,S!==null&&S.memoizedState!==null?(S=og,og=16777216,fh(u,h,b),og=S):fh(u,h,b));break;default:fh(u,h,b)}}function M4(u){var h=u.alternate;if(h!==null&&(u=h.child,u!==null)){h.child=null;do h=u.sibling,u.sibling=null,u=h;while(u!==null)}}function lg(u){var h=u.deletions;if((u.flags&16)!==0){if(h!==null)for(var b=0;b<h.length;b++){var S=h[b];xr=S,A4(S,u)}M4(u)}if(u.subtreeFlags&10256)for(u=u.child;u!==null;)E4(u),u=u.sibling}function E4(u){switch(u.tag){case 0:case 11:case 15:lg(u),u.flags&2048&&Hc(9,u,u.return);break;case 3:lg(u);break;case 12:lg(u);break;case 22:var h=u.stateNode;u.memoizedState!==null&&h._visibility&2&&(u.return===null||u.return.tag!==13)?(h._visibility&=-3,Zv(u)):lg(u);break;default:lg(u)}}function Zv(u){var h=u.deletions;if((u.flags&16)!==0){if(h!==null)for(var b=0;b<h.length;b++){var S=h[b];xr=S,A4(S,u)}M4(u)}for(u=u.child;u!==null;){switch(h=u,h.tag){case 0:case 11:case 15:Hc(8,h,h.return),Zv(h);break;case 22:b=h.stateNode,b._visibility&2&&(b._visibility&=-3,Zv(h));break;default:Zv(h)}u=u.sibling}}function A4(u,h){for(;xr!==null;){var b=xr;switch(b.tag){case 0:case 11:case 15:Hc(8,b,h);break;case 23:case 22:if(b.memoizedState!==null&&b.memoizedState.cachePool!==null){var S=b.memoizedState.cachePool.pool;S!=null&&S.refCount++}break;case 24:Gm(b.memoizedState.cache)}if(S=b.child,S!==null)S.return=b,xr=S;else e:for(b=u;xr!==null;){S=xr;var R=S.sibling,k=S.return;if(g4(S),S===b){xr=null;break e}if(R!==null){R.return=k,xr=R;break e}xr=k}}}var Wee={getCacheForType:function(u){var h=Dr(Ii),b=h.data.get(u);return b===void 0&&(b=u(),h.data.set(u,b)),b},cacheSignal:function(){return Dr(Ii).controller.signal}},qee=typeof WeakMap=="function"?WeakMap:Map,Tn=0,qn=null,fn=null,gn=0,Dn=0,Ka=null,Vc=!1,hh=!1,DE=!1,wl=0,_i=0,$c=0,Ad=0,kE=0,Ya=0,ph=0,cg=null,Ca=null,OE=!1,Qv=0,T4=0,Jv=1/0,ey=null,Gc=null,Ji=0,Wc=null,mh=null,Ml=0,LE=0,IE=null,C4=null,ug=0,UE=null;function Za(){return(Tn&2)!==0&&gn!==0?gn&-gn:H.T!==null?VE():Nr()}function N4(){if(Ya===0)if((gn&536870912)===0||yn){var u=fe;fe<<=1,(fe&3932160)===0&&(fe=262144),Ya=u}else Ya=536870912;return u=qa.current,u!==null&&(u.flags|=32),Ya}function Na(u,h,b){(u===qn&&(Dn===2||Dn===9)||u.cancelPendingCommit!==null)&&(gh(u,0),qc(u,gn,Ya,!1)),on(u,b),((Tn&2)===0||u!==qn)&&(u===qn&&((Tn&2)===0&&(Ad|=b),_i===4&&qc(u,gn,Ya,!1)),Po(u))}function R4(u,h,b){if((Tn&6)!==0)throw Error(i(327));var S=!b&&(h&127)===0&&(h&u.expiredLanes)===0||Be(u,h),R=S?Yee(u,h):FE(u,h,!0),k=S;do{if(R===0){hh&&!S&&qc(u,h,0,!1);break}else{if(b=u.current.alternate,k&&!Xee(b)){R=FE(u,h,!1),k=!1;continue}if(R===2){if(k=h,u.errorRecoveryDisabledLanes&k)var G=0;else G=u.pendingLanes&-536870913,G=G!==0?G:G&536870912?536870912:0;if(G!==0){h=G;e:{var ie=u;R=cg;var _e=ie.current.memoizedState.isDehydrated;if(_e&&(gh(ie,G).flags|=256),G=FE(ie,G,!1),G!==2){if(DE&&!_e){ie.errorRecoveryDisabledLanes|=k,Ad|=k,R=4;break e}k=Ca,Ca=R,k!==null&&(Ca===null?Ca=k:Ca.push.apply(Ca,k))}R=G}if(k=!1,R!==2)continue}}if(R===1){gh(u,0),qc(u,h,0,!0);break}e:{switch(S=u,k=R,k){case 0:case 1:throw Error(i(345));case 4:if((h&4194048)!==h)break;case 6:qc(S,h,Ya,!Vc);break e;case 2:Ca=null;break;case 3:case 5:break;default:throw Error(i(329))}if((h&62914560)===h&&(R=Qv+300-L(),10<R)){if(qc(S,h,Ya,!Vc),xe(S,0,!0)!==0)break e;Ml=h,S.timeoutHandle=oU(P4.bind(null,S,b,Ca,ey,OE,h,Ya,Ad,ph,Vc,k,"Throttled",-0,0),R);break e}P4(S,b,Ca,ey,OE,h,Ya,Ad,ph,Vc,k,null,-0,0)}}break}while(!0);Po(u)}function P4(u,h,b,S,R,k,G,ie,_e,ze,Je,ot,Ve,Ke){if(u.timeoutHandle=-1,ot=h.subtreeFlags,ot&8192||(ot&16785408)===16785408){ot={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:cl},w4(h,k,ot);var Ct=(k&62914560)===k?Qv-L():(k&4194048)===k?T4-L():0;if(Ct=Dte(ot,Ct),Ct!==null){Ml=k,u.cancelPendingCommit=Ct(F4.bind(null,u,h,k,b,S,R,G,ie,_e,Je,ot,null,Ve,Ke)),qc(u,k,G,!ze);return}}F4(u,h,k,b,S,R,G,ie,_e)}function Xee(u){for(var h=u;;){var b=h.tag;if((b===0||b===11||b===15)&&h.flags&16384&&(b=h.updateQueue,b!==null&&(b=b.stores,b!==null)))for(var S=0;S<b.length;S++){var R=b[S],k=R.getSnapshot;R=R.value;try{if(!Ga(k(),R))return!1}catch{return!1}}if(b=h.child,h.subtreeFlags&16384&&b!==null)b.return=h,h=b;else{if(h===u)break;for(;h.sibling===null;){if(h.return===null||h.return===u)return!0;h=h.return}h.sibling.return=h.return,h=h.sibling}}return!0}function qc(u,h,b,S){h&=~kE,h&=~Ad,u.suspendedLanes|=h,u.pingedLanes&=~h,S&&(u.warmLanes|=h),S=u.expirationTimes;for(var R=h;0<R;){var k=31-nt(R),G=1<<k;S[k]=-1,R&=~G}b!==0&&Rn(u,b,h)}function ty(){return(Tn&6)===0?(dg(0),!1):!0}function jE(){if(fn!==null){if(Dn===0)var u=fn.return;else u=fn,hl=xd=null,eE(u),sh=null,qm=0,u=fn;for(;u!==null;)l4(u.alternate,u),u=u.return;fn=null}}function gh(u,h){var b=u.timeoutHandle;b!==-1&&(u.timeoutHandle=-1,pte(b)),b=u.cancelPendingCommit,b!==null&&(u.cancelPendingCommit=null,b()),Ml=0,jE(),qn=u,fn=b=dl(u.current,null),gn=h,Dn=0,Ka=null,Vc=!1,hh=Be(u,h),DE=!1,ph=Ya=kE=Ad=$c=_i=0,Ca=cg=null,OE=!1,(h&8)!==0&&(h|=h&32);var S=u.entangledLanes;if(S!==0)for(u=u.entanglements,S&=h;0<S;){var R=31-nt(S),k=1<<R;h|=u[R],S&=~k}return wl=h,Sv(),b}function D4(u,h){Qt=null,H.H=tg,h===ah||h===Rv?(h=XL(),Dn=3):h===HM?(h=XL(),Dn=4):Dn=h===gE?8:h!==null&&typeof h=="object"&&typeof h.then=="function"?6:1,Ka=h,fn===null&&(_i=1,$v(u,gs(h,u.current)))}function k4(){var u=qa.current;return u===null?!0:(gn&4194048)===gn?bs===null:(gn&62914560)===gn||(gn&536870912)!==0?u===bs:!1}function O4(){var u=H.H;return H.H=tg,u===null?tg:u}function L4(){var u=H.A;return H.A=Wee,u}function ny(){_i=4,Vc||(gn&4194048)!==gn&&qa.current!==null||(hh=!0),($c&134217727)===0&&(Ad&134217727)===0||qn===null||qc(qn,gn,Ya,!1)}function FE(u,h,b){var S=Tn;Tn|=2;var R=O4(),k=L4();(qn!==u||gn!==h)&&(ey=null,gh(u,h)),h=!1;var G=_i;e:do try{if(Dn!==0&&fn!==null){var ie=fn,_e=Ka;switch(Dn){case 8:jE(),G=6;break e;case 3:case 2:case 9:case 6:qa.current===null&&(h=!0);var ze=Dn;if(Dn=0,Ka=null,xh(u,ie,_e,ze),b&&hh){G=0;break e}break;default:ze=Dn,Dn=0,Ka=null,xh(u,ie,_e,ze)}}Kee(),G=_i;break}catch(Je){D4(u,Je)}while(!0);return h&&u.shellSuspendCounter++,hl=xd=null,Tn=S,H.H=R,H.A=k,fn===null&&(qn=null,gn=0,Sv()),G}function Kee(){for(;fn!==null;)I4(fn)}function Yee(u,h){var b=Tn;Tn|=2;var S=O4(),R=L4();qn!==u||gn!==h?(ey=null,Jv=L()+500,gh(u,h)):hh=Be(u,h);e:do try{if(Dn!==0&&fn!==null){h=fn;var k=Ka;t:switch(Dn){case 1:Dn=0,Ka=null,xh(u,h,k,1);break;case 2:case 9:if(WL(k)){Dn=0,Ka=null,U4(h);break}h=function(){Dn!==2&&Dn!==9||qn!==u||(Dn=7),Po(u)},k.then(h,h);break e;case 3:Dn=7;break e;case 4:Dn=5;break e;case 7:WL(k)?(Dn=0,Ka=null,U4(h)):(Dn=0,Ka=null,xh(u,h,k,7));break;case 5:var G=null;switch(fn.tag){case 26:G=fn.memoizedState;case 5:case 27:var ie=fn;if(G?SU(G):ie.stateNode.complete){Dn=0,Ka=null;var _e=ie.sibling;if(_e!==null)fn=_e;else{var ze=ie.return;ze!==null?(fn=ze,iy(ze)):fn=null}break t}}Dn=0,Ka=null,xh(u,h,k,5);break;case 6:Dn=0,Ka=null,xh(u,h,k,6);break;case 8:jE(),_i=6;break e;default:throw Error(i(462))}}Zee();break}catch(Je){D4(u,Je)}while(!0);return hl=xd=null,H.H=S,H.A=R,Tn=b,fn!==null?0:(qn=null,gn=0,Sv(),_i)}function Zee(){for(;fn!==null&&!te();)I4(fn)}function I4(u){var h=s4(u.alternate,u,wl);u.memoizedProps=u.pendingProps,h===null?iy(u):fn=h}function U4(u){var h=u,b=h.alternate;switch(h.tag){case 15:case 0:h=e4(b,h,h.pendingProps,h.type,void 0,gn);break;case 11:h=e4(b,h,h.pendingProps,h.type.render,h.ref,gn);break;case 5:eE(h);default:l4(b,h),h=fn=LL(h,wl),h=s4(b,h,wl)}u.memoizedProps=u.pendingProps,h===null?iy(u):fn=h}function xh(u,h,b,S){hl=xd=null,eE(h),sh=null,qm=0;var R=h.return;try{if(Fee(u,R,h,b,gn)){_i=1,$v(u,gs(b,u.current)),fn=null;return}}catch(k){if(R!==null)throw fn=R,k;_i=1,$v(u,gs(b,u.current)),fn=null;return}h.flags&32768?(yn||S===1?u=!0:hh||(gn&536870912)!==0?u=!1:(Vc=u=!0,(S===2||S===9||S===3||S===6)&&(S=qa.current,S!==null&&S.tag===13&&(S.flags|=16384))),j4(h,u)):iy(h)}function iy(u){var h=u;do{if((h.flags&32768)!==0){j4(h,Vc);return}u=h.return;var b=Hee(h.alternate,h,wl);if(b!==null){fn=b;return}if(h=h.sibling,h!==null){fn=h;return}fn=h=u}while(h!==null);_i===0&&(_i=5)}function j4(u,h){do{var b=Vee(u.alternate,u);if(b!==null){b.flags&=32767,fn=b;return}if(b=u.return,b!==null&&(b.flags|=32768,b.subtreeFlags=0,b.deletions=null),!h&&(u=u.sibling,u!==null)){fn=u;return}fn=u=b}while(u!==null);_i=6,fn=null}function F4(u,h,b,S,R,k,G,ie,_e){u.cancelPendingCommit=null;do ry();while(Ji!==0);if((Tn&6)!==0)throw Error(i(327));if(h!==null){if(h===u.current)throw Error(i(177));if(k=h.lanes|h.childLanes,k|=TM,Dt(u,b,k,G,ie,_e),u===qn&&(fn=qn=null,gn=0),mh=h,Wc=u,Ml=b,LE=k,IE=R,C4=S,(h.subtreeFlags&10256)!==0||(h.flags&10256)!==0?(u.callbackNode=null,u.callbackPriority=0,tte(pe,function(){return $4(),null})):(u.callbackNode=null,u.callbackPriority=0),S=(h.flags&13878)!==0,(h.subtreeFlags&13878)!==0||S){S=H.T,H.T=null,R=$.p,$.p=2,G=Tn,Tn|=4;try{$ee(u,h,b)}finally{Tn=G,$.p=R,H.T=S}}Ji=1,z4(),B4(),H4()}}function z4(){if(Ji===1){Ji=0;var u=Wc,h=mh,b=(h.flags&13878)!==0;if((h.subtreeFlags&13878)!==0||b){b=H.T,H.T=null;var S=$.p;$.p=2;var R=Tn;Tn|=4;try{b4(h,u);var k=ZE,G=AL(u.containerInfo),ie=k.focusedElem,_e=k.selectionRange;if(G!==ie&&ie&&ie.ownerDocument&&EL(ie.ownerDocument.documentElement,ie)){if(_e!==null&&SM(ie)){var ze=_e.start,Je=_e.end;if(Je===void 0&&(Je=ze),"selectionStart"in ie)ie.selectionStart=ze,ie.selectionEnd=Math.min(Je,ie.value.length);else{var ot=ie.ownerDocument||document,Ve=ot&&ot.defaultView||window;if(Ve.getSelection){var Ke=Ve.getSelection(),Ct=ie.textContent.length,Bt=Math.min(_e.start,Ct),jn=_e.end===void 0?Bt:Math.min(_e.end,Ct);!Ke.extend&&Bt>jn&&(G=jn,jn=Bt,Bt=G);var ke=ML(ie,Bt),Ee=ML(ie,jn);if(ke&&Ee&&(Ke.rangeCount!==1||Ke.anchorNode!==ke.node||Ke.anchorOffset!==ke.offset||Ke.focusNode!==Ee.node||Ke.focusOffset!==Ee.offset)){var Fe=ot.createRange();Fe.setStart(ke.node,ke.offset),Ke.removeAllRanges(),Bt>jn?(Ke.addRange(Fe),Ke.extend(Ee.node,Ee.offset)):(Fe.setEnd(Ee.node,Ee.offset),Ke.addRange(Fe))}}}}for(ot=[],Ke=ie;Ke=Ke.parentNode;)Ke.nodeType===1&&ot.push({element:Ke,left:Ke.scrollLeft,top:Ke.scrollTop});for(typeof ie.focus=="function"&&ie.focus(),ie=0;ie<ot.length;ie++){var rt=ot[ie];rt.element.scrollLeft=rt.left,rt.element.scrollTop=rt.top}}gy=!!YE,ZE=YE=null}finally{Tn=R,$.p=S,H.T=b}}u.current=h,Ji=2}}function B4(){if(Ji===2){Ji=0;var u=Wc,h=mh,b=(h.flags&8772)!==0;if((h.subtreeFlags&8772)!==0||b){b=H.T,H.T=null;var S=$.p;$.p=2;var R=Tn;Tn|=4;try{m4(u,h.alternate,h)}finally{Tn=R,$.p=S,H.T=b}}Ji=3}}function H4(){if(Ji===4||Ji===3){Ji=0,j();var u=Wc,h=mh,b=Ml,S=C4;(h.subtreeFlags&10256)!==0||(h.flags&10256)!==0?Ji=5:(Ji=0,mh=Wc=null,V4(u,u.pendingLanes));var R=u.pendingLanes;if(R===0&&(Gc=null),pr(b),h=h.stateNode,Re&&typeof Re.onCommitFiberRoot=="function")try{Re.onCommitFiberRoot(Ie,h,void 0,(h.current.flags&128)===128)}catch{}if(S!==null){h=H.T,R=$.p,$.p=2,H.T=null;try{for(var k=u.onRecoverableError,G=0;G<S.length;G++){var ie=S[G];k(ie.value,{componentStack:ie.stack})}}finally{H.T=h,$.p=R}}(Ml&3)!==0&&ry(),Po(u),R=u.pendingLanes,(b&261930)!==0&&(R&42)!==0?u===UE?ug++:(ug=0,UE=u):ug=0,dg(0)}}function V4(u,h){(u.pooledCacheLanes&=h)===0&&(h=u.pooledCache,h!=null&&(u.pooledCache=null,Gm(h)))}function ry(){return z4(),B4(),H4(),$4()}function $4(){if(Ji!==5)return!1;var u=Wc,h=LE;LE=0;var b=pr(Ml),S=H.T,R=$.p;try{$.p=32>b?32:b,H.T=null,b=IE,IE=null;var k=Wc,G=Ml;if(Ji=0,mh=Wc=null,Ml=0,(Tn&6)!==0)throw Error(i(331));var ie=Tn;if(Tn|=4,E4(k.current),S4(k,k.current,G,b),Tn=ie,dg(0,!1),Re&&typeof Re.onPostCommitFiberRoot=="function")try{Re.onPostCommitFiberRoot(Ie,k)}catch{}return!0}finally{$.p=R,H.T=S,V4(u,h)}}function G4(u,h,b){h=gs(b,h),h=mE(u.stateNode,h,2),u=Fc(u,h,2),u!==null&&(on(u,2),Po(u))}function kn(u,h,b){if(u.tag===3)G4(u,u,b);else for(;h!==null;){if(h.tag===3){G4(h,u,b);break}else if(h.tag===1){var S=h.stateNode;if(typeof h.type.getDerivedStateFromError=="function"||typeof S.componentDidCatch=="function"&&(Gc===null||!Gc.has(S))){u=gs(b,u),b=WI(2),S=Fc(h,b,2),S!==null&&(qI(b,S,h,u),on(S,2),Po(S));break}}h=h.return}}function zE(u,h,b){var S=u.pingCache;if(S===null){S=u.pingCache=new qee;var R=new Set;S.set(h,R)}else R=S.get(h),R===void 0&&(R=new Set,S.set(h,R));R.has(b)||(DE=!0,R.add(b),u=Qee.bind(null,u,h,b),h.then(u,u))}function Qee(u,h,b){var S=u.pingCache;S!==null&&S.delete(h),u.pingedLanes|=u.suspendedLanes&b,u.warmLanes&=~b,qn===u&&(gn&b)===b&&(_i===4||_i===3&&(gn&62914560)===gn&&300>L()-Qv?(Tn&2)===0&&gh(u,0):kE|=b,ph===gn&&(ph=0)),Po(u)}function W4(u,h){h===0&&(h=bt()),u=pd(u,h),u!==null&&(on(u,h),Po(u))}function Jee(u){var h=u.memoizedState,b=0;h!==null&&(b=h.retryLane),W4(u,b)}function ete(u,h){var b=0;switch(u.tag){case 31:case 13:var S=u.stateNode,R=u.memoizedState;R!==null&&(b=R.retryLane);break;case 19:S=u.stateNode;break;case 22:S=u.stateNode._retryCache;break;default:throw Error(i(314))}S!==null&&S.delete(h),W4(u,b)}function tte(u,h){return De(u,h)}var ay=null,vh=null,BE=!1,sy=!1,HE=!1,Xc=0;function Po(u){u!==vh&&u.next===null&&(vh===null?ay=vh=u:vh=vh.next=u),sy=!0,BE||(BE=!0,ite())}function dg(u,h){if(!HE&&sy){HE=!0;do for(var b=!1,S=ay;S!==null;){if(u!==0){var R=S.pendingLanes;if(R===0)var k=0;else{var G=S.suspendedLanes,ie=S.pingedLanes;k=(1<<31-nt(42|u)+1)-1,k&=R&~(G&~ie),k=k&201326741?k&201326741|1:k?k|2:0}k!==0&&(b=!0,Y4(S,k))}else k=gn,k=xe(S,S===qn?k:0,S.cancelPendingCommit!==null||S.timeoutHandle!==-1),(k&3)===0||Be(S,k)||(b=!0,Y4(S,k));S=S.next}while(b);HE=!1}}function nte(){q4()}function q4(){sy=BE=!1;var u=0;Xc!==0&&hte()&&(u=Xc);for(var h=L(),b=null,S=ay;S!==null;){var R=S.next,k=X4(S,h);k===0?(S.next=null,b===null?ay=R:b.next=R,R===null&&(vh=b)):(b=S,(u!==0||(k&3)!==0)&&(sy=!0)),S=R}Ji!==0&&Ji!==5||dg(u),Xc!==0&&(Xc=0)}function X4(u,h){for(var b=u.suspendedLanes,S=u.pingedLanes,R=u.expirationTimes,k=u.pendingLanes&-62914561;0<k;){var G=31-nt(k),ie=1<<G,_e=R[G];_e===-1?((ie&b)===0||(ie&S)!==0)&&(R[G]=ct(ie,h)):_e<=h&&(u.expiredLanes|=ie),k&=~ie}if(h=qn,b=gn,b=xe(u,u===h?b:0,u.cancelPendingCommit!==null||u.timeoutHandle!==-1),S=u.callbackNode,b===0||u===h&&(Dn===2||Dn===9)||u.cancelPendingCommit!==null)return S!==null&&S!==null&&Ne(S),u.callbackNode=null,u.callbackPriority=0;if((b&3)===0||Be(u,b)){if(h=b&-b,h===u.callbackPriority)return h;switch(S!==null&&Ne(S),pr(b)){case 2:case 8:b=ye;break;case 32:b=pe;break;case 268435456:b=Le;break;default:b=pe}return S=K4.bind(null,u),b=De(b,S),u.callbackPriority=h,u.callbackNode=b,h}return S!==null&&S!==null&&Ne(S),u.callbackPriority=2,u.callbackNode=null,2}function K4(u,h){if(Ji!==0&&Ji!==5)return u.callbackNode=null,u.callbackPriority=0,null;var b=u.callbackNode;if(ry()&&u.callbackNode!==b)return null;var S=gn;return S=xe(u,u===qn?S:0,u.cancelPendingCommit!==null||u.timeoutHandle!==-1),S===0?null:(R4(u,S,h),X4(u,L()),u.callbackNode!=null&&u.callbackNode===b?K4.bind(null,u):null)}function Y4(u,h){if(ry())return null;R4(u,h,!0)}function ite(){mte(function(){(Tn&6)!==0?De(me,nte):q4()})}function VE(){if(Xc===0){var u=ih;u===0&&(u=it,it<<=1,(it&261888)===0&&(it=256)),Xc=u}return Xc}function Z4(u){return u==null||typeof u=="symbol"||typeof u=="boolean"?null:typeof u=="function"?u:pv(""+u)}function Q4(u,h){var b=h.ownerDocument.createElement("input");return b.name=h.name,b.value=h.value,u.id&&b.setAttribute("form",u.id),h.parentNode.insertBefore(b,h),u=new FormData(u),b.parentNode.removeChild(b),u}function rte(u,h,b,S,R){if(h==="submit"&&b&&b.stateNode===R){var k=Z4((R[Ai]||null).action),G=S.submitter;G&&(h=(h=G[Ai]||null)?Z4(h.formAction):G.getAttribute("formAction"),h!==null&&(k=h,G=null));var ie=new vv("action","action",null,S,R);u.push({event:ie,listeners:[{instance:null,listener:function(){if(S.defaultPrevented){if(Xc!==0){var _e=G?Q4(R,G):new FormData(R);cE(b,{pending:!0,data:_e,method:R.method,action:k},null,_e)}}else typeof k=="function"&&(ie.preventDefault(),_e=G?Q4(R,G):new FormData(R),cE(b,{pending:!0,data:_e,method:R.method,action:k},k,_e))},currentTarget:R}]})}}for(var $E=0;$E<AM.length;$E++){var GE=AM[$E],ate=GE.toLowerCase(),ste=GE[0].toUpperCase()+GE.slice(1);Js(ate,"on"+ste)}Js(NL,"onAnimationEnd"),Js(RL,"onAnimationIteration"),Js(PL,"onAnimationStart"),Js("dblclick","onDoubleClick"),Js("focusin","onFocus"),Js("focusout","onBlur"),Js(See,"onTransitionRun"),Js(wee,"onTransitionStart"),Js(Mee,"onTransitionCancel"),Js(DL,"onTransitionEnd"),vt("onMouseEnter",["mouseout","mouseover"]),vt("onMouseLeave",["mouseout","mouseover"]),vt("onPointerEnter",["pointerout","pointerover"]),vt("onPointerLeave",["pointerout","pointerover"]),dt("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),dt("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),dt("onBeforeInput",["compositionend","keypress","textInput","paste"]),dt("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),dt("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),dt("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var fg="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(" "),ote=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(fg));function J4(u,h){h=(h&4)!==0;for(var b=0;b<u.length;b++){var S=u[b],R=S.event;S=S.listeners;e:{var k=void 0;if(h)for(var G=S.length-1;0<=G;G--){var ie=S[G],_e=ie.instance,ze=ie.currentTarget;if(ie=ie.listener,_e!==k&&R.isPropagationStopped())break e;k=ie,R.currentTarget=ze;try{k(R)}catch(Je){_v(Je)}R.currentTarget=null,k=_e}else for(G=0;G<S.length;G++){if(ie=S[G],_e=ie.instance,ze=ie.currentTarget,ie=ie.listener,_e!==k&&R.isPropagationStopped())break e;k=ie,R.currentTarget=ze;try{k(R)}catch(Je){_v(Je)}R.currentTarget=null,k=_e}}}}function hn(u,h){var b=h[Pc];b===void 0&&(b=h[Pc]=new Set);var S=u+"__bubble";b.has(S)||(eU(h,u,2,!1),b.add(S))}function WE(u,h,b){var S=0;h&&(S|=4),eU(b,u,S,h)}var oy="_reactListening"+Math.random().toString(36).slice(2);function qE(u){if(!u[oy]){u[oy]=!0,Se.forEach(function(b){b!=="selectionchange"&&(ote.has(b)||WE(b,!1,u),WE(b,!0,u))});var h=u.nodeType===9?u:u.ownerDocument;h===null||h[oy]||(h[oy]=!0,WE("selectionchange",!1,h))}}function eU(u,h,b,S){switch(NU(h)){case 2:var R=Lte;break;case 8:R=Ite;break;default:R=lA}b=R.bind(null,h,b,u),R=void 0,!hM||h!=="touchstart"&&h!=="touchmove"&&h!=="wheel"||(R=!0),S?R!==void 0?u.addEventListener(h,b,{capture:!0,passive:R}):u.addEventListener(h,b,!0):R!==void 0?u.addEventListener(h,b,{passive:R}):u.addEventListener(h,b,!1)}function XE(u,h,b,S,R){var k=S;if((h&1)===0&&(h&2)===0&&S!==null)e:for(;;){if(S===null)return;var G=S.tag;if(G===3||G===4){var ie=S.stateNode.containerInfo;if(ie===R)break;if(G===4)for(G=S.return;G!==null;){var _e=G.tag;if((_e===3||_e===4)&&G.stateNode.containerInfo===R)return;G=G.return}for(;ie!==null;){if(G=_t(ie),G===null)return;if(_e=G.tag,_e===5||_e===6||_e===26||_e===27){S=k=G;continue e}ie=ie.parentNode}}S=S.return}aL(function(){var ze=k,Je=dM(b),ot=[];e:{var Ve=kL.get(u);if(Ve!==void 0){var Ke=vv,Ct=u;switch(u){case"keypress":if(gv(b)===0)break e;case"keydown":case"keyup":Ke=eee;break;case"focusin":Ct="focus",Ke=xM;break;case"focusout":Ct="blur",Ke=xM;break;case"beforeblur":case"afterblur":Ke=xM;break;case"click":if(b.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":Ke=lL;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Ke=HJ;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Ke=iee;break;case NL:case RL:case PL:Ke=GJ;break;case DL:Ke=aee;break;case"scroll":case"scrollend":Ke=zJ;break;case"wheel":Ke=oee;break;case"copy":case"cut":case"paste":Ke=qJ;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Ke=uL;break;case"toggle":case"beforetoggle":Ke=cee}var Bt=(h&4)!==0,jn=!Bt&&(u==="scroll"||u==="scrollend"),ke=Bt?Ve!==null?Ve+"Capture":null:Ve;Bt=[];for(var Ee=ze,Fe;Ee!==null;){var rt=Ee;if(Fe=rt.stateNode,rt=rt.tag,rt!==5&&rt!==26&&rt!==27||Fe===null||ke===null||(rt=Om(Ee,ke),rt!=null&&Bt.push(hg(Ee,rt,Fe))),jn)break;Ee=Ee.return}0<Bt.length&&(Ve=new Ke(Ve,Ct,null,b,Je),ot.push({event:Ve,listeners:Bt}))}}if((h&7)===0){e:{if(Ve=u==="mouseover"||u==="pointerover",Ke=u==="mouseout"||u==="pointerout",Ve&&b!==uM&&(Ct=b.relatedTarget||b.fromElement)&&(_t(Ct)||Ct[Zs]))break e;if((Ke||Ve)&&(Ve=Je.window===Je?Je:(Ve=Je.ownerDocument)?Ve.defaultView||Ve.parentWindow:window,Ke?(Ct=b.relatedTarget||b.toElement,Ke=ze,Ct=Ct?_t(Ct):null,Ct!==null&&(jn=a(Ct),Bt=Ct.tag,Ct!==jn||Bt!==5&&Bt!==27&&Bt!==6)&&(Ct=null)):(Ke=null,Ct=ze),Ke!==Ct)){if(Bt=lL,rt="onMouseLeave",ke="onMouseEnter",Ee="mouse",(u==="pointerout"||u==="pointerover")&&(Bt=uL,rt="onPointerLeave",ke="onPointerEnter",Ee="pointer"),jn=Ke==null?Ve:be(Ke),Fe=Ct==null?Ve:be(Ct),Ve=new Bt(rt,Ee+"leave",Ke,b,Je),Ve.target=jn,Ve.relatedTarget=Fe,rt=null,_t(Je)===ze&&(Bt=new Bt(ke,Ee+"enter",Ct,b,Je),Bt.target=Fe,Bt.relatedTarget=jn,rt=Bt),jn=rt,Ke&&Ct)t:{for(Bt=lte,ke=Ke,Ee=Ct,Fe=0,rt=ke;rt;rt=Bt(rt))Fe++;rt=0;for(var Ut=Ee;Ut;Ut=Bt(Ut))rt++;for(;0<Fe-rt;)ke=Bt(ke),Fe--;for(;0<rt-Fe;)Ee=Bt(Ee),rt--;for(;Fe--;){if(ke===Ee||Ee!==null&&ke===Ee.alternate){Bt=ke;break t}ke=Bt(ke),Ee=Bt(Ee)}Bt=null}else Bt=null;Ke!==null&&tU(ot,Ve,Ke,Bt,!1),Ct!==null&&jn!==null&&tU(ot,jn,Ct,Bt,!0)}}e:{if(Ve=ze?be(ze):window,Ke=Ve.nodeName&&Ve.nodeName.toLowerCase(),Ke==="select"||Ke==="input"&&Ve.type==="file")var Sn=vL;else if(gL(Ve))if(yL)Sn=yee;else{Sn=xee;var Pt=gee}else Ke=Ve.nodeName,!Ke||Ke.toLowerCase()!=="input"||Ve.type!=="checkbox"&&Ve.type!=="radio"?ze&&cM(ze.elementType)&&(Sn=vL):Sn=vee;if(Sn&&(Sn=Sn(u,ze))){xL(ot,Sn,b,Je);break e}Pt&&Pt(u,Ve,ze),u==="focusout"&&ze&&Ve.type==="number"&&ze.memoizedProps.value!=null&&mr(Ve,"number",Ve.value)}switch(Pt=ze?be(ze):window,u){case"focusin":(gL(Pt)||Pt.contentEditable==="true")&&(Kf=Pt,wM=ze,Hm=null);break;case"focusout":Hm=wM=Kf=null;break;case"mousedown":MM=!0;break;case"contextmenu":case"mouseup":case"dragend":MM=!1,TL(ot,b,Je);break;case"selectionchange":if(_ee)break;case"keydown":case"keyup":TL(ot,b,Je)}var Jt;if(yM)e:{switch(u){case"compositionstart":var xn="onCompositionStart";break e;case"compositionend":xn="onCompositionEnd";break e;case"compositionupdate":xn="onCompositionUpdate";break e}xn=void 0}else Xf?pL(u,b)&&(xn="onCompositionEnd"):u==="keydown"&&b.keyCode===229&&(xn="onCompositionStart");xn&&(dL&&b.locale!=="ko"&&(Xf||xn!=="onCompositionStart"?xn==="onCompositionEnd"&&Xf&&(Jt=sL()):(Dc=Je,pM="value"in Dc?Dc.value:Dc.textContent,Xf=!0)),Pt=ly(ze,xn),0<Pt.length&&(xn=new cL(xn,u,null,b,Je),ot.push({event:xn,listeners:Pt}),Jt?xn.data=Jt:(Jt=mL(b),Jt!==null&&(xn.data=Jt)))),(Jt=dee?fee(u,b):hee(u,b))&&(xn=ly(ze,"onBeforeInput"),0<xn.length&&(Pt=new cL("onBeforeInput","beforeinput",null,b,Je),ot.push({event:Pt,listeners:xn}),Pt.data=Jt)),rte(ot,u,ze,b,Je)}J4(ot,h)})}function hg(u,h,b){return{instance:u,listener:h,currentTarget:b}}function ly(u,h){for(var b=h+"Capture",S=[];u!==null;){var R=u,k=R.stateNode;if(R=R.tag,R!==5&&R!==26&&R!==27||k===null||(R=Om(u,b),R!=null&&S.unshift(hg(u,R,k)),R=Om(u,h),R!=null&&S.push(hg(u,R,k))),u.tag===3)return S;u=u.return}return[]}function lte(u){if(u===null)return null;do u=u.return;while(u&&u.tag!==5&&u.tag!==27);return u||null}function tU(u,h,b,S,R){for(var k=h._reactName,G=[];b!==null&&b!==S;){var ie=b,_e=ie.alternate,ze=ie.stateNode;if(ie=ie.tag,_e!==null&&_e===S)break;ie!==5&&ie!==26&&ie!==27||ze===null||(_e=ze,R?(ze=Om(b,k),ze!=null&&G.unshift(hg(b,ze,_e))):R||(ze=Om(b,k),ze!=null&&G.push(hg(b,ze,_e)))),b=b.return}G.length!==0&&u.push({event:h,listeners:G})}var cte=/\r\n?/g,ute=/\u0000|\uFFFD/g;function nU(u){return(typeof u=="string"?u:""+u).replace(cte,`
  9. `).replace(ute,"")}function iU(u,h){return h=nU(h),nU(u)===h}function Un(u,h,b,S,R,k){switch(b){case"children":typeof S=="string"?h==="body"||h==="textarea"&&S===""||To(u,S):(typeof S=="number"||typeof S=="bigint")&&h!=="body"&&To(u,""+S);break;case"className":Lt(u,"class",S);break;case"tabIndex":Lt(u,"tabindex",S);break;case"dir":case"role":case"viewBox":case"width":case"height":Lt(u,b,S);break;case"style":iL(u,S,k);break;case"data":if(h!=="object"){Lt(u,"data",S);break}case"src":case"href":if(S===""&&(h!=="a"||b!=="href")){u.removeAttribute(b);break}if(S==null||typeof S=="function"||typeof S=="symbol"||typeof S=="boolean"){u.removeAttribute(b);break}S=pv(""+S),u.setAttribute(b,S);break;case"action":case"formAction":if(typeof S=="function"){u.setAttribute(b,"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 k=="function"&&(b==="formAction"?(h!=="input"&&Un(u,h,"name",R.name,R,null),Un(u,h,"formEncType",R.formEncType,R,null),Un(u,h,"formMethod",R.formMethod,R,null),Un(u,h,"formTarget",R.formTarget,R,null)):(Un(u,h,"encType",R.encType,R,null),Un(u,h,"method",R.method,R,null),Un(u,h,"target",R.target,R,null)));if(S==null||typeof S=="symbol"||typeof S=="boolean"){u.removeAttribute(b);break}S=pv(""+S),u.setAttribute(b,S);break;case"onClick":S!=null&&(u.onclick=cl);break;case"onScroll":S!=null&&hn("scroll",u);break;case"onScrollEnd":S!=null&&hn("scrollend",u);break;case"dangerouslySetInnerHTML":if(S!=null){if(typeof S!="object"||!("__html"in S))throw Error(i(61));if(b=S.__html,b!=null){if(R.children!=null)throw Error(i(60));u.innerHTML=b}}break;case"multiple":u.multiple=S&&typeof S!="function"&&typeof S!="symbol";break;case"muted":u.muted=S&&typeof S!="function"&&typeof S!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(S==null||typeof S=="function"||typeof S=="boolean"||typeof S=="symbol"){u.removeAttribute("xlink:href");break}b=pv(""+S),u.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",b);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":S!=null&&typeof S!="function"&&typeof S!="symbol"?u.setAttribute(b,""+S):u.removeAttribute(b);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":S&&typeof S!="function"&&typeof S!="symbol"?u.setAttribute(b,""):u.removeAttribute(b);break;case"capture":case"download":S===!0?u.setAttribute(b,""):S!==!1&&S!=null&&typeof S!="function"&&typeof S!="symbol"?u.setAttribute(b,S):u.removeAttribute(b);break;case"cols":case"rows":case"size":case"span":S!=null&&typeof S!="function"&&typeof S!="symbol"&&!isNaN(S)&&1<=S?u.setAttribute(b,S):u.removeAttribute(b);break;case"rowSpan":case"start":S==null||typeof S=="function"||typeof S=="symbol"||isNaN(S)?u.removeAttribute(b):u.setAttribute(b,S);break;case"popover":hn("beforetoggle",u),hn("toggle",u),$t(u,"popover",S);break;case"xlinkActuate":en(u,"http://www.w3.org/1999/xlink","xlink:actuate",S);break;case"xlinkArcrole":en(u,"http://www.w3.org/1999/xlink","xlink:arcrole",S);break;case"xlinkRole":en(u,"http://www.w3.org/1999/xlink","xlink:role",S);break;case"xlinkShow":en(u,"http://www.w3.org/1999/xlink","xlink:show",S);break;case"xlinkTitle":en(u,"http://www.w3.org/1999/xlink","xlink:title",S);break;case"xlinkType":en(u,"http://www.w3.org/1999/xlink","xlink:type",S);break;case"xmlBase":en(u,"http://www.w3.org/XML/1998/namespace","xml:base",S);break;case"xmlLang":en(u,"http://www.w3.org/XML/1998/namespace","xml:lang",S);break;case"xmlSpace":en(u,"http://www.w3.org/XML/1998/namespace","xml:space",S);break;case"is":$t(u,"is",S);break;case"innerText":case"textContent":break;default:(!(2<b.length)||b[0]!=="o"&&b[0]!=="O"||b[1]!=="n"&&b[1]!=="N")&&(b=jJ.get(b)||b,$t(u,b,S))}}function KE(u,h,b,S,R,k){switch(b){case"style":iL(u,S,k);break;case"dangerouslySetInnerHTML":if(S!=null){if(typeof S!="object"||!("__html"in S))throw Error(i(61));if(b=S.__html,b!=null){if(R.children!=null)throw Error(i(60));u.innerHTML=b}}break;case"children":typeof S=="string"?To(u,S):(typeof S=="number"||typeof S=="bigint")&&To(u,""+S);break;case"onScroll":S!=null&&hn("scroll",u);break;case"onScrollEnd":S!=null&&hn("scrollend",u);break;case"onClick":S!=null&&(u.onclick=cl);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Qe.hasOwnProperty(b))e:{if(b[0]==="o"&&b[1]==="n"&&(R=b.endsWith("Capture"),h=b.slice(2,R?b.length-7:void 0),k=u[Ai]||null,k=k!=null?k[b]:null,typeof k=="function"&&u.removeEventListener(h,k,R),typeof S=="function")){typeof k!="function"&&k!==null&&(b in u?u[b]=null:u.hasAttribute(b)&&u.removeAttribute(b)),u.addEventListener(h,S,R);break e}b in u?u[b]=S:S===!0?u.setAttribute(b,""):$t(u,b,S)}}}function Or(u,h,b){switch(h){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":hn("error",u),hn("load",u);var S=!1,R=!1,k;for(k in b)if(b.hasOwnProperty(k)){var G=b[k];if(G!=null)switch(k){case"src":S=!0;break;case"srcSet":R=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(i(137,h));default:Un(u,h,k,G,b,null)}}R&&Un(u,h,"srcSet",b.srcSet,b,null),S&&Un(u,h,"src",b.src,b,null);return;case"input":hn("invalid",u);var ie=k=G=R=null,_e=null,ze=null;for(S in b)if(b.hasOwnProperty(S)){var Je=b[S];if(Je!=null)switch(S){case"name":R=Je;break;case"type":G=Je;break;case"checked":_e=Je;break;case"defaultChecked":ze=Je;break;case"value":k=Je;break;case"defaultValue":ie=Je;break;case"children":case"dangerouslySetInnerHTML":if(Je!=null)throw Error(i(137,h));break;default:Un(u,h,S,Je,b,null)}}Pn(u,k,ie,_e,ze,G,R,!1);return;case"select":hn("invalid",u),S=G=k=null;for(R in b)if(b.hasOwnProperty(R)&&(ie=b[R],ie!=null))switch(R){case"value":k=ie;break;case"defaultValue":G=ie;break;case"multiple":S=ie;default:Un(u,h,R,ie,b,null)}h=k,b=G,u.multiple=!!S,h!=null?Qi(u,!!S,h,!1):b!=null&&Qi(u,!!S,b,!0);return;case"textarea":hn("invalid",u),k=R=S=null;for(G in b)if(b.hasOwnProperty(G)&&(ie=b[G],ie!=null))switch(G){case"value":S=ie;break;case"defaultValue":R=ie;break;case"children":k=ie;break;case"dangerouslySetInnerHTML":if(ie!=null)throw Error(i(91));break;default:Un(u,h,G,ie,b,null)}Rr(u,S,R,k);return;case"option":for(_e in b)if(b.hasOwnProperty(_e)&&(S=b[_e],S!=null))switch(_e){case"selected":u.selected=S&&typeof S!="function"&&typeof S!="symbol";break;default:Un(u,h,_e,S,b,null)}return;case"dialog":hn("beforetoggle",u),hn("toggle",u),hn("cancel",u),hn("close",u);break;case"iframe":case"object":hn("load",u);break;case"video":case"audio":for(S=0;S<fg.length;S++)hn(fg[S],u);break;case"image":hn("error",u),hn("load",u);break;case"details":hn("toggle",u);break;case"embed":case"source":case"link":hn("error",u),hn("load",u);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 b)if(b.hasOwnProperty(ze)&&(S=b[ze],S!=null))switch(ze){case"children":case"dangerouslySetInnerHTML":throw Error(i(137,h));default:Un(u,h,ze,S,b,null)}return;default:if(cM(h)){for(Je in b)b.hasOwnProperty(Je)&&(S=b[Je],S!==void 0&&KE(u,h,Je,S,b,void 0));return}}for(ie in b)b.hasOwnProperty(ie)&&(S=b[ie],S!=null&&Un(u,h,ie,S,b,null))}function dte(u,h,b,S){switch(h){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var R=null,k=null,G=null,ie=null,_e=null,ze=null,Je=null;for(Ke in b){var ot=b[Ke];if(b.hasOwnProperty(Ke)&&ot!=null)switch(Ke){case"checked":break;case"value":break;case"defaultValue":_e=ot;default:S.hasOwnProperty(Ke)||Un(u,h,Ke,null,S,ot)}}for(var Ve in S){var Ke=S[Ve];if(ot=b[Ve],S.hasOwnProperty(Ve)&&(Ke!=null||ot!=null))switch(Ve){case"type":k=Ke;break;case"name":R=Ke;break;case"checked":ze=Ke;break;case"defaultChecked":Je=Ke;break;case"value":G=Ke;break;case"defaultValue":ie=Ke;break;case"children":case"dangerouslySetInnerHTML":if(Ke!=null)throw Error(i(137,h));break;default:Ke!==ot&&Un(u,h,Ve,Ke,S,ot)}}Qs(u,G,ie,_e,ze,Je,k,R);return;case"select":Ke=G=ie=Ve=null;for(k in b)if(_e=b[k],b.hasOwnProperty(k)&&_e!=null)switch(k){case"value":break;case"multiple":Ke=_e;default:S.hasOwnProperty(k)||Un(u,h,k,null,S,_e)}for(R in S)if(k=S[R],_e=b[R],S.hasOwnProperty(R)&&(k!=null||_e!=null))switch(R){case"value":Ve=k;break;case"defaultValue":ie=k;break;case"multiple":G=k;default:k!==_e&&Un(u,h,R,k,S,_e)}h=ie,b=G,S=Ke,Ve!=null?Qi(u,!!b,Ve,!1):!!S!=!!b&&(h!=null?Qi(u,!!b,h,!0):Qi(u,!!b,b?[]:"",!1));return;case"textarea":Ke=Ve=null;for(ie in b)if(R=b[ie],b.hasOwnProperty(ie)&&R!=null&&!S.hasOwnProperty(ie))switch(ie){case"value":break;case"children":break;default:Un(u,h,ie,null,S,R)}for(G in S)if(R=S[G],k=b[G],S.hasOwnProperty(G)&&(R!=null||k!=null))switch(G){case"value":Ve=R;break;case"defaultValue":Ke=R;break;case"children":break;case"dangerouslySetInnerHTML":if(R!=null)throw Error(i(91));break;default:R!==k&&Un(u,h,G,R,S,k)}gr(u,Ve,Ke);return;case"option":for(var Ct in b)if(Ve=b[Ct],b.hasOwnProperty(Ct)&&Ve!=null&&!S.hasOwnProperty(Ct))switch(Ct){case"selected":u.selected=!1;break;default:Un(u,h,Ct,null,S,Ve)}for(_e in S)if(Ve=S[_e],Ke=b[_e],S.hasOwnProperty(_e)&&Ve!==Ke&&(Ve!=null||Ke!=null))switch(_e){case"selected":u.selected=Ve&&typeof Ve!="function"&&typeof Ve!="symbol";break;default:Un(u,h,_e,Ve,S,Ke)}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 Bt in b)Ve=b[Bt],b.hasOwnProperty(Bt)&&Ve!=null&&!S.hasOwnProperty(Bt)&&Un(u,h,Bt,null,S,Ve);for(ze in S)if(Ve=S[ze],Ke=b[ze],S.hasOwnProperty(ze)&&Ve!==Ke&&(Ve!=null||Ke!=null))switch(ze){case"children":case"dangerouslySetInnerHTML":if(Ve!=null)throw Error(i(137,h));break;default:Un(u,h,ze,Ve,S,Ke)}return;default:if(cM(h)){for(var jn in b)Ve=b[jn],b.hasOwnProperty(jn)&&Ve!==void 0&&!S.hasOwnProperty(jn)&&KE(u,h,jn,void 0,S,Ve);for(Je in S)Ve=S[Je],Ke=b[Je],!S.hasOwnProperty(Je)||Ve===Ke||Ve===void 0&&Ke===void 0||KE(u,h,Je,Ve,S,Ke);return}}for(var ke in b)Ve=b[ke],b.hasOwnProperty(ke)&&Ve!=null&&!S.hasOwnProperty(ke)&&Un(u,h,ke,null,S,Ve);for(ot in S)Ve=S[ot],Ke=b[ot],!S.hasOwnProperty(ot)||Ve===Ke||Ve==null&&Ke==null||Un(u,h,ot,Ve,S,Ke)}function rU(u){switch(u){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function fte(){if(typeof performance.getEntriesByType=="function"){for(var u=0,h=0,b=performance.getEntriesByType("resource"),S=0;S<b.length;S++){var R=b[S],k=R.transferSize,G=R.initiatorType,ie=R.duration;if(k&&ie&&rU(G)){for(G=0,ie=R.responseEnd,S+=1;S<b.length;S++){var _e=b[S],ze=_e.startTime;if(ze>ie)break;var Je=_e.transferSize,ot=_e.initiatorType;Je&&rU(ot)&&(_e=_e.responseEnd,G+=Je*(_e<ie?1:(ie-ze)/(_e-ze)))}if(--S,h+=8*(k+G)/(R.duration/1e3),u++,10<u)break}}if(0<u)return h/u/1e6}return navigator.connection&&(u=navigator.connection.downlink,typeof u=="number")?u:5}var YE=null,ZE=null;function cy(u){return u.nodeType===9?u:u.ownerDocument}function aU(u){switch(u){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function sU(u,h){if(u===0)switch(h){case"svg":return 1;case"math":return 2;default:return 0}return u===1&&h==="foreignObject"?0:u}function QE(u,h){return u==="textarea"||u==="noscript"||typeof h.children=="string"||typeof h.children=="number"||typeof h.children=="bigint"||typeof h.dangerouslySetInnerHTML=="object"&&h.dangerouslySetInnerHTML!==null&&h.dangerouslySetInnerHTML.__html!=null}var JE=null;function hte(){var u=window.event;return u&&u.type==="popstate"?u===JE?!1:(JE=u,!0):(JE=null,!1)}var oU=typeof setTimeout=="function"?setTimeout:void 0,pte=typeof clearTimeout=="function"?clearTimeout:void 0,lU=typeof Promise=="function"?Promise:void 0,mte=typeof queueMicrotask=="function"?queueMicrotask:typeof lU<"u"?function(u){return lU.resolve(null).then(u).catch(gte)}:oU;function gte(u){setTimeout(function(){throw u})}function Kc(u){return u==="head"}function cU(u,h){var b=h,S=0;do{var R=b.nextSibling;if(u.removeChild(b),R&&R.nodeType===8)if(b=R.data,b==="/$"||b==="/&"){if(S===0){u.removeChild(R),Sh(h);return}S--}else if(b==="$"||b==="$?"||b==="$~"||b==="$!"||b==="&")S++;else if(b==="html")pg(u.ownerDocument.documentElement);else if(b==="head"){b=u.ownerDocument.head,pg(b);for(var k=b.firstChild;k;){var G=k.nextSibling,ie=k.nodeName;k[Xe]||ie==="SCRIPT"||ie==="STYLE"||ie==="LINK"&&k.rel.toLowerCase()==="stylesheet"||b.removeChild(k),k=G}}else b==="body"&&pg(u.ownerDocument.body);b=R}while(b);Sh(h)}function uU(u,h){var b=u;u=0;do{var S=b.nextSibling;if(b.nodeType===1?h?(b._stashedDisplay=b.style.display,b.style.display="none"):(b.style.display=b._stashedDisplay||"",b.getAttribute("style")===""&&b.removeAttribute("style")):b.nodeType===3&&(h?(b._stashedText=b.nodeValue,b.nodeValue=""):b.nodeValue=b._stashedText||""),S&&S.nodeType===8)if(b=S.data,b==="/$"){if(u===0)break;u--}else b!=="$"&&b!=="$?"&&b!=="$~"&&b!=="$!"||u++;b=S}while(b)}function eA(u){var h=u.firstChild;for(h&&h.nodeType===10&&(h=h.nextSibling);h;){var b=h;switch(h=h.nextSibling,b.nodeName){case"HTML":case"HEAD":case"BODY":eA(b),Ge(b);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(b.rel.toLowerCase()==="stylesheet")continue}u.removeChild(b)}}function xte(u,h,b,S){for(;u.nodeType===1;){var R=b;if(u.nodeName.toLowerCase()!==h.toLowerCase()){if(!S&&(u.nodeName!=="INPUT"||u.type!=="hidden"))break}else if(S){if(!u[Xe])switch(h){case"meta":if(!u.hasAttribute("itemprop"))break;return u;case"link":if(k=u.getAttribute("rel"),k==="stylesheet"&&u.hasAttribute("data-precedence"))break;if(k!==R.rel||u.getAttribute("href")!==(R.href==null||R.href===""?null:R.href)||u.getAttribute("crossorigin")!==(R.crossOrigin==null?null:R.crossOrigin)||u.getAttribute("title")!==(R.title==null?null:R.title))break;return u;case"style":if(u.hasAttribute("data-precedence"))break;return u;case"script":if(k=u.getAttribute("src"),(k!==(R.src==null?null:R.src)||u.getAttribute("type")!==(R.type==null?null:R.type)||u.getAttribute("crossorigin")!==(R.crossOrigin==null?null:R.crossOrigin))&&k&&u.hasAttribute("async")&&!u.hasAttribute("itemprop"))break;return u;default:return u}}else if(h==="input"&&u.type==="hidden"){var k=R.name==null?null:""+R.name;if(R.type==="hidden"&&u.getAttribute("name")===k)return u}else return u;if(u=_s(u.nextSibling),u===null)break}return null}function vte(u,h,b){if(h==="")return null;for(;u.nodeType!==3;)if((u.nodeType!==1||u.nodeName!=="INPUT"||u.type!=="hidden")&&!b||(u=_s(u.nextSibling),u===null))return null;return u}function dU(u,h){for(;u.nodeType!==8;)if((u.nodeType!==1||u.nodeName!=="INPUT"||u.type!=="hidden")&&!h||(u=_s(u.nextSibling),u===null))return null;return u}function tA(u){return u.data==="$?"||u.data==="$~"}function nA(u){return u.data==="$!"||u.data==="$?"&&u.ownerDocument.readyState!=="loading"}function yte(u,h){var b=u.ownerDocument;if(u.data==="$~")u._reactRetry=h;else if(u.data!=="$?"||b.readyState!=="loading")h();else{var S=function(){h(),b.removeEventListener("DOMContentLoaded",S)};b.addEventListener("DOMContentLoaded",S),u._reactRetry=S}}function _s(u){for(;u!=null;u=u.nextSibling){var h=u.nodeType;if(h===1||h===3)break;if(h===8){if(h=u.data,h==="$"||h==="$!"||h==="$?"||h==="$~"||h==="&"||h==="F!"||h==="F")break;if(h==="/$"||h==="/&")return null}}return u}var iA=null;function fU(u){u=u.nextSibling;for(var h=0;u;){if(u.nodeType===8){var b=u.data;if(b==="/$"||b==="/&"){if(h===0)return _s(u.nextSibling);h--}else b!=="$"&&b!=="$!"&&b!=="$?"&&b!=="$~"&&b!=="&"||h++}u=u.nextSibling}return null}function hU(u){u=u.previousSibling;for(var h=0;u;){if(u.nodeType===8){var b=u.data;if(b==="$"||b==="$!"||b==="$?"||b==="$~"||b==="&"){if(h===0)return u;h--}else b!=="/$"&&b!=="/&"||h++}u=u.previousSibling}return null}function pU(u,h,b){switch(h=cy(b),u){case"html":if(u=h.documentElement,!u)throw Error(i(452));return u;case"head":if(u=h.head,!u)throw Error(i(453));return u;case"body":if(u=h.body,!u)throw Error(i(454));return u;default:throw Error(i(451))}}function pg(u){for(var h=u.attributes;h.length;)u.removeAttributeNode(h[0]);Ge(u)}var Ss=new Map,mU=new Set;function uy(u){return typeof u.getRootNode=="function"?u.getRootNode():u.nodeType===9?u:u.ownerDocument}var El=$.d;$.d={f:bte,r:_te,D:Ste,C:wte,L:Mte,m:Ete,X:Tte,S:Ate,M:Cte};function bte(){var u=El.f(),h=ty();return u||h}function _te(u){var h=Q(u);h!==null&&h.tag===5&&h.type==="form"?DI(h):El.r(u)}var yh=typeof document>"u"?null:document;function gU(u,h,b){var S=yh;if(S&&typeof h=="string"&&h){var R=Nn(h);R='link[rel="'+u+'"][href="'+R+'"]',typeof b=="string"&&(R+='[crossorigin="'+b+'"]'),mU.has(R)||(mU.add(R),u={rel:u,crossOrigin:b,href:h},S.querySelector(R)===null&&(h=S.createElement("link"),Or(h,"link",u),Te(h),S.head.appendChild(h)))}}function Ste(u){El.D(u),gU("dns-prefetch",u,null)}function wte(u,h){El.C(u,h),gU("preconnect",u,h)}function Mte(u,h,b){El.L(u,h,b);var S=yh;if(S&&u&&h){var R='link[rel="preload"][as="'+Nn(h)+'"]';h==="image"&&b&&b.imageSrcSet?(R+='[imagesrcset="'+Nn(b.imageSrcSet)+'"]',typeof b.imageSizes=="string"&&(R+='[imagesizes="'+Nn(b.imageSizes)+'"]')):R+='[href="'+Nn(u)+'"]';var k=R;switch(h){case"style":k=bh(u);break;case"script":k=_h(u)}Ss.has(k)||(u=f({rel:"preload",href:h==="image"&&b&&b.imageSrcSet?void 0:u,as:h},b),Ss.set(k,u),S.querySelector(R)!==null||h==="style"&&S.querySelector(mg(k))||h==="script"&&S.querySelector(gg(k))||(h=S.createElement("link"),Or(h,"link",u),Te(h),S.head.appendChild(h)))}}function Ete(u,h){El.m(u,h);var b=yh;if(b&&u){var S=h&&typeof h.as=="string"?h.as:"script",R='link[rel="modulepreload"][as="'+Nn(S)+'"][href="'+Nn(u)+'"]',k=R;switch(S){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":k=_h(u)}if(!Ss.has(k)&&(u=f({rel:"modulepreload",href:u},h),Ss.set(k,u),b.querySelector(R)===null)){switch(S){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(b.querySelector(gg(k)))return}S=b.createElement("link"),Or(S,"link",u),Te(S),b.head.appendChild(S)}}}function Ate(u,h,b){El.S(u,h,b);var S=yh;if(S&&u){var R=Ce(S).hoistableStyles,k=bh(u);h=h||"default";var G=R.get(k);if(!G){var ie={loading:0,preload:null};if(G=S.querySelector(mg(k)))ie.loading=5;else{u=f({rel:"stylesheet",href:u,"data-precedence":h},b),(b=Ss.get(k))&&rA(u,b);var _e=G=S.createElement("link");Te(_e),Or(_e,"link",u),_e._p=new Promise(function(ze,Je){_e.onload=ze,_e.onerror=Je}),_e.addEventListener("load",function(){ie.loading|=1}),_e.addEventListener("error",function(){ie.loading|=2}),ie.loading|=4,dy(G,h,S)}G={type:"stylesheet",instance:G,count:1,state:ie},R.set(k,G)}}}function Tte(u,h){El.X(u,h);var b=yh;if(b&&u){var S=Ce(b).hoistableScripts,R=_h(u),k=S.get(R);k||(k=b.querySelector(gg(R)),k||(u=f({src:u,async:!0},h),(h=Ss.get(R))&&aA(u,h),k=b.createElement("script"),Te(k),Or(k,"link",u),b.head.appendChild(k)),k={type:"script",instance:k,count:1,state:null},S.set(R,k))}}function Cte(u,h){El.M(u,h);var b=yh;if(b&&u){var S=Ce(b).hoistableScripts,R=_h(u),k=S.get(R);k||(k=b.querySelector(gg(R)),k||(u=f({src:u,async:!0,type:"module"},h),(h=Ss.get(R))&&aA(u,h),k=b.createElement("script"),Te(k),Or(k,"link",u),b.head.appendChild(k)),k={type:"script",instance:k,count:1,state:null},S.set(R,k))}}function xU(u,h,b,S){var R=(R=ne.current)?uy(R):null;if(!R)throw Error(i(446));switch(u){case"meta":case"title":return null;case"style":return typeof b.precedence=="string"&&typeof b.href=="string"?(h=bh(b.href),b=Ce(R).hoistableStyles,S=b.get(h),S||(S={type:"style",instance:null,count:0,state:null},b.set(h,S)),S):{type:"void",instance:null,count:0,state:null};case"link":if(b.rel==="stylesheet"&&typeof b.href=="string"&&typeof b.precedence=="string"){u=bh(b.href);var k=Ce(R).hoistableStyles,G=k.get(u);if(G||(R=R.ownerDocument||R,G={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},k.set(u,G),(k=R.querySelector(mg(u)))&&!k._p&&(G.instance=k,G.state.loading=5),Ss.has(u)||(b={rel:"preload",as:"style",href:b.href,crossOrigin:b.crossOrigin,integrity:b.integrity,media:b.media,hrefLang:b.hrefLang,referrerPolicy:b.referrerPolicy},Ss.set(u,b),k||Nte(R,u,b,G.state))),h&&S===null)throw Error(i(528,""));return G}if(h&&S!==null)throw Error(i(529,""));return null;case"script":return h=b.async,b=b.src,typeof b=="string"&&h&&typeof h!="function"&&typeof h!="symbol"?(h=_h(b),b=Ce(R).hoistableScripts,S=b.get(h),S||(S={type:"script",instance:null,count:0,state:null},b.set(h,S)),S):{type:"void",instance:null,count:0,state:null};default:throw Error(i(444,u))}}function bh(u){return'href="'+Nn(u)+'"'}function mg(u){return'link[rel="stylesheet"]['+u+"]"}function vU(u){return f({},u,{"data-precedence":u.precedence,precedence:null})}function Nte(u,h,b,S){u.querySelector('link[rel="preload"][as="style"]['+h+"]")?S.loading=1:(h=u.createElement("link"),S.preload=h,h.addEventListener("load",function(){return S.loading|=1}),h.addEventListener("error",function(){return S.loading|=2}),Or(h,"link",b),Te(h),u.head.appendChild(h))}function _h(u){return'[src="'+Nn(u)+'"]'}function gg(u){return"script[async]"+u}function yU(u,h,b){if(h.count++,h.instance===null)switch(h.type){case"style":var S=u.querySelector('style[data-href~="'+Nn(b.href)+'"]');if(S)return h.instance=S,Te(S),S;var R=f({},b,{"data-href":b.href,"data-precedence":b.precedence,href:null,precedence:null});return S=(u.ownerDocument||u).createElement("style"),Te(S),Or(S,"style",R),dy(S,b.precedence,u),h.instance=S;case"stylesheet":R=bh(b.href);var k=u.querySelector(mg(R));if(k)return h.state.loading|=4,h.instance=k,Te(k),k;S=vU(b),(R=Ss.get(R))&&rA(S,R),k=(u.ownerDocument||u).createElement("link"),Te(k);var G=k;return G._p=new Promise(function(ie,_e){G.onload=ie,G.onerror=_e}),Or(k,"link",S),h.state.loading|=4,dy(k,b.precedence,u),h.instance=k;case"script":return k=_h(b.src),(R=u.querySelector(gg(k)))?(h.instance=R,Te(R),R):(S=b,(R=Ss.get(k))&&(S=f({},b),aA(S,R)),u=u.ownerDocument||u,R=u.createElement("script"),Te(R),Or(R,"link",S),u.head.appendChild(R),h.instance=R);case"void":return null;default:throw Error(i(443,h.type))}else h.type==="stylesheet"&&(h.state.loading&4)===0&&(S=h.instance,h.state.loading|=4,dy(S,b.precedence,u));return h.instance}function dy(u,h,b){for(var S=b.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),R=S.length?S[S.length-1]:null,k=R,G=0;G<S.length;G++){var ie=S[G];if(ie.dataset.precedence===h)k=ie;else if(k!==R)break}k?k.parentNode.insertBefore(u,k.nextSibling):(h=b.nodeType===9?b.head:b,h.insertBefore(u,h.firstChild))}function rA(u,h){u.crossOrigin==null&&(u.crossOrigin=h.crossOrigin),u.referrerPolicy==null&&(u.referrerPolicy=h.referrerPolicy),u.title==null&&(u.title=h.title)}function aA(u,h){u.crossOrigin==null&&(u.crossOrigin=h.crossOrigin),u.referrerPolicy==null&&(u.referrerPolicy=h.referrerPolicy),u.integrity==null&&(u.integrity=h.integrity)}var fy=null;function bU(u,h,b){if(fy===null){var S=new Map,R=fy=new Map;R.set(b,S)}else R=fy,S=R.get(b),S||(S=new Map,R.set(b,S));if(S.has(u))return S;for(S.set(u,null),b=b.getElementsByTagName(u),R=0;R<b.length;R++){var k=b[R];if(!(k[Xe]||k[hi]||u==="link"&&k.getAttribute("rel")==="stylesheet")&&k.namespaceURI!=="http://www.w3.org/2000/svg"){var G=k.getAttribute(h)||"";G=u+G;var ie=S.get(G);ie?ie.push(k):S.set(G,[k])}}return S}function _U(u,h,b){u=u.ownerDocument||u,u.head.insertBefore(b,h==="title"?u.querySelector("head > title"):null)}function Rte(u,h,b){if(b===1||h.itemProp!=null)return!1;switch(u){case"meta":case"title":return!0;case"style":if(typeof h.precedence!="string"||typeof h.href!="string"||h.href==="")break;return!0;case"link":if(typeof h.rel!="string"||typeof h.href!="string"||h.href===""||h.onLoad||h.onError)break;switch(h.rel){case"stylesheet":return u=h.disabled,typeof h.precedence=="string"&&u==null;default:return!0}case"script":if(h.async&&typeof h.async!="function"&&typeof h.async!="symbol"&&!h.onLoad&&!h.onError&&h.src&&typeof h.src=="string")return!0}return!1}function SU(u){return!(u.type==="stylesheet"&&(u.state.loading&3)===0)}function Pte(u,h,b,S){if(b.type==="stylesheet"&&(typeof S.media!="string"||matchMedia(S.media).matches!==!1)&&(b.state.loading&4)===0){if(b.instance===null){var R=bh(S.href),k=h.querySelector(mg(R));if(k){h=k._p,h!==null&&typeof h=="object"&&typeof h.then=="function"&&(u.count++,u=hy.bind(u),h.then(u,u)),b.state.loading|=4,b.instance=k,Te(k);return}k=h.ownerDocument||h,S=vU(S),(R=Ss.get(R))&&rA(S,R),k=k.createElement("link"),Te(k);var G=k;G._p=new Promise(function(ie,_e){G.onload=ie,G.onerror=_e}),Or(k,"link",S),b.instance=k}u.stylesheets===null&&(u.stylesheets=new Map),u.stylesheets.set(b,h),(h=b.state.preload)&&(b.state.loading&3)===0&&(u.count++,b=hy.bind(u),h.addEventListener("load",b),h.addEventListener("error",b))}}var sA=0;function Dte(u,h){return u.stylesheets&&u.count===0&&my(u,u.stylesheets),0<u.count||0<u.imgCount?function(b){var S=setTimeout(function(){if(u.stylesheets&&my(u,u.stylesheets),u.unsuspend){var k=u.unsuspend;u.unsuspend=null,k()}},6e4+h);0<u.imgBytes&&sA===0&&(sA=62500*fte());var R=setTimeout(function(){if(u.waitingForImages=!1,u.count===0&&(u.stylesheets&&my(u,u.stylesheets),u.unsuspend)){var k=u.unsuspend;u.unsuspend=null,k()}},(u.imgBytes>sA?50:800)+h);return u.unsuspend=b,function(){u.unsuspend=null,clearTimeout(S),clearTimeout(R)}}:null}function hy(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)my(this,this.stylesheets);else if(this.unsuspend){var u=this.unsuspend;this.unsuspend=null,u()}}}var py=null;function my(u,h){u.stylesheets=null,u.unsuspend!==null&&(u.count++,py=new Map,h.forEach(kte,u),py=null,hy.call(u))}function kte(u,h){if(!(h.state.loading&4)){var b=py.get(u);if(b)var S=b.get(null);else{b=new Map,py.set(u,b);for(var R=u.querySelectorAll("link[data-precedence],style[data-precedence]"),k=0;k<R.length;k++){var G=R[k];(G.nodeName==="LINK"||G.getAttribute("media")!=="not all")&&(b.set(G.dataset.precedence,G),S=G)}S&&b.set(null,S)}R=h.instance,G=R.getAttribute("data-precedence"),k=b.get(G)||S,k===S&&b.set(null,R),b.set(G,R),this.count++,S=hy.bind(this),R.addEventListener("load",S),R.addEventListener("error",S),k?k.parentNode.insertBefore(R,k.nextSibling):(u=u.nodeType===9?u.head:u,u.insertBefore(R,u.firstChild)),h.state.loading|=4}}var xg={$$typeof:w,Provider:null,Consumer:null,_currentValue:K,_currentValue2:K,_threadCount:0};function Ote(u,h,b,S,R,k,G,ie,_e){this.tag=1,this.containerInfo=u,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=Nt(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Nt(0),this.hiddenUpdates=Nt(null),this.identifierPrefix=S,this.onUncaughtError=R,this.onCaughtError=k,this.onRecoverableError=G,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=_e,this.incompleteTransitions=new Map}function wU(u,h,b,S,R,k,G,ie,_e,ze,Je,ot){return u=new Ote(u,h,b,G,_e,ze,Je,ot,ie),h=1,k===!0&&(h|=24),k=Wa(3,null,null,h),u.current=k,k.stateNode=u,h=FM(),h.refCount++,u.pooledCache=h,h.refCount++,k.memoizedState={element:S,isDehydrated:b,cache:h},VM(k),u}function MU(u){return u?(u=Qf,u):Qf}function EU(u,h,b,S,R,k){R=MU(R),S.context===null?S.context=R:S.pendingContext=R,S=jc(h),S.payload={element:b},k=k===void 0?null:k,k!==null&&(S.callback=k),b=Fc(u,S,h),b!==null&&(Na(b,u,h),Km(b,u,h))}function AU(u,h){if(u=u.memoizedState,u!==null&&u.dehydrated!==null){var b=u.retryLane;u.retryLane=b!==0&&b<h?b:h}}function oA(u,h){AU(u,h),(u=u.alternate)&&AU(u,h)}function TU(u){if(u.tag===13||u.tag===31){var h=pd(u,67108864);h!==null&&Na(h,u,67108864),oA(u,67108864)}}function CU(u){if(u.tag===13||u.tag===31){var h=Za();h=Zi(h);var b=pd(u,h);b!==null&&Na(b,u,h),oA(u,h)}}var gy=!0;function Lte(u,h,b,S){var R=H.T;H.T=null;var k=$.p;try{$.p=2,lA(u,h,b,S)}finally{$.p=k,H.T=R}}function Ite(u,h,b,S){var R=H.T;H.T=null;var k=$.p;try{$.p=8,lA(u,h,b,S)}finally{$.p=k,H.T=R}}function lA(u,h,b,S){if(gy){var R=cA(S);if(R===null)XE(u,h,S,xy,b),RU(u,S);else if(jte(R,u,h,b,S))S.stopPropagation();else if(RU(u,S),h&4&&-1<Ute.indexOf(u)){for(;R!==null;){var k=Q(R);if(k!==null)switch(k.tag){case 3:if(k=k.stateNode,k.current.memoizedState.isDehydrated){var G=Me(k.pendingLanes);if(G!==0){var ie=k;for(ie.pendingLanes|=2,ie.entangledLanes|=2;G;){var _e=1<<31-nt(G);ie.entanglements[1]|=_e,G&=~_e}Po(k),(Tn&6)===0&&(Jv=L()+500,dg(0))}}break;case 31:case 13:ie=pd(k,2),ie!==null&&Na(ie,k,2),ty(),oA(k,2)}if(k=cA(S),k===null&&XE(u,h,S,xy,b),k===R)break;R=k}R!==null&&S.stopPropagation()}else XE(u,h,S,null,b)}}function cA(u){return u=dM(u),uA(u)}var xy=null;function uA(u){if(xy=null,u=_t(u),u!==null){var h=a(u);if(h===null)u=null;else{var b=h.tag;if(b===13){if(u=s(h),u!==null)return u;u=null}else if(b===31){if(u=o(h),u!==null)return u;u=null}else if(b===3){if(h.stateNode.current.memoizedState.isDehydrated)return h.tag===3?h.stateNode.containerInfo:null;u=null}else h!==u&&(u=null)}}return xy=u,null}function NU(u){switch(u){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(Y()){case me:return 2;case ye:return 8;case pe:case Ze:return 32;case Le:return 268435456;default:return 32}default:return 32}}var dA=!1,Yc=null,Zc=null,Qc=null,vg=new Map,yg=new Map,Jc=[],Ute="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 RU(u,h){switch(u){case"focusin":case"focusout":Yc=null;break;case"dragenter":case"dragleave":Zc=null;break;case"mouseover":case"mouseout":Qc=null;break;case"pointerover":case"pointerout":vg.delete(h.pointerId);break;case"gotpointercapture":case"lostpointercapture":yg.delete(h.pointerId)}}function bg(u,h,b,S,R,k){return u===null||u.nativeEvent!==k?(u={blockedOn:h,domEventName:b,eventSystemFlags:S,nativeEvent:k,targetContainers:[R]},h!==null&&(h=Q(h),h!==null&&TU(h)),u):(u.eventSystemFlags|=S,h=u.targetContainers,R!==null&&h.indexOf(R)===-1&&h.push(R),u)}function jte(u,h,b,S,R){switch(h){case"focusin":return Yc=bg(Yc,u,h,b,S,R),!0;case"dragenter":return Zc=bg(Zc,u,h,b,S,R),!0;case"mouseover":return Qc=bg(Qc,u,h,b,S,R),!0;case"pointerover":var k=R.pointerId;return vg.set(k,bg(vg.get(k)||null,u,h,b,S,R)),!0;case"gotpointercapture":return k=R.pointerId,yg.set(k,bg(yg.get(k)||null,u,h,b,S,R)),!0}return!1}function PU(u){var h=_t(u.target);if(h!==null){var b=a(h);if(b!==null){if(h=b.tag,h===13){if(h=s(b),h!==null){u.blockedOn=h,Gr(u.priority,function(){CU(b)});return}}else if(h===31){if(h=o(b),h!==null){u.blockedOn=h,Gr(u.priority,function(){CU(b)});return}}else if(h===3&&b.stateNode.current.memoizedState.isDehydrated){u.blockedOn=b.tag===3?b.stateNode.containerInfo:null;return}}}u.blockedOn=null}function vy(u){if(u.blockedOn!==null)return!1;for(var h=u.targetContainers;0<h.length;){var b=cA(u.nativeEvent);if(b===null){b=u.nativeEvent;var S=new b.constructor(b.type,b);uM=S,b.target.dispatchEvent(S),uM=null}else return h=Q(b),h!==null&&TU(h),u.blockedOn=b,!1;h.shift()}return!0}function DU(u,h,b){vy(u)&&b.delete(h)}function Fte(){dA=!1,Yc!==null&&vy(Yc)&&(Yc=null),Zc!==null&&vy(Zc)&&(Zc=null),Qc!==null&&vy(Qc)&&(Qc=null),vg.forEach(DU),yg.forEach(DU)}function yy(u,h){u.blockedOn===h&&(u.blockedOn=null,dA||(dA=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,Fte)))}var by=null;function kU(u){by!==u&&(by=u,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){by===u&&(by=null);for(var h=0;h<u.length;h+=3){var b=u[h],S=u[h+1],R=u[h+2];if(typeof S!="function"){if(uA(S||b)===null)continue;break}var k=Q(b);k!==null&&(u.splice(h,3),h-=3,cE(k,{pending:!0,data:R,method:b.method,action:S},S,R))}}))}function Sh(u){function h(_e){return yy(_e,u)}Yc!==null&&yy(Yc,u),Zc!==null&&yy(Zc,u),Qc!==null&&yy(Qc,u),vg.forEach(h),yg.forEach(h);for(var b=0;b<Jc.length;b++){var S=Jc[b];S.blockedOn===u&&(S.blockedOn=null)}for(;0<Jc.length&&(b=Jc[0],b.blockedOn===null);)PU(b),b.blockedOn===null&&Jc.shift();if(b=(u.ownerDocument||u).$$reactFormReplay,b!=null)for(S=0;S<b.length;S+=3){var R=b[S],k=b[S+1],G=R[Ai]||null;if(typeof k=="function")G||kU(b);else if(G){var ie=null;if(k&&k.hasAttribute("formAction")){if(R=k,G=k[Ai]||null)ie=G.formAction;else if(uA(R)!==null)continue}else ie=G.action;typeof ie=="function"?b[S+1]=ie:(b.splice(S,3),S-=3),kU(b)}}}function OU(){function u(k){k.canIntercept&&k.info==="react-transition"&&k.intercept({handler:function(){return new Promise(function(G){return R=G})},focusReset:"manual",scroll:"manual"})}function h(){R!==null&&(R(),R=null),S||setTimeout(b,20)}function b(){if(!S&&!navigation.transition){var k=navigation.currentEntry;k&&k.url!=null&&navigation.navigate(k.url,{state:k.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var S=!1,R=null;return navigation.addEventListener("navigate",u),navigation.addEventListener("navigatesuccess",h),navigation.addEventListener("navigateerror",h),setTimeout(b,100),function(){S=!0,navigation.removeEventListener("navigate",u),navigation.removeEventListener("navigatesuccess",h),navigation.removeEventListener("navigateerror",h),R!==null&&(R(),R=null)}}}function fA(u){this._internalRoot=u}_y.prototype.render=fA.prototype.render=function(u){var h=this._internalRoot;if(h===null)throw Error(i(409));var b=h.current,S=Za();EU(b,S,u,h,null,null)},_y.prototype.unmount=fA.prototype.unmount=function(){var u=this._internalRoot;if(u!==null){this._internalRoot=null;var h=u.containerInfo;EU(u.current,2,null,u,null,null),ty(),h[Zs]=null}};function _y(u){this._internalRoot=u}_y.prototype.unstable_scheduleHydration=function(u){if(u){var h=Nr();u={blockedOn:null,target:u,priority:h};for(var b=0;b<Jc.length&&h!==0&&h<Jc[b].priority;b++);Jc.splice(b,0,u),b===0&&PU(u)}};var LU=e.version;if(LU!=="19.2.0")throw Error(i(527,LU,"19.2.0"));$.findDOMNode=function(u){var h=u._reactInternals;if(h===void 0)throw typeof u.render=="function"?Error(i(188)):(u=Object.keys(u).join(","),Error(i(268,u)));return u=c(h),u=u!==null?d(u):null,u=u===null?null:u.stateNode,u};var zte={bundleType:0,version:"19.2.0",rendererPackageName:"react-dom",currentDispatcherRef:H,reconcilerVersion:"19.2.0"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Sy=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Sy.isDisabled&&Sy.supportsFiber)try{Ie=Sy.inject(zte),Re=Sy}catch{}}return Sg.createRoot=function(u,h){if(!r(u))throw Error(i(299));var b=!1,S="",R=HI,k=VI,G=$I;return h!=null&&(h.unstable_strictMode===!0&&(b=!0),h.identifierPrefix!==void 0&&(S=h.identifierPrefix),h.onUncaughtError!==void 0&&(R=h.onUncaughtError),h.onCaughtError!==void 0&&(k=h.onCaughtError),h.onRecoverableError!==void 0&&(G=h.onRecoverableError)),h=wU(u,1,!1,null,null,b,S,null,R,k,G,OU),u[Zs]=h.current,qE(u),new fA(h)},Sg.hydrateRoot=function(u,h,b){if(!r(u))throw Error(i(299));var S=!1,R="",k=HI,G=VI,ie=$I,_e=null;return b!=null&&(b.unstable_strictMode===!0&&(S=!0),b.identifierPrefix!==void 0&&(R=b.identifierPrefix),b.onUncaughtError!==void 0&&(k=b.onUncaughtError),b.onCaughtError!==void 0&&(G=b.onCaughtError),b.onRecoverableError!==void 0&&(ie=b.onRecoverableError),b.formState!==void 0&&(_e=b.formState)),h=wU(u,1,!0,h,b??null,S,R,_e,k,G,ie,OU),h.context=MU(null),b=h.current,S=Za(),S=Zi(S),R=jc(S),R.callback=null,Fc(b,R,S),b=S,h.current.lanes=b,on(h,b),Po(h),u[Zs]=h.current,qE(u),new _y(h)},Sg.version="19.2.0",Sg}var GU;function Zte(){if(GU)return mA.exports;GU=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(),mA.exports=Yte(),mA.exports}var Qte=Zte();const Ht=t=>typeof t=="string",wg=()=>{let t,e;const n=new Promise((i,r)=>{t=i,e=r});return n.resolve=t,n.reject=e,n},WU=t=>t==null?"":""+t,Jte=(t,e,n)=>{t.forEach(i=>{e[i]&&(n[i]=e[i])})},ene=/###/g,qU=t=>t&&t.indexOf("###")>-1?t.replace(ene,"."):t,XU=t=>!t||Ht(t),s0=(t,e,n)=>{const i=Ht(e)?e.split("."):e;let r=0;for(;r<i.length-1;){if(XU(t))return{};const a=qU(i[r]);!t[a]&&n&&(t[a]=new n),Object.prototype.hasOwnProperty.call(t,a)?t=t[a]:t={},++r}return XU(t)?{}:{obj:t,k:qU(i[r])}},KU=(t,e,n)=>{const{obj:i,k:r}=s0(t,e,Object);if(i!==void 0||e.length===1){i[r]=n;return}let a=e[e.length-1],s=e.slice(0,e.length-1),o=s0(t,s,Object);for(;o.obj===void 0&&s.length;)a=`${s[s.length-1]}.${a}`,s=s.slice(0,s.length-1),o=s0(t,s,Object),o?.obj&&typeof o.obj[`${o.k}.${a}`]<"u"&&(o.obj=void 0);o.obj[`${o.k}.${a}`]=n},tne=(t,e,n,i)=>{const{obj:r,k:a}=s0(t,e,Object);r[a]=r[a]||[],r[a].push(n)},T_=(t,e)=>{const{obj:n,k:i}=s0(t,e);if(n&&Object.prototype.hasOwnProperty.call(n,i))return n[i]},nne=(t,e,n)=>{const i=T_(t,n);return i!==void 0?i:T_(e,n)},tG=(t,e,n)=>{for(const i in e)i!=="__proto__"&&i!=="constructor"&&(i in t?Ht(t[i])||t[i]instanceof String||Ht(e[i])||e[i]instanceof String?n&&(t[i]=e[i]):tG(t[i],e[i],n):t[i]=e[i]);return t},wh=t=>t.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");var ine={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;"};const rne=t=>Ht(t)?t.replace(/[&<>"'\/]/g,e=>ine[e]):t;class ane{constructor(e){this.capacity=e,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(e){const n=this.regExpMap.get(e);if(n!==void 0)return n;const i=new RegExp(e);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(e,i),this.regExpQueue.push(e),i}}const sne=[" ",",","?","!",";"],one=new ane(20),lne=(t,e,n)=>{e=e||"",n=n||"";const i=sne.filter(s=>e.indexOf(s)<0&&n.indexOf(s)<0);if(i.length===0)return!0;const r=one.getRegExp(`(${i.map(s=>s==="?"?"\\?":s).join("|")})`);let a=!r.test(t);if(!a){const s=t.indexOf(n);s>0&&!r.test(t.substring(0,s))&&(a=!0)}return a},rN=(t,e,n=".")=>{if(!t)return;if(t[e])return Object.prototype.hasOwnProperty.call(t,e)?t[e]:void 0;const i=e.split(n);let r=t;for(let a=0;a<i.length;){if(!r||typeof r!="object")return;let s,o="";for(let l=a;l<i.length;++l)if(l!==a&&(o+=n),o+=i[l],s=r[o],s!==void 0){if(["string","number","boolean"].indexOf(typeof s)>-1&&l<i.length-1)continue;a+=l-a+1;break}r=s}return r},R0=t=>t?.replace("_","-"),cne={type:"logger",log(t){this.output("log",t)},warn(t){this.output("warn",t)},error(t){this.output("error",t)},output(t,e){console?.[t]?.apply?.(console,e)}};class C_{constructor(e,n={}){this.init(e,n)}init(e,n={}){this.prefix=n.prefix||"i18next:",this.logger=e||cne,this.options=n,this.debug=n.debug}log(...e){return this.forward(e,"log","",!0)}warn(...e){return this.forward(e,"warn","",!0)}error(...e){return this.forward(e,"error","")}deprecate(...e){return this.forward(e,"warn","WARNING DEPRECATED: ",!0)}forward(e,n,i,r){return r&&!this.debug?null:(Ht(e[0])&&(e[0]=`${i}${this.prefix} ${e[0]}`),this.logger[n](e))}create(e){return new C_(this.logger,{prefix:`${this.prefix}:${e}:`,...this.options})}clone(e){return e=e||this.options,e.prefix=e.prefix||this.prefix,new C_(this.logger,e)}}var Vo=new C_;let US=class{constructor(){this.observers={}}on(e,n){return e.split(" ").forEach(i=>{this.observers[i]||(this.observers[i]=new Map);const r=this.observers[i].get(n)||0;this.observers[i].set(n,r+1)}),this}off(e,n){if(this.observers[e]){if(!n){delete this.observers[e];return}this.observers[e].delete(n)}}emit(e,...n){this.observers[e]&&Array.from(this.observers[e].entries()).forEach(([r,a])=>{for(let s=0;s<a;s++)r(...n)}),this.observers["*"]&&Array.from(this.observers["*"].entries()).forEach(([r,a])=>{for(let s=0;s<a;s++)r.apply(r,[e,...n])})}};class YU extends US{constructor(e,n={ns:["translation"],defaultNS:"translation"}){super(),this.data=e||{},this.options=n,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(e){this.options.ns.indexOf(e)<0&&this.options.ns.push(e)}removeNamespaces(e){const n=this.options.ns.indexOf(e);n>-1&&this.options.ns.splice(n,1)}getResource(e,n,i,r={}){const a=r.keySeparator!==void 0?r.keySeparator:this.options.keySeparator,s=r.ignoreJSONStructure!==void 0?r.ignoreJSONStructure:this.options.ignoreJSONStructure;let o;e.indexOf(".")>-1?o=e.split("."):(o=[e,n],i&&(Array.isArray(i)?o.push(...i):Ht(i)&&a?o.push(...i.split(a)):o.push(i)));const l=T_(this.data,o);return!l&&!n&&!i&&e.indexOf(".")>-1&&(e=o[0],n=o[1],i=o.slice(2).join(".")),l||!s||!Ht(i)?l:rN(this.data?.[e]?.[n],i,a)}addResource(e,n,i,r,a={silent:!1}){const s=a.keySeparator!==void 0?a.keySeparator:this.options.keySeparator;let o=[e,n];i&&(o=o.concat(s?i.split(s):i)),e.indexOf(".")>-1&&(o=e.split("."),r=n,n=o[1]),this.addNamespaces(n),KU(this.data,o,r),a.silent||this.emit("added",e,n,i,r)}addResources(e,n,i,r={silent:!1}){for(const a in i)(Ht(i[a])||Array.isArray(i[a]))&&this.addResource(e,n,a,i[a],{silent:!0});r.silent||this.emit("added",e,n,i)}addResourceBundle(e,n,i,r,a,s={silent:!1,skipCopy:!1}){let o=[e,n];e.indexOf(".")>-1&&(o=e.split("."),r=i,i=n,n=o[1]),this.addNamespaces(n);let l=T_(this.data,o)||{};s.skipCopy||(i=JSON.parse(JSON.stringify(i))),r?tG(l,i,a):l={...l,...i},KU(this.data,o,l),s.silent||this.emit("added",e,n,i)}removeResourceBundle(e,n){this.hasResourceBundle(e,n)&&delete this.data[e][n],this.removeNamespaces(n),this.emit("removed",e,n)}hasResourceBundle(e,n){return this.getResource(e,n)!==void 0}getResourceBundle(e,n){return n||(n=this.options.defaultNS),this.getResource(e,n)}getDataByLanguage(e){return this.data[e]}hasLanguageSomeTranslations(e){const n=this.getDataByLanguage(e);return!!(n&&Object.keys(n)||[]).find(r=>n[r]&&Object.keys(n[r]).length>0)}toJSON(){return this.data}}var nG={processors:{},addPostProcessor(t){this.processors[t.name]=t},handle(t,e,n,i,r){return t.forEach(a=>{e=this.processors[a]?.process(e,n,i,r)??e}),e}};const iG=Symbol("i18next/PATH_KEY");function une(){const t=[],e=Object.create(null);let n;return e.get=(i,r)=>(n?.revoke?.(),r===iG?t:(t.push(r),n=Proxy.revocable(i,e),n.proxy)),Proxy.revocable(Object.create(null),e).proxy}function aN(t,e){const{[iG]:n}=t(une());return n.join(e?.keySeparator??".")}const ZU={},yA=t=>!Ht(t)&&typeof t!="boolean"&&typeof t!="number";class N_ extends US{constructor(e,n={}){super(),Jte(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],e,this),this.options=n,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=Vo.create("translator")}changeLanguage(e){e&&(this.language=e)}exists(e,n={interpolation:{}}){const i={...n};if(e==null)return!1;const r=this.resolve(e,i);if(r?.res===void 0)return!1;const a=yA(r.res);return!(i.returnObjects===!1&&a)}extractFromKey(e,n){let i=n.nsSeparator!==void 0?n.nsSeparator:this.options.nsSeparator;i===void 0&&(i=":");const r=n.keySeparator!==void 0?n.keySeparator:this.options.keySeparator;let a=n.ns||this.options.defaultNS||[];const s=i&&e.indexOf(i)>-1,o=!this.options.userDefinedKeySeparator&&!n.keySeparator&&!this.options.userDefinedNsSeparator&&!n.nsSeparator&&!lne(e,i,r);if(s&&!o){const l=e.match(this.interpolator.nestingRegexp);if(l&&l.length>0)return{key:e,namespaces:Ht(a)?[a]:a};const c=e.split(i);(i!==r||i===r&&this.options.ns.indexOf(c[0])>-1)&&(a=c.shift()),e=c.join(r)}return{key:e,namespaces:Ht(a)?[a]:a}}translate(e,n,i){let r=typeof n=="object"?{...n}:n;if(typeof r!="object"&&this.options.overloadTranslationOptionHandler&&(r=this.options.overloadTranslationOptionHandler(arguments)),typeof r=="object"&&(r={...r}),r||(r={}),e==null)return"";typeof e=="function"&&(e=aN(e,{...this.options,...r})),Array.isArray(e)||(e=[String(e)]);const a=r.returnDetails!==void 0?r.returnDetails:this.options.returnDetails,s=r.keySeparator!==void 0?r.keySeparator:this.options.keySeparator,{key:o,namespaces:l}=this.extractFromKey(e[e.length-1],r),c=l[l.length-1];let d=r.nsSeparator!==void 0?r.nsSeparator:this.options.nsSeparator;d===void 0&&(d=":");const f=r.lng||this.language,m=r.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(f?.toLowerCase()==="cimode")return m?a?{res:`${c}${d}${o}`,usedKey:o,exactUsedKey:o,usedLng:f,usedNS:c,usedParams:this.getUsedParamsDetails(r)}:`${c}${d}${o}`:a?{res:o,usedKey:o,exactUsedKey:o,usedLng:f,usedNS:c,usedParams:this.getUsedParamsDetails(r)}:o;const g=this.resolve(e,r);let y=g?.res;const _=g?.usedKey||o,v=g?.exactUsedKey||o,x=["[object Number]","[object Function]","[object RegExp]"],M=r.joinArrays!==void 0?r.joinArrays:this.options.joinArrays,w=!this.i18nFormat||this.i18nFormat.handleAsObject,T=r.count!==void 0&&!Ht(r.count),C=N_.hasDefaultValue(r),P=T?this.pluralResolver.getSuffix(f,r.count,r):"",A=r.ordinal&&T?this.pluralResolver.getSuffix(f,r.count,{ordinal:!1}):"",U=T&&!r.ordinal&&r.count===0,N=U&&r[`defaultValue${this.options.pluralSeparator}zero`]||r[`defaultValue${P}`]||r[`defaultValue${A}`]||r.defaultValue;let D=y;w&&!y&&C&&(D=N);const F=yA(D),I=Object.prototype.toString.apply(D);if(w&&D&&F&&x.indexOf(I)<0&&!(Ht(M)&&Array.isArray(D))){if(!r.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const W=this.options.returnedObjectHandler?this.options.returnedObjectHandler(_,D,{...r,ns:l}):`key '${o} (${this.language})' returned an object instead of string.`;return a?(g.res=W,g.usedParams=this.getUsedParamsDetails(r),g):W}if(s){const W=Array.isArray(D),O=W?[]:{},B=W?v:_;for(const H in D)if(Object.prototype.hasOwnProperty.call(D,H)){const $=`${B}${s}${H}`;C&&!y?O[H]=this.translate($,{...r,defaultValue:yA(N)?N[H]:void 0,joinArrays:!1,ns:l}):O[H]=this.translate($,{...r,joinArrays:!1,ns:l}),O[H]===$&&(O[H]=D[H])}y=O}}else if(w&&Ht(M)&&Array.isArray(y))y=y.join(M),y&&(y=this.extendTranslation(y,e,r,i));else{let W=!1,O=!1;!this.isValidLookup(y)&&C&&(W=!0,y=N),this.isValidLookup(y)||(O=!0,y=o);const H=(r.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&O?void 0:y,$=C&&N!==y&&this.options.updateMissing;if(O||W||$){if(this.logger.log($?"updateKey":"missingKey",f,c,o,$?N:y),s){const V=this.resolve(o,{...r,keySeparator:!1});V&&V.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}let K=[];const Z=this.languageUtils.getFallbackCodes(this.options.fallbackLng,r.lng||this.language);if(this.options.saveMissingTo==="fallback"&&Z&&Z[0])for(let V=0;V<Z.length;V++)K.push(Z[V]);else this.options.saveMissingTo==="all"?K=this.languageUtils.toResolveHierarchy(r.lng||this.language):K.push(r.lng||this.language);const se=(V,X,ae)=>{const ce=C&&ae!==y?ae:H;this.options.missingKeyHandler?this.options.missingKeyHandler(V,c,X,ce,$,r):this.backendConnector?.saveMissing&&this.backendConnector.saveMissing(V,c,X,ce,$,r),this.emit("missingKey",V,c,X,y)};this.options.saveMissing&&(this.options.saveMissingPlurals&&T?K.forEach(V=>{const X=this.pluralResolver.getSuffixes(V,r);U&&r[`defaultValue${this.options.pluralSeparator}zero`]&&X.indexOf(`${this.options.pluralSeparator}zero`)<0&&X.push(`${this.options.pluralSeparator}zero`),X.forEach(ae=>{se([V],o+ae,r[`defaultValue${ae}`]||N)})}):se(K,o,N))}y=this.extendTranslation(y,e,r,g,i),O&&y===o&&this.options.appendNamespaceToMissingKey&&(y=`${c}${d}${o}`),(O||W)&&this.options.parseMissingKeyHandler&&(y=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${c}${d}${o}`:o,W?y:void 0,r))}return a?(g.res=y,g.usedParams=this.getUsedParamsDetails(r),g):y}extendTranslation(e,n,i,r,a){if(this.i18nFormat?.parse)e=this.i18nFormat.parse(e,{...this.options.interpolation.defaultVariables,...i},i.lng||this.language||r.usedLng,r.usedNS,r.usedKey,{resolved:r});else if(!i.skipInterpolation){i.interpolation&&this.interpolator.init({...i,interpolation:{...this.options.interpolation,...i.interpolation}});const l=Ht(e)&&(i?.interpolation?.skipOnVariables!==void 0?i.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let c;if(l){const f=e.match(this.interpolator.nestingRegexp);c=f&&f.length}let d=i.replace&&!Ht(i.replace)?i.replace:i;if(this.options.interpolation.defaultVariables&&(d={...this.options.interpolation.defaultVariables,...d}),e=this.interpolator.interpolate(e,d,i.lng||this.language||r.usedLng,i),l){const f=e.match(this.interpolator.nestingRegexp),m=f&&f.length;c<m&&(i.nest=!1)}!i.lng&&r&&r.res&&(i.lng=this.language||r.usedLng),i.nest!==!1&&(e=this.interpolator.nest(e,(...f)=>a?.[0]===f[0]&&!i.context?(this.logger.warn(`It seems you are nesting recursively key: ${f[0]} in key: ${n[0]}`),null):this.translate(...f,n),i)),i.interpolation&&this.interpolator.reset()}const s=i.postProcess||this.options.postProcess,o=Ht(s)?[s]:s;return e!=null&&o?.length&&i.applyPostProcessor!==!1&&(e=nG.handle(o,e,n,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...r,usedParams:this.getUsedParamsDetails(i)},...i}:i,this)),e}resolve(e,n={}){let i,r,a,s,o;return Ht(e)&&(e=[e]),e.forEach(l=>{if(this.isValidLookup(i))return;const c=this.extractFromKey(l,n),d=c.key;r=d;let f=c.namespaces;this.options.fallbackNS&&(f=f.concat(this.options.fallbackNS));const m=n.count!==void 0&&!Ht(n.count),g=m&&!n.ordinal&&n.count===0,y=n.context!==void 0&&(Ht(n.context)||typeof n.context=="number")&&n.context!=="",_=n.lngs?n.lngs:this.languageUtils.toResolveHierarchy(n.lng||this.language,n.fallbackLng);f.forEach(v=>{this.isValidLookup(i)||(o=v,!ZU[`${_[0]}-${v}`]&&this.utils?.hasLoadedNamespace&&!this.utils?.hasLoadedNamespace(o)&&(ZU[`${_[0]}-${v}`]=!0,this.logger.warn(`key "${r}" for languages "${_.join(", ")}" won't get resolved as namespace "${o}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),_.forEach(x=>{if(this.isValidLookup(i))return;s=x;const M=[d];if(this.i18nFormat?.addLookupKeys)this.i18nFormat.addLookupKeys(M,d,x,v,n);else{let T;m&&(T=this.pluralResolver.getSuffix(x,n.count,n));const C=`${this.options.pluralSeparator}zero`,P=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(m&&(n.ordinal&&T.indexOf(P)===0&&M.push(d+T.replace(P,this.options.pluralSeparator)),M.push(d+T),g&&M.push(d+C)),y){const A=`${d}${this.options.contextSeparator||"_"}${n.context}`;M.push(A),m&&(n.ordinal&&T.indexOf(P)===0&&M.push(A+T.replace(P,this.options.pluralSeparator)),M.push(A+T),g&&M.push(A+C))}}let w;for(;w=M.pop();)this.isValidLookup(i)||(a=w,i=this.getResource(x,v,w,n))}))})}),{res:i,usedKey:r,exactUsedKey:a,usedLng:s,usedNS:o}}isValidLookup(e){return e!==void 0&&!(!this.options.returnNull&&e===null)&&!(!this.options.returnEmptyString&&e==="")}getResource(e,n,i,r={}){return this.i18nFormat?.getResource?this.i18nFormat.getResource(e,n,i,r):this.resourceStore.getResource(e,n,i,r)}getUsedParamsDetails(e={}){const n=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],i=e.replace&&!Ht(e.replace);let r=i?e.replace:e;if(i&&typeof e.count<"u"&&(r.count=e.count),this.options.interpolation.defaultVariables&&(r={...this.options.interpolation.defaultVariables,...r}),!i){r={...r};for(const a of n)delete r[a]}return r}static hasDefaultValue(e){const n="defaultValue";for(const i in e)if(Object.prototype.hasOwnProperty.call(e,i)&&n===i.substring(0,n.length)&&e[i]!==void 0)return!0;return!1}}class QU{constructor(e){this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=Vo.create("languageUtils")}getScriptPartFromCode(e){if(e=R0(e),!e||e.indexOf("-")<0)return null;const n=e.split("-");return n.length===2||(n.pop(),n[n.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(n.join("-"))}getLanguagePartFromCode(e){if(e=R0(e),!e||e.indexOf("-")<0)return e;const n=e.split("-");return this.formatLanguageCode(n[0])}formatLanguageCode(e){if(Ht(e)&&e.indexOf("-")>-1){let n;try{n=Intl.getCanonicalLocales(e)[0]}catch{}return n&&this.options.lowerCaseLng&&(n=n.toLowerCase()),n||(this.options.lowerCaseLng?e.toLowerCase():e)}return this.options.cleanCode||this.options.lowerCaseLng?e.toLowerCase():e}isSupportedCode(e){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(e=this.getLanguagePartFromCode(e)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(e)>-1}getBestMatchFromCodes(e){if(!e)return null;let n;return e.forEach(i=>{if(n)return;const r=this.formatLanguageCode(i);(!this.options.supportedLngs||this.isSupportedCode(r))&&(n=r)}),!n&&this.options.supportedLngs&&e.forEach(i=>{if(n)return;const r=this.getScriptPartFromCode(i);if(this.isSupportedCode(r))return n=r;const a=this.getLanguagePartFromCode(i);if(this.isSupportedCode(a))return n=a;n=this.options.supportedLngs.find(s=>{if(s===a)return s;if(!(s.indexOf("-")<0&&a.indexOf("-")<0)&&(s.indexOf("-")>0&&a.indexOf("-")<0&&s.substring(0,s.indexOf("-"))===a||s.indexOf(a)===0&&a.length>1))return s})}),n||(n=this.getFallbackCodes(this.options.fallbackLng)[0]),n}getFallbackCodes(e,n){if(!e)return[];if(typeof e=="function"&&(e=e(n)),Ht(e)&&(e=[e]),Array.isArray(e))return e;if(!n)return e.default||[];let i=e[n];return i||(i=e[this.getScriptPartFromCode(n)]),i||(i=e[this.formatLanguageCode(n)]),i||(i=e[this.getLanguagePartFromCode(n)]),i||(i=e.default),i||[]}toResolveHierarchy(e,n){const i=this.getFallbackCodes((n===!1?[]:n)||this.options.fallbackLng||[],e),r=[],a=s=>{s&&(this.isSupportedCode(s)?r.push(s):this.logger.warn(`rejecting language code not found in supportedLngs: ${s}`))};return Ht(e)&&(e.indexOf("-")>-1||e.indexOf("_")>-1)?(this.options.load!=="languageOnly"&&a(this.formatLanguageCode(e)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&a(this.getScriptPartFromCode(e)),this.options.load!=="currentOnly"&&a(this.getLanguagePartFromCode(e))):Ht(e)&&a(this.formatLanguageCode(e)),i.forEach(s=>{r.indexOf(s)<0&&a(this.formatLanguageCode(s))}),r}}const JU={zero:0,one:1,two:2,few:3,many:4,other:5},ej={select:t=>t===1?"one":"other",resolvedOptions:()=>({pluralCategories:["one","other"]})};class dne{constructor(e,n={}){this.languageUtils=e,this.options=n,this.logger=Vo.create("pluralResolver"),this.pluralRulesCache={}}addRule(e,n){this.rules[e]=n}clearCache(){this.pluralRulesCache={}}getRule(e,n={}){const i=R0(e==="dev"?"en":e),r=n.ordinal?"ordinal":"cardinal",a=JSON.stringify({cleanedCode:i,type:r});if(a in this.pluralRulesCache)return this.pluralRulesCache[a];let s;try{s=new Intl.PluralRules(i,{type:r})}catch{if(!Intl)return this.logger.error("No Intl support, please use an Intl polyfill!"),ej;if(!e.match(/-|_/))return ej;const l=this.languageUtils.getLanguagePartFromCode(e);s=this.getRule(l,n)}return this.pluralRulesCache[a]=s,s}needsPlural(e,n={}){let i=this.getRule(e,n);return i||(i=this.getRule("dev",n)),i?.resolvedOptions().pluralCategories.length>1}getPluralFormsOfKey(e,n,i={}){return this.getSuffixes(e,i).map(r=>`${n}${r}`)}getSuffixes(e,n={}){let i=this.getRule(e,n);return i||(i=this.getRule("dev",n)),i?i.resolvedOptions().pluralCategories.sort((r,a)=>JU[r]-JU[a]).map(r=>`${this.options.prepend}${n.ordinal?`ordinal${this.options.prepend}`:""}${r}`):[]}getSuffix(e,n,i={}){const r=this.getRule(e,i);return r?`${this.options.prepend}${i.ordinal?`ordinal${this.options.prepend}`:""}${r.select(n)}`:(this.logger.warn(`no plural rule found for: ${e}`),this.getSuffix("dev",n,i))}}const tj=(t,e,n,i=".",r=!0)=>{let a=nne(t,e,n);return!a&&r&&Ht(n)&&(a=rN(t,n,i),a===void 0&&(a=rN(e,n,i))),a},bA=t=>t.replace(/\$/g,"$$$$");class fne{constructor(e={}){this.logger=Vo.create("interpolator"),this.options=e,this.format=e?.interpolation?.format||(n=>n),this.init(e)}init(e={}){e.interpolation||(e.interpolation={escapeValue:!0});const{escape:n,escapeValue:i,useRawValueToEscape:r,prefix:a,prefixEscaped:s,suffix:o,suffixEscaped:l,formatSeparator:c,unescapeSuffix:d,unescapePrefix:f,nestingPrefix:m,nestingPrefixEscaped:g,nestingSuffix:y,nestingSuffixEscaped:_,nestingOptionsSeparator:v,maxReplaces:x,alwaysFormat:M}=e.interpolation;this.escape=n!==void 0?n:rne,this.escapeValue=i!==void 0?i:!0,this.useRawValueToEscape=r!==void 0?r:!1,this.prefix=a?wh(a):s||"{{",this.suffix=o?wh(o):l||"}}",this.formatSeparator=c||",",this.unescapePrefix=d?"":f||"-",this.unescapeSuffix=this.unescapePrefix?"":d||"",this.nestingPrefix=m?wh(m):g||wh("$t("),this.nestingSuffix=y?wh(y):_||wh(")"),this.nestingOptionsSeparator=v||",",this.maxReplaces=x||1e3,this.alwaysFormat=M!==void 0?M:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const e=(n,i)=>n?.source===i?(n.lastIndex=0,n):new RegExp(i,"g");this.regexp=e(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=e(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=e(this.nestingRegexp,`${this.nestingPrefix}((?:[^()"']+|"[^"]*"|'[^']*'|\\((?:[^()]|"[^"]*"|'[^']*')*\\))*?)${this.nestingSuffix}`)}interpolate(e,n,i,r){let a,s,o;const l=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},c=g=>{if(g.indexOf(this.formatSeparator)<0){const x=tj(n,l,g,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(x,void 0,i,{...r,...n,interpolationkey:g}):x}const y=g.split(this.formatSeparator),_=y.shift().trim(),v=y.join(this.formatSeparator).trim();return this.format(tj(n,l,_,this.options.keySeparator,this.options.ignoreJSONStructure),v,i,{...r,...n,interpolationkey:_})};this.resetRegExp();const d=r?.missingInterpolationHandler||this.options.missingInterpolationHandler,f=r?.interpolation?.skipOnVariables!==void 0?r.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:g=>bA(g)},{regex:this.regexp,safeValue:g=>this.escapeValue?bA(this.escape(g)):bA(g)}].forEach(g=>{for(o=0;a=g.regex.exec(e);){const y=a[1].trim();if(s=c(y),s===void 0)if(typeof d=="function"){const v=d(e,a,r);s=Ht(v)?v:""}else if(r&&Object.prototype.hasOwnProperty.call(r,y))s="";else if(f){s=a[0];continue}else this.logger.warn(`missed to pass in variable ${y} for interpolating ${e}`),s="";else!Ht(s)&&!this.useRawValueToEscape&&(s=WU(s));const _=g.safeValue(s);if(e=e.replace(a[0],_),f?(g.regex.lastIndex+=s.length,g.regex.lastIndex-=a[0].length):g.regex.lastIndex=0,o++,o>=this.maxReplaces)break}}),e}nest(e,n,i={}){let r,a,s;const o=(l,c)=>{const d=this.nestingOptionsSeparator;if(l.indexOf(d)<0)return l;const f=l.split(new RegExp(`${d}[ ]*{`));let m=`{${f[1]}`;l=f[0],m=this.interpolate(m,s);const g=m.match(/'/g),y=m.match(/"/g);((g?.length??0)%2===0&&!y||y.length%2!==0)&&(m=m.replace(/'/g,'"'));try{s=JSON.parse(m),c&&(s={...c,...s})}catch(_){return this.logger.warn(`failed parsing options string in nesting for key ${l}`,_),`${l}${d}${m}`}return s.defaultValue&&s.defaultValue.indexOf(this.prefix)>-1&&delete s.defaultValue,l};for(;r=this.nestingRegexp.exec(e);){let l=[];s={...i},s=s.replace&&!Ht(s.replace)?s.replace:s,s.applyPostProcessor=!1,delete s.defaultValue;const c=/{.*}/.test(r[1])?r[1].lastIndexOf("}")+1:r[1].indexOf(this.formatSeparator);if(c!==-1&&(l=r[1].slice(c).split(this.formatSeparator).map(d=>d.trim()).filter(Boolean),r[1]=r[1].slice(0,c)),a=n(o.call(this,r[1].trim(),s),s),a&&r[0]===e&&!Ht(a))return a;Ht(a)||(a=WU(a)),a||(this.logger.warn(`missed to resolve ${r[1]} for nesting ${e}`),a=""),l.length&&(a=l.reduce((d,f)=>this.format(d,f,i.lng,{...i,interpolationkey:r[1].trim()}),a.trim())),e=e.replace(r[0],a),this.regexp.lastIndex=0}return e}}const hne=t=>{let e=t.toLowerCase().trim();const n={};if(t.indexOf("(")>-1){const i=t.split("(");e=i[0].toLowerCase().trim();const r=i[1].substring(0,i[1].length-1);e==="currency"&&r.indexOf(":")<0?n.currency||(n.currency=r.trim()):e==="relativetime"&&r.indexOf(":")<0?n.range||(n.range=r.trim()):r.split(";").forEach(s=>{if(s){const[o,...l]=s.split(":"),c=l.join(":").trim().replace(/^'+|'+$/g,""),d=o.trim();n[d]||(n[d]=c),c==="false"&&(n[d]=!1),c==="true"&&(n[d]=!0),isNaN(c)||(n[d]=parseInt(c,10))}})}return{formatName:e,formatOptions:n}},nj=t=>{const e={};return(n,i,r)=>{let a=r;r&&r.interpolationkey&&r.formatParams&&r.formatParams[r.interpolationkey]&&r[r.interpolationkey]&&(a={...a,[r.interpolationkey]:void 0});const s=i+JSON.stringify(a);let o=e[s];return o||(o=t(R0(i),r),e[s]=o),o(n)}},pne=t=>(e,n,i)=>t(R0(n),i)(e);class mne{constructor(e={}){this.logger=Vo.create("formatter"),this.options=e,this.init(e)}init(e,n={interpolation:{}}){this.formatSeparator=n.interpolation.formatSeparator||",";const i=n.cacheInBuiltFormats?nj:pne;this.formats={number:i((r,a)=>{const s=new Intl.NumberFormat(r,{...a});return o=>s.format(o)}),currency:i((r,a)=>{const s=new Intl.NumberFormat(r,{...a,style:"currency"});return o=>s.format(o)}),datetime:i((r,a)=>{const s=new Intl.DateTimeFormat(r,{...a});return o=>s.format(o)}),relativetime:i((r,a)=>{const s=new Intl.RelativeTimeFormat(r,{...a});return o=>s.format(o,a.range||"day")}),list:i((r,a)=>{const s=new Intl.ListFormat(r,{...a});return o=>s.format(o)})}}add(e,n){this.formats[e.toLowerCase().trim()]=n}addCached(e,n){this.formats[e.toLowerCase().trim()]=nj(n)}format(e,n,i,r={}){const a=n.split(this.formatSeparator);if(a.length>1&&a[0].indexOf("(")>1&&a[0].indexOf(")")<0&&a.find(o=>o.indexOf(")")>-1)){const o=a.findIndex(l=>l.indexOf(")")>-1);a[0]=[a[0],...a.splice(1,o)].join(this.formatSeparator)}return a.reduce((o,l)=>{const{formatName:c,formatOptions:d}=hne(l);if(this.formats[c]){let f=o;try{const m=r?.formatParams?.[r.interpolationkey]||{},g=m.locale||m.lng||r.locale||r.lng||i;f=this.formats[c](o,g,{...d,...r,...m})}catch(m){this.logger.warn(m)}return f}else this.logger.warn(`there was no format function for ${c}`);return o},e)}}const gne=(t,e)=>{t.pending[e]!==void 0&&(delete t.pending[e],t.pendingCount--)};class xne extends US{constructor(e,n,i,r={}){super(),this.backend=e,this.store=n,this.services=i,this.languageUtils=i.languageUtils,this.options=r,this.logger=Vo.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=r.maxParallelReads||10,this.readingCalls=0,this.maxRetries=r.maxRetries>=0?r.maxRetries:5,this.retryTimeout=r.retryTimeout>=1?r.retryTimeout:350,this.state={},this.queue=[],this.backend?.init?.(i,r.backend,r)}queueLoad(e,n,i,r){const a={},s={},o={},l={};return e.forEach(c=>{let d=!0;n.forEach(f=>{const m=`${c}|${f}`;!i.reload&&this.store.hasResourceBundle(c,f)?this.state[m]=2:this.state[m]<0||(this.state[m]===1?s[m]===void 0&&(s[m]=!0):(this.state[m]=1,d=!1,s[m]===void 0&&(s[m]=!0),a[m]===void 0&&(a[m]=!0),l[f]===void 0&&(l[f]=!0)))}),d||(o[c]=!0)}),(Object.keys(a).length||Object.keys(s).length)&&this.queue.push({pending:s,pendingCount:Object.keys(s).length,loaded:{},errors:[],callback:r}),{toLoad:Object.keys(a),pending:Object.keys(s),toLoadLanguages:Object.keys(o),toLoadNamespaces:Object.keys(l)}}loaded(e,n,i){const r=e.split("|"),a=r[0],s=r[1];n&&this.emit("failedLoading",a,s,n),!n&&i&&this.store.addResourceBundle(a,s,i,void 0,void 0,{skipCopy:!0}),this.state[e]=n?-1:2,n&&i&&(this.state[e]=0);const o={};this.queue.forEach(l=>{tne(l.loaded,[a],s),gne(l,e),n&&l.errors.push(n),l.pendingCount===0&&!l.done&&(Object.keys(l.loaded).forEach(c=>{o[c]||(o[c]={});const d=l.loaded[c];d.length&&d.forEach(f=>{o[c][f]===void 0&&(o[c][f]=!0)})}),l.done=!0,l.errors.length?l.callback(l.errors):l.callback())}),this.emit("loaded",o),this.queue=this.queue.filter(l=>!l.done)}read(e,n,i,r=0,a=this.retryTimeout,s){if(!e.length)return s(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:e,ns:n,fcName:i,tried:r,wait:a,callback:s});return}this.readingCalls++;const o=(c,d)=>{if(this.readingCalls--,this.waitingReads.length>0){const f=this.waitingReads.shift();this.read(f.lng,f.ns,f.fcName,f.tried,f.wait,f.callback)}if(c&&d&&r<this.maxRetries){setTimeout(()=>{this.read.call(this,e,n,i,r+1,a*2,s)},a);return}s(c,d)},l=this.backend[i].bind(this.backend);if(l.length===2){try{const c=l(e,n);c&&typeof c.then=="function"?c.then(d=>o(null,d)).catch(o):o(null,c)}catch(c){o(c)}return}return l(e,n,o)}prepareLoading(e,n,i={},r){if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),r&&r();Ht(e)&&(e=this.languageUtils.toResolveHierarchy(e)),Ht(n)&&(n=[n]);const a=this.queueLoad(e,n,i,r);if(!a.toLoad.length)return a.pending.length||r(),null;a.toLoad.forEach(s=>{this.loadOne(s)})}load(e,n,i){this.prepareLoading(e,n,{},i)}reload(e,n,i){this.prepareLoading(e,n,{reload:!0},i)}loadOne(e,n=""){const i=e.split("|"),r=i[0],a=i[1];this.read(r,a,"read",void 0,void 0,(s,o)=>{s&&this.logger.warn(`${n}loading namespace ${a} for language ${r} failed`,s),!s&&o&&this.logger.log(`${n}loaded namespace ${a} for language ${r}`,o),this.loaded(e,s,o)})}saveMissing(e,n,i,r,a,s={},o=()=>{}){if(this.services?.utils?.hasLoadedNamespace&&!this.services?.utils?.hasLoadedNamespace(n)){this.logger.warn(`did not save key "${i}" as the namespace "${n}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");return}if(!(i==null||i==="")){if(this.backend?.create){const l={...s,isUpdate:a},c=this.backend.create.bind(this.backend);if(c.length<6)try{let d;c.length===5?d=c(e,n,i,r,l):d=c(e,n,i,r),d&&typeof d.then=="function"?d.then(f=>o(null,f)).catch(o):o(null,d)}catch(d){o(d)}else c(e,n,i,r,o,l)}!e||!e[0]||this.store.addResource(e[0],n,i,r)}}}const ij=()=>({debug:!1,initAsync:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:t=>{let e={};if(typeof t[1]=="object"&&(e=t[1]),Ht(t[1])&&(e.defaultValue=t[1]),Ht(t[2])&&(e.tDescription=t[2]),typeof t[2]=="object"||typeof t[3]=="object"){const n=t[3]||t[2];Object.keys(n).forEach(i=>{e[i]=n[i]})}return e},interpolation:{escapeValue:!0,format:t=>t,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0},cacheInBuiltFormats:!0}),rj=t=>(Ht(t.ns)&&(t.ns=[t.ns]),Ht(t.fallbackLng)&&(t.fallbackLng=[t.fallbackLng]),Ht(t.fallbackNS)&&(t.fallbackNS=[t.fallbackNS]),t.supportedLngs?.indexOf?.("cimode")<0&&(t.supportedLngs=t.supportedLngs.concat(["cimode"])),typeof t.initImmediate=="boolean"&&(t.initAsync=t.initImmediate),t),My=()=>{},vne=t=>{Object.getOwnPropertyNames(Object.getPrototypeOf(t)).forEach(n=>{typeof t[n]=="function"&&(t[n]=t[n].bind(t))})};class o0 extends US{constructor(e={},n){if(super(),this.options=rj(e),this.services={},this.logger=Vo,this.modules={external:[]},vne(this),n&&!this.isInitialized&&!e.isClone){if(!this.options.initAsync)return this.init(e,n),this;setTimeout(()=>{this.init(e,n)},0)}}init(e={},n){this.isInitializing=!0,typeof e=="function"&&(n=e,e={}),e.defaultNS==null&&e.ns&&(Ht(e.ns)?e.defaultNS=e.ns:e.ns.indexOf("translation")<0&&(e.defaultNS=e.ns[0]));const i=ij();this.options={...i,...this.options,...rj(e)},this.options.interpolation={...i.interpolation,...this.options.interpolation},e.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=e.keySeparator),e.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=e.nsSeparator);const r=c=>c?typeof c=="function"?new c:c:null;if(!this.options.isClone){this.modules.logger?Vo.init(r(this.modules.logger),this.options):Vo.init(null,this.options);let c;this.modules.formatter?c=this.modules.formatter:c=mne;const d=new QU(this.options);this.store=new YU(this.options.resources,this.options);const f=this.services;f.logger=Vo,f.resourceStore=this.store,f.languageUtils=d,f.pluralResolver=new dne(d,{prepend:this.options.pluralSeparator,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),this.options.interpolation.format&&this.options.interpolation.format!==i.interpolation.format&&this.logger.deprecate("init: you are still using the legacy format function, please use the new approach: https://www.i18next.com/translation-function/formatting"),c&&(!this.options.interpolation.format||this.options.interpolation.format===i.interpolation.format)&&(f.formatter=r(c),f.formatter.init&&f.formatter.init(f,this.options),this.options.interpolation.format=f.formatter.format.bind(f.formatter)),f.interpolator=new fne(this.options),f.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},f.backendConnector=new xne(r(this.modules.backend),f.resourceStore,f,this.options),f.backendConnector.on("*",(g,...y)=>{this.emit(g,...y)}),this.modules.languageDetector&&(f.languageDetector=r(this.modules.languageDetector),f.languageDetector.init&&f.languageDetector.init(f,this.options.detection,this.options)),this.modules.i18nFormat&&(f.i18nFormat=r(this.modules.i18nFormat),f.i18nFormat.init&&f.i18nFormat.init(this)),this.translator=new N_(this.services,this.options),this.translator.on("*",(g,...y)=>{this.emit(g,...y)}),this.modules.external.forEach(g=>{g.init&&g.init(this)})}if(this.format=this.options.interpolation.format,n||(n=My),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const c=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);c.length>0&&c[0]!=="dev"&&(this.options.lng=c[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn("init: no languageDetector is used and no lng is defined"),["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(c=>{this[c]=(...d)=>this.store[c](...d)}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(c=>{this[c]=(...d)=>(this.store[c](...d),this)});const o=wg(),l=()=>{const c=(d,f)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),o.resolve(f),n(d,f)};if(this.languages&&!this.isInitialized)return c(null,this.t.bind(this));this.changeLanguage(this.options.lng,c)};return this.options.resources||!this.options.initAsync?l():setTimeout(l,0),o}loadResources(e,n=My){let i=n;const r=Ht(e)?e:this.language;if(typeof e=="function"&&(i=e),!this.options.resources||this.options.partialBundledLanguages){if(r?.toLowerCase()==="cimode"&&(!this.options.preload||this.options.preload.length===0))return i();const a=[],s=o=>{if(!o||o==="cimode")return;this.services.languageUtils.toResolveHierarchy(o).forEach(c=>{c!=="cimode"&&a.indexOf(c)<0&&a.push(c)})};r?s(r):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(l=>s(l)),this.options.preload?.forEach?.(o=>s(o)),this.services.backendConnector.load(a,this.options.ns,o=>{!o&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),i(o)})}else i(null)}reloadResources(e,n,i){const r=wg();return typeof e=="function"&&(i=e,e=void 0),typeof n=="function"&&(i=n,n=void 0),e||(e=this.languages),n||(n=this.options.ns),i||(i=My),this.services.backendConnector.reload(e,n,a=>{r.resolve(),i(a)}),r}use(e){if(!e)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!e.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return e.type==="backend"&&(this.modules.backend=e),(e.type==="logger"||e.log&&e.warn&&e.error)&&(this.modules.logger=e),e.type==="languageDetector"&&(this.modules.languageDetector=e),e.type==="i18nFormat"&&(this.modules.i18nFormat=e),e.type==="postProcessor"&&nG.addPostProcessor(e),e.type==="formatter"&&(this.modules.formatter=e),e.type==="3rdParty"&&this.modules.external.push(e),this}setResolvedLanguage(e){if(!(!e||!this.languages)&&!(["cimode","dev"].indexOf(e)>-1)){for(let n=0;n<this.languages.length;n++){const i=this.languages[n];if(!(["cimode","dev"].indexOf(i)>-1)&&this.store.hasLanguageSomeTranslations(i)){this.resolvedLanguage=i;break}}!this.resolvedLanguage&&this.languages.indexOf(e)<0&&this.store.hasLanguageSomeTranslations(e)&&(this.resolvedLanguage=e,this.languages.unshift(e))}}changeLanguage(e,n){this.isLanguageChangingTo=e;const i=wg();this.emit("languageChanging",e);const r=o=>{this.language=o,this.languages=this.services.languageUtils.toResolveHierarchy(o),this.resolvedLanguage=void 0,this.setResolvedLanguage(o)},a=(o,l)=>{l?this.isLanguageChangingTo===e&&(r(l),this.translator.changeLanguage(l),this.isLanguageChangingTo=void 0,this.emit("languageChanged",l),this.logger.log("languageChanged",l)):this.isLanguageChangingTo=void 0,i.resolve((...c)=>this.t(...c)),n&&n(o,(...c)=>this.t(...c))},s=o=>{!e&&!o&&this.services.languageDetector&&(o=[]);const l=Ht(o)?o:o&&o[0],c=this.store.hasLanguageSomeTranslations(l)?l:this.services.languageUtils.getBestMatchFromCodes(Ht(o)?[o]:o);c&&(this.language||r(c),this.translator.language||this.translator.changeLanguage(c),this.services.languageDetector?.cacheUserLanguage?.(c)),this.loadResources(c,d=>{a(d,c)})};return!e&&this.services.languageDetector&&!this.services.languageDetector.async?s(this.services.languageDetector.detect()):!e&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(s):this.services.languageDetector.detect(s):s(e),i}getFixedT(e,n,i){const r=(a,s,...o)=>{let l;typeof s!="object"?l=this.options.overloadTranslationOptionHandler([a,s].concat(o)):l={...s},l.lng=l.lng||r.lng,l.lngs=l.lngs||r.lngs,l.ns=l.ns||r.ns,l.keyPrefix!==""&&(l.keyPrefix=l.keyPrefix||i||r.keyPrefix);const c=this.options.keySeparator||".";let d;return l.keyPrefix&&Array.isArray(a)?d=a.map(f=>(typeof f=="function"&&(f=aN(f,{...this.options,...s})),`${l.keyPrefix}${c}${f}`)):(typeof a=="function"&&(a=aN(a,{...this.options,...s})),d=l.keyPrefix?`${l.keyPrefix}${c}${a}`:a),this.t(d,l)};return Ht(e)?r.lng=e:r.lngs=e,r.ns=n,r.keyPrefix=i,r}t(...e){return this.translator?.translate(...e)}exists(...e){return this.translator?.exists(...e)}setDefaultNamespace(e){this.options.defaultNS=e}hasLoadedNamespace(e,n={}){if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;const i=n.lng||this.resolvedLanguage||this.languages[0],r=this.options?this.options.fallbackLng:!1,a=this.languages[this.languages.length-1];if(i.toLowerCase()==="cimode")return!0;const s=(o,l)=>{const c=this.services.backendConnector.state[`${o}|${l}`];return c===-1||c===0||c===2};if(n.precheck){const o=n.precheck(this,s);if(o!==void 0)return o}return!!(this.hasResourceBundle(i,e)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||s(i,e)&&(!r||s(a,e)))}loadNamespaces(e,n){const i=wg();return this.options.ns?(Ht(e)&&(e=[e]),e.forEach(r=>{this.options.ns.indexOf(r)<0&&this.options.ns.push(r)}),this.loadResources(r=>{i.resolve(),n&&n(r)}),i):(n&&n(),Promise.resolve())}loadLanguages(e,n){const i=wg();Ht(e)&&(e=[e]);const r=this.options.preload||[],a=e.filter(s=>r.indexOf(s)<0&&this.services.languageUtils.isSupportedCode(s));return a.length?(this.options.preload=r.concat(a),this.loadResources(s=>{i.resolve(),n&&n(s)}),i):(n&&n(),Promise.resolve())}dir(e){if(e||(e=this.resolvedLanguage||(this.languages?.length>0?this.languages[0]:this.language)),!e)return"rtl";try{const r=new Intl.Locale(e);if(r&&r.getTextInfo){const a=r.getTextInfo();if(a&&a.direction)return a.direction}}catch{}const n=["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"],i=this.services?.languageUtils||new QU(ij());return e.toLowerCase().indexOf("-latn")>1?"ltr":n.indexOf(i.getLanguagePartFromCode(e))>-1||e.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(e={},n){const i=new o0(e,n);return i.createInstance=o0.createInstance,i}cloneInstance(e={},n=My){const i=e.forkResourceStore;i&&delete e.forkResourceStore;const r={...this.options,...e,isClone:!0},a=new o0(r);if((e.debug!==void 0||e.prefix!==void 0)&&(a.logger=a.logger.clone(e)),["store","services","language"].forEach(o=>{a[o]=this[o]}),a.services={...this.services},a.services.utils={hasLoadedNamespace:a.hasLoadedNamespace.bind(a)},i){const o=Object.keys(this.store.data).reduce((l,c)=>(l[c]={...this.store.data[c]},l[c]=Object.keys(l[c]).reduce((d,f)=>(d[f]={...l[c][f]},d),l[c]),l),{});a.store=new YU(o,r),a.services.resourceStore=a.store}return a.translator=new N_(a.services,r),a.translator.on("*",(o,...l)=>{a.emit(o,...l)}),a.init(r,n),a.translator.options=r,a.translator.backendConnector.services.utils={hasLoadedNamespace:a.hasLoadedNamespace.bind(a)},a}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}const wa=o0.createInstance();wa.createInstance;wa.dir;wa.init;wa.loadResources;wa.reloadResources;wa.use;wa.changeLanguage;wa.getFixedT;wa.t;wa.exists;wa.setDefaultNamespace;wa.hasLoadedNamespace;wa.loadNamespaces;wa.loadLanguages;const yne=(t,e,n,i)=>{const r=[n,{code:e,...i||{}}];if(t?.services?.logger?.forward)return t.services.logger.forward(r,"warn","react-i18next::",!0);vf(r[0])&&(r[0]=`react-i18next:: ${r[0]}`),t?.services?.logger?.warn?t.services.logger.warn(...r):console?.warn&&console.warn(...r)},aj={},rG=(t,e,n,i)=>{vf(n)&&aj[n]||(vf(n)&&(aj[n]=new Date),yne(t,e,n,i))},aG=(t,e)=>()=>{if(t.isInitialized)e();else{const n=()=>{setTimeout(()=>{t.off("initialized",n)},0),e()};t.on("initialized",n)}},sN=(t,e,n)=>{t.loadNamespaces(e,aG(t,n))},sj=(t,e,n,i)=>{if(vf(n)&&(n=[n]),t.options.preload&&t.options.preload.indexOf(e)>-1)return sN(t,n,i);n.forEach(r=>{t.options.ns.indexOf(r)<0&&t.options.ns.push(r)}),t.loadLanguages(e,aG(t,i))},bne=(t,e,n={})=>!e.languages||!e.languages.length?(rG(e,"NO_LANGUAGES","i18n.languages were undefined or empty",{languages:e.languages}),!0):e.hasLoadedNamespace(t,{lng:n.lng,precheck:(i,r)=>{if(n.bindI18n&&n.bindI18n.indexOf("languageChanging")>-1&&i.services.backendConnector.backend&&i.isLanguageChangingTo&&!r(i.isLanguageChangingTo,t))return!1}}),vf=t=>typeof t=="string",_ne=t=>typeof t=="object"&&t!==null,Sne=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,wne={"&amp;":"&","&#38;":"&","&lt;":"<","&#60;":"<","&gt;":">","&#62;":">","&apos;":"'","&#39;":"'","&quot;":'"',"&#34;":'"',"&nbsp;":" ","&#160;":" ","&copy;":"©","&#169;":"©","&reg;":"®","&#174;":"®","&hellip;":"…","&#8230;":"…","&#x2F;":"/","&#47;":"/"},Mne=t=>wne[t],Ene=t=>t.replace(Sne,Mne);let oN={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:Ene};const Ane=(t={})=>{oN={...oN,...t}},Tne=()=>oN;let sG;const Cne=t=>{sG=t},Nne=()=>sG,Rne={type:"3rdParty",init(t){Ane(t.options.react),Cne(t)}},Pne=E.createContext();class Dne{constructor(){this.usedNamespaces={}}addUsedNamespaces(e){e.forEach(n=>{this.usedNamespaces[n]||(this.usedNamespaces[n]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}}var _A={exports:{}},SA={};var oj;function kne(){if(oj)return SA;oj=1;var t=lm();function e(f,m){return f===m&&(f!==0||1/f===1/m)||f!==f&&m!==m}var n=typeof Object.is=="function"?Object.is:e,i=t.useState,r=t.useEffect,a=t.useLayoutEffect,s=t.useDebugValue;function o(f,m){var g=m(),y=i({inst:{value:g,getSnapshot:m}}),_=y[0].inst,v=y[1];return a(function(){_.value=g,_.getSnapshot=m,l(_)&&v({inst:_})},[f,g,m]),r(function(){return l(_)&&v({inst:_}),f(function(){l(_)&&v({inst:_})})},[f]),s(g),g}function l(f){var m=f.getSnapshot;f=f.value;try{var g=m();return!n(f,g)}catch{return!0}}function c(f,m){return m()}var d=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?c:o;return SA.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:d,SA}var lj;function oG(){return lj||(lj=1,_A.exports=kne()),_A.exports}var pP=oG();const One=(t,e)=>vf(e)?e:_ne(e)&&vf(e.defaultValue)?e.defaultValue:Array.isArray(t)?t[t.length-1]:t,Lne={t:One,ready:!1},Ine=()=>()=>{},mP=(t,e={})=>{const{i18n:n}=e,{i18n:i,defaultNS:r}=E.useContext(Pne)||{},a=n||i||Nne();a&&!a.reportNamespaces&&(a.reportNamespaces=new Dne),a||rG(a,"NO_I18NEXT_INSTANCE","useTranslation: You will need to pass in an i18next instance by using initReactI18next");const s=E.useMemo(()=>({...Tne(),...a?.options?.react,...e}),[a,e]),{useSuspense:o,keyPrefix:l}=s,c=r||a?.options?.defaultNS,d=vf(c)?[c]:c||["translation"],f=E.useMemo(()=>d,d);a?.reportNamespaces?.addUsedNamespaces?.(f);const m=E.useRef(0),g=E.useCallback(N=>{if(!a)return Ine;const{bindI18n:D,bindI18nStore:F}=s,I=()=>{m.current+=1,N()};return D&&a.on(D,I),F&&a.store.on(F,I),()=>{D&&D.split(" ").forEach(W=>a.off(W,I)),F&&F.split(" ").forEach(W=>a.store.off(W,I))}},[a,s]),y=E.useRef(),_=E.useCallback(()=>{if(!a)return Lne;const N=!!(a.isInitialized||a.initializedStoreOnce)&&f.every(B=>bne(B,a,s)),D=e.lng||a.language,F=m.current,I=y.current;if(I&&I.ready===N&&I.lng===D&&I.keyPrefix===l&&I.revision===F)return I;const O={t:a.getFixedT(D,s.nsMode==="fallback"?f:f[0],l),ready:N,lng:D,keyPrefix:l,revision:F};return y.current=O,O},[a,f,l,s,e.lng]),[v,x]=E.useState(0),{t:M,ready:w}=pP.useSyncExternalStore(g,_,_);E.useEffect(()=>{if(a&&!w&&!o){const N=()=>x(D=>D+1);e.lng?sj(a,e.lng,f,N):sN(a,f,N)}},[a,e.lng,f,w,o,v]);const T=a||{},C=E.useRef(null),P=E.useRef(),A=N=>{const D=Object.getOwnPropertyDescriptors(N);D.__original&&delete D.__original;const F=Object.create(Object.getPrototypeOf(N),D);if(!Object.prototype.hasOwnProperty.call(F,"__original"))try{Object.defineProperty(F,"__original",{value:N,writable:!1,enumerable:!1,configurable:!1})}catch{}return F},U=E.useMemo(()=>{const N=T,D=N?.language;let F=N;N&&(C.current&&C.current.__original===N?P.current!==D?(F=A(N),C.current=F,P.current=D):F=C.current:(F=A(N),C.current=F,P.current=D));const I=[M,F,w];return I.t=M,I.i18n=F,I.ready=w,I},[M,T,w,T.resolvedLanguage,T.language,T.languages]);if(a&&o&&!w)throw new Promise(N=>{const D=()=>N();e.lng?sj(a,e.lng,f,D):sN(a,f,D)});return U},{slice:Une,forEach:jne}=[];function Fne(t){return jne.call(Une.call(arguments,1),e=>{if(e)for(const n in e)t[n]===void 0&&(t[n]=e[n])}),t}function zne(t){return typeof t!="string"?!1:[/<\s*script.*?>/i,/<\s*\/\s*script\s*>/i,/<\s*img.*?on\w+\s*=/i,/<\s*\w+\s*on\w+\s*=.*?>/i,/javascript\s*:/i,/vbscript\s*:/i,/expression\s*\(/i,/eval\s*\(/i,/alert\s*\(/i,/document\.cookie/i,/document\.write\s*\(/i,/window\.location/i,/innerHTML/i].some(n=>n.test(t))}const cj=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/,Bne=function(t,e){const i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{path:"/"},r=encodeURIComponent(e);let a=`${t}=${r}`;if(i.maxAge>0){const s=i.maxAge-0;if(Number.isNaN(s))throw new Error("maxAge should be a Number");a+=`; Max-Age=${Math.floor(s)}`}if(i.domain){if(!cj.test(i.domain))throw new TypeError("option domain is invalid");a+=`; Domain=${i.domain}`}if(i.path){if(!cj.test(i.path))throw new TypeError("option path is invalid");a+=`; Path=${i.path}`}if(i.expires){if(typeof i.expires.toUTCString!="function")throw new TypeError("option expires is invalid");a+=`; Expires=${i.expires.toUTCString()}`}if(i.httpOnly&&(a+="; HttpOnly"),i.secure&&(a+="; Secure"),i.sameSite)switch(typeof i.sameSite=="string"?i.sameSite.toLowerCase():i.sameSite){case!0:a+="; SameSite=Strict";break;case"lax":a+="; SameSite=Lax";break;case"strict":a+="; SameSite=Strict";break;case"none":a+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}return i.partitioned&&(a+="; Partitioned"),a},uj={create(t,e,n,i){let r=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{path:"/",sameSite:"strict"};n&&(r.expires=new Date,r.expires.setTime(r.expires.getTime()+n*60*1e3)),i&&(r.domain=i),document.cookie=Bne(t,e,r)},read(t){const e=`${t}=`,n=document.cookie.split(";");for(let i=0;i<n.length;i++){let r=n[i];for(;r.charAt(0)===" ";)r=r.substring(1,r.length);if(r.indexOf(e)===0)return r.substring(e.length,r.length)}return null},remove(t,e){this.create(t,"",-1,e)}};var Hne={name:"cookie",lookup(t){let{lookupCookie:e}=t;if(e&&typeof document<"u")return uj.read(e)||void 0},cacheUserLanguage(t,e){let{lookupCookie:n,cookieMinutes:i,cookieDomain:r,cookieOptions:a}=e;n&&typeof document<"u"&&uj.create(n,t,i,r,a)}},Vne={name:"querystring",lookup(t){let{lookupQuerystring:e}=t,n;if(typeof window<"u"){let{search:i}=window.location;!window.location.search&&window.location.hash?.indexOf("?")>-1&&(i=window.location.hash.substring(window.location.hash.indexOf("?")));const a=i.substring(1).split("&");for(let s=0;s<a.length;s++){const o=a[s].indexOf("=");o>0&&a[s].substring(0,o)===e&&(n=a[s].substring(o+1))}}return n}},$ne={name:"hash",lookup(t){let{lookupHash:e,lookupFromHashIndex:n}=t,i;if(typeof window<"u"){const{hash:r}=window.location;if(r&&r.length>2){const a=r.substring(1);if(e){const s=a.split("&");for(let o=0;o<s.length;o++){const l=s[o].indexOf("=");l>0&&s[o].substring(0,l)===e&&(i=s[o].substring(l+1))}}if(i)return i;if(!i&&n>-1){const s=r.match(/\/([a-zA-Z-]*)/g);return Array.isArray(s)?s[typeof n=="number"?n:0]?.replace("/",""):void 0}}}return i}};let Mh=null;const dj=()=>{if(Mh!==null)return Mh;try{if(Mh=typeof window<"u"&&window.localStorage!==null,!Mh)return!1;const t="i18next.translate.boo";window.localStorage.setItem(t,"foo"),window.localStorage.removeItem(t)}catch{Mh=!1}return Mh};var Gne={name:"localStorage",lookup(t){let{lookupLocalStorage:e}=t;if(e&&dj())return window.localStorage.getItem(e)||void 0},cacheUserLanguage(t,e){let{lookupLocalStorage:n}=e;n&&dj()&&window.localStorage.setItem(n,t)}};let Eh=null;const fj=()=>{if(Eh!==null)return Eh;try{if(Eh=typeof window<"u"&&window.sessionStorage!==null,!Eh)return!1;const t="i18next.translate.boo";window.sessionStorage.setItem(t,"foo"),window.sessionStorage.removeItem(t)}catch{Eh=!1}return Eh};var Wne={name:"sessionStorage",lookup(t){let{lookupSessionStorage:e}=t;if(e&&fj())return window.sessionStorage.getItem(e)||void 0},cacheUserLanguage(t,e){let{lookupSessionStorage:n}=e;n&&fj()&&window.sessionStorage.setItem(n,t)}},qne={name:"navigator",lookup(t){const e=[];if(typeof navigator<"u"){const{languages:n,userLanguage:i,language:r}=navigator;if(n)for(let a=0;a<n.length;a++)e.push(n[a]);i&&e.push(i),r&&e.push(r)}return e.length>0?e:void 0}},Xne={name:"htmlTag",lookup(t){let{htmlTag:e}=t,n;const i=e||(typeof document<"u"?document.documentElement:null);return i&&typeof i.getAttribute=="function"&&(n=i.getAttribute("lang")),n}},Kne={name:"path",lookup(t){let{lookupFromPathIndex:e}=t;if(typeof window>"u")return;const n=window.location.pathname.match(/\/([a-zA-Z-]*)/g);return Array.isArray(n)?n[typeof e=="number"?e:0]?.replace("/",""):void 0}},Yne={name:"subdomain",lookup(t){let{lookupFromSubdomainIndex:e}=t;const n=typeof e=="number"?e+1:1,i=typeof window<"u"&&window.location?.hostname?.match(/^(\w{2,5})\.(([a-z0-9-]{1,63}\.[a-z]{2,6})|localhost)/i);if(i)return i[n]}};let lG=!1;try{document.cookie,lG=!0}catch{}const cG=["querystring","cookie","localStorage","sessionStorage","navigator","htmlTag"];lG||cG.splice(1,1);const Zne=()=>({order:cG,lookupQuerystring:"lng",lookupCookie:"i18next",lookupLocalStorage:"i18nextLng",lookupSessionStorage:"i18nextLng",caches:["localStorage"],excludeCacheFor:["cimode"],convertDetectedLanguage:t=>t});class uG{constructor(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.type="languageDetector",this.detectors={},this.init(e,n)}init(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{languageUtils:{}},n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};this.services=e,this.options=Fne(n,this.options||{},Zne()),typeof this.options.convertDetectedLanguage=="string"&&this.options.convertDetectedLanguage.indexOf("15897")>-1&&(this.options.convertDetectedLanguage=r=>r.replace("-","_")),this.options.lookupFromUrlIndex&&(this.options.lookupFromPathIndex=this.options.lookupFromUrlIndex),this.i18nOptions=i,this.addDetector(Hne),this.addDetector(Vne),this.addDetector(Gne),this.addDetector(Wne),this.addDetector(qne),this.addDetector(Xne),this.addDetector(Kne),this.addDetector(Yne),this.addDetector($ne)}addDetector(e){return this.detectors[e.name]=e,this}detect(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.options.order,n=[];return e.forEach(i=>{if(this.detectors[i]){let r=this.detectors[i].lookup(this.options);r&&typeof r=="string"&&(r=[r]),r&&(n=n.concat(r))}}),n=n.filter(i=>i!=null&&!zne(i)).map(i=>this.options.convertDetectedLanguage(i)),this.services&&this.services.languageUtils&&this.services.languageUtils.getBestMatchFromCodes?n:n.length>0?n[0]:null}cacheUserLanguage(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.options.caches;n&&(this.options.excludeCacheFor&&this.options.excludeCacheFor.indexOf(e)>-1||n.forEach(i=>{this.detectors[i]&&this.detectors[i].cacheUserLanguage(e,this.options)}))}}uG.type="languageDetector";const Qne={nav:{printers:"Printers",archives:"Archives",queue:"Queue",stats:"Statistics",profiles:"Profiles",maintenance:"Maintenance",settings:"Settings",collapseSidebar:"Collapse sidebar",expandSidebar:"Expand sidebar",update:"Update",updateAvailable:"Update available: v{{version}}",viewOnGithub:"View on GitHub",keyboardShortcuts:"Keyboard shortcuts (?)",switchToLight:"Switch to light mode",switchToDark:"Switch to dark mode"},common:{save:"Save",cancel:"Cancel",delete:"Delete",edit:"Edit",add:"Add",close:"Close",confirm:"Confirm",loading:"Loading...",error:"Error",success:"Success",warning:"Warning",enabled:"Enabled",disabled:"Disabled",yes:"Yes",no:"No",on:"On",off:"Off",all:"All",none:"None",search:"Search",filter:"Filter",sort:"Sort",refresh:"Refresh",download:"Download",upload:"Upload",actions:"Actions",status:"Status",name:"Name",description:"Description",date:"Date",time:"Time",hours:"hours",minutes:"minutes",seconds:"seconds",noPrinters:"No printers configured",noData:"No data available",required:"Required",optional:"Optional"},printers:{title:"Printers",addPrinter:"Add Printer",editPrinter:"Edit Printer",deletePrinter:"Delete Printer",printerName:"Printer Name",serialNumber:"Serial Number",ipAddress:"IP Address",accessCode:"Access Code",model:"Model",nozzleCount:"Nozzle Count",autoArchive:"Auto Archive",status:{idle:"Idle",printing:"Printing",paused:"Paused",offline:"Offline",error:"Error",finished:"Finished",unknown:"Unknown"},temperatures:{nozzle:"Nozzle",bed:"Bed",chamber:"Chamber"},progress:"{{percent}}% complete",timeRemaining:"{{time}} remaining",deleteConfirm:'Are you sure you want to delete "{{name}}"?',maintenanceOk:"Maintenance OK",maintenanceWarning:"{{count}} warning",maintenanceWarning_plural:"{{count}} warnings",maintenanceDue:"{{count}} due",maintenanceDue_plural:"{{count}} due"},archives:{title:"Print Archives",searchPlaceholder:"Search archives...",filterByPrinter:"Filter by printer",filterByStatus:"Filter by status",sortBy:"Sort by",sortNewest:"Newest first",sortOldest:"Oldest first",sortName:"Name",sortDuration:"Duration",noArchives:"No archives found",printTime:"Print Time",filamentUsed:"Filament Used",cost:"Cost",reprint:"Reprint",preview:"Preview",deleteArchive:"Delete Archive",deleteConfirm:"Are you sure you want to delete this archive?",favorite:"Favorite",unfavorite:"Remove from favorites",viewDetails:"View Details",status:{completed:"Completed",failed:"Failed",stopped:"Stopped"}},queue:{title:"Print Queue",addToQueue:"Add to Queue",clearQueue:"Clear Queue",emptyQueue:"Queue is empty",position:"Position",scheduledTime:"Scheduled Time",moveUp:"Move Up",moveDown:"Move Down",remove:"Remove",startNow:"Start Now",status:{pending:"Pending",printing:"Printing",completed:"Completed",failed:"Failed",cancelled:"Cancelled"}},stats:{title:"Statistics",overview:"Overview",totalPrints:"Total Prints",successRate:"Success Rate",totalPrintTime:"Total Print Time",totalFilament:"Total Filament Used",totalCost:"Total Cost",averagePrintTime:"Average Print Time",printsPerDay:"Prints per Day",byPrinter:"By Printer",byMaterial:"By Material",byMonth:"By Month",last7Days:"Last 7 Days",last30Days:"Last 30 Days",last90Days:"Last 90 Days",allTime:"All Time"},profiles:{title:"Filament Profiles",addProfile:"Add Profile",editProfile:"Edit Profile",deleteProfile:"Delete Profile",material:"Material",brand:"Brand",color:"Color",diameter:"Diameter",density:"Density",costPerKg:"Cost per kg",spoolWeight:"Spool Weight",noProfiles:"No profiles configured",deleteConfirm:"Are you sure you want to delete this profile?"},maintenance:{title:"Maintenance",overview:"Overview",allOk:"All maintenance up to date",dueCount:"{{count}} item due",dueCount_plural:"{{count}} items due",warningCount:"{{count}} warning",warningCount_plural:"{{count}} warnings",totalPrintTime:"Total Print Time",nextMaintenance:"Next Maintenance",nothingDue:"Nothing due",tasks:"Tasks",lastPerformed:"Last performed",interval:"Interval",hoursRemaining:"{{hours}}h remaining",hoursOverdue:"{{hours}}h overdue",markDone:"Mark as Done",performMaintenance:"Perform Maintenance",history:"History",noHistory:"No maintenance history",editPrintHours:"Edit Print Hours",currentHours:"Current Hours",types:{lubricateRails:"Lubricate Linear Rails",cleanNozzle:"Clean Nozzle/Hotend",checkBelts:"Check Belt Tension",cleanBuildPlate:"Clean Build Plate",checkExtruder:"Check Extruder Gears",checkCooling:"Check Cooling Fans",generalInspection:"General Inspection"}},settings:{title:"Settings",general:"General",appearance:"Appearance",notifications:"Notifications",smartPlugs:"Smart Plugs",spoolman:"Spoolman",updates:"Updates",language:"Language",languageDescription:"Select your preferred language",theme:"Theme",themeLight:"Light",themeDark:"Dark",themeSystem:"System",defaultView:"Default View",defaultViewDescription:"Page to show when opening the app",checkForUpdates:"Check for Updates",autoUpdate:"Auto Update",currentVersion:"Current Version",latestVersion:"Latest Version",upToDate:"You are up to date",updateAvailable:"Update available",notificationLanguage:"Notification Language",notificationLanguageDescription:"Language for push notifications",notificationProviders:"Notification Providers",addProvider:"Add Provider",editProvider:"Edit Provider",providerType:"Provider Type",testNotification:"Test Notification",testSuccess:"Test notification sent successfully",testFailed:"Failed to send test notification",quietHours:"Quiet Hours",quietHoursDescription:"Do not disturb during these hours",quietHoursStart:"Start",quietHoursEnd:"End",events:{title:"Notification Events",printStart:"Print Started",printComplete:"Print Completed",printFailed:"Print Failed",printStopped:"Print Stopped",printProgress:"Progress Milestones",printProgressDescription:"Notify at 25%, 50%, 75%",printerOffline:"Printer Offline",printerError:"Printer Error",filamentLow:"Low Filament",maintenanceDue:"Maintenance Due",maintenanceDueDescription:"Notify when maintenance is needed"},smartPlug:{title:"Smart Plugs",add:"Add Smart Plug",edit:"Edit Smart Plug",name:"Name",ipAddress:"IP Address",linkedPrinter:"Linked Printer",autoOn:"Auto Power On",autoOnDescription:"Turn on when print starts",autoOff:"Auto Power Off",autoOffDescription:"Turn off after print completes",offDelay:"Off Delay",offDelayMinutes:"Minutes after print",offDelayTemp:"When nozzle below temperature",currentState:"Current State",turnOn:"Turn On",turnOff:"Turn Off"},spoolmanEnabled:"Enable Spoolman Integration",spoolmanUrl:"Spoolman URL",spoolmanConnected:"Connected",spoolmanDisconnected:"Disconnected"},notification:{printStarted:{title:"Print Started",body:"{{printer}}: {{filename}} has started printing"},printCompleted:{title:"Print Completed",body:"{{printer}}: {{filename}} completed successfully"},printFailed:{title:"Print Failed",body:"{{printer}}: {{filename}} has failed"},printStopped:{title:"Print Stopped",body:"{{printer}}: {{filename}} was stopped"},printProgress:{title:"Print Progress",body:"{{printer}}: {{filename}} is {{percent}}% complete"},printerOffline:{title:"Printer Offline",body:"{{printer}} is offline"},printerError:{title:"Printer Error",body:"{{printer}}: {{error}}"},filamentLow:{title:"Low Filament",body:"{{printer}}: Filament is running low"},maintenanceDue:{title:"Maintenance Due",body:"{{printer}}: {{items}} need attention"}},errors:{generic:"Something went wrong",networkError:"Network error. Please check your connection.",notFound:"Not found",unauthorized:"Unauthorized",serverError:"Server error",validationError:"Please check your input",printerConnectionFailed:"Failed to connect to printer",saveFailed:"Failed to save changes",deleteFailed:"Failed to delete",loadFailed:"Failed to load data"},confirm:{delete:"Are you sure you want to delete this?",unsavedChanges:"You have unsaved changes. Are you sure you want to leave?",clearQueue:"Are you sure you want to clear the queue?"}},Jne={nav:{printers:"Drucker",archives:"Archiv",queue:"Warteschlange",stats:"Statistiken",profiles:"Profile",maintenance:"Wartung",settings:"Einstellungen",collapseSidebar:"Seitenleiste einklappen",expandSidebar:"Seitenleiste ausklappen",update:"Update",updateAvailable:"Update verfügbar: v{{version}}",viewOnGithub:"Auf GitHub ansehen",keyboardShortcuts:"Tastaturkürzel (?)",switchToLight:"Zum hellen Modus wechseln",switchToDark:"Zum dunklen Modus wechseln"},common:{save:"Speichern",cancel:"Abbrechen",delete:"Löschen",edit:"Bearbeiten",add:"Hinzufügen",close:"Schließen",confirm:"Bestätigen",loading:"Lädt...",error:"Fehler",success:"Erfolg",warning:"Warnung",enabled:"Aktiviert",disabled:"Deaktiviert",yes:"Ja",no:"Nein",on:"An",off:"Aus",all:"Alle",none:"Keine",search:"Suchen",filter:"Filtern",sort:"Sortieren",refresh:"Aktualisieren",download:"Herunterladen",upload:"Hochladen",actions:"Aktionen",status:"Status",name:"Name",description:"Beschreibung",date:"Datum",time:"Zeit",hours:"Stunden",minutes:"Minuten",seconds:"Sekunden",noPrinters:"Keine Drucker konfiguriert",noData:"Keine Daten verfügbar",required:"Erforderlich",optional:"Optional"},printers:{title:"Drucker",addPrinter:"Drucker hinzufügen",editPrinter:"Drucker bearbeiten",deletePrinter:"Drucker löschen",printerName:"Druckername",serialNumber:"Seriennummer",ipAddress:"IP-Adresse",accessCode:"Zugangscode",model:"Modell",nozzleCount:"Düsenanzahl",autoArchive:"Automatische Archivierung",status:{idle:"Bereit",printing:"Druckt",paused:"Pausiert",offline:"Offline",error:"Fehler",finished:"Fertig",unknown:"Unbekannt"},temperatures:{nozzle:"Düse",bed:"Druckbett",chamber:"Kammer"},progress:"{{percent}}% abgeschlossen",timeRemaining:"Noch {{time}}",deleteConfirm:'Möchten Sie "{{name}}" wirklich löschen?',maintenanceOk:"Wartung OK",maintenanceWarning:"{{count}} Warnung",maintenanceWarning_plural:"{{count}} Warnungen",maintenanceDue:"{{count}} fällig",maintenanceDue_plural:"{{count}} fällig"},archives:{title:"Druckarchiv",searchPlaceholder:"Archiv durchsuchen...",filterByPrinter:"Nach Drucker filtern",filterByStatus:"Nach Status filtern",sortBy:"Sortieren nach",sortNewest:"Neueste zuerst",sortOldest:"Älteste zuerst",sortName:"Name",sortDuration:"Dauer",noArchives:"Keine Archive gefunden",printTime:"Druckzeit",filamentUsed:"Verbrauchtes Filament",cost:"Kosten",reprint:"Erneut drucken",preview:"Vorschau",deleteArchive:"Archiv löschen",deleteConfirm:"Möchten Sie dieses Archiv wirklich löschen?",favorite:"Favorit",unfavorite:"Aus Favoriten entfernen",viewDetails:"Details anzeigen",status:{completed:"Abgeschlossen",failed:"Fehlgeschlagen",stopped:"Gestoppt"}},queue:{title:"Druckwarteschlange",addToQueue:"Zur Warteschlange hinzufügen",clearQueue:"Warteschlange leeren",emptyQueue:"Warteschlange ist leer",position:"Position",scheduledTime:"Geplante Zeit",moveUp:"Nach oben",moveDown:"Nach unten",remove:"Entfernen",startNow:"Jetzt starten",status:{pending:"Ausstehend",printing:"Druckt",completed:"Abgeschlossen",failed:"Fehlgeschlagen",cancelled:"Abgebrochen"}},stats:{title:"Statistiken",overview:"Übersicht",totalPrints:"Gesamtdrucke",successRate:"Erfolgsrate",totalPrintTime:"Gesamtdruckzeit",totalFilament:"Gesamtverbrauch Filament",totalCost:"Gesamtkosten",averagePrintTime:"Durchschnittliche Druckzeit",printsPerDay:"Drucke pro Tag",byPrinter:"Nach Drucker",byMaterial:"Nach Material",byMonth:"Nach Monat",last7Days:"Letzte 7 Tage",last30Days:"Letzte 30 Tage",last90Days:"Letzte 90 Tage",allTime:"Gesamt"},profiles:{title:"Filament-Profile",addProfile:"Profil hinzufügen",editProfile:"Profil bearbeiten",deleteProfile:"Profil löschen",material:"Material",brand:"Marke",color:"Farbe",diameter:"Durchmesser",density:"Dichte",costPerKg:"Kosten pro kg",spoolWeight:"Spulengewicht",noProfiles:"Keine Profile konfiguriert",deleteConfirm:"Möchten Sie dieses Profil wirklich löschen?"},maintenance:{title:"Wartung",overview:"Übersicht",allOk:"Alle Wartungen aktuell",dueCount:"{{count}} Aufgabe fällig",dueCount_plural:"{{count}} Aufgaben fällig",warningCount:"{{count}} Warnung",warningCount_plural:"{{count}} Warnungen",totalPrintTime:"Gesamtdruckzeit",nextMaintenance:"Nächste Wartung",nothingDue:"Nichts fällig",tasks:"Aufgaben",lastPerformed:"Zuletzt durchgeführt",interval:"Intervall",hoursRemaining:"{{hours}}h verbleibend",hoursOverdue:"{{hours}}h überfällig",markDone:"Als erledigt markieren",performMaintenance:"Wartung durchführen",history:"Verlauf",noHistory:"Kein Wartungsverlauf",editPrintHours:"Druckstunden bearbeiten",currentHours:"Aktuelle Stunden",types:{lubricateRails:"Linearschienen schmieren",cleanNozzle:"Düse/Hotend reinigen",checkBelts:"Riemenspannung prüfen",cleanBuildPlate:"Druckbett reinigen",checkExtruder:"Extruderzahnräder prüfen",checkCooling:"Kühlungslüfter prüfen",generalInspection:"Allgemeine Inspektion"}},settings:{title:"Einstellungen",general:"Allgemein",appearance:"Erscheinungsbild",notifications:"Benachrichtigungen",smartPlugs:"Smart Plugs",spoolman:"Spoolman",updates:"Updates",language:"Sprache",languageDescription:"Wählen Sie Ihre bevorzugte Sprache",theme:"Design",themeLight:"Hell",themeDark:"Dunkel",themeSystem:"System",defaultView:"Standardansicht",defaultViewDescription:"Seite, die beim Öffnen der App angezeigt wird",checkForUpdates:"Nach Updates suchen",autoUpdate:"Automatische Updates",currentVersion:"Aktuelle Version",latestVersion:"Neueste Version",upToDate:"Sie sind auf dem neuesten Stand",updateAvailable:"Update verfügbar",notificationLanguage:"Benachrichtigungssprache",notificationLanguageDescription:"Sprache für Push-Benachrichtigungen",notificationProviders:"Benachrichtigungsanbieter",addProvider:"Anbieter hinzufügen",editProvider:"Anbieter bearbeiten",providerType:"Anbietertyp",testNotification:"Testbenachrichtigung",testSuccess:"Testbenachrichtigung erfolgreich gesendet",testFailed:"Testbenachrichtigung konnte nicht gesendet werden",quietHours:"Ruhezeiten",quietHoursDescription:"Keine Störungen während dieser Zeiten",quietHoursStart:"Beginn",quietHoursEnd:"Ende",events:{title:"Benachrichtigungsereignisse",printStart:"Druck gestartet",printComplete:"Druck abgeschlossen",printFailed:"Druck fehlgeschlagen",printStopped:"Druck gestoppt",printProgress:"Fortschrittsmeldungen",printProgressDescription:"Bei 25%, 50%, 75% benachrichtigen",printerOffline:"Drucker offline",printerError:"Druckerfehler",filamentLow:"Filament niedrig",maintenanceDue:"Wartung fällig",maintenanceDueDescription:"Benachrichtigen, wenn Wartung erforderlich"},smartPlug:{title:"Smart Plugs",add:"Smart Plug hinzufügen",edit:"Smart Plug bearbeiten",name:"Name",ipAddress:"IP-Adresse",linkedPrinter:"Verknüpfter Drucker",autoOn:"Automatisch einschalten",autoOnDescription:"Einschalten beim Druckstart",autoOff:"Automatisch ausschalten",autoOffDescription:"Ausschalten nach Druckende",offDelay:"Ausschaltverzögerung",offDelayMinutes:"Minuten nach Druck",offDelayTemp:"Wenn Düse unter Temperatur",currentState:"Aktueller Status",turnOn:"Einschalten",turnOff:"Ausschalten"},spoolmanEnabled:"Spoolman-Integration aktivieren",spoolmanUrl:"Spoolman URL",spoolmanConnected:"Verbunden",spoolmanDisconnected:"Nicht verbunden"},notification:{printStarted:{title:"Druck gestartet",body:"{{printer}}: {{filename}} wird gedruckt"},printCompleted:{title:"Druck abgeschlossen",body:"{{printer}}: {{filename}} erfolgreich abgeschlossen"},printFailed:{title:"Druck fehlgeschlagen",body:"{{printer}}: {{filename}} ist fehlgeschlagen"},printStopped:{title:"Druck gestoppt",body:"{{printer}}: {{filename}} wurde gestoppt"},printProgress:{title:"Druckfortschritt",body:"{{printer}}: {{filename}} ist zu {{percent}}% abgeschlossen"},printerOffline:{title:"Drucker offline",body:"{{printer}} ist offline"},printerError:{title:"Druckerfehler",body:"{{printer}}: {{error}}"},filamentLow:{title:"Filament niedrig",body:"{{printer}}: Filament geht zur Neige"},maintenanceDue:{title:"Wartung fällig",body:"{{printer}}: {{items}} benötigen Aufmerksamkeit"}},errors:{generic:"Etwas ist schiefgelaufen",networkError:"Netzwerkfehler. Bitte überprüfen Sie Ihre Verbindung.",notFound:"Nicht gefunden",unauthorized:"Nicht autorisiert",serverError:"Serverfehler",validationError:"Bitte überprüfen Sie Ihre Eingabe",printerConnectionFailed:"Verbindung zum Drucker fehlgeschlagen",saveFailed:"Speichern fehlgeschlagen",deleteFailed:"Löschen fehlgeschlagen",loadFailed:"Laden der Daten fehlgeschlagen"},confirm:{delete:"Möchten Sie dies wirklich löschen?",unsavedChanges:"Sie haben ungespeicherte Änderungen. Möchten Sie wirklich verlassen?",clearQueue:"Möchten Sie die Warteschlange wirklich leeren?"}},eie={en:{translation:Qne},de:{translation:Jne}};wa.use(uG).use(Rne).init({resources:eie,fallbackLng:"en",supportedLngs:["en","de"],detection:{order:["localStorage","navigator","htmlTag"],lookupLocalStorage:"bambutrack_language",caches:["localStorage"]},interpolation:{escapeValue:!1},react:{useSuspense:!1}});const hj=[{code:"en",name:"English",nativeName:"English"},{code:"de",name:"German",nativeName:"Deutsch"}];var pj="popstate";function tie(t={}){function e(i,r){let{pathname:a,search:s,hash:o}=i.location;return lN("",{pathname:a,search:s,hash:o},r.state&&r.state.usr||null,r.state&&r.state.key||"default")}function n(i,r){return typeof r=="string"?r:P0(r)}return iie(e,n,null,t)}function mi(t,e){if(t===!1||t===null||typeof t>"u")throw new Error(e)}function bo(t,e){if(!t){typeof console<"u"&&console.warn(e);try{throw new Error(e)}catch{}}}function nie(){return Math.random().toString(36).substring(2,10)}function mj(t,e){return{usr:t.state,key:t.key,idx:e}}function lN(t,e,n=null,i){return{pathname:typeof t=="string"?t:t.pathname,search:"",hash:"",...typeof e=="string"?cm(e):e,state:n,key:e&&e.key||i||nie()}}function P0({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 cm(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 iie(t,e,n,i={}){let{window:r=document.defaultView,v5Compat:a=!1}=i,s=r.history,o="POP",l=null,c=d();c==null&&(c=0,s.replaceState({...s.state,idx:c},""));function d(){return(s.state||{idx:null}).idx}function f(){o="POP";let v=d(),x=v==null?null:v-c;c=v,l&&l({action:o,location:_.location,delta:x})}function m(v,x){o="PUSH";let M=lN(_.location,v,x);c=d()+1;let w=mj(M,c),T=_.createHref(M);try{s.pushState(w,"",T)}catch(C){if(C instanceof DOMException&&C.name==="DataCloneError")throw C;r.location.assign(T)}a&&l&&l({action:o,location:_.location,delta:1})}function g(v,x){o="REPLACE";let M=lN(_.location,v,x);c=d();let w=mj(M,c),T=_.createHref(M);s.replaceState(w,"",T),a&&l&&l({action:o,location:_.location,delta:0})}function y(v){return rie(v)}let _={get action(){return o},get location(){return t(r,s)},listen(v){if(l)throw new Error("A history only accepts one active listener");return r.addEventListener(pj,f),l=v,()=>{r.removeEventListener(pj,f),l=null}},createHref(v){return e(r,v)},createURL:y,encodeLocation(v){let x=y(v);return{pathname:x.pathname,search:x.search,hash:x.hash}},push:m,replace:g,go(v){return s.go(v)}};return _}function rie(t,e=!1){let n="http://localhost";typeof window<"u"&&(n=window.location.origin!=="null"?window.location.origin:window.location.href),mi(n,"No window.location.(origin|href) available to create URL");let i=typeof t=="string"?t:P0(t);return i=i.replace(/ $/,"%20"),!e&&i.startsWith("//")&&(i=n+i),new URL(i,n)}function dG(t,e,n="/"){return aie(t,e,n,!1)}function aie(t,e,n,i){let r=typeof e=="string"?cm(e):e,a=cc(r.pathname||"/",n);if(a==null)return null;let s=fG(t);sie(s);let o=null;for(let l=0;o==null&&l<s.length;++l){let c=xie(a);o=mie(s[l],c,i)}return o}function fG(t,e=[],n=[],i="",r=!1){let a=(s,o,l=r,c)=>{let d={relativePath:c===void 0?s.path||"":c,caseSensitive:s.caseSensitive===!0,childrenIndex:o,route:s};if(d.relativePath.startsWith("/")){if(!d.relativePath.startsWith(i)&&l)return;mi(d.relativePath.startsWith(i),`Absolute route path "${d.relativePath}" nested under path "${i}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),d.relativePath=d.relativePath.slice(i.length)}let f=tc([i,d.relativePath]),m=n.concat(d);s.children&&s.children.length>0&&(mi(s.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${f}".`),fG(s.children,e,m,f,l)),!(s.path==null&&!s.index)&&e.push({path:f,score:hie(f,s.index),routesMeta:m})};return t.forEach((s,o)=>{if(s.path===""||!s.path?.includes("?"))a(s,o);else for(let l of hG(s.path))a(s,o,!0,l)}),e}function hG(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=hG(i.join("/")),o=[];return o.push(...s.map(l=>l===""?a:[a,l].join("/"))),r&&o.push(...s),o.map(l=>t.startsWith("/")&&l===""?"/":l)}function sie(t){t.sort((e,n)=>e.score!==n.score?n.score-e.score:pie(e.routesMeta.map(i=>i.childrenIndex),n.routesMeta.map(i=>i.childrenIndex)))}var oie=/^:[\w-]+$/,lie=3,cie=2,uie=1,die=10,fie=-2,gj=t=>t==="*";function hie(t,e){let n=t.split("/"),i=n.length;return n.some(gj)&&(i+=fie),e&&(i+=cie),n.filter(r=>!gj(r)).reduce((r,a)=>r+(oie.test(a)?lie:a===""?uie:die),i)}function pie(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 mie(t,e,n=!1){let{routesMeta:i}=t,r={},a="/",s=[];for(let o=0;o<i.length;++o){let l=i[o],c=o===i.length-1,d=a==="/"?e:e.slice(a.length)||"/",f=R_({path:l.relativePath,caseSensitive:l.caseSensitive,end:c},d),m=l.route;if(!f&&c&&n&&!i[i.length-1].route.index&&(f=R_({path:l.relativePath,caseSensitive:l.caseSensitive,end:!1},d)),!f)return null;Object.assign(r,f.params),s.push({params:r,pathname:tc([a,f.pathname]),pathnameBase:Sie(tc([a,f.pathnameBase])),route:m}),f.pathnameBase!=="/"&&(a=tc([a,f.pathnameBase]))}return s}function R_(t,e){typeof t=="string"&&(t={path:t,caseSensitive:!1,end:!0});let[n,i]=gie(t.path,t.caseSensitive,t.end),r=e.match(n);if(!r)return null;let a=r[0],s=a.replace(/(.)\/+$/,"$1"),o=r.slice(1);return{params:i.reduce((c,{paramName:d,isOptional:f},m)=>{if(d==="*"){let y=o[m]||"";s=a.slice(0,a.length-y.length).replace(/(.)\/+$/,"$1")}const g=o[m];return f&&!g?c[d]=void 0:c[d]=(g||"").replace(/%2F/g,"/"),c},{}),pathname:a,pathnameBase:s,pattern:t}}function gie(t,e=!1,n=!0){bo(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,o,l)=>(i.push({paramName:o,isOptional:l!=null}),l?"/?([^\\/]+)?":"/([^\\/]+)")).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 xie(t){try{return t.split("/").map(e=>decodeURIComponent(e).replace(/\//g,"%2F")).join("/")}catch(e){return bo(!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 cc(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 vie=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,yie=t=>vie.test(t);function bie(t,e="/"){let{pathname:n,search:i="",hash:r=""}=typeof t=="string"?cm(t):t,a;if(n)if(yie(n))a=n;else{if(n.includes("//")){let s=n;n=n.replace(/\/\/+/g,"/"),bo(!1,`Pathnames cannot have embedded double slashes - normalizing ${s} -> ${n}`)}n.startsWith("/")?a=xj(n.substring(1),"/"):a=xj(n,e)}else a=e;return{pathname:a,search:wie(i),hash:Mie(r)}}function xj(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 wA(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 _ie(t){return t.filter((e,n)=>n===0||e.route.path&&e.route.path.length>0)}function pG(t){let e=_ie(t);return e.map((n,i)=>i===e.length-1?n.pathname:n.pathnameBase)}function mG(t,e,n,i=!1){let r;typeof t=="string"?r=cm(t):(r={...t},mi(!r.pathname||!r.pathname.includes("?"),wA("?","pathname","search",r)),mi(!r.pathname||!r.pathname.includes("#"),wA("#","pathname","hash",r)),mi(!r.search||!r.search.includes("#"),wA("#","search","hash",r)));let a=t===""||r.pathname==="",s=a?"/":r.pathname,o;if(s==null)o=n;else{let f=e.length-1;if(!i&&s.startsWith("..")){let m=s.split("/");for(;m[0]==="..";)m.shift(),f-=1;r.pathname=m.join("/")}o=f>=0?e[f]:"/"}let l=bie(r,o),c=s&&s!=="/"&&s.endsWith("/"),d=(a||s===".")&&n.endsWith("/");return!l.pathname.endsWith("/")&&(c||d)&&(l.pathname+="/"),l}var tc=t=>t.join("/").replace(/\/\/+/g,"/"),Sie=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),wie=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,Mie=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t;function Eie(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 gG=["POST","PUT","PATCH","DELETE"];new Set(gG);var Aie=["GET",...gG];new Set(Aie);var um=E.createContext(null);um.displayName="DataRouter";var jS=E.createContext(null);jS.displayName="DataRouterState";E.createContext(!1);var xG=E.createContext({isTransitioning:!1});xG.displayName="ViewTransition";var Tie=E.createContext(new Map);Tie.displayName="Fetchers";var Cie=E.createContext(null);Cie.displayName="Await";var sl=E.createContext(null);sl.displayName="Navigation";var Ex=E.createContext(null);Ex.displayName="Location";var wo=E.createContext({outlet:null,matches:[],isDataRoute:!1});wo.displayName="Route";var gP=E.createContext(null);gP.displayName="RouteError";function Nie(t,{relative:e}={}){mi(Ax(),"useHref() may be used only in the context of a <Router> component.");let{basename:n,navigator:i}=E.useContext(sl),{hash:r,pathname:a,search:s}=Tx(t,{relative:e}),o=a;return n!=="/"&&(o=a==="/"?n:tc([n,a])),i.createHref({pathname:o,search:s,hash:r})}function Ax(){return E.useContext(Ex)!=null}function nd(){return mi(Ax(),"useLocation() may be used only in the context of a <Router> component."),E.useContext(Ex).location}var vG="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function yG(t){E.useContext(sl).static||E.useLayoutEffect(t)}function xP(){let{isDataRoute:t}=E.useContext(wo);return t?Gie():Rie()}function Rie(){mi(Ax(),"useNavigate() may be used only in the context of a <Router> component.");let t=E.useContext(um),{basename:e,navigator:n}=E.useContext(sl),{matches:i}=E.useContext(wo),{pathname:r}=nd(),a=JSON.stringify(pG(i)),s=E.useRef(!1);return yG(()=>{s.current=!0}),E.useCallback((l,c={})=>{if(bo(s.current,vG),!s.current)return;if(typeof l=="number"){n.go(l);return}let d=mG(l,JSON.parse(a),r,c.relative==="path");t==null&&e!=="/"&&(d.pathname=d.pathname==="/"?e:tc([e,d.pathname])),(c.replace?n.replace:n.push)(d,c.state,c)},[e,n,a,r,t])}var Pie=E.createContext(null);function Die(t){let e=E.useContext(wo).outlet;return E.useMemo(()=>e&&E.createElement(Pie.Provider,{value:t},e),[e,t])}function kie(){let{matches:t}=E.useContext(wo),e=t[t.length-1];return e?e.params:{}}function Tx(t,{relative:e}={}){let{matches:n}=E.useContext(wo),{pathname:i}=nd(),r=JSON.stringify(pG(n));return E.useMemo(()=>mG(t,JSON.parse(r),i,e==="path"),[t,r,i,e])}function Oie(t,e){return bG(t,e)}function bG(t,e,n,i,r){mi(Ax(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:a}=E.useContext(sl),{matches:s}=E.useContext(wo),o=s[s.length-1],l=o?o.params:{},c=o?o.pathname:"/",d=o?o.pathnameBase:"/",f=o&&o.route;{let M=f&&f.path||"";_G(c,!f||M.endsWith("*")||M.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${c}" (under <Route path="${M}">) 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="${M}"> to <Route path="${M==="/"?"*":`${M}/*`}">.`)}let m=nd(),g;if(e){let M=typeof e=="string"?cm(e):e;mi(d==="/"||M.pathname?.startsWith(d),`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 "${d}" but pathname "${M.pathname}" was given in the \`location\` prop.`),g=M}else g=m;let y=g.pathname||"/",_=y;if(d!=="/"){let M=d.replace(/^\//,"").split("/");_="/"+y.replace(/^\//,"").split("/").slice(M.length).join("/")}let v=dG(t,{pathname:_});bo(f||v!=null,`No routes matched location "${g.pathname}${g.search}${g.hash}" `),bo(v==null||v[v.length-1].route.element!==void 0||v[v.length-1].route.Component!==void 0||v[v.length-1].route.lazy!==void 0,`Matched leaf route at location "${g.pathname}${g.search}${g.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 x=Fie(v&&v.map(M=>Object.assign({},M,{params:Object.assign({},l,M.params),pathname:tc([d,a.encodeLocation?a.encodeLocation(M.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:M.pathname]),pathnameBase:M.pathnameBase==="/"?d:tc([d,a.encodeLocation?a.encodeLocation(M.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:M.pathnameBase])})),s,n,i,r);return e&&x?E.createElement(Ex.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",...g},navigationType:"POP"}},x):x}function Lie(){let t=$ie(),e=Eie(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=E.createElement(E.Fragment,null,E.createElement("p",null,"💿 Hey developer 👋"),E.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",E.createElement("code",{style:a},"ErrorBoundary")," or"," ",E.createElement("code",{style:a},"errorElement")," prop on your route.")),E.createElement(E.Fragment,null,E.createElement("h2",null,"Unexpected Application Error!"),E.createElement("h3",{style:{fontStyle:"italic"}},e),n?E.createElement("pre",{style:r},n):null,s)}var Iie=E.createElement(Lie,null),Uie=class extends E.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?E.createElement(wo.Provider,{value:this.props.routeContext},E.createElement(gP.Provider,{value:this.state.error,children:this.props.component})):this.props.children}};function jie({routeContext:t,match:e,children:n}){let i=E.useContext(um);return i&&i.static&&i.staticContext&&(e.route.errorElement||e.route.ErrorBoundary)&&(i.staticContext._deepestRenderedBoundaryId=e.route.id),E.createElement(wo.Provider,{value:t},n)}function Fie(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 d=a.findIndex(f=>f.route.id&&s?.[f.route.id]!==void 0);mi(d>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(s).join(",")}`),a=a.slice(0,Math.min(a.length,d+1))}let o=!1,l=-1;if(n)for(let d=0;d<a.length;d++){let f=a[d];if((f.route.HydrateFallback||f.route.hydrateFallbackElement)&&(l=d),f.route.id){let{loaderData:m,errors:g}=n,y=f.route.loader&&!m.hasOwnProperty(f.route.id)&&(!g||g[f.route.id]===void 0);if(f.route.lazy||y){o=!0,l>=0?a=a.slice(0,l+1):a=[a[0]];break}}}let c=n&&i?(d,f)=>{i(d,{location:n.location,params:n.matches?.[0]?.params??{},errorInfo:f})}:void 0;return a.reduceRight((d,f,m)=>{let g,y=!1,_=null,v=null;n&&(g=s&&f.route.id?s[f.route.id]:void 0,_=f.route.errorElement||Iie,o&&(l<0&&m===0?(_G("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),y=!0,v=null):l===m&&(y=!0,v=f.route.hydrateFallbackElement||null)));let x=e.concat(a.slice(0,m+1)),M=()=>{let w;return g?w=_:y?w=v:f.route.Component?w=E.createElement(f.route.Component,null):f.route.element?w=f.route.element:w=d,E.createElement(jie,{match:f,routeContext:{outlet:d,matches:x,isDataRoute:n!=null},children:w})};return n&&(f.route.ErrorBoundary||f.route.errorElement||m===0)?E.createElement(Uie,{location:n.location,revalidation:n.revalidation,component:_,error:g,children:M(),routeContext:{outlet:null,matches:x,isDataRoute:!0},onError:c}):M()},null)}function vP(t){return`${t} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function zie(t){let e=E.useContext(um);return mi(e,vP(t)),e}function Bie(t){let e=E.useContext(jS);return mi(e,vP(t)),e}function Hie(t){let e=E.useContext(wo);return mi(e,vP(t)),e}function yP(t){let e=Hie(t),n=e.matches[e.matches.length-1];return mi(n.route.id,`${t} can only be used on routes that contain a unique "id"`),n.route.id}function Vie(){return yP("useRouteId")}function $ie(){let t=E.useContext(gP),e=Bie("useRouteError"),n=yP("useRouteError");return t!==void 0?t:e.errors?.[n]}function Gie(){let{router:t}=zie("useNavigate"),e=yP("useNavigate"),n=E.useRef(!1);return yG(()=>{n.current=!0}),E.useCallback(async(r,a={})=>{bo(n.current,vG),n.current&&(typeof r=="number"?t.navigate(r):await t.navigate(r,{fromRouteId:e,...a}))},[t,e])}var vj={};function _G(t,e,n){!e&&!vj[t]&&(vj[t]=!0,bo(!1,n))}E.memo(Wie);function Wie({routes:t,future:e,state:n,unstable_onError:i}){return bG(t,void 0,n,i,e)}function qie(t){return Die(t.context)}function Lo(t){mi(!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 Xie({basename:t="/",children:e=null,location:n,navigationType:i="POP",navigator:r,static:a=!1}){mi(!Ax(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let s=t.replace(/^\/*/,"/"),o=E.useMemo(()=>({basename:s,navigator:r,static:a,future:{}}),[s,r,a]);typeof n=="string"&&(n=cm(n));let{pathname:l="/",search:c="",hash:d="",state:f=null,key:m="default"}=n,g=E.useMemo(()=>{let y=cc(l,s);return y==null?null:{location:{pathname:y,search:c,hash:d,state:f,key:m},navigationType:i}},[s,l,c,d,f,m,i]);return bo(g!=null,`<Router basename="${s}"> is not able to match the URL "${l}${c}${d}" because it does not start with the basename, so the <Router> won't render anything.`),g==null?null:E.createElement(sl.Provider,{value:o},E.createElement(Ex.Provider,{children:e,value:g}))}function Kie({children:t,location:e}){return Oie(cN(t),e)}function cN(t,e=[]){let n=[];return E.Children.forEach(t,(i,r)=>{if(!E.isValidElement(i))return;let a=[...e,r];if(i.type===E.Fragment){n.push.apply(n,cN(i.props.children,a));return}mi(i.type===Lo,`[${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>`),mi(!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=cN(i.props.children,a)),n.push(s)}),n}var i_="get",r_="application/x-www-form-urlencoded";function FS(t){return t!=null&&typeof t.tagName=="string"}function Yie(t){return FS(t)&&t.tagName.toLowerCase()==="button"}function Zie(t){return FS(t)&&t.tagName.toLowerCase()==="form"}function Qie(t){return FS(t)&&t.tagName.toLowerCase()==="input"}function Jie(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function ere(t,e){return t.button===0&&(!e||e==="_self")&&!Jie(t)}var Ey=null;function tre(){if(Ey===null)try{new FormData(document.createElement("form"),0),Ey=!1}catch{Ey=!0}return Ey}var nre=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function MA(t){return t!=null&&!nre.has(t)?(bo(!1,`"${t}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${r_}"`),null):t}function ire(t,e){let n,i,r,a,s;if(Zie(t)){let o=t.getAttribute("action");i=o?cc(o,e):null,n=t.getAttribute("method")||i_,r=MA(t.getAttribute("enctype"))||r_,a=new FormData(t)}else if(Yie(t)||Qie(t)&&(t.type==="submit"||t.type==="image")){let o=t.form;if(o==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let l=t.getAttribute("formaction")||o.getAttribute("action");if(i=l?cc(l,e):null,n=t.getAttribute("formmethod")||o.getAttribute("method")||i_,r=MA(t.getAttribute("formenctype"))||MA(o.getAttribute("enctype"))||r_,a=new FormData(o,t),!tre()){let{name:c,type:d,value:f}=t;if(d==="image"){let m=c?`${c}.`:"";a.append(`${m}x`,"0"),a.append(`${m}y`,"0")}else c&&a.append(c,f)}}else{if(FS(t))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=i_,i=null,r=r_,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 bP(t,e){if(t===!1||t===null||typeof t>"u")throw new Error(e)}function rre(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&&cc(i.pathname,e)==="/"?i.pathname=`${e.replace(/\/$/,"")}/_root.${n}`:i.pathname=`${i.pathname.replace(/\/$/,"")}.${n}`,i}async function are(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 sre(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 ore(t,e,n){let i=await Promise.all(t.map(async r=>{let a=e.routes[r.route.id];if(a){let s=await are(a,n);return s.links?s.links():[]}return[]}));return dre(i.flat(1).filter(sre).filter(r=>r.rel==="stylesheet"||r.rel==="preload").map(r=>r.rel==="stylesheet"?{...r,rel:"prefetch",as:"style"}:{...r,rel:"prefetch"}))}function yj(t,e,n,i,r,a){let s=(l,c)=>n[c]?l.route.id!==n[c].route.id:!0,o=(l,c)=>n[c].pathname!==l.pathname||n[c].route.path?.endsWith("*")&&n[c].params["*"]!==l.params["*"];return a==="assets"?e.filter((l,c)=>s(l,c)||o(l,c)):a==="data"?e.filter((l,c)=>{let d=i.routes[l.route.id];if(!d||!d.hasLoader)return!1;if(s(l,c)||o(l,c))return!0;if(l.route.shouldRevalidate){let f=l.route.shouldRevalidate({currentUrl:new URL(r.pathname+r.search+r.hash,window.origin),currentParams:n[0]?.params||{},nextUrl:new URL(t,window.origin),nextParams:l.params,defaultShouldRevalidate:!0});if(typeof f=="boolean")return f}return!0}):[]}function lre(t,e,{includeHydrateFallback:n}={}){return cre(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 cre(t){return[...new Set(t)]}function ure(t){let e={},n=Object.keys(t).sort();for(let i of n)e[i]=t[i];return e}function dre(t,e){let n=new Set;return new Set(e),t.reduce((i,r)=>{let a=JSON.stringify(ure(r));return n.has(a)||(n.add(a),i.push({key:a,link:r})),i},[])}function SG(){let t=E.useContext(um);return bP(t,"You must render this element inside a <DataRouterContext.Provider> element"),t}function fre(){let t=E.useContext(jS);return bP(t,"You must render this element inside a <DataRouterStateContext.Provider> element"),t}var _P=E.createContext(void 0);_P.displayName="FrameworkContext";function wG(){let t=E.useContext(_P);return bP(t,"You must render this element inside a <HydratedRouter> element"),t}function hre(t,e){let n=E.useContext(_P),[i,r]=E.useState(!1),[a,s]=E.useState(!1),{onFocus:o,onBlur:l,onMouseEnter:c,onMouseLeave:d,onTouchStart:f}=e,m=E.useRef(null);E.useEffect(()=>{if(t==="render"&&s(!0),t==="viewport"){let _=x=>{x.forEach(M=>{s(M.isIntersecting)})},v=new IntersectionObserver(_,{threshold:.5});return m.current&&v.observe(m.current),()=>{v.disconnect()}}},[t]),E.useEffect(()=>{if(i){let _=setTimeout(()=>{s(!0)},100);return()=>{clearTimeout(_)}}},[i]);let g=()=>{r(!0)},y=()=>{r(!1),s(!1)};return n?t!=="intent"?[a,m,{}]:[a,m,{onFocus:Mg(o,g),onBlur:Mg(l,y),onMouseEnter:Mg(c,g),onMouseLeave:Mg(d,y),onTouchStart:Mg(f,g)}]:[!1,m,{}]}function Mg(t,e){return n=>{t&&t(n),n.defaultPrevented||e(n)}}function pre({page:t,...e}){let{router:n}=SG(),i=E.useMemo(()=>dG(n.routes,t,n.basename),[n.routes,t,n.basename]);return i?E.createElement(gre,{page:t,matches:i,...e}):null}function mre(t){let{manifest:e,routeModules:n}=wG(),[i,r]=E.useState([]);return E.useEffect(()=>{let a=!1;return ore(t,e,n).then(s=>{a||r(s)}),()=>{a=!0}},[t,e,n]),i}function gre({page:t,matches:e,...n}){let i=nd(),{manifest:r,routeModules:a}=wG(),{basename:s}=SG(),{loaderData:o,matches:l}=fre(),c=E.useMemo(()=>yj(t,e,l,r,i,"data"),[t,e,l,r,i]),d=E.useMemo(()=>yj(t,e,l,r,i,"assets"),[t,e,l,r,i]),f=E.useMemo(()=>{if(t===i.pathname+i.search+i.hash)return[];let y=new Set,_=!1;if(e.forEach(x=>{let M=r.routes[x.route.id];!M||!M.hasLoader||(!c.some(w=>w.route.id===x.route.id)&&x.route.id in o&&a[x.route.id]?.shouldRevalidate||M.hasClientLoader?_=!0:y.add(x.route.id))}),y.size===0)return[];let v=rre(t,s,"data");return _&&y.size>0&&v.searchParams.set("_routes",e.filter(x=>y.has(x.route.id)).map(x=>x.route.id).join(",")),[v.pathname+v.search]},[s,o,i,r,c,e,t,a]),m=E.useMemo(()=>lre(d,r),[d,r]),g=mre(d);return E.createElement(E.Fragment,null,f.map(y=>E.createElement("link",{key:y,rel:"prefetch",as:"fetch",href:y,...n})),m.map(y=>E.createElement("link",{key:y,rel:"modulepreload",href:y,...n})),g.map(({key:y,link:_})=>E.createElement("link",{key:y,nonce:n.nonce,..._})))}function xre(...t){return e=>{t.forEach(n=>{typeof n=="function"?n(e):n!=null&&(n.current=e)})}}var MG=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{MG&&(window.__reactRouterVersion="7.9.6")}catch{}function vre({basename:t,children:e,window:n}){let i=E.useRef();i.current==null&&(i.current=tie({window:n,v5Compat:!0}));let r=i.current,[a,s]=E.useState({action:r.action,location:r.location}),o=E.useCallback(l=>{E.startTransition(()=>s(l))},[s]);return E.useLayoutEffect(()=>r.listen(o),[r,o]),E.createElement(Xie,{basename:t,children:e,location:a.location,navigationType:a.action,navigator:r})}var EG=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,zS=E.forwardRef(function({onClick:e,discover:n="render",prefetch:i="none",relative:r,reloadDocument:a,replace:s,state:o,target:l,to:c,preventScrollReset:d,viewTransition:f,...m},g){let{basename:y}=E.useContext(sl),_=typeof c=="string"&&EG.test(c),v,x=!1;if(typeof c=="string"&&_&&(v=c,MG))try{let N=new URL(window.location.href),D=c.startsWith("//")?new URL(N.protocol+c):new URL(c),F=cc(D.pathname,y);D.origin===N.origin&&F!=null?c=F+D.search+D.hash:x=!0}catch{bo(!1,`<Link to="${c}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}let M=Nie(c,{relative:r}),[w,T,C]=hre(i,m),P=_re(c,{replace:s,state:o,target:l,preventScrollReset:d,relative:r,viewTransition:f});function A(N){e&&e(N),N.defaultPrevented||P(N)}let U=E.createElement("a",{...m,...C,href:v||M,onClick:x||a?e:A,ref:xre(g,T),target:l,"data-discover":!_&&n==="render"?"true":void 0});return w&&!_?E.createElement(E.Fragment,null,U,E.createElement(pre,{page:M})):U});zS.displayName="Link";var AG=E.forwardRef(function({"aria-current":e="page",caseSensitive:n=!1,className:i="",end:r=!1,style:a,to:s,viewTransition:o,children:l,...c},d){let f=Tx(s,{relative:c.relative}),m=nd(),g=E.useContext(jS),{navigator:y,basename:_}=E.useContext(sl),v=g!=null&&Are(f)&&o===!0,x=y.encodeLocation?y.encodeLocation(f).pathname:f.pathname,M=m.pathname,w=g&&g.navigation&&g.navigation.location?g.navigation.location.pathname:null;n||(M=M.toLowerCase(),w=w?w.toLowerCase():null,x=x.toLowerCase()),w&&_&&(w=cc(w,_)||w);const T=x!=="/"&&x.endsWith("/")?x.length-1:x.length;let C=M===x||!r&&M.startsWith(x)&&M.charAt(T)==="/",P=w!=null&&(w===x||!r&&w.startsWith(x)&&w.charAt(x.length)==="/"),A={isActive:C,isPending:P,isTransitioning:v},U=C?e:void 0,N;typeof i=="function"?N=i(A):N=[i,C?"active":null,P?"pending":null,v?"transitioning":null].filter(Boolean).join(" ");let D=typeof a=="function"?a(A):a;return E.createElement(zS,{...c,"aria-current":U,className:N,ref:d,style:D,to:s,viewTransition:o},typeof l=="function"?l(A):l)});AG.displayName="NavLink";var yre=E.forwardRef(({discover:t="render",fetcherKey:e,navigate:n,reloadDocument:i,replace:r,state:a,method:s=i_,action:o,onSubmit:l,relative:c,preventScrollReset:d,viewTransition:f,...m},g)=>{let y=Mre(),_=Ere(o,{relative:c}),v=s.toLowerCase()==="get"?"get":"post",x=typeof o=="string"&&EG.test(o),M=w=>{if(l&&l(w),w.defaultPrevented)return;w.preventDefault();let T=w.nativeEvent.submitter,C=T?.getAttribute("formmethod")||s;y(T||w.currentTarget,{fetcherKey:e,method:C,navigate:n,replace:r,state:a,relative:c,preventScrollReset:d,viewTransition:f})};return E.createElement("form",{ref:g,method:v,action:_,onSubmit:i?l:M,...m,"data-discover":!x&&t==="render"?"true":void 0})});yre.displayName="Form";function bre(t){return`${t} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function TG(t){let e=E.useContext(um);return mi(e,bre(t)),e}function _re(t,{target:e,replace:n,state:i,preventScrollReset:r,relative:a,viewTransition:s}={}){let o=xP(),l=nd(),c=Tx(t,{relative:a});return E.useCallback(d=>{if(ere(d,e)){d.preventDefault();let f=n!==void 0?n:P0(l)===P0(c);o(t,{replace:f,state:i,preventScrollReset:r,relative:a,viewTransition:s})}},[l,o,c,n,i,e,t,r,a,s])}var Sre=0,wre=()=>`__${String(++Sre)}__`;function Mre(){let{router:t}=TG("useSubmit"),{basename:e}=E.useContext(sl),n=Vie();return E.useCallback(async(i,r={})=>{let{action:a,method:s,encType:o,formData:l,body:c}=ire(i,e);if(r.navigate===!1){let d=r.fetcherKey||wre();await t.fetch(d,n,r.action||a,{preventScrollReset:r.preventScrollReset,formData:l,body:c,formMethod:r.method||s,formEncType:r.encType||o,flushSync:r.flushSync})}else await t.navigate(r.action||a,{preventScrollReset:r.preventScrollReset,formData:l,body:c,formMethod:r.method||s,formEncType:r.encType||o,replace:r.replace,state:r.state,fromRouteId:n,flushSync:r.flushSync,viewTransition:r.viewTransition})},[t,e,n])}function Ere(t,{relative:e}={}){let{basename:n}=E.useContext(sl),i=E.useContext(wo);mi(i,"useFormAction must be used inside a RouteContext");let[r]=i.matches.slice(-1),a={...Tx(t||".",{relative:e})},s=nd();if(t==null){a.search=s.search;let o=new URLSearchParams(a.search),l=o.getAll("index");if(l.some(d=>d==="")){o.delete("index"),l.filter(f=>f).forEach(f=>o.append("index",f));let d=o.toString();a.search=d?`?${d}`:""}}return(!t||t===".")&&r.route.index&&(a.search=a.search?a.search.replace(/^\?/,"?index&"):"?index"),n!=="/"&&(a.pathname=a.pathname==="/"?n:tc([n,a.pathname])),P0(a)}function Are(t,{relative:e}={}){let n=E.useContext(xG);mi(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:i}=TG("useViewTransitionState"),r=Tx(t,{relative:e});if(!n.isTransitioning)return!1;let a=cc(n.currentLocation.pathname,i)||n.currentLocation.pathname,s=cc(n.nextLocation.pathname,i)||n.nextLocation.pathname;return R_(r.pathname,s)!=null||R_(r.pathname,a)!=null}var Xl=eG();const Tre=Ks(Xl);var dm=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(){}},Cre={setTimeout:(t,e)=>setTimeout(t,e),clearTimeout:t=>clearTimeout(t),setInterval:(t,e)=>setInterval(t,e),clearInterval:t=>clearInterval(t)},Nre=class{#e=Cre;#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)}},Kd=new Nre;function Rre(t){setTimeout(t,0)}var yf=typeof window>"u"||"Deno"in globalThis;function da(){}function Pre(t,e){return typeof t=="function"?t(e):t}function uN(t){return typeof t=="number"&&t>=0&&t!==1/0}function CG(t,e){return Math.max(t+(e||0)-Date.now(),0)}function Ou(t,e){return typeof t=="function"?t(e):t}function Ps(t,e){return typeof t=="function"?t(e):t}function bj(t,e){const{type:n="all",exact:i,fetchStatus:r,predicate:a,queryKey:s,stale:o}=t;if(s){if(i){if(e.queryHash!==SP(s,e.options))return!1}else if(!D0(e.queryKey,s))return!1}if(n!=="all"){const l=e.isActive();if(n==="active"&&!l||n==="inactive"&&l)return!1}return!(typeof o=="boolean"&&e.isStale()!==o||r&&r!==e.state.fetchStatus||a&&!a(e))}function _j(t,e){const{exact:n,status:i,predicate:r,mutationKey:a}=t;if(a){if(!e.options.mutationKey)return!1;if(n){if(bf(e.options.mutationKey)!==bf(a))return!1}else if(!D0(e.options.mutationKey,a))return!1}return!(i&&e.state.status!==i||r&&!r(e))}function SP(t,e){return(e?.queryKeyHashFn||bf)(t)}function bf(t){return JSON.stringify(t,(e,n)=>dN(n)?Object.keys(n).sort().reduce((i,r)=>(i[r]=n[r],i),{}):n)}function D0(t,e){return t===e?!0:typeof t!=typeof e?!1:t&&e&&typeof t=="object"&&typeof e=="object"?Object.keys(e).every(n=>D0(t[n],e[n])):!1}var Dre=Object.prototype.hasOwnProperty;function NG(t,e){if(t===e)return t;const n=Sj(t)&&Sj(e);if(!n&&!(dN(t)&&dN(e)))return e;const r=(n?t:Object.keys(t)).length,a=n?e:Object.keys(e),s=a.length,o=n?new Array(s):{};let l=0;for(let c=0;c<s;c++){const d=n?c:a[c],f=t[d],m=e[d];if(f===m){o[d]=f,(n?c<r:Dre.call(t,d))&&l++;continue}if(f===null||m===null||typeof f!="object"||typeof m!="object"){o[d]=m;continue}const g=NG(f,m);o[d]=g,g===f&&l++}return r===s&&l===r?t:o}function P_(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 Sj(t){return Array.isArray(t)&&t.length===Object.keys(t).length}function dN(t){if(!wj(t))return!1;const e=t.constructor;if(e===void 0)return!0;const n=e.prototype;return!(!wj(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(t)!==Object.prototype)}function wj(t){return Object.prototype.toString.call(t)==="[object Object]"}function kre(t){return new Promise(e=>{Kd.setTimeout(e,t)})}function fN(t,e,n){return typeof n.structuralSharing=="function"?n.structuralSharing(t,e):n.structuralSharing!==!1?NG(t,e):e}function Ore(t,e,n=0){const i=[...t,e];return n&&i.length>n?i.slice(1):i}function Lre(t,e,n=0){const i=[e,...t];return n&&i.length>n?i.slice(0,-1):i}var wP=Symbol();function RG(t,e){return!t.queryFn&&e?.initialPromise?()=>e.initialPromise:!t.queryFn||t.queryFn===wP?()=>Promise.reject(new Error(`Missing queryFn: '${t.queryHash}'`)):t.queryFn}function PG(t,e){return typeof t=="function"?t(...e):!!t}var Ire=class extends dm{#e;#t;#n;constructor(){super(),this.#n=t=>{if(!yf&&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"}},MP=new Ire;function hN(){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 Ure=Rre;function jre(){let t=[],e=0,n=o=>{o()},i=o=>{o()},r=Ure;const a=o=>{e?t.push(o):r(()=>{n(o)})},s=()=>{const o=t;t=[],o.length&&r(()=>{i(()=>{o.forEach(l=>{n(l)})})})};return{batch:o=>{let l;e++;try{l=o()}finally{e--,e||s()}return l},batchCalls:o=>(...l)=>{a(()=>{o(...l)})},schedule:a,setNotifyFunction:o=>{n=o},setBatchNotifyFunction:o=>{i=o},setScheduler:o=>{r=o}}}var ir=jre(),Fre=class extends dm{#e=!0;#t;#n;constructor(){super(),this.#n=t=>{if(!yf&&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}},D_=new Fre;function zre(t){return Math.min(1e3*2**t,3e4)}function DG(t){return(t??"online")==="online"?D_.isOnline():!0}var pN=class extends Error{constructor(t){super("CancelledError"),this.revert=t?.revert,this.silent=t?.silent}};function kG(t){let e=!1,n=0,i;const r=hN(),a=()=>r.status!=="pending",s=_=>{if(!a()){const v=new pN(_);m(v),t.onCancel?.(v)}},o=()=>{e=!0},l=()=>{e=!1},c=()=>MP.isFocused()&&(t.networkMode==="always"||D_.isOnline())&&t.canRun(),d=()=>DG(t.networkMode)&&t.canRun(),f=_=>{a()||(i?.(),r.resolve(_))},m=_=>{a()||(i?.(),r.reject(_))},g=()=>new Promise(_=>{i=v=>{(a()||c())&&_(v)},t.onPause?.()}).then(()=>{i=void 0,a()||t.onContinue?.()}),y=()=>{if(a())return;let _;const v=n===0?t.initialPromise:void 0;try{_=v??t.fn()}catch(x){_=Promise.reject(x)}Promise.resolve(_).then(f).catch(x=>{if(a())return;const M=t.retry??(yf?0:3),w=t.retryDelay??zre,T=typeof w=="function"?w(n,x):w,C=M===!0||typeof M=="number"&&n<M||typeof M=="function"&&M(n,x);if(e||!C){m(x);return}n++,t.onFail?.(n,x),kre(T).then(()=>c()?void 0:g()).then(()=>{e?m(x):y()})})};return{promise:r,status:()=>r.status,cancel:s,continue:()=>(i?.(),r),cancelRetry:o,continueRetry:l,canStart:d,start:()=>(d()?y():g().then(y),r)}}var OG=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),uN(this.gcTime)&&(this.#e=Kd.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(t){this.gcTime=Math.max(this.gcTime||0,t??(yf?1/0:300*1e3))}clearGcTimeout(){this.#e&&(Kd.clearTimeout(this.#e),this.#e=void 0)}},Bre=class extends OG{#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=Ej(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=Ej(this.options);e.data!==void 0&&(this.setState(Mj(e.data,e.dataUpdatedAt)),this.#e=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&this.#n.remove(this)}setData(t,e){const n=fN(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(da).catch(da):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(this.#e)}isActive(){return this.observers.some(t=>Ps(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===wP||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>Ou(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:!CG(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 o=this.observers.find(l=>l.options.queryFn);o&&this.setOptions(o.options)}const n=new AbortController,i=o=>{Object.defineProperty(o,"signal",{enumerable:!0,get:()=>(this.#o=!0,n.signal)})},r=()=>{const o=RG(this.options,e),c=(()=>{const d={client:this.#r,queryKey:this.queryKey,meta:this.meta};return i(d),d})();return this.#o=!1,this.options.persister?this.options.persister(o,c,this):o(c)},s=(()=>{const o={fetchOptions:e,options:this.options,queryKey:this.queryKey,client:this.#r,state:this.state,fetchFn:r};return i(o),o})();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=kG({initialPromise:e?.initialPromise,fn:s.fetchFn,onCancel:o=>{o instanceof pN&&o.revert&&this.setState({...this.#t,fetchStatus:"idle"}),n.abort()},onFail:(o,l)=>{this.#a({type:"failed",failureCount:o,error:l})},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 o=await this.#i.start();if(o===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(o),this.#n.config.onSuccess?.(o,this),this.#n.config.onSettled?.(o,this.state.error,this),o}catch(o){if(o instanceof pN){if(o.silent)return this.#i.promise;if(o.revert){if(this.state.data===void 0)throw o;return this.state.data}}throw this.#a({type:"error",error:o}),this.#n.config.onError?.(o,this),this.#n.config.onSettled?.(this.state.data,o,this),o}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,...LG(n.data,this.options),fetchMeta:t.meta??null};case"success":const i={...n,...Mj(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),ir.batch(()=>{this.observers.forEach(n=>{n.onQueryUpdate()}),this.#n.notify({query:this,type:"updated",action:t})})}};function LG(t,e){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:DG(e.networkMode)?"fetching":"paused",...t===void 0&&{error:null,status:"pending"}}}function Mj(t,e){return{data:t,dataUpdatedAt:e??Date.now(),error:null,isInvalidated:!1,status:"success"}}function Ej(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 Hre=class extends dm{constructor(t,e){super(),this.options=e,this.#e=t,this.#a=null,this.#o=hN(),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),Aj(this.#t,this.options)?this.#d():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return mN(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return mN(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 Ps(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&&!P_(this.options,e)&&this.#e.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#t,observer:this});const i=this.hasListeners();i&&Tj(this.#t,n,this.options,e)&&this.#d(),this.updateResult(),i&&(this.#t!==n||Ps(this.options.enabled,this.#t)!==Ps(e.enabled,this.#t)||Ou(this.options.staleTime,this.#t)!==Ou(e.staleTime,this.#t))&&this.#g();const r=this.#x();i&&(this.#t!==n||Ps(this.options.enabled,this.#t)!==Ps(e.enabled,this.#t)||r!==this.#l)&&this.#v(r)}getOptimisticResult(t){const e=this.#e.getQueryCache().build(this.#e,t),n=this.createResult(e,t);return $re(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(da)),e}#g(){this.#b();const t=Ou(this.options.staleTime,this.#t);if(yf||this.#r.isStale||!uN(t))return;const n=CG(this.#r.dataUpdatedAt,t)+1;this.#c=Kd.setTimeout(()=>{this.#r.isStale||this.updateResult()},n)}#x(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#v(t){this.#_(),this.#l=t,!(yf||Ps(this.options.enabled,this.#t)===!1||!uN(this.#l)||this.#l===0)&&(this.#u=Kd.setInterval(()=>{(this.options.refetchIntervalInBackground||MP.isFocused())&&this.#d()},this.#l))}#y(){this.#g(),this.#v(this.#x())}#b(){this.#c&&(Kd.clearTimeout(this.#c),this.#c=void 0)}#_(){this.#u&&(Kd.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,l=t!==n?t.state:this.#n,{state:c}=t;let d={...c},f=!1,m;if(e._optimisticResults){const U=this.hasListeners(),N=!U&&Aj(t,e),D=U&&Tj(t,n,e,i);(N||D)&&(d={...d,...LG(c.data,t.options)}),e._optimisticResults==="isRestoring"&&(d.fetchStatus="idle")}let{error:g,errorUpdatedAt:y,status:_}=d;m=d.data;let v=!1;if(e.placeholderData!==void 0&&m===void 0&&_==="pending"){let U;r?.isPlaceholderData&&e.placeholderData===s?.placeholderData?(U=r.data,v=!0):U=typeof e.placeholderData=="function"?e.placeholderData(this.#h?.state.data,this.#h):e.placeholderData,U!==void 0&&(_="success",m=fN(r?.data,U,e),f=!0)}if(e.select&&m!==void 0&&!v)if(r&&m===a?.data&&e.select===this.#m)m=this.#f;else try{this.#m=e.select,m=e.select(m),m=fN(r?.data,m,e),this.#f=m,this.#a=null}catch(U){this.#a=U}this.#a&&(g=this.#a,m=this.#f,y=Date.now(),_="error");const x=d.fetchStatus==="fetching",M=_==="pending",w=_==="error",T=M&&x,C=m!==void 0,A={status:_,fetchStatus:d.fetchStatus,isPending:M,isSuccess:_==="success",isError:w,isInitialLoading:T,isLoading:T,data:m,dataUpdatedAt:d.dataUpdatedAt,error:g,errorUpdatedAt:y,failureCount:d.fetchFailureCount,failureReason:d.fetchFailureReason,errorUpdateCount:d.errorUpdateCount,isFetched:d.dataUpdateCount>0||d.errorUpdateCount>0,isFetchedAfterMount:d.dataUpdateCount>l.dataUpdateCount||d.errorUpdateCount>l.errorUpdateCount,isFetching:x,isRefetching:x&&!M,isLoadingError:w&&!C,isPaused:d.fetchStatus==="paused",isPlaceholderData:f,isRefetchError:w&&C,isStale:EP(t,e),refetch:this.refetch,promise:this.#o,isEnabled:Ps(e.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const U=F=>{A.status==="error"?F.reject(A.error):A.data!==void 0&&F.resolve(A.data)},N=()=>{const F=this.#o=A.promise=hN();U(F)},D=this.#o;switch(D.status){case"pending":t.queryHash===n.queryHash&&U(D);break;case"fulfilled":(A.status==="error"||A.data!==D.value)&&N();break;case"rejected":(A.status!=="error"||A.error!==D.reason)&&N();break}}return A}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),P_(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 o=s;return this.#r[o]!==t[o]&&a.has(o)})};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){ir.batch(()=>{t.listeners&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:"observerResultsUpdated"})})}};function Vre(t,e){return Ps(e.enabled,t)!==!1&&t.state.data===void 0&&!(t.state.status==="error"&&e.retryOnMount===!1)}function Aj(t,e){return Vre(t,e)||t.state.data!==void 0&&mN(t,e,e.refetchOnMount)}function mN(t,e,n){if(Ps(e.enabled,t)!==!1&&Ou(e.staleTime,t)!=="static"){const i=typeof n=="function"?n(t):n;return i==="always"||i!==!1&&EP(t,e)}return!1}function Tj(t,e,n,i){return(t!==e||Ps(i.enabled,t)===!1)&&(!n.suspense||t.state.status!=="error")&&EP(t,n)}function EP(t,e){return Ps(e.enabled,t)!==!1&&t.isStaleByTime(Ou(e.staleTime,t))}function $re(t,e){return!P_(t.getCurrentResult(),e)}function Cj(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 o={pages:[],pageParams:[]},l=0;const c=async()=>{let d=!1;const f=y=>{Object.defineProperty(y,"signal",{enumerable:!0,get:()=>(e.signal.aborted?d=!0:e.signal.addEventListener("abort",()=>{d=!0}),e.signal)})},m=RG(e.options,e.fetchOptions),g=async(y,_,v)=>{if(d)return Promise.reject();if(_==null&&y.pages.length)return Promise.resolve(y);const M=(()=>{const P={client:e.client,queryKey:e.queryKey,pageParam:_,direction:v?"backward":"forward",meta:e.options.meta};return f(P),P})(),w=await m(M),{maxPages:T}=e.options,C=v?Lre:Ore;return{pages:C(y.pages,w,T),pageParams:C(y.pageParams,_,T)}};if(r&&a.length){const y=r==="backward",_=y?Gre:Nj,v={pages:a,pageParams:s},x=_(i,v);o=await g(v,x,y)}else{const y=t??a.length;do{const _=l===0?s[0]??i.initialPageParam:Nj(i,o);if(l>0&&_==null)break;o=await g(o,_),l++}while(l<y)}return o};e.options.persister?e.fetchFn=()=>e.options.persister?.(c,{client:e.client,queryKey:e.queryKey,meta:e.options.meta,signal:e.signal},n):e.fetchFn=c}}}function Nj(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 Gre(t,{pages:e,pageParams:n}){return e.length>0?t.getPreviousPageParam?.(e[0],e,n[0],n):void 0}var Wre=class extends OG{#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||IG(),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=kG({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),ir.batch(()=>{this.#t.forEach(n=>{n.onMutationUpdate(t)}),this.#n.notify({mutation:this,type:"updated",action:t})})}};function IG(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var qre=class extends dm{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 Wre({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=Ay(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=Ay(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=Ay(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=Ay(t);return typeof e=="string"?this.#t.get(e)?.find(i=>i!==t&&i.state.isPaused)?.continue()??Promise.resolve():Promise.resolve()}clear(){ir.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=>_j(e,n))}findAll(t={}){return this.getAll().filter(e=>_j(t,e))}notify(t){ir.batch(()=>{this.listeners.forEach(e=>{e(t)})})}resumePausedMutations(){const t=this.getAll().filter(e=>e.state.isPaused);return ir.batch(()=>Promise.all(t.map(e=>e.continue().catch(da))))}};function Ay(t){return t.options.scope?.id}var Xre=class extends dm{#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),P_(this.options,n)||this.#e.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.#n,observer:this}),n?.mutationKey&&this.options.mutationKey&&bf(n.mutationKey)!==bf(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??IG();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){ir.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)})})}},Kre=class extends dm{constructor(t={}){super(),this.config=t,this.#e=new Map}#e;build(t,e,n){const i=e.queryKey,r=e.queryHash??SP(i,e);let a=this.get(r);return a||(a=new Bre({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(){ir.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=>bj(e,n))}findAll(t={}){const e=this.getAll();return Object.keys(t).length>0?e.filter(n=>bj(t,n)):e}notify(t){ir.batch(()=>{this.listeners.forEach(e=>{e(t)})})}onFocus(){ir.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){ir.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},Yre=class{#e;#t;#n;#r;#i;#s;#o;#a;constructor(t={}){this.#e=t.queryCache||new Kre,this.#t=t.mutationCache||new qre,this.#n=t.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#s=0}mount(){this.#s++,this.#s===1&&(this.#o=MP.subscribe(async t=>{t&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#a=D_.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(Ou(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=Pre(e,a);if(s!==void 0)return this.#e.build(this,i).setData(s,{...n,manual:!0})}setQueriesData(t,e,n){return ir.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;ir.batch(()=>{e.findAll(t).forEach(n=>{e.remove(n)})})}resetQueries(t,e){const n=this.#e;return ir.batch(()=>(n.findAll(t).forEach(i=>{i.reset()}),this.refetchQueries({type:"active",...t},e)))}cancelQueries(t,e={}){const n={revert:!0,...e},i=ir.batch(()=>this.#e.findAll(t).map(r=>r.cancel(n)));return Promise.all(i).then(da).catch(da)}invalidateQueries(t,e={}){return ir.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=ir.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(da)),r.state.fetchStatus==="paused"?Promise.resolve():a}));return Promise.all(i).then(da)}fetchQuery(t){const e=this.defaultQueryOptions(t);e.retry===void 0&&(e.retry=!1);const n=this.#e.build(this,e);return n.isStaleByTime(Ou(e.staleTime,n))?n.fetch(e):Promise.resolve(n.state.data)}prefetchQuery(t){return this.fetchQuery(t).then(da).catch(da)}fetchInfiniteQuery(t){return t.behavior=Cj(t.pages),this.fetchQuery(t)}prefetchInfiniteQuery(t){return this.fetchInfiniteQuery(t).then(da).catch(da)}ensureInfiniteQueryData(t){return t.behavior=Cj(t.pages),this.ensureQueryData(t)}resumePausedMutations(){return D_.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(bf(t),{queryKey:t,defaultOptions:e})}getQueryDefaults(t){const e=[...this.#r.values()],n={};return e.forEach(i=>{D0(t,i.queryKey)&&Object.assign(n,i.defaultOptions)}),n}setMutationDefaults(t,e){this.#i.set(bf(t),{mutationKey:t,defaultOptions:e})}getMutationDefaults(t){const e=[...this.#i.values()],n={};return e.forEach(i=>{D0(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=SP(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===wP&&(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()}},UG=E.createContext(void 0),Jn=t=>{const e=E.useContext(UG);if(!e)throw new Error("No QueryClient set, use QueryClientProvider to set one");return e},Zre=({client:t,children:e})=>(E.useEffect(()=>(t.mount(),()=>{t.unmount()}),[t]),p.jsx(UG.Provider,{value:t,children:e})),jG=E.createContext(!1),Qre=()=>E.useContext(jG);jG.Provider;function Jre(){let t=!1;return{clearReset:()=>{t=!1},reset:()=>{t=!0},isReset:()=>t}}var eae=E.createContext(Jre()),tae=()=>E.useContext(eae),nae=(t,e)=>{(t.suspense||t.throwOnError||t.experimental_prefetchInRender)&&(e.isReset()||(t.retryOnMount=!1))},iae=t=>{E.useEffect(()=>{t.clearReset()},[t])},rae=({result:t,errorResetBoundary:e,throwOnError:n,query:i,suspense:r})=>t.isError&&!e.isReset()&&!t.isFetching&&i&&(r&&t.data===void 0||PG(n,[t.error,i])),aae=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))}},sae=(t,e)=>t.isLoading&&t.isFetching&&!e,oae=(t,e)=>t?.suspense&&e.isPending,Rj=(t,e,n)=>e.fetchOptimistic(t).catch(()=>{n.clearReset()});function lae(t,e,n){const i=Qre(),r=tae(),a=Jn(),s=a.defaultQueryOptions(t);a.getDefaultOptions().queries?._experimental_beforeQuery?.(s),s._optimisticResults=i?"isRestoring":"optimistic",aae(s),nae(s,r),iae(r);const o=!a.getQueryCache().get(s.queryHash),[l]=E.useState(()=>new e(a,s)),c=l.getOptimisticResult(s),d=!i&&t.subscribed!==!1;if(E.useSyncExternalStore(E.useCallback(f=>{const m=d?l.subscribe(ir.batchCalls(f)):da;return l.updateResult(),m},[l,d]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),E.useEffect(()=>{l.setOptions(s)},[s,l]),oae(s,c))throw Rj(s,l,r);if(rae({result:c,errorResetBoundary:r,throwOnError:s.throwOnError,query:a.getQueryCache().get(s.queryHash),suspense:s.suspense}))throw c.error;return a.getDefaultOptions().queries?._experimental_afterQuery?.(s,c),s.experimental_prefetchInRender&&!yf&&sae(c,i)&&(o?Rj(s,l,r):a.getQueryCache().get(s.queryHash)?.promise)?.catch(da).finally(()=>{l.updateResult()}),s.notifyOnChangeProps?c:l.trackResult(c)}function It(t,e){return lae(t,Hre)}function Ot(t,e){const n=Jn(),[i]=E.useState(()=>new Xre(n,t));E.useEffect(()=>{i.setOptions(t)},[i,t]);const r=E.useSyncExternalStore(E.useCallback(s=>i.subscribe(ir.batchCalls(s)),[i]),()=>i.getCurrentResult(),()=>i.getCurrentResult()),a=E.useCallback((s,o)=>{i.mutate(s,o).catch(da)},[i]);if(r.error&&PG(i.options.throwOnError,[r.error]))throw r.error;return{...r,mutate:a,mutateAsync:r.mutate}}const cae=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),uae=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,n,i)=>i?i.toUpperCase():n.toLowerCase()),Pj=t=>{const e=uae(t);return e.charAt(0).toUpperCase()+e.slice(1)},FG=(...t)=>t.filter((e,n,i)=>!!e&&e.trim()!==""&&i.indexOf(e)===n).join(" ").trim(),dae=t=>{for(const e in t)if(e.startsWith("aria-")||e==="role"||e==="title")return!0};var fae={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 hae=E.forwardRef(({color:t="currentColor",size:e=24,strokeWidth:n=2,absoluteStrokeWidth:i,className:r="",children:a,iconNode:s,...o},l)=>E.createElement("svg",{ref:l,...fae,width:e,height:e,stroke:t,strokeWidth:i?Number(n)*24/Number(e):n,className:FG("lucide",r),...!a&&!dae(o)&&{"aria-hidden":"true"},...o},[...s.map(([c,d])=>E.createElement(c,d)),...Array.isArray(a)?a:[a]]));const et=(t,e)=>{const n=E.forwardRef(({className:i,...r},a)=>E.createElement(hae,{ref:a,iconNode:e,className:FG(`lucide-${cae(Pj(t))}`,`lucide-${t}`,i),...r}));return n.displayName=Pj(t),n};const pae=[["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"}]],mae=et("archive",pae);const gae=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],gN=et("arrow-down",gae);const xae=[["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"}]],vae=et("arrow-up-down",xae);const yae=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],xN=et("arrow-up",yae);const bae=[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}]],vN=et("bell",bae);const _ae=[["path",{d:"M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8",key:"mg9rjx"}]],Sae=et("bold",_ae);const wae=[["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"}]],k0=et("box",wae);const Mae=[["path",{d:"M17 19a1 1 0 0 1-1-1v-2a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v2a1 1 0 0 1-1 1z",key:"trhst0"}],["path",{d:"M17 21v-2",key:"ds4u3f"}],["path",{d:"M19 14V6.5a1 1 0 0 0-7 0v11a1 1 0 0 1-7 0V10",key:"1mo9zo"}],["path",{d:"M21 21v-2",key:"eo0ou"}],["path",{d:"M3 5V3",key:"1k5hjh"}],["path",{d:"M4 10a2 2 0 0 1-2-2V6a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2a2 2 0 0 1-2 2z",key:"1dd30t"}],["path",{d:"M7 5V3",key:"1t1388"}]],Eae=et("cable",Mae);const Aae=[["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"}]],Tae=et("calendar-days",Aae);const Cae=[["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"}]],Yo=et("calendar",Cae);const Nae=[["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"}]],k_=et("camera",Nae);const Rae=[["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"}]],Pae=et("chart-column",Rae);const Dae=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],O0=et("check",Dae);const kae=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Cx=et("chevron-down",kae);const Oae=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],zf=et("chevron-right",Oae);const Lae=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],_f=et("chevron-left",Lae);const Iae=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],zG=et("chevron-up",Iae);const Uae=[["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"}]],id=et("circle-alert",Uae);const jae=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 12-4-4-4 4",key:"177agl"}],["path",{d:"M12 16V8",key:"1sbj14"}]],Dj=et("circle-arrow-up",jae);const Fae=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],rd=et("circle-check-big",Fae);const zae=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["rect",{x:"9",y:"9",width:"6",height:"6",rx:"1",key:"1ssd4o"}]],Bae=et("circle-stop",zae);const Hae=[["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"}]],Nx=et("circle-x",Hae);const Vae=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],xa=et("clock",Vae);const $ae=[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]],AP=et("cloud",$ae);const Gae=[["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"}]],Wae=et("code-xml",Gae);const qae=[["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"}]],yN=et("copy",qae);const Xae=[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]],kj=et("database",Xae);const Kae=[["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"}]],Oj=et("dollar-sign",Kae);const Yae=[["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"}]],$u=et("download",Yae);const Zae=[["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"}]],BG=et("droplet",Zae);const Qae=[["path",{d:"M7 16.3c2.2 0 4-1.83 4-4.05 0-1.16-.57-2.26-1.71-3.19S7.29 6.75 7 5.3c-.29 1.45-1.14 2.84-2.29 3.76S3 11.1 3 12.25c0 2.22 1.8 4.05 4 4.05z",key:"1ptgy4"}],["path",{d:"M12.56 6.6A10.97 10.97 0 0 0 14 3.02c.5 2.5 2 4.9 4 6.5s3 3.5 3 5.5a6.98 6.98 0 0 1-11.91 4.97",key:"1sl1rz"}]],Jae=et("droplets",Qae);const ese=[["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"}]],tse=et("ellipsis-vertical",ese);const nse=[["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"}]],uc=et("external-link",nse);const ise=[["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"}]],rse=et("eye-off",ise);const ase=[["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"}]],Lj=et("eye",ase);const sse=[["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"}]],ose=et("file-box",sse);const lse=[["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 12.5 8 15l2 2.5",key:"1tg20x"}],["path",{d:"m14 12.5 2 2.5-2 2.5",key:"yinavb"}]],Ij=et("file-code",lse);const cse=[["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"}]],use=et("file-exclamation-point",cse);const dse=[["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"}]],gp=et("file-text",dse);const fse=[["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"}]],HG=et("file",fse);const hse=[["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"}]],wp=et("film",hse);const pse=[["path",{d:"M12 3q1 4 4 6.5t3 5.5a1 1 0 0 1-14 0 5 5 0 0 1 1-3 1 1 0 0 0 5 0c0-2-1.5-3-1.5-5q0-2 2.5-4",key:"1slcih"}]],mse=et("flame",pse);const gse=[["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"}]],xse=et("folder-open",gse);const vse=[["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"}]],yse=et("folder",vse);const bse=[["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"}]],_se=et("funnel",bse);const Sse=[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]],TP=et("gauge",Sse);const wse=[["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"}]],Uj=et("github",wse);const Mse=[["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"}]],O_=et("globe",Mse);const Ese=[["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"}]],CP=et("grip-vertical",Ese);const Ase=[["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"}]],VG=et("hard-drive",Ase);const Tse=[["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"}]],BS=et("image",Tse);const Cse=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],$G=et("info",Cse);const Nse=[["line",{x1:"19",x2:"10",y1:"4",y2:"4",key:"15jd3p"}],["line",{x1:"14",x2:"5",y1:"20",y2:"20",key:"bu0au3"}],["line",{x1:"15",x2:"9",y1:"4",y2:"20",key:"uljnxc"}]],Rse=et("italic",Nse);const Pse=[["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"}]],Dse=et("key",Pse);const kse=[["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"}]],bN=et("keyboard",kse);const Ose=[["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"}]],L_=et("layers",Ose);const Lse=[["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"}]],GG=et("layout-grid",Lse);const Ise=[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}],["path",{d:"M14 4h7",key:"3xa0d5"}],["path",{d:"M14 9h7",key:"1icrd9"}],["path",{d:"M14 15h7",key:"1mj8o2"}],["path",{d:"M14 20h7",key:"11slyb"}]],Use=et("layout-list",Ise);const jse=[["path",{d:"M9 17H7A5 5 0 0 1 7 7",key:"10o201"}],["path",{d:"M15 7h2a5 5 0 0 1 4 8",key:"1d3206"}],["line",{x1:"8",x2:"12",y1:"12",y2:"12",key:"rvw6j4"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]],Fse=et("link-2-off",jse);const zse=[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]],Bse=et("link-2",zse);const Hse=[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]],WG=et("link",Hse);const Vse=[["path",{d:"M11 5h10",key:"1cz7ny"}],["path",{d:"M11 12h10",key:"1438ji"}],["path",{d:"M11 19h10",key:"11t30w"}],["path",{d:"M4 4h1v5",key:"10yrso"}],["path",{d:"M4 9h2",key:"r1h2o0"}],["path",{d:"M6.5 20H3.4c0-1 2.6-1.925 2.6-3.5a1.5 1.5 0 0 0-2.6-1.02",key:"xtkcd5"}]],$se=et("list-ordered",Vse);const Gse=[["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"}]],qG=et("list",Gse);const Wse=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],Yt=et("loader-circle",Wse);const qse=[["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"}]],jj=et("log-in",qse);const Xse=[["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"}]],Kse=et("log-out",Xse);const Yse=[["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"}]],Zse=et("maximize-2",Yse);const Qse=[["path",{d:"M8 3H5a2 2 0 0 0-2 2v3",key:"1dcmit"}],["path",{d:"M21 8V5a2 2 0 0 0-2-2h-3",key:"1e4gt3"}],["path",{d:"M3 16v3a2 2 0 0 0 2 2h3",key:"wsl5sc"}],["path",{d:"M16 21h3a2 2 0 0 0 2-2v-3",key:"18trek"}]],Jse=et("maximize",Qse);const eoe=[["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"}]],toe=et("minimize-2",eoe);const noe=[["path",{d:"M8 3v3a2 2 0 0 1-2 2H3",key:"hohbtr"}],["path",{d:"M21 8h-3a2 2 0 0 1-2-2V3",key:"5jw1f3"}],["path",{d:"M3 16h3a2 2 0 0 1 2 2v3",key:"198tvr"}],["path",{d:"M16 21v-3a2 2 0 0 1 2-2h3",key:"ph8mxp"}]],ioe=et("minimize",noe);const roe=[["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"}]],I_=et("moon",roe);const aoe=[["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"}]],U_=et("package",aoe);const soe=[["rect",{x:"14",y:"3",width:"5",height:"18",rx:"1",key:"kaeet6"}],["rect",{x:"5",y:"3",width:"5",height:"18",rx:"1",key:"1wsw3u"}]],ooe=et("pause",soe);const loe=[["path",{d:"M13 21h8",key:"1jsn5i"}],["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"}]],NP=et("pen-line",loe);const coe=[["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"}]],XG=et("pen",coe);const uoe=[["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"}]],_N=et("pencil",uoe);const doe=[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]],HS=et("play",doe);const foe=[["path",{d:"M12 22v-5",key:"1ega77"}],["path",{d:"M9 8V2",key:"14iosj"}],["path",{d:"M15 8V2",key:"18g5xt"}],["path",{d:"M18 8v5a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V8Z",key:"osxo6l"}]],SN=et("plug",foe);const hoe=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],dc=et("plus",hoe);const poe=[["path",{d:"M18.36 6.64A9 9 0 0 1 20.77 15",key:"dxknvb"}],["path",{d:"M6.16 6.16a9 9 0 1 0 12.68 12.68",key:"1x7qb5"}],["path",{d:"M12 2v4",key:"3427ic"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],KG=et("power-off",poe);const moe=[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]],fm=et("power",moe);const goe=[["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"}]],fc=et("printer",goe);const xoe=[["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"}]],voe=et("qr-code",xoe);const yoe=[["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"}]],Zo=et("refresh-cw",yoe);const boe=[["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"}]],VS=et("rotate-ccw",boe);const _oe=[["path",{d:"M21.3 15.3a2.4 2.4 0 0 1 0 3.4l-2.6 2.6a2.4 2.4 0 0 1-3.4 0L2.7 8.7a2.41 2.41 0 0 1 0-3.4l2.6-2.6a2.41 2.41 0 0 1 3.4 0Z",key:"icamh8"}],["path",{d:"m14.5 12.5 2-2",key:"inckbg"}],["path",{d:"m11.5 9.5 2-2",key:"fmmyf7"}],["path",{d:"m8.5 6.5 2-2",key:"vc6u1g"}],["path",{d:"m17.5 15.5 2-2",key:"wo5hmg"}]],Soe=et("ruler",_oe);const woe=[["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"}]],Rx=et("save",woe);const Moe=[["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"}]],Eoe=et("scan-search",Moe);const Aoe=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],L0=et("search",Aoe);const Toe=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],YG=et("send",Toe);const Coe=[["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"}]],RP=et("settings-2",Coe);const Noe=[["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"}]],Roe=et("settings",Noe);const Poe=[["path",{d:"M2 20h.01",key:"4haj6o"}],["path",{d:"M7 20v-4",key:"j294jx"}],["path",{d:"M12 20v-8",key:"i3yub9"}],["path",{d:"M17 20V8",key:"1tkaf5"}],["path",{d:"M22 4v16",key:"sih9yq"}]],Doe=et("signal",Poe);const koe=[["path",{d:"M17.971 4.285A2 2 0 0 1 21 6v12a2 2 0 0 1-3.029 1.715l-9.997-5.998a2 2 0 0 1-.003-3.432z",key:"15892j"}],["path",{d:"M3 20V4",key:"1ptbpl"}]],Ooe=et("skip-back",koe);const Loe=[["path",{d:"M21 4v16",key:"7j8fe9"}],["path",{d:"M6.029 4.285A2 2 0 0 0 3 6v12a2 2 0 0 0 3.029 1.715l9.997-5.998a2 2 0 0 0 .003-3.432z",key:"zs4d6"}]],ZG=et("skip-forward",Loe);const Ioe=[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],Uoe=et("sparkles",Ioe);const joe=[["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"}]],j_=et("square-check-big",joe);const Foe=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],I0=et("square",Foe);const zoe=[["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"}]],U0=et("star",zoe);const Boe=[["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"}]],Hoe=et("sticky-note",Boe);const Voe=[["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"}]],Fj=et("sun",Voe);const $oe=[["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"}]],j0=et("tag",$oe);const Goe=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"6",key:"1vlfrh"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]],Woe=et("target",Goe);const qoe=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],Xoe=et("terminal",qoe);const Koe=[["path",{d:"M21 5H3",key:"1fi0y6"}],["path",{d:"M17 12H7",key:"16if0g"}],["path",{d:"M19 19H5",key:"vjpgq2"}]],Yoe=et("text-align-center",Koe);const Zoe=[["path",{d:"M21 5H3",key:"1fi0y6"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M21 19H7",key:"4cu937"}]],Qoe=et("text-align-end",Zoe);const Joe=[["path",{d:"M21 5H3",key:"1fi0y6"}],["path",{d:"M15 12H3",key:"6jk70r"}],["path",{d:"M17 19H3",key:"z6ezky"}]],ele=et("text-align-start",Joe);const tle=[["path",{d:"M14 4v10.54a4 4 0 1 1-4 0V4a2 2 0 0 1 4 0Z",key:"17jzev"}]],l0=et("thermometer",tle);const nle=[["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"}]],na=et("trash-2",nle);const ile=[["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"}]],hc=et("triangle-alert",ile);const rle=[["path",{d:"M6 4v6a6 6 0 0 0 12 0V4",key:"9kb039"}],["line",{x1:"4",x2:"20",y1:"20",y2:"20",key:"nun2al"}]],ale=et("underline",rle);const sle=[["path",{d:"m18.84 12.25 1.72-1.71h-.02a5.004 5.004 0 0 0-.12-7.07 5.006 5.006 0 0 0-6.95 0l-1.72 1.71",key:"yqzxt4"}],["path",{d:"m5.17 11.75-1.71 1.71a5.004 5.004 0 0 0 .12 7.07 5.006 5.006 0 0 0 6.95 0l1.71-1.71",key:"4qinb0"}],["line",{x1:"8",x2:"8",y1:"2",y2:"5",key:"1041cp"}],["line",{x1:"2",x2:"5",y1:"8",y2:"8",key:"14m1p5"}],["line",{x1:"16",x2:"16",y1:"19",y2:"22",key:"rzdirn"}],["line",{x1:"19",x2:"22",y1:"16",y2:"16",key:"ox905f"}]],QG=et("unlink",sle);const ole=[["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"}]],F0=et("upload",ole);const lle=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],zj=et("user",lle);const cle=[["path",{d:"m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5",key:"ftymec"}],["rect",{x:"2",y:"6",width:"14",height:"12",rx:"2",key:"158x01"}]],ule=et("video",cle);const dle=[["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"}]],PP=et("wifi-off",dle);const fle=[["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"}]],JG=et("wifi",fle);const hle=[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z",key:"1ngwbx"}]],Ip=et("wrench",hle);const ple=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Cn=et("x",ple);const mle=[["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"}]],gle=et("zoom-in",mle);const xle=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],e9=et("zap",xle);const vle=[["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"}]],yle=et("zoom-out",vle),t9=E.createContext(void 0);function ble({children:t}){const[e,n]=E.useState(()=>{const a=localStorage.getItem("theme");return a||(window.matchMedia("(prefers-color-scheme: light)").matches?"light":"dark")});E.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 p.jsx(t9.Provider,{value:{theme:e,toggleTheme:i,setTheme:r},children:t})}function n9(){const t=E.useContext(t9);if(!t)throw new Error("useTheme must be used within a ThemeProvider");return t}function Zt({children:t,className:e="",onClick:n,onContextMenu:i}){return p.jsx("div",{className:`bg-bambu-dark-secondary rounded-xl border border-bambu-dark-tertiary ${e}`,onClick:n,onContextMenu:i,children:t})}function Fo({children:t,className:e=""}){return p.jsx("div",{className:`px-6 py-4 border-b border-bambu-dark-tertiary ${e}`,children:t})}function cn({children:t,className:e=""}){return p.jsx("div",{className:`p-6 ${e}`,children:t})}function _le(t,e){return[{category:"Navigation",items:t?t.map((i,r)=>({keys:[String(r+1)],description:`Go to ${e(i.labelKey)}`})):[{keys:["1"],description:"Go to Printers"},{keys:["2"],description:"Go to Archives"},{keys:["3"],description:"Go to Queue"},{keys:["4"],description:"Go to Statistics"},{keys:["5"],description:"Go to Cloud Profiles"},{keys:["6"],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 Bj({children:t}){return p.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 Sle({onClose:t,navItems:e}){const{t:n}=mP(),i=_le(e,n);return E.useEffect(()=>{const r=a=>{a.key==="Escape"&&t()};return window.addEventListener("keydown",r),()=>window.removeEventListener("keydown",r)},[t]),p.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4",onClick:t,children:p.jsx(Zt,{className:"w-full max-w-md",onClick:r=>r.stopPropagation(),children:p.jsxs(cn,{className:"p-0",children:[p.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-bambu-dark-tertiary",children:[p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx(bN,{className:"w-5 h-5 text-bambu-green"}),p.jsx("h2",{className:"text-xl font-semibold text-white",children:"Keyboard Shortcuts"})]}),p.jsx("button",{onClick:t,className:"text-bambu-gray hover:text-white transition-colors",children:p.jsx(Cn,{className:"w-5 h-5"})})]}),p.jsx("div",{className:"p-4 space-y-6 max-h-[60vh] overflow-y-auto",children:i.map(r=>p.jsxs("div",{children:[p.jsx("h3",{className:"text-sm font-medium text-bambu-gray mb-3",children:r.category}),p.jsx("div",{className:"space-y-2",children:r.items.map(a=>p.jsxs("div",{className:"flex items-center justify-between",children:[p.jsx("span",{className:"text-white text-sm",children:a.description}),p.jsx("div",{className:"flex gap-1",children:a.keys.map(s=>p.jsx(Bj,{children:s},s))})]},a.description))})]},r.category))}),p.jsx("div",{className:"p-4 border-t border-bambu-dark-tertiary",children:p.jsxs("p",{className:"text-xs text-bambu-gray text-center",children:["Press ",p.jsx(Bj,{children:"Esc"})," or click outside to close"]})})]})})})}const Ri="/api/v1";async function ft(t,e={}){const n=await fetch(`${Ri}${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 Ye={getPrinters:()=>ft("/printers/"),getPrinter:t=>ft(`/printers/${t}`),createPrinter:t=>ft("/printers/",{method:"POST",body:JSON.stringify(t)}),updatePrinter:(t,e)=>ft(`/printers/${t}`,{method:"PATCH",body:JSON.stringify(e)}),deletePrinter:t=>ft(`/printers/${t}`,{method:"DELETE"}),getPrinterStatus:t=>ft(`/printers/${t}/status`),connectPrinter:t=>ft(`/printers/${t}/connect`,{method:"POST"}),disconnectPrinter:t=>ft(`/printers/${t}/disconnect`,{method:"POST"}),enableMQTTLogging:t=>ft(`/printers/${t}/logging/enable`,{method:"POST"}),disableMQTTLogging:t=>ft(`/printers/${t}/logging/disable`,{method:"POST"}),getMQTTLogs:t=>ft(`/printers/${t}/logging`),clearMQTTLogs:t=>ft(`/printers/${t}/logging`,{method:"DELETE"}),getPrinterFiles:(t,e="/")=>ft(`/printers/${t}/files?path=${encodeURIComponent(e)}`),getPrinterFileDownloadUrl:(t,e)=>`${Ri}/printers/${t}/files/download?path=${encodeURIComponent(e)}`,deletePrinterFile:(t,e)=>ft(`/printers/${t}/files?path=${encodeURIComponent(e)}`,{method:"DELETE"}),getPrinterStorage:t=>ft(`/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)),ft(`/archives/?${i}`)},getArchive:t=>ft(`/archives/${t}`),updateArchive:(t,e)=>ft(`/archives/${t}`,{method:"PATCH",body:JSON.stringify(e)}),toggleFavorite:t=>ft(`/archives/${t}/favorite`,{method:"POST"}),deleteArchive:t=>ft(`/archives/${t}`,{method:"DELETE"}),getArchiveStats:()=>ft("/archives/stats"),getArchiveDuplicates:t=>ft(`/archives/${t}/duplicates`),backfillContentHashes:()=>ft("/archives/backfill-hashes",{method:"POST"}),getArchiveThumbnail:t=>`${Ri}/archives/${t}/thumbnail`,getArchiveDownload:t=>`${Ri}/archives/${t}/download`,getArchiveGcode:t=>`${Ri}/archives/${t}/gcode`,getArchiveTimelapse:t=>`${Ri}/archives/${t}/timelapse`,scanArchiveTimelapse:t=>ft(`/archives/${t}/timelapse/scan`,{method:"POST"}),selectArchiveTimelapse:(t,e)=>ft(`/archives/${t}/timelapse/select?filename=${encodeURIComponent(e)}`,{method:"POST"}),uploadArchiveTimelapse:async(t,e)=>{const n=new FormData;n.append("file",e);const i=await fetch(`${Ri}/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)=>`${Ri}/archives/${t}/photos/${encodeURIComponent(e)}`,uploadArchivePhoto:async(t,e)=>{const n=new FormData;n.append("file",e);const i=await fetch(`${Ri}/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)=>ft(`/archives/${t}/photos/${encodeURIComponent(e)}`,{method:"DELETE"}),getSource3mfDownloadUrl:t=>`${Ri}/archives/${t}/source`,getSource3mfForSlicer:(t,e)=>`${Ri}/archives/${t}/source/${encodeURIComponent(e.endsWith(".3mf")?e:e+".3mf")}`,uploadSource3mf:async(t,e)=>{const n=new FormData;n.append("file",e);const i=await fetch(`${Ri}/archives/${t}/source`,{method:"POST",body:n});if(!i.ok){const r=await i.json().catch(()=>({}));throw new Error(r.detail||`HTTP ${i.status}`)}return i.json()},deleteSource3mf:t=>ft(`/archives/${t}/source`,{method:"DELETE"}),getArchiveQRCodeUrl:(t,e=200)=>`${Ri}/archives/${t}/qrcode?size=${e}`,getArchiveCapabilities:t=>ft(`/archives/${t}/capabilities`),getArchiveProjectPage:t=>ft(`/archives/${t}/project-page`),updateArchiveProjectPage:(t,e)=>ft(`/archives/${t}/project-page`,{method:"PATCH",body:JSON.stringify(e)}),getArchiveProjectImageUrl:(t,e)=>`${Ri}/archives/${t}/project-image/${encodeURIComponent(e)}`,getArchiveForSlicer:(t,e)=>`${Ri}/archives/${t}/file/${encodeURIComponent(e.endsWith(".3mf")?e:e+".3mf")}`,reprintArchive:(t,e)=>ft(`/archives/${t}/reprint?printer_id=${e}`,{method:"POST"}),uploadArchive:async(t,e)=>{const n=new FormData;n.append("file",t);const i=e?`${Ri}/archives/upload?printer_id=${e}`:`${Ri}/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?`${Ri}/archives/upload-bulk?printer_id=${e}`:`${Ri}/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:()=>ft("/settings/"),updateSettings:t=>ft("/settings/",{method:"PUT",body:JSON.stringify(t)}),resetSettings:()=>ft("/settings/reset",{method:"POST"}),checkFfmpeg:()=>ft("/settings/check-ffmpeg"),getCloudStatus:()=>ft("/cloud/status"),cloudLogin:(t,e,n="global")=>ft("/cloud/login",{method:"POST",body:JSON.stringify({email:t,password:e,region:n})}),cloudVerify:(t,e)=>ft("/cloud/verify",{method:"POST",body:JSON.stringify({email:t,code:e})}),cloudSetToken:t=>ft("/cloud/token",{method:"POST",body:JSON.stringify({access_token:t})}),cloudLogout:()=>ft("/cloud/logout",{method:"POST"}),getCloudSettings:(t="01.09.00.00")=>ft(`/cloud/settings?version=${t}`),getCloudSettingDetail:t=>ft(`/cloud/settings/${t}`),getCloudDevices:()=>ft("/cloud/devices"),getSmartPlugs:()=>ft("/smart-plugs/"),getSmartPlug:t=>ft(`/smart-plugs/${t}`),getSmartPlugByPrinter:t=>ft(`/smart-plugs/by-printer/${t}`),createSmartPlug:t=>ft("/smart-plugs/",{method:"POST",body:JSON.stringify(t)}),updateSmartPlug:(t,e)=>ft(`/smart-plugs/${t}`,{method:"PATCH",body:JSON.stringify(e)}),deleteSmartPlug:t=>ft(`/smart-plugs/${t}`,{method:"DELETE"}),controlSmartPlug:(t,e)=>ft(`/smart-plugs/${t}/control`,{method:"POST",body:JSON.stringify({action:e})}),getSmartPlugStatus:t=>ft(`/smart-plugs/${t}/status`),testSmartPlugConnection:(t,e,n)=>ft("/smart-plugs/test-connection",{method:"POST",body:JSON.stringify({ip_address:t,username:e,password:n})}),getQueue:(t,e)=>{const n=new URLSearchParams;return t&&n.set("printer_id",String(t)),e&&n.set("status",e),ft(`/queue/?${n}`)},getQueueItem:t=>ft(`/queue/${t}`),addToQueue:t=>ft("/queue/",{method:"POST",body:JSON.stringify(t)}),updateQueueItem:(t,e)=>ft(`/queue/${t}`,{method:"PATCH",body:JSON.stringify(e)}),removeFromQueue:t=>ft(`/queue/${t}`,{method:"DELETE"}),reorderQueue:t=>ft("/queue/reorder",{method:"POST",body:JSON.stringify({items:t})}),cancelQueueItem:t=>ft(`/queue/${t}/cancel`,{method:"POST"}),stopQueueItem:t=>ft(`/queue/${t}/stop`,{method:"POST"}),getKProfiles:(t,e="0.4")=>ft(`/printers/${t}/kprofiles/?nozzle_diameter=${e}`),setKProfile:(t,e)=>ft(`/printers/${t}/kprofiles/`,{method:"POST",body:JSON.stringify(e)}),deleteKProfile:(t,e)=>ft(`/printers/${t}/kprofiles/`,{method:"DELETE",body:JSON.stringify(e)}),getSlotPresets:t=>ft(`/printers/${t}/slot-presets`),getSlotPreset:(t,e,n)=>ft(`/printers/${t}/slot-presets/${e}/${n}`),saveSlotPreset:(t,e,n,i,r)=>ft(`/printers/${t}/slot-presets/${e}/${n}?preset_id=${encodeURIComponent(i)}&preset_name=${encodeURIComponent(r)}`,{method:"PUT"}),deleteSlotPreset:(t,e,n)=>ft(`/printers/${t}/slot-presets/${e}/${n}`,{method:"DELETE"}),listFilaments:()=>ft("/filaments/"),getFilament:t=>ft(`/filaments/${t}`),getFilamentsByType:t=>ft(`/filaments/by-type/${t}`),getNotificationProviders:()=>ft("/notifications/"),getNotificationProvider:t=>ft(`/notifications/${t}`),createNotificationProvider:t=>ft("/notifications/",{method:"POST",body:JSON.stringify(t)}),updateNotificationProvider:(t,e)=>ft(`/notifications/${t}`,{method:"PATCH",body:JSON.stringify(e)}),deleteNotificationProvider:t=>ft(`/notifications/${t}`,{method:"DELETE"}),testNotificationProvider:t=>ft(`/notifications/${t}/test`,{method:"POST"}),testNotificationConfig:t=>ft("/notifications/test-config",{method:"POST",body:JSON.stringify(t)}),getSpoolmanStatus:()=>ft("/spoolman/status"),connectSpoolman:()=>ft("/spoolman/connect",{method:"POST"}),disconnectSpoolman:()=>ft("/spoolman/disconnect",{method:"POST"}),syncPrinterAms:t=>ft(`/spoolman/sync/${t}`,{method:"POST"}),syncAllPrintersAms:()=>ft("/spoolman/sync-all",{method:"POST"}),getSpoolmanSpools:()=>ft("/spoolman/spools"),getSpoolmanFilaments:()=>ft("/spoolman/filaments"),getVersion:()=>ft("/updates/version"),checkForUpdates:()=>ft("/updates/check"),applyUpdate:()=>ft("/updates/apply",{method:"POST"}),getUpdateStatus:()=>ft("/updates/status"),getMaintenanceTypes:()=>ft("/maintenance/types"),createMaintenanceType:t=>ft("/maintenance/types",{method:"POST",body:JSON.stringify(t)}),updateMaintenanceType:(t,e)=>ft(`/maintenance/types/${t}`,{method:"PATCH",body:JSON.stringify(e)}),deleteMaintenanceType:t=>ft(`/maintenance/types/${t}`,{method:"DELETE"}),getMaintenanceOverview:()=>ft("/maintenance/overview"),getPrinterMaintenance:t=>ft(`/maintenance/printers/${t}`),updateMaintenanceItem:(t,e)=>ft(`/maintenance/items/${t}`,{method:"PATCH",body:JSON.stringify(e)}),performMaintenance:(t,e)=>ft(`/maintenance/items/${t}/perform`,{method:"POST",body:JSON.stringify({notes:e})}),getMaintenanceHistory:t=>ft(`/maintenance/items/${t}/history`),getMaintenanceSummary:()=>ft("/maintenance/summary"),setPrinterHours:(t,e)=>ft(`/maintenance/printers/${t}/hours?total_hours=${e}`,{method:"PATCH"}),getCameraStreamUrl:(t,e=10)=>`${Ri}/printers/${t}/camera/stream?fps=${e}`,getCameraSnapshotUrl:t=>`${Ri}/printers/${t}/camera/snapshot`,testCameraConnection:t=>ft(`/printers/${t}/camera/test`)},a_=[{id:"printers",to:"/",icon:fc,labelKey:"nav.printers"},{id:"archives",to:"/archives",icon:mae,labelKey:"nav.archives"},{id:"queue",to:"/queue",icon:Yo,labelKey:"nav.queue"},{id:"stats",to:"/stats",icon:Pae,labelKey:"nav.stats"},{id:"profiles",to:"/profiles",icon:AP,labelKey:"nav.profiles"},{id:"maintenance",to:"/maintenance",icon:Ip,labelKey:"nav.maintenance"},{id:"settings",to:"/settings",icon:Roe,labelKey:"nav.settings"}];function wle(){const t=localStorage.getItem("sidebarOrder");if(t)try{const e=JSON.parse(t),n=new Map(a_.map(r=>[r.id,r])),i=[];for(const r of e){const a=n.get(r);a&&(i.push(a),n.delete(r))}for(const r of n.values())i.push(r);return i}catch{return a_}return a_}function Mle(t){localStorage.setItem("sidebarOrder",JSON.stringify(t.map(e=>e.id)))}function i9(){return localStorage.getItem("defaultView")||"/"}function Ele(t){localStorage.setItem("defaultView",t)}function Ale(){const t=xP(),e=nd(),{theme:n,toggleTheme:i}=n9(),{t:r}=mP(),[a,s]=E.useState(()=>localStorage.getItem("sidebarExpanded")!=="false"),[o,l]=E.useState(!1),[c,d]=E.useState(wle),[f,m]=E.useState(null),[g,y]=E.useState(null),_=E.useRef(!1),{data:v}=It({queryKey:["version"],queryFn:Ye.getVersion,staleTime:1/0}),{data:x}=It({queryKey:["settings"],queryFn:Ye.getSettings,staleTime:300*1e3}),{data:M}=It({queryKey:["updateCheck"],queryFn:Ye.checkForUpdates,enabled:x?.check_updates!==!1,staleTime:3600*1e3,refetchInterval:3600*1e3});E.useEffect(()=>{if(!_.current&&e.pathname==="/"){const N=i9();N!=="/"&&(_.current=!0,t(N,{replace:!0}))}},[e.pathname,t]),E.useEffect(()=>{localStorage.setItem("sidebarExpanded",String(a))},[a]);const w=(N,D)=>{m(D),N.dataTransfer.effectAllowed="move",N.dataTransfer.setData("text/plain",String(D))},T=(N,D)=>{N.preventDefault(),N.dataTransfer.dropEffect="move",y(D)},C=()=>{y(null)},P=(N,D)=>{if(N.preventDefault(),f===null||f===D){m(null),y(null);return}const F=[...c],[I]=F.splice(f,1);F.splice(D,0,I),d(F),Mle(F),m(null),y(null)},A=()=>{m(null),y(null)},U=E.useCallback(N=>{const D=N.target;if(!(D.tagName==="INPUT"||D.tagName==="TEXTAREA"||D.isContentEditable)&&!N.metaKey&&!N.ctrlKey&&!N.altKey){const F=parseInt(N.key);if(F>=1&&F<=c.length){N.preventDefault(),t(c[F-1].to);return}switch(N.key){case"?":N.preventDefault(),l(!0);break;case"Escape":l(!1);break}}},[t,c]);return E.useEffect(()=>(document.addEventListener("keydown",U),()=>document.removeEventListener("keydown",U)),[U]),p.jsxs("div",{className:"flex min-h-screen",children:[p.jsxs("aside",{className:`${a?"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:[p.jsx("div",{className:`border-b border-bambu-dark-tertiary flex items-center justify-center ${a?"p-4":"p-2"}`,children:p.jsx("img",{src:n==="dark"?"/img/bambusy_logo_dark.png":"/img/bambusy_logo_light.png",alt:"Bambusy",className:a?"h-16 w-auto":"h-8 w-8 object-cover object-left"})}),p.jsx("nav",{className:"flex-1 p-2",children:p.jsx("ul",{className:"space-y-2",children:c.map(({id:N,to:D,icon:F,labelKey:I},W)=>p.jsx("li",{draggable:!0,onDragStart:O=>w(O,W),onDragOver:O=>T(O,W),onDragLeave:C,onDrop:O=>P(O,W),onDragEnd:A,className:`relative ${f===W?"opacity-50":""} ${g===W&&f!==W?"before:absolute before:left-0 before:right-0 before:top-0 before:h-0.5 before:bg-bambu-green":""}`,children:p.jsxs(AG,{to:D,className:({isActive:O})=>`flex items-center ${a?"gap-3 px-4":"justify-center px-2"} py-3 rounded-lg transition-colors group ${O?"bg-bambu-green text-white":"text-bambu-gray-light hover:bg-bambu-dark-tertiary hover:text-white"}`,title:a?void 0:r(I),children:[a&&p.jsx(CP,{className:"w-4 h-4 flex-shrink-0 opacity-0 group-hover:opacity-50 cursor-grab active:cursor-grabbing -ml-1"}),p.jsx(F,{className:"w-5 h-5 flex-shrink-0"}),a&&p.jsx("span",{children:r(I)})]})},N))})}),p.jsx("button",{onClick:()=>s(!a),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:r(a?"nav.collapseSidebar":"nav.expandSidebar"),children:a?p.jsx(_f,{className:"w-5 h-5"}):p.jsx(zf,{className:"w-5 h-5"})}),p.jsx("div",{className:"p-2 border-t border-bambu-dark-tertiary",children:a?p.jsxs("div",{className:"flex items-center justify-between px-2",children:[p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsxs("span",{className:"text-sm text-bambu-gray",children:["v",v?.version||"..."]}),M?.update_available&&p.jsxs("button",{onClick:()=>t("/settings"),className:"flex items-center gap-1 text-xs text-bambu-green hover:text-bambu-green/80 transition-colors",title:r("nav.updateAvailable",{version:M.latest_version}),children:[p.jsx(Dj,{className:"w-4 h-4"}),p.jsx("span",{children:r("nav.update")})]})]}),p.jsxs("div",{className:"flex items-center gap-1",children:[p.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:r("nav.viewOnGithub"),children:p.jsx(Uj,{className:"w-5 h-5"})}),p.jsx("button",{onClick:()=>l(!0),className:"p-2 rounded-lg hover:bg-bambu-dark-tertiary transition-colors text-bambu-gray-light hover:text-white",title:r("nav.keyboardShortcuts"),children:p.jsx(bN,{className:"w-5 h-5"})}),p.jsx("button",{onClick:i,className:"p-2 rounded-lg hover:bg-bambu-dark-tertiary transition-colors text-bambu-gray-light hover:text-white",title:r(n==="dark"?"nav.switchToLight":"nav.switchToDark"),children:n==="dark"?p.jsx(Fj,{className:"w-5 h-5"}):p.jsx(I_,{className:"w-5 h-5"})})]})]}):p.jsxs("div",{className:"flex flex-col items-center gap-1",children:[M?.update_available&&p.jsx("button",{onClick:()=>t("/settings"),className:"p-2 rounded-lg hover:bg-bambu-dark-tertiary transition-colors text-bambu-green hover:text-bambu-green/80",title:r("nav.updateAvailable",{version:M.latest_version}),children:p.jsx(Dj,{className:"w-5 h-5"})}),p.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:r("nav.viewOnGithub"),children:p.jsx(Uj,{className:"w-5 h-5"})}),p.jsx("button",{onClick:()=>l(!0),className:"p-2 rounded-lg hover:bg-bambu-dark-tertiary transition-colors text-bambu-gray-light hover:text-white",title:r("nav.keyboardShortcuts"),children:p.jsx(bN,{className:"w-5 h-5"})}),p.jsx("button",{onClick:i,className:"p-2 rounded-lg hover:bg-bambu-dark-tertiary transition-colors text-bambu-gray-light hover:text-white",title:r(n==="dark"?"nav.switchToLight":"nav.switchToDark"),children:n==="dark"?p.jsx(Fj,{className:"w-5 h-5"}):p.jsx(I_,{className:"w-5 h-5"})})]})})]}),p.jsx("main",{className:`flex-1 bg-bambu-dark overflow-auto ${a?"ml-64":"ml-16"} transition-all duration-300`,children:p.jsx(qie,{})}),o&&p.jsx(Sle,{onClose:()=>l(!1),navItems:c})]})}function st({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"},o={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 p.jsx("button",{className:`${a} ${s[t]} ${o[e]} ${n}`,...r,children:i})}function ma({title:t,message:e,confirmText:n="Confirm",cancelText:i="Cancel",variant:r="default",onConfirm:a,onCancel:s}){E.useEffect(()=>{const c=d=>{d.key==="Escape"&&s()};return window.addEventListener("keydown",c),()=>window.removeEventListener("keydown",c)},[s]);const l={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 p.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4",onClick:s,children:p.jsx(Zt,{className:"w-full max-w-md",onClick:c=>c.stopPropagation(),children:p.jsxs(cn,{className:"p-6",children:[p.jsxs("div",{className:"flex items-start gap-4",children:[p.jsx("div",{className:`p-2 rounded-full bg-bambu-dark ${l.icon}`,children:p.jsx(hc,{className:"w-6 h-6"})}),p.jsxs("div",{className:"flex-1",children:[p.jsx("h3",{className:"text-lg font-semibold text-white mb-2",children:t}),p.jsx("p",{className:"text-bambu-gray text-sm",children:e})]})]}),p.jsxs("div",{className:"flex gap-3 mt-6",children:[p.jsx(st,{variant:"secondary",onClick:s,className:"flex-1",children:i}),p.jsx(st,{onClick:a,className:`flex-1 ${l.button}`,children:n})]})]})})})}const r9=E.createContext(void 0);function Mo(){const t=E.useContext(r9);if(!t)throw new Error("useToast must be used within a ToastProvider");return t}const Tle={success:p.jsx(rd,{className:"w-5 h-5 text-green-400"}),error:p.jsx(Nx,{className:"w-5 h-5 text-red-400"}),warning:p.jsx(id,{className:"w-5 h-5 text-yellow-400"}),info:p.jsx($G,{className:"w-5 h-5 text-blue-400"})},Cle={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 Nle({children:t}){const[e,n]=E.useState([]),i=E.useCallback((a,s="success")=>{const o=Math.random().toString(36).substr(2,9);n(l=>[...l,{id:o,message:a,type:s}]),setTimeout(()=>{n(l=>l.filter(c=>c.id!==o))},3e3)},[]),r=E.useCallback(a=>{n(s=>s.filter(o=>o.id!==a))},[]);return p.jsxs(r9.Provider,{value:{showToast:i},children:[t,p.jsx("div",{className:"fixed bottom-4 right-4 z-50 flex flex-col gap-2",children:e.map(a=>p.jsxs("div",{className:`flex items-center gap-3 px-4 py-3 rounded-lg border shadow-lg backdrop-blur-sm animate-slide-in ${Cle[a.type]}`,children:[Tle[a.type],p.jsx("span",{className:"text-white text-sm",children:a.message}),p.jsx("button",{onClick:()=>r(a.id),className:"ml-2 text-bambu-gray hover:text-white transition-colors",children:p.jsx(Cn,{className:"w-4 h-4"})})]},a.id))})]})}function Rle(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 Hj(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 Ple(t,e){if(e)return yse;switch(t.toLowerCase().split(".").pop()||""){case"3mf":return ose;case"gcode":return gp;case"mp4":case"avi":return wp;case"png":case"jpg":case"jpeg":return BS;default:return HG}}function Dle({printerId:t,printerName:e,onClose:n}){const{showToast:i}=Mo(),r=Jn(),[a,s]=E.useState("/"),[o,l]=E.useState(null),[c,d]=E.useState(""),[f,m]=E.useState(null);E.useEffect(()=>{const A=U=>{U.key==="Escape"&&n()};return window.addEventListener("keydown",A),()=>window.removeEventListener("keydown",A)},[n]);const{data:g,isLoading:y,refetch:_}=It({queryKey:["printerFiles",t,a],queryFn:()=>Ye.getPrinterFiles(t,a)}),{data:v}=It({queryKey:["printerStorage",t],queryFn:()=>Ye.getPrinterStorage(t),staleTime:3e4}),x=Ot({mutationFn:A=>Ye.deletePrinterFile(t,A),onSuccess:(A,U)=>{i(`Deleted: ${U.split("/").pop()}`),r.invalidateQueries({queryKey:["printerFiles",t]}),l(null)},onError:A=>{i(`Delete failed: ${A.message}`,"error")}}),M=A=>{s(A),l(null)},w=()=>{if(a==="/")return;const A=a.split("/").filter(Boolean);A.pop(),s(A.length?"/"+A.join("/"):"/"),l(null)},T=A=>{window.open(Ye.getPrinterFileDownloadUrl(t,A),"_blank")},C=A=>{m(A)},P=[{path:"/",label:"Root"},{path:"/cache",label:"Cache"},{path:"/model",label:"Models"},{path:"/timelapse",label:"Timelapse"}];return p.jsxs("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4",onClick:n,children:[p.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:A=>A.stopPropagation(),children:[p.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-bambu-dark-tertiary flex-shrink-0",children:[p.jsxs("div",{className:"flex items-center gap-3",children:[p.jsx(VG,{className:"w-5 h-5 text-bambu-green"}),p.jsxs("div",{children:[p.jsx("h2",{className:"text-lg font-semibold text-white",children:"File Manager"}),p.jsx("p",{className:"text-sm text-bambu-gray",children:e})]})]}),p.jsxs("div",{className:"flex items-center gap-4",children:[v&&(v.used_bytes!=null||v.free_bytes!=null)&&p.jsxs("div",{className:"text-sm text-bambu-gray flex items-center gap-2",children:[v.used_bytes!=null&&p.jsxs("span",{children:["Used: ",Hj(v.used_bytes)]}),v.used_bytes!=null&&v.free_bytes!=null&&p.jsx("span",{className:"text-bambu-dark-tertiary",children:"|"}),v.free_bytes!=null&&p.jsxs("span",{children:["Free: ",Hj(v.free_bytes)]})]}),p.jsx("button",{onClick:n,className:"text-bambu-gray hover:text-white transition-colors",children:p.jsx(Cn,{className:"w-5 h-5"})})]})]}),p.jsxs("div",{className:"flex items-center gap-2 p-3 border-b border-bambu-dark-tertiary bg-bambu-dark/50 flex-shrink-0",children:[P.map(A=>p.jsx("button",{onClick:()=>{M(A.path),d("")},className:`px-3 py-1 text-sm rounded-full transition-colors ${a===A.path?"bg-bambu-green text-white":"bg-bambu-dark-tertiary text-bambu-gray hover:text-white"}`,children:A.label},A.path)),p.jsx("div",{className:"flex-1"}),p.jsxs("div",{className:"relative",children:[p.jsx(L0,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray"}),p.jsx("input",{type:"text",placeholder:"Filter files...",value:c,onChange:A=>d(A.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"})]}),p.jsx(st,{variant:"secondary",size:"sm",onClick:()=>_(),disabled:y,children:p.jsx(Zo,{className:`w-4 h-4 ${y?"animate-spin":""}`})})]}),p.jsxs("div",{className:"flex items-center gap-2 px-4 py-2 bg-bambu-dark text-sm flex-shrink-0",children:[p.jsx("button",{onClick:w,disabled:a==="/",className:"p-1 rounded hover:bg-bambu-dark-tertiary disabled:opacity-50 disabled:cursor-not-allowed",children:p.jsx(_f,{className:"w-4 h-4"})}),p.jsx("span",{className:"text-bambu-gray font-mono",children:a})]}),p.jsx("div",{className:"flex-1 overflow-y-auto p-2 min-h-0",children:y?p.jsx("div",{className:"flex items-center justify-center py-12",children:p.jsx(Yt,{className:"w-8 h-8 text-bambu-green animate-spin"})}):g?.files?.length?p.jsx("div",{className:"space-y-1",children:[...g.files].filter(A=>!c||A.name.toLowerCase().includes(c.toLowerCase())).sort((A,U)=>A.is_directory&&!U.is_directory?-1:!A.is_directory&&U.is_directory?1:A.name.localeCompare(U.name)).map(A=>{const U=Ple(A.name,A.is_directory),N=o===A.path;return p.jsxs("div",{className:`flex items-center gap-3 p-2 rounded-lg cursor-pointer transition-colors ${N?"bg-bambu-green/20 border border-bambu-green/50":"hover:bg-bambu-dark-tertiary"}`,onClick:()=>{A.is_directory?M(A.path):l(N?null:A.path)},children:[p.jsx(U,{className:`w-5 h-5 flex-shrink-0 ${A.is_directory?"text-bambu-green":"text-bambu-gray"}`}),p.jsx("span",{className:"flex-1 text-white truncate",children:A.name}),!A.is_directory&&p.jsx("span",{className:"text-sm text-bambu-gray",children:Rle(A.size)}),A.is_directory&&p.jsx(_f,{className:"w-4 h-4 text-bambu-gray rotate-180"})]},A.path)})}):p.jsx("div",{className:"text-center py-12 text-bambu-gray",children:"No files in this directory"})}),p.jsxs("div",{className:"flex items-center justify-between p-4 border-t border-bambu-dark-tertiary bg-bambu-dark/50 flex-shrink-0",children:[p.jsx("div",{className:"text-sm text-bambu-gray",children:c?`${g?.files?.filter(A=>A.name.toLowerCase().includes(c.toLowerCase())).length||0} of ${g?.files?.length||0} items`:`${g?.files?.length||0} items`}),p.jsxs("div",{className:"flex gap-2",children:[p.jsxs(st,{variant:"secondary",disabled:!o,onClick:()=>o&&T(o),children:[p.jsx($u,{className:"w-4 h-4"}),"Download"]}),p.jsxs(st,{variant:"secondary",disabled:!o||x.isPending,onClick:()=>o&&C(o),className:"text-red-400 hover:text-red-300",children:[x.isPending?p.jsx(Yt,{className:"w-4 h-4 animate-spin"}):p.jsx(na,{className:"w-4 h-4"}),"Delete"]})]})]})]}),f&&p.jsx(ma,{title:"Delete File",message:`Delete "${f.split("/").pop()}"? This cannot be undone.`,confirmText:"Delete",variant:"danger",onConfirm:()=>{x.mutate(f),m(null)},onCancel:()=>m(null)})]})}function kle({printerId:t,printerName:e,onClose:n}){const i=Jn(),[r,a]=E.useState(!0),[s,o]=E.useState(new Set),[l,c]=E.useState(""),[d,f]=E.useState("all"),m=E.useRef(null),{data:g,isLoading:y,refetch:_}=It({queryKey:["mqtt-logs",t],queryFn:()=>Ye.getMQTTLogs(t),refetchInterval:1e3}),v=Ot({mutationFn:()=>Ye.enableMQTTLogging(t),onSuccess:()=>{i.invalidateQueries({queryKey:["mqtt-logs",t]})}}),x=Ot({mutationFn:()=>Ye.disableMQTTLogging(t),onSuccess:()=>{i.invalidateQueries({queryKey:["mqtt-logs",t]})}}),M=Ot({mutationFn:()=>Ye.clearMQTTLogs(t),onSuccess:()=>{i.invalidateQueries({queryKey:["mqtt-logs",t]})}});E.useEffect(()=>{const N=D=>{D.key==="Escape"&&n()};return window.addEventListener("keydown",N),()=>window.removeEventListener("keydown",N)},[n]),E.useEffect(()=>{r&&m.current&&(m.current.scrollTop=m.current.scrollHeight)},[g?.logs,r]);const w=N=>{o(D=>{const F=new Set(D);return F.has(N)?F.delete(N):F.add(N),F})},T=N=>new Date(N).toLocaleTimeString("en-US",{hour12:!1,fractionalSecondDigits:3}),C=(N,D)=>{if(N==null)return"<empty>";const F=typeof N=="string"?JSON.parse(N):N,I=JSON.stringify(F,null,D?2:0);return!D&&I.length>100?I.substring(0,100)+"...":I},P=g?.logging_enabled??!1,A=g?.logs??[],U=E.useMemo(()=>A.filter(N=>{if(d!=="all"&&N.direction!==d)return!1;if(l.trim()){const D=l.toLowerCase(),F=N.topic.toLowerCase().includes(D),W=JSON.stringify(N.payload).toLowerCase().includes(D);return F||W}return!0}),[A,l,d]);return p.jsx("div",{className:"fixed inset-0 bg-black/70 flex items-center justify-center z-50 p-4",children:p.jsxs("div",{className:"bg-bambu-dark-secondary rounded-lg max-w-4xl w-full max-h-[85vh] flex flex-col",children:[p.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-bambu-dark-tertiary",children:[p.jsxs("div",{children:[p.jsx("h2",{className:"text-lg font-semibold text-white",children:"MQTT Debug Log"}),p.jsx("p",{className:"text-sm text-bambu-gray",children:e})]}),p.jsx("button",{onClick:n,className:"text-bambu-gray hover:text-white transition-colors",children:p.jsx(Cn,{className:"w-5 h-5"})})]}),p.jsxs("div",{className:"flex flex-col gap-2 p-4 border-b border-bambu-dark-tertiary",children:[p.jsxs("div",{className:"flex items-center gap-2",children:[P?p.jsxs(st,{size:"sm",variant:"secondary",onClick:()=>x.mutate(),disabled:x.isPending,children:[p.jsx(I0,{className:"w-4 h-4"}),"Stop"]}):p.jsxs(st,{size:"sm",onClick:()=>v.mutate(),disabled:v.isPending,children:[p.jsx(HS,{className:"w-4 h-4"}),"Start Logging"]}),p.jsxs(st,{size:"sm",variant:"secondary",onClick:()=>M.mutate(),disabled:M.isPending||A.length===0,children:[p.jsx(na,{className:"w-4 h-4"}),"Clear"]}),p.jsx(st,{size:"sm",variant:"secondary",onClick:()=>_(),disabled:y,children:p.jsx(Zo,{className:`w-4 h-4 ${y?"animate-spin":""}`})}),p.jsx("div",{className:"flex-1"}),p.jsxs("label",{className:"flex items-center gap-2 text-sm text-bambu-gray cursor-pointer",children:[p.jsx("input",{type:"checkbox",checked:r,onChange:N=>a(N.target.checked),className:"rounded border-bambu-dark-tertiary"}),"Auto-scroll"]}),p.jsxs("span",{className:"text-sm text-bambu-gray",children:[U.length,"/",A.length]})]}),p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsxs("div",{className:"relative flex-1",children:[p.jsx(L0,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray"}),p.jsx("input",{type:"text",placeholder:"Search topic or payload...",value:l,onChange:N=>c(N.target.value),className:"w-full pl-8 pr-3 py-1.5 text-sm bg-bambu-dark border border-bambu-dark-tertiary rounded text-white placeholder-bambu-gray focus:border-bambu-green focus:outline-none"}),l&&p.jsx("button",{onClick:()=>c(""),className:"absolute right-2 top-1/2 -translate-y-1/2 text-bambu-gray hover:text-white",children:p.jsx(Cn,{className:"w-4 h-4"})})]}),p.jsxs("div",{className:"flex items-center gap-1 bg-bambu-dark rounded border border-bambu-dark-tertiary",children:[p.jsx("button",{onClick:()=>f("all"),className:`px-2 py-1.5 text-xs rounded-l transition-colors ${d==="all"?"bg-bambu-green text-white":"text-bambu-gray hover:text-white"}`,children:"All"}),p.jsxs("button",{onClick:()=>f("in"),className:`px-2 py-1.5 text-xs transition-colors flex items-center gap-1 ${d==="in"?"bg-blue-500 text-white":"text-bambu-gray hover:text-white"}`,children:[p.jsx(gN,{className:"w-3 h-3"}),"In"]}),p.jsxs("button",{onClick:()=>f("out"),className:`px-2 py-1.5 text-xs rounded-r transition-colors flex items-center gap-1 ${d==="out"?"bg-green-500 text-white":"text-bambu-gray hover:text-white"}`,children:[p.jsx(xN,{className:"w-3 h-3"}),"Out"]})]})]})]}),p.jsx("div",{ref:m,className:"flex-1 overflow-auto p-4 font-mono text-xs bg-black min-h-[400px]",children:A.length===0?p.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-bambu-gray",children:[p.jsx("p",{className:"mb-2",children:"No messages logged yet"}),!P&&p.jsx("p",{className:"text-sm",children:'Click "Start Logging" to begin capturing MQTT messages'})]}):U.length===0?p.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-bambu-gray",children:[p.jsx("p",{className:"mb-2",children:"No messages match your filter"}),p.jsx("p",{className:"text-sm",children:"Try adjusting your search or filter criteria"})]}):p.jsx("div",{className:"space-y-1",children:U.map((N,D)=>{const F=s.has(D),I=N.direction==="in";return p.jsxs("div",{className:`p-2 rounded cursor-pointer hover:bg-bambu-dark-secondary transition-colors ${F?"bg-bambu-dark-secondary":""}`,onClick:()=>w(D),children:[p.jsxs("div",{className:"flex items-start gap-2",children:[p.jsx("span",{className:"text-bambu-gray shrink-0",children:T(N.timestamp)}),p.jsx("span",{className:`shrink-0 ${I?"text-blue-400":"text-green-400"}`,title:I?"Incoming":"Outgoing",children:I?p.jsx(gN,{className:"w-3 h-3"}):p.jsx(xN,{className:"w-3 h-3"})}),p.jsx("span",{className:"text-purple-400 shrink-0",children:N.topic})]}),F?p.jsx("pre",{className:"mt-2 p-3 bg-gray-900 border border-gray-700 rounded text-green-400 overflow-x-auto whitespace-pre-wrap break-all max-h-96 overflow-y-auto text-xs",children:C(N.payload,!0)}):p.jsx("pre",{className:"mt-1 text-white/80 truncate",children:C(N.payload,!1)})]},D)})})}),p.jsxs("div",{className:"flex items-center justify-between p-4 border-t border-bambu-dark-tertiary",children:[p.jsx("div",{className:"text-sm text-bambu-gray",children:P?p.jsxs("span",{className:"flex items-center gap-2",children:[p.jsx("span",{className:"w-2 h-2 bg-green-500 rounded-full animate-pulse"}),"Logging active - messages will auto-refresh"]}):p.jsx("span",{children:"Logging stopped"})}),p.jsx(st,{variant:"secondary",onClick:n,children:"Close"})]})]})})}const Ole={"0700_5500_0002_0001":"A binding error occurred between AMS and the extruder. Please perform AMS initialization again.","0500_0300_0002_000E":"Some modules are incompatible with the printer firmware version. Please update firmware.","0300_0100_0002_0054":"The heatbed temperature is abnormal. The sensor may be disconnected or damaged.","0500_0100_0005_0005":"Motor driver overheated. Let the printer cool down.","0500_0100_0005_0006":"Motor driver communication error.","0700_0100_0007_0001":"AMS communication error.","0700_0100_0007_0002":"AMS filament runout.","0700_0100_0007_0003":"AMS filament not detected.","0C00_0100_000C_0003":"First layer inspection failed.","0C00_0100_000C_0004":"Nozzle clog detected.","0C00_0100_000C_8000":"Foreign object detected on print bed.","0500_0100_0005_0000":"Motor X axis lost steps.","0500_0100_0005_0001":"Motor Y axis lost steps.","0500_0100_0005_0002":"Motor Z axis lost steps."};function Lle(t){switch(t){case 1:return{label:"Fatal",color:"text-red-500",bgColor:"bg-red-500/20",Icon:hc};case 2:return{label:"Serious",color:"text-red-400",bgColor:"bg-red-500/15",Icon:hc};case 3:return{label:"Warning",color:"text-orange-400",bgColor:"bg-orange-500/20",Icon:id};case 4:default:return{label:"Info",color:"text-blue-400",bgColor:"bg-blue-500/20",Icon:$G}}}function a9(t,e){const n=(t>>24&255).toString(16).padStart(2,"0").toUpperCase(),i=(t>>16&255).toString(16).padStart(2,"0").toUpperCase(),r=(t>>8&255).toString(16).padStart(2,"0").toUpperCase(),a=(t&255).toString(16).padStart(2,"0").toUpperCase(),s=(e>>24&255).toString(16).padStart(2,"0").toUpperCase(),o=(e>>16&255).toString(16).padStart(2,"0").toUpperCase(),l=(e>>8&255).toString(16).padStart(2,"0").toUpperCase(),c=(e&255).toString(16).padStart(2,"0").toUpperCase();return`${n}${i}_${r}${a}_${s}${o}_${l}${c}`}function Ile(t,e,n){const i=a9(t,e);return`https://wiki.bambulab.com/en/${n.toLowerCase().includes("h2")?"h2":"x1"}/troubleshooting/hmscode/${i}`}function Ule({printerName:t,errors:e,onClose:n}){return console.log("HMSErrorModal errors:",JSON.stringify(e,null,2)),E.useEffect(()=>{const i=r=>{r.key==="Escape"&&n()};return window.addEventListener("keydown",i),()=>window.removeEventListener("keydown",i)},[n]),p.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4",children:p.jsxs("div",{className:"bg-bambu-dark-secondary rounded-lg shadow-xl max-w-lg w-full max-h-[80vh] flex flex-col",children:[p.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-bambu-dark-tertiary",children:[p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx(hc,{className:"w-5 h-5 text-orange-400"}),p.jsxs("h2",{className:"text-lg font-semibold text-white",children:["HMS Errors - ",t]})]}),p.jsx("button",{onClick:n,className:"p-1 hover:bg-bambu-dark-tertiary rounded-lg transition-colors",children:p.jsx(Cn,{className:"w-5 h-5 text-bambu-gray"})})]}),p.jsx("div",{className:"flex-1 overflow-y-auto p-4",children:e.length===0?p.jsxs("div",{className:"text-center py-8 text-bambu-gray",children:[p.jsx(id,{className:"w-12 h-12 mx-auto mb-3 opacity-30"}),p.jsx("p",{children:"No HMS errors"})]}):p.jsx("div",{className:"space-y-3",children:e.map((i,r)=>{const{label:a,color:s,bgColor:o,Icon:l}=Lle(i.severity),c=parseInt(i.code.replace("0x",""),16)||0,d=a9(i.attr,c),f=Ole[d]||"Unknown error. Click the link below for details.",m=Ile(i.attr,c,t),g=`HMS_${d.replace(/_/g,"-")}`;return p.jsx("div",{className:`p-4 rounded-lg ${o} border border-white/10`,children:p.jsxs("div",{className:"flex items-start gap-3",children:[p.jsx(l,{className:`w-5 h-5 ${s} flex-shrink-0 mt-0.5`}),p.jsxs("div",{className:"flex-1 min-w-0",children:[p.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[p.jsx("span",{className:`font-mono text-sm ${s}`,children:g}),p.jsx("span",{className:`text-xs px-2 py-0.5 rounded-full ${o} ${s}`,children:a})]}),p.jsx("p",{className:"text-sm text-bambu-gray mb-2",children:f}),p.jsxs("a",{href:m,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 text-xs text-bambu-green hover:underline",children:[p.jsx(uc,{className:"w-3 h-3"}),"View on Bambu Lab Wiki"]})]})]})},`${i.code}-${r}`)})})}),p.jsx("div",{className:"p-4 border-t border-bambu-dark-tertiary",children:p.jsx("p",{className:"text-xs text-bambu-gray",children:"HMS (Health Management System) monitors printer health. Clear errors on the printer to dismiss them here."})})]})})}function jle(t){if(!t)return"ASAP";const e=new Date(t),n=new Date,i=e.getTime()-n.getTime();return i<0?"Now":i<6e4?"In <1 min":i<36e5?`In ${Math.round(i/6e4)} min`:i<864e5?`In ${Math.round(i/36e5)}h`:e.toLocaleDateString()}function Fle({printerId:t}){const{data:e}=It({queryKey:["queue",t,"pending"],queryFn:()=>Ye.getQueue(t,"pending"),refetchInterval:3e4}),n=e?.[0],i=e?.length||0;return i===0?null:p.jsx(zS,{to:"/queue",className:"block mb-3 p-3 bg-bambu-dark rounded-lg hover:bg-bambu-dark-tertiary transition-colors",children:p.jsxs("div",{className:"flex items-center justify-between gap-3",children:[p.jsxs("div",{className:"flex items-center gap-3 min-w-0 flex-1",children:[p.jsx(Yo,{className:"w-5 h-5 text-yellow-400 flex-shrink-0"}),p.jsxs("div",{className:"min-w-0 flex-1",children:[p.jsx("p",{className:"text-xs text-bambu-gray",children:"Next in queue"}),p.jsx("p",{className:"text-sm text-white truncate",children:n?.archive_name||`Archive #${n?.archive_id}`})]})]}),p.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[p.jsxs("span",{className:"text-xs text-bambu-gray flex items-center gap-1",children:[p.jsx(xa,{className:"w-3 h-3"}),jle(n?.scheduled_time||null)]}),i>1&&p.jsxs("span",{className:"text-xs px-1.5 py-0.5 bg-yellow-400/20 text-yellow-400 rounded",children:["+",i-1]}),p.jsx(zf,{className:"w-4 h-4 text-bambu-gray"})]})]})})}function zle({side:t}){const{theme:e}=n9(),n=e==="dark"?"#1a4d2e":"#e7f5e9";return p.jsx("span",{className:"inline-flex items-center justify-center w-4 h-4 text-[10px] font-bold rounded",style:{backgroundColor:n,color:"#00ae42"},children:t})}function Vj({className:t}){return p.jsx("svg",{className:t,viewBox:"0 0 36 54",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:p.jsx("path",{d:"M17.8131 0.00538C18.4463 -0.15091 20.3648 3.14642 20.8264 3.84781C25.4187 10.816 35.3089 26.9368 35.9383 34.8694C37.4182 53.5822 11.882 61.3357 2.53721 45.3789C-1.73471 38.0791 0.016 32.2049 3.178 25.0232C6.99221 16.3662 12.6411 7.90372 17.8131 0.00538ZM18.3738 7.24807L17.5881 7.48441C14.4452 12.9431 10.917 18.2341 8.19369 23.9368C4.6808 31.29 1.18317 38.5479 7.69403 45.5657C17.3058 55.9228 34.9847 46.8808 31.4604 32.8681C29.2558 24.0969 22.4207 15.2913 18.3776 7.24807H18.3738Z",fill:"#C3C2C1"})})}function Ble({className:t}){return p.jsxs("svg",{className:t,viewBox:"0 0 35 53",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[p.jsx("path",{d:"M17.3165 0.0038C17.932 -0.14959 19.7971 3.08645 20.2458 3.77481C24.7103 10.6135 34.3251 26.4346 34.937 34.2198C36.3757 52.5848 11.5505 60.1942 2.46584 44.534C-1.68714 37.3735 0.0148 31.6085 3.08879 24.5603C6.79681 16.0605 12.2884 7.75907 17.3165 0.0038ZM17.8615 7.11561L17.0977 7.34755C14.0423 12.7048 10.6124 17.8974 7.96483 23.4941C4.54975 30.7107 1.14949 37.8337 7.47908 44.721C16.8233 54.8856 34.01 46.0117 30.5838 32.2595C28.4405 23.6512 21.7957 15.0093 17.8652 7.11561H17.8615Z",fill:"#C3C2C1"}),p.jsx("path",{d:"M5.03547 30.112C9.64453 30.4936 11.632 35.7985 16.4154 35.791C19.6339 35.7873 20.2161 33.2283 22.3853 31.6197C31.6776 24.7286 33.5835 37.4894 27.9881 44.4254C18.1878 56.5653 -1.16063 44.6013 5.03917 30.1158L5.03547 30.112Z",fill:"#1F8FEB"})]})}function Hle({className:t}){return p.jsxs("svg",{className:t,viewBox:"0 0 36 54",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[p.jsx("path",{d:"M17.9625 4.48059L4.77216 26.3154L2.08228 40.2175L10.0224 50.8414H23.1594L33.3246 42.1693V30.2455L17.9625 4.48059Z",fill:"#1F8FEB"}),p.jsx("path",{d:"M17.7948 0.00538C18.4273 -0.15091 20.3438 3.14642 20.8048 3.84781C25.3921 10.816 35.2715 26.9368 35.9001 34.8694C37.3784 53.5822 11.8702 61.3357 2.53562 45.3789C-1.73163 38.0829 0.0134 32.2087 3.1757 25.027C6.98574 16.3662 12.6284 7.90372 17.7948 0.00538ZM18.3549 7.24807L17.57 7.48441C14.4306 12.9431 10.9063 18.2341 8.1859 23.9368C4.67686 31.29 1.18305 38.5479 7.68679 45.5657C17.2881 55.9228 34.9476 46.8808 31.4271 32.8681C29.2249 24.0969 22.3974 15.2913 18.3587 7.24807H18.3549Z",fill:"#C3C2C1"})]})}function Vle({className:t}){return p.jsxs("svg",{className:t,viewBox:"0 0 12 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[p.jsx("path",{d:"M6 0.5C4.6 0.5 3.5 1.6 3.5 3V12.1C2.6 12.8 2 13.9 2 15C2 17.2 3.8 19 6 19C8.2 19 10 17.2 10 15C10 13.9 9.4 12.8 8.5 12.1V3C8.5 1.6 7.4 0.5 6 0.5Z",stroke:"#C3C2C1",strokeWidth:"1",fill:"none"}),p.jsx("circle",{cx:"6",cy:"15",r:"2.5",stroke:"#C3C2C1",strokeWidth:"1",fill:"none"})]})}function $le({className:t}){return p.jsxs("svg",{className:t,viewBox:"0 0 12 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[p.jsx("rect",{x:"4.5",y:"8",width:"3",height:"4.5",fill:"#d4a017",rx:"0.5"}),p.jsx("circle",{cx:"6",cy:"15",r:"2",fill:"#d4a017"}),p.jsx("path",{d:"M6 0.5C4.6 0.5 3.5 1.6 3.5 3V12.1C2.6 12.8 2 13.9 2 15C2 17.2 3.8 19 6 19C8.2 19 10 17.2 10 15C10 13.9 9.4 12.8 8.5 12.1V3C8.5 1.6 7.4 0.5 6 0.5Z",stroke:"#C3C2C1",strokeWidth:"1",fill:"none"})]})}function Gle({className:t}){return p.jsxs("svg",{className:t,viewBox:"0 0 12 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[p.jsx("rect",{x:"4.5",y:"3",width:"3",height:"9.5",fill:"#c62828",rx:"0.5"}),p.jsx("circle",{cx:"6",cy:"15",r:"2",fill:"#c62828"}),p.jsx("path",{d:"M6 0.5C4.6 0.5 3.5 1.6 3.5 3V12.1C2.6 12.8 2 13.9 2 15C2 17.2 3.8 19 6 19C8.2 19 10 17.2 10 15C10 13.9 9.4 12.8 8.5 12.1V3C8.5 1.6 7.4 0.5 6 0.5Z",stroke:"#C3C2C1",strokeWidth:"1",fill:"none"})]})}function Wle({humidity:t,goodThreshold:e=40,fairThreshold:n=60}){const i=typeof t=="string"?parseInt(t,10):t,r=typeof e=="number"?e:40,a=typeof n=="number"?n:60;let s,o;isNaN(i)?(s="#C3C2C1",o="Unknown"):i<=r?(s="#22a352",o="Good"):i<=a?(s="#d4a017",o="Fair"):(s="#c62828",o="Bad");let l;return isNaN(i)||i<=r?l=Vj:i<=a?l=Ble:l=Hle,p.jsxs("div",{className:"flex items-center justify-end gap-1",title:`Humidity: ${i}% - ${o}`,children:[p.jsx(l,{className:"w-3 h-4"}),p.jsxs("span",{className:"text-xs font-medium tabular-nums w-8 text-right",style:{color:s},children:[i,"%"]})]})}function qle({temp:t,goodThreshold:e=28,fairThreshold:n=35}){const i=typeof e=="number"?e:28,r=typeof n=="number"?n:35;let a,s;return t<=i?(a="#22a352",s=Vle):t<=r?(a="#d4a017",s=$le):(a="#c62828",s=Gle),p.jsxs("span",{className:"flex items-center gap-1",title:"Temperature",children:[p.jsx(s,{className:"w-3 h-4"}),p.jsxs("span",{className:"tabular-nums w-12 text-right",style:{color:a},children:[t,"°C"]})]})}function Xle(t,e){const n=typeof t=="string"?parseInt(t,10):t,i=isNaN(n)?0:n,r=e===1,a=i>=128?i-128:i,s=String.fromCharCode(65+a);return r?`HT-${s}`:`AMS-${s}`}function Kle(t){const e=Math.floor(t/3600),n=Math.floor(t%3600/60);return e>0?`${e}h ${n}m`:`${n}m`}function Yle(t){const e=new Date,n=new Date(e.getTime()+t*60*1e3),i=new Date;i.setHours(0,0,0,0);const r=new Date(n);r.setHours(0,0,0,0);const a=n.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}),s=Math.floor((r.getTime()-i.getTime())/(1e3*60*60*24));return s===0?a:s===1?`Tomorrow ${a}`:n.toLocaleDateString([],{weekday:"short"})+" "+a}function Zle(t){if(!t)return"/img/printers/default.png";const e=t.toLowerCase().replace(/\s+/g,"");return e.includes("x1e")?"/img/printers/x1e.png":e.includes("x1c")||e.includes("x1carbon")||e.includes("x1")?"/img/printers/x1c.png":e.includes("h2d")||e.includes("h2c")||e.includes("h2s")?"/img/printers/h2d.png":e.includes("p2s")||e.includes("p1s")?"/img/printers/p1s.png":e.includes("p1p")?"/img/printers/p1p.png":e.includes("a1mini")?"/img/printers/a1mini.png":e.includes("a1")?"/img/printers/a1.png":"/img/printers/default.png"}function Qle(t){return t==null?{label:"",color:"text-bambu-gray",bars:0}:t>=-50?{label:"Excellent",color:"text-bambu-green",bars:4}:t>=-60?{label:"Good",color:"text-bambu-green",bars:3}:t>=-70?{label:"Fair",color:"text-yellow-400",bars:2}:t>=-80?{label:"Weak",color:"text-orange-400",bars:1}:{label:"Very weak",color:"text-red-400",bars:1}}function Jle({url:t,printName:e}){const[n,i]=E.useState(!1),[r,a]=E.useState(!1),[s,o]=E.useState(!1);return p.jsxs(p.Fragment,{children:[p.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&&o(!0),children:t&&!r?p.jsxs(p.Fragment,{children:[p.jsx("img",{src:t,alt:"Print preview",className:`w-full h-full object-cover ${n?"block":"hidden"}`,onLoad:()=>i(!0),onError:()=>a(!0)}),!n&&p.jsx(k0,{className:"w-8 h-8 text-bambu-gray"})]}):p.jsx(k0,{className:"w-8 h-8 text-bambu-gray"})}),s&&t&&p.jsx("div",{className:"fixed inset-0 bg-black/80 flex items-center justify-center z-50 p-8",onClick:()=>o(!1),children:p.jsxs("div",{className:"relative max-w-2xl max-h-full",children:[p.jsx("img",{src:t,alt:"Print preview",className:"max-w-full max-h-[80vh] rounded-lg shadow-2xl"}),e&&p.jsx("p",{className:"text-white text-center mt-4 text-lg",children:e})]})})]})}function ece({printers:t}){const e=Jn(),n=E.useMemo(()=>{let r=0,a=0,s=0,o=0;return t?.forEach(l=>{const c=e.getQueryData(["printerStatus",l.id]);c===void 0?o++:c.connected?c.state==="RUNNING"?r++:a++:s++}),{printing:r,idle:a,offline:s,loading:o,total:t?.length||0}},[t,e]),[,i]=E.useState(0);return E.useEffect(()=>{const r=e.getQueryCache().subscribe(()=>{i(a=>a+1)});return()=>r()},[e]),t?.length?p.jsxs("div",{className:"flex items-center gap-4 text-sm",children:[n.printing>0&&p.jsxs("div",{className:"flex items-center gap-1.5",children:[p.jsx("div",{className:"w-2 h-2 rounded-full bg-bambu-green animate-pulse"}),p.jsxs("span",{className:"text-bambu-gray",children:[p.jsx("span",{className:"text-white font-medium",children:n.printing})," printing"]})]}),n.idle>0&&p.jsxs("div",{className:"flex items-center gap-1.5",children:[p.jsx("div",{className:"w-2 h-2 rounded-full bg-blue-400"}),p.jsxs("span",{className:"text-bambu-gray",children:[p.jsx("span",{className:"text-white font-medium",children:n.idle})," idle"]})]}),n.offline>0&&p.jsxs("div",{className:"flex items-center gap-1.5",children:[p.jsx("div",{className:"w-2 h-2 rounded-full bg-gray-400"}),p.jsxs("span",{className:"text-bambu-gray",children:[p.jsx("span",{className:"text-white font-medium",children:n.offline})," offline"]})]})]}):null}function $j({printer:t,hideIfDisconnected:e,maintenanceInfo:n,viewMode:i="expanded",amsThresholds:r}){const a=Jn(),s=xP(),[o,l]=E.useState(!1),[c,d]=E.useState(!1),[f,m]=E.useState(!1),[g,y]=E.useState(!1),[_,v]=E.useState(!1),[x,M]=E.useState(!1),[w,T]=E.useState(!1),[C,P]=E.useState(!1),{data:A}=It({queryKey:["printerStatus",t.id],queryFn:()=>Ye.getPrinterStatus(t.id),refetchInterval:3e4}),[U,N]=E.useState(null);E.useEffect(()=>{A?.wifi_signal!=null&&N(A.wifi_signal)},[A?.wifi_signal]);const D=A?.wifi_signal??U,F=E.useRef({});E.useEffect(()=>{A?.ams_extruder_map&&Object.keys(A.ams_extruder_map).length>0&&(F.current=A.ams_extruder_map)},[A?.ams_extruder_map]);const I=A?.ams_extruder_map&&Object.keys(A.ams_extruder_map).length>0?A.ams_extruder_map:F.current,W=E.useRef([]);E.useEffect(()=>{A?.ams&&A.ams.length>0&&(W.current=A.ams)},[A?.ams]);const O=A?.ams&&A.ams.length>0?A.ams:W.current,{data:B}=It({queryKey:["smartPlugByPrinter",t.id],queryFn:()=>Ye.getSmartPlugByPrinter(t.id)}),{data:H}=It({queryKey:["smartPlugStatus",B?.id],queryFn:()=>B?Ye.getSmartPlugStatus(B.id):null,enabled:!!B,refetchInterval:1e4}),{data:$}=It({queryKey:["queue",t.id,"pending"],queryFn:()=>Ye.getQueue(t.id,"pending")}),K=$?.length||0,{data:Z}=It({queryKey:["archives",t.id,"last"],queryFn:()=>Ye.getArchives(t.id,1,0),enabled:A?.connected&&A?.state!=="RUNNING"}),se=Z?.[0],V=e&&A&&!A.connected,X=Ot({mutationFn:()=>Ye.deletePrinter(t.id),onSuccess:()=>{a.invalidateQueries({queryKey:["printers"]})}}),ae=Ot({mutationFn:()=>Ye.connectPrinter(t.id),onSuccess:()=>{a.invalidateQueries({queryKey:["printerStatus",t.id]})}}),ce=Ot({mutationFn:ne=>B?Ye.controlSmartPlug(B.id,ne):Promise.reject("No plug"),onSuccess:()=>{a.invalidateQueries({queryKey:["smartPlugStatus",B?.id]})}}),ge=Ot({mutationFn:ne=>B?Ye.updateSmartPlug(B.id,{auto_off:ne}):Promise.reject("No plug"),onSuccess:()=>{a.invalidateQueries({queryKey:["smartPlugByPrinter",t.id]}),a.invalidateQueries({queryKey:["smart-plugs"]})}});return V?null:p.jsxs(Zt,{className:"relative",children:[p.jsxs(cn,{children:[p.jsxs("div",{className:i==="compact"?"mb-2":"mb-4",children:[p.jsxs("div",{className:"flex items-start justify-between gap-2",children:[p.jsxs("div",{className:"flex items-center gap-3 min-w-0 flex-1",children:[p.jsx("img",{src:Zle(t.model),alt:t.model||"Printer",className:`object-contain rounded-lg bg-bambu-dark flex-shrink-0 ${i==="compact"?"w-10 h-10":"w-14 h-14"}`}),p.jsxs("div",{className:"min-w-0 flex-1",children:[p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("h3",{className:`font-semibold text-white ${i==="compact"?"text-base truncate":"text-lg"}`,children:t.name}),i==="compact"&&p.jsx("div",{className:`w-2 h-2 rounded-full flex-shrink-0 ${A?.connected?"bg-bambu-green":"bg-red-500"}`,title:A?.connected?"Connected":"Offline"})]}),p.jsxs("p",{className:"text-sm text-bambu-gray",children:[t.model||"Unknown Model",i==="expanded"&&A?.nozzles&&A.nozzles[0]?.nozzle_diameter&&p.jsxs("span",{className:"ml-1.5 text-bambu-gray",title:A.nozzles[0].nozzle_type||"Nozzle",children:["• ",A.nozzles[0].nozzle_diameter,"mm"]}),i==="expanded"&&n&&n.total_print_hours>0&&p.jsxs("span",{className:"ml-2 text-bambu-gray",children:[p.jsx(xa,{className:"w-3 h-3 inline-block mr-1"}),Math.round(n.total_print_hours),"h"]})]})]})]}),p.jsxs("div",{className:"relative flex-shrink-0",children:[p.jsx(st,{variant:"ghost",size:"sm",onClick:()=>l(!o),children:p.jsx(tse,{className:"w-4 h-4"})}),o&&p.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:[p.jsxs("button",{className:"w-full px-4 py-2 text-left text-sm hover:bg-bambu-dark-tertiary flex items-center gap-2",onClick:()=>{m(!0),l(!1)},children:[p.jsx(_N,{className:"w-4 h-4"}),"Edit"]}),p.jsxs("button",{className:"w-full px-4 py-2 text-left text-sm hover:bg-bambu-dark-tertiary flex items-center gap-2",onClick:()=>{ae.mutate(),l(!1)},children:[p.jsx(Zo,{className:"w-4 h-4"}),"Reconnect"]}),p.jsxs("button",{className:"w-full px-4 py-2 text-left text-sm hover:bg-bambu-dark-tertiary flex items-center gap-2",onClick:()=>{v(!0),l(!1)},children:[p.jsx(Xoe,{className:"w-4 h-4"}),"MQTT Debug"]}),p.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:()=>{d(!0),l(!1)},children:[p.jsx(na,{className:"w-4 h-4"}),"Delete"]})]})]})]}),i==="expanded"&&p.jsxs("div",{className:"flex flex-wrap items-center gap-2 mt-2",children:[p.jsxs("span",{className:`flex items-center gap-1.5 px-2 py-1 rounded-full text-xs ${A?.connected?"bg-bambu-green/20 text-bambu-green":"bg-red-500/20 text-red-400"}`,children:[A?.connected?p.jsx(WG,{className:"w-3 h-3"}):p.jsx(QG,{className:"w-3 h-3"}),A?.connected?"Connected":"Offline"]}),A?.connected&&D!=null&&p.jsxs("span",{className:`flex items-center gap-1 px-2 py-1 rounded-full text-xs ${D>=-50||D>=-60?"bg-bambu-green/20 text-bambu-green":D>=-70?"bg-amber-500/20 text-amber-600":D>=-80?"bg-orange-500/20 text-orange-600":"bg-red-500/20 text-red-600"}`,title:`WiFi: ${D} dBm - ${Qle(D).label}`,children:[p.jsx(Doe,{className:"w-3 h-3"}),D,"dBm"]}),A?.connected&&p.jsxs("button",{onClick:()=>P(!0),className:`flex items-center gap-1 px-2 py-1 rounded-full text-xs cursor-pointer hover:opacity-80 transition-opacity ${A.hms_errors&&A.hms_errors.length>0?A.hms_errors.some(ne=>ne.severity<=2)?"bg-red-500/20 text-red-400":"bg-orange-500/20 text-orange-400":"bg-bambu-green/20 text-bambu-green"}`,title:"Click to view HMS errors",children:[p.jsx(hc,{className:"w-3 h-3"}),A.hms_errors&&A.hms_errors.length>0?A.hms_errors.length:"OK"]}),n&&p.jsxs("button",{onClick:()=>s("/maintenance"),className:`flex items-center gap-1 px-2 py-1 rounded-full text-xs cursor-pointer hover:opacity-80 transition-opacity ${n.due_count>0?"bg-red-500/20 text-red-400":n.warning_count>0?"bg-orange-500/20 text-orange-400":"bg-bambu-green/20 text-bambu-green"}`,title:n.due_count>0||n.warning_count>0?`${n.due_count>0?`${n.due_count} maintenance due`:""}${n.due_count>0&&n.warning_count>0?", ":""}${n.warning_count>0?`${n.warning_count} due soon`:""} - Click to view`:"All maintenance up to date - Click to view",children:[p.jsx(Ip,{className:"w-3 h-3"}),n.due_count>0||n.warning_count>0?n.due_count+n.warning_count:"OK"]}),K>0&&p.jsxs("button",{onClick:()=>s("/queue"),className:"flex items-center gap-1 px-2 py-1 rounded-full text-xs bg-purple-500/20 text-purple-400 hover:opacity-80 transition-opacity",title:`${K} print${K>1?"s":""} in queue`,children:[p.jsx(L_,{className:"w-3 h-3"}),K]})]})]}),c&&p.jsx(ma,{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:()=>{X.mutate(),d(!1)},onCancel:()=>d(!1)}),A?.connected&&p.jsxs(p.Fragment,{children:[i==="compact"?p.jsx("div",{className:"mt-2",children:A.state==="RUNNING"?p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("div",{className:"flex-1 bg-bambu-dark-tertiary rounded-full h-1.5",children:p.jsx("div",{className:"bg-bambu-green h-1.5 rounded-full transition-all",style:{width:`${A.progress||0}%`}})}),p.jsxs("span",{className:"text-xs text-white",children:[Math.round(A.progress||0),"%"]})]}):p.jsx("p",{className:"text-xs text-bambu-gray capitalize",children:A.state?.toLowerCase()||"Idle"})}):p.jsxs(p.Fragment,{children:[p.jsx("div",{className:"mb-4 p-3 bg-bambu-dark rounded-lg",children:p.jsxs("div",{className:"flex gap-3",children:[p.jsx(Jle,{url:A.state==="RUNNING"?A.cover_url:null,printName:A.state==="RUNNING"&&(A.subtask_name||A.current_print)||void 0}),p.jsx("div",{className:"flex-1 min-w-0",children:A.current_print&&A.state==="RUNNING"?p.jsxs(p.Fragment,{children:[p.jsx("p",{className:"text-sm text-bambu-gray mb-1",children:"Printing"}),p.jsx("p",{className:"text-white text-sm mb-2 truncate",children:A.subtask_name||A.current_print}),p.jsxs("div",{className:"flex items-center justify-between text-sm",children:[p.jsx("div",{className:"flex-1 bg-bambu-dark-tertiary rounded-full h-2 mr-3",children:p.jsx("div",{className:"bg-bambu-green h-2 rounded-full transition-all",style:{width:`${A.progress||0}%`}})}),p.jsxs("span",{className:"text-white",children:[Math.round(A.progress||0),"%"]})]}),p.jsxs("div",{className:"flex items-center gap-3 mt-2 text-xs text-bambu-gray",children:[A.remaining_time!=null&&A.remaining_time>0&&p.jsxs(p.Fragment,{children:[p.jsxs("span",{className:"flex items-center gap-1",children:[p.jsx(xa,{className:"w-3 h-3"}),Kle(A.remaining_time*60)]}),p.jsxs("span",{className:"text-bambu-green font-medium",title:"Estimated completion time",children:["ETA ",Yle(A.remaining_time)]})]}),A.layer_num!=null&&A.total_layers!=null&&A.total_layers>0&&p.jsxs("span",{className:"flex items-center gap-1",children:[p.jsx(L_,{className:"w-3 h-3"}),A.layer_num,"/",A.total_layers]})]})]}):p.jsxs(p.Fragment,{children:[p.jsx("p",{className:"text-sm text-bambu-gray mb-1",children:"Status"}),p.jsx("p",{className:"text-white text-sm mb-2 capitalize",children:A.state?.toLowerCase()||"Idle"}),p.jsxs("div",{className:"flex items-center justify-between text-sm",children:[p.jsx("div",{className:"flex-1 bg-bambu-dark-tertiary rounded-full h-2 mr-3",children:p.jsx("div",{className:"bg-bambu-dark-tertiary h-2 rounded-full"})}),p.jsx("span",{className:"text-bambu-gray",children:"—"})]}),se?p.jsxs("p",{className:"text-xs text-bambu-gray mt-2 truncate",title:se.print_name||se.filename,children:["Last: ",se.print_name||se.filename,se.completed_at&&p.jsxs("span",{className:"ml-1 text-bambu-gray/60",children:["• ",new Date(se.completed_at).toLocaleDateString([],{month:"short",day:"numeric"})]})]}):p.jsx("p",{className:"text-xs text-bambu-gray mt-2",children:"Ready to print"})]})})]})}),A.state!=="RUNNING"&&p.jsx(Fle,{printerId:t.id})]}),A.temperatures&&i==="expanded"&&p.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[p.jsxs("div",{className:"text-center p-2 bg-bambu-dark rounded-lg",children:[p.jsx(l0,{className:"w-4 h-4 mx-auto mb-1 text-orange-400"}),A.temperatures.nozzle_2!==void 0?p.jsxs(p.Fragment,{children:[p.jsx("p",{className:"text-xs text-bambu-gray",children:"Left / Right"}),p.jsxs("p",{className:"text-sm text-white",children:[Math.round(A.temperatures.nozzle||0),"°C / ",Math.round(A.temperatures.nozzle_2||0),"°C"]})]}):p.jsxs(p.Fragment,{children:[p.jsx("p",{className:"text-xs text-bambu-gray",children:"Nozzle"}),p.jsxs("p",{className:"text-sm text-white",children:[Math.round(A.temperatures.nozzle||0),"°C"]})]})]}),p.jsxs("div",{className:"text-center p-2 bg-bambu-dark rounded-lg",children:[p.jsx(l0,{className:"w-4 h-4 mx-auto mb-1 text-blue-400"}),p.jsx("p",{className:"text-xs text-bambu-gray",children:"Bed"}),p.jsxs("p",{className:"text-sm text-white",children:[Math.round(A.temperatures.bed||0),"°C"]})]}),A.temperatures.chamber!==void 0&&p.jsxs("div",{className:"text-center p-2 bg-bambu-dark rounded-lg",children:[p.jsx(l0,{className:"w-4 h-4 mx-auto mb-1 text-green-400"}),p.jsx("p",{className:"text-xs text-bambu-gray",children:"Chamber"}),p.jsxs("p",{className:"text-sm text-white",children:[Math.round(A.temperatures.chamber||0),"°C"]})]})]}),O&&O.length>0&&i==="expanded"&&p.jsxs("div",{className:"mt-3 p-2 bg-bambu-dark rounded-lg",children:[p.jsx("div",{className:"space-y-2",children:O.map(ne=>{const ve=ne.id>=128?ne.id-128:ne.id,Pe=I[String(ve)],he=Pe!==void 0?Pe:ve,we=t.nozzle_count===2||A?.temperatures?.nozzle_2!==void 0,je=he===1,ue=he===0;return p.jsxs("div",{className:"flex items-center justify-between",children:[p.jsxs("div",{className:"flex items-center gap-2",children:[we&&(je||ue)&&p.jsx(zle,{side:je?"L":"R"}),p.jsx("span",{className:"text-xs text-bambu-gray whitespace-nowrap",children:Xle(ne.id,ne.tray.length)}),p.jsx("div",{className:"flex gap-1",children:ne.tray.map((lt,z)=>p.jsx("div",{className:`w-5 h-5 rounded-full border border-white/20 ${lt.tray_type?"":"ams-empty-slot"}`,style:{backgroundColor:lt.tray_color?`#${lt.tray_color}`:lt.tray_type?"#333":void 0},title:lt.tray_type?`${lt.tray_sub_brands||lt.tray_type}${lt.remain?` (${lt.remain}%)`:""}`:"Empty slot"},`${ne.id}-${z}`))})]}),(ne.humidity!=null||ne.temp!=null)&&p.jsxs("div",{className:"flex items-center gap-3 text-xs",children:[ne.humidity!=null&&p.jsx("div",{className:"w-14 text-right",children:p.jsx(Wle,{humidity:ne.humidity,goodThreshold:r?.humidityGood,fairThreshold:r?.humidityFair})}),ne.temp!=null&&p.jsx(qle,{temp:ne.temp,goodThreshold:r?.tempGood,fairThreshold:r?.tempFair})]})]},ne.id)})}),A.vt_tray&&A.vt_tray.tray_type&&p.jsxs("div",{className:"flex items-center gap-2 pt-2 mt-2 border-t border-bambu-dark-tertiary",children:[p.jsx("span",{className:"text-xs text-bambu-gray w-10",children:"Ext"}),p.jsx("div",{className:"w-5 h-5 rounded-full border border-white/20",style:{backgroundColor:A.vt_tray.tray_color?`#${A.vt_tray.tray_color}`:"#333"},title:A.vt_tray.tray_sub_brands||A.vt_tray.tray_type||"External"})]})]})]}),B&&i==="expanded"&&p.jsx("div",{className:"mt-4 pt-4 border-t border-bambu-dark-tertiary",children:p.jsxs("div",{className:"flex items-center gap-3",children:[p.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[p.jsx(e9,{className:"w-4 h-4 text-bambu-gray flex-shrink-0"}),p.jsx("span",{className:"text-sm text-white truncate",children:B.name}),H&&p.jsx("span",{className:`text-xs px-1.5 py-0.5 rounded flex-shrink-0 ${H.state==="ON"?"bg-bambu-green/20 text-bambu-green":H.state==="OFF"?"bg-red-500/20 text-red-400":"bg-bambu-gray/20 text-bambu-gray"}`,children:H.state||"?"}),H?.energy?.power!=null&&H.state==="ON"&&p.jsxs("span",{className:"text-xs text-yellow-400 font-medium flex-shrink-0",children:[H.energy.power,"W"]})]}),p.jsx("div",{className:"flex-1"}),p.jsxs("div",{className:"flex items-center gap-1",children:[p.jsxs("button",{onClick:()=>M(!0),disabled:ce.isPending||H?.state==="ON",className:`px-2 py-1 text-xs rounded transition-colors flex items-center gap-1 ${H?.state==="ON"?"bg-bambu-green text-white":"bg-bambu-dark text-bambu-gray hover:text-white hover:bg-bambu-dark-tertiary"}`,children:[p.jsx(fm,{className:"w-3 h-3"}),"On"]}),p.jsxs("button",{onClick:()=>T(!0),disabled:ce.isPending||H?.state==="OFF",className:`px-2 py-1 text-xs rounded transition-colors flex items-center gap-1 ${H?.state==="OFF"?"bg-red-500/30 text-red-400":"bg-bambu-dark text-bambu-gray hover:text-white hover:bg-bambu-dark-tertiary"}`,children:[p.jsx(KG,{className:"w-3 h-3"}),"Off"]})]}),p.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[p.jsx("span",{className:`text-xs hidden sm:inline ${B.auto_off_executed?"text-bambu-green":"text-bambu-gray"}`,children:B.auto_off_executed?"Auto-off done":"Auto-off"}),p.jsx("button",{onClick:()=>ge.mutate(!B.auto_off),disabled:ge.isPending||B.auto_off_executed,title:B.auto_off_executed?"Auto-off was executed - turn printer on to reset":"Auto power-off after print",className:`relative w-9 h-5 rounded-full transition-colors flex-shrink-0 ${B.auto_off_executed?"bg-bambu-green/50 cursor-not-allowed":B.auto_off?"bg-bambu-green":"bg-bambu-dark-tertiary"}`,children:p.jsx("span",{className:`absolute top-[2px] left-[2px] w-4 h-4 bg-white rounded-full transition-transform ${B.auto_off||B.auto_off_executed?"translate-x-4":"translate-x-0"}`})})]})]})}),i==="expanded"&&p.jsxs("div",{className:"mt-4 pt-4 border-t border-bambu-dark-tertiary flex items-center justify-between",children:[p.jsxs("div",{className:"text-xs text-bambu-gray",children:[p.jsx("p",{children:t.ip_address}),p.jsx("p",{className:"truncate",children:t.serial_number})]}),p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx(st,{variant:"secondary",size:"sm",onClick:()=>{window.open(`/camera/${t.id}`,`camera-${t.id}`,"width=640,height=400,menubar=no,toolbar=no,location=no,status=no")},disabled:!A?.connected,title:"Open camera in new window",children:p.jsx(ule,{className:"w-4 h-4"})}),p.jsxs(st,{variant:"secondary",size:"sm",onClick:()=>y(!0),title:"Browse printer files",children:[p.jsx(VG,{className:"w-4 h-4"}),"Files"]})]})]})]}),g&&p.jsx(Dle,{printerId:t.id,printerName:t.name,onClose:()=>y(!1)}),_&&p.jsx(kle,{printerId:t.id,printerName:t.name,onClose:()=>v(!1)}),x&&B&&p.jsx(ma,{title:"Power On Printer",message:`Are you sure you want to turn ON the power for "${t.name}"?`,confirmText:"Power On",variant:"default",onConfirm:()=>{ce.mutate("on"),M(!1)},onCancel:()=>M(!1)}),w&&B&&p.jsx(ma,{title:"Power Off Printer",message:A?.state==="RUNNING"?`WARNING: "${t.name}" is currently printing! Are you sure you want to turn OFF the power? This will interrupt the print and may damage the printer.`:`Are you sure you want to turn OFF the power for "${t.name}"?`,confirmText:"Power Off",variant:"danger",onConfirm:()=>{ce.mutate("off"),T(!1)},onCancel:()=>T(!1)}),C&&p.jsx(Ule,{printerName:t.name,errors:A?.hms_errors||[],onClose:()=>P(!1)}),f&&p.jsx(nce,{printer:t,onClose:()=>m(!1)})]})}function tce({onClose:t,onAdd:e}){const[n,i]=E.useState({name:"",serial_number:"",ip_address:"",access_code:"",model:"",auto_archive:!0});return E.useEffect(()=>{const r=a=>{a.key==="Escape"&&t()};return window.addEventListener("keydown",r),()=>window.removeEventListener("keydown",r)},[t]),p.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",onClick:t,children:p.jsx(Zt,{className:"w-full max-w-md",onClick:r=>r.stopPropagation(),children:p.jsxs(cn,{children:[p.jsx("h2",{className:"text-xl font-semibold mb-4",children:"Add Printer"}),p.jsxs("form",{onSubmit:r=>{r.preventDefault(),e(n)},className:"space-y-4",children:[p.jsxs("div",{children:[p.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:"Name"}),p.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"})]}),p.jsxs("div",{children:[p.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:"IP Address"}),p.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"})]}),p.jsxs("div",{children:[p.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:"Serial Number"}),p.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"})]}),p.jsxs("div",{children:[p.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:"Access Code"}),p.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"})]}),p.jsxs("div",{children:[p.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:"Model (optional)"}),p.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:[p.jsx("option",{value:"",children:"Select model..."}),p.jsxs("optgroup",{label:"H2 Series",children:[p.jsx("option",{value:"H2C",children:"H2C"}),p.jsx("option",{value:"H2D",children:"H2D"}),p.jsx("option",{value:"H2S",children:"H2S"})]}),p.jsxs("optgroup",{label:"X1 Series",children:[p.jsx("option",{value:"X1E",children:"X1E"}),p.jsx("option",{value:"X1C",children:"X1 Carbon"}),p.jsx("option",{value:"X1",children:"X1"})]}),p.jsxs("optgroup",{label:"P Series",children:[p.jsx("option",{value:"P2S",children:"P2S"}),p.jsx("option",{value:"P1S",children:"P1S"}),p.jsx("option",{value:"P1P",children:"P1P"})]}),p.jsxs("optgroup",{label:"A1 Series",children:[p.jsx("option",{value:"A1",children:"A1"}),p.jsx("option",{value:"A1 Mini",children:"A1 Mini"})]})]})]}),p.jsxs("div",{className:"flex items-center gap-2",children:[p.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"}),p.jsx("label",{htmlFor:"auto_archive",className:"text-sm text-bambu-gray",children:"Auto-archive completed prints"})]}),p.jsxs("div",{className:"flex gap-3 pt-4",children:[p.jsx(st,{type:"button",variant:"secondary",onClick:t,className:"flex-1",children:"Cancel"}),p.jsx(st,{type:"submit",className:"flex-1",children:"Add Printer"})]})]})]})})})}function nce({printer:t,onClose:e}){const n=Jn(),[i,r]=E.useState({name:t.name,ip_address:t.ip_address,access_code:"",model:t.model||"",location:t.location||"",auto_archive:t.auto_archive}),a=Ot({mutationFn:o=>Ye.updatePrinter(t.id,o),onSuccess:()=>{n.invalidateQueries({queryKey:["printers"]}),n.invalidateQueries({queryKey:["printerStatus",t.id]}),e()}});E.useEffect(()=>{const o=l=>{l.key==="Escape"&&e()};return window.addEventListener("keydown",o),()=>window.removeEventListener("keydown",o)},[e]);const s=o=>{o.preventDefault();const l={name:i.name,ip_address:i.ip_address,model:i.model||void 0,location:i.location||void 0,auto_archive:i.auto_archive};i.access_code&&(l.access_code=i.access_code),a.mutate(l)};return p.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",onClick:e,children:p.jsx(Zt,{className:"w-full max-w-md",onClick:o=>o.stopPropagation(),children:p.jsxs(cn,{children:[p.jsx("h2",{className:"text-xl font-semibold mb-4",children:"Edit Printer"}),p.jsxs("form",{onSubmit:s,className:"space-y-4",children:[p.jsxs("div",{children:[p.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:"Name"}),p.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:i.name,onChange:o=>r({...i,name:o.target.value}),placeholder:"My Printer"})]}),p.jsxs("div",{children:[p.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:"IP Address"}),p.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:i.ip_address,onChange:o=>r({...i,ip_address:o.target.value}),placeholder:"192.168.1.100"})]}),p.jsxs("div",{children:[p.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:"Serial Number"}),p.jsx("input",{type:"text",disabled:!0,className:"w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-bambu-gray cursor-not-allowed",value:t.serial_number}),p.jsx("p",{className:"text-xs text-bambu-gray mt-1",children:"Serial number cannot be changed"})]}),p.jsxs("div",{children:[p.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:"Access Code"}),p.jsx("input",{type:"password",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:i.access_code,onChange:o=>r({...i,access_code:o.target.value}),placeholder:"Leave empty to keep current"})]}),p.jsxs("div",{children:[p.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:"Model"}),p.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:i.model,onChange:o=>r({...i,model:o.target.value}),children:[p.jsx("option",{value:"",children:"Select model..."}),p.jsxs("optgroup",{label:"H2 Series",children:[p.jsx("option",{value:"H2C",children:"H2C"}),p.jsx("option",{value:"H2D",children:"H2D"}),p.jsx("option",{value:"H2S",children:"H2S"})]}),p.jsxs("optgroup",{label:"X1 Series",children:[p.jsx("option",{value:"X1E",children:"X1E"}),p.jsx("option",{value:"X1C",children:"X1 Carbon"}),p.jsx("option",{value:"X1",children:"X1"})]}),p.jsxs("optgroup",{label:"P Series",children:[p.jsx("option",{value:"P2S",children:"P2S"}),p.jsx("option",{value:"P1S",children:"P1S"}),p.jsx("option",{value:"P1P",children:"P1P"})]}),p.jsxs("optgroup",{label:"A1 Series",children:[p.jsx("option",{value:"A1",children:"A1"}),p.jsx("option",{value:"A1 Mini",children:"A1 Mini"})]})]})]}),p.jsxs("div",{children:[p.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:"Location / Group"}),p.jsx("input",{type:"text",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:i.location,onChange:o=>r({...i,location:o.target.value}),placeholder:"e.g., Workshop, Office, Basement"}),p.jsx("p",{className:"text-xs text-bambu-gray mt-1",children:"Used to group printers on the dashboard"})]}),p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("input",{type:"checkbox",id:"edit_auto_archive",checked:i.auto_archive,onChange:o=>r({...i,auto_archive:o.target.checked}),className:"rounded border-bambu-dark-tertiary bg-bambu-dark text-bambu-green focus:ring-bambu-green"}),p.jsx("label",{htmlFor:"edit_auto_archive",className:"text-sm text-bambu-gray",children:"Auto-archive completed prints"})]}),p.jsxs("div",{className:"flex gap-3 pt-4",children:[p.jsx(st,{type:"button",variant:"secondary",onClick:e,className:"flex-1",children:"Cancel"}),p.jsx(st,{type:"submit",className:"flex-1",disabled:a.isPending,children:a.isPending?"Saving...":"Save Changes"})]})]})]})})})}function ice(t){const{data:e}=It({queryKey:["printerStatus",t],queryFn:()=>Ye.getPrinterStatus(t),refetchInterval:3e4});return!e?.connected}function rce({printer:t,plug:e,onPowerOn:n,isPowering:i}){const r=ice(t.id),{data:a}=It({queryKey:["smartPlugStatus",e.id],queryFn:()=>Ye.getSmartPlugStatus(e.id),refetchInterval:1e4});return r?p.jsxs("div",{className:"flex items-center justify-between px-3 py-2 hover:bg-gray-100 dark:hover:bg-bambu-dark-tertiary",children:[p.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[p.jsx("span",{className:"text-sm text-gray-900 dark:text-white truncate",children:t.name}),a&&p.jsx("span",{className:`text-xs px-1.5 py-0.5 rounded ${a.state==="ON"?"bg-bambu-green/20 text-bambu-green":"bg-red-500/20 text-red-400"}`,children:a.state||"?"})]}),p.jsxs("button",{onClick:()=>n(e.id),disabled:i||a?.state==="ON",className:`px-2 py-1 text-xs rounded transition-colors flex items-center gap-1 ${a?.state==="ON"?"bg-bambu-green/20 text-bambu-green cursor-default":"bg-bambu-green/20 text-bambu-green hover:bg-bambu-green hover:text-white"}`,children:[p.jsx(fm,{className:"w-3 h-3"}),i?"...":"On"]})]}):null}function ace(){const[t,e]=E.useState(!1),[n,i]=E.useState(()=>localStorage.getItem("hideDisconnectedPrinters")==="true"),[r,a]=E.useState(!1),[s,o]=E.useState(null),[l,c]=E.useState(()=>localStorage.getItem("printerSortBy")||"name"),[d,f]=E.useState(()=>localStorage.getItem("printerSortAsc")!=="false"),[m,g]=E.useState(()=>localStorage.getItem("printerViewMode")||"expanded"),y=Jn(),{data:_,isLoading:v}=It({queryKey:["printers"],queryFn:Ye.getPrinters}),{data:x}=It({queryKey:["settings"],queryFn:Ye.getSettings}),{data:M}=It({queryKey:["smart-plugs"],queryFn:Ye.getSmartPlugs}),{data:w}=It({queryKey:["maintenanceOverview"],queryFn:Ye.getMaintenanceOverview,staleTime:60*1e3}),T=w?.reduce((O,B)=>(O[B.printer_id]={due_count:B.due_count,warning_count:B.warning_count,total_print_hours:B.total_print_hours},O),{})||{},C=M?.reduce((O,B)=>(B.printer_id&&(O[B.printer_id]=B),O),{})||{},P=Ot({mutationFn:Ye.createPrinter,onSuccess:()=>{y.invalidateQueries({queryKey:["printers"]}),e(!1)}}),A=Ot({mutationFn:O=>Ye.controlSmartPlug(O,"on"),onSuccess:()=>{y.invalidateQueries({queryKey:["smart-plugs"]}),o(null)},onError:()=>{o(null)}}),U=()=>{const O=!n;i(O),localStorage.setItem("hideDisconnectedPrinters",String(O))},N=O=>{c(O),localStorage.setItem("printerSortBy",O)},D=()=>{const O=!d;f(O),localStorage.setItem("printerSortAsc",String(O))},F=()=>{const O=m==="expanded"?"compact":"expanded";g(O),localStorage.setItem("printerViewMode",O)},I=E.useMemo(()=>{if(!_)return[];const O=[..._];switch(l){case"name":O.sort((B,H)=>B.name.localeCompare(H.name));break;case"model":O.sort((B,H)=>(B.model||"").localeCompare(H.model||""));break;case"location":O.sort((B,H)=>{const $=B.location||"",K=H.location||"";return!$&&K?1:$&&!K?-1:$.localeCompare(K)||B.name.localeCompare(H.name)});break;case"status":O.sort((B,H)=>{const $=y.getQueryData(["printerStatus",B.id]),K=y.getQueryData(["printerStatus",H.id]),Z=se=>se?.connected?se.state==="RUNNING"?0:1:2;return Z($)-Z(K)});break}return d||O.reverse(),O},[_,l,d,y]),W=E.useMemo(()=>{if(l!=="location")return null;const O={};return I.forEach(B=>{const H=B.location||"Ungrouped";O[H]||(O[H]=[]),O[H].push(B)}),O},[l,I]);return p.jsxs("div",{className:"p-8",children:[p.jsxs("div",{className:"flex items-center justify-between mb-6",children:[p.jsxs("div",{children:[p.jsx("h1",{className:"text-2xl font-bold text-white",children:"Printers"}),p.jsx(ece,{printers:_})]}),p.jsxs("div",{className:"flex items-center gap-3",children:[p.jsxs("div",{className:"flex items-center gap-1",children:[p.jsxs("select",{value:l,onChange:O=>N(O.target.value),className:"text-sm bg-bambu-dark border border-bambu-dark-tertiary rounded-lg px-2 py-1.5 text-white focus:border-bambu-green focus:outline-none",children:[p.jsx("option",{value:"name",children:"Name"}),p.jsx("option",{value:"status",children:"Status"}),p.jsx("option",{value:"model",children:"Model"}),p.jsx("option",{value:"location",children:"Location"})]}),p.jsx("button",{onClick:D,className:"p-1.5 rounded-lg hover:bg-bambu-dark-tertiary transition-colors",title:d?"Sort descending":"Sort ascending",children:d?p.jsx(xN,{className:"w-4 h-4 text-bambu-gray"}):p.jsx(gN,{className:"w-4 h-4 text-bambu-gray"})})]}),p.jsx("button",{onClick:F,className:"p-1.5 rounded-lg hover:bg-bambu-dark-tertiary transition-colors",title:m==="expanded"?"Switch to compact view":"Switch to expanded view",children:m==="expanded"?p.jsx(Use,{className:"w-5 h-5 text-bambu-gray"}):p.jsx(GG,{className:"w-5 h-5 text-bambu-gray"})}),p.jsx("div",{className:"w-px h-6 bg-bambu-dark-tertiary"}),p.jsxs("label",{className:"flex items-center gap-2 text-sm text-bambu-gray cursor-pointer",children:[p.jsx("input",{type:"checkbox",checked:n,onChange:U,className:"rounded border-bambu-dark-tertiary bg-bambu-dark text-bambu-green focus:ring-bambu-green"}),"Hide offline"]}),n&&Object.keys(C).length>0&&p.jsxs("div",{className:"relative",children:[p.jsxs("button",{onClick:()=>a(!r),className:"flex items-center gap-1.5 px-3 py-1.5 text-sm bg-white dark:bg-bambu-dark-secondary border border-gray-200 dark:border-bambu-dark-tertiary rounded-lg text-gray-600 dark:text-bambu-gray hover:text-gray-900 dark:hover:text-white hover:border-bambu-green transition-colors",children:[p.jsx(fm,{className:"w-4 h-4"}),"Power On",p.jsx(Cx,{className:`w-3 h-3 transition-transform ${r?"rotate-180":""}`})]}),r&&p.jsxs(p.Fragment,{children:[p.jsx("div",{className:"fixed inset-0 z-10",onClick:()=>a(!1)}),p.jsxs("div",{className:"absolute right-0 mt-2 w-56 bg-white dark:bg-bambu-dark-secondary border border-gray-200 dark:border-bambu-dark-tertiary rounded-lg shadow-lg z-20 py-1",children:[p.jsx("div",{className:"px-3 py-2 text-xs text-gray-500 dark:text-bambu-gray border-b border-gray-200 dark:border-bambu-dark-tertiary",children:"Offline printers with smart plugs"}),_?.filter(O=>C[O.id]).map(O=>p.jsx(rce,{printer:O,plug:C[O.id],onPowerOn:B=>{o(B),A.mutate(B)},isPowering:s===C[O.id]?.id},O.id)),_?.filter(O=>C[O.id]).length===0&&p.jsx("div",{className:"px-3 py-2 text-sm text-bambu-gray",children:"No printers with smart plugs"})]})]})]}),p.jsxs(st,{onClick:()=>e(!0),children:[p.jsx(dc,{className:"w-4 h-4"}),"Add Printer"]})]})]}),v?p.jsx("div",{className:"text-center py-12 text-bambu-gray",children:"Loading printers..."}):_?.length===0?p.jsx(Zt,{children:p.jsxs(cn,{className:"text-center py-12",children:[p.jsx("p",{className:"text-bambu-gray mb-4",children:"No printers configured yet"}),p.jsxs(st,{onClick:()=>e(!0),children:[p.jsx(dc,{className:"w-4 h-4"}),"Add Your First Printer"]})]})}):W?p.jsx("div",{className:"space-y-6",children:Object.entries(W).map(([O,B])=>p.jsxs("div",{children:[p.jsxs("h2",{className:"text-lg font-semibold text-white mb-3 flex items-center gap-2",children:[p.jsx("span",{className:"w-2 h-2 rounded-full bg-bambu-green"}),O,p.jsxs("span",{className:"text-sm font-normal text-bambu-gray",children:["(",B.length,")"]})]}),p.jsx("div",{className:`grid gap-4 ${m==="compact"?"grid-cols-1 md:grid-cols-2 lg:grid-cols-4":"grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6"}`,children:B.map(H=>p.jsx($j,{printer:H,hideIfDisconnected:n,maintenanceInfo:T[H.id],viewMode:m,amsThresholds:x?{humidityGood:Number(x.ams_humidity_good)||40,humidityFair:Number(x.ams_humidity_fair)||60,tempGood:Number(x.ams_temp_good)||28,tempFair:Number(x.ams_temp_fair)||35}:void 0},H.id))})]},O))}):p.jsx("div",{className:`grid gap-4 ${m==="compact"?"grid-cols-1 md:grid-cols-2 lg:grid-cols-4":"grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6"}`,children:I.map(O=>p.jsx($j,{printer:O,hideIfDisconnected:n,maintenanceInfo:T[O.id],viewMode:m,amsThresholds:x?{humidityGood:Number(x.ams_humidity_good)||40,humidityFair:Number(x.ams_humidity_fair)||60,tempGood:Number(x.ams_temp_good)||28,tempFair:Number(x.ams_temp_fair)||35}:void 0},O.id))}),t&&p.jsx(tce,{onClose:()=>e(!1),onAdd:O=>P.mutate(O)})]})}const DP="181",Mp={ROTATE:0,DOLLY:1,PAN:2},xp={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},sce=0,Gj=1,oce=2,s9=1,lce=2,zl=3,Gu=0,Ia=1,Bo=2,nc=0,Ep=1,Wj=2,qj=3,Xj=4,cce=5,Vd=100,uce=101,dce=102,fce=103,hce=104,pce=200,mce=201,gce=202,xce=203,wN=204,MN=205,vce=206,yce=207,bce=208,_ce=209,Sce=210,wce=211,Mce=212,Ece=213,Ace=214,EN=0,AN=1,TN=2,Up=3,CN=4,NN=5,RN=6,PN=7,kP=0,Tce=1,Cce=2,Lu=0,Nce=1,Rce=2,Pce=3,Dce=4,kce=5,Oce=6,Lce=7,o9=300,jp=301,Fp=302,DN=303,kN=304,$S=306,ON=1e3,Kl=1001,LN=1002,cs=1003,Ice=1004,Ty=1005,zs=1006,EA=1007,Yd=1008,Qo=1009,l9=1010,c9=1011,z0=1012,OP=1013,Sf=1014,Yl=1015,hm=1016,LP=1017,IP=1018,B0=1020,u9=35902,d9=35899,f9=1021,h9=1022,mo=1023,H0=1026,V0=1027,p9=1028,UP=1029,jP=1030,FP=1031,zP=1033,s_=33776,o_=33777,l_=33778,c_=33779,IN=35840,UN=35841,jN=35842,FN=35843,zN=36196,BN=37492,HN=37496,VN=37808,$N=37809,GN=37810,WN=37811,qN=37812,XN=37813,KN=37814,YN=37815,ZN=37816,QN=37817,JN=37818,e3=37819,t3=37820,n3=37821,i3=36492,r3=36494,a3=36495,s3=36283,o3=36284,l3=36285,c3=36286,Uce=3200,jce=3201,m9=0,Fce=1,Mu="",Ds="srgb",zp="srgb-linear",F_="linear",zn="srgb",Ah=7680,Kj=519,zce=512,Bce=513,Hce=514,g9=515,Vce=516,$ce=517,Gce=518,Wce=519,Yj=35044,Zj="300 es",$o=2e3,z_=2001;function x9(t){for(let e=t.length-1;e>=0;--e)if(t[e]>=65535)return!0;return!1}function B_(t){return document.createElementNS("http://www.w3.org/1999/xhtml",t)}function qce(){const t=B_("canvas");return t.style.display="block",t}const Qj={};function Jj(...t){const e="THREE."+t.shift();console.log(e,...t)}function Gt(...t){const e="THREE."+t.shift();console.warn(e,...t)}function Di(...t){const e="THREE."+t.shift();console.error(e,...t)}function $0(...t){const e=t.join(" ");e in Qj||(Qj[e]=!0,Gt(...t))}function Xce(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 Bf=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 qr=["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"],u_=Math.PI/180,u3=180/Math.PI;function Px(){const t=Math.random()*4294967295|0,e=Math.random()*4294967295|0,n=Math.random()*4294967295|0,i=Math.random()*4294967295|0;return(qr[t&255]+qr[t>>8&255]+qr[t>>16&255]+qr[t>>24&255]+"-"+qr[e&255]+qr[e>>8&255]+"-"+qr[e>>16&15|64]+qr[e>>24&255]+"-"+qr[n&63|128]+qr[n>>8&255]+"-"+qr[n>>16&255]+qr[n>>24&255]+qr[i&255]+qr[i>>8&255]+qr[i>>16&255]+qr[i>>24&255]).toLowerCase()}function pn(t,e,n){return Math.max(e,Math.min(n,t))}function Kce(t,e){return(t%e+e)%e}function AA(t,e,n){return(1-n)*t+n*e}function Eg(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 Ra(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 Yce={DEG2RAD:u_};let an=class v9{constructor(e=0,n=0){v9.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=pn(this.x,e.x,n.x),this.y=pn(this.y,e.y,n.y),this}clampScalar(e,n){return this.x=pn(this.x,e,n),this.y=pn(this.y,e,n),this}clampLength(e,n){const i=this.length();return this.divideScalar(i||1).multiplyScalar(pn(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(pn(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}},wf=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,o){let l=i[r+0],c=i[r+1],d=i[r+2],f=i[r+3],m=a[s+0],g=a[s+1],y=a[s+2],_=a[s+3];if(o<=0){e[n+0]=l,e[n+1]=c,e[n+2]=d,e[n+3]=f;return}if(o>=1){e[n+0]=m,e[n+1]=g,e[n+2]=y,e[n+3]=_;return}if(f!==_||l!==m||c!==g||d!==y){let v=l*m+c*g+d*y+f*_;v<0&&(m=-m,g=-g,y=-y,_=-_,v=-v);let x=1-o;if(v<.9995){const M=Math.acos(v),w=Math.sin(M);x=Math.sin(x*M)/w,o=Math.sin(o*M)/w,l=l*x+m*o,c=c*x+g*o,d=d*x+y*o,f=f*x+_*o}else{l=l*x+m*o,c=c*x+g*o,d=d*x+y*o,f=f*x+_*o;const M=1/Math.sqrt(l*l+c*c+d*d+f*f);l*=M,c*=M,d*=M,f*=M}}e[n]=l,e[n+1]=c,e[n+2]=d,e[n+3]=f}static multiplyQuaternionsFlat(e,n,i,r,a,s){const o=i[r],l=i[r+1],c=i[r+2],d=i[r+3],f=a[s],m=a[s+1],g=a[s+2],y=a[s+3];return e[n]=o*y+d*f+l*g-c*m,e[n+1]=l*y+d*m+c*f-o*g,e[n+2]=c*y+d*g+o*m-l*f,e[n+3]=d*y-o*f-l*m-c*g,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,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,o=Math.cos,l=Math.sin,c=o(i/2),d=o(r/2),f=o(a/2),m=l(i/2),g=l(r/2),y=l(a/2);switch(s){case"XYZ":this._x=m*d*f+c*g*y,this._y=c*g*f-m*d*y,this._z=c*d*y+m*g*f,this._w=c*d*f-m*g*y;break;case"YXZ":this._x=m*d*f+c*g*y,this._y=c*g*f-m*d*y,this._z=c*d*y-m*g*f,this._w=c*d*f+m*g*y;break;case"ZXY":this._x=m*d*f-c*g*y,this._y=c*g*f+m*d*y,this._z=c*d*y+m*g*f,this._w=c*d*f-m*g*y;break;case"ZYX":this._x=m*d*f-c*g*y,this._y=c*g*f+m*d*y,this._z=c*d*y-m*g*f,this._w=c*d*f+m*g*y;break;case"YZX":this._x=m*d*f+c*g*y,this._y=c*g*f+m*d*y,this._z=c*d*y-m*g*f,this._w=c*d*f-m*g*y;break;case"XZY":this._x=m*d*f-c*g*y,this._y=c*g*f-m*d*y,this._z=c*d*y+m*g*f,this._w=c*d*f+m*g*y;break;default:Gt("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],o=n[5],l=n[9],c=n[2],d=n[6],f=n[10],m=i+o+f;if(m>0){const g=.5/Math.sqrt(m+1);this._w=.25/g,this._x=(d-l)*g,this._y=(a-c)*g,this._z=(s-r)*g}else if(i>o&&i>f){const g=2*Math.sqrt(1+i-o-f);this._w=(d-l)/g,this._x=.25*g,this._y=(r+s)/g,this._z=(a+c)/g}else if(o>f){const g=2*Math.sqrt(1+o-i-f);this._w=(a-c)/g,this._x=(r+s)/g,this._y=.25*g,this._z=(l+d)/g}else{const g=2*Math.sqrt(1+f-i-o);this._w=(s-r)/g,this._x=(a+c)/g,this._y=(l+d)/g,this._z=.25*g}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(pn(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,o=n._x,l=n._y,c=n._z,d=n._w;return this._x=i*d+s*o+r*c-a*l,this._y=r*d+s*l+a*o-i*c,this._z=a*d+s*c+i*l-r*o,this._w=s*d-i*o-r*l-a*c,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,o=this.dot(e);o<0&&(i=-i,r=-r,a=-a,s=-s,o=-o);let l=1-n;if(o<.9995){const c=Math.acos(o),d=Math.sin(c);l=Math.sin(l*c)/d,n=Math.sin(n*c)/d,this._x=this._x*l+i*n,this._y=this._y*l+r*n,this._z=this._z*l+a*n,this._w=this._w*l+s*n,this._onChangeCallback()}else this._x=this._x*l+i*n,this._y=this._y*l+r*n,this._z=this._z*l+a*n,this._w=this._w*l+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}},$e=class y9{constructor(e=0,n=0,i=0){y9.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(eF.setFromEuler(e))}applyAxisAngle(e,n){return this.applyQuaternion(eF.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,o=e.z,l=e.w,c=2*(s*r-o*i),d=2*(o*n-a*r),f=2*(a*i-s*n);return this.x=n+l*c+s*f-o*d,this.y=i+l*d+o*c-a*f,this.z=r+l*f+a*d-s*c,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=pn(this.x,e.x,n.x),this.y=pn(this.y,e.y,n.y),this.z=pn(this.z,e.z,n.z),this}clampScalar(e,n){return this.x=pn(this.x,e,n),this.y=pn(this.y,e,n),this.z=pn(this.z,e,n),this}clampLength(e,n){const i=this.length();return this.divideScalar(i||1).multiplyScalar(pn(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,o=n.y,l=n.z;return this.x=r*l-a*o,this.y=a*s-i*l,this.z=i*o-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 TA.copy(this).projectOnVector(e),this.sub(TA)}reflect(e){return this.sub(TA.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(pn(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 TA=new $e,eF=new wf;let ln=class b9{constructor(e,n,i,r,a,s,o,l,c){b9.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,o,l,c)}set(e,n,i,r,a,s,o,l,c){const d=this.elements;return d[0]=e,d[1]=r,d[2]=o,d[3]=n,d[4]=a,d[5]=l,d[6]=i,d[7]=s,d[8]=c,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],o=i[3],l=i[6],c=i[1],d=i[4],f=i[7],m=i[2],g=i[5],y=i[8],_=r[0],v=r[3],x=r[6],M=r[1],w=r[4],T=r[7],C=r[2],P=r[5],A=r[8];return a[0]=s*_+o*M+l*C,a[3]=s*v+o*w+l*P,a[6]=s*x+o*T+l*A,a[1]=c*_+d*M+f*C,a[4]=c*v+d*w+f*P,a[7]=c*x+d*T+f*A,a[2]=m*_+g*M+y*C,a[5]=m*v+g*w+y*P,a[8]=m*x+g*T+y*A,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],o=e[5],l=e[6],c=e[7],d=e[8];return n*s*d-n*o*c-i*a*d+i*o*l+r*a*c-r*s*l}invert(){const e=this.elements,n=e[0],i=e[1],r=e[2],a=e[3],s=e[4],o=e[5],l=e[6],c=e[7],d=e[8],f=d*s-o*c,m=o*l-d*a,g=c*a-s*l,y=n*f+i*m+r*g;if(y===0)return this.set(0,0,0,0,0,0,0,0,0);const _=1/y;return e[0]=f*_,e[1]=(r*c-d*i)*_,e[2]=(o*i-r*s)*_,e[3]=m*_,e[4]=(d*n-r*l)*_,e[5]=(r*a-o*n)*_,e[6]=g*_,e[7]=(i*l-c*n)*_,e[8]=(s*n-i*a)*_,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,o){const l=Math.cos(a),c=Math.sin(a);return this.set(i*l,i*c,-i*(l*s+c*o)+s+e,-r*c,r*l,-r*(-c*s+l*o)+o+n,0,0,1),this}scale(e,n){return this.premultiply(CA.makeScale(e,n)),this}rotate(e){return this.premultiply(CA.makeRotation(-e)),this}translate(e,n){return this.premultiply(CA.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 CA=new ln,tF=new ln().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),nF=new ln().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function Zce(){const t={enabled:!0,workingColorSpace:zp,spaces:{},convert:function(r,a,s){return this.enabled===!1||a===s||!a||!s||(this.spaces[a].transfer===zn&&(r.r=ic(r.r),r.g=ic(r.g),r.b=ic(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===zn&&(r.r=Ap(r.r),r.g=Ap(r.g),r.b=Ap(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===Mu?F_: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 $0("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),t.workingToColorSpace(r,a)},toWorkingColorSpace:function(r,a){return $0("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({[zp]:{primaries:e,whitePoint:i,transfer:F_,toXYZ:tF,fromXYZ:nF,luminanceCoefficients:n,workingColorSpaceConfig:{unpackColorSpace:Ds},outputColorSpaceConfig:{drawingBufferColorSpace:Ds}},[Ds]:{primaries:e,whitePoint:i,transfer:zn,toXYZ:tF,fromXYZ:nF,luminanceCoefficients:n,outputColorSpaceConfig:{drawingBufferColorSpace:Ds}}}),t}const Mn=Zce();function ic(t){return t<.04045?t*.0773993808:Math.pow(t*.9478672986+.0521327014,2.4)}function Ap(t){return t<.0031308?t*12.92:1.055*Math.pow(t,.41666)-.055}let Th,Qce=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{Th===void 0&&(Th=B_("canvas")),Th.width=e.width,Th.height=e.height;const r=Th.getContext("2d");e instanceof ImageData?r.putImageData(e,0,0):r.drawImage(e,0,0,e.width,e.height),i=Th}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=B_("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]=ic(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(ic(n[i]/255)*255):n[i]=ic(n[i]);return{data:n,width:e.width,height:e.height}}else return Gt("ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}},Jce=0,BP=class{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:Jce++}),this.uuid=Px(),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,o=r.length;s<o;s++)r[s].isDataTexture?a.push(NA(r[s].image)):a.push(NA(r[s]))}else a=NA(r);i.url=a}return n||(e.images[this.uuid]=i),i}};function NA(t){return typeof HTMLImageElement<"u"&&t instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&t instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&t instanceof ImageBitmap?Qce.getDataURL(t):t.data?{data:Array.from(t.data),width:t.width,height:t.height,type:t.data.constructor.name}:(Gt("Texture: Unable to serialize Texture."),{})}let eue=0;const RA=new $e;let Eo=class d_ extends Bf{constructor(e=d_.DEFAULT_IMAGE,n=d_.DEFAULT_MAPPING,i=Kl,r=Kl,a=zs,s=Yd,o=mo,l=Qo,c=d_.DEFAULT_ANISOTROPY,d=Mu){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:eue++}),this.uuid=Px(),this.name="",this.source=new BP(e),this.mipmaps=[],this.mapping=n,this.channel=0,this.wrapS=i,this.wrapT=r,this.magFilter=a,this.minFilter=s,this.anisotropy=c,this.format=o,this.internalFormat=null,this.type=l,this.offset=new an(0,0),this.repeat=new an(1,1),this.center=new an(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new ln,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=d,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(RA).x}get height(){return this.source.getSize(RA).y}get depth(){return this.source.getSize(RA).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){Gt(`Texture.setValues(): parameter '${n}' has value of undefined.`);continue}const r=this[n];if(r===void 0){Gt(`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!==o9)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case ON:e.x=e.x-Math.floor(e.x);break;case Kl:e.x=e.x<0?0:1;break;case LN: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 ON:e.y=e.y-Math.floor(e.y);break;case Kl:e.y=e.y<0?0:1;break;case LN: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++}};Eo.DEFAULT_IMAGE=null;Eo.DEFAULT_MAPPING=o9;Eo.DEFAULT_ANISOTROPY=1;let Vi=class _9{constructor(e=0,n=0,i=0,r=1){_9.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 l=e.elements,c=l[0],d=l[4],f=l[8],m=l[1],g=l[5],y=l[9],_=l[2],v=l[6],x=l[10];if(Math.abs(d-m)<.01&&Math.abs(f-_)<.01&&Math.abs(y-v)<.01){if(Math.abs(d+m)<.1&&Math.abs(f+_)<.1&&Math.abs(y+v)<.1&&Math.abs(c+g+x-3)<.1)return this.set(1,0,0,0),this;n=Math.PI;const w=(c+1)/2,T=(g+1)/2,C=(x+1)/2,P=(d+m)/4,A=(f+_)/4,U=(y+v)/4;return w>T&&w>C?w<.01?(i=0,r=.707106781,a=.707106781):(i=Math.sqrt(w),r=P/i,a=A/i):T>C?T<.01?(i=.707106781,r=0,a=.707106781):(r=Math.sqrt(T),i=P/r,a=U/r):C<.01?(i=.707106781,r=.707106781,a=0):(a=Math.sqrt(C),i=A/a,r=U/a),this.set(i,r,a,n),this}let M=Math.sqrt((v-y)*(v-y)+(f-_)*(f-_)+(m-d)*(m-d));return Math.abs(M)<.001&&(M=1),this.x=(v-y)/M,this.y=(f-_)/M,this.z=(m-d)/M,this.w=Math.acos((c+g+x-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=pn(this.x,e.x,n.x),this.y=pn(this.y,e.y,n.y),this.z=pn(this.z,e.z,n.z),this.w=pn(this.w,e.w,n.w),this}clampScalar(e,n){return this.x=pn(this.x,e,n),this.y=pn(this.y,e,n),this.z=pn(this.z,e,n),this.w=pn(this.w,e,n),this}clampLength(e,n){const i=this.length();return this.divideScalar(i||1).multiplyScalar(pn(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}},tue=class extends Bf{constructor(e=1,n=1,i={}){super(),i=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:zs,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 Vi(0,0,e,n),this.scissorTest=!1,this.viewport=new Vi(0,0,e,n);const r={width:e,height:n,depth:i.depth},a=new Eo(r);this.textures=[];const s=i.count;for(let o=0;o<s;o++)this.textures[o]=a.clone(),this.textures[o].isRenderTargetTexture=!0,this.textures[o].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:zs,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 BP(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"})}},Mf=class extends tue{constructor(e=1,n=1,i={}){super(e,n,i),this.isWebGLRenderTarget=!0}},S9=class extends Eo{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=cs,this.minFilter=cs,this.wrapR=Kl,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}},nue=class extends Eo{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=cs,this.minFilter=cs,this.wrapR=Kl,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}},Ef=class{constructor(e=new $e(1/0,1/0,1/0),n=new $e(-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(no.fromArray(e,n));return this}setFromBufferAttribute(e){this.makeEmpty();for(let n=0,i=e.count;n<i;n++)this.expandByPoint(no.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=no.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,o=a.count;s<o;s++)e.isMesh===!0?e.getVertexPosition(s,no):no.fromBufferAttribute(a,s),no.applyMatrix4(e.matrixWorld),this.expandByPoint(no);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),Cy.copy(e.boundingBox)):(i.boundingBox===null&&i.computeBoundingBox(),Cy.copy(i.boundingBox)),Cy.applyMatrix4(e.matrixWorld),this.union(Cy)}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,no),no.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(Ag),Ny.subVectors(this.max,Ag),Ch.subVectors(e.a,Ag),Nh.subVectors(e.b,Ag),Rh.subVectors(e.c,Ag),tu.subVectors(Nh,Ch),nu.subVectors(Rh,Nh),Td.subVectors(Ch,Rh);let n=[0,-tu.z,tu.y,0,-nu.z,nu.y,0,-Td.z,Td.y,tu.z,0,-tu.x,nu.z,0,-nu.x,Td.z,0,-Td.x,-tu.y,tu.x,0,-nu.y,nu.x,0,-Td.y,Td.x,0];return!PA(n,Ch,Nh,Rh,Ny)||(n=[1,0,0,0,1,0,0,0,1],!PA(n,Ch,Nh,Rh,Ny))?!1:(Ry.crossVectors(tu,nu),n=[Ry.x,Ry.y,Ry.z],PA(n,Ch,Nh,Rh,Ny))}clampPoint(e,n){return n.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,no).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(no).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:(Al[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Al[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Al[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Al[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Al[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Al[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Al[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Al[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Al),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 Al=[new $e,new $e,new $e,new $e,new $e,new $e,new $e,new $e],no=new $e,Cy=new Ef,Ch=new $e,Nh=new $e,Rh=new $e,tu=new $e,nu=new $e,Td=new $e,Ag=new $e,Ny=new $e,Ry=new $e,Cd=new $e;function PA(t,e,n,i,r){for(let a=0,s=t.length-3;a<=s;a+=3){Cd.fromArray(t,a);const o=r.x*Math.abs(Cd.x)+r.y*Math.abs(Cd.y)+r.z*Math.abs(Cd.z),l=e.dot(Cd),c=n.dot(Cd),d=i.dot(Cd);if(Math.max(-Math.max(l,c,d),Math.min(l,c,d))>o)return!1}return!0}const iue=new Ef,Tg=new $e,DA=new $e;let GS=class{constructor(e=new $e,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):iue.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;Tg.subVectors(e,this.center);const n=Tg.lengthSq();if(n>this.radius*this.radius){const i=Math.sqrt(n),r=(i-this.radius)*.5;this.center.addScaledVector(Tg,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):(DA.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(Tg.copy(e.center).add(DA)),this.expandByPoint(Tg.copy(e.center).sub(DA))),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 Tl=new $e,kA=new $e,Py=new $e,iu=new $e,OA=new $e,Dy=new $e,LA=new $e;let HP=class{constructor(e=new $e,n=new $e(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,Tl)),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=Tl.subVectors(e,this.origin).dot(this.direction);return n<0?this.origin.distanceToSquared(e):(Tl.copy(this.origin).addScaledVector(this.direction,n),Tl.distanceToSquared(e))}distanceSqToSegment(e,n,i,r){kA.copy(e).add(n).multiplyScalar(.5),Py.copy(n).sub(e).normalize(),iu.copy(this.origin).sub(kA);const a=e.distanceTo(n)*.5,s=-this.direction.dot(Py),o=iu.dot(this.direction),l=-iu.dot(Py),c=iu.lengthSq(),d=Math.abs(1-s*s);let f,m,g,y;if(d>0)if(f=s*l-o,m=s*o-l,y=a*d,f>=0)if(m>=-y)if(m<=y){const _=1/d;f*=_,m*=_,g=f*(f+s*m+2*o)+m*(s*f+m+2*l)+c}else m=a,f=Math.max(0,-(s*m+o)),g=-f*f+m*(m+2*l)+c;else m=-a,f=Math.max(0,-(s*m+o)),g=-f*f+m*(m+2*l)+c;else m<=-y?(f=Math.max(0,-(-s*a+o)),m=f>0?-a:Math.min(Math.max(-a,-l),a),g=-f*f+m*(m+2*l)+c):m<=y?(f=0,m=Math.min(Math.max(-a,-l),a),g=m*(m+2*l)+c):(f=Math.max(0,-(s*a+o)),m=f>0?a:Math.min(Math.max(-a,-l),a),g=-f*f+m*(m+2*l)+c);else m=s>0?-a:a,f=Math.max(0,-(s*m+o)),g=-f*f+m*(m+2*l)+c;return i&&i.copy(this.origin).addScaledVector(this.direction,f),r&&r.copy(kA).addScaledVector(Py,m),g}intersectSphere(e,n){Tl.subVectors(e.center,this.origin);const i=Tl.dot(this.direction),r=Tl.dot(Tl)-i*i,a=e.radius*e.radius;if(r>a)return null;const s=Math.sqrt(a-r),o=i-s,l=i+s;return l<0?null:o<0?this.at(l,n):this.at(o,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,o,l;const c=1/this.direction.x,d=1/this.direction.y,f=1/this.direction.z,m=this.origin;return c>=0?(i=(e.min.x-m.x)*c,r=(e.max.x-m.x)*c):(i=(e.max.x-m.x)*c,r=(e.min.x-m.x)*c),d>=0?(a=(e.min.y-m.y)*d,s=(e.max.y-m.y)*d):(a=(e.max.y-m.y)*d,s=(e.min.y-m.y)*d),i>s||a>r||((a>i||isNaN(i))&&(i=a),(s<r||isNaN(r))&&(r=s),f>=0?(o=(e.min.z-m.z)*f,l=(e.max.z-m.z)*f):(o=(e.max.z-m.z)*f,l=(e.min.z-m.z)*f),i>l||o>r)||((o>i||i!==i)&&(i=o),(l<r||r!==r)&&(r=l),r<0)?null:this.at(i>=0?i:r,n)}intersectsBox(e){return this.intersectBox(e,Tl)!==null}intersectTriangle(e,n,i,r,a){OA.subVectors(n,e),Dy.subVectors(i,e),LA.crossVectors(OA,Dy);let s=this.direction.dot(LA),o;if(s>0){if(r)return null;o=1}else if(s<0)o=-1,s=-s;else return null;iu.subVectors(this.origin,e);const l=o*this.direction.dot(Dy.crossVectors(iu,Dy));if(l<0)return null;const c=o*this.direction.dot(OA.cross(iu));if(c<0||l+c>s)return null;const d=-o*iu.dot(LA);return d<0?null:this.at(d/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)}},qi=class d3{constructor(e,n,i,r,a,s,o,l,c,d,f,m,g,y,_,v){d3.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,o,l,c,d,f,m,g,y,_,v)}set(e,n,i,r,a,s,o,l,c,d,f,m,g,y,_,v){const x=this.elements;return x[0]=e,x[4]=n,x[8]=i,x[12]=r,x[1]=a,x[5]=s,x[9]=o,x[13]=l,x[2]=c,x[6]=d,x[10]=f,x[14]=m,x[3]=g,x[7]=y,x[11]=_,x[15]=v,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 d3().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/Ph.setFromMatrixColumn(e,0).length(),a=1/Ph.setFromMatrixColumn(e,1).length(),s=1/Ph.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),o=Math.sin(i),l=Math.cos(r),c=Math.sin(r),d=Math.cos(a),f=Math.sin(a);if(e.order==="XYZ"){const m=s*d,g=s*f,y=o*d,_=o*f;n[0]=l*d,n[4]=-l*f,n[8]=c,n[1]=g+y*c,n[5]=m-_*c,n[9]=-o*l,n[2]=_-m*c,n[6]=y+g*c,n[10]=s*l}else if(e.order==="YXZ"){const m=l*d,g=l*f,y=c*d,_=c*f;n[0]=m+_*o,n[4]=y*o-g,n[8]=s*c,n[1]=s*f,n[5]=s*d,n[9]=-o,n[2]=g*o-y,n[6]=_+m*o,n[10]=s*l}else if(e.order==="ZXY"){const m=l*d,g=l*f,y=c*d,_=c*f;n[0]=m-_*o,n[4]=-s*f,n[8]=y+g*o,n[1]=g+y*o,n[5]=s*d,n[9]=_-m*o,n[2]=-s*c,n[6]=o,n[10]=s*l}else if(e.order==="ZYX"){const m=s*d,g=s*f,y=o*d,_=o*f;n[0]=l*d,n[4]=y*c-g,n[8]=m*c+_,n[1]=l*f,n[5]=_*c+m,n[9]=g*c-y,n[2]=-c,n[6]=o*l,n[10]=s*l}else if(e.order==="YZX"){const m=s*l,g=s*c,y=o*l,_=o*c;n[0]=l*d,n[4]=_-m*f,n[8]=y*f+g,n[1]=f,n[5]=s*d,n[9]=-o*d,n[2]=-c*d,n[6]=g*f+y,n[10]=m-_*f}else if(e.order==="XZY"){const m=s*l,g=s*c,y=o*l,_=o*c;n[0]=l*d,n[4]=-f,n[8]=c*d,n[1]=m*f+_,n[5]=s*d,n[9]=g*f-y,n[2]=y*f-g,n[6]=o*d,n[10]=_*f+m}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(rue,e,aue)}lookAt(e,n,i){const r=this.elements;return Qa.subVectors(e,n),Qa.lengthSq()===0&&(Qa.z=1),Qa.normalize(),ru.crossVectors(i,Qa),ru.lengthSq()===0&&(Math.abs(i.z)===1?Qa.x+=1e-4:Qa.z+=1e-4,Qa.normalize(),ru.crossVectors(i,Qa)),ru.normalize(),ky.crossVectors(Qa,ru),r[0]=ru.x,r[4]=ky.x,r[8]=Qa.x,r[1]=ru.y,r[5]=ky.y,r[9]=Qa.y,r[2]=ru.z,r[6]=ky.z,r[10]=Qa.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],o=i[4],l=i[8],c=i[12],d=i[1],f=i[5],m=i[9],g=i[13],y=i[2],_=i[6],v=i[10],x=i[14],M=i[3],w=i[7],T=i[11],C=i[15],P=r[0],A=r[4],U=r[8],N=r[12],D=r[1],F=r[5],I=r[9],W=r[13],O=r[2],B=r[6],H=r[10],$=r[14],K=r[3],Z=r[7],se=r[11],V=r[15];return a[0]=s*P+o*D+l*O+c*K,a[4]=s*A+o*F+l*B+c*Z,a[8]=s*U+o*I+l*H+c*se,a[12]=s*N+o*W+l*$+c*V,a[1]=d*P+f*D+m*O+g*K,a[5]=d*A+f*F+m*B+g*Z,a[9]=d*U+f*I+m*H+g*se,a[13]=d*N+f*W+m*$+g*V,a[2]=y*P+_*D+v*O+x*K,a[6]=y*A+_*F+v*B+x*Z,a[10]=y*U+_*I+v*H+x*se,a[14]=y*N+_*W+v*$+x*V,a[3]=M*P+w*D+T*O+C*K,a[7]=M*A+w*F+T*B+C*Z,a[11]=M*U+w*I+T*H+C*se,a[15]=M*N+w*W+T*$+C*V,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],o=e[5],l=e[9],c=e[13],d=e[2],f=e[6],m=e[10],g=e[14],y=e[3],_=e[7],v=e[11],x=e[15];return y*(+a*l*f-r*c*f-a*o*m+i*c*m+r*o*g-i*l*g)+_*(+n*l*g-n*c*m+a*s*m-r*s*g+r*c*d-a*l*d)+v*(+n*c*f-n*o*g-a*s*f+i*s*g+a*o*d-i*c*d)+x*(-r*o*d-n*l*f+n*o*m+r*s*f-i*s*m+i*l*d)}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],o=e[5],l=e[6],c=e[7],d=e[8],f=e[9],m=e[10],g=e[11],y=e[12],_=e[13],v=e[14],x=e[15],M=f*v*c-_*m*c+_*l*g-o*v*g-f*l*x+o*m*x,w=y*m*c-d*v*c-y*l*g+s*v*g+d*l*x-s*m*x,T=d*_*c-y*f*c+y*o*g-s*_*g-d*o*x+s*f*x,C=y*f*l-d*_*l-y*o*m+s*_*m+d*o*v-s*f*v,P=n*M+i*w+r*T+a*C;if(P===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const A=1/P;return e[0]=M*A,e[1]=(_*m*a-f*v*a-_*r*g+i*v*g+f*r*x-i*m*x)*A,e[2]=(o*v*a-_*l*a+_*r*c-i*v*c-o*r*x+i*l*x)*A,e[3]=(f*l*a-o*m*a-f*r*c+i*m*c+o*r*g-i*l*g)*A,e[4]=w*A,e[5]=(d*v*a-y*m*a+y*r*g-n*v*g-d*r*x+n*m*x)*A,e[6]=(y*l*a-s*v*a-y*r*c+n*v*c+s*r*x-n*l*x)*A,e[7]=(s*m*a-d*l*a+d*r*c-n*m*c-s*r*g+n*l*g)*A,e[8]=T*A,e[9]=(y*f*a-d*_*a-y*i*g+n*_*g+d*i*x-n*f*x)*A,e[10]=(s*_*a-y*o*a+y*i*c-n*_*c-s*i*x+n*o*x)*A,e[11]=(d*o*a-s*f*a-d*i*c+n*f*c+s*i*g-n*o*g)*A,e[12]=C*A,e[13]=(d*_*r-y*f*r+y*i*m-n*_*m-d*i*v+n*f*v)*A,e[14]=(y*o*r-s*_*r-y*i*l+n*_*l+s*i*v-n*o*v)*A,e[15]=(s*f*r-d*o*r+d*i*l-n*f*l-s*i*m+n*o*m)*A,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,o=e.y,l=e.z,c=a*s,d=a*o;return this.set(c*s+i,c*o-r*l,c*l+r*o,0,c*o+r*l,d*o+i,d*l-r*s,0,c*l-r*o,d*l+r*s,a*l*l+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,o=n._z,l=n._w,c=a+a,d=s+s,f=o+o,m=a*c,g=a*d,y=a*f,_=s*d,v=s*f,x=o*f,M=l*c,w=l*d,T=l*f,C=i.x,P=i.y,A=i.z;return r[0]=(1-(_+x))*C,r[1]=(g+T)*C,r[2]=(y-w)*C,r[3]=0,r[4]=(g-T)*P,r[5]=(1-(m+x))*P,r[6]=(v+M)*P,r[7]=0,r[8]=(y+w)*A,r[9]=(v-M)*A,r[10]=(1-(m+_))*A,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=Ph.set(r[0],r[1],r[2]).length();const s=Ph.set(r[4],r[5],r[6]).length(),o=Ph.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],io.copy(this);const c=1/a,d=1/s,f=1/o;return io.elements[0]*=c,io.elements[1]*=c,io.elements[2]*=c,io.elements[4]*=d,io.elements[5]*=d,io.elements[6]*=d,io.elements[8]*=f,io.elements[9]*=f,io.elements[10]*=f,n.setFromRotationMatrix(io),i.x=a,i.y=s,i.z=o,this}makePerspective(e,n,i,r,a,s,o=$o,l=!1){const c=this.elements,d=2*a/(n-e),f=2*a/(i-r),m=(n+e)/(n-e),g=(i+r)/(i-r);let y,_;if(l)y=a/(s-a),_=s*a/(s-a);else if(o===$o)y=-(s+a)/(s-a),_=-2*s*a/(s-a);else if(o===z_)y=-s/(s-a),_=-s*a/(s-a);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+o);return c[0]=d,c[4]=0,c[8]=m,c[12]=0,c[1]=0,c[5]=f,c[9]=g,c[13]=0,c[2]=0,c[6]=0,c[10]=y,c[14]=_,c[3]=0,c[7]=0,c[11]=-1,c[15]=0,this}makeOrthographic(e,n,i,r,a,s,o=$o,l=!1){const c=this.elements,d=2/(n-e),f=2/(i-r),m=-(n+e)/(n-e),g=-(i+r)/(i-r);let y,_;if(l)y=1/(s-a),_=s/(s-a);else if(o===$o)y=-2/(s-a),_=-(s+a)/(s-a);else if(o===z_)y=-1/(s-a),_=-a/(s-a);else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+o);return c[0]=d,c[4]=0,c[8]=0,c[12]=m,c[1]=0,c[5]=f,c[9]=0,c[13]=g,c[2]=0,c[6]=0,c[10]=y,c[14]=_,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 Ph=new $e,io=new qi,rue=new $e(0,0,0),aue=new $e(1,1,1),ru=new $e,ky=new $e,Qa=new $e,iF=new qi,rF=new wf;let Wu=class w9{constructor(e=0,n=0,i=0,r=w9.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],o=r[8],l=r[1],c=r[5],d=r[9],f=r[2],m=r[6],g=r[10];switch(n){case"XYZ":this._y=Math.asin(pn(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-d,g),this._z=Math.atan2(-s,a)):(this._x=Math.atan2(m,c),this._z=0);break;case"YXZ":this._x=Math.asin(-pn(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(o,g),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-f,a),this._z=0);break;case"ZXY":this._x=Math.asin(pn(m,-1,1)),Math.abs(m)<.9999999?(this._y=Math.atan2(-f,g),this._z=Math.atan2(-s,c)):(this._y=0,this._z=Math.atan2(l,a));break;case"ZYX":this._y=Math.asin(-pn(f,-1,1)),Math.abs(f)<.9999999?(this._x=Math.atan2(m,g),this._z=Math.atan2(l,a)):(this._x=0,this._z=Math.atan2(-s,c));break;case"YZX":this._z=Math.asin(pn(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-d,c),this._y=Math.atan2(-f,a)):(this._x=0,this._y=Math.atan2(o,g));break;case"XZY":this._z=Math.asin(-pn(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(m,c),this._y=Math.atan2(o,a)):(this._x=Math.atan2(-d,g),this._y=0);break;default:Gt("Euler: .setFromRotationMatrix() encountered an unknown order: "+n)}return this._order=n,i===!0&&this._onChangeCallback(),this}setFromQuaternion(e,n,i){return iF.makeRotationFromQuaternion(e),this.setFromRotationMatrix(iF,n,i)}setFromVector3(e,n=this._order){return this.set(e.x,e.y,e.z,n)}reorder(e){return rF.setFromEuler(this),this.setFromQuaternion(rF,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}};Wu.DEFAULT_ORDER="XYZ";let M9=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}},sue=0;const aF=new $e,Dh=new wf,Cl=new qi,Oy=new $e,Cg=new $e,oue=new $e,lue=new wf,sF=new $e(1,0,0),oF=new $e(0,1,0),lF=new $e(0,0,1),cF={type:"added"},cue={type:"removed"},kh={type:"childadded",child:null},IA={type:"childremoved",child:null};let hs=class f_ extends Bf{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:sue++}),this.uuid=Px(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=f_.DEFAULT_UP.clone();const e=new $e,n=new Wu,i=new wf,r=new $e(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 qi},normalMatrix:{value:new ln}}),this.matrix=new qi,this.matrixWorld=new qi,this.matrixAutoUpdate=f_.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=f_.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new M9,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 Dh.setFromAxisAngle(e,n),this.quaternion.multiply(Dh),this}rotateOnWorldAxis(e,n){return Dh.setFromAxisAngle(e,n),this.quaternion.premultiply(Dh),this}rotateX(e){return this.rotateOnAxis(sF,e)}rotateY(e){return this.rotateOnAxis(oF,e)}rotateZ(e){return this.rotateOnAxis(lF,e)}translateOnAxis(e,n){return aF.copy(e).applyQuaternion(this.quaternion),this.position.add(aF.multiplyScalar(n)),this}translateX(e){return this.translateOnAxis(sF,e)}translateY(e){return this.translateOnAxis(oF,e)}translateZ(e){return this.translateOnAxis(lF,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(Cl.copy(this.matrixWorld).invert())}lookAt(e,n,i){e.isVector3?Oy.copy(e):Oy.set(e,n,i);const r=this.parent;this.updateWorldMatrix(!0,!1),Cg.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Cl.lookAt(Cg,Oy,this.up):Cl.lookAt(Oy,Cg,this.up),this.quaternion.setFromRotationMatrix(Cl),r&&(Cl.extractRotation(r.matrixWorld),Dh.setFromRotationMatrix(Cl),this.quaternion.premultiply(Dh.invert()))}add(e){if(arguments.length>1){for(let n=0;n<arguments.length;n++)this.add(arguments[n]);return this}return e===this?(Di("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(cF),kh.child=e,this.dispatchEvent(kh),kh.child=null):Di("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(cue),IA.child=e,this.dispatchEvent(IA),IA.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),Cl.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),Cl.multiply(e.parent.matrixWorld)),e.applyMatrix4(Cl),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(cF),kh.child=e,this.dispatchEvent(kh),kh.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(Cg,e,oue),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Cg,lue,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(o=>({...o,boundingBox:o.boundingBox?o.boundingBox.toJSON():void 0,boundingSphere:o.boundingSphere?o.boundingSphere.toJSON():void 0})),r.instanceInfo=this._instanceInfo.map(o=>({...o})),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(o,l){return o[l.uuid]===void 0&&(o[l.uuid]=l.toJSON(e)),l.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 o=this.geometry.parameters;if(o!==void 0&&o.shapes!==void 0){const l=o.shapes;if(Array.isArray(l))for(let c=0,d=l.length;c<d;c++){const f=l[c];a(e.shapes,f)}else a(e.shapes,l)}}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 o=[];for(let l=0,c=this.material.length;l<c;l++)o.push(a(e.materials,this.material[l]));r.material=o}else r.material=a(e.materials,this.material);if(this.children.length>0){r.children=[];for(let o=0;o<this.children.length;o++)r.children.push(this.children[o].toJSON(e).object)}if(this.animations.length>0){r.animations=[];for(let o=0;o<this.animations.length;o++){const l=this.animations[o];r.animations.push(a(e.animations,l))}}if(n){const o=s(e.geometries),l=s(e.materials),c=s(e.textures),d=s(e.images),f=s(e.shapes),m=s(e.skeletons),g=s(e.animations),y=s(e.nodes);o.length>0&&(i.geometries=o),l.length>0&&(i.materials=l),c.length>0&&(i.textures=c),d.length>0&&(i.images=d),f.length>0&&(i.shapes=f),m.length>0&&(i.skeletons=m),g.length>0&&(i.animations=g),y.length>0&&(i.nodes=y)}return i.object=r,i;function s(o){const l=[];for(const c in o){const d=o[c];delete d.metadata,l.push(d)}return l}}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}};hs.DEFAULT_UP=new $e(0,1,0);hs.DEFAULT_MATRIX_AUTO_UPDATE=!0;hs.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;const ro=new $e,Nl=new $e,UA=new $e,Rl=new $e,Oh=new $e,Lh=new $e,uF=new $e,jA=new $e,FA=new $e,zA=new $e,BA=new Vi,HA=new Vi,VA=new Vi;let Ng=class up{constructor(e=new $e,n=new $e,i=new $e){this.a=e,this.b=n,this.c=i}static getNormal(e,n,i,r){r.subVectors(i,n),ro.subVectors(e,n),r.cross(ro);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){ro.subVectors(r,n),Nl.subVectors(i,n),UA.subVectors(e,n);const s=ro.dot(ro),o=ro.dot(Nl),l=ro.dot(UA),c=Nl.dot(Nl),d=Nl.dot(UA),f=s*c-o*o;if(f===0)return a.set(0,0,0),null;const m=1/f,g=(c*l-o*d)*m,y=(s*d-o*l)*m;return a.set(1-g-y,y,g)}static containsPoint(e,n,i,r){return this.getBarycoord(e,n,i,r,Rl)===null?!1:Rl.x>=0&&Rl.y>=0&&Rl.x+Rl.y<=1}static getInterpolation(e,n,i,r,a,s,o,l){return this.getBarycoord(e,n,i,r,Rl)===null?(l.x=0,l.y=0,"z"in l&&(l.z=0),"w"in l&&(l.w=0),null):(l.setScalar(0),l.addScaledVector(a,Rl.x),l.addScaledVector(s,Rl.y),l.addScaledVector(o,Rl.z),l)}static getInterpolatedAttribute(e,n,i,r,a,s){return BA.setScalar(0),HA.setScalar(0),VA.setScalar(0),BA.fromBufferAttribute(e,n),HA.fromBufferAttribute(e,i),VA.fromBufferAttribute(e,r),s.setScalar(0),s.addScaledVector(BA,a.x),s.addScaledVector(HA,a.y),s.addScaledVector(VA,a.z),s}static isFrontFacing(e,n,i,r){return ro.subVectors(i,n),Nl.subVectors(e,n),ro.cross(Nl).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 ro.subVectors(this.c,this.b),Nl.subVectors(this.a,this.b),ro.cross(Nl).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return up.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,n){return up.getBarycoord(e,this.a,this.b,this.c,n)}getInterpolation(e,n,i,r,a){return up.getInterpolation(e,this.a,this.b,this.c,n,i,r,a)}containsPoint(e){return up.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return up.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,o;Oh.subVectors(r,i),Lh.subVectors(a,i),jA.subVectors(e,i);const l=Oh.dot(jA),c=Lh.dot(jA);if(l<=0&&c<=0)return n.copy(i);FA.subVectors(e,r);const d=Oh.dot(FA),f=Lh.dot(FA);if(d>=0&&f<=d)return n.copy(r);const m=l*f-d*c;if(m<=0&&l>=0&&d<=0)return s=l/(l-d),n.copy(i).addScaledVector(Oh,s);zA.subVectors(e,a);const g=Oh.dot(zA),y=Lh.dot(zA);if(y>=0&&g<=y)return n.copy(a);const _=g*c-l*y;if(_<=0&&c>=0&&y<=0)return o=c/(c-y),n.copy(i).addScaledVector(Lh,o);const v=d*y-g*f;if(v<=0&&f-d>=0&&g-y>=0)return uF.subVectors(a,r),o=(f-d)/(f-d+(g-y)),n.copy(r).addScaledVector(uF,o);const x=1/(v+_+m);return s=_*x,o=m*x,n.copy(i).addScaledVector(Oh,s).addScaledVector(Lh,o)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}};const E9={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},au={h:0,s:0,l:0},Ly={h:0,s:0,l:0};function $A(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 vn=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=Ds){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,Mn.colorSpaceToWorking(this,n),this}setRGB(e,n,i,r=Mn.workingColorSpace){return this.r=e,this.g=n,this.b=i,Mn.colorSpaceToWorking(this,r),this}setHSL(e,n,i,r=Mn.workingColorSpace){if(e=Kce(e,1),n=pn(n,0,1),i=pn(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=$A(s,a,e+1/3),this.g=$A(s,a,e),this.b=$A(s,a,e-1/3)}return Mn.colorSpaceToWorking(this,r),this}setStyle(e,n=Ds){function i(a){a!==void 0&&parseFloat(a)<1&&Gt("Color: Alpha component of "+e+" will be ignored.")}let r;if(r=/^(\w+)\(([^\)]*)\)/.exec(e)){let a;const s=r[1],o=r[2];switch(s){case"rgb":case"rgba":if(a=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))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(o))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(o))return i(a[4]),this.setHSL(parseFloat(a[1])/360,parseFloat(a[2])/100,parseFloat(a[3])/100,n);break;default:Gt("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);Gt("Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,n);return this}setColorName(e,n=Ds){const i=E9[e.toLowerCase()];return i!==void 0?this.setHex(i,n):Gt("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=ic(e.r),this.g=ic(e.g),this.b=ic(e.b),this}copyLinearToSRGB(e){return this.r=Ap(e.r),this.g=Ap(e.g),this.b=Ap(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Ds){return Mn.workingToColorSpace(Xr.copy(this),e),Math.round(pn(Xr.r*255,0,255))*65536+Math.round(pn(Xr.g*255,0,255))*256+Math.round(pn(Xr.b*255,0,255))}getHexString(e=Ds){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,n=Mn.workingColorSpace){Mn.workingToColorSpace(Xr.copy(this),n);const i=Xr.r,r=Xr.g,a=Xr.b,s=Math.max(i,r,a),o=Math.min(i,r,a);let l,c;const d=(o+s)/2;if(o===s)l=0,c=0;else{const f=s-o;switch(c=d<=.5?f/(s+o):f/(2-s-o),s){case i:l=(r-a)/f+(r<a?6:0);break;case r:l=(a-i)/f+2;break;case a:l=(i-r)/f+4;break}l/=6}return e.h=l,e.s=c,e.l=d,e}getRGB(e,n=Mn.workingColorSpace){return Mn.workingToColorSpace(Xr.copy(this),n),e.r=Xr.r,e.g=Xr.g,e.b=Xr.b,e}getStyle(e=Ds){Mn.workingToColorSpace(Xr.copy(this),e);const n=Xr.r,i=Xr.g,r=Xr.b;return e!==Ds?`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(au),this.setHSL(au.h+e,au.s+n,au.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(au),e.getHSL(Ly);const i=AA(au.h,Ly.h,n),r=AA(au.s,Ly.s,n),a=AA(au.l,Ly.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 vn;vn.NAMES=E9;let uue=0,pm=class extends Bf{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:uue++}),this.uuid=Px(),this.name="",this.type="Material",this.blending=Ep,this.side=Gu,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=wN,this.blendDst=MN,this.blendEquation=Vd,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new vn(0,0,0),this.blendAlpha=0,this.depthFunc=Up,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=Kj,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=Ah,this.stencilZFail=Ah,this.stencilZPass=Ah,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){Gt(`Material: parameter '${n}' has value of undefined.`);continue}const r=this[n];if(r===void 0){Gt(`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!==Ep&&(i.blending=this.blending),this.side!==Gu&&(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!==wN&&(i.blendSrc=this.blendSrc),this.blendDst!==MN&&(i.blendDst=this.blendDst),this.blendEquation!==Vd&&(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!==Up&&(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!==Kj&&(i.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(i.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(i.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==Ah&&(i.stencilFail=this.stencilFail),this.stencilZFail!==Ah&&(i.stencilZFail=this.stencilZFail),this.stencilZPass!==Ah&&(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 o in a){const l=a[o];delete l.metadata,s.push(l)}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++}},VP=class extends pm{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new vn(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 Wu,this.combine=kP,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 zi=new $e,Iy=new an;let due=0,Hs=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:due++}),this.name="",this.array=e,this.itemSize=n,this.count=e!==void 0?e.length/n:0,this.normalized=i,this.usage=Yj,this.updateRanges=[],this.gpuType=Yl,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++)Iy.fromBufferAttribute(this,n),Iy.applyMatrix3(e),this.setXY(n,Iy.x,Iy.y);else if(this.itemSize===3)for(let n=0,i=this.count;n<i;n++)zi.fromBufferAttribute(this,n),zi.applyMatrix3(e),this.setXYZ(n,zi.x,zi.y,zi.z);return this}applyMatrix4(e){for(let n=0,i=this.count;n<i;n++)zi.fromBufferAttribute(this,n),zi.applyMatrix4(e),this.setXYZ(n,zi.x,zi.y,zi.z);return this}applyNormalMatrix(e){for(let n=0,i=this.count;n<i;n++)zi.fromBufferAttribute(this,n),zi.applyNormalMatrix(e),this.setXYZ(n,zi.x,zi.y,zi.z);return this}transformDirection(e){for(let n=0,i=this.count;n<i;n++)zi.fromBufferAttribute(this,n),zi.transformDirection(e),this.setXYZ(n,zi.x,zi.y,zi.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=Eg(i,this.array)),i}setComponent(e,n,i){return this.normalized&&(i=Ra(i,this.array)),this.array[e*this.itemSize+n]=i,this}getX(e){let n=this.array[e*this.itemSize];return this.normalized&&(n=Eg(n,this.array)),n}setX(e,n){return this.normalized&&(n=Ra(n,this.array)),this.array[e*this.itemSize]=n,this}getY(e){let n=this.array[e*this.itemSize+1];return this.normalized&&(n=Eg(n,this.array)),n}setY(e,n){return this.normalized&&(n=Ra(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=Eg(n,this.array)),n}setZ(e,n){return this.normalized&&(n=Ra(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=Eg(n,this.array)),n}setW(e,n){return this.normalized&&(n=Ra(n,this.array)),this.array[e*this.itemSize+3]=n,this}setXY(e,n,i){return e*=this.itemSize,this.normalized&&(n=Ra(n,this.array),i=Ra(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=Ra(n,this.array),i=Ra(i,this.array),r=Ra(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=Ra(n,this.array),i=Ra(i,this.array),r=Ra(r,this.array),a=Ra(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!==Yj&&(e.usage=this.usage),e}},A9=class extends Hs{constructor(e,n,i){super(new Uint16Array(e),n,i)}},T9=class extends Hs{constructor(e,n,i){super(new Uint32Array(e),n,i)}},vo=class extends Hs{constructor(e,n,i){super(new Float32Array(e),n,i)}},fue=0;const ws=new qi,GA=new hs,Ih=new $e,Ja=new Ef,Rg=new Ef,vr=new $e;let ol=class C9 extends Bf{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:fue++}),this.uuid=Px(),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(x9(e)?T9:A9)(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 ln().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 ws.makeRotationFromQuaternion(e),this.applyMatrix4(ws),this}rotateX(e){return ws.makeRotationX(e),this.applyMatrix4(ws),this}rotateY(e){return ws.makeRotationY(e),this.applyMatrix4(ws),this}rotateZ(e){return ws.makeRotationZ(e),this.applyMatrix4(ws),this}translate(e,n,i){return ws.makeTranslation(e,n,i),this.applyMatrix4(ws),this}scale(e,n,i){return ws.makeScale(e,n,i),this.applyMatrix4(ws),this}lookAt(e){return GA.lookAt(e),GA.updateMatrix(),this.applyMatrix4(GA.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Ih).negate(),this.translate(Ih.x,Ih.y,Ih.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 vo(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&&Gt("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 Ef);const e=this.attributes.position,n=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){Di("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new $e(-1/0,-1/0,-1/0),new $e(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];Ja.setFromBufferAttribute(a),this.morphTargetsRelative?(vr.addVectors(this.boundingBox.min,Ja.min),this.boundingBox.expandByPoint(vr),vr.addVectors(this.boundingBox.max,Ja.max),this.boundingBox.expandByPoint(vr)):(this.boundingBox.expandByPoint(Ja.min),this.boundingBox.expandByPoint(Ja.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&Di('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 GS);const e=this.attributes.position,n=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){Di("BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new $e,1/0);return}if(e){const i=this.boundingSphere.center;if(Ja.setFromBufferAttribute(e),n)for(let a=0,s=n.length;a<s;a++){const o=n[a];Rg.setFromBufferAttribute(o),this.morphTargetsRelative?(vr.addVectors(Ja.min,Rg.min),Ja.expandByPoint(vr),vr.addVectors(Ja.max,Rg.max),Ja.expandByPoint(vr)):(Ja.expandByPoint(Rg.min),Ja.expandByPoint(Rg.max))}Ja.getCenter(i);let r=0;for(let a=0,s=e.count;a<s;a++)vr.fromBufferAttribute(e,a),r=Math.max(r,i.distanceToSquared(vr));if(n)for(let a=0,s=n.length;a<s;a++){const o=n[a],l=this.morphTargetsRelative;for(let c=0,d=o.count;c<d;c++)vr.fromBufferAttribute(o,c),l&&(Ih.fromBufferAttribute(e,c),vr.add(Ih)),r=Math.max(r,i.distanceToSquared(vr))}this.boundingSphere.radius=Math.sqrt(r),isNaN(this.boundingSphere.radius)&&Di('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){Di("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 Hs(new Float32Array(4*i.count),4));const s=this.getAttribute("tangent"),o=[],l=[];for(let U=0;U<i.count;U++)o[U]=new $e,l[U]=new $e;const c=new $e,d=new $e,f=new $e,m=new an,g=new an,y=new an,_=new $e,v=new $e;function x(U,N,D){c.fromBufferAttribute(i,U),d.fromBufferAttribute(i,N),f.fromBufferAttribute(i,D),m.fromBufferAttribute(a,U),g.fromBufferAttribute(a,N),y.fromBufferAttribute(a,D),d.sub(c),f.sub(c),g.sub(m),y.sub(m);const F=1/(g.x*y.y-y.x*g.y);isFinite(F)&&(_.copy(d).multiplyScalar(y.y).addScaledVector(f,-g.y).multiplyScalar(F),v.copy(f).multiplyScalar(g.x).addScaledVector(d,-y.x).multiplyScalar(F),o[U].add(_),o[N].add(_),o[D].add(_),l[U].add(v),l[N].add(v),l[D].add(v))}let M=this.groups;M.length===0&&(M=[{start:0,count:e.count}]);for(let U=0,N=M.length;U<N;++U){const D=M[U],F=D.start,I=D.count;for(let W=F,O=F+I;W<O;W+=3)x(e.getX(W+0),e.getX(W+1),e.getX(W+2))}const w=new $e,T=new $e,C=new $e,P=new $e;function A(U){C.fromBufferAttribute(r,U),P.copy(C);const N=o[U];w.copy(N),w.sub(C.multiplyScalar(C.dot(N))).normalize(),T.crossVectors(P,N);const F=T.dot(l[U])<0?-1:1;s.setXYZW(U,w.x,w.y,w.z,F)}for(let U=0,N=M.length;U<N;++U){const D=M[U],F=D.start,I=D.count;for(let W=F,O=F+I;W<O;W+=3)A(e.getX(W+0)),A(e.getX(W+1)),A(e.getX(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 Hs(new Float32Array(n.count*3),3),this.setAttribute("normal",i);else for(let m=0,g=i.count;m<g;m++)i.setXYZ(m,0,0,0);const r=new $e,a=new $e,s=new $e,o=new $e,l=new $e,c=new $e,d=new $e,f=new $e;if(e)for(let m=0,g=e.count;m<g;m+=3){const y=e.getX(m+0),_=e.getX(m+1),v=e.getX(m+2);r.fromBufferAttribute(n,y),a.fromBufferAttribute(n,_),s.fromBufferAttribute(n,v),d.subVectors(s,a),f.subVectors(r,a),d.cross(f),o.fromBufferAttribute(i,y),l.fromBufferAttribute(i,_),c.fromBufferAttribute(i,v),o.add(d),l.add(d),c.add(d),i.setXYZ(y,o.x,o.y,o.z),i.setXYZ(_,l.x,l.y,l.z),i.setXYZ(v,c.x,c.y,c.z)}else for(let m=0,g=n.count;m<g;m+=3)r.fromBufferAttribute(n,m+0),a.fromBufferAttribute(n,m+1),s.fromBufferAttribute(n,m+2),d.subVectors(s,a),f.subVectors(r,a),d.cross(f),i.setXYZ(m+0,d.x,d.y,d.z),i.setXYZ(m+1,d.x,d.y,d.z),i.setXYZ(m+2,d.x,d.y,d.z);this.normalizeNormals(),i.needsUpdate=!0}}normalizeNormals(){const e=this.attributes.normal;for(let n=0,i=e.count;n<i;n++)vr.fromBufferAttribute(e,n),vr.normalize(),e.setXYZ(n,vr.x,vr.y,vr.z)}toNonIndexed(){function e(o,l){const c=o.array,d=o.itemSize,f=o.normalized,m=new c.constructor(l.length*d);let g=0,y=0;for(let _=0,v=l.length;_<v;_++){o.isInterleavedBufferAttribute?g=l[_]*o.data.stride+o.offset:g=l[_]*d;for(let x=0;x<d;x++)m[y++]=c[g++]}return new Hs(m,d,f)}if(this.index===null)return Gt("BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const n=new C9,i=this.index.array,r=this.attributes;for(const o in r){const l=r[o],c=e(l,i);n.setAttribute(o,c)}const a=this.morphAttributes;for(const o in a){const l=[],c=a[o];for(let d=0,f=c.length;d<f;d++){const m=c[d],g=e(m,i);l.push(g)}n.morphAttributes[o]=l}n.morphTargetsRelative=this.morphTargetsRelative;const s=this.groups;for(let o=0,l=s.length;o<l;o++){const c=s[o];n.addGroup(c.start,c.count,c.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 l=this.parameters;for(const c in l)l[c]!==void 0&&(e[c]=l[c]);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 l in i){const c=i[l];e.data.attributes[l]=c.toJSON(e.data)}const r={};let a=!1;for(const l in this.morphAttributes){const c=this.morphAttributes[l],d=[];for(let f=0,m=c.length;f<m;f++){const g=c[f];d.push(g.toJSON(e.data))}d.length>0&&(r[l]=d,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 o=this.boundingSphere;return o!==null&&(e.data.boundingSphere=o.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 c in r){const d=r[c];this.setAttribute(c,d.clone(n))}const a=e.morphAttributes;for(const c in a){const d=[],f=a[c];for(let m=0,g=f.length;m<g;m++)d.push(f[m].clone(n));this.morphAttributes[c]=d}this.morphTargetsRelative=e.morphTargetsRelative;const s=e.groups;for(let c=0,d=s.length;c<d;c++){const f=s[c];this.addGroup(f.start,f.count,f.materialIndex)}const o=e.boundingBox;o!==null&&(this.boundingBox=o.clone());const l=e.boundingSphere;return l!==null&&(this.boundingSphere=l.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}};const dF=new qi,Nd=new HP,Uy=new GS,fF=new $e,jy=new $e,Fy=new $e,zy=new $e,WA=new $e,By=new $e,hF=new $e,Hy=new $e;let Jo=class extends hs{constructor(e=new ol,n=new VP){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 o=r[a].name||String(a);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=a}}}}getVertexPosition(e,n){const i=this.geometry,r=i.attributes.position,a=i.morphAttributes.position,s=i.morphTargetsRelative;n.fromBufferAttribute(r,e);const o=this.morphTargetInfluences;if(a&&o){By.set(0,0,0);for(let l=0,c=a.length;l<c;l++){const d=o[l],f=a[l];d!==0&&(WA.fromBufferAttribute(f,e),s?By.addScaledVector(WA,d):By.addScaledVector(WA.sub(n),d))}n.add(By)}return n}raycast(e,n){const i=this.geometry,r=this.material,a=this.matrixWorld;r!==void 0&&(i.boundingSphere===null&&i.computeBoundingSphere(),Uy.copy(i.boundingSphere),Uy.applyMatrix4(a),Nd.copy(e.ray).recast(e.near),!(Uy.containsPoint(Nd.origin)===!1&&(Nd.intersectSphere(Uy,fF)===null||Nd.origin.distanceToSquared(fF)>(e.far-e.near)**2))&&(dF.copy(a).invert(),Nd.copy(e.ray).applyMatrix4(dF),!(i.boundingBox!==null&&Nd.intersectsBox(i.boundingBox)===!1)&&this._computeIntersections(e,n,Nd)))}_computeIntersections(e,n,i){let r;const a=this.geometry,s=this.material,o=a.index,l=a.attributes.position,c=a.attributes.uv,d=a.attributes.uv1,f=a.attributes.normal,m=a.groups,g=a.drawRange;if(o!==null)if(Array.isArray(s))for(let y=0,_=m.length;y<_;y++){const v=m[y],x=s[v.materialIndex],M=Math.max(v.start,g.start),w=Math.min(o.count,Math.min(v.start+v.count,g.start+g.count));for(let T=M,C=w;T<C;T+=3){const P=o.getX(T),A=o.getX(T+1),U=o.getX(T+2);r=Vy(this,x,e,i,c,d,f,P,A,U),r&&(r.faceIndex=Math.floor(T/3),r.face.materialIndex=v.materialIndex,n.push(r))}}else{const y=Math.max(0,g.start),_=Math.min(o.count,g.start+g.count);for(let v=y,x=_;v<x;v+=3){const M=o.getX(v),w=o.getX(v+1),T=o.getX(v+2);r=Vy(this,s,e,i,c,d,f,M,w,T),r&&(r.faceIndex=Math.floor(v/3),n.push(r))}}else if(l!==void 0)if(Array.isArray(s))for(let y=0,_=m.length;y<_;y++){const v=m[y],x=s[v.materialIndex],M=Math.max(v.start,g.start),w=Math.min(l.count,Math.min(v.start+v.count,g.start+g.count));for(let T=M,C=w;T<C;T+=3){const P=T,A=T+1,U=T+2;r=Vy(this,x,e,i,c,d,f,P,A,U),r&&(r.faceIndex=Math.floor(T/3),r.face.materialIndex=v.materialIndex,n.push(r))}}else{const y=Math.max(0,g.start),_=Math.min(l.count,g.start+g.count);for(let v=y,x=_;v<x;v+=3){const M=v,w=v+1,T=v+2;r=Vy(this,s,e,i,c,d,f,M,w,T),r&&(r.faceIndex=Math.floor(v/3),n.push(r))}}}};function hue(t,e,n,i,r,a,s,o){let l;if(e.side===Ia?l=i.intersectTriangle(s,a,r,!0,o):l=i.intersectTriangle(r,a,s,e.side===Gu,o),l===null)return null;Hy.copy(o),Hy.applyMatrix4(t.matrixWorld);const c=n.ray.origin.distanceTo(Hy);return c<n.near||c>n.far?null:{distance:c,point:Hy.clone(),object:t}}function Vy(t,e,n,i,r,a,s,o,l,c){t.getVertexPosition(o,jy),t.getVertexPosition(l,Fy),t.getVertexPosition(c,zy);const d=hue(t,e,n,i,jy,Fy,zy,hF);if(d){const f=new $e;Ng.getBarycoord(hF,jy,Fy,zy,f),r&&(d.uv=Ng.getInterpolatedAttribute(r,o,l,c,f,new an)),a&&(d.uv1=Ng.getInterpolatedAttribute(a,o,l,c,f,new an)),s&&(d.normal=Ng.getInterpolatedAttribute(s,o,l,c,f,new $e),d.normal.dot(i.direction)>0&&d.normal.multiplyScalar(-1));const m={a:o,b:l,c,normal:new $e,materialIndex:0};Ng.getNormal(jy,Fy,zy,m.normal),d.face=m,d.barycoord=f}return d}let $P=class N9 extends ol{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 o=this;r=Math.floor(r),a=Math.floor(a),s=Math.floor(s);const l=[],c=[],d=[],f=[];let m=0,g=0;y("z","y","x",-1,-1,i,n,e,s,a,0),y("z","y","x",1,-1,i,n,-e,s,a,1),y("x","z","y",1,1,e,i,n,r,s,2),y("x","z","y",1,-1,e,i,-n,r,s,3),y("x","y","z",1,-1,e,n,i,r,a,4),y("x","y","z",-1,-1,e,n,-i,r,a,5),this.setIndex(l),this.setAttribute("position",new vo(c,3)),this.setAttribute("normal",new vo(d,3)),this.setAttribute("uv",new vo(f,2));function y(_,v,x,M,w,T,C,P,A,U,N){const D=T/A,F=C/U,I=T/2,W=C/2,O=P/2,B=A+1,H=U+1;let $=0,K=0;const Z=new $e;for(let se=0;se<H;se++){const V=se*F-W;for(let X=0;X<B;X++){const ae=X*D-I;Z[_]=ae*M,Z[v]=V*w,Z[x]=O,c.push(Z.x,Z.y,Z.z),Z[_]=0,Z[v]=0,Z[x]=P>0?1:-1,d.push(Z.x,Z.y,Z.z),f.push(X/A),f.push(1-se/U),$+=1}}for(let se=0;se<U;se++)for(let V=0;V<A;V++){const X=m+V+B*se,ae=m+V+B*(se+1),ce=m+(V+1)+B*(se+1),ge=m+(V+1)+B*se;l.push(X,ae,ge),l.push(ae,ce,ge),K+=6}o.addGroup(g,K,N),g+=K,m+=$}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new N9(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}};function Bp(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?(Gt("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 ca(t){const e={};for(let n=0;n<t.length;n++){const i=Bp(t[n]);for(const r in i)e[r]=i[r]}return e}function pue(t){const e=[];for(let n=0;n<t.length;n++)e.push(t[n].clone());return e}function R9(t){const e=t.getRenderTarget();return e===null?t.outputColorSpace:e.isXRRenderTarget===!0?e.texture.colorSpace:Mn.workingColorSpace}const mue={clone:Bp,merge:ca};var gue=`void main() {
  11. gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
  12. }`,xue=`void main() {
  13. gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
  14. }`;let pc=class extends pm{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=gue,this.fragmentShader=xue,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=Bp(e.uniforms),this.uniformsGroups=pue(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}},P9=class extends hs{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new qi,this.projectionMatrix=new qi,this.projectionMatrixInverse=new qi,this.coordinateSystem=$o,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 su=new $e,pF=new an,mF=new an;let Ls=class extends P9{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=u3*2*Math.atan(n),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(u_*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return u3*2*Math.atan(Math.tan(u_*.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){su.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(su.x,su.y).multiplyScalar(-e/su.z),su.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),i.set(su.x,su.y).multiplyScalar(-e/su.z)}getViewSize(e,n){return this.getViewBounds(e,pF,mF),n.subVectors(mF,pF)}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(u_*.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 l=s.fullWidth,c=s.fullHeight;a+=s.offsetX*r/l,n-=s.offsetY*i/c,r*=s.width/l,i*=s.height/c}const o=this.filmOffset;o!==0&&(a+=e*o/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 Uh=-90,jh=1;let vue=class extends hs{constructor(e,n,i){super(),this.type="CubeCamera",this.renderTarget=i,this.coordinateSystem=null,this.activeMipmapLevel=0;const r=new Ls(Uh,jh,e,n);r.layers=this.layers,this.add(r);const a=new Ls(Uh,jh,e,n);a.layers=this.layers,this.add(a);const s=new Ls(Uh,jh,e,n);s.layers=this.layers,this.add(s);const o=new Ls(Uh,jh,e,n);o.layers=this.layers,this.add(o);const l=new Ls(Uh,jh,e,n);l.layers=this.layers,this.add(l);const c=new Ls(Uh,jh,e,n);c.layers=this.layers,this.add(c)}updateCoordinateSystem(){const e=this.coordinateSystem,n=this.children.concat(),[i,r,a,s,o,l]=n;for(const c of n)this.remove(c);if(e===$o)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),o.up.set(0,1,0),o.lookAt(0,0,1),l.up.set(0,1,0),l.lookAt(0,0,-1);else if(e===z_)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),o.up.set(0,-1,0),o.lookAt(0,0,1),l.up.set(0,-1,0),l.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(const c of n)this.add(c),c.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,o,l,c,d]=this.children,f=e.getRenderTarget(),m=e.getActiveCubeFace(),g=e.getActiveMipmapLevel(),y=e.xr.enabled;e.xr.enabled=!1;const _=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,o),e.setRenderTarget(i,3,r),e.render(n,l),e.setRenderTarget(i,4,r),e.render(n,c),i.texture.generateMipmaps=_,e.setRenderTarget(i,5,r),e.render(n,d),e.setRenderTarget(f,m,g),e.xr.enabled=y,i.texture.needsPMREMUpdate=!0}},D9=class extends Eo{constructor(e=[],n=jp,i,r,a,s,o,l,c,d){super(e,n,i,r,a,s,o,l,c,d),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}},yue=class extends Mf{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 D9(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 $P(5,5,5),a=new pc({name:"CubemapFromEquirect",uniforms:Bp(i.uniforms),vertexShader:i.vertexShader,fragmentShader:i.fragmentShader,side:Ia,blending:nc});a.uniforms.tEquirect.value=n;const s=new Jo(r,a),o=n.minFilter;return n.minFilter===Yd&&(n.minFilter=zs),new vue(1,10,this).update(e,s),n.minFilter=o,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)}},Yg=class extends hs{constructor(){super(),this.isGroup=!0,this.type="Group"}};const bue={type:"move"};let qA=class{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Yg,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 Yg,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new $e,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new $e),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new Yg,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new $e,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new $e),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 o=this._targetRay,l=this._grip,c=this._hand;if(e&&n.session.visibilityState!=="visible-blurred"){if(c&&e.hand){s=!0;for(const _ of e.hand.values()){const v=n.getJointPose(_,i),x=this._getHandJoint(c,_);v!==null&&(x.matrix.fromArray(v.transform.matrix),x.matrix.decompose(x.position,x.rotation,x.scale),x.matrixWorldNeedsUpdate=!0,x.jointRadius=v.radius),x.visible=v!==null}const d=c.joints["index-finger-tip"],f=c.joints["thumb-tip"],m=d.position.distanceTo(f.position),g=.02,y=.005;c.inputState.pinching&&m>g+y?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&m<=g-y&&(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else l!==null&&e.gripSpace&&(a=n.getPose(e.gripSpace,i),a!==null&&(l.matrix.fromArray(a.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),l.matrixWorldNeedsUpdate=!0,a.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(a.linearVelocity)):l.hasLinearVelocity=!1,a.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(a.angularVelocity)):l.hasAngularVelocity=!1));o!==null&&(r=n.getPose(e.targetRaySpace,i),r===null&&a!==null&&(r=a),r!==null&&(o.matrix.fromArray(r.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,r.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(r.linearVelocity)):o.hasLinearVelocity=!1,r.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(r.angularVelocity)):o.hasAngularVelocity=!1,this.dispatchEvent(bue)))}return o!==null&&(o.visible=r!==null),l!==null&&(l.visible=a!==null),c!==null&&(c.visible=s!==null),this}_getHandJoint(e,n){if(e.joints[n.jointName]===void 0){const i=new Yg;i.matrixAutoUpdate=!1,i.visible=!1,e.joints[n.jointName]=i,e.add(i)}return e.joints[n.jointName]}},_ue=class extends hs{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 Wu,this.environmentIntensity=1,this.environmentRotation=new Wu,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}},Sue=class extends Eo{constructor(e=null,n=1,i=1,r,a,s,o,l,c=cs,d=cs,f,m){super(null,s,o,l,c,d,r,a,f,m),this.isDataTexture=!0,this.image={data:e,width:n,height:i},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}};const XA=new $e,wue=new $e,Mue=new ln;let gu=class{constructor(e=new $e(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=XA.subVectors(i,n).cross(wue.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(XA),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||Mue.getNormalMatrix(e),r=this.coplanarPoint(XA).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 Rd=new GS,Eue=new an(.5,.5),$y=new $e;let GP=class{constructor(e=new gu,n=new gu,i=new gu,r=new gu,a=new gu,s=new gu){this.planes=[e,n,i,r,a,s]}set(e,n,i,r,a,s){const o=this.planes;return o[0].copy(e),o[1].copy(n),o[2].copy(i),o[3].copy(r),o[4].copy(a),o[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=$o,i=!1){const r=this.planes,a=e.elements,s=a[0],o=a[1],l=a[2],c=a[3],d=a[4],f=a[5],m=a[6],g=a[7],y=a[8],_=a[9],v=a[10],x=a[11],M=a[12],w=a[13],T=a[14],C=a[15];if(r[0].setComponents(c-s,g-d,x-y,C-M).normalize(),r[1].setComponents(c+s,g+d,x+y,C+M).normalize(),r[2].setComponents(c+o,g+f,x+_,C+w).normalize(),r[3].setComponents(c-o,g-f,x-_,C-w).normalize(),i)r[4].setComponents(l,m,v,T).normalize(),r[5].setComponents(c-l,g-m,x-v,C-T).normalize();else if(r[4].setComponents(c-l,g-m,x-v,C-T).normalize(),n===$o)r[5].setComponents(c+l,g+m,x+v,C+T).normalize();else if(n===z_)r[5].setComponents(l,m,v,T).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(),Rd.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const n=e.geometry;n.boundingSphere===null&&n.computeBoundingSphere(),Rd.copy(n.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(Rd)}intersectsSprite(e){Rd.center.set(0,0,0);const n=Eue.distanceTo(e.center);return Rd.radius=.7071067811865476+n,Rd.applyMatrix4(e.matrixWorld),this.intersectsSphere(Rd)}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($y.x=r.normal.x>0?e.max.x:e.min.x,$y.y=r.normal.y>0?e.max.y:e.min.y,$y.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint($y)<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)}},k9=class extends pm{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new vn(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 H_=new $e,V_=new $e,gF=new qi,Pg=new HP,Gy=new GS,KA=new $e,xF=new $e;let Aue=class extends hs{constructor(e=new ol,n=new k9){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++)H_.fromBufferAttribute(n,r-1),V_.fromBufferAttribute(n,r),i[r]=i[r-1],i[r]+=H_.distanceTo(V_);e.setAttribute("lineDistance",new vo(i,1))}else Gt("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(),Gy.copy(i.boundingSphere),Gy.applyMatrix4(r),Gy.radius+=a,e.ray.intersectsSphere(Gy)===!1)return;gF.copy(r).invert(),Pg.copy(e.ray).applyMatrix4(gF);const o=a/((this.scale.x+this.scale.y+this.scale.z)/3),l=o*o,c=this.isLineSegments?2:1,d=i.index,m=i.attributes.position;if(d!==null){const g=Math.max(0,s.start),y=Math.min(d.count,s.start+s.count);for(let _=g,v=y-1;_<v;_+=c){const x=d.getX(_),M=d.getX(_+1),w=Wy(this,e,Pg,l,x,M,_);w&&n.push(w)}if(this.isLineLoop){const _=d.getX(y-1),v=d.getX(g),x=Wy(this,e,Pg,l,_,v,y-1);x&&n.push(x)}}else{const g=Math.max(0,s.start),y=Math.min(m.count,s.start+s.count);for(let _=g,v=y-1;_<v;_+=c){const x=Wy(this,e,Pg,l,_,_+1,_);x&&n.push(x)}if(this.isLineLoop){const _=Wy(this,e,Pg,l,y-1,g,y-1);_&&n.push(_)}}}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 o=r[a].name||String(a);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=a}}}}};function Wy(t,e,n,i,r,a,s){const o=t.geometry.attributes.position;if(H_.fromBufferAttribute(o,r),V_.fromBufferAttribute(o,a),n.distanceSqToSegment(H_,V_,KA,xF)>i)return;KA.applyMatrix4(t.matrixWorld);const c=e.ray.origin.distanceTo(KA);if(!(c<e.near||c>e.far))return{distance:c,point:xF.clone().applyMatrix4(t.matrixWorld),index:s,face:null,faceIndex:null,barycoord:null,object:t}}const vF=new $e,yF=new $e;let Tue=class extends Aue{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)vF.fromBufferAttribute(n,r),yF.fromBufferAttribute(n,r+1),i[r]=r===0?0:i[r-1],i[r+1]=i[r]+vF.distanceTo(yF);e.setAttribute("lineDistance",new vo(i,1))}else Gt("LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}},O9=class extends Eo{constructor(e,n,i=Sf,r,a,s,o=cs,l=cs,c,d=H0,f=1){if(d!==H0&&d!==V0)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");const m={width:e,height:n,depth:f};super(m,r,a,s,o,l,d,i,c),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.source=new BP(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 L9 extends Eo{constructor(e=null){super(),this.sourceTexture=e,this.isExternalTexture=!0}copy(e){return super.copy(e),this.sourceTexture=e.sourceTexture,this}}let WP=class I9 extends ol{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,o=Math.floor(i),l=Math.floor(r),c=o+1,d=l+1,f=e/o,m=n/l,g=[],y=[],_=[],v=[];for(let x=0;x<d;x++){const M=x*m-s;for(let w=0;w<c;w++){const T=w*f-a;y.push(T,-M,0),_.push(0,0,1),v.push(w/o),v.push(1-x/l)}}for(let x=0;x<l;x++)for(let M=0;M<o;M++){const w=M+c*x,T=M+c*(x+1),C=M+1+c*(x+1),P=M+1+c*x;g.push(w,T,P),g.push(T,C,P)}this.setIndex(g),this.setAttribute("position",new vo(y,3)),this.setAttribute("normal",new vo(_,3)),this.setAttribute("uv",new vo(v,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new I9(e.width,e.height,e.widthSegments,e.heightSegments)}};class Cue extends pm{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new vn(16777215),this.specular=new vn(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new vn(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=m9,this.normalScale=new an(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Wu,this.combine=kP,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 Nue=class extends pm{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=Uce,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}},Rue=class extends pm{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}},U9=class extends hs{constructor(e,n=1){super(),this.isLight=!0,this.type="Light",this.color=new vn(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 YA=new qi,bF=new $e,_F=new $e;let Pue=class{constructor(e){this.camera=e,this.intensity=1,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new an(512,512),this.mapType=Qo,this.map=null,this.mapPass=null,this.matrix=new qi,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new GP,this._frameExtents=new an(1,1),this._viewportCount=1,this._viewports=[new Vi(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const n=this.camera,i=this.matrix;bF.setFromMatrixPosition(e.matrixWorld),n.position.copy(bF),_F.setFromMatrixPosition(e.target.matrixWorld),n.lookAt(_F),n.updateMatrixWorld(),YA.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(YA,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(YA)}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}},j9=class extends P9{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,o=r+n,l=r-n;if(this.view!==null&&this.view.enabled){const c=(this.right-this.left)/this.view.fullWidth/this.zoom,d=(this.top-this.bottom)/this.view.fullHeight/this.zoom;a+=c*this.view.offsetX,s=a+c*this.view.width,o-=d*this.view.offsetY,l=o-d*this.view.height}this.projectionMatrix.makeOrthographic(a,s,o,l,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 Due extends Pue{constructor(){super(new j9(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class SF extends U9{constructor(e,n){super(e,n),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(hs.DEFAULT_UP),this.updateMatrix(),this.target=new hs,this.shadow=new Due}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}let kue=class extends U9{constructor(e,n){super(e,n),this.isAmbientLight=!0,this.type="AmbientLight"}},Oue=class extends Ls{constructor(e=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=e}},wF=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=pn(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(pn(n/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}};class Lue extends Tue{constructor(e=10,n=10,i=4473924,r=8947848){i=new vn(i),r=new vn(r);const a=n/2,s=e/n,o=e/2,l=[],c=[];for(let m=0,g=0,y=-o;m<=n;m++,y+=s){l.push(-o,0,y,o,0,y),l.push(y,0,-o,y,0,o);const _=m===a?i:r;_.toArray(c,g),g+=3,_.toArray(c,g),g+=3,_.toArray(c,g),g+=3,_.toArray(c,g),g+=3}const d=new ol;d.setAttribute("position",new vo(l,3)),d.setAttribute("color",new vo(c,3));const f=new k9({vertexColors:!0,toneMapped:!1});super(d,f),this.type="GridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}class Iue extends Bf{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){Gt("Controls: connect() now requires an element.");return}this.domElement!==null&&this.disconnect(),this.domElement=e}disconnect(){}dispose(){}update(){}}function MF(t,e,n,i){const r=Uue(i);switch(n){case f9:return t*e;case p9:return t*e/r.components*r.byteLength;case UP:return t*e/r.components*r.byteLength;case jP:return t*e*2/r.components*r.byteLength;case FP:return t*e*2/r.components*r.byteLength;case h9:return t*e*3/r.components*r.byteLength;case mo:return t*e*4/r.components*r.byteLength;case zP:return t*e*4/r.components*r.byteLength;case s_:case o_:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*8;case l_:case c_:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*16;case UN:case FN:return Math.max(t,16)*Math.max(e,8)/4;case IN:case jN:return Math.max(t,8)*Math.max(e,8)/2;case zN:case BN:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*8;case HN:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*16;case VN:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*16;case $N:return Math.floor((t+4)/5)*Math.floor((e+3)/4)*16;case GN:return Math.floor((t+4)/5)*Math.floor((e+4)/5)*16;case WN:return Math.floor((t+5)/6)*Math.floor((e+4)/5)*16;case qN:return Math.floor((t+5)/6)*Math.floor((e+5)/6)*16;case XN:return Math.floor((t+7)/8)*Math.floor((e+4)/5)*16;case KN:return Math.floor((t+7)/8)*Math.floor((e+5)/6)*16;case YN:return Math.floor((t+7)/8)*Math.floor((e+7)/8)*16;case ZN:return Math.floor((t+9)/10)*Math.floor((e+4)/5)*16;case QN:return Math.floor((t+9)/10)*Math.floor((e+5)/6)*16;case JN:return Math.floor((t+9)/10)*Math.floor((e+7)/8)*16;case e3:return Math.floor((t+9)/10)*Math.floor((e+9)/10)*16;case t3:return Math.floor((t+11)/12)*Math.floor((e+9)/10)*16;case n3:return Math.floor((t+11)/12)*Math.floor((e+11)/12)*16;case i3:case r3:case a3:return Math.ceil(t/4)*Math.ceil(e/4)*16;case s3:case o3:return Math.ceil(t/4)*Math.ceil(e/4)*8;case l3:case c3:return Math.ceil(t/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${n} format.`)}function Uue(t){switch(t){case Qo:case l9:return{byteLength:1,components:1};case z0:case c9:case hm:return{byteLength:2,components:1};case LP:case IP:return{byteLength:2,components:4};case Sf:case OP:case Yl:return{byteLength:4,components:1};case u9:case d9:return{byteLength:4,components:3}}throw new Error(`Unknown texture type ${t}.`)}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:DP}}));typeof window<"u"&&(window.__THREE__?Gt("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=DP);function F9(){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 jue(t){const e=new WeakMap;function n(o,l){const c=o.array,d=o.usage,f=c.byteLength,m=t.createBuffer();t.bindBuffer(l,m),t.bufferData(l,c,d),o.onUploadCallback();let g;if(c instanceof Float32Array)g=t.FLOAT;else if(typeof Float16Array<"u"&&c instanceof Float16Array)g=t.HALF_FLOAT;else if(c instanceof Uint16Array)o.isFloat16BufferAttribute?g=t.HALF_FLOAT:g=t.UNSIGNED_SHORT;else if(c instanceof Int16Array)g=t.SHORT;else if(c instanceof Uint32Array)g=t.UNSIGNED_INT;else if(c instanceof Int32Array)g=t.INT;else if(c instanceof Int8Array)g=t.BYTE;else if(c instanceof Uint8Array)g=t.UNSIGNED_BYTE;else if(c instanceof Uint8ClampedArray)g=t.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+c);return{buffer:m,type:g,bytesPerElement:c.BYTES_PER_ELEMENT,version:o.version,size:f}}function i(o,l,c){const d=l.array,f=l.updateRanges;if(t.bindBuffer(c,o),f.length===0)t.bufferSubData(c,0,d);else{f.sort((g,y)=>g.start-y.start);let m=0;for(let g=1;g<f.length;g++){const y=f[m],_=f[g];_.start<=y.start+y.count+1?y.count=Math.max(y.count,_.start+_.count-y.start):(++m,f[m]=_)}f.length=m+1;for(let g=0,y=f.length;g<y;g++){const _=f[g];t.bufferSubData(c,_.start*d.BYTES_PER_ELEMENT,d,_.start,_.count)}l.clearUpdateRanges()}l.onUploadCallback()}function r(o){return o.isInterleavedBufferAttribute&&(o=o.data),e.get(o)}function a(o){o.isInterleavedBufferAttribute&&(o=o.data);const l=e.get(o);l&&(t.deleteBuffer(l.buffer),e.delete(o))}function s(o,l){if(o.isInterleavedBufferAttribute&&(o=o.data),o.isGLBufferAttribute){const d=e.get(o);(!d||d.version<o.version)&&e.set(o,{buffer:o.buffer,type:o.type,bytesPerElement:o.elementSize,version:o.version});return}const c=e.get(o);if(c===void 0)e.set(o,n(o,l));else if(c.version<o.version){if(c.size!==o.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(c.buffer,o,l),c.version=o.version}}return{get:r,remove:a,update:s}}var Fue=`#ifdef USE_ALPHAHASH
  34. if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;
  35. #endif`,zue=`#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`,Bue=`#ifdef USE_ALPHAMAP
  71. diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;
  72. #endif`,Hue=`#ifdef USE_ALPHAMAP
  73. uniform sampler2D alphaMap;
  74. #endif`,Vue=`#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`,$ue=`#ifdef USE_ALPHATEST
  82. uniform float alphaTest;
  83. #endif`,Gue=`#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`,Wue=`#ifdef USE_AOMAP
  97. uniform sampler2D aoMap;
  98. uniform float aoMapIntensity;
  99. #endif`,que=`#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`,Xue=`#ifdef USE_BATCHING
  134. mat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) );
  135. #endif`,Kue=`vec3 transformed = vec3( position );
  136. #ifdef USE_ALPHAHASH
  137. vPosition = vec3( position );
  138. #endif`,Yue=`vec3 objectNormal = vec3( normal );
  139. #ifdef USE_TANGENT
  140. vec3 objectTangent = vec3( tangent.xyz );
  141. #endif`,Zue=`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`,Que=`#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`,Jue=`#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`,ede=`#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`,tde=`#if NUM_CLIPPING_PLANES > 0
  286. varying vec3 vClipPosition;
  287. uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];
  288. #endif`,nde=`#if NUM_CLIPPING_PLANES > 0
  289. varying vec3 vClipPosition;
  290. #endif`,ide=`#if NUM_CLIPPING_PLANES > 0
  291. vClipPosition = - mvPosition.xyz;
  292. #endif`,rde=`#if defined( USE_COLOR_ALPHA )
  293. diffuseColor *= vColor;
  294. #elif defined( USE_COLOR )
  295. diffuseColor.rgb *= vColor;
  296. #endif`,ade=`#if defined( USE_COLOR_ALPHA )
  297. varying vec4 vColor;
  298. #elif defined( USE_COLOR )
  299. varying vec3 vColor;
  300. #endif`,sde=`#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`,ode=`#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`,lde=`#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`,cde=`#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`,ude=`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`,dde=`#ifdef USE_DISPLACEMENTMAP
  508. uniform sampler2D displacementMap;
  509. uniform float displacementScale;
  510. uniform float displacementBias;
  511. #endif`,fde=`#ifdef USE_DISPLACEMENTMAP
  512. transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );
  513. #endif`,hde=`#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`,pde=`#ifdef USE_EMISSIVEMAP
  520. uniform sampler2D emissiveMap;
  521. #endif`,mde="gl_FragColor = linearToOutputTexel( gl_FragColor );",gde=`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. }`,xde=`#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`,vde=`#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`,yde=`#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`,bde=`#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`,_de=`#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`,Sde=`#ifdef USE_FOG
  606. vFogDepth = - mvPosition.z;
  607. #endif`,wde=`#ifdef USE_FOG
  608. varying float vFogDepth;
  609. #endif`,Mde=`#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`,Ede=`#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`,Ade=`#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. }`,Tde=`#ifdef USE_LIGHTMAP
  638. uniform sampler2D lightMap;
  639. uniform float lightMapIntensity;
  640. #endif`,Cde=`LambertMaterial material;
  641. material.diffuseColor = diffuseColor.rgb;
  642. material.specularStrength = specularStrength;`,Nde=`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`,Rde=`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`,Pde=`#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`,Dde=`ToonMaterial material;
  806. material.diffuseColor = diffuseColor.rgb;`,kde=`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`,Ode=`BlinnPhongMaterial material;
  819. material.diffuseColor = diffuseColor.rgb;
  820. material.specularColor = specular;
  821. material.specularShininess = shininess;
  822. material.specularStrength = specularStrength;`,Lde=`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`,Ide=`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`,Ude=`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. }`,jde=`
  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`,Fde=`#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`,zde=`#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`,Bde=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )
  1381. gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;
  1382. #endif`,Hde=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )
  1383. uniform float logDepthBufFC;
  1384. varying float vFragDepth;
  1385. varying float vIsPerspective;
  1386. #endif`,Vde=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER
  1387. varying float vFragDepth;
  1388. varying float vIsPerspective;
  1389. #endif`,$de=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER
  1390. vFragDepth = 1.0 + gl_Position.w;
  1391. vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );
  1392. #endif`,Gde=`#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`,Wde=`#ifdef USE_MAP
  1399. uniform sampler2D map;
  1400. #endif`,qde=`#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`,Xde=`#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`,Kde=`float metalnessFactor = metalness;
  1425. #ifdef USE_METALNESSMAP
  1426. vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );
  1427. metalnessFactor *= texelMetalness.b;
  1428. #endif`,Yde=`#ifdef USE_METALNESSMAP
  1429. uniform sampler2D metalnessMap;
  1430. #endif`,Zde=`#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`,Qde=`#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`,Jde=`#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`,efe=`#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`,tfe=`#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`,nfe=`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;`,ife=`#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`,rfe=`#ifndef FLAT_SHADED
  1526. varying vec3 vNormal;
  1527. #ifdef USE_TANGENT
  1528. varying vec3 vTangent;
  1529. varying vec3 vBitangent;
  1530. #endif
  1531. #endif`,afe=`#ifndef FLAT_SHADED
  1532. varying vec3 vNormal;
  1533. #ifdef USE_TANGENT
  1534. varying vec3 vTangent;
  1535. varying vec3 vBitangent;
  1536. #endif
  1537. #endif`,sfe=`#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`,ofe=`#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`,lfe=`#ifdef USE_CLEARCOAT
  1566. vec3 clearcoatNormal = nonPerturbedNormal;
  1567. #endif`,cfe=`#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`,ufe=`#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`,dfe=`#ifdef USE_IRIDESCENCEMAP
  1581. uniform sampler2D iridescenceMap;
  1582. #endif
  1583. #ifdef USE_IRIDESCENCE_THICKNESSMAP
  1584. uniform sampler2D iridescenceThicknessMap;
  1585. #endif`,ffe=`#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 );`,hfe=`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. }`,pfe=`#ifdef PREMULTIPLIED_ALPHA
  1661. gl_FragColor.rgb *= gl_FragColor.a;
  1662. #endif`,mfe=`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;`,gfe=`#ifdef DITHERING
  1671. gl_FragColor.rgb = dithering( gl_FragColor.rgb );
  1672. #endif`,xfe=`#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`,vfe=`float roughnessFactor = roughness;
  1680. #ifdef USE_ROUGHNESSMAP
  1681. vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );
  1682. roughnessFactor *= texelRoughness.g;
  1683. #endif`,yfe=`#ifdef USE_ROUGHNESSMAP
  1684. uniform sampler2D roughnessMap;
  1685. #endif`,bfe=`#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`,_fe=`#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`,Sfe=`#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`,wfe=`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. }`,Mfe=`#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`,Efe=`#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`,Afe=`#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`,Tfe=`#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`,Cfe=`float specularStrength;
  2024. #ifdef USE_SPECULARMAP
  2025. vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );
  2026. specularStrength = texelSpecular.r;
  2027. #else
  2028. specularStrength = 1.0;
  2029. #endif`,Nfe=`#ifdef USE_SPECULARMAP
  2030. uniform sampler2D specularMap;
  2031. #endif`,Rfe=`#if defined( TONE_MAPPING )
  2032. gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );
  2033. #endif`,Pfe=`#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; }`,Dfe=`#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`,kfe=`#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`,Ofe=`#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`,Lfe=`#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`,Ife=`#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`,Ufe=`#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 jfe=`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. }`,Ffe=`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. }`,zfe=`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. }`,Bfe=`#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. }`,Hfe=`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. }`,Vfe=`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. }`,$fe=`#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. }`,Gfe=`#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. }`,Wfe=`#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. }`,qfe=`#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. }`,Xfe=`varying vec3 vWorldDirection;
  2702. #include <common>
  2703. void main() {
  2704. vWorldDirection = transformDirection( position, modelMatrix );
  2705. #include <begin_vertex>
  2706. #include <project_vertex>
  2707. }`,Kfe=`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. }`,Yfe=`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. }`,Zfe=`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. }`,Qfe=`#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. }`,Jfe=`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. }`,ehe=`#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. }`,the=`#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. }`,nhe=`#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. }`,ihe=`#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. }`,rhe=`#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. }`,ahe=`#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. }`,she=`#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. }`,ohe=`#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. }`,lhe=`#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. }`,che=`#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. }`,uhe=`#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. }`,dhe=`#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. }`,fhe=`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. }`,hhe=`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. }`,phe=`#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. }`,mhe=`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. }`,ghe=`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. }`,xhe=`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. }`,nn={alphahash_fragment:Fue,alphahash_pars_fragment:zue,alphamap_fragment:Bue,alphamap_pars_fragment:Hue,alphatest_fragment:Vue,alphatest_pars_fragment:$ue,aomap_fragment:Gue,aomap_pars_fragment:Wue,batching_pars_vertex:que,batching_vertex:Xue,begin_vertex:Kue,beginnormal_vertex:Yue,bsdfs:Zue,iridescence_fragment:Que,bumpmap_pars_fragment:Jue,clipping_planes_fragment:ede,clipping_planes_pars_fragment:tde,clipping_planes_pars_vertex:nde,clipping_planes_vertex:ide,color_fragment:rde,color_pars_fragment:ade,color_pars_vertex:sde,color_vertex:ode,common:lde,cube_uv_reflection_fragment:cde,defaultnormal_vertex:ude,displacementmap_pars_vertex:dde,displacementmap_vertex:fde,emissivemap_fragment:hde,emissivemap_pars_fragment:pde,colorspace_fragment:mde,colorspace_pars_fragment:gde,envmap_fragment:xde,envmap_common_pars_fragment:vde,envmap_pars_fragment:yde,envmap_pars_vertex:bde,envmap_physical_pars_fragment:Pde,envmap_vertex:_de,fog_vertex:Sde,fog_pars_vertex:wde,fog_fragment:Mde,fog_pars_fragment:Ede,gradientmap_pars_fragment:Ade,lightmap_pars_fragment:Tde,lights_lambert_fragment:Cde,lights_lambert_pars_fragment:Nde,lights_pars_begin:Rde,lights_toon_fragment:Dde,lights_toon_pars_fragment:kde,lights_phong_fragment:Ode,lights_phong_pars_fragment:Lde,lights_physical_fragment:Ide,lights_physical_pars_fragment:Ude,lights_fragment_begin:jde,lights_fragment_maps:Fde,lights_fragment_end:zde,logdepthbuf_fragment:Bde,logdepthbuf_pars_fragment:Hde,logdepthbuf_pars_vertex:Vde,logdepthbuf_vertex:$de,map_fragment:Gde,map_pars_fragment:Wde,map_particle_fragment:qde,map_particle_pars_fragment:Xde,metalnessmap_fragment:Kde,metalnessmap_pars_fragment:Yde,morphinstance_vertex:Zde,morphcolor_vertex:Qde,morphnormal_vertex:Jde,morphtarget_pars_vertex:efe,morphtarget_vertex:tfe,normal_fragment_begin:nfe,normal_fragment_maps:ife,normal_pars_fragment:rfe,normal_pars_vertex:afe,normal_vertex:sfe,normalmap_pars_fragment:ofe,clearcoat_normal_fragment_begin:lfe,clearcoat_normal_fragment_maps:cfe,clearcoat_pars_fragment:ufe,iridescence_pars_fragment:dfe,opaque_fragment:ffe,packing:hfe,premultiplied_alpha_fragment:pfe,project_vertex:mfe,dithering_fragment:gfe,dithering_pars_fragment:xfe,roughnessmap_fragment:vfe,roughnessmap_pars_fragment:yfe,shadowmap_pars_fragment:bfe,shadowmap_pars_vertex:_fe,shadowmap_vertex:Sfe,shadowmask_pars_fragment:wfe,skinbase_vertex:Mfe,skinning_pars_vertex:Efe,skinning_vertex:Afe,skinnormal_vertex:Tfe,specularmap_fragment:Cfe,specularmap_pars_fragment:Nfe,tonemapping_fragment:Rfe,tonemapping_pars_fragment:Pfe,transmission_fragment:Dfe,transmission_pars_fragment:kfe,uv_pars_fragment:Ofe,uv_pars_vertex:Lfe,uv_vertex:Ife,worldpos_vertex:Ufe,background_vert:jfe,background_frag:Ffe,backgroundCube_vert:zfe,backgroundCube_frag:Bfe,cube_vert:Hfe,cube_frag:Vfe,depth_vert:$fe,depth_frag:Gfe,distanceRGBA_vert:Wfe,distanceRGBA_frag:qfe,equirect_vert:Xfe,equirect_frag:Kfe,linedashed_vert:Yfe,linedashed_frag:Zfe,meshbasic_vert:Qfe,meshbasic_frag:Jfe,meshlambert_vert:ehe,meshlambert_frag:the,meshmatcap_vert:nhe,meshmatcap_frag:ihe,meshnormal_vert:rhe,meshnormal_frag:ahe,meshphong_vert:she,meshphong_frag:ohe,meshphysical_vert:lhe,meshphysical_frag:che,meshtoon_vert:uhe,meshtoon_frag:dhe,points_vert:fhe,points_frag:hhe,shadow_vert:phe,shadow_frag:mhe,sprite_vert:ghe,sprite_frag:xhe},St={common:{diffuse:{value:new vn(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new ln},alphaMap:{value:null},alphaMapTransform:{value:new ln},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new ln}},envmap:{envMap:{value:null},envMapRotation:{value:new ln},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 ln}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new ln}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new ln},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new ln},normalScale:{value:new an(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new ln},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new ln}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new ln}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new ln}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new vn(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 vn(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new ln},alphaTest:{value:0},uvTransform:{value:new ln}},sprite:{diffuse:{value:new vn(16777215)},opacity:{value:1},center:{value:new an(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new ln},alphaMap:{value:null},alphaMapTransform:{value:new ln},alphaTest:{value:0}}},zo={basic:{uniforms:ca([St.common,St.specularmap,St.envmap,St.aomap,St.lightmap,St.fog]),vertexShader:nn.meshbasic_vert,fragmentShader:nn.meshbasic_frag},lambert:{uniforms:ca([St.common,St.specularmap,St.envmap,St.aomap,St.lightmap,St.emissivemap,St.bumpmap,St.normalmap,St.displacementmap,St.fog,St.lights,{emissive:{value:new vn(0)}}]),vertexShader:nn.meshlambert_vert,fragmentShader:nn.meshlambert_frag},phong:{uniforms:ca([St.common,St.specularmap,St.envmap,St.aomap,St.lightmap,St.emissivemap,St.bumpmap,St.normalmap,St.displacementmap,St.fog,St.lights,{emissive:{value:new vn(0)},specular:{value:new vn(1118481)},shininess:{value:30}}]),vertexShader:nn.meshphong_vert,fragmentShader:nn.meshphong_frag},standard:{uniforms:ca([St.common,St.envmap,St.aomap,St.lightmap,St.emissivemap,St.bumpmap,St.normalmap,St.displacementmap,St.roughnessmap,St.metalnessmap,St.fog,St.lights,{emissive:{value:new vn(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:nn.meshphysical_vert,fragmentShader:nn.meshphysical_frag},toon:{uniforms:ca([St.common,St.aomap,St.lightmap,St.emissivemap,St.bumpmap,St.normalmap,St.displacementmap,St.gradientmap,St.fog,St.lights,{emissive:{value:new vn(0)}}]),vertexShader:nn.meshtoon_vert,fragmentShader:nn.meshtoon_frag},matcap:{uniforms:ca([St.common,St.bumpmap,St.normalmap,St.displacementmap,St.fog,{matcap:{value:null}}]),vertexShader:nn.meshmatcap_vert,fragmentShader:nn.meshmatcap_frag},points:{uniforms:ca([St.points,St.fog]),vertexShader:nn.points_vert,fragmentShader:nn.points_frag},dashed:{uniforms:ca([St.common,St.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:nn.linedashed_vert,fragmentShader:nn.linedashed_frag},depth:{uniforms:ca([St.common,St.displacementmap]),vertexShader:nn.depth_vert,fragmentShader:nn.depth_frag},normal:{uniforms:ca([St.common,St.bumpmap,St.normalmap,St.displacementmap,{opacity:{value:1}}]),vertexShader:nn.meshnormal_vert,fragmentShader:nn.meshnormal_frag},sprite:{uniforms:ca([St.sprite,St.fog]),vertexShader:nn.sprite_vert,fragmentShader:nn.sprite_frag},background:{uniforms:{uvTransform:{value:new ln},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:nn.background_vert,fragmentShader:nn.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new ln}},vertexShader:nn.backgroundCube_vert,fragmentShader:nn.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:nn.cube_vert,fragmentShader:nn.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:nn.equirect_vert,fragmentShader:nn.equirect_frag},distanceRGBA:{uniforms:ca([St.common,St.displacementmap,{referencePosition:{value:new $e},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:nn.distanceRGBA_vert,fragmentShader:nn.distanceRGBA_frag},shadow:{uniforms:ca([St.lights,St.fog,{color:{value:new vn(0)},opacity:{value:1}}]),vertexShader:nn.shadow_vert,fragmentShader:nn.shadow_frag}};zo.physical={uniforms:ca([zo.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new ln},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new ln},clearcoatNormalScale:{value:new an(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new ln},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new ln},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new ln},sheen:{value:0},sheenColor:{value:new vn(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new ln},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new ln},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new ln},transmissionSamplerSize:{value:new an},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new ln},attenuationDistance:{value:0},attenuationColor:{value:new vn(0)},specularColor:{value:new vn(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new ln},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new ln},anisotropyVector:{value:new an},anisotropyMap:{value:null},anisotropyMapTransform:{value:new ln}}]),vertexShader:nn.meshphysical_vert,fragmentShader:nn.meshphysical_frag};const qy={r:0,b:0,g:0},Pd=new Wu,vhe=new qi;function yhe(t,e,n,i,r,a,s){const o=new vn(0);let l=a===!0?0:1,c,d,f=null,m=0,g=null;function y(w){let T=w.isScene===!0?w.background:null;return T&&T.isTexture&&(T=(w.backgroundBlurriness>0?n:e).get(T)),T}function _(w){let T=!1;const C=y(w);C===null?x(o,l):C&&C.isColor&&(x(C,1),T=!0);const P=t.xr.getEnvironmentBlendMode();P==="additive"?i.buffers.color.setClear(0,0,0,1,s):P==="alpha-blend"&&i.buffers.color.setClear(0,0,0,0,s),(t.autoClear||T)&&(i.buffers.depth.setTest(!0),i.buffers.depth.setMask(!0),i.buffers.color.setMask(!0),t.clear(t.autoClearColor,t.autoClearDepth,t.autoClearStencil))}function v(w,T){const C=y(T);C&&(C.isCubeTexture||C.mapping===$S)?(d===void 0&&(d=new Jo(new $P(1,1,1),new pc({name:"BackgroundCubeMaterial",uniforms:Bp(zo.backgroundCube.uniforms),vertexShader:zo.backgroundCube.vertexShader,fragmentShader:zo.backgroundCube.fragmentShader,side:Ia,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),d.geometry.deleteAttribute("normal"),d.geometry.deleteAttribute("uv"),d.onBeforeRender=function(P,A,U){this.matrixWorld.copyPosition(U.matrixWorld)},Object.defineProperty(d.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),r.update(d)),Pd.copy(T.backgroundRotation),Pd.x*=-1,Pd.y*=-1,Pd.z*=-1,C.isCubeTexture&&C.isRenderTargetTexture===!1&&(Pd.y*=-1,Pd.z*=-1),d.material.uniforms.envMap.value=C,d.material.uniforms.flipEnvMap.value=C.isCubeTexture&&C.isRenderTargetTexture===!1?-1:1,d.material.uniforms.backgroundBlurriness.value=T.backgroundBlurriness,d.material.uniforms.backgroundIntensity.value=T.backgroundIntensity,d.material.uniforms.backgroundRotation.value.setFromMatrix4(vhe.makeRotationFromEuler(Pd)),d.material.toneMapped=Mn.getTransfer(C.colorSpace)!==zn,(f!==C||m!==C.version||g!==t.toneMapping)&&(d.material.needsUpdate=!0,f=C,m=C.version,g=t.toneMapping),d.layers.enableAll(),w.unshift(d,d.geometry,d.material,0,0,null)):C&&C.isTexture&&(c===void 0&&(c=new Jo(new WP(2,2),new pc({name:"BackgroundMaterial",uniforms:Bp(zo.background.uniforms),vertexShader:zo.background.vertexShader,fragmentShader:zo.background.fragmentShader,side:Gu,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),c.geometry.deleteAttribute("normal"),Object.defineProperty(c.material,"map",{get:function(){return this.uniforms.t2D.value}}),r.update(c)),c.material.uniforms.t2D.value=C,c.material.uniforms.backgroundIntensity.value=T.backgroundIntensity,c.material.toneMapped=Mn.getTransfer(C.colorSpace)!==zn,C.matrixAutoUpdate===!0&&C.updateMatrix(),c.material.uniforms.uvTransform.value.copy(C.matrix),(f!==C||m!==C.version||g!==t.toneMapping)&&(c.material.needsUpdate=!0,f=C,m=C.version,g=t.toneMapping),c.layers.enableAll(),w.unshift(c,c.geometry,c.material,0,0,null))}function x(w,T){w.getRGB(qy,R9(t)),i.buffers.color.setClear(qy.r,qy.g,qy.b,T,s)}function M(){d!==void 0&&(d.geometry.dispose(),d.material.dispose(),d=void 0),c!==void 0&&(c.geometry.dispose(),c.material.dispose(),c=void 0)}return{getClearColor:function(){return o},setClearColor:function(w,T=1){o.set(w),l=T,x(o,l)},getClearAlpha:function(){return l},setClearAlpha:function(w){l=w,x(o,l)},render:_,addToRenderList:v,dispose:M}}function bhe(t,e){const n=t.getParameter(t.MAX_VERTEX_ATTRIBS),i={},r=m(null);let a=r,s=!1;function o(D,F,I,W,O){let B=!1;const H=f(W,I,F);a!==H&&(a=H,c(a.object)),B=g(D,W,I,O),B&&y(D,W,I,O),O!==null&&e.update(O,t.ELEMENT_ARRAY_BUFFER),(B||s)&&(s=!1,T(D,F,I,W),O!==null&&t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,e.get(O).buffer))}function l(){return t.createVertexArray()}function c(D){return t.bindVertexArray(D)}function d(D){return t.deleteVertexArray(D)}function f(D,F,I){const W=I.wireframe===!0;let O=i[D.id];O===void 0&&(O={},i[D.id]=O);let B=O[F.id];B===void 0&&(B={},O[F.id]=B);let H=B[W];return H===void 0&&(H=m(l()),B[W]=H),H}function m(D){const F=[],I=[],W=[];for(let O=0;O<n;O++)F[O]=0,I[O]=0,W[O]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:F,enabledAttributes:I,attributeDivisors:W,object:D,attributes:{},index:null}}function g(D,F,I,W){const O=a.attributes,B=F.attributes;let H=0;const $=I.getAttributes();for(const K in $)if($[K].location>=0){const se=O[K];let V=B[K];if(V===void 0&&(K==="instanceMatrix"&&D.instanceMatrix&&(V=D.instanceMatrix),K==="instanceColor"&&D.instanceColor&&(V=D.instanceColor)),se===void 0||se.attribute!==V||V&&se.data!==V.data)return!0;H++}return a.attributesNum!==H||a.index!==W}function y(D,F,I,W){const O={},B=F.attributes;let H=0;const $=I.getAttributes();for(const K in $)if($[K].location>=0){let se=B[K];se===void 0&&(K==="instanceMatrix"&&D.instanceMatrix&&(se=D.instanceMatrix),K==="instanceColor"&&D.instanceColor&&(se=D.instanceColor));const V={};V.attribute=se,se&&se.data&&(V.data=se.data),O[K]=V,H++}a.attributes=O,a.attributesNum=H,a.index=W}function _(){const D=a.newAttributes;for(let F=0,I=D.length;F<I;F++)D[F]=0}function v(D){x(D,0)}function x(D,F){const I=a.newAttributes,W=a.enabledAttributes,O=a.attributeDivisors;I[D]=1,W[D]===0&&(t.enableVertexAttribArray(D),W[D]=1),O[D]!==F&&(t.vertexAttribDivisor(D,F),O[D]=F)}function M(){const D=a.newAttributes,F=a.enabledAttributes;for(let I=0,W=F.length;I<W;I++)F[I]!==D[I]&&(t.disableVertexAttribArray(I),F[I]=0)}function w(D,F,I,W,O,B,H){H===!0?t.vertexAttribIPointer(D,F,I,O,B):t.vertexAttribPointer(D,F,I,W,O,B)}function T(D,F,I,W){_();const O=W.attributes,B=I.getAttributes(),H=F.defaultAttributeValues;for(const $ in B){const K=B[$];if(K.location>=0){let Z=O[$];if(Z===void 0&&($==="instanceMatrix"&&D.instanceMatrix&&(Z=D.instanceMatrix),$==="instanceColor"&&D.instanceColor&&(Z=D.instanceColor)),Z!==void 0){const se=Z.normalized,V=Z.itemSize,X=e.get(Z);if(X===void 0)continue;const ae=X.buffer,ce=X.type,ge=X.bytesPerElement,ne=ce===t.INT||ce===t.UNSIGNED_INT||Z.gpuType===OP;if(Z.isInterleavedBufferAttribute){const ve=Z.data,Pe=ve.stride,he=Z.offset;if(ve.isInstancedInterleavedBuffer){for(let we=0;we<K.locationSize;we++)x(K.location+we,ve.meshPerAttribute);D.isInstancedMesh!==!0&&W._maxInstanceCount===void 0&&(W._maxInstanceCount=ve.meshPerAttribute*ve.count)}else for(let we=0;we<K.locationSize;we++)v(K.location+we);t.bindBuffer(t.ARRAY_BUFFER,ae);for(let we=0;we<K.locationSize;we++)w(K.location+we,V/K.locationSize,ce,se,Pe*ge,(he+V/K.locationSize*we)*ge,ne)}else{if(Z.isInstancedBufferAttribute){for(let ve=0;ve<K.locationSize;ve++)x(K.location+ve,Z.meshPerAttribute);D.isInstancedMesh!==!0&&W._maxInstanceCount===void 0&&(W._maxInstanceCount=Z.meshPerAttribute*Z.count)}else for(let ve=0;ve<K.locationSize;ve++)v(K.location+ve);t.bindBuffer(t.ARRAY_BUFFER,ae);for(let ve=0;ve<K.locationSize;ve++)w(K.location+ve,V/K.locationSize,ce,se,V*ge,V/K.locationSize*ve*ge,ne)}}else if(H!==void 0){const se=H[$];if(se!==void 0)switch(se.length){case 2:t.vertexAttrib2fv(K.location,se);break;case 3:t.vertexAttrib3fv(K.location,se);break;case 4:t.vertexAttrib4fv(K.location,se);break;default:t.vertexAttrib1fv(K.location,se)}}}}M()}function C(){U();for(const D in i){const F=i[D];for(const I in F){const W=F[I];for(const O in W)d(W[O].object),delete W[O];delete F[I]}delete i[D]}}function P(D){if(i[D.id]===void 0)return;const F=i[D.id];for(const I in F){const W=F[I];for(const O in W)d(W[O].object),delete W[O];delete F[I]}delete i[D.id]}function A(D){for(const F in i){const I=i[F];if(I[D.id]===void 0)continue;const W=I[D.id];for(const O in W)d(W[O].object),delete W[O];delete I[D.id]}}function U(){N(),s=!0,a!==r&&(a=r,c(a.object))}function N(){r.geometry=null,r.program=null,r.wireframe=!1}return{setup:o,reset:U,resetDefaultState:N,dispose:C,releaseStatesOfGeometry:P,releaseStatesOfProgram:A,initAttributes:_,enableAttribute:v,disableUnusedAttributes:M}}function _he(t,e,n){let i;function r(c){i=c}function a(c,d){t.drawArrays(i,c,d),n.update(d,i,1)}function s(c,d,f){f!==0&&(t.drawArraysInstanced(i,c,d,f),n.update(d,i,f))}function o(c,d,f){if(f===0)return;e.get("WEBGL_multi_draw").multiDrawArraysWEBGL(i,c,0,d,0,f);let g=0;for(let y=0;y<f;y++)g+=d[y];n.update(g,i,1)}function l(c,d,f,m){if(f===0)return;const g=e.get("WEBGL_multi_draw");if(g===null)for(let y=0;y<c.length;y++)s(c[y],d[y],m[y]);else{g.multiDrawArraysInstancedWEBGL(i,c,0,d,0,m,0,f);let y=0;for(let _=0;_<f;_++)y+=d[_]*m[_];n.update(y,i,1)}}this.setMode=r,this.render=a,this.renderInstances=s,this.renderMultiDraw=o,this.renderMultiDrawInstances=l}function She(t,e,n,i){let r;function a(){if(r!==void 0)return r;if(e.has("EXT_texture_filter_anisotropic")===!0){const A=e.get("EXT_texture_filter_anisotropic");r=t.getParameter(A.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else r=0;return r}function s(A){return!(A!==mo&&i.convert(A)!==t.getParameter(t.IMPLEMENTATION_COLOR_READ_FORMAT))}function o(A){const U=A===hm&&(e.has("EXT_color_buffer_half_float")||e.has("EXT_color_buffer_float"));return!(A!==Qo&&i.convert(A)!==t.getParameter(t.IMPLEMENTATION_COLOR_READ_TYPE)&&A!==Yl&&!U)}function l(A){if(A==="highp"){if(t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.HIGH_FLOAT).precision>0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.HIGH_FLOAT).precision>0)return"highp";A="mediump"}return A==="mediump"&&t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.MEDIUM_FLOAT).precision>0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let c=n.precision!==void 0?n.precision:"highp";const d=l(c);d!==c&&(Gt("WebGLRenderer:",c,"not supported, using",d,"instead."),c=d);const f=n.logarithmicDepthBuffer===!0,m=n.reversedDepthBuffer===!0&&e.has("EXT_clip_control"),g=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),y=t.getParameter(t.MAX_VERTEX_TEXTURE_IMAGE_UNITS),_=t.getParameter(t.MAX_TEXTURE_SIZE),v=t.getParameter(t.MAX_CUBE_MAP_TEXTURE_SIZE),x=t.getParameter(t.MAX_VERTEX_ATTRIBS),M=t.getParameter(t.MAX_VERTEX_UNIFORM_VECTORS),w=t.getParameter(t.MAX_VARYING_VECTORS),T=t.getParameter(t.MAX_FRAGMENT_UNIFORM_VECTORS),C=y>0,P=t.getParameter(t.MAX_SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:a,getMaxPrecision:l,textureFormatReadable:s,textureTypeReadable:o,precision:c,logarithmicDepthBuffer:f,reversedDepthBuffer:m,maxTextures:g,maxVertexTextures:y,maxTextureSize:_,maxCubemapSize:v,maxAttributes:x,maxVertexUniforms:M,maxVaryings:w,maxFragmentUniforms:T,vertexTextures:C,maxSamples:P}}function whe(t){const e=this;let n=null,i=0,r=!1,a=!1;const s=new gu,o=new ln,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(f,m){const g=f.length!==0||m||i!==0||r;return r=m,i=f.length,g},this.beginShadows=function(){a=!0,d(null)},this.endShadows=function(){a=!1},this.setGlobalState=function(f,m){n=d(f,m,0)},this.setState=function(f,m,g){const y=f.clippingPlanes,_=f.clipIntersection,v=f.clipShadows,x=t.get(f);if(!r||y===null||y.length===0||a&&!v)a?d(null):c();else{const M=a?0:i,w=M*4;let T=x.clippingState||null;l.value=T,T=d(y,m,w,g);for(let C=0;C!==w;++C)T[C]=n[C];x.clippingState=T,this.numIntersection=_?this.numPlanes:0,this.numPlanes+=M}};function c(){l.value!==n&&(l.value=n,l.needsUpdate=i>0),e.numPlanes=i,e.numIntersection=0}function d(f,m,g,y){const _=f!==null?f.length:0;let v=null;if(_!==0){if(v=l.value,y!==!0||v===null){const x=g+_*4,M=m.matrixWorldInverse;o.getNormalMatrix(M),(v===null||v.length<x)&&(v=new Float32Array(x));for(let w=0,T=g;w!==_;++w,T+=4)s.copy(f[w]).applyMatrix4(M,o),s.normal.toArray(v,T),v[T+3]=s.constant}l.value=v,l.needsUpdate=!0}return e.numPlanes=_,e.numIntersection=0,v}}function Mhe(t){let e=new WeakMap;function n(s,o){return o===DN?s.mapping=jp:o===kN&&(s.mapping=Fp),s}function i(s){if(s&&s.isTexture){const o=s.mapping;if(o===DN||o===kN)if(e.has(s)){const l=e.get(s).texture;return n(l,s.mapping)}else{const l=s.image;if(l&&l.height>0){const c=new yue(l.height);return c.fromEquirectangularTexture(t,s),e.set(s,c),s.addEventListener("dispose",r),n(c.texture,s.mapping)}else return null}}return s}function r(s){const o=s.target;o.removeEventListener("dispose",r);const l=e.get(o);l!==void 0&&(e.delete(o),l.dispose())}function a(){e=new WeakMap}return{get:i,dispose:a}}const Cu=4,EF=[.125,.215,.35,.446,.526,.582],$d=20,Ehe=256,Dg=new j9,AF=new vn;let ZA=null,QA=0,JA=0,eT=!1;const Ahe=new $e;let TF=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:o=Ahe}=a;ZA=this._renderer.getRenderTarget(),QA=this._renderer.getActiveCubeFace(),JA=this._renderer.getActiveMipmapLevel(),eT=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(s);const l=this._allocateTargets();return l.depthBuffer=!0,this._sceneToCubeUV(e,i,r,l,o),n>0&&this._blur(l,0,0,n),this._applyPMREM(l),this._cleanup(l),l}fromEquirectangular(e,n=null){return this._fromTexture(e,n)}fromCubemap(e,n=null){return this._fromTexture(e,n)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=RF(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=NF(),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(ZA,QA,JA),this._renderer.xr.enabled=eT,e.scissorTest=!1,Fh(e,0,0,e.width,e.height)}_fromTexture(e,n){e.mapping===jp||e.mapping===Fp?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),ZA=this._renderer.getRenderTarget(),QA=this._renderer.getActiveCubeFace(),JA=this._renderer.getActiveMipmapLevel(),eT=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:zs,minFilter:zs,generateMipmaps:!1,type:hm,format:mo,colorSpace:zp,depthBuffer:!1},r=CF(e,n,i);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==n){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=CF(e,n,i);const{_lodMax:a}=this;({lodMeshes:this._lodMeshes,sizeLods:this._sizeLods,sigmas:this._sigmas}=The(a)),this._blurMaterial=Nhe(a,e,n),this._ggxMaterial=Che(a,e,n)}return r}_compileMaterial(e){const n=new Jo(new ol,e);this._renderer.compile(n,Dg)}_sceneToCubeUV(e,n,i,r,a){const l=new Ls(90,1,n,i),c=[1,-1,1,1,1,1],d=[1,1,1,-1,-1,-1],f=this._renderer,m=f.autoClear,g=f.toneMapping;f.getClearColor(AF),f.toneMapping=Lu,f.autoClear=!1,f.state.buffers.depth.getReversed()&&(f.setRenderTarget(r),f.clearDepth(),f.setRenderTarget(null)),this._backgroundBox===null&&(this._backgroundBox=new Jo(new $P,new VP({name:"PMREM.Background",side:Ia,depthWrite:!1,depthTest:!1})));const _=this._backgroundBox,v=_.material;let x=!1;const M=e.background;M?M.isColor&&(v.color.copy(M),e.background=null,x=!0):(v.color.copy(AF),x=!0);for(let w=0;w<6;w++){const T=w%3;T===0?(l.up.set(0,c[w],0),l.position.set(a.x,a.y,a.z),l.lookAt(a.x+d[w],a.y,a.z)):T===1?(l.up.set(0,0,c[w]),l.position.set(a.x,a.y,a.z),l.lookAt(a.x,a.y+d[w],a.z)):(l.up.set(0,c[w],0),l.position.set(a.x,a.y,a.z),l.lookAt(a.x,a.y,a.z+d[w]));const C=this._cubeSize;Fh(r,T*C,w>2?C:0,C,C),f.setRenderTarget(r),x&&f.render(_,l),f.render(e,l)}f.toneMapping=g,f.autoClear=m,e.background=M}_textureToCubeUV(e,n){const i=this._renderer,r=e.mapping===jp||e.mapping===Fp;r?(this._cubemapMaterial===null&&(this._cubemapMaterial=RF()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=NF());const a=r?this._cubemapMaterial:this._equirectMaterial,s=this._lodMeshes[0];s.material=a;const o=a.uniforms;o.envMap.value=e;const l=this._cubeSize;Fh(n,0,0,3*l,2*l),i.setRenderTarget(n),i.render(s,Dg)}_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,o=this._lodMeshes[i];o.material=s;const l=s.uniforms,c=i/(this._lodMeshes.length-1),d=n/(this._lodMeshes.length-1),f=Math.sqrt(c*c-d*d),m=.05+c*.95,g=f*m,{_lodMax:y}=this,_=this._sizeLods[i],v=3*_*(i>y-Cu?i-y+Cu:0),x=4*(this._cubeSize-_);l.envMap.value=e.texture,l.roughness.value=g,l.mipInt.value=y-n,Fh(a,v,x,3*_,2*_),r.setRenderTarget(a),r.render(o,Dg),l.envMap.value=a.texture,l.roughness.value=0,l.mipInt.value=y-i,Fh(e,v,x,3*_,2*_),r.setRenderTarget(e),r.render(o,Dg)}_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,o){const l=this._renderer,c=this._blurMaterial;s!=="latitudinal"&&s!=="longitudinal"&&Di("blur direction must be either latitudinal or longitudinal!");const d=3,f=this._lodMeshes[r];f.material=c;const m=c.uniforms,g=this._sizeLods[i]-1,y=isFinite(a)?Math.PI/(2*g):2*Math.PI/(2*$d-1),_=a/y,v=isFinite(a)?1+Math.floor(d*_):$d;v>$d&&Gt(`sigmaRadians, ${a}, is too large and will clip, as it requested ${v} samples when the maximum is set to ${$d}`);const x=[];let M=0;for(let A=0;A<$d;++A){const U=A/_,N=Math.exp(-U*U/2);x.push(N),A===0?M+=N:A<v&&(M+=2*N)}for(let A=0;A<x.length;A++)x[A]=x[A]/M;m.envMap.value=e.texture,m.samples.value=v,m.weights.value=x,m.latitudinal.value=s==="latitudinal",o&&(m.poleAxis.value=o);const{_lodMax:w}=this;m.dTheta.value=y,m.mipInt.value=w-i;const T=this._sizeLods[r],C=3*T*(r>w-Cu?r-w+Cu:0),P=4*(this._cubeSize-T);Fh(n,C,P,3*T,2*T),l.setRenderTarget(n),l.render(f,Dg)}};function The(t){const e=[],n=[],i=[];let r=t;const a=t-Cu+1+EF.length;for(let s=0;s<a;s++){const o=Math.pow(2,r);e.push(o);let l=1/o;s>t-Cu?l=EF[s-t+Cu-1]:s===0&&(l=0),n.push(l);const c=1/(o-2),d=-c,f=1+c,m=[d,d,f,d,f,f,d,d,f,f,d,f],g=6,y=6,_=3,v=2,x=1,M=new Float32Array(_*y*g),w=new Float32Array(v*y*g),T=new Float32Array(x*y*g);for(let P=0;P<g;P++){const A=P%3*2/3-1,U=P>2?0:-1,N=[A,U,0,A+2/3,U,0,A+2/3,U+1,0,A,U,0,A+2/3,U+1,0,A,U+1,0];M.set(N,_*y*P),w.set(m,v*y*P);const D=[P,P,P,P,P,P];T.set(D,x*y*P)}const C=new ol;C.setAttribute("position",new Hs(M,_)),C.setAttribute("uv",new Hs(w,v)),C.setAttribute("faceIndex",new Hs(T,x)),i.push(new Jo(C,null)),r>Cu&&r--}return{lodMeshes:i,sizeLods:e,sigmas:n}}function CF(t,e,n){const i=new Mf(t,e,n);return i.texture.mapping=$S,i.texture.name="PMREM.cubeUv",i.scissorTest=!0,i}function Fh(t,e,n,i,r){t.viewport.set(e,n,i,r),t.scissor.set(e,n,i,r)}function Che(t,e,n){return new pc({name:"PMREMGGXConvolution",defines:{GGX_SAMPLES:Ehe,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:WS(),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:nc,depthTest:!1,depthWrite:!1})}function Nhe(t,e,n){const i=new Float32Array($d),r=new $e(0,1,0);return new pc({name:"SphericalGaussianBlur",defines:{n:$d,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:WS(),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:nc,depthTest:!1,depthWrite:!1})}function NF(){return new pc({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:WS(),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:nc,depthTest:!1,depthWrite:!1})}function RF(){return new pc({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:WS(),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:nc,depthTest:!1,depthWrite:!1})}function WS(){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 Rhe(t){let e=new WeakMap,n=null;function i(o){if(o&&o.isTexture){const l=o.mapping,c=l===DN||l===kN,d=l===jp||l===Fp;if(c||d){let f=e.get(o);const m=f!==void 0?f.texture.pmremVersion:0;if(o.isRenderTargetTexture&&o.pmremVersion!==m)return n===null&&(n=new TF(t)),f=c?n.fromEquirectangular(o,f):n.fromCubemap(o,f),f.texture.pmremVersion=o.pmremVersion,e.set(o,f),f.texture;if(f!==void 0)return f.texture;{const g=o.image;return c&&g&&g.height>0||d&&g&&r(g)?(n===null&&(n=new TF(t)),f=c?n.fromEquirectangular(o):n.fromCubemap(o),f.texture.pmremVersion=o.pmremVersion,e.set(o,f),o.addEventListener("dispose",a),f.texture):null}}}return o}function r(o){let l=0;const c=6;for(let d=0;d<c;d++)o[d]!==void 0&&l++;return l===c}function a(o){const l=o.target;l.removeEventListener("dispose",a);const c=e.get(l);c!==void 0&&(e.delete(l),c.dispose())}function s(){e=new WeakMap,n!==null&&(n.dispose(),n=null)}return{get:i,dispose:s}}function Phe(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&&$0("WebGLRenderer: "+i+" extension not supported."),r}}}function Dhe(t,e,n,i){const r={},a=new WeakMap;function s(f){const m=f.target;m.index!==null&&e.remove(m.index);for(const y in m.attributes)e.remove(m.attributes[y]);m.removeEventListener("dispose",s),delete r[m.id];const g=a.get(m);g&&(e.remove(g),a.delete(m)),i.releaseStatesOfGeometry(m),m.isInstancedBufferGeometry===!0&&delete m._maxInstanceCount,n.memory.geometries--}function o(f,m){return r[m.id]===!0||(m.addEventListener("dispose",s),r[m.id]=!0,n.memory.geometries++),m}function l(f){const m=f.attributes;for(const g in m)e.update(m[g],t.ARRAY_BUFFER)}function c(f){const m=[],g=f.index,y=f.attributes.position;let _=0;if(g!==null){const M=g.array;_=g.version;for(let w=0,T=M.length;w<T;w+=3){const C=M[w+0],P=M[w+1],A=M[w+2];m.push(C,P,P,A,A,C)}}else if(y!==void 0){const M=y.array;_=y.version;for(let w=0,T=M.length/3-1;w<T;w+=3){const C=w+0,P=w+1,A=w+2;m.push(C,P,P,A,A,C)}}else return;const v=new(x9(m)?T9:A9)(m,1);v.version=_;const x=a.get(f);x&&e.remove(x),a.set(f,v)}function d(f){const m=a.get(f);if(m){const g=f.index;g!==null&&m.version<g.version&&c(f)}else c(f);return a.get(f)}return{get:o,update:l,getWireframeAttribute:d}}function khe(t,e,n){let i;function r(m){i=m}let a,s;function o(m){a=m.type,s=m.bytesPerElement}function l(m,g){t.drawElements(i,g,a,m*s),n.update(g,i,1)}function c(m,g,y){y!==0&&(t.drawElementsInstanced(i,g,a,m*s,y),n.update(g,i,y))}function d(m,g,y){if(y===0)return;e.get("WEBGL_multi_draw").multiDrawElementsWEBGL(i,g,0,a,m,0,y);let v=0;for(let x=0;x<y;x++)v+=g[x];n.update(v,i,1)}function f(m,g,y,_){if(y===0)return;const v=e.get("WEBGL_multi_draw");if(v===null)for(let x=0;x<m.length;x++)c(m[x]/s,g[x],_[x]);else{v.multiDrawElementsInstancedWEBGL(i,g,0,a,m,0,_,0,y);let x=0;for(let M=0;M<y;M++)x+=g[M]*_[M];n.update(x,i,1)}}this.setMode=r,this.setIndex=o,this.render=l,this.renderInstances=c,this.renderMultiDraw=d,this.renderMultiDrawInstances=f}function Ohe(t){const e={geometries:0,textures:0},n={frame:0,calls:0,triangles:0,points:0,lines:0};function i(a,s,o){switch(n.calls++,s){case t.TRIANGLES:n.triangles+=o*(a/3);break;case t.LINES:n.lines+=o*(a/2);break;case t.LINE_STRIP:n.lines+=o*(a-1);break;case t.LINE_LOOP:n.lines+=o*a;break;case t.POINTS:n.points+=o*a;break;default:Di("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 Lhe(t,e,n){const i=new WeakMap,r=new Vi;function a(s,o,l){const c=s.morphTargetInfluences,d=o.morphAttributes.position||o.morphAttributes.normal||o.morphAttributes.color,f=d!==void 0?d.length:0;let m=i.get(o);if(m===void 0||m.count!==f){let D=function(){U.dispose(),i.delete(o),o.removeEventListener("dispose",D)};var g=D;m!==void 0&&m.texture.dispose();const y=o.morphAttributes.position!==void 0,_=o.morphAttributes.normal!==void 0,v=o.morphAttributes.color!==void 0,x=o.morphAttributes.position||[],M=o.morphAttributes.normal||[],w=o.morphAttributes.color||[];let T=0;y===!0&&(T=1),_===!0&&(T=2),v===!0&&(T=3);let C=o.attributes.position.count*T,P=1;C>e.maxTextureSize&&(P=Math.ceil(C/e.maxTextureSize),C=e.maxTextureSize);const A=new Float32Array(C*P*4*f),U=new S9(A,C,P,f);U.type=Yl,U.needsUpdate=!0;const N=T*4;for(let F=0;F<f;F++){const I=x[F],W=M[F],O=w[F],B=C*P*4*F;for(let H=0;H<I.count;H++){const $=H*N;y===!0&&(r.fromBufferAttribute(I,H),A[B+$+0]=r.x,A[B+$+1]=r.y,A[B+$+2]=r.z,A[B+$+3]=0),_===!0&&(r.fromBufferAttribute(W,H),A[B+$+4]=r.x,A[B+$+5]=r.y,A[B+$+6]=r.z,A[B+$+7]=0),v===!0&&(r.fromBufferAttribute(O,H),A[B+$+8]=r.x,A[B+$+9]=r.y,A[B+$+10]=r.z,A[B+$+11]=O.itemSize===4?r.w:1)}}m={count:f,texture:U,size:new an(C,P)},i.set(o,m),o.addEventListener("dispose",D)}if(s.isInstancedMesh===!0&&s.morphTexture!==null)l.getUniforms().setValue(t,"morphTexture",s.morphTexture,n);else{let y=0;for(let v=0;v<c.length;v++)y+=c[v];const _=o.morphTargetsRelative?1:1-y;l.getUniforms().setValue(t,"morphTargetBaseInfluence",_),l.getUniforms().setValue(t,"morphTargetInfluences",c)}l.getUniforms().setValue(t,"morphTargetsTexture",m.texture,n),l.getUniforms().setValue(t,"morphTargetsTextureSize",m.size)}return{update:a}}function Ihe(t,e,n,i){let r=new WeakMap;function a(l){const c=i.render.frame,d=l.geometry,f=e.get(l,d);if(r.get(f)!==c&&(e.update(f),r.set(f,c)),l.isInstancedMesh&&(l.hasEventListener("dispose",o)===!1&&l.addEventListener("dispose",o),r.get(l)!==c&&(n.update(l.instanceMatrix,t.ARRAY_BUFFER),l.instanceColor!==null&&n.update(l.instanceColor,t.ARRAY_BUFFER),r.set(l,c))),l.isSkinnedMesh){const m=l.skeleton;r.get(m)!==c&&(m.update(),r.set(m,c))}return f}function s(){r=new WeakMap}function o(l){const c=l.target;c.removeEventListener("dispose",o),n.remove(c.instanceMatrix),c.instanceColor!==null&&n.remove(c.instanceColor)}return{update:a,dispose:s}}const z9=new Eo,PF=new O9(1,1),B9=new S9,H9=new nue,V9=new D9,DF=[],kF=[],OF=new Float32Array(16),LF=new Float32Array(9),IF=new Float32Array(4);function mm(t,e,n){const i=t[0];if(i<=0||i>0)return t;const r=e*n;let a=DF[r];if(a===void 0&&(a=new Float32Array(r),DF[r]=a),e!==0){i.toArray(a,0);for(let s=1,o=0;s!==e;++s)o+=n,t[s].toArray(a,o)}return a}function rr(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 ar(t,e){for(let n=0,i=e.length;n<i;n++)t[n]=e[n]}function qS(t,e){let n=kF[e];n===void 0&&(n=new Int32Array(e),kF[e]=n);for(let i=0;i!==e;++i)n[i]=t.allocateTextureUnit();return n}function Uhe(t,e){const n=this.cache;n[0]!==e&&(t.uniform1f(this.addr,e),n[0]=e)}function jhe(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(rr(n,e))return;t.uniform2fv(this.addr,e),ar(n,e)}}function Fhe(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(rr(n,e))return;t.uniform3fv(this.addr,e),ar(n,e)}}function zhe(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(rr(n,e))return;t.uniform4fv(this.addr,e),ar(n,e)}}function Bhe(t,e){const n=this.cache,i=e.elements;if(i===void 0){if(rr(n,e))return;t.uniformMatrix2fv(this.addr,!1,e),ar(n,e)}else{if(rr(n,i))return;IF.set(i),t.uniformMatrix2fv(this.addr,!1,IF),ar(n,i)}}function Hhe(t,e){const n=this.cache,i=e.elements;if(i===void 0){if(rr(n,e))return;t.uniformMatrix3fv(this.addr,!1,e),ar(n,e)}else{if(rr(n,i))return;LF.set(i),t.uniformMatrix3fv(this.addr,!1,LF),ar(n,i)}}function Vhe(t,e){const n=this.cache,i=e.elements;if(i===void 0){if(rr(n,e))return;t.uniformMatrix4fv(this.addr,!1,e),ar(n,e)}else{if(rr(n,i))return;OF.set(i),t.uniformMatrix4fv(this.addr,!1,OF),ar(n,i)}}function $he(t,e){const n=this.cache;n[0]!==e&&(t.uniform1i(this.addr,e),n[0]=e)}function Ghe(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(rr(n,e))return;t.uniform2iv(this.addr,e),ar(n,e)}}function Whe(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(rr(n,e))return;t.uniform3iv(this.addr,e),ar(n,e)}}function qhe(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(rr(n,e))return;t.uniform4iv(this.addr,e),ar(n,e)}}function Xhe(t,e){const n=this.cache;n[0]!==e&&(t.uniform1ui(this.addr,e),n[0]=e)}function Khe(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(rr(n,e))return;t.uniform2uiv(this.addr,e),ar(n,e)}}function Yhe(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(rr(n,e))return;t.uniform3uiv(this.addr,e),ar(n,e)}}function Zhe(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(rr(n,e))return;t.uniform4uiv(this.addr,e),ar(n,e)}}function Qhe(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?(PF.compareFunction=g9,a=PF):a=z9,n.setTexture2D(e||a,r)}function Jhe(t,e,n){const i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(t.uniform1i(this.addr,r),i[0]=r),n.setTexture3D(e||H9,r)}function epe(t,e,n){const i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(t.uniform1i(this.addr,r),i[0]=r),n.setTextureCube(e||V9,r)}function tpe(t,e,n){const i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(t.uniform1i(this.addr,r),i[0]=r),n.setTexture2DArray(e||B9,r)}function npe(t){switch(t){case 5126:return Uhe;case 35664:return jhe;case 35665:return Fhe;case 35666:return zhe;case 35674:return Bhe;case 35675:return Hhe;case 35676:return Vhe;case 5124:case 35670:return $he;case 35667:case 35671:return Ghe;case 35668:case 35672:return Whe;case 35669:case 35673:return qhe;case 5125:return Xhe;case 36294:return Khe;case 36295:return Yhe;case 36296:return Zhe;case 35678:case 36198:case 36298:case 36306:case 35682:return Qhe;case 35679:case 36299:case 36307:return Jhe;case 35680:case 36300:case 36308:case 36293:return epe;case 36289:case 36303:case 36311:case 36292:return tpe}}function ipe(t,e){t.uniform1fv(this.addr,e)}function rpe(t,e){const n=mm(e,this.size,2);t.uniform2fv(this.addr,n)}function ape(t,e){const n=mm(e,this.size,3);t.uniform3fv(this.addr,n)}function spe(t,e){const n=mm(e,this.size,4);t.uniform4fv(this.addr,n)}function ope(t,e){const n=mm(e,this.size,4);t.uniformMatrix2fv(this.addr,!1,n)}function lpe(t,e){const n=mm(e,this.size,9);t.uniformMatrix3fv(this.addr,!1,n)}function cpe(t,e){const n=mm(e,this.size,16);t.uniformMatrix4fv(this.addr,!1,n)}function upe(t,e){t.uniform1iv(this.addr,e)}function dpe(t,e){t.uniform2iv(this.addr,e)}function fpe(t,e){t.uniform3iv(this.addr,e)}function hpe(t,e){t.uniform4iv(this.addr,e)}function ppe(t,e){t.uniform1uiv(this.addr,e)}function mpe(t,e){t.uniform2uiv(this.addr,e)}function gpe(t,e){t.uniform3uiv(this.addr,e)}function xpe(t,e){t.uniform4uiv(this.addr,e)}function vpe(t,e,n){const i=this.cache,r=e.length,a=qS(n,r);rr(i,a)||(t.uniform1iv(this.addr,a),ar(i,a));for(let s=0;s!==r;++s)n.setTexture2D(e[s]||z9,a[s])}function ype(t,e,n){const i=this.cache,r=e.length,a=qS(n,r);rr(i,a)||(t.uniform1iv(this.addr,a),ar(i,a));for(let s=0;s!==r;++s)n.setTexture3D(e[s]||H9,a[s])}function bpe(t,e,n){const i=this.cache,r=e.length,a=qS(n,r);rr(i,a)||(t.uniform1iv(this.addr,a),ar(i,a));for(let s=0;s!==r;++s)n.setTextureCube(e[s]||V9,a[s])}function _pe(t,e,n){const i=this.cache,r=e.length,a=qS(n,r);rr(i,a)||(t.uniform1iv(this.addr,a),ar(i,a));for(let s=0;s!==r;++s)n.setTexture2DArray(e[s]||B9,a[s])}function Spe(t){switch(t){case 5126:return ipe;case 35664:return rpe;case 35665:return ape;case 35666:return spe;case 35674:return ope;case 35675:return lpe;case 35676:return cpe;case 5124:case 35670:return upe;case 35667:case 35671:return dpe;case 35668:case 35672:return fpe;case 35669:case 35673:return hpe;case 5125:return ppe;case 36294:return mpe;case 36295:return gpe;case 36296:return xpe;case 35678:case 36198:case 36298:case 36306:case 35682:return vpe;case 35679:case 36299:case 36307:return ype;case 35680:case 36300:case 36308:case 36293:return bpe;case 36289:case 36303:case 36311:case 36292:return _pe}}let wpe=class{constructor(e,n,i){this.id=e,this.addr=i,this.cache=[],this.type=n.type,this.setValue=npe(n.type)}},Mpe=class{constructor(e,n,i){this.id=e,this.addr=i,this.cache=[],this.type=n.type,this.size=n.size,this.setValue=Spe(n.type)}},Epe=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 o=r[a];o.setValue(e,n[o.id],i)}}};const tT=/(\w+)(\])?(\[|\.)?/g;function UF(t,e){t.seq.push(e),t.map[e.id]=e}function Ape(t,e,n){const i=t.name,r=i.length;for(tT.lastIndex=0;;){const a=tT.exec(i),s=tT.lastIndex;let o=a[1];const l=a[2]==="]",c=a[3];if(l&&(o=o|0),c===void 0||c==="["&&s+2===r){UF(n,c===void 0?new wpe(o,t,e):new Mpe(o,t,e));break}else{let f=n.map[o];f===void 0&&(f=new Epe(o),UF(n,f)),n=f}}}let h_=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);Ape(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 o=n[a],l=i[o.id];l.needsUpdate!==!1&&o.setValue(e,l.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 jF(t,e,n){const i=t.createShader(e);return t.shaderSource(i,n),t.compileShader(i),i}const Tpe=37297;let Cpe=0;function Npe(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 o=s+1;i.push(`${o===e?">":" "} ${o}: ${n[s]}`)}return i.join(`
  3751. `)}const FF=new ln;function Rpe(t){Mn._getMatrix(FF,Mn.workingColorSpace,t);const e=`mat3( ${FF.elements.map(n=>n.toFixed(4))} )`;switch(Mn.getTransfer(t)){case F_:return[e,"LinearTransferOETF"];case zn:return[e,"sRGBTransferOETF"];default:return Gt("WebGLProgram: Unsupported color space: ",t),[e,"LinearTransferOETF"]}}function zF(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 o=parseInt(s[1]);return n.toUpperCase()+`
  3752. `+a+`
  3753. `+Npe(t.getShaderSource(e),o)}else return a}function Ppe(t,e){const n=Rpe(e);return[`vec4 ${t}( vec4 value ) {`,` return ${n[1]}( vec4( value.rgb * ${n[0]}, value.a ) );`,"}"].join(`
  3754. `)}function Dpe(t,e){let n;switch(e){case Nce:n="Linear";break;case Rce:n="Reinhard";break;case Pce:n="Cineon";break;case Dce:n="ACESFilmic";break;case Oce:n="AgX";break;case Lce:n="Neutral";break;case kce:n="Custom";break;default:Gt("WebGLProgram: Unsupported toneMapping:",e),n="Linear"}return"vec3 "+t+"( vec3 color ) { return "+n+"ToneMapping( color ); }"}const Xy=new $e;function kpe(){Mn.getLuminanceCoefficients(Xy);const t=Xy.x.toFixed(4),e=Xy.y.toFixed(4),n=Xy.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",` const vec3 weights = vec3( ${t}, ${e}, ${n} );`," return dot( weights, rgb );","}"].join(`
  3755. `)}function Ope(t){return[t.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",t.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(Zg).join(`
  3756. `)}function Lpe(t){const e=[];for(const n in t){const i=t[n];i!==!1&&e.push("#define "+n+" "+i)}return e.join(`
  3757. `)}function Ipe(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 o=1;a.type===t.FLOAT_MAT2&&(o=2),a.type===t.FLOAT_MAT3&&(o=3),a.type===t.FLOAT_MAT4&&(o=4),n[s]={type:a.type,location:t.getAttribLocation(e,s),locationSize:o}}return n}function Zg(t){return t!==""}function BF(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 HF(t,e){return t.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const Upe=/^[ \t]*#include +<([\w\d./]+)>/gm;function f3(t){return t.replace(Upe,Fpe)}const jpe=new Map;function Fpe(t,e){let n=nn[e];if(n===void 0){const i=jpe.get(e);if(i!==void 0)n=nn[i],Gt('WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,i);else throw new Error("Can not resolve #include <"+e+">")}return f3(n)}const zpe=/#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 VF(t){return t.replace(zpe,Bpe)}function Bpe(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 $F(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 Hpe(t){let e="SHADOWMAP_TYPE_BASIC";return t.shadowMapType===s9?e="SHADOWMAP_TYPE_PCF":t.shadowMapType===lce?e="SHADOWMAP_TYPE_PCF_SOFT":t.shadowMapType===zl&&(e="SHADOWMAP_TYPE_VSM"),e}function Vpe(t){let e="ENVMAP_TYPE_CUBE";if(t.envMap)switch(t.envMapMode){case jp:case Fp:e="ENVMAP_TYPE_CUBE";break;case $S:e="ENVMAP_TYPE_CUBE_UV";break}return e}function $pe(t){let e="ENVMAP_MODE_REFLECTION";if(t.envMap)switch(t.envMapMode){case Fp:e="ENVMAP_MODE_REFRACTION";break}return e}function Gpe(t){let e="ENVMAP_BLENDING_NONE";if(t.envMap)switch(t.combine){case kP:e="ENVMAP_BLENDING_MULTIPLY";break;case Tce:e="ENVMAP_BLENDING_MIX";break;case Cce:e="ENVMAP_BLENDING_ADD";break}return e}function Wpe(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 qpe(t,e,n,i){const r=t.getContext(),a=n.defines;let s=n.vertexShader,o=n.fragmentShader;const l=Hpe(n),c=Vpe(n),d=$pe(n),f=Gpe(n),m=Wpe(n),g=Ope(n),y=Lpe(a),_=r.createProgram();let v,x,M=n.glslVersion?"#version "+n.glslVersion+`
  3778. `:"";n.isRawShaderMaterial?(v=["#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,y].filter(Zg).join(`
  3779. `),v.length>0&&(v+=`
  3780. `),x=["#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,y].filter(Zg).join(`
  3781. `),x.length>0&&(x+=`
  3782. `)):(v=[$F(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,y,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 "+d:"",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 "+l:"",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(Zg).join(`
  3784. `),x=[$F(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,y,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 "+c:"",n.envMap?"#define "+d:"",n.envMap?"#define "+f:"",m?"#define CUBEUV_TEXEL_WIDTH "+m.texelWidth:"",m?"#define CUBEUV_TEXEL_HEIGHT "+m.texelHeight:"",m?"#define CUBEUV_MAX_MIP "+m.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 "+l:"",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!==Lu?"#define TONE_MAPPING":"",n.toneMapping!==Lu?nn.tonemapping_pars_fragment:"",n.toneMapping!==Lu?Dpe("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",n.opaque?"#define OPAQUE":"",nn.colorspace_pars_fragment,Ppe("linearToOutputTexel",n.outputColorSpace),kpe(),n.useDepthPacking?"#define DEPTH_PACKING "+n.depthPacking:"",`
  3785. `].filter(Zg).join(`
  3786. `)),s=f3(s),s=BF(s,n),s=HF(s,n),o=f3(o),o=BF(o,n),o=HF(o,n),s=VF(s),o=VF(o),n.isRawShaderMaterial!==!0&&(M=`#version 300 es
  3787. `,v=[g,"#define attribute in","#define varying out","#define texture2D texture"].join(`
  3788. `)+`
  3789. `+v,x=["#define varying in",n.glslVersion===Zj?"":"layout(location = 0) out highp vec4 pc_fragColor;",n.glslVersion===Zj?"":"#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. `+x);const w=M+v+s,T=M+x+o,C=jF(r,r.VERTEX_SHADER,w),P=jF(r,r.FRAGMENT_SHADER,T);r.attachShader(_,C),r.attachShader(_,P),n.index0AttributeName!==void 0?r.bindAttribLocation(_,0,n.index0AttributeName):n.morphTargets===!0&&r.bindAttribLocation(_,0,"position"),r.linkProgram(_);function A(F){if(t.debug.checkShaderErrors){const I=r.getProgramInfoLog(_)||"",W=r.getShaderInfoLog(C)||"",O=r.getShaderInfoLog(P)||"",B=I.trim(),H=W.trim(),$=O.trim();let K=!0,Z=!0;if(r.getProgramParameter(_,r.LINK_STATUS)===!1)if(K=!1,typeof t.debug.onShaderError=="function")t.debug.onShaderError(r,_,C,P);else{const se=zF(r,C,"vertex"),V=zF(r,P,"fragment");Di("THREE.WebGLProgram: Shader Error "+r.getError()+" - VALIDATE_STATUS "+r.getProgramParameter(_,r.VALIDATE_STATUS)+`
  3792. Material Name: `+F.name+`
  3793. Material Type: `+F.type+`
  3794. Program Info Log: `+B+`
  3795. `+se+`
  3796. `+V)}else B!==""?Gt("WebGLProgram: Program Info Log:",B):(H===""||$==="")&&(Z=!1);Z&&(F.diagnostics={runnable:K,programLog:B,vertexShader:{log:H,prefix:v},fragmentShader:{log:$,prefix:x}})}r.deleteShader(C),r.deleteShader(P),U=new h_(r,_),N=Ipe(r,_)}let U;this.getUniforms=function(){return U===void 0&&A(this),U};let N;this.getAttributes=function(){return N===void 0&&A(this),N};let D=n.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return D===!1&&(D=r.getProgramParameter(_,Tpe)),D},this.destroy=function(){i.releaseStatesOfProgram(this),r.deleteProgram(_),this.program=void 0},this.type=n.shaderType,this.name=n.shaderName,this.id=Cpe++,this.cacheKey=e,this.usedTimes=1,this.program=_,this.vertexShader=C,this.fragmentShader=P,this}let Xpe=0,Kpe=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 Ype(e),n.set(e,i)),i}},Ype=class{constructor(e){this.id=Xpe++,this.code=e,this.usedTimes=0}};function Zpe(t,e,n,i,r,a,s){const o=new M9,l=new Kpe,c=new Set,d=[],f=r.logarithmicDepthBuffer,m=r.vertexTextures;let g=r.precision;const y={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 _(N){return c.add(N),N===0?"uv":`uv${N}`}function v(N,D,F,I,W){const O=I.fog,B=W.geometry,H=N.isMeshStandardMaterial?I.environment:null,$=(N.isMeshStandardMaterial?n:e).get(N.envMap||H),K=$&&$.mapping===$S?$.image.height:null,Z=y[N.type];N.precision!==null&&(g=r.getMaxPrecision(N.precision),g!==N.precision&&Gt("WebGLProgram.getParameters:",N.precision,"not supported, using",g,"instead."));const se=B.morphAttributes.position||B.morphAttributes.normal||B.morphAttributes.color,V=se!==void 0?se.length:0;let X=0;B.morphAttributes.position!==void 0&&(X=1),B.morphAttributes.normal!==void 0&&(X=2),B.morphAttributes.color!==void 0&&(X=3);let ae,ce,ge,ne;if(Z){const Nt=zo[Z];ae=Nt.vertexShader,ce=Nt.fragmentShader}else ae=N.vertexShader,ce=N.fragmentShader,l.update(N),ge=l.getVertexShaderID(N),ne=l.getFragmentShaderID(N);const ve=t.getRenderTarget(),Pe=t.state.buffers.depth.getReversed(),he=W.isInstancedMesh===!0,we=W.isBatchedMesh===!0,je=!!N.map,ue=!!N.matcap,lt=!!$,z=!!N.aoMap,q=!!N.lightMap,re=!!N.bumpMap,J=!!N.normalMap,ee=!!N.displacementMap,oe=!!N.emissiveMap,De=!!N.metalnessMap,Ne=!!N.roughnessMap,te=N.anisotropy>0,j=N.clearcoat>0,L=N.dispersion>0,Y=N.iridescence>0,me=N.sheen>0,ye=N.transmission>0,pe=te&&!!N.anisotropyMap,Ze=j&&!!N.clearcoatMap,Le=j&&!!N.clearcoatNormalMap,qe=j&&!!N.clearcoatRoughnessMap,at=Y&&!!N.iridescenceMap,Ie=Y&&!!N.iridescenceThicknessMap,Re=me&&!!N.sheenColorMap,pt=me&&!!N.sheenRoughnessMap,nt=!!N.specularMap,tt=!!N.specularColorMap,ut=!!N.specularIntensityMap,de=ye&&!!N.transmissionMap,it=ye&&!!N.thicknessMap,fe=!!N.gradientMap,Oe=!!N.alphaMap,Me=N.alphaTest>0,xe=!!N.alphaHash,Be=!!N.extensions;let ct=Lu;N.toneMapped&&(ve===null||ve.isXRRenderTarget===!0)&&(ct=t.toneMapping);const bt={shaderID:Z,shaderType:N.type,shaderName:N.name,vertexShader:ae,fragmentShader:ce,defines:N.defines,customVertexShaderID:ge,customFragmentShaderID:ne,isRawShaderMaterial:N.isRawShaderMaterial===!0,glslVersion:N.glslVersion,precision:g,batching:we,batchingColor:we&&W._colorsTexture!==null,instancing:he,instancingColor:he&&W.instanceColor!==null,instancingMorph:he&&W.morphTexture!==null,supportsVertexTextures:m,outputColorSpace:ve===null?t.outputColorSpace:ve.isXRRenderTarget===!0?ve.texture.colorSpace:zp,alphaToCoverage:!!N.alphaToCoverage,map:je,matcap:ue,envMap:lt,envMapMode:lt&&$.mapping,envMapCubeUVHeight:K,aoMap:z,lightMap:q,bumpMap:re,normalMap:J,displacementMap:m&&ee,emissiveMap:oe,normalMapObjectSpace:J&&N.normalMapType===Fce,normalMapTangentSpace:J&&N.normalMapType===m9,metalnessMap:De,roughnessMap:Ne,anisotropy:te,anisotropyMap:pe,clearcoat:j,clearcoatMap:Ze,clearcoatNormalMap:Le,clearcoatRoughnessMap:qe,dispersion:L,iridescence:Y,iridescenceMap:at,iridescenceThicknessMap:Ie,sheen:me,sheenColorMap:Re,sheenRoughnessMap:pt,specularMap:nt,specularColorMap:tt,specularIntensityMap:ut,transmission:ye,transmissionMap:de,thicknessMap:it,gradientMap:fe,opaque:N.transparent===!1&&N.blending===Ep&&N.alphaToCoverage===!1,alphaMap:Oe,alphaTest:Me,alphaHash:xe,combine:N.combine,mapUv:je&&_(N.map.channel),aoMapUv:z&&_(N.aoMap.channel),lightMapUv:q&&_(N.lightMap.channel),bumpMapUv:re&&_(N.bumpMap.channel),normalMapUv:J&&_(N.normalMap.channel),displacementMapUv:ee&&_(N.displacementMap.channel),emissiveMapUv:oe&&_(N.emissiveMap.channel),metalnessMapUv:De&&_(N.metalnessMap.channel),roughnessMapUv:Ne&&_(N.roughnessMap.channel),anisotropyMapUv:pe&&_(N.anisotropyMap.channel),clearcoatMapUv:Ze&&_(N.clearcoatMap.channel),clearcoatNormalMapUv:Le&&_(N.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:qe&&_(N.clearcoatRoughnessMap.channel),iridescenceMapUv:at&&_(N.iridescenceMap.channel),iridescenceThicknessMapUv:Ie&&_(N.iridescenceThicknessMap.channel),sheenColorMapUv:Re&&_(N.sheenColorMap.channel),sheenRoughnessMapUv:pt&&_(N.sheenRoughnessMap.channel),specularMapUv:nt&&_(N.specularMap.channel),specularColorMapUv:tt&&_(N.specularColorMap.channel),specularIntensityMapUv:ut&&_(N.specularIntensityMap.channel),transmissionMapUv:de&&_(N.transmissionMap.channel),thicknessMapUv:it&&_(N.thicknessMap.channel),alphaMapUv:Oe&&_(N.alphaMap.channel),vertexTangents:!!B.attributes.tangent&&(J||te),vertexColors:N.vertexColors,vertexAlphas:N.vertexColors===!0&&!!B.attributes.color&&B.attributes.color.itemSize===4,pointsUvs:W.isPoints===!0&&!!B.attributes.uv&&(je||Oe),fog:!!O,useFog:N.fog===!0,fogExp2:!!O&&O.isFogExp2,flatShading:N.flatShading===!0&&N.wireframe===!1,sizeAttenuation:N.sizeAttenuation===!0,logarithmicDepthBuffer:f,reversedDepthBuffer:Pe,skinning:W.isSkinnedMesh===!0,morphTargets:B.morphAttributes.position!==void 0,morphNormals:B.morphAttributes.normal!==void 0,morphColors:B.morphAttributes.color!==void 0,morphTargetsCount:V,morphTextureStride:X,numDirLights:D.directional.length,numPointLights:D.point.length,numSpotLights:D.spot.length,numSpotLightMaps:D.spotLightMap.length,numRectAreaLights:D.rectArea.length,numHemiLights:D.hemi.length,numDirLightShadows:D.directionalShadowMap.length,numPointLightShadows:D.pointShadowMap.length,numSpotLightShadows:D.spotShadowMap.length,numSpotLightShadowsWithMaps:D.numSpotLightShadowsWithMaps,numLightProbes:D.numLightProbes,numClippingPlanes:s.numPlanes,numClipIntersection:s.numIntersection,dithering:N.dithering,shadowMapEnabled:t.shadowMap.enabled&&F.length>0,shadowMapType:t.shadowMap.type,toneMapping:ct,decodeVideoTexture:je&&N.map.isVideoTexture===!0&&Mn.getTransfer(N.map.colorSpace)===zn,decodeVideoTextureEmissive:oe&&N.emissiveMap.isVideoTexture===!0&&Mn.getTransfer(N.emissiveMap.colorSpace)===zn,premultipliedAlpha:N.premultipliedAlpha,doubleSided:N.side===Bo,flipSided:N.side===Ia,useDepthPacking:N.depthPacking>=0,depthPacking:N.depthPacking||0,index0AttributeName:N.index0AttributeName,extensionClipCullDistance:Be&&N.extensions.clipCullDistance===!0&&i.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(Be&&N.extensions.multiDraw===!0||we)&&i.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:i.has("KHR_parallel_shader_compile"),customProgramCacheKey:N.customProgramCacheKey()};return bt.vertexUv1s=c.has(1),bt.vertexUv2s=c.has(2),bt.vertexUv3s=c.has(3),c.clear(),bt}function x(N){const D=[];if(N.shaderID?D.push(N.shaderID):(D.push(N.customVertexShaderID),D.push(N.customFragmentShaderID)),N.defines!==void 0)for(const F in N.defines)D.push(F),D.push(N.defines[F]);return N.isRawShaderMaterial===!1&&(M(D,N),w(D,N),D.push(t.outputColorSpace)),D.push(N.customProgramCacheKey),D.join()}function M(N,D){N.push(D.precision),N.push(D.outputColorSpace),N.push(D.envMapMode),N.push(D.envMapCubeUVHeight),N.push(D.mapUv),N.push(D.alphaMapUv),N.push(D.lightMapUv),N.push(D.aoMapUv),N.push(D.bumpMapUv),N.push(D.normalMapUv),N.push(D.displacementMapUv),N.push(D.emissiveMapUv),N.push(D.metalnessMapUv),N.push(D.roughnessMapUv),N.push(D.anisotropyMapUv),N.push(D.clearcoatMapUv),N.push(D.clearcoatNormalMapUv),N.push(D.clearcoatRoughnessMapUv),N.push(D.iridescenceMapUv),N.push(D.iridescenceThicknessMapUv),N.push(D.sheenColorMapUv),N.push(D.sheenRoughnessMapUv),N.push(D.specularMapUv),N.push(D.specularColorMapUv),N.push(D.specularIntensityMapUv),N.push(D.transmissionMapUv),N.push(D.thicknessMapUv),N.push(D.combine),N.push(D.fogExp2),N.push(D.sizeAttenuation),N.push(D.morphTargetsCount),N.push(D.morphAttributeCount),N.push(D.numDirLights),N.push(D.numPointLights),N.push(D.numSpotLights),N.push(D.numSpotLightMaps),N.push(D.numHemiLights),N.push(D.numRectAreaLights),N.push(D.numDirLightShadows),N.push(D.numPointLightShadows),N.push(D.numSpotLightShadows),N.push(D.numSpotLightShadowsWithMaps),N.push(D.numLightProbes),N.push(D.shadowMapType),N.push(D.toneMapping),N.push(D.numClippingPlanes),N.push(D.numClipIntersection),N.push(D.depthPacking)}function w(N,D){o.disableAll(),D.supportsVertexTextures&&o.enable(0),D.instancing&&o.enable(1),D.instancingColor&&o.enable(2),D.instancingMorph&&o.enable(3),D.matcap&&o.enable(4),D.envMap&&o.enable(5),D.normalMapObjectSpace&&o.enable(6),D.normalMapTangentSpace&&o.enable(7),D.clearcoat&&o.enable(8),D.iridescence&&o.enable(9),D.alphaTest&&o.enable(10),D.vertexColors&&o.enable(11),D.vertexAlphas&&o.enable(12),D.vertexUv1s&&o.enable(13),D.vertexUv2s&&o.enable(14),D.vertexUv3s&&o.enable(15),D.vertexTangents&&o.enable(16),D.anisotropy&&o.enable(17),D.alphaHash&&o.enable(18),D.batching&&o.enable(19),D.dispersion&&o.enable(20),D.batchingColor&&o.enable(21),D.gradientMap&&o.enable(22),N.push(o.mask),o.disableAll(),D.fog&&o.enable(0),D.useFog&&o.enable(1),D.flatShading&&o.enable(2),D.logarithmicDepthBuffer&&o.enable(3),D.reversedDepthBuffer&&o.enable(4),D.skinning&&o.enable(5),D.morphTargets&&o.enable(6),D.morphNormals&&o.enable(7),D.morphColors&&o.enable(8),D.premultipliedAlpha&&o.enable(9),D.shadowMapEnabled&&o.enable(10),D.doubleSided&&o.enable(11),D.flipSided&&o.enable(12),D.useDepthPacking&&o.enable(13),D.dithering&&o.enable(14),D.transmission&&o.enable(15),D.sheen&&o.enable(16),D.opaque&&o.enable(17),D.pointsUvs&&o.enable(18),D.decodeVideoTexture&&o.enable(19),D.decodeVideoTextureEmissive&&o.enable(20),D.alphaToCoverage&&o.enable(21),N.push(o.mask)}function T(N){const D=y[N.type];let F;if(D){const I=zo[D];F=mue.clone(I.uniforms)}else F=N.uniforms;return F}function C(N,D){let F;for(let I=0,W=d.length;I<W;I++){const O=d[I];if(O.cacheKey===D){F=O,++F.usedTimes;break}}return F===void 0&&(F=new qpe(t,D,N,a),d.push(F)),F}function P(N){if(--N.usedTimes===0){const D=d.indexOf(N);d[D]=d[d.length-1],d.pop(),N.destroy()}}function A(N){l.remove(N)}function U(){l.dispose()}return{getParameters:v,getProgramCacheKey:x,getUniforms:T,acquireProgram:C,releaseProgram:P,releaseShaderCache:A,programs:d,dispose:U}}function Qpe(){let t=new WeakMap;function e(s){return t.has(s)}function n(s){let o=t.get(s);return o===void 0&&(o={},t.set(s,o)),o}function i(s){t.delete(s)}function r(s,o,l){t.get(s)[o]=l}function a(){t=new WeakMap}return{has:e,get:n,remove:i,update:r,dispose:a}}function Jpe(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 GF(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 WF(){const t=[];let e=0;const n=[],i=[],r=[];function a(){e=0,n.length=0,i.length=0,r.length=0}function s(f,m,g,y,_,v){let x=t[e];return x===void 0?(x={id:f.id,object:f,geometry:m,material:g,groupOrder:y,renderOrder:f.renderOrder,z:_,group:v},t[e]=x):(x.id=f.id,x.object=f,x.geometry=m,x.material=g,x.groupOrder=y,x.renderOrder=f.renderOrder,x.z=_,x.group=v),e++,x}function o(f,m,g,y,_,v){const x=s(f,m,g,y,_,v);g.transmission>0?i.push(x):g.transparent===!0?r.push(x):n.push(x)}function l(f,m,g,y,_,v){const x=s(f,m,g,y,_,v);g.transmission>0?i.unshift(x):g.transparent===!0?r.unshift(x):n.unshift(x)}function c(f,m){n.length>1&&n.sort(f||Jpe),i.length>1&&i.sort(m||GF),r.length>1&&r.sort(m||GF)}function d(){for(let f=e,m=t.length;f<m;f++){const g=t[f];if(g.id===null)break;g.id=null,g.object=null,g.geometry=null,g.material=null,g.group=null}}return{opaque:n,transmissive:i,transparent:r,init:a,push:o,unshift:l,finish:d,sort:c}}function eme(){let t=new WeakMap;function e(i,r){const a=t.get(i);let s;return a===void 0?(s=new WF,t.set(i,[s])):r>=a.length?(s=new WF,a.push(s)):s=a[r],s}function n(){t=new WeakMap}return{get:e,dispose:n}}function tme(){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 $e,color:new vn};break;case"SpotLight":n={position:new $e,direction:new $e,color:new vn,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new $e,color:new vn,distance:0,decay:0};break;case"HemisphereLight":n={direction:new $e,skyColor:new vn,groundColor:new vn};break;case"RectAreaLight":n={color:new vn,position:new $e,halfWidth:new $e,halfHeight:new $e};break}return t[e.id]=n,n}}}function nme(){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 an};break;case"SpotLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new an};break;case"PointLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new an,shadowCameraNear:1,shadowCameraFar:1e3};break}return t[e.id]=n,n}}}let ime=0;function rme(t,e){return(e.castShadow?2:0)-(t.castShadow?2:0)+(e.map?1:0)-(t.map?1:0)}function ame(t){const e=new tme,n=nme(),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 c=0;c<9;c++)i.probe.push(new $e);const r=new $e,a=new qi,s=new qi;function o(c){let d=0,f=0,m=0;for(let N=0;N<9;N++)i.probe[N].set(0,0,0);let g=0,y=0,_=0,v=0,x=0,M=0,w=0,T=0,C=0,P=0,A=0;c.sort(rme);for(let N=0,D=c.length;N<D;N++){const F=c[N],I=F.color,W=F.intensity,O=F.distance,B=F.shadow&&F.shadow.map?F.shadow.map.texture:null;if(F.isAmbientLight)d+=I.r*W,f+=I.g*W,m+=I.b*W;else if(F.isLightProbe){for(let H=0;H<9;H++)i.probe[H].addScaledVector(F.sh.coefficients[H],W);A++}else if(F.isDirectionalLight){const H=e.get(F);if(H.color.copy(F.color).multiplyScalar(F.intensity),F.castShadow){const $=F.shadow,K=n.get(F);K.shadowIntensity=$.intensity,K.shadowBias=$.bias,K.shadowNormalBias=$.normalBias,K.shadowRadius=$.radius,K.shadowMapSize=$.mapSize,i.directionalShadow[g]=K,i.directionalShadowMap[g]=B,i.directionalShadowMatrix[g]=F.shadow.matrix,M++}i.directional[g]=H,g++}else if(F.isSpotLight){const H=e.get(F);H.position.setFromMatrixPosition(F.matrixWorld),H.color.copy(I).multiplyScalar(W),H.distance=O,H.coneCos=Math.cos(F.angle),H.penumbraCos=Math.cos(F.angle*(1-F.penumbra)),H.decay=F.decay,i.spot[_]=H;const $=F.shadow;if(F.map&&(i.spotLightMap[C]=F.map,C++,$.updateMatrices(F),F.castShadow&&P++),i.spotLightMatrix[_]=$.matrix,F.castShadow){const K=n.get(F);K.shadowIntensity=$.intensity,K.shadowBias=$.bias,K.shadowNormalBias=$.normalBias,K.shadowRadius=$.radius,K.shadowMapSize=$.mapSize,i.spotShadow[_]=K,i.spotShadowMap[_]=B,T++}_++}else if(F.isRectAreaLight){const H=e.get(F);H.color.copy(I).multiplyScalar(W),H.halfWidth.set(F.width*.5,0,0),H.halfHeight.set(0,F.height*.5,0),i.rectArea[v]=H,v++}else if(F.isPointLight){const H=e.get(F);if(H.color.copy(F.color).multiplyScalar(F.intensity),H.distance=F.distance,H.decay=F.decay,F.castShadow){const $=F.shadow,K=n.get(F);K.shadowIntensity=$.intensity,K.shadowBias=$.bias,K.shadowNormalBias=$.normalBias,K.shadowRadius=$.radius,K.shadowMapSize=$.mapSize,K.shadowCameraNear=$.camera.near,K.shadowCameraFar=$.camera.far,i.pointShadow[y]=K,i.pointShadowMap[y]=B,i.pointShadowMatrix[y]=F.shadow.matrix,w++}i.point[y]=H,y++}else if(F.isHemisphereLight){const H=e.get(F);H.skyColor.copy(F.color).multiplyScalar(W),H.groundColor.copy(F.groundColor).multiplyScalar(W),i.hemi[x]=H,x++}}v>0&&(t.has("OES_texture_float_linear")===!0?(i.rectAreaLTC1=St.LTC_FLOAT_1,i.rectAreaLTC2=St.LTC_FLOAT_2):(i.rectAreaLTC1=St.LTC_HALF_1,i.rectAreaLTC2=St.LTC_HALF_2)),i.ambient[0]=d,i.ambient[1]=f,i.ambient[2]=m;const U=i.hash;(U.directionalLength!==g||U.pointLength!==y||U.spotLength!==_||U.rectAreaLength!==v||U.hemiLength!==x||U.numDirectionalShadows!==M||U.numPointShadows!==w||U.numSpotShadows!==T||U.numSpotMaps!==C||U.numLightProbes!==A)&&(i.directional.length=g,i.spot.length=_,i.rectArea.length=v,i.point.length=y,i.hemi.length=x,i.directionalShadow.length=M,i.directionalShadowMap.length=M,i.pointShadow.length=w,i.pointShadowMap.length=w,i.spotShadow.length=T,i.spotShadowMap.length=T,i.directionalShadowMatrix.length=M,i.pointShadowMatrix.length=w,i.spotLightMatrix.length=T+C-P,i.spotLightMap.length=C,i.numSpotLightShadowsWithMaps=P,i.numLightProbes=A,U.directionalLength=g,U.pointLength=y,U.spotLength=_,U.rectAreaLength=v,U.hemiLength=x,U.numDirectionalShadows=M,U.numPointShadows=w,U.numSpotShadows=T,U.numSpotMaps=C,U.numLightProbes=A,i.version=ime++)}function l(c,d){let f=0,m=0,g=0,y=0,_=0;const v=d.matrixWorldInverse;for(let x=0,M=c.length;x<M;x++){const w=c[x];if(w.isDirectionalLight){const T=i.directional[f];T.direction.setFromMatrixPosition(w.matrixWorld),r.setFromMatrixPosition(w.target.matrixWorld),T.direction.sub(r),T.direction.transformDirection(v),f++}else if(w.isSpotLight){const T=i.spot[g];T.position.setFromMatrixPosition(w.matrixWorld),T.position.applyMatrix4(v),T.direction.setFromMatrixPosition(w.matrixWorld),r.setFromMatrixPosition(w.target.matrixWorld),T.direction.sub(r),T.direction.transformDirection(v),g++}else if(w.isRectAreaLight){const T=i.rectArea[y];T.position.setFromMatrixPosition(w.matrixWorld),T.position.applyMatrix4(v),s.identity(),a.copy(w.matrixWorld),a.premultiply(v),s.extractRotation(a),T.halfWidth.set(w.width*.5,0,0),T.halfHeight.set(0,w.height*.5,0),T.halfWidth.applyMatrix4(s),T.halfHeight.applyMatrix4(s),y++}else if(w.isPointLight){const T=i.point[m];T.position.setFromMatrixPosition(w.matrixWorld),T.position.applyMatrix4(v),m++}else if(w.isHemisphereLight){const T=i.hemi[_];T.direction.setFromMatrixPosition(w.matrixWorld),T.direction.transformDirection(v),_++}}}return{setup:o,setupView:l,state:i}}function qF(t){const e=new ame(t),n=[],i=[];function r(d){c.camera=d,n.length=0,i.length=0}function a(d){n.push(d)}function s(d){i.push(d)}function o(){e.setup(n)}function l(d){e.setupView(n,d)}const c={lightsArray:n,shadowsArray:i,camera:null,lights:e,transmissionRenderTarget:{}};return{init:r,state:c,setupLights:o,setupLightsView:l,pushLight:a,pushShadow:s}}function sme(t){let e=new WeakMap;function n(r,a=0){const s=e.get(r);let o;return s===void 0?(o=new qF(t),e.set(r,[o])):a>=s.length?(o=new qF(t),s.push(o)):o=s[a],o}function i(){e=new WeakMap}return{get:n,dispose:i}}const ome=`void main() {
  3797. gl_Position = vec4( position, 1.0 );
  3798. }`,lme=`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 cme(t,e,n){let i=new GP;const r=new an,a=new an,s=new Vi,o=new Nue({depthPacking:jce}),l=new Rue,c={},d=n.maxTextureSize,f={[Gu]:Ia,[Ia]:Gu,[Bo]:Bo},m=new pc({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new an},radius:{value:4}},vertexShader:ome,fragmentShader:lme}),g=m.clone();g.defines.HORIZONTAL_PASS=1;const y=new ol;y.setAttribute("position",new Hs(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const _=new Jo(y,m),v=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=s9;let x=this.type;this.render=function(P,A,U){if(v.enabled===!1||v.autoUpdate===!1&&v.needsUpdate===!1||P.length===0)return;const N=t.getRenderTarget(),D=t.getActiveCubeFace(),F=t.getActiveMipmapLevel(),I=t.state;I.setBlending(nc),I.buffers.depth.getReversed()===!0?I.buffers.color.setClear(0,0,0,0):I.buffers.color.setClear(1,1,1,1),I.buffers.depth.setTest(!0),I.setScissorTest(!1);const W=x!==zl&&this.type===zl,O=x===zl&&this.type!==zl;for(let B=0,H=P.length;B<H;B++){const $=P[B],K=$.shadow;if(K===void 0){Gt("WebGLShadowMap:",$,"has no shadow.");continue}if(K.autoUpdate===!1&&K.needsUpdate===!1)continue;r.copy(K.mapSize);const Z=K.getFrameExtents();if(r.multiply(Z),a.copy(K.mapSize),(r.x>d||r.y>d)&&(r.x>d&&(a.x=Math.floor(d/Z.x),r.x=a.x*Z.x,K.mapSize.x=a.x),r.y>d&&(a.y=Math.floor(d/Z.y),r.y=a.y*Z.y,K.mapSize.y=a.y)),K.map===null||W===!0||O===!0){const V=this.type!==zl?{minFilter:cs,magFilter:cs}:{};K.map!==null&&K.map.dispose(),K.map=new Mf(r.x,r.y,V),K.map.texture.name=$.name+".shadowMap",K.camera.updateProjectionMatrix()}t.setRenderTarget(K.map),t.clear();const se=K.getViewportCount();for(let V=0;V<se;V++){const X=K.getViewport(V);s.set(a.x*X.x,a.y*X.y,a.x*X.z,a.y*X.w),I.viewport(s),K.updateMatrices($,V),i=K.getFrustum(),T(A,U,K.camera,$,this.type)}K.isPointLightShadow!==!0&&this.type===zl&&M(K,U),K.needsUpdate=!1}x=this.type,v.needsUpdate=!1,t.setRenderTarget(N,D,F)};function M(P,A){const U=e.update(_);m.defines.VSM_SAMPLES!==P.blurSamples&&(m.defines.VSM_SAMPLES=P.blurSamples,g.defines.VSM_SAMPLES=P.blurSamples,m.needsUpdate=!0,g.needsUpdate=!0),P.mapPass===null&&(P.mapPass=new Mf(r.x,r.y)),m.uniforms.shadow_pass.value=P.map.texture,m.uniforms.resolution.value=P.mapSize,m.uniforms.radius.value=P.radius,t.setRenderTarget(P.mapPass),t.clear(),t.renderBufferDirect(A,null,U,m,_,null),g.uniforms.shadow_pass.value=P.mapPass.texture,g.uniforms.resolution.value=P.mapSize,g.uniforms.radius.value=P.radius,t.setRenderTarget(P.map),t.clear(),t.renderBufferDirect(A,null,U,g,_,null)}function w(P,A,U,N){let D=null;const F=U.isPointLight===!0?P.customDistanceMaterial:P.customDepthMaterial;if(F!==void 0)D=F;else if(D=U.isPointLight===!0?l:o,t.localClippingEnabled&&A.clipShadows===!0&&Array.isArray(A.clippingPlanes)&&A.clippingPlanes.length!==0||A.displacementMap&&A.displacementScale!==0||A.alphaMap&&A.alphaTest>0||A.map&&A.alphaTest>0||A.alphaToCoverage===!0){const I=D.uuid,W=A.uuid;let O=c[I];O===void 0&&(O={},c[I]=O);let B=O[W];B===void 0&&(B=D.clone(),O[W]=B,A.addEventListener("dispose",C)),D=B}if(D.visible=A.visible,D.wireframe=A.wireframe,N===zl?D.side=A.shadowSide!==null?A.shadowSide:A.side:D.side=A.shadowSide!==null?A.shadowSide:f[A.side],D.alphaMap=A.alphaMap,D.alphaTest=A.alphaToCoverage===!0?.5:A.alphaTest,D.map=A.map,D.clipShadows=A.clipShadows,D.clippingPlanes=A.clippingPlanes,D.clipIntersection=A.clipIntersection,D.displacementMap=A.displacementMap,D.displacementScale=A.displacementScale,D.displacementBias=A.displacementBias,D.wireframeLinewidth=A.wireframeLinewidth,D.linewidth=A.linewidth,U.isPointLight===!0&&D.isMeshDistanceMaterial===!0){const I=t.properties.get(D);I.light=U}return D}function T(P,A,U,N,D){if(P.visible===!1)return;if(P.layers.test(A.layers)&&(P.isMesh||P.isLine||P.isPoints)&&(P.castShadow||P.receiveShadow&&D===zl)&&(!P.frustumCulled||i.intersectsObject(P))){P.modelViewMatrix.multiplyMatrices(U.matrixWorldInverse,P.matrixWorld);const W=e.update(P),O=P.material;if(Array.isArray(O)){const B=W.groups;for(let H=0,$=B.length;H<$;H++){const K=B[H],Z=O[K.materialIndex];if(Z&&Z.visible){const se=w(P,Z,N,D);P.onBeforeShadow(t,P,A,U,W,se,K),t.renderBufferDirect(U,null,W,se,P,K),P.onAfterShadow(t,P,A,U,W,se,K)}}}else if(O.visible){const B=w(P,O,N,D);P.onBeforeShadow(t,P,A,U,W,B,null),t.renderBufferDirect(U,null,W,B,P,null),P.onAfterShadow(t,P,A,U,W,B,null)}}const I=P.children;for(let W=0,O=I.length;W<O;W++)T(I[W],A,U,N,D)}function C(P){P.target.removeEventListener("dispose",C);for(const U in c){const N=c[U],D=P.target.uuid;D in N&&(N[D].dispose(),delete N[D])}}}const ume={[EN]:AN,[TN]:RN,[CN]:PN,[Up]:NN,[AN]:EN,[RN]:TN,[PN]:CN,[NN]:Up};function dme(t,e){function n(){let de=!1;const it=new Vi;let fe=null;const Oe=new Vi(0,0,0,0);return{setMask:function(Me){fe!==Me&&!de&&(t.colorMask(Me,Me,Me,Me),fe=Me)},setLocked:function(Me){de=Me},setClear:function(Me,xe,Be,ct,bt){bt===!0&&(Me*=ct,xe*=ct,Be*=ct),it.set(Me,xe,Be,ct),Oe.equals(it)===!1&&(t.clearColor(Me,xe,Be,ct),Oe.copy(it))},reset:function(){de=!1,fe=null,Oe.set(-1,0,0,0)}}}function i(){let de=!1,it=!1,fe=null,Oe=null,Me=null;return{setReversed:function(xe){if(it!==xe){const Be=e.get("EXT_clip_control");xe?Be.clipControlEXT(Be.LOWER_LEFT_EXT,Be.ZERO_TO_ONE_EXT):Be.clipControlEXT(Be.LOWER_LEFT_EXT,Be.NEGATIVE_ONE_TO_ONE_EXT),it=xe;const ct=Me;Me=null,this.setClear(ct)}},getReversed:function(){return it},setTest:function(xe){xe?ve(t.DEPTH_TEST):Pe(t.DEPTH_TEST)},setMask:function(xe){fe!==xe&&!de&&(t.depthMask(xe),fe=xe)},setFunc:function(xe){if(it&&(xe=ume[xe]),Oe!==xe){switch(xe){case EN:t.depthFunc(t.NEVER);break;case AN:t.depthFunc(t.ALWAYS);break;case TN:t.depthFunc(t.LESS);break;case Up:t.depthFunc(t.LEQUAL);break;case CN:t.depthFunc(t.EQUAL);break;case NN:t.depthFunc(t.GEQUAL);break;case RN:t.depthFunc(t.GREATER);break;case PN:t.depthFunc(t.NOTEQUAL);break;default:t.depthFunc(t.LEQUAL)}Oe=xe}},setLocked:function(xe){de=xe},setClear:function(xe){Me!==xe&&(it&&(xe=1-xe),t.clearDepth(xe),Me=xe)},reset:function(){de=!1,fe=null,Oe=null,Me=null,it=!1}}}function r(){let de=!1,it=null,fe=null,Oe=null,Me=null,xe=null,Be=null,ct=null,bt=null;return{setTest:function(Nt){de||(Nt?ve(t.STENCIL_TEST):Pe(t.STENCIL_TEST))},setMask:function(Nt){it!==Nt&&!de&&(t.stencilMask(Nt),it=Nt)},setFunc:function(Nt,on,Dt){(fe!==Nt||Oe!==on||Me!==Dt)&&(t.stencilFunc(Nt,on,Dt),fe=Nt,Oe=on,Me=Dt)},setOp:function(Nt,on,Dt){(xe!==Nt||Be!==on||ct!==Dt)&&(t.stencilOp(Nt,on,Dt),xe=Nt,Be=on,ct=Dt)},setLocked:function(Nt){de=Nt},setClear:function(Nt){bt!==Nt&&(t.clearStencil(Nt),bt=Nt)},reset:function(){de=!1,it=null,fe=null,Oe=null,Me=null,xe=null,Be=null,ct=null,bt=null}}}const a=new n,s=new i,o=new r,l=new WeakMap,c=new WeakMap;let d={},f={},m=new WeakMap,g=[],y=null,_=!1,v=null,x=null,M=null,w=null,T=null,C=null,P=null,A=new vn(0,0,0),U=0,N=!1,D=null,F=null,I=null,W=null,O=null;const B=t.getParameter(t.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let H=!1,$=0;const K=t.getParameter(t.VERSION);K.indexOf("WebGL")!==-1?($=parseFloat(/^WebGL (\d)/.exec(K)[1]),H=$>=1):K.indexOf("OpenGL ES")!==-1&&($=parseFloat(/^OpenGL ES (\d)/.exec(K)[1]),H=$>=2);let Z=null,se={};const V=t.getParameter(t.SCISSOR_BOX),X=t.getParameter(t.VIEWPORT),ae=new Vi().fromArray(V),ce=new Vi().fromArray(X);function ge(de,it,fe,Oe){const Me=new Uint8Array(4),xe=t.createTexture();t.bindTexture(de,xe),t.texParameteri(de,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(de,t.TEXTURE_MAG_FILTER,t.NEAREST);for(let Be=0;Be<fe;Be++)de===t.TEXTURE_3D||de===t.TEXTURE_2D_ARRAY?t.texImage3D(it,0,t.RGBA,1,1,Oe,0,t.RGBA,t.UNSIGNED_BYTE,Me):t.texImage2D(it+Be,0,t.RGBA,1,1,0,t.RGBA,t.UNSIGNED_BYTE,Me);return xe}const ne={};ne[t.TEXTURE_2D]=ge(t.TEXTURE_2D,t.TEXTURE_2D,1),ne[t.TEXTURE_CUBE_MAP]=ge(t.TEXTURE_CUBE_MAP,t.TEXTURE_CUBE_MAP_POSITIVE_X,6),ne[t.TEXTURE_2D_ARRAY]=ge(t.TEXTURE_2D_ARRAY,t.TEXTURE_2D_ARRAY,1,1),ne[t.TEXTURE_3D]=ge(t.TEXTURE_3D,t.TEXTURE_3D,1,1),a.setClear(0,0,0,1),s.setClear(1),o.setClear(0),ve(t.DEPTH_TEST),s.setFunc(Up),re(!1),J(Gj),ve(t.CULL_FACE),z(nc);function ve(de){d[de]!==!0&&(t.enable(de),d[de]=!0)}function Pe(de){d[de]!==!1&&(t.disable(de),d[de]=!1)}function he(de,it){return f[de]!==it?(t.bindFramebuffer(de,it),f[de]=it,de===t.DRAW_FRAMEBUFFER&&(f[t.FRAMEBUFFER]=it),de===t.FRAMEBUFFER&&(f[t.DRAW_FRAMEBUFFER]=it),!0):!1}function we(de,it){let fe=g,Oe=!1;if(de){fe=m.get(it),fe===void 0&&(fe=[],m.set(it,fe));const Me=de.textures;if(fe.length!==Me.length||fe[0]!==t.COLOR_ATTACHMENT0){for(let xe=0,Be=Me.length;xe<Be;xe++)fe[xe]=t.COLOR_ATTACHMENT0+xe;fe.length=Me.length,Oe=!0}}else fe[0]!==t.BACK&&(fe[0]=t.BACK,Oe=!0);Oe&&t.drawBuffers(fe)}function je(de){return y!==de?(t.useProgram(de),y=de,!0):!1}const ue={[Vd]:t.FUNC_ADD,[uce]:t.FUNC_SUBTRACT,[dce]:t.FUNC_REVERSE_SUBTRACT};ue[fce]=t.MIN,ue[hce]=t.MAX;const lt={[pce]:t.ZERO,[mce]:t.ONE,[gce]:t.SRC_COLOR,[wN]:t.SRC_ALPHA,[Sce]:t.SRC_ALPHA_SATURATE,[bce]:t.DST_COLOR,[vce]:t.DST_ALPHA,[xce]:t.ONE_MINUS_SRC_COLOR,[MN]:t.ONE_MINUS_SRC_ALPHA,[_ce]:t.ONE_MINUS_DST_COLOR,[yce]:t.ONE_MINUS_DST_ALPHA,[wce]:t.CONSTANT_COLOR,[Mce]:t.ONE_MINUS_CONSTANT_COLOR,[Ece]:t.CONSTANT_ALPHA,[Ace]:t.ONE_MINUS_CONSTANT_ALPHA};function z(de,it,fe,Oe,Me,xe,Be,ct,bt,Nt){if(de===nc){_===!0&&(Pe(t.BLEND),_=!1);return}if(_===!1&&(ve(t.BLEND),_=!0),de!==cce){if(de!==v||Nt!==N){if((x!==Vd||T!==Vd)&&(t.blendEquation(t.FUNC_ADD),x=Vd,T=Vd),Nt)switch(de){case Ep:t.blendFuncSeparate(t.ONE,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA);break;case Wj:t.blendFunc(t.ONE,t.ONE);break;case qj:t.blendFuncSeparate(t.ZERO,t.ONE_MINUS_SRC_COLOR,t.ZERO,t.ONE);break;case Xj:t.blendFuncSeparate(t.DST_COLOR,t.ONE_MINUS_SRC_ALPHA,t.ZERO,t.ONE);break;default:Di("WebGLState: Invalid blending: ",de);break}else switch(de){case Ep:t.blendFuncSeparate(t.SRC_ALPHA,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA);break;case Wj:t.blendFuncSeparate(t.SRC_ALPHA,t.ONE,t.ONE,t.ONE);break;case qj:Di("WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true");break;case Xj:Di("WebGLState: MultiplyBlending requires material.premultipliedAlpha = true");break;default:Di("WebGLState: Invalid blending: ",de);break}M=null,w=null,C=null,P=null,A.set(0,0,0),U=0,v=de,N=Nt}return}Me=Me||it,xe=xe||fe,Be=Be||Oe,(it!==x||Me!==T)&&(t.blendEquationSeparate(ue[it],ue[Me]),x=it,T=Me),(fe!==M||Oe!==w||xe!==C||Be!==P)&&(t.blendFuncSeparate(lt[fe],lt[Oe],lt[xe],lt[Be]),M=fe,w=Oe,C=xe,P=Be),(ct.equals(A)===!1||bt!==U)&&(t.blendColor(ct.r,ct.g,ct.b,bt),A.copy(ct),U=bt),v=de,N=!1}function q(de,it){de.side===Bo?Pe(t.CULL_FACE):ve(t.CULL_FACE);let fe=de.side===Ia;it&&(fe=!fe),re(fe),de.blending===Ep&&de.transparent===!1?z(nc):z(de.blending,de.blendEquation,de.blendSrc,de.blendDst,de.blendEquationAlpha,de.blendSrcAlpha,de.blendDstAlpha,de.blendColor,de.blendAlpha,de.premultipliedAlpha),s.setFunc(de.depthFunc),s.setTest(de.depthTest),s.setMask(de.depthWrite),a.setMask(de.colorWrite);const Oe=de.stencilWrite;o.setTest(Oe),Oe&&(o.setMask(de.stencilWriteMask),o.setFunc(de.stencilFunc,de.stencilRef,de.stencilFuncMask),o.setOp(de.stencilFail,de.stencilZFail,de.stencilZPass)),oe(de.polygonOffset,de.polygonOffsetFactor,de.polygonOffsetUnits),de.alphaToCoverage===!0?ve(t.SAMPLE_ALPHA_TO_COVERAGE):Pe(t.SAMPLE_ALPHA_TO_COVERAGE)}function re(de){D!==de&&(de?t.frontFace(t.CW):t.frontFace(t.CCW),D=de)}function J(de){de!==sce?(ve(t.CULL_FACE),de!==F&&(de===Gj?t.cullFace(t.BACK):de===oce?t.cullFace(t.FRONT):t.cullFace(t.FRONT_AND_BACK))):Pe(t.CULL_FACE),F=de}function ee(de){de!==I&&(H&&t.lineWidth(de),I=de)}function oe(de,it,fe){de?(ve(t.POLYGON_OFFSET_FILL),(W!==it||O!==fe)&&(t.polygonOffset(it,fe),W=it,O=fe)):Pe(t.POLYGON_OFFSET_FILL)}function De(de){de?ve(t.SCISSOR_TEST):Pe(t.SCISSOR_TEST)}function Ne(de){de===void 0&&(de=t.TEXTURE0+B-1),Z!==de&&(t.activeTexture(de),Z=de)}function te(de,it,fe){fe===void 0&&(Z===null?fe=t.TEXTURE0+B-1:fe=Z);let Oe=se[fe];Oe===void 0&&(Oe={type:void 0,texture:void 0},se[fe]=Oe),(Oe.type!==de||Oe.texture!==it)&&(Z!==fe&&(t.activeTexture(fe),Z=fe),t.bindTexture(de,it||ne[de]),Oe.type=de,Oe.texture=it)}function j(){const de=se[Z];de!==void 0&&de.type!==void 0&&(t.bindTexture(de.type,null),de.type=void 0,de.texture=void 0)}function L(){try{t.compressedTexImage2D(...arguments)}catch(de){de("WebGLState:",de)}}function Y(){try{t.compressedTexImage3D(...arguments)}catch(de){de("WebGLState:",de)}}function me(){try{t.texSubImage2D(...arguments)}catch(de){de("WebGLState:",de)}}function ye(){try{t.texSubImage3D(...arguments)}catch(de){de("WebGLState:",de)}}function pe(){try{t.compressedTexSubImage2D(...arguments)}catch(de){de("WebGLState:",de)}}function Ze(){try{t.compressedTexSubImage3D(...arguments)}catch(de){de("WebGLState:",de)}}function Le(){try{t.texStorage2D(...arguments)}catch(de){de("WebGLState:",de)}}function qe(){try{t.texStorage3D(...arguments)}catch(de){de("WebGLState:",de)}}function at(){try{t.texImage2D(...arguments)}catch(de){de("WebGLState:",de)}}function Ie(){try{t.texImage3D(...arguments)}catch(de){de("WebGLState:",de)}}function Re(de){ae.equals(de)===!1&&(t.scissor(de.x,de.y,de.z,de.w),ae.copy(de))}function pt(de){ce.equals(de)===!1&&(t.viewport(de.x,de.y,de.z,de.w),ce.copy(de))}function nt(de,it){let fe=c.get(it);fe===void 0&&(fe=new WeakMap,c.set(it,fe));let Oe=fe.get(de);Oe===void 0&&(Oe=t.getUniformBlockIndex(it,de.name),fe.set(de,Oe))}function tt(de,it){const Oe=c.get(it).get(de);l.get(it)!==Oe&&(t.uniformBlockBinding(it,Oe,de.__bindingPointIndex),l.set(it,Oe))}function ut(){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),d={},Z=null,se={},f={},m=new WeakMap,g=[],y=null,_=!1,v=null,x=null,M=null,w=null,T=null,C=null,P=null,A=new vn(0,0,0),U=0,N=!1,D=null,F=null,I=null,W=null,O=null,ae.set(0,0,t.canvas.width,t.canvas.height),ce.set(0,0,t.canvas.width,t.canvas.height),a.reset(),s.reset(),o.reset()}return{buffers:{color:a,depth:s,stencil:o},enable:ve,disable:Pe,bindFramebuffer:he,drawBuffers:we,useProgram:je,setBlending:z,setMaterial:q,setFlipSided:re,setCullFace:J,setLineWidth:ee,setPolygonOffset:oe,setScissorTest:De,activeTexture:Ne,bindTexture:te,unbindTexture:j,compressedTexImage2D:L,compressedTexImage3D:Y,texImage2D:at,texImage3D:Ie,updateUBOMapping:nt,uniformBlockBinding:tt,texStorage2D:Le,texStorage3D:qe,texSubImage2D:me,texSubImage3D:ye,compressedTexSubImage2D:pe,compressedTexSubImage3D:Ze,scissor:Re,viewport:pt,reset:ut}}function fme(t,e,n,i,r,a,s){const o=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,l=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),c=new an,d=new WeakMap;let f;const m=new WeakMap;let g=!1;try{g=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function y(j,L){return g?new OffscreenCanvas(j,L):B_("canvas")}function _(j,L,Y){let me=1;const ye=te(j);if((ye.width>Y||ye.height>Y)&&(me=Y/Math.max(ye.width,ye.height)),me<1)if(typeof HTMLImageElement<"u"&&j instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&j instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&j instanceof ImageBitmap||typeof VideoFrame<"u"&&j instanceof VideoFrame){const pe=Math.floor(me*ye.width),Ze=Math.floor(me*ye.height);f===void 0&&(f=y(pe,Ze));const Le=L?y(pe,Ze):f;return Le.width=pe,Le.height=Ze,Le.getContext("2d").drawImage(j,0,0,pe,Ze),Gt("WebGLRenderer: Texture has been resized from ("+ye.width+"x"+ye.height+") to ("+pe+"x"+Ze+")."),Le}else return"data"in j&&Gt("WebGLRenderer: Image in DataTexture is too big ("+ye.width+"x"+ye.height+")."),j;return j}function v(j){return j.generateMipmaps}function x(j){t.generateMipmap(j)}function M(j){return j.isWebGLCubeRenderTarget?t.TEXTURE_CUBE_MAP:j.isWebGL3DRenderTarget?t.TEXTURE_3D:j.isWebGLArrayRenderTarget||j.isCompressedArrayTexture?t.TEXTURE_2D_ARRAY:t.TEXTURE_2D}function w(j,L,Y,me,ye=!1){if(j!==null){if(t[j]!==void 0)return t[j];Gt("WebGLRenderer: Attempt to use non-existing WebGL internal format '"+j+"'")}let pe=L;if(L===t.RED&&(Y===t.FLOAT&&(pe=t.R32F),Y===t.HALF_FLOAT&&(pe=t.R16F),Y===t.UNSIGNED_BYTE&&(pe=t.R8)),L===t.RED_INTEGER&&(Y===t.UNSIGNED_BYTE&&(pe=t.R8UI),Y===t.UNSIGNED_SHORT&&(pe=t.R16UI),Y===t.UNSIGNED_INT&&(pe=t.R32UI),Y===t.BYTE&&(pe=t.R8I),Y===t.SHORT&&(pe=t.R16I),Y===t.INT&&(pe=t.R32I)),L===t.RG&&(Y===t.FLOAT&&(pe=t.RG32F),Y===t.HALF_FLOAT&&(pe=t.RG16F),Y===t.UNSIGNED_BYTE&&(pe=t.RG8)),L===t.RG_INTEGER&&(Y===t.UNSIGNED_BYTE&&(pe=t.RG8UI),Y===t.UNSIGNED_SHORT&&(pe=t.RG16UI),Y===t.UNSIGNED_INT&&(pe=t.RG32UI),Y===t.BYTE&&(pe=t.RG8I),Y===t.SHORT&&(pe=t.RG16I),Y===t.INT&&(pe=t.RG32I)),L===t.RGB_INTEGER&&(Y===t.UNSIGNED_BYTE&&(pe=t.RGB8UI),Y===t.UNSIGNED_SHORT&&(pe=t.RGB16UI),Y===t.UNSIGNED_INT&&(pe=t.RGB32UI),Y===t.BYTE&&(pe=t.RGB8I),Y===t.SHORT&&(pe=t.RGB16I),Y===t.INT&&(pe=t.RGB32I)),L===t.RGBA_INTEGER&&(Y===t.UNSIGNED_BYTE&&(pe=t.RGBA8UI),Y===t.UNSIGNED_SHORT&&(pe=t.RGBA16UI),Y===t.UNSIGNED_INT&&(pe=t.RGBA32UI),Y===t.BYTE&&(pe=t.RGBA8I),Y===t.SHORT&&(pe=t.RGBA16I),Y===t.INT&&(pe=t.RGBA32I)),L===t.RGB&&(Y===t.UNSIGNED_INT_5_9_9_9_REV&&(pe=t.RGB9_E5),Y===t.UNSIGNED_INT_10F_11F_11F_REV&&(pe=t.R11F_G11F_B10F)),L===t.RGBA){const Ze=ye?F_:Mn.getTransfer(me);Y===t.FLOAT&&(pe=t.RGBA32F),Y===t.HALF_FLOAT&&(pe=t.RGBA16F),Y===t.UNSIGNED_BYTE&&(pe=Ze===zn?t.SRGB8_ALPHA8:t.RGBA8),Y===t.UNSIGNED_SHORT_4_4_4_4&&(pe=t.RGBA4),Y===t.UNSIGNED_SHORT_5_5_5_1&&(pe=t.RGB5_A1)}return(pe===t.R16F||pe===t.R32F||pe===t.RG16F||pe===t.RG32F||pe===t.RGBA16F||pe===t.RGBA32F)&&e.get("EXT_color_buffer_float"),pe}function T(j,L){let Y;return j?L===null||L===Sf||L===B0?Y=t.DEPTH24_STENCIL8:L===Yl?Y=t.DEPTH32F_STENCIL8:L===z0&&(Y=t.DEPTH24_STENCIL8,Gt("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):L===null||L===Sf||L===B0?Y=t.DEPTH_COMPONENT24:L===Yl?Y=t.DEPTH_COMPONENT32F:L===z0&&(Y=t.DEPTH_COMPONENT16),Y}function C(j,L){return v(j)===!0||j.isFramebufferTexture&&j.minFilter!==cs&&j.minFilter!==zs?Math.log2(Math.max(L.width,L.height))+1:j.mipmaps!==void 0&&j.mipmaps.length>0?j.mipmaps.length:j.isCompressedTexture&&Array.isArray(j.image)?L.mipmaps.length:1}function P(j){const L=j.target;L.removeEventListener("dispose",P),U(L),L.isVideoTexture&&d.delete(L)}function A(j){const L=j.target;L.removeEventListener("dispose",A),D(L)}function U(j){const L=i.get(j);if(L.__webglInit===void 0)return;const Y=j.source,me=m.get(Y);if(me){const ye=me[L.__cacheKey];ye.usedTimes--,ye.usedTimes===0&&N(j),Object.keys(me).length===0&&m.delete(Y)}i.remove(j)}function N(j){const L=i.get(j);t.deleteTexture(L.__webglTexture);const Y=j.source,me=m.get(Y);delete me[L.__cacheKey],s.memory.textures--}function D(j){const L=i.get(j);if(j.depthTexture&&(j.depthTexture.dispose(),i.remove(j.depthTexture)),j.isWebGLCubeRenderTarget)for(let me=0;me<6;me++){if(Array.isArray(L.__webglFramebuffer[me]))for(let ye=0;ye<L.__webglFramebuffer[me].length;ye++)t.deleteFramebuffer(L.__webglFramebuffer[me][ye]);else t.deleteFramebuffer(L.__webglFramebuffer[me]);L.__webglDepthbuffer&&t.deleteRenderbuffer(L.__webglDepthbuffer[me])}else{if(Array.isArray(L.__webglFramebuffer))for(let me=0;me<L.__webglFramebuffer.length;me++)t.deleteFramebuffer(L.__webglFramebuffer[me]);else t.deleteFramebuffer(L.__webglFramebuffer);if(L.__webglDepthbuffer&&t.deleteRenderbuffer(L.__webglDepthbuffer),L.__webglMultisampledFramebuffer&&t.deleteFramebuffer(L.__webglMultisampledFramebuffer),L.__webglColorRenderbuffer)for(let me=0;me<L.__webglColorRenderbuffer.length;me++)L.__webglColorRenderbuffer[me]&&t.deleteRenderbuffer(L.__webglColorRenderbuffer[me]);L.__webglDepthRenderbuffer&&t.deleteRenderbuffer(L.__webglDepthRenderbuffer)}const Y=j.textures;for(let me=0,ye=Y.length;me<ye;me++){const pe=i.get(Y[me]);pe.__webglTexture&&(t.deleteTexture(pe.__webglTexture),s.memory.textures--),i.remove(Y[me])}i.remove(j)}let F=0;function I(){F=0}function W(){const j=F;return j>=r.maxTextures&&Gt("WebGLTextures: Trying to use "+j+" texture units while this GPU supports only "+r.maxTextures),F+=1,j}function O(j){const L=[];return L.push(j.wrapS),L.push(j.wrapT),L.push(j.wrapR||0),L.push(j.magFilter),L.push(j.minFilter),L.push(j.anisotropy),L.push(j.internalFormat),L.push(j.format),L.push(j.type),L.push(j.generateMipmaps),L.push(j.premultiplyAlpha),L.push(j.flipY),L.push(j.unpackAlignment),L.push(j.colorSpace),L.join()}function B(j,L){const Y=i.get(j);if(j.isVideoTexture&&De(j),j.isRenderTargetTexture===!1&&j.isExternalTexture!==!0&&j.version>0&&Y.__version!==j.version){const me=j.image;if(me===null)Gt("WebGLRenderer: Texture marked for update but no image data found.");else if(me.complete===!1)Gt("WebGLRenderer: Texture marked for update but image is incomplete");else{ne(Y,j,L);return}}else j.isExternalTexture&&(Y.__webglTexture=j.sourceTexture?j.sourceTexture:null);n.bindTexture(t.TEXTURE_2D,Y.__webglTexture,t.TEXTURE0+L)}function H(j,L){const Y=i.get(j);if(j.isRenderTargetTexture===!1&&j.version>0&&Y.__version!==j.version){ne(Y,j,L);return}else j.isExternalTexture&&(Y.__webglTexture=j.sourceTexture?j.sourceTexture:null);n.bindTexture(t.TEXTURE_2D_ARRAY,Y.__webglTexture,t.TEXTURE0+L)}function $(j,L){const Y=i.get(j);if(j.isRenderTargetTexture===!1&&j.version>0&&Y.__version!==j.version){ne(Y,j,L);return}n.bindTexture(t.TEXTURE_3D,Y.__webglTexture,t.TEXTURE0+L)}function K(j,L){const Y=i.get(j);if(j.version>0&&Y.__version!==j.version){ve(Y,j,L);return}n.bindTexture(t.TEXTURE_CUBE_MAP,Y.__webglTexture,t.TEXTURE0+L)}const Z={[ON]:t.REPEAT,[Kl]:t.CLAMP_TO_EDGE,[LN]:t.MIRRORED_REPEAT},se={[cs]:t.NEAREST,[Ice]:t.NEAREST_MIPMAP_NEAREST,[Ty]:t.NEAREST_MIPMAP_LINEAR,[zs]:t.LINEAR,[EA]:t.LINEAR_MIPMAP_NEAREST,[Yd]:t.LINEAR_MIPMAP_LINEAR},V={[zce]:t.NEVER,[Wce]:t.ALWAYS,[Bce]:t.LESS,[g9]:t.LEQUAL,[Hce]:t.EQUAL,[Gce]:t.GEQUAL,[Vce]:t.GREATER,[$ce]:t.NOTEQUAL};function X(j,L){if(L.type===Yl&&e.has("OES_texture_float_linear")===!1&&(L.magFilter===zs||L.magFilter===EA||L.magFilter===Ty||L.magFilter===Yd||L.minFilter===zs||L.minFilter===EA||L.minFilter===Ty||L.minFilter===Yd)&&Gt("WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),t.texParameteri(j,t.TEXTURE_WRAP_S,Z[L.wrapS]),t.texParameteri(j,t.TEXTURE_WRAP_T,Z[L.wrapT]),(j===t.TEXTURE_3D||j===t.TEXTURE_2D_ARRAY)&&t.texParameteri(j,t.TEXTURE_WRAP_R,Z[L.wrapR]),t.texParameteri(j,t.TEXTURE_MAG_FILTER,se[L.magFilter]),t.texParameteri(j,t.TEXTURE_MIN_FILTER,se[L.minFilter]),L.compareFunction&&(t.texParameteri(j,t.TEXTURE_COMPARE_MODE,t.COMPARE_REF_TO_TEXTURE),t.texParameteri(j,t.TEXTURE_COMPARE_FUNC,V[L.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(L.magFilter===cs||L.minFilter!==Ty&&L.minFilter!==Yd||L.type===Yl&&e.has("OES_texture_float_linear")===!1)return;if(L.anisotropy>1||i.get(L).__currentAnisotropy){const Y=e.get("EXT_texture_filter_anisotropic");t.texParameterf(j,Y.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(L.anisotropy,r.getMaxAnisotropy())),i.get(L).__currentAnisotropy=L.anisotropy}}}function ae(j,L){let Y=!1;j.__webglInit===void 0&&(j.__webglInit=!0,L.addEventListener("dispose",P));const me=L.source;let ye=m.get(me);ye===void 0&&(ye={},m.set(me,ye));const pe=O(L);if(pe!==j.__cacheKey){ye[pe]===void 0&&(ye[pe]={texture:t.createTexture(),usedTimes:0},s.memory.textures++,Y=!0),ye[pe].usedTimes++;const Ze=ye[j.__cacheKey];Ze!==void 0&&(ye[j.__cacheKey].usedTimes--,Ze.usedTimes===0&&N(L)),j.__cacheKey=pe,j.__webglTexture=ye[pe].texture}return Y}function ce(j,L,Y){return Math.floor(Math.floor(j/Y)/L)}function ge(j,L,Y,me){const pe=j.updateRanges;if(pe.length===0)n.texSubImage2D(t.TEXTURE_2D,0,0,0,L.width,L.height,Y,me,L.data);else{pe.sort((Ie,Re)=>Ie.start-Re.start);let Ze=0;for(let Ie=1;Ie<pe.length;Ie++){const Re=pe[Ze],pt=pe[Ie],nt=Re.start+Re.count,tt=ce(pt.start,L.width,4),ut=ce(Re.start,L.width,4);pt.start<=nt+1&&tt===ut&&ce(pt.start+pt.count-1,L.width,4)===tt?Re.count=Math.max(Re.count,pt.start+pt.count-Re.start):(++Ze,pe[Ze]=pt)}pe.length=Ze+1;const Le=t.getParameter(t.UNPACK_ROW_LENGTH),qe=t.getParameter(t.UNPACK_SKIP_PIXELS),at=t.getParameter(t.UNPACK_SKIP_ROWS);t.pixelStorei(t.UNPACK_ROW_LENGTH,L.width);for(let Ie=0,Re=pe.length;Ie<Re;Ie++){const pt=pe[Ie],nt=Math.floor(pt.start/4),tt=Math.ceil(pt.count/4),ut=nt%L.width,de=Math.floor(nt/L.width),it=tt,fe=1;t.pixelStorei(t.UNPACK_SKIP_PIXELS,ut),t.pixelStorei(t.UNPACK_SKIP_ROWS,de),n.texSubImage2D(t.TEXTURE_2D,0,ut,de,it,fe,Y,me,L.data)}j.clearUpdateRanges(),t.pixelStorei(t.UNPACK_ROW_LENGTH,Le),t.pixelStorei(t.UNPACK_SKIP_PIXELS,qe),t.pixelStorei(t.UNPACK_SKIP_ROWS,at)}}function ne(j,L,Y){let me=t.TEXTURE_2D;(L.isDataArrayTexture||L.isCompressedArrayTexture)&&(me=t.TEXTURE_2D_ARRAY),L.isData3DTexture&&(me=t.TEXTURE_3D);const ye=ae(j,L),pe=L.source;n.bindTexture(me,j.__webglTexture,t.TEXTURE0+Y);const Ze=i.get(pe);if(pe.version!==Ze.__version||ye===!0){n.activeTexture(t.TEXTURE0+Y);const Le=Mn.getPrimaries(Mn.workingColorSpace),qe=L.colorSpace===Mu?null:Mn.getPrimaries(L.colorSpace),at=L.colorSpace===Mu||Le===qe?t.NONE:t.BROWSER_DEFAULT_WEBGL;t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,L.flipY),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,L.premultiplyAlpha),t.pixelStorei(t.UNPACK_ALIGNMENT,L.unpackAlignment),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,at);let Ie=_(L.image,!1,r.maxTextureSize);Ie=Ne(L,Ie);const Re=a.convert(L.format,L.colorSpace),pt=a.convert(L.type);let nt=w(L.internalFormat,Re,pt,L.colorSpace,L.isVideoTexture);X(me,L);let tt;const ut=L.mipmaps,de=L.isVideoTexture!==!0,it=Ze.__version===void 0||ye===!0,fe=pe.dataReady,Oe=C(L,Ie);if(L.isDepthTexture)nt=T(L.format===V0,L.type),it&&(de?n.texStorage2D(t.TEXTURE_2D,1,nt,Ie.width,Ie.height):n.texImage2D(t.TEXTURE_2D,0,nt,Ie.width,Ie.height,0,Re,pt,null));else if(L.isDataTexture)if(ut.length>0){de&&it&&n.texStorage2D(t.TEXTURE_2D,Oe,nt,ut[0].width,ut[0].height);for(let Me=0,xe=ut.length;Me<xe;Me++)tt=ut[Me],de?fe&&n.texSubImage2D(t.TEXTURE_2D,Me,0,0,tt.width,tt.height,Re,pt,tt.data):n.texImage2D(t.TEXTURE_2D,Me,nt,tt.width,tt.height,0,Re,pt,tt.data);L.generateMipmaps=!1}else de?(it&&n.texStorage2D(t.TEXTURE_2D,Oe,nt,Ie.width,Ie.height),fe&&ge(L,Ie,Re,pt)):n.texImage2D(t.TEXTURE_2D,0,nt,Ie.width,Ie.height,0,Re,pt,Ie.data);else if(L.isCompressedTexture)if(L.isCompressedArrayTexture){de&&it&&n.texStorage3D(t.TEXTURE_2D_ARRAY,Oe,nt,ut[0].width,ut[0].height,Ie.depth);for(let Me=0,xe=ut.length;Me<xe;Me++)if(tt=ut[Me],L.format!==mo)if(Re!==null)if(de){if(fe)if(L.layerUpdates.size>0){const Be=MF(tt.width,tt.height,L.format,L.type);for(const ct of L.layerUpdates){const bt=tt.data.subarray(ct*Be/tt.data.BYTES_PER_ELEMENT,(ct+1)*Be/tt.data.BYTES_PER_ELEMENT);n.compressedTexSubImage3D(t.TEXTURE_2D_ARRAY,Me,0,0,ct,tt.width,tt.height,1,Re,bt)}L.clearLayerUpdates()}else n.compressedTexSubImage3D(t.TEXTURE_2D_ARRAY,Me,0,0,0,tt.width,tt.height,Ie.depth,Re,tt.data)}else n.compressedTexImage3D(t.TEXTURE_2D_ARRAY,Me,nt,tt.width,tt.height,Ie.depth,0,tt.data,0,0);else Gt("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else de?fe&&n.texSubImage3D(t.TEXTURE_2D_ARRAY,Me,0,0,0,tt.width,tt.height,Ie.depth,Re,pt,tt.data):n.texImage3D(t.TEXTURE_2D_ARRAY,Me,nt,tt.width,tt.height,Ie.depth,0,Re,pt,tt.data)}else{de&&it&&n.texStorage2D(t.TEXTURE_2D,Oe,nt,ut[0].width,ut[0].height);for(let Me=0,xe=ut.length;Me<xe;Me++)tt=ut[Me],L.format!==mo?Re!==null?de?fe&&n.compressedTexSubImage2D(t.TEXTURE_2D,Me,0,0,tt.width,tt.height,Re,tt.data):n.compressedTexImage2D(t.TEXTURE_2D,Me,nt,tt.width,tt.height,0,tt.data):Gt("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):de?fe&&n.texSubImage2D(t.TEXTURE_2D,Me,0,0,tt.width,tt.height,Re,pt,tt.data):n.texImage2D(t.TEXTURE_2D,Me,nt,tt.width,tt.height,0,Re,pt,tt.data)}else if(L.isDataArrayTexture)if(de){if(it&&n.texStorage3D(t.TEXTURE_2D_ARRAY,Oe,nt,Ie.width,Ie.height,Ie.depth),fe)if(L.layerUpdates.size>0){const Me=MF(Ie.width,Ie.height,L.format,L.type);for(const xe of L.layerUpdates){const Be=Ie.data.subarray(xe*Me/Ie.data.BYTES_PER_ELEMENT,(xe+1)*Me/Ie.data.BYTES_PER_ELEMENT);n.texSubImage3D(t.TEXTURE_2D_ARRAY,0,0,0,xe,Ie.width,Ie.height,1,Re,pt,Be)}L.clearLayerUpdates()}else n.texSubImage3D(t.TEXTURE_2D_ARRAY,0,0,0,0,Ie.width,Ie.height,Ie.depth,Re,pt,Ie.data)}else n.texImage3D(t.TEXTURE_2D_ARRAY,0,nt,Ie.width,Ie.height,Ie.depth,0,Re,pt,Ie.data);else if(L.isData3DTexture)de?(it&&n.texStorage3D(t.TEXTURE_3D,Oe,nt,Ie.width,Ie.height,Ie.depth),fe&&n.texSubImage3D(t.TEXTURE_3D,0,0,0,0,Ie.width,Ie.height,Ie.depth,Re,pt,Ie.data)):n.texImage3D(t.TEXTURE_3D,0,nt,Ie.width,Ie.height,Ie.depth,0,Re,pt,Ie.data);else if(L.isFramebufferTexture){if(it)if(de)n.texStorage2D(t.TEXTURE_2D,Oe,nt,Ie.width,Ie.height);else{let Me=Ie.width,xe=Ie.height;for(let Be=0;Be<Oe;Be++)n.texImage2D(t.TEXTURE_2D,Be,nt,Me,xe,0,Re,pt,null),Me>>=1,xe>>=1}}else if(ut.length>0){if(de&&it){const Me=te(ut[0]);n.texStorage2D(t.TEXTURE_2D,Oe,nt,Me.width,Me.height)}for(let Me=0,xe=ut.length;Me<xe;Me++)tt=ut[Me],de?fe&&n.texSubImage2D(t.TEXTURE_2D,Me,0,0,Re,pt,tt):n.texImage2D(t.TEXTURE_2D,Me,nt,Re,pt,tt);L.generateMipmaps=!1}else if(de){if(it){const Me=te(Ie);n.texStorage2D(t.TEXTURE_2D,Oe,nt,Me.width,Me.height)}fe&&n.texSubImage2D(t.TEXTURE_2D,0,0,0,Re,pt,Ie)}else n.texImage2D(t.TEXTURE_2D,0,nt,Re,pt,Ie);v(L)&&x(me),Ze.__version=pe.version,L.onUpdate&&L.onUpdate(L)}j.__version=L.version}function ve(j,L,Y){if(L.image.length!==6)return;const me=ae(j,L),ye=L.source;n.bindTexture(t.TEXTURE_CUBE_MAP,j.__webglTexture,t.TEXTURE0+Y);const pe=i.get(ye);if(ye.version!==pe.__version||me===!0){n.activeTexture(t.TEXTURE0+Y);const Ze=Mn.getPrimaries(Mn.workingColorSpace),Le=L.colorSpace===Mu?null:Mn.getPrimaries(L.colorSpace),qe=L.colorSpace===Mu||Ze===Le?t.NONE:t.BROWSER_DEFAULT_WEBGL;t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,L.flipY),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,L.premultiplyAlpha),t.pixelStorei(t.UNPACK_ALIGNMENT,L.unpackAlignment),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,qe);const at=L.isCompressedTexture||L.image[0].isCompressedTexture,Ie=L.image[0]&&L.image[0].isDataTexture,Re=[];for(let xe=0;xe<6;xe++)!at&&!Ie?Re[xe]=_(L.image[xe],!0,r.maxCubemapSize):Re[xe]=Ie?L.image[xe].image:L.image[xe],Re[xe]=Ne(L,Re[xe]);const pt=Re[0],nt=a.convert(L.format,L.colorSpace),tt=a.convert(L.type),ut=w(L.internalFormat,nt,tt,L.colorSpace),de=L.isVideoTexture!==!0,it=pe.__version===void 0||me===!0,fe=ye.dataReady;let Oe=C(L,pt);X(t.TEXTURE_CUBE_MAP,L);let Me;if(at){de&&it&&n.texStorage2D(t.TEXTURE_CUBE_MAP,Oe,ut,pt.width,pt.height);for(let xe=0;xe<6;xe++){Me=Re[xe].mipmaps;for(let Be=0;Be<Me.length;Be++){const ct=Me[Be];L.format!==mo?nt!==null?de?fe&&n.compressedTexSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+xe,Be,0,0,ct.width,ct.height,nt,ct.data):n.compressedTexImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+xe,Be,ut,ct.width,ct.height,0,ct.data):Gt("WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):de?fe&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+xe,Be,0,0,ct.width,ct.height,nt,tt,ct.data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+xe,Be,ut,ct.width,ct.height,0,nt,tt,ct.data)}}}else{if(Me=L.mipmaps,de&&it){Me.length>0&&Oe++;const xe=te(Re[0]);n.texStorage2D(t.TEXTURE_CUBE_MAP,Oe,ut,xe.width,xe.height)}for(let xe=0;xe<6;xe++)if(Ie){de?fe&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+xe,0,0,0,Re[xe].width,Re[xe].height,nt,tt,Re[xe].data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+xe,0,ut,Re[xe].width,Re[xe].height,0,nt,tt,Re[xe].data);for(let Be=0;Be<Me.length;Be++){const bt=Me[Be].image[xe].image;de?fe&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+xe,Be+1,0,0,bt.width,bt.height,nt,tt,bt.data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+xe,Be+1,ut,bt.width,bt.height,0,nt,tt,bt.data)}}else{de?fe&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+xe,0,0,0,nt,tt,Re[xe]):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+xe,0,ut,nt,tt,Re[xe]);for(let Be=0;Be<Me.length;Be++){const ct=Me[Be];de?fe&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+xe,Be+1,0,0,nt,tt,ct.image[xe]):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+xe,Be+1,ut,nt,tt,ct.image[xe])}}}v(L)&&x(t.TEXTURE_CUBE_MAP),pe.__version=ye.version,L.onUpdate&&L.onUpdate(L)}j.__version=L.version}function Pe(j,L,Y,me,ye,pe){const Ze=a.convert(Y.format,Y.colorSpace),Le=a.convert(Y.type),qe=w(Y.internalFormat,Ze,Le,Y.colorSpace),at=i.get(L),Ie=i.get(Y);if(Ie.__renderTarget=L,!at.__hasExternalTextures){const Re=Math.max(1,L.width>>pe),pt=Math.max(1,L.height>>pe);ye===t.TEXTURE_3D||ye===t.TEXTURE_2D_ARRAY?n.texImage3D(ye,pe,qe,Re,pt,L.depth,0,Ze,Le,null):n.texImage2D(ye,pe,qe,Re,pt,0,Ze,Le,null)}n.bindFramebuffer(t.FRAMEBUFFER,j),oe(L)?o.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,me,ye,Ie.__webglTexture,0,ee(L)):(ye===t.TEXTURE_2D||ye>=t.TEXTURE_CUBE_MAP_POSITIVE_X&&ye<=t.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&t.framebufferTexture2D(t.FRAMEBUFFER,me,ye,Ie.__webglTexture,pe),n.bindFramebuffer(t.FRAMEBUFFER,null)}function he(j,L,Y){if(t.bindRenderbuffer(t.RENDERBUFFER,j),L.depthBuffer){const me=L.depthTexture,ye=me&&me.isDepthTexture?me.type:null,pe=T(L.stencilBuffer,ye),Ze=L.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,Le=ee(L);oe(L)?o.renderbufferStorageMultisampleEXT(t.RENDERBUFFER,Le,pe,L.width,L.height):Y?t.renderbufferStorageMultisample(t.RENDERBUFFER,Le,pe,L.width,L.height):t.renderbufferStorage(t.RENDERBUFFER,pe,L.width,L.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,Ze,t.RENDERBUFFER,j)}else{const me=L.textures;for(let ye=0;ye<me.length;ye++){const pe=me[ye],Ze=a.convert(pe.format,pe.colorSpace),Le=a.convert(pe.type),qe=w(pe.internalFormat,Ze,Le,pe.colorSpace),at=ee(L);Y&&oe(L)===!1?t.renderbufferStorageMultisample(t.RENDERBUFFER,at,qe,L.width,L.height):oe(L)?o.renderbufferStorageMultisampleEXT(t.RENDERBUFFER,at,qe,L.width,L.height):t.renderbufferStorage(t.RENDERBUFFER,qe,L.width,L.height)}}t.bindRenderbuffer(t.RENDERBUFFER,null)}function we(j,L){if(L&&L.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(n.bindFramebuffer(t.FRAMEBUFFER,j),!(L.depthTexture&&L.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");const me=i.get(L.depthTexture);me.__renderTarget=L,(!me.__webglTexture||L.depthTexture.image.width!==L.width||L.depthTexture.image.height!==L.height)&&(L.depthTexture.image.width=L.width,L.depthTexture.image.height=L.height,L.depthTexture.needsUpdate=!0),B(L.depthTexture,0);const ye=me.__webglTexture,pe=ee(L);if(L.depthTexture.format===H0)oe(L)?o.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.TEXTURE_2D,ye,0,pe):t.framebufferTexture2D(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.TEXTURE_2D,ye,0);else if(L.depthTexture.format===V0)oe(L)?o.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.TEXTURE_2D,ye,0,pe):t.framebufferTexture2D(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.TEXTURE_2D,ye,0);else throw new Error("Unknown depthTexture format")}function je(j){const L=i.get(j),Y=j.isWebGLCubeRenderTarget===!0;if(L.__boundDepthTexture!==j.depthTexture){const me=j.depthTexture;if(L.__depthDisposeCallback&&L.__depthDisposeCallback(),me){const ye=()=>{delete L.__boundDepthTexture,delete L.__depthDisposeCallback,me.removeEventListener("dispose",ye)};me.addEventListener("dispose",ye),L.__depthDisposeCallback=ye}L.__boundDepthTexture=me}if(j.depthTexture&&!L.__autoAllocateDepthBuffer){if(Y)throw new Error("target.depthTexture not supported in Cube render targets");const me=j.texture.mipmaps;me&&me.length>0?we(L.__webglFramebuffer[0],j):we(L.__webglFramebuffer,j)}else if(Y){L.__webglDepthbuffer=[];for(let me=0;me<6;me++)if(n.bindFramebuffer(t.FRAMEBUFFER,L.__webglFramebuffer[me]),L.__webglDepthbuffer[me]===void 0)L.__webglDepthbuffer[me]=t.createRenderbuffer(),he(L.__webglDepthbuffer[me],j,!1);else{const ye=j.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,pe=L.__webglDepthbuffer[me];t.bindRenderbuffer(t.RENDERBUFFER,pe),t.framebufferRenderbuffer(t.FRAMEBUFFER,ye,t.RENDERBUFFER,pe)}}else{const me=j.texture.mipmaps;if(me&&me.length>0?n.bindFramebuffer(t.FRAMEBUFFER,L.__webglFramebuffer[0]):n.bindFramebuffer(t.FRAMEBUFFER,L.__webglFramebuffer),L.__webglDepthbuffer===void 0)L.__webglDepthbuffer=t.createRenderbuffer(),he(L.__webglDepthbuffer,j,!1);else{const ye=j.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,pe=L.__webglDepthbuffer;t.bindRenderbuffer(t.RENDERBUFFER,pe),t.framebufferRenderbuffer(t.FRAMEBUFFER,ye,t.RENDERBUFFER,pe)}}n.bindFramebuffer(t.FRAMEBUFFER,null)}function ue(j,L,Y){const me=i.get(j);L!==void 0&&Pe(me.__webglFramebuffer,j,j.texture,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,0),Y!==void 0&&je(j)}function lt(j){const L=j.texture,Y=i.get(j),me=i.get(L);j.addEventListener("dispose",A);const ye=j.textures,pe=j.isWebGLCubeRenderTarget===!0,Ze=ye.length>1;if(Ze||(me.__webglTexture===void 0&&(me.__webglTexture=t.createTexture()),me.__version=L.version,s.memory.textures++),pe){Y.__webglFramebuffer=[];for(let Le=0;Le<6;Le++)if(L.mipmaps&&L.mipmaps.length>0){Y.__webglFramebuffer[Le]=[];for(let qe=0;qe<L.mipmaps.length;qe++)Y.__webglFramebuffer[Le][qe]=t.createFramebuffer()}else Y.__webglFramebuffer[Le]=t.createFramebuffer()}else{if(L.mipmaps&&L.mipmaps.length>0){Y.__webglFramebuffer=[];for(let Le=0;Le<L.mipmaps.length;Le++)Y.__webglFramebuffer[Le]=t.createFramebuffer()}else Y.__webglFramebuffer=t.createFramebuffer();if(Ze)for(let Le=0,qe=ye.length;Le<qe;Le++){const at=i.get(ye[Le]);at.__webglTexture===void 0&&(at.__webglTexture=t.createTexture(),s.memory.textures++)}if(j.samples>0&&oe(j)===!1){Y.__webglMultisampledFramebuffer=t.createFramebuffer(),Y.__webglColorRenderbuffer=[],n.bindFramebuffer(t.FRAMEBUFFER,Y.__webglMultisampledFramebuffer);for(let Le=0;Le<ye.length;Le++){const qe=ye[Le];Y.__webglColorRenderbuffer[Le]=t.createRenderbuffer(),t.bindRenderbuffer(t.RENDERBUFFER,Y.__webglColorRenderbuffer[Le]);const at=a.convert(qe.format,qe.colorSpace),Ie=a.convert(qe.type),Re=w(qe.internalFormat,at,Ie,qe.colorSpace,j.isXRRenderTarget===!0),pt=ee(j);t.renderbufferStorageMultisample(t.RENDERBUFFER,pt,Re,j.width,j.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+Le,t.RENDERBUFFER,Y.__webglColorRenderbuffer[Le])}t.bindRenderbuffer(t.RENDERBUFFER,null),j.depthBuffer&&(Y.__webglDepthRenderbuffer=t.createRenderbuffer(),he(Y.__webglDepthRenderbuffer,j,!0)),n.bindFramebuffer(t.FRAMEBUFFER,null)}}if(pe){n.bindTexture(t.TEXTURE_CUBE_MAP,me.__webglTexture),X(t.TEXTURE_CUBE_MAP,L);for(let Le=0;Le<6;Le++)if(L.mipmaps&&L.mipmaps.length>0)for(let qe=0;qe<L.mipmaps.length;qe++)Pe(Y.__webglFramebuffer[Le][qe],j,L,t.COLOR_ATTACHMENT0,t.TEXTURE_CUBE_MAP_POSITIVE_X+Le,qe);else Pe(Y.__webglFramebuffer[Le],j,L,t.COLOR_ATTACHMENT0,t.TEXTURE_CUBE_MAP_POSITIVE_X+Le,0);v(L)&&x(t.TEXTURE_CUBE_MAP),n.unbindTexture()}else if(Ze){for(let Le=0,qe=ye.length;Le<qe;Le++){const at=ye[Le],Ie=i.get(at);let Re=t.TEXTURE_2D;(j.isWebGL3DRenderTarget||j.isWebGLArrayRenderTarget)&&(Re=j.isWebGL3DRenderTarget?t.TEXTURE_3D:t.TEXTURE_2D_ARRAY),n.bindTexture(Re,Ie.__webglTexture),X(Re,at),Pe(Y.__webglFramebuffer,j,at,t.COLOR_ATTACHMENT0+Le,Re,0),v(at)&&x(Re)}n.unbindTexture()}else{let Le=t.TEXTURE_2D;if((j.isWebGL3DRenderTarget||j.isWebGLArrayRenderTarget)&&(Le=j.isWebGL3DRenderTarget?t.TEXTURE_3D:t.TEXTURE_2D_ARRAY),n.bindTexture(Le,me.__webglTexture),X(Le,L),L.mipmaps&&L.mipmaps.length>0)for(let qe=0;qe<L.mipmaps.length;qe++)Pe(Y.__webglFramebuffer[qe],j,L,t.COLOR_ATTACHMENT0,Le,qe);else Pe(Y.__webglFramebuffer,j,L,t.COLOR_ATTACHMENT0,Le,0);v(L)&&x(Le),n.unbindTexture()}j.depthBuffer&&je(j)}function z(j){const L=j.textures;for(let Y=0,me=L.length;Y<me;Y++){const ye=L[Y];if(v(ye)){const pe=M(j),Ze=i.get(ye).__webglTexture;n.bindTexture(pe,Ze),x(pe),n.unbindTexture()}}}const q=[],re=[];function J(j){if(j.samples>0){if(oe(j)===!1){const L=j.textures,Y=j.width,me=j.height;let ye=t.COLOR_BUFFER_BIT;const pe=j.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,Ze=i.get(j),Le=L.length>1;if(Le)for(let at=0;at<L.length;at++)n.bindFramebuffer(t.FRAMEBUFFER,Ze.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+at,t.RENDERBUFFER,null),n.bindFramebuffer(t.FRAMEBUFFER,Ze.__webglFramebuffer),t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0+at,t.TEXTURE_2D,null,0);n.bindFramebuffer(t.READ_FRAMEBUFFER,Ze.__webglMultisampledFramebuffer);const qe=j.texture.mipmaps;qe&&qe.length>0?n.bindFramebuffer(t.DRAW_FRAMEBUFFER,Ze.__webglFramebuffer[0]):n.bindFramebuffer(t.DRAW_FRAMEBUFFER,Ze.__webglFramebuffer);for(let at=0;at<L.length;at++){if(j.resolveDepthBuffer&&(j.depthBuffer&&(ye|=t.DEPTH_BUFFER_BIT),j.stencilBuffer&&j.resolveStencilBuffer&&(ye|=t.STENCIL_BUFFER_BIT)),Le){t.framebufferRenderbuffer(t.READ_FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.RENDERBUFFER,Ze.__webglColorRenderbuffer[at]);const Ie=i.get(L[at]).__webglTexture;t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,Ie,0)}t.blitFramebuffer(0,0,Y,me,0,0,Y,me,ye,t.NEAREST),l===!0&&(q.length=0,re.length=0,q.push(t.COLOR_ATTACHMENT0+at),j.depthBuffer&&j.resolveDepthBuffer===!1&&(q.push(pe),re.push(pe),t.invalidateFramebuffer(t.DRAW_FRAMEBUFFER,re)),t.invalidateFramebuffer(t.READ_FRAMEBUFFER,q))}if(n.bindFramebuffer(t.READ_FRAMEBUFFER,null),n.bindFramebuffer(t.DRAW_FRAMEBUFFER,null),Le)for(let at=0;at<L.length;at++){n.bindFramebuffer(t.FRAMEBUFFER,Ze.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+at,t.RENDERBUFFER,Ze.__webglColorRenderbuffer[at]);const Ie=i.get(L[at]).__webglTexture;n.bindFramebuffer(t.FRAMEBUFFER,Ze.__webglFramebuffer),t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0+at,t.TEXTURE_2D,Ie,0)}n.bindFramebuffer(t.DRAW_FRAMEBUFFER,Ze.__webglMultisampledFramebuffer)}else if(j.depthBuffer&&j.resolveDepthBuffer===!1&&l){const L=j.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT;t.invalidateFramebuffer(t.DRAW_FRAMEBUFFER,[L])}}}function ee(j){return Math.min(r.maxSamples,j.samples)}function oe(j){const L=i.get(j);return j.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&L.__useRenderToTexture!==!1}function De(j){const L=s.render.frame;d.get(j)!==L&&(d.set(j,L),j.update())}function Ne(j,L){const Y=j.colorSpace,me=j.format,ye=j.type;return j.isCompressedTexture===!0||j.isVideoTexture===!0||Y!==zp&&Y!==Mu&&(Mn.getTransfer(Y)===zn?(me!==mo||ye!==Qo)&&Gt("WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):Di("WebGLTextures: Unsupported texture color space:",Y)),L}function te(j){return typeof HTMLImageElement<"u"&&j instanceof HTMLImageElement?(c.width=j.naturalWidth||j.width,c.height=j.naturalHeight||j.height):typeof VideoFrame<"u"&&j instanceof VideoFrame?(c.width=j.displayWidth,c.height=j.displayHeight):(c.width=j.width,c.height=j.height),c}this.allocateTextureUnit=W,this.resetTextureUnits=I,this.setTexture2D=B,this.setTexture2DArray=H,this.setTexture3D=$,this.setTextureCube=K,this.rebindTextures=ue,this.setupRenderTarget=lt,this.updateRenderTargetMipmap=z,this.updateMultisampleRenderTarget=J,this.setupDepthRenderbuffer=je,this.setupFrameBufferTexture=Pe,this.useMultisampledRTT=oe}function hme(t,e){function n(i,r=Mu){let a;const s=Mn.getTransfer(r);if(i===Qo)return t.UNSIGNED_BYTE;if(i===LP)return t.UNSIGNED_SHORT_4_4_4_4;if(i===IP)return t.UNSIGNED_SHORT_5_5_5_1;if(i===u9)return t.UNSIGNED_INT_5_9_9_9_REV;if(i===d9)return t.UNSIGNED_INT_10F_11F_11F_REV;if(i===l9)return t.BYTE;if(i===c9)return t.SHORT;if(i===z0)return t.UNSIGNED_SHORT;if(i===OP)return t.INT;if(i===Sf)return t.UNSIGNED_INT;if(i===Yl)return t.FLOAT;if(i===hm)return t.HALF_FLOAT;if(i===f9)return t.ALPHA;if(i===h9)return t.RGB;if(i===mo)return t.RGBA;if(i===H0)return t.DEPTH_COMPONENT;if(i===V0)return t.DEPTH_STENCIL;if(i===p9)return t.RED;if(i===UP)return t.RED_INTEGER;if(i===jP)return t.RG;if(i===FP)return t.RG_INTEGER;if(i===zP)return t.RGBA_INTEGER;if(i===s_||i===o_||i===l_||i===c_)if(s===zn)if(a=e.get("WEBGL_compressed_texture_s3tc_srgb"),a!==null){if(i===s_)return a.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(i===o_)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(i===l_)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(i===c_)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(a=e.get("WEBGL_compressed_texture_s3tc"),a!==null){if(i===s_)return a.COMPRESSED_RGB_S3TC_DXT1_EXT;if(i===o_)return a.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(i===l_)return a.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(i===c_)return a.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(i===IN||i===UN||i===jN||i===FN)if(a=e.get("WEBGL_compressed_texture_pvrtc"),a!==null){if(i===IN)return a.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(i===UN)return a.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(i===jN)return a.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(i===FN)return a.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(i===zN||i===BN||i===HN)if(a=e.get("WEBGL_compressed_texture_etc"),a!==null){if(i===zN||i===BN)return s===zn?a.COMPRESSED_SRGB8_ETC2:a.COMPRESSED_RGB8_ETC2;if(i===HN)return s===zn?a.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:a.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(i===VN||i===$N||i===GN||i===WN||i===qN||i===XN||i===KN||i===YN||i===ZN||i===QN||i===JN||i===e3||i===t3||i===n3)if(a=e.get("WEBGL_compressed_texture_astc"),a!==null){if(i===VN)return s===zn?a.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:a.COMPRESSED_RGBA_ASTC_4x4_KHR;if(i===$N)return s===zn?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:a.COMPRESSED_RGBA_ASTC_5x4_KHR;if(i===GN)return s===zn?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:a.COMPRESSED_RGBA_ASTC_5x5_KHR;if(i===WN)return s===zn?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:a.COMPRESSED_RGBA_ASTC_6x5_KHR;if(i===qN)return s===zn?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:a.COMPRESSED_RGBA_ASTC_6x6_KHR;if(i===XN)return s===zn?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:a.COMPRESSED_RGBA_ASTC_8x5_KHR;if(i===KN)return s===zn?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:a.COMPRESSED_RGBA_ASTC_8x6_KHR;if(i===YN)return s===zn?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:a.COMPRESSED_RGBA_ASTC_8x8_KHR;if(i===ZN)return s===zn?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:a.COMPRESSED_RGBA_ASTC_10x5_KHR;if(i===QN)return s===zn?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:a.COMPRESSED_RGBA_ASTC_10x6_KHR;if(i===JN)return s===zn?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:a.COMPRESSED_RGBA_ASTC_10x8_KHR;if(i===e3)return s===zn?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:a.COMPRESSED_RGBA_ASTC_10x10_KHR;if(i===t3)return s===zn?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:a.COMPRESSED_RGBA_ASTC_12x10_KHR;if(i===n3)return s===zn?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:a.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(i===i3||i===r3||i===a3)if(a=e.get("EXT_texture_compression_bptc"),a!==null){if(i===i3)return s===zn?a.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:a.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(i===r3)return a.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(i===a3)return a.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(i===s3||i===o3||i===l3||i===c3)if(a=e.get("EXT_texture_compression_rgtc"),a!==null){if(i===s3)return a.COMPRESSED_RED_RGTC1_EXT;if(i===o3)return a.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(i===l3)return a.COMPRESSED_RED_GREEN_RGTC2_EXT;if(i===c3)return a.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return i===B0?t.UNSIGNED_INT_24_8:t[i]!==void 0?t[i]:null}return{convert:n}}const pme=`
  3825. void main() {
  3826. gl_Position = vec4( position, 1.0 );
  3827. }`,mme=`
  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 gme{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,n){if(this.texture===null){const i=new L9(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 pc({vertexShader:pme,fragmentShader:mme,uniforms:{depthColor:{value:this.texture},depthWidth:{value:n.z},depthHeight:{value:n.w}}});this.mesh=new Jo(new WP(20,20),i)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}let xme=class extends Bf{constructor(e,n){super();const i=this;let r=null,a=1,s=null,o="local-floor",l=1,c=null,d=null,f=null,m=null,g=null,y=null;const _=typeof XRWebGLBinding<"u",v=new gme,x={},M=n.getContextAttributes();let w=null,T=null;const C=[],P=[],A=new an;let U=null;const N=new Ls;N.viewport=new Vi;const D=new Ls;D.viewport=new Vi;const F=[N,D],I=new Oue;let W=null,O=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(ne){let ve=C[ne];return ve===void 0&&(ve=new qA,C[ne]=ve),ve.getTargetRaySpace()},this.getControllerGrip=function(ne){let ve=C[ne];return ve===void 0&&(ve=new qA,C[ne]=ve),ve.getGripSpace()},this.getHand=function(ne){let ve=C[ne];return ve===void 0&&(ve=new qA,C[ne]=ve),ve.getHandSpace()};function B(ne){const ve=P.indexOf(ne.inputSource);if(ve===-1)return;const Pe=C[ve];Pe!==void 0&&(Pe.update(ne.inputSource,ne.frame,c||s),Pe.dispatchEvent({type:ne.type,data:ne.inputSource}))}function H(){r.removeEventListener("select",B),r.removeEventListener("selectstart",B),r.removeEventListener("selectend",B),r.removeEventListener("squeeze",B),r.removeEventListener("squeezestart",B),r.removeEventListener("squeezeend",B),r.removeEventListener("end",H),r.removeEventListener("inputsourceschange",$);for(let ne=0;ne<C.length;ne++){const ve=P[ne];ve!==null&&(P[ne]=null,C[ne].disconnect(ve))}W=null,O=null,v.reset();for(const ne in x)delete x[ne];e.setRenderTarget(w),g=null,m=null,f=null,r=null,T=null,ge.stop(),i.isPresenting=!1,e.setPixelRatio(U),e.setSize(A.width,A.height,!1),i.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(ne){a=ne,i.isPresenting===!0&&Gt("WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(ne){o=ne,i.isPresenting===!0&&Gt("WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return c||s},this.setReferenceSpace=function(ne){c=ne},this.getBaseLayer=function(){return m!==null?m:g},this.getBinding=function(){return f===null&&_&&(f=new XRWebGLBinding(r,n)),f},this.getFrame=function(){return y},this.getSession=function(){return r},this.setSession=async function(ne){if(r=ne,r!==null){if(w=e.getRenderTarget(),r.addEventListener("select",B),r.addEventListener("selectstart",B),r.addEventListener("selectend",B),r.addEventListener("squeeze",B),r.addEventListener("squeezestart",B),r.addEventListener("squeezeend",B),r.addEventListener("end",H),r.addEventListener("inputsourceschange",$),M.xrCompatible!==!0&&await n.makeXRCompatible(),U=e.getPixelRatio(),e.getSize(A),_&&"createProjectionLayer"in XRWebGLBinding.prototype){let Pe=null,he=null,we=null;M.depth&&(we=M.stencil?n.DEPTH24_STENCIL8:n.DEPTH_COMPONENT24,Pe=M.stencil?V0:H0,he=M.stencil?B0:Sf);const je={colorFormat:n.RGBA8,depthFormat:we,scaleFactor:a};f=this.getBinding(),m=f.createProjectionLayer(je),r.updateRenderState({layers:[m]}),e.setPixelRatio(1),e.setSize(m.textureWidth,m.textureHeight,!1),T=new Mf(m.textureWidth,m.textureHeight,{format:mo,type:Qo,depthTexture:new O9(m.textureWidth,m.textureHeight,he,void 0,void 0,void 0,void 0,void 0,void 0,Pe),stencilBuffer:M.stencil,colorSpace:e.outputColorSpace,samples:M.antialias?4:0,resolveDepthBuffer:m.ignoreDepthValues===!1,resolveStencilBuffer:m.ignoreDepthValues===!1})}else{const Pe={antialias:M.antialias,alpha:!0,depth:M.depth,stencil:M.stencil,framebufferScaleFactor:a};g=new XRWebGLLayer(r,n,Pe),r.updateRenderState({baseLayer:g}),e.setPixelRatio(1),e.setSize(g.framebufferWidth,g.framebufferHeight,!1),T=new Mf(g.framebufferWidth,g.framebufferHeight,{format:mo,type:Qo,colorSpace:e.outputColorSpace,stencilBuffer:M.stencil,resolveDepthBuffer:g.ignoreDepthValues===!1,resolveStencilBuffer:g.ignoreDepthValues===!1})}T.isXRRenderTarget=!0,this.setFoveation(l),c=null,s=await r.requestReferenceSpace(o),ge.setContext(r),ge.start(),i.isPresenting=!0,i.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(r!==null)return r.environmentBlendMode},this.getDepthTexture=function(){return v.getDepthTexture()};function $(ne){for(let ve=0;ve<ne.removed.length;ve++){const Pe=ne.removed[ve],he=P.indexOf(Pe);he>=0&&(P[he]=null,C[he].disconnect(Pe))}for(let ve=0;ve<ne.added.length;ve++){const Pe=ne.added[ve];let he=P.indexOf(Pe);if(he===-1){for(let je=0;je<C.length;je++)if(je>=P.length){P.push(Pe),he=je;break}else if(P[je]===null){P[je]=Pe,he=je;break}if(he===-1)break}const we=C[he];we&&we.connect(Pe)}}const K=new $e,Z=new $e;function se(ne,ve,Pe){K.setFromMatrixPosition(ve.matrixWorld),Z.setFromMatrixPosition(Pe.matrixWorld);const he=K.distanceTo(Z),we=ve.projectionMatrix.elements,je=Pe.projectionMatrix.elements,ue=we[14]/(we[10]-1),lt=we[14]/(we[10]+1),z=(we[9]+1)/we[5],q=(we[9]-1)/we[5],re=(we[8]-1)/we[0],J=(je[8]+1)/je[0],ee=ue*re,oe=ue*J,De=he/(-re+J),Ne=De*-re;if(ve.matrixWorld.decompose(ne.position,ne.quaternion,ne.scale),ne.translateX(Ne),ne.translateZ(De),ne.matrixWorld.compose(ne.position,ne.quaternion,ne.scale),ne.matrixWorldInverse.copy(ne.matrixWorld).invert(),we[10]===-1)ne.projectionMatrix.copy(ve.projectionMatrix),ne.projectionMatrixInverse.copy(ve.projectionMatrixInverse);else{const te=ue+De,j=lt+De,L=ee-Ne,Y=oe+(he-Ne),me=z*lt/j*te,ye=q*lt/j*te;ne.projectionMatrix.makePerspective(L,Y,me,ye,te,j),ne.projectionMatrixInverse.copy(ne.projectionMatrix).invert()}}function V(ne,ve){ve===null?ne.matrixWorld.copy(ne.matrix):ne.matrixWorld.multiplyMatrices(ve.matrixWorld,ne.matrix),ne.matrixWorldInverse.copy(ne.matrixWorld).invert()}this.updateCamera=function(ne){if(r===null)return;let ve=ne.near,Pe=ne.far;v.texture!==null&&(v.depthNear>0&&(ve=v.depthNear),v.depthFar>0&&(Pe=v.depthFar)),I.near=D.near=N.near=ve,I.far=D.far=N.far=Pe,(W!==I.near||O!==I.far)&&(r.updateRenderState({depthNear:I.near,depthFar:I.far}),W=I.near,O=I.far),I.layers.mask=ne.layers.mask|6,N.layers.mask=I.layers.mask&3,D.layers.mask=I.layers.mask&5;const he=ne.parent,we=I.cameras;V(I,he);for(let je=0;je<we.length;je++)V(we[je],he);we.length===2?se(I,N,D):I.projectionMatrix.copy(N.projectionMatrix),X(ne,I,he)};function X(ne,ve,Pe){Pe===null?ne.matrix.copy(ve.matrixWorld):(ne.matrix.copy(Pe.matrixWorld),ne.matrix.invert(),ne.matrix.multiply(ve.matrixWorld)),ne.matrix.decompose(ne.position,ne.quaternion,ne.scale),ne.updateMatrixWorld(!0),ne.projectionMatrix.copy(ve.projectionMatrix),ne.projectionMatrixInverse.copy(ve.projectionMatrixInverse),ne.isPerspectiveCamera&&(ne.fov=u3*2*Math.atan(1/ne.projectionMatrix.elements[5]),ne.zoom=1)}this.getCamera=function(){return I},this.getFoveation=function(){if(!(m===null&&g===null))return l},this.setFoveation=function(ne){l=ne,m!==null&&(m.fixedFoveation=ne),g!==null&&g.fixedFoveation!==void 0&&(g.fixedFoveation=ne)},this.hasDepthSensing=function(){return v.texture!==null},this.getDepthSensingMesh=function(){return v.getMesh(I)},this.getCameraTexture=function(ne){return x[ne]};let ae=null;function ce(ne,ve){if(d=ve.getViewerPose(c||s),y=ve,d!==null){const Pe=d.views;g!==null&&(e.setRenderTargetFramebuffer(T,g.framebuffer),e.setRenderTarget(T));let he=!1;Pe.length!==I.cameras.length&&(I.cameras.length=0,he=!0);for(let lt=0;lt<Pe.length;lt++){const z=Pe[lt];let q=null;if(g!==null)q=g.getViewport(z);else{const J=f.getViewSubImage(m,z);q=J.viewport,lt===0&&(e.setRenderTargetTextures(T,J.colorTexture,J.depthStencilTexture),e.setRenderTarget(T))}let re=F[lt];re===void 0&&(re=new Ls,re.layers.enable(lt),re.viewport=new Vi,F[lt]=re),re.matrix.fromArray(z.transform.matrix),re.matrix.decompose(re.position,re.quaternion,re.scale),re.projectionMatrix.fromArray(z.projectionMatrix),re.projectionMatrixInverse.copy(re.projectionMatrix).invert(),re.viewport.set(q.x,q.y,q.width,q.height),lt===0&&(I.matrix.copy(re.matrix),I.matrix.decompose(I.position,I.quaternion,I.scale)),he===!0&&I.cameras.push(re)}const we=r.enabledFeatures;if(we&&we.includes("depth-sensing")&&r.depthUsage=="gpu-optimized"&&_){f=i.getBinding();const lt=f.getDepthInformation(Pe[0]);lt&&lt.isValid&&lt.texture&&v.init(lt,r.renderState)}if(we&&we.includes("camera-access")&&_){e.state.unbindTexture(),f=i.getBinding();for(let lt=0;lt<Pe.length;lt++){const z=Pe[lt].camera;if(z){let q=x[z];q||(q=new L9,x[z]=q);const re=f.getCameraImage(z);q.sourceTexture=re}}}}for(let Pe=0;Pe<C.length;Pe++){const he=P[Pe],we=C[Pe];he!==null&&we!==void 0&&we.update(he,ve,c||s)}ae&&ae(ne,ve),ve.detectedPlanes&&i.dispatchEvent({type:"planesdetected",data:ve}),y=null}const ge=new F9;ge.setAnimationLoop(ce),this.setAnimationLoop=function(ne){ae=ne},this.dispose=function(){}}};const Dd=new Wu,vme=new qi;function yme(t,e){function n(v,x){v.matrixAutoUpdate===!0&&v.updateMatrix(),x.value.copy(v.matrix)}function i(v,x){x.color.getRGB(v.fogColor.value,R9(t)),x.isFog?(v.fogNear.value=x.near,v.fogFar.value=x.far):x.isFogExp2&&(v.fogDensity.value=x.density)}function r(v,x,M,w,T){x.isMeshBasicMaterial||x.isMeshLambertMaterial?a(v,x):x.isMeshToonMaterial?(a(v,x),f(v,x)):x.isMeshPhongMaterial?(a(v,x),d(v,x)):x.isMeshStandardMaterial?(a(v,x),m(v,x),x.isMeshPhysicalMaterial&&g(v,x,T)):x.isMeshMatcapMaterial?(a(v,x),y(v,x)):x.isMeshDepthMaterial?a(v,x):x.isMeshDistanceMaterial?(a(v,x),_(v,x)):x.isMeshNormalMaterial?a(v,x):x.isLineBasicMaterial?(s(v,x),x.isLineDashedMaterial&&o(v,x)):x.isPointsMaterial?l(v,x,M,w):x.isSpriteMaterial?c(v,x):x.isShadowMaterial?(v.color.value.copy(x.color),v.opacity.value=x.opacity):x.isShaderMaterial&&(x.uniformsNeedUpdate=!1)}function a(v,x){v.opacity.value=x.opacity,x.color&&v.diffuse.value.copy(x.color),x.emissive&&v.emissive.value.copy(x.emissive).multiplyScalar(x.emissiveIntensity),x.map&&(v.map.value=x.map,n(x.map,v.mapTransform)),x.alphaMap&&(v.alphaMap.value=x.alphaMap,n(x.alphaMap,v.alphaMapTransform)),x.bumpMap&&(v.bumpMap.value=x.bumpMap,n(x.bumpMap,v.bumpMapTransform),v.bumpScale.value=x.bumpScale,x.side===Ia&&(v.bumpScale.value*=-1)),x.normalMap&&(v.normalMap.value=x.normalMap,n(x.normalMap,v.normalMapTransform),v.normalScale.value.copy(x.normalScale),x.side===Ia&&v.normalScale.value.negate()),x.displacementMap&&(v.displacementMap.value=x.displacementMap,n(x.displacementMap,v.displacementMapTransform),v.displacementScale.value=x.displacementScale,v.displacementBias.value=x.displacementBias),x.emissiveMap&&(v.emissiveMap.value=x.emissiveMap,n(x.emissiveMap,v.emissiveMapTransform)),x.specularMap&&(v.specularMap.value=x.specularMap,n(x.specularMap,v.specularMapTransform)),x.alphaTest>0&&(v.alphaTest.value=x.alphaTest);const M=e.get(x),w=M.envMap,T=M.envMapRotation;w&&(v.envMap.value=w,Dd.copy(T),Dd.x*=-1,Dd.y*=-1,Dd.z*=-1,w.isCubeTexture&&w.isRenderTargetTexture===!1&&(Dd.y*=-1,Dd.z*=-1),v.envMapRotation.value.setFromMatrix4(vme.makeRotationFromEuler(Dd)),v.flipEnvMap.value=w.isCubeTexture&&w.isRenderTargetTexture===!1?-1:1,v.reflectivity.value=x.reflectivity,v.ior.value=x.ior,v.refractionRatio.value=x.refractionRatio),x.lightMap&&(v.lightMap.value=x.lightMap,v.lightMapIntensity.value=x.lightMapIntensity,n(x.lightMap,v.lightMapTransform)),x.aoMap&&(v.aoMap.value=x.aoMap,v.aoMapIntensity.value=x.aoMapIntensity,n(x.aoMap,v.aoMapTransform))}function s(v,x){v.diffuse.value.copy(x.color),v.opacity.value=x.opacity,x.map&&(v.map.value=x.map,n(x.map,v.mapTransform))}function o(v,x){v.dashSize.value=x.dashSize,v.totalSize.value=x.dashSize+x.gapSize,v.scale.value=x.scale}function l(v,x,M,w){v.diffuse.value.copy(x.color),v.opacity.value=x.opacity,v.size.value=x.size*M,v.scale.value=w*.5,x.map&&(v.map.value=x.map,n(x.map,v.uvTransform)),x.alphaMap&&(v.alphaMap.value=x.alphaMap,n(x.alphaMap,v.alphaMapTransform)),x.alphaTest>0&&(v.alphaTest.value=x.alphaTest)}function c(v,x){v.diffuse.value.copy(x.color),v.opacity.value=x.opacity,v.rotation.value=x.rotation,x.map&&(v.map.value=x.map,n(x.map,v.mapTransform)),x.alphaMap&&(v.alphaMap.value=x.alphaMap,n(x.alphaMap,v.alphaMapTransform)),x.alphaTest>0&&(v.alphaTest.value=x.alphaTest)}function d(v,x){v.specular.value.copy(x.specular),v.shininess.value=Math.max(x.shininess,1e-4)}function f(v,x){x.gradientMap&&(v.gradientMap.value=x.gradientMap)}function m(v,x){v.metalness.value=x.metalness,x.metalnessMap&&(v.metalnessMap.value=x.metalnessMap,n(x.metalnessMap,v.metalnessMapTransform)),v.roughness.value=x.roughness,x.roughnessMap&&(v.roughnessMap.value=x.roughnessMap,n(x.roughnessMap,v.roughnessMapTransform)),x.envMap&&(v.envMapIntensity.value=x.envMapIntensity)}function g(v,x,M){v.ior.value=x.ior,x.sheen>0&&(v.sheenColor.value.copy(x.sheenColor).multiplyScalar(x.sheen),v.sheenRoughness.value=x.sheenRoughness,x.sheenColorMap&&(v.sheenColorMap.value=x.sheenColorMap,n(x.sheenColorMap,v.sheenColorMapTransform)),x.sheenRoughnessMap&&(v.sheenRoughnessMap.value=x.sheenRoughnessMap,n(x.sheenRoughnessMap,v.sheenRoughnessMapTransform))),x.clearcoat>0&&(v.clearcoat.value=x.clearcoat,v.clearcoatRoughness.value=x.clearcoatRoughness,x.clearcoatMap&&(v.clearcoatMap.value=x.clearcoatMap,n(x.clearcoatMap,v.clearcoatMapTransform)),x.clearcoatRoughnessMap&&(v.clearcoatRoughnessMap.value=x.clearcoatRoughnessMap,n(x.clearcoatRoughnessMap,v.clearcoatRoughnessMapTransform)),x.clearcoatNormalMap&&(v.clearcoatNormalMap.value=x.clearcoatNormalMap,n(x.clearcoatNormalMap,v.clearcoatNormalMapTransform),v.clearcoatNormalScale.value.copy(x.clearcoatNormalScale),x.side===Ia&&v.clearcoatNormalScale.value.negate())),x.dispersion>0&&(v.dispersion.value=x.dispersion),x.iridescence>0&&(v.iridescence.value=x.iridescence,v.iridescenceIOR.value=x.iridescenceIOR,v.iridescenceThicknessMinimum.value=x.iridescenceThicknessRange[0],v.iridescenceThicknessMaximum.value=x.iridescenceThicknessRange[1],x.iridescenceMap&&(v.iridescenceMap.value=x.iridescenceMap,n(x.iridescenceMap,v.iridescenceMapTransform)),x.iridescenceThicknessMap&&(v.iridescenceThicknessMap.value=x.iridescenceThicknessMap,n(x.iridescenceThicknessMap,v.iridescenceThicknessMapTransform))),x.transmission>0&&(v.transmission.value=x.transmission,v.transmissionSamplerMap.value=M.texture,v.transmissionSamplerSize.value.set(M.width,M.height),x.transmissionMap&&(v.transmissionMap.value=x.transmissionMap,n(x.transmissionMap,v.transmissionMapTransform)),v.thickness.value=x.thickness,x.thicknessMap&&(v.thicknessMap.value=x.thicknessMap,n(x.thicknessMap,v.thicknessMapTransform)),v.attenuationDistance.value=x.attenuationDistance,v.attenuationColor.value.copy(x.attenuationColor)),x.anisotropy>0&&(v.anisotropyVector.value.set(x.anisotropy*Math.cos(x.anisotropyRotation),x.anisotropy*Math.sin(x.anisotropyRotation)),x.anisotropyMap&&(v.anisotropyMap.value=x.anisotropyMap,n(x.anisotropyMap,v.anisotropyMapTransform))),v.specularIntensity.value=x.specularIntensity,v.specularColor.value.copy(x.specularColor),x.specularColorMap&&(v.specularColorMap.value=x.specularColorMap,n(x.specularColorMap,v.specularColorMapTransform)),x.specularIntensityMap&&(v.specularIntensityMap.value=x.specularIntensityMap,n(x.specularIntensityMap,v.specularIntensityMapTransform))}function y(v,x){x.matcap&&(v.matcap.value=x.matcap)}function _(v,x){const M=e.get(x).light;v.referencePosition.value.setFromMatrixPosition(M.matrixWorld),v.nearDistance.value=M.shadow.camera.near,v.farDistance.value=M.shadow.camera.far}return{refreshFogUniforms:i,refreshMaterialUniforms:r}}function bme(t,e,n,i){let r={},a={},s=[];const o=t.getParameter(t.MAX_UNIFORM_BUFFER_BINDINGS);function l(M,w){const T=w.program;i.uniformBlockBinding(M,T)}function c(M,w){let T=r[M.id];T===void 0&&(y(M),T=d(M),r[M.id]=T,M.addEventListener("dispose",v));const C=w.program;i.updateUBOMapping(M,C);const P=e.render.frame;a[M.id]!==P&&(m(M),a[M.id]=P)}function d(M){const w=f();M.__bindingPointIndex=w;const T=t.createBuffer(),C=M.__size,P=M.usage;return t.bindBuffer(t.UNIFORM_BUFFER,T),t.bufferData(t.UNIFORM_BUFFER,C,P),t.bindBuffer(t.UNIFORM_BUFFER,null),t.bindBufferBase(t.UNIFORM_BUFFER,w,T),T}function f(){for(let M=0;M<o;M++)if(s.indexOf(M)===-1)return s.push(M),M;return Di("WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function m(M){const w=r[M.id],T=M.uniforms,C=M.__cache;t.bindBuffer(t.UNIFORM_BUFFER,w);for(let P=0,A=T.length;P<A;P++){const U=Array.isArray(T[P])?T[P]:[T[P]];for(let N=0,D=U.length;N<D;N++){const F=U[N];if(g(F,P,N,C)===!0){const I=F.__offset,W=Array.isArray(F.value)?F.value:[F.value];let O=0;for(let B=0;B<W.length;B++){const H=W[B],$=_(H);typeof H=="number"||typeof H=="boolean"?(F.__data[0]=H,t.bufferSubData(t.UNIFORM_BUFFER,I+O,F.__data)):H.isMatrix3?(F.__data[0]=H.elements[0],F.__data[1]=H.elements[1],F.__data[2]=H.elements[2],F.__data[3]=0,F.__data[4]=H.elements[3],F.__data[5]=H.elements[4],F.__data[6]=H.elements[5],F.__data[7]=0,F.__data[8]=H.elements[6],F.__data[9]=H.elements[7],F.__data[10]=H.elements[8],F.__data[11]=0):(H.toArray(F.__data,O),O+=$.storage/Float32Array.BYTES_PER_ELEMENT)}t.bufferSubData(t.UNIFORM_BUFFER,I,F.__data)}}}t.bindBuffer(t.UNIFORM_BUFFER,null)}function g(M,w,T,C){const P=M.value,A=w+"_"+T;if(C[A]===void 0)return typeof P=="number"||typeof P=="boolean"?C[A]=P:C[A]=P.clone(),!0;{const U=C[A];if(typeof P=="number"||typeof P=="boolean"){if(U!==P)return C[A]=P,!0}else if(U.equals(P)===!1)return U.copy(P),!0}return!1}function y(M){const w=M.uniforms;let T=0;const C=16;for(let A=0,U=w.length;A<U;A++){const N=Array.isArray(w[A])?w[A]:[w[A]];for(let D=0,F=N.length;D<F;D++){const I=N[D],W=Array.isArray(I.value)?I.value:[I.value];for(let O=0,B=W.length;O<B;O++){const H=W[O],$=_(H),K=T%C,Z=K%$.boundary,se=K+Z;T+=Z,se!==0&&C-se<$.storage&&(T+=C-se),I.__data=new Float32Array($.storage/Float32Array.BYTES_PER_ELEMENT),I.__offset=T,T+=$.storage}}}const P=T%C;return P>0&&(T+=C-P),M.__size=T,M.__cache={},this}function _(M){const w={boundary:0,storage:0};return typeof M=="number"||typeof M=="boolean"?(w.boundary=4,w.storage=4):M.isVector2?(w.boundary=8,w.storage=8):M.isVector3||M.isColor?(w.boundary=16,w.storage=12):M.isVector4?(w.boundary=16,w.storage=16):M.isMatrix3?(w.boundary=48,w.storage=48):M.isMatrix4?(w.boundary=64,w.storage=64):M.isTexture?Gt("WebGLRenderer: Texture samplers can not be part of an uniforms group."):Gt("WebGLRenderer: Unsupported uniform value type.",M),w}function v(M){const w=M.target;w.removeEventListener("dispose",v);const T=s.indexOf(w.__bindingPointIndex);s.splice(T,1),t.deleteBuffer(r[w.id]),delete r[w.id],delete a[w.id]}function x(){for(const M in r)t.deleteBuffer(r[M]);s=[],r={},a={}}return{bind:l,update:c,dispose:x}}const _me=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 Pl=null;function Sme(){return Pl===null&&(Pl=new Sue(_me,32,32,jP,hm),Pl.minFilter=zs,Pl.magFilter=zs,Pl.wrapS=Kl,Pl.wrapT=Kl,Pl.generateMipmaps=!1,Pl.needsUpdate=!0),Pl}let wme=class{constructor(e={}){const{canvas:n=qce(),context:i=null,depth:r=!0,stencil:a=!1,alpha:s=!1,antialias:o=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:c=!1,powerPreference:d="default",failIfMajorPerformanceCaveat:f=!1,reversedDepthBuffer:m=!1}=e;this.isWebGLRenderer=!0;let g;if(i!==null){if(typeof WebGLRenderingContext<"u"&&i instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");g=i.getContextAttributes().alpha}else g=s;const y=new Set([zP,FP,UP]),_=new Set([Qo,Sf,z0,B0,LP,IP]),v=new Uint32Array(4),x=new Int32Array(4);let M=null,w=null;const T=[],C=[];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=Lu,this.toneMappingExposure=1,this.transmissionResolutionScale=1;const P=this;let A=!1;this._outputColorSpace=Ds;let U=0,N=0,D=null,F=-1,I=null;const W=new Vi,O=new Vi;let B=null;const H=new vn(0);let $=0,K=n.width,Z=n.height,se=1,V=null,X=null;const ae=new Vi(0,0,K,Z),ce=new Vi(0,0,K,Z);let ge=!1;const ne=new GP;let ve=!1,Pe=!1;const he=new qi,we=new $e,je=new Vi,ue={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let lt=!1;function z(){return D===null?se:1}let q=i;function re(Q,be){return n.getContext(Q,be)}try{const Q={alpha:!0,depth:r,stencil:a,antialias:o,premultipliedAlpha:l,preserveDrawingBuffer:c,powerPreference:d,failIfMajorPerformanceCaveat:f};if("setAttribute"in n&&n.setAttribute("data-engine",`three.js r${DP}`),n.addEventListener("webglcontextlost",Me,!1),n.addEventListener("webglcontextrestored",xe,!1),n.addEventListener("webglcontextcreationerror",Be,!1),q===null){const be="webgl2";if(q=re(be,Q),q===null)throw re(be)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(Q){throw Q("WebGLRenderer: "+Q.message),Q}let J,ee,oe,De,Ne,te,j,L,Y,me,ye,pe,Ze,Le,qe,at,Ie,Re,pt,nt,tt,ut,de,it;function fe(){J=new Phe(q),J.init(),ut=new hme(q,J),ee=new She(q,J,e,ut),oe=new dme(q,J),ee.reversedDepthBuffer&&m&&oe.buffers.depth.setReversed(!0),De=new Ohe(q),Ne=new Qpe,te=new fme(q,J,oe,Ne,ee,ut,De),j=new Mhe(P),L=new Rhe(P),Y=new jue(q),de=new bhe(q,Y),me=new Dhe(q,Y,De,de),ye=new Ihe(q,me,Y,De),pt=new Lhe(q,ee,te),at=new whe(Ne),pe=new Zpe(P,j,L,J,ee,de,at),Ze=new yme(P,Ne),Le=new eme,qe=new sme(J),Re=new yhe(P,j,L,oe,ye,g,l),Ie=new cme(P,ye,ee),it=new bme(q,De,ee,oe),nt=new _he(q,J,De),tt=new khe(q,J,De),De.programs=pe.programs,P.capabilities=ee,P.extensions=J,P.properties=Ne,P.renderLists=Le,P.shadowMap=Ie,P.state=oe,P.info=De}fe();const Oe=new xme(P,q);this.xr=Oe,this.getContext=function(){return q},this.getContextAttributes=function(){return q.getContextAttributes()},this.forceContextLoss=function(){const Q=J.get("WEBGL_lose_context");Q&&Q.loseContext()},this.forceContextRestore=function(){const Q=J.get("WEBGL_lose_context");Q&&Q.restoreContext()},this.getPixelRatio=function(){return se},this.setPixelRatio=function(Q){Q!==void 0&&(se=Q,this.setSize(K,Z,!1))},this.getSize=function(Q){return Q.set(K,Z)},this.setSize=function(Q,be,Ce=!0){if(Oe.isPresenting){Gt("WebGLRenderer: Can't change size while VR device is presenting.");return}K=Q,Z=be,n.width=Math.floor(Q*se),n.height=Math.floor(be*se),Ce===!0&&(n.style.width=Q+"px",n.style.height=be+"px"),this.setViewport(0,0,Q,be)},this.getDrawingBufferSize=function(Q){return Q.set(K*se,Z*se).floor()},this.setDrawingBufferSize=function(Q,be,Ce){K=Q,Z=be,se=Ce,n.width=Math.floor(Q*Ce),n.height=Math.floor(be*Ce),this.setViewport(0,0,Q,be)},this.getCurrentViewport=function(Q){return Q.copy(W)},this.getViewport=function(Q){return Q.copy(ae)},this.setViewport=function(Q,be,Ce,Te){Q.isVector4?ae.set(Q.x,Q.y,Q.z,Q.w):ae.set(Q,be,Ce,Te),oe.viewport(W.copy(ae).multiplyScalar(se).round())},this.getScissor=function(Q){return Q.copy(ce)},this.setScissor=function(Q,be,Ce,Te){Q.isVector4?ce.set(Q.x,Q.y,Q.z,Q.w):ce.set(Q,be,Ce,Te),oe.scissor(O.copy(ce).multiplyScalar(se).round())},this.getScissorTest=function(){return ge},this.setScissorTest=function(Q){oe.setScissorTest(ge=Q)},this.setOpaqueSort=function(Q){V=Q},this.setTransparentSort=function(Q){X=Q},this.getClearColor=function(Q){return Q.copy(Re.getClearColor())},this.setClearColor=function(){Re.setClearColor(...arguments)},this.getClearAlpha=function(){return Re.getClearAlpha()},this.setClearAlpha=function(){Re.setClearAlpha(...arguments)},this.clear=function(Q=!0,be=!0,Ce=!0){let Te=0;if(Q){let Se=!1;if(D!==null){const Qe=D.texture.format;Se=y.has(Qe)}if(Se){const Qe=D.texture.type,dt=_.has(Qe),vt=Re.getClearColor(),xt=Re.getClearAlpha(),Rt=vt.r,wt=vt.g,mt=vt.b;dt?(v[0]=Rt,v[1]=wt,v[2]=mt,v[3]=xt,q.clearBufferuiv(q.COLOR,0,v)):(x[0]=Rt,x[1]=wt,x[2]=mt,x[3]=xt,q.clearBufferiv(q.COLOR,0,x))}else Te|=q.COLOR_BUFFER_BIT}be&&(Te|=q.DEPTH_BUFFER_BIT),Ce&&(Te|=q.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),q.clear(Te)},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",xe,!1),n.removeEventListener("webglcontextcreationerror",Be,!1),Re.dispose(),Le.dispose(),qe.dispose(),Ne.dispose(),j.dispose(),L.dispose(),ye.dispose(),de.dispose(),it.dispose(),pe.dispose(),Oe.dispose(),Oe.removeEventListener("sessionstart",Wn),Oe.removeEventListener("sessionend",hr),Zi.stop()};function Me(Q){Q.preventDefault(),Jj("WebGLRenderer: Context Lost."),A=!0}function xe(){Jj("WebGLRenderer: Context Restored."),A=!1;const Q=De.autoReset,be=Ie.enabled,Ce=Ie.autoUpdate,Te=Ie.needsUpdate,Se=Ie.type;fe(),De.autoReset=Q,Ie.enabled=be,Ie.autoUpdate=Ce,Ie.needsUpdate=Te,Ie.type=Se}function Be(Q){Di("WebGLRenderer: A WebGL context could not be created. Reason: ",Q.statusMessage)}function ct(Q){const be=Q.target;be.removeEventListener("dispose",ct),bt(be)}function bt(Q){Nt(Q),Ne.remove(Q)}function Nt(Q){const be=Ne.get(Q).programs;be!==void 0&&(be.forEach(function(Ce){pe.releaseProgram(Ce)}),Q.isShaderMaterial&&pe.releaseShaderCache(Q))}this.renderBufferDirect=function(Q,be,Ce,Te,Se,Qe){be===null&&(be=ue);const dt=Se.isMesh&&Se.matrixWorld.determinant()<0,vt=le(Q,be,Ce,Te,Se);oe.setMaterial(Te,dt);let xt=Ce.index,Rt=1;if(Te.wireframe===!0){if(xt=me.getWireframeAttribute(Ce),xt===void 0)return;Rt=2}const wt=Ce.drawRange,mt=Ce.attributes.position;let $t=wt.start*Rt,Lt=(wt.start+wt.count)*Rt;Qe!==null&&($t=Math.max($t,Qe.start*Rt),Lt=Math.min(Lt,(Qe.start+Qe.count)*Rt)),xt!==null?($t=Math.max($t,0),Lt=Math.min(Lt,xt.count)):mt!=null&&($t=Math.max($t,0),Lt=Math.min(Lt,mt.count));const en=Lt-$t;if(en<0||en===1/0)return;de.setup(Se,Te,vt,Ce,xt);let un,mn=nt;if(xt!==null&&(un=Y.get(xt),mn=tt,mn.setIndex(un)),Se.isMesh)Te.wireframe===!0?(oe.setLineWidth(Te.wireframeLinewidth*z()),mn.setMode(q.LINES)):mn.setMode(q.TRIANGLES);else if(Se.isLine){let kt=Te.linewidth;kt===void 0&&(kt=1),oe.setLineWidth(kt*z()),Se.isLineSegments?mn.setMode(q.LINES):Se.isLineLoop?mn.setMode(q.LINE_LOOP):mn.setMode(q.LINE_STRIP)}else Se.isPoints?mn.setMode(q.POINTS):Se.isSprite&&mn.setMode(q.TRIANGLES);if(Se.isBatchedMesh)if(Se._multiDrawInstances!==null)$0("WebGLRenderer: renderMultiDrawInstances has been deprecated and will be removed in r184. Append to renderMultiDraw arguments and use indirection."),mn.renderMultiDrawInstances(Se._multiDrawStarts,Se._multiDrawCounts,Se._multiDrawCount,Se._multiDrawInstances);else if(J.get("WEBGL_multi_draw"))mn.renderMultiDraw(Se._multiDrawStarts,Se._multiDrawCounts,Se._multiDrawCount);else{const kt=Se._multiDrawStarts,qt=Se._multiDrawCounts,Kt=Se._multiDrawCount,yi=xt?Y.get(xt).bytesPerElement:1,Ti=Ne.get(Te).currentProgram.getUniforms();for(let Nn=0;Nn<Kt;Nn++)Ti.setValue(q,"_gl_DrawID",Nn),mn.render(kt[Nn]/yi,qt[Nn])}else if(Se.isInstancedMesh)mn.renderInstances($t,en,Se.count);else if(Ce.isInstancedBufferGeometry){const kt=Ce._maxInstanceCount!==void 0?Ce._maxInstanceCount:1/0,qt=Math.min(Ce.instanceCount,kt);mn.renderInstances($t,en,qt)}else mn.render($t,en)};function on(Q,be,Ce){Q.transparent===!0&&Q.side===Bo&&Q.forceSinglePass===!1?(Q.side=Ia,Q.needsUpdate=!0,Ai(Q,be,Ce),Q.side=Gu,Q.needsUpdate=!0,Ai(Q,be,Ce),Q.side=Bo):Ai(Q,be,Ce)}this.compile=function(Q,be,Ce=null){Ce===null&&(Ce=Q),w=qe.get(Ce),w.init(be),C.push(w),Ce.traverseVisible(function(Se){Se.isLight&&Se.layers.test(be.layers)&&(w.pushLight(Se),Se.castShadow&&w.pushShadow(Se))}),Q!==Ce&&Q.traverseVisible(function(Se){Se.isLight&&Se.layers.test(be.layers)&&(w.pushLight(Se),Se.castShadow&&w.pushShadow(Se))}),w.setupLights();const Te=new Set;return Q.traverse(function(Se){if(!(Se.isMesh||Se.isPoints||Se.isLine||Se.isSprite))return;const Qe=Se.material;if(Qe)if(Array.isArray(Qe))for(let dt=0;dt<Qe.length;dt++){const vt=Qe[dt];on(vt,Ce,Se),Te.add(vt)}else on(Qe,Ce,Se),Te.add(Qe)}),w=C.pop(),Te},this.compileAsync=function(Q,be,Ce=null){const Te=this.compile(Q,be,Ce);return new Promise(Se=>{function Qe(){if(Te.forEach(function(dt){Ne.get(dt).currentProgram.isReady()&&Te.delete(dt)}),Te.size===0){Se(Q);return}setTimeout(Qe,10)}J.get("KHR_parallel_shader_compile")!==null?Qe():setTimeout(Qe,10)})};let Dt=null;function Rn(Q){Dt&&Dt(Q)}function Wn(){Zi.stop()}function hr(){Zi.start()}const Zi=new F9;Zi.setAnimationLoop(Rn),typeof self<"u"&&Zi.setContext(self),this.setAnimationLoop=function(Q){Dt=Q,Oe.setAnimationLoop(Q),Q===null?Zi.stop():Zi.start()},Oe.addEventListener("sessionstart",Wn),Oe.addEventListener("sessionend",hr),this.render=function(Q,be){if(be!==void 0&&be.isCamera!==!0){Di("WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(A===!0)return;if(Q.matrixWorldAutoUpdate===!0&&Q.updateMatrixWorld(),be.parent===null&&be.matrixWorldAutoUpdate===!0&&be.updateMatrixWorld(),Oe.enabled===!0&&Oe.isPresenting===!0&&(Oe.cameraAutoUpdate===!0&&Oe.updateCamera(be),be=Oe.getCamera()),Q.isScene===!0&&Q.onBeforeRender(P,Q,be,D),w=qe.get(Q,C.length),w.init(be),C.push(w),he.multiplyMatrices(be.projectionMatrix,be.matrixWorldInverse),ne.setFromProjectionMatrix(he,$o,be.reversedDepth),Pe=this.localClippingEnabled,ve=at.init(this.clippingPlanes,Pe),M=Le.get(Q,T.length),M.init(),T.push(M),Oe.enabled===!0&&Oe.isPresenting===!0){const Qe=P.xr.getDepthSensingMesh();Qe!==null&&pr(Qe,be,-1/0,P.sortObjects)}pr(Q,be,0,P.sortObjects),M.finish(),P.sortObjects===!0&&M.sort(V,X),lt=Oe.enabled===!1||Oe.isPresenting===!1||Oe.hasDepthSensing()===!1,lt&&Re.addToRenderList(M,Q),this.info.render.frame++,ve===!0&&at.beginShadows();const Ce=w.state.shadowsArray;Ie.render(Ce,Q,be),ve===!0&&at.endShadows(),this.info.autoReset===!0&&this.info.reset();const Te=M.opaque,Se=M.transmissive;if(w.setupLights(),be.isArrayCamera){const Qe=be.cameras;if(Se.length>0)for(let dt=0,vt=Qe.length;dt<vt;dt++){const xt=Qe[dt];Gr(Te,Se,Q,xt)}lt&&Re.render(Q);for(let dt=0,vt=Qe.length;dt<vt;dt++){const xt=Qe[dt];Nr(M,Q,xt,xt.viewport)}}else Se.length>0&&Gr(Te,Se,Q,be),lt&&Re.render(Q),Nr(M,Q,be);D!==null&&N===0&&(te.updateMultisampleRenderTarget(D),te.updateRenderTargetMipmap(D)),Q.isScene===!0&&Q.onAfterRender(P,Q,be),de.resetDefaultState(),F=-1,I=null,C.pop(),C.length>0?(w=C[C.length-1],ve===!0&&at.setGlobalState(P.clippingPlanes,w.state.camera)):w=null,T.pop(),T.length>0?M=T[T.length-1]:M=null};function pr(Q,be,Ce,Te){if(Q.visible===!1)return;if(Q.layers.test(be.layers)){if(Q.isGroup)Ce=Q.renderOrder;else if(Q.isLOD)Q.autoUpdate===!0&&Q.update(be);else if(Q.isLight)w.pushLight(Q),Q.castShadow&&w.pushShadow(Q);else if(Q.isSprite){if(!Q.frustumCulled||ne.intersectsSprite(Q)){Te&&je.setFromMatrixPosition(Q.matrixWorld).applyMatrix4(he);const dt=ye.update(Q),vt=Q.material;vt.visible&&M.push(Q,dt,vt,Ce,je.z,null)}}else if((Q.isMesh||Q.isLine||Q.isPoints)&&(!Q.frustumCulled||ne.intersectsObject(Q))){const dt=ye.update(Q),vt=Q.material;if(Te&&(Q.boundingSphere!==void 0?(Q.boundingSphere===null&&Q.computeBoundingSphere(),je.copy(Q.boundingSphere.center)):(dt.boundingSphere===null&&dt.computeBoundingSphere(),je.copy(dt.boundingSphere.center)),je.applyMatrix4(Q.matrixWorld).applyMatrix4(he)),Array.isArray(vt)){const xt=dt.groups;for(let Rt=0,wt=xt.length;Rt<wt;Rt++){const mt=xt[Rt],$t=vt[mt.materialIndex];$t&&$t.visible&&M.push(Q,dt,$t,Ce,je.z,mt)}}else vt.visible&&M.push(Q,dt,vt,Ce,je.z,null)}}const Qe=Q.children;for(let dt=0,vt=Qe.length;dt<vt;dt++)pr(Qe[dt],be,Ce,Te)}function Nr(Q,be,Ce,Te){const{opaque:Se,transmissive:Qe,transparent:dt}=Q;w.setupLightsView(Ce),ve===!0&&at.setGlobalState(P.clippingPlanes,Ce),Te&&oe.viewport(W.copy(Te)),Se.length>0&&Li(Se,be,Ce),Qe.length>0&&Li(Qe,be,Ce),dt.length>0&&Li(dt,be,Ce),oe.buffers.depth.setTest(!0),oe.buffers.depth.setMask(!0),oe.buffers.color.setMask(!0),oe.setPolygonOffset(!1)}function Gr(Q,be,Ce,Te){if((Ce.isScene===!0?Ce.overrideMaterial:null)!==null)return;w.state.transmissionRenderTarget[Te.id]===void 0&&(w.state.transmissionRenderTarget[Te.id]=new Mf(1,1,{generateMipmaps:!0,type:J.has("EXT_color_buffer_half_float")||J.has("EXT_color_buffer_float")?hm:Qo,minFilter:Yd,samples:4,stencilBuffer:a,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:Mn.workingColorSpace}));const Qe=w.state.transmissionRenderTarget[Te.id],dt=Te.viewport||W;Qe.setSize(dt.z*P.transmissionResolutionScale,dt.w*P.transmissionResolutionScale);const vt=P.getRenderTarget(),xt=P.getActiveCubeFace(),Rt=P.getActiveMipmapLevel();P.setRenderTarget(Qe),P.getClearColor(H),$=P.getClearAlpha(),$<1&&P.setClearColor(16777215,.5),P.clear(),lt&&Re.render(Ce);const wt=P.toneMapping;P.toneMapping=Lu;const mt=Te.viewport;if(Te.viewport!==void 0&&(Te.viewport=void 0),w.setupLightsView(Te),ve===!0&&at.setGlobalState(P.clippingPlanes,Te),Li(Q,Ce,Te),te.updateMultisampleRenderTarget(Qe),te.updateRenderTargetMipmap(Qe),J.has("WEBGL_multisampled_render_to_texture")===!1){let $t=!1;for(let Lt=0,en=be.length;Lt<en;Lt++){const un=be[Lt],{object:mn,geometry:kt,material:qt,group:Kt}=un;if(qt.side===Bo&&mn.layers.test(Te.layers)){const yi=qt.side;qt.side=Ia,qt.needsUpdate=!0,hi(mn,Ce,Te,kt,qt,Kt),qt.side=yi,qt.needsUpdate=!0,$t=!0}}$t===!0&&(te.updateMultisampleRenderTarget(Qe),te.updateRenderTargetMipmap(Qe))}P.setRenderTarget(vt,xt,Rt),P.setClearColor(H,$),mt!==void 0&&(Te.viewport=mt),P.toneMapping=wt}function Li(Q,be,Ce){const Te=be.isScene===!0?be.overrideMaterial:null;for(let Se=0,Qe=Q.length;Se<Qe;Se++){const dt=Q[Se],{object:vt,geometry:xt,group:Rt}=dt;let wt=dt.material;wt.allowOverride===!0&&Te!==null&&(wt=Te),vt.layers.test(Ce.layers)&&hi(vt,be,Ce,xt,wt,Rt)}}function hi(Q,be,Ce,Te,Se,Qe){Q.onBeforeRender(P,be,Ce,Te,Se,Qe),Q.modelViewMatrix.multiplyMatrices(Ce.matrixWorldInverse,Q.matrixWorld),Q.normalMatrix.getNormalMatrix(Q.modelViewMatrix),Se.onBeforeRender(P,be,Ce,Te,Q,Qe),Se.transparent===!0&&Se.side===Bo&&Se.forceSinglePass===!1?(Se.side=Ia,Se.needsUpdate=!0,P.renderBufferDirect(Ce,be,Te,Se,Q,Qe),Se.side=Gu,Se.needsUpdate=!0,P.renderBufferDirect(Ce,be,Te,Se,Q,Qe),Se.side=Bo):P.renderBufferDirect(Ce,be,Te,Se,Q,Qe),Q.onAfterRender(P,be,Ce,Te,Se,Qe)}function Ai(Q,be,Ce){be.isScene!==!0&&(be=ue);const Te=Ne.get(Q),Se=w.state.lights,Qe=w.state.shadowsArray,dt=Se.state.version,vt=pe.getParameters(Q,Se.state,Qe,be,Ce),xt=pe.getProgramCacheKey(vt);let Rt=Te.programs;Te.environment=Q.isMeshStandardMaterial?be.environment:null,Te.fog=be.fog,Te.envMap=(Q.isMeshStandardMaterial?L:j).get(Q.envMap||Te.environment),Te.envMapRotation=Te.environment!==null&&Q.envMap===null?be.environmentRotation:Q.envMapRotation,Rt===void 0&&(Q.addEventListener("dispose",ct),Rt=new Map,Te.programs=Rt);let wt=Rt.get(xt);if(wt!==void 0){if(Te.currentProgram===wt&&Te.lightsStateVersion===dt)return Pc(Q,vt),wt}else vt.uniforms=pe.getUniforms(Q),Q.onBeforeCompile(vt,P),wt=pe.acquireProgram(vt,xt),Rt.set(xt,wt),Te.uniforms=vt.uniforms;const mt=Te.uniforms;return(!Q.isShaderMaterial&&!Q.isRawShaderMaterial||Q.clipping===!0)&&(mt.clippingPlanes=at.uniform),Pc(Q,vt),Te.needsLights=We(Q),Te.lightsStateVersion=dt,Te.needsLights&&(mt.ambientLightColor.value=Se.state.ambient,mt.lightProbe.value=Se.state.probe,mt.directionalLights.value=Se.state.directional,mt.directionalLightShadows.value=Se.state.directionalShadow,mt.spotLights.value=Se.state.spot,mt.spotLightShadows.value=Se.state.spotShadow,mt.rectAreaLights.value=Se.state.rectArea,mt.ltc_1.value=Se.state.rectAreaLTC1,mt.ltc_2.value=Se.state.rectAreaLTC2,mt.pointLights.value=Se.state.point,mt.pointLightShadows.value=Se.state.pointShadow,mt.hemisphereLights.value=Se.state.hemi,mt.directionalShadowMap.value=Se.state.directionalShadowMap,mt.directionalShadowMatrix.value=Se.state.directionalShadowMatrix,mt.spotShadowMap.value=Se.state.spotShadowMap,mt.spotLightMatrix.value=Se.state.spotLightMatrix,mt.spotLightMap.value=Se.state.spotLightMap,mt.pointShadowMap.value=Se.state.pointShadowMap,mt.pointShadowMatrix.value=Se.state.pointShadowMatrix),Te.currentProgram=wt,Te.uniformsList=null,wt}function Zs(Q){if(Q.uniformsList===null){const be=Q.currentProgram.getUniforms();Q.uniformsList=h_.seqWithValue(be.seq,Q.uniforms)}return Q.uniformsList}function Pc(Q,be){const Ce=Ne.get(Q);Ce.outputColorSpace=be.outputColorSpace,Ce.batching=be.batching,Ce.batchingColor=be.batchingColor,Ce.instancing=be.instancing,Ce.instancingColor=be.instancingColor,Ce.instancingMorph=be.instancingMorph,Ce.skinning=be.skinning,Ce.morphTargets=be.morphTargets,Ce.morphNormals=be.morphNormals,Ce.morphColors=be.morphColors,Ce.morphTargetsCount=be.morphTargetsCount,Ce.numClippingPlanes=be.numClippingPlanes,Ce.numIntersection=be.numClipIntersection,Ce.vertexAlphas=be.vertexAlphas,Ce.vertexTangents=be.vertexTangents,Ce.toneMapping=be.toneMapping}function le(Q,be,Ce,Te,Se){be.isScene!==!0&&(be=ue),te.resetTextureUnits();const Qe=be.fog,dt=Te.isMeshStandardMaterial?be.environment:null,vt=D===null?P.outputColorSpace:D.isXRRenderTarget===!0?D.texture.colorSpace:zp,xt=(Te.isMeshStandardMaterial?L:j).get(Te.envMap||dt),Rt=Te.vertexColors===!0&&!!Ce.attributes.color&&Ce.attributes.color.itemSize===4,wt=!!Ce.attributes.tangent&&(!!Te.normalMap||Te.anisotropy>0),mt=!!Ce.morphAttributes.position,$t=!!Ce.morphAttributes.normal,Lt=!!Ce.morphAttributes.color;let en=Lu;Te.toneMapped&&(D===null||D.isXRRenderTarget===!0)&&(en=P.toneMapping);const un=Ce.morphAttributes.position||Ce.morphAttributes.normal||Ce.morphAttributes.color,mn=un!==void 0?un.length:0,kt=Ne.get(Te),qt=w.state.lights;if(ve===!0&&(Pe===!0||Q!==I)){const gr=Q===I&&Te.id===F;at.setState(Te,Q,gr)}let Kt=!1;Te.version===kt.__version?(kt.needsLights&&kt.lightsStateVersion!==qt.state.version||kt.outputColorSpace!==vt||Se.isBatchedMesh&&kt.batching===!1||!Se.isBatchedMesh&&kt.batching===!0||Se.isBatchedMesh&&kt.batchingColor===!0&&Se.colorTexture===null||Se.isBatchedMesh&&kt.batchingColor===!1&&Se.colorTexture!==null||Se.isInstancedMesh&&kt.instancing===!1||!Se.isInstancedMesh&&kt.instancing===!0||Se.isSkinnedMesh&&kt.skinning===!1||!Se.isSkinnedMesh&&kt.skinning===!0||Se.isInstancedMesh&&kt.instancingColor===!0&&Se.instanceColor===null||Se.isInstancedMesh&&kt.instancingColor===!1&&Se.instanceColor!==null||Se.isInstancedMesh&&kt.instancingMorph===!0&&Se.morphTexture===null||Se.isInstancedMesh&&kt.instancingMorph===!1&&Se.morphTexture!==null||kt.envMap!==xt||Te.fog===!0&&kt.fog!==Qe||kt.numClippingPlanes!==void 0&&(kt.numClippingPlanes!==at.numPlanes||kt.numIntersection!==at.numIntersection)||kt.vertexAlphas!==Rt||kt.vertexTangents!==wt||kt.morphTargets!==mt||kt.morphNormals!==$t||kt.morphColors!==Lt||kt.toneMapping!==en||kt.morphTargetsCount!==mn)&&(Kt=!0):(Kt=!0,kt.__version=Te.version);let yi=kt.currentProgram;Kt===!0&&(yi=Ai(Te,be,Se));let Ti=!1,Nn=!1,Qs=!1;const Pn=yi.getUniforms(),mr=kt.uniforms;if(oe.useProgram(yi.program)&&(Ti=!0,Nn=!0,Qs=!0),Te.id!==F&&(F=Te.id,Nn=!0),Ti||I!==Q){oe.buffers.depth.getReversed()&&Q.reversedDepth!==!0&&(Q._reversedDepth=!0,Q.updateProjectionMatrix()),Pn.setValue(q,"projectionMatrix",Q.projectionMatrix),Pn.setValue(q,"viewMatrix",Q.matrixWorldInverse);const Rr=Pn.map.cameraPosition;Rr!==void 0&&Rr.setValue(q,we.setFromMatrixPosition(Q.matrixWorld)),ee.logarithmicDepthBuffer&&Pn.setValue(q,"logDepthBufFC",2/(Math.log(Q.far+1)/Math.LN2)),(Te.isMeshPhongMaterial||Te.isMeshToonMaterial||Te.isMeshLambertMaterial||Te.isMeshBasicMaterial||Te.isMeshStandardMaterial||Te.isShaderMaterial)&&Pn.setValue(q,"isOrthographic",Q.isOrthographicCamera===!0),I!==Q&&(I=Q,Nn=!0,Qs=!0)}if(Se.isSkinnedMesh){Pn.setOptional(q,Se,"bindMatrix"),Pn.setOptional(q,Se,"bindMatrixInverse");const gr=Se.skeleton;gr&&(gr.boneTexture===null&&gr.computeBoneTexture(),Pn.setValue(q,"boneTexture",gr.boneTexture,te))}Se.isBatchedMesh&&(Pn.setOptional(q,Se,"batchingTexture"),Pn.setValue(q,"batchingTexture",Se._matricesTexture,te),Pn.setOptional(q,Se,"batchingIdTexture"),Pn.setValue(q,"batchingIdTexture",Se._indirectTexture,te),Pn.setOptional(q,Se,"batchingColorTexture"),Se._colorsTexture!==null&&Pn.setValue(q,"batchingColorTexture",Se._colorsTexture,te));const Qi=Ce.morphAttributes;if((Qi.position!==void 0||Qi.normal!==void 0||Qi.color!==void 0)&&pt.update(Se,Ce,yi),(Nn||kt.receiveShadow!==Se.receiveShadow)&&(kt.receiveShadow=Se.receiveShadow,Pn.setValue(q,"receiveShadow",Se.receiveShadow)),Te.isMeshGouraudMaterial&&Te.envMap!==null&&(mr.envMap.value=xt,mr.flipEnvMap.value=xt.isCubeTexture&&xt.isRenderTargetTexture===!1?-1:1),Te.isMeshStandardMaterial&&Te.envMap===null&&be.environment!==null&&(mr.envMapIntensity.value=be.environmentIntensity),mr.dfgLUT!==void 0&&(mr.dfgLUT.value=Sme()),Nn&&(Pn.setValue(q,"toneMappingExposure",P.toneMappingExposure),kt.needsLights&&Ue(mr,Qs),Qe&&Te.fog===!0&&Ze.refreshFogUniforms(mr,Qe),Ze.refreshMaterialUniforms(mr,Te,se,Z,w.state.transmissionRenderTarget[Q.id]),h_.upload(q,Zs(kt),mr,te)),Te.isShaderMaterial&&Te.uniformsNeedUpdate===!0&&(h_.upload(q,Zs(kt),mr,te),Te.uniformsNeedUpdate=!1),Te.isSpriteMaterial&&Pn.setValue(q,"center",Se.center),Pn.setValue(q,"modelViewMatrix",Se.modelViewMatrix),Pn.setValue(q,"normalMatrix",Se.normalMatrix),Pn.setValue(q,"modelMatrix",Se.matrixWorld),Te.isShaderMaterial||Te.isRawShaderMaterial){const gr=Te.uniformsGroups;for(let Rr=0,To=gr.length;Rr<To;Rr++){const ll=gr[Rr];it.update(ll,yi),it.bind(ll,yi)}}return yi}function Ue(Q,be){Q.ambientLightColor.needsUpdate=be,Q.lightProbe.needsUpdate=be,Q.directionalLights.needsUpdate=be,Q.directionalLightShadows.needsUpdate=be,Q.pointLights.needsUpdate=be,Q.pointLightShadows.needsUpdate=be,Q.spotLights.needsUpdate=be,Q.spotLightShadows.needsUpdate=be,Q.rectAreaLights.needsUpdate=be,Q.hemisphereLights.needsUpdate=be}function We(Q){return Q.isMeshLambertMaterial||Q.isMeshToonMaterial||Q.isMeshPhongMaterial||Q.isMeshStandardMaterial||Q.isShadowMaterial||Q.isShaderMaterial&&Q.lights===!0}this.getActiveCubeFace=function(){return U},this.getActiveMipmapLevel=function(){return N},this.getRenderTarget=function(){return D},this.setRenderTargetTextures=function(Q,be,Ce){const Te=Ne.get(Q);Te.__autoAllocateDepthBuffer=Q.resolveDepthBuffer===!1,Te.__autoAllocateDepthBuffer===!1&&(Te.__useRenderToTexture=!1),Ne.get(Q.texture).__webglTexture=be,Ne.get(Q.depthTexture).__webglTexture=Te.__autoAllocateDepthBuffer?void 0:Ce,Te.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(Q,be){const Ce=Ne.get(Q);Ce.__webglFramebuffer=be,Ce.__useDefaultFramebuffer=be===void 0};const Xe=q.createFramebuffer();this.setRenderTarget=function(Q,be=0,Ce=0){D=Q,U=be,N=Ce;let Te=!0,Se=null,Qe=!1,dt=!1;if(Q){const xt=Ne.get(Q);if(xt.__useDefaultFramebuffer!==void 0)oe.bindFramebuffer(q.FRAMEBUFFER,null),Te=!1;else if(xt.__webglFramebuffer===void 0)te.setupRenderTarget(Q);else if(xt.__hasExternalTextures)te.rebindTextures(Q,Ne.get(Q.texture).__webglTexture,Ne.get(Q.depthTexture).__webglTexture);else if(Q.depthBuffer){const mt=Q.depthTexture;if(xt.__boundDepthTexture!==mt){if(mt!==null&&Ne.has(mt)&&(Q.width!==mt.image.width||Q.height!==mt.image.height))throw new Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");te.setupDepthRenderbuffer(Q)}}const Rt=Q.texture;(Rt.isData3DTexture||Rt.isDataArrayTexture||Rt.isCompressedArrayTexture)&&(dt=!0);const wt=Ne.get(Q).__webglFramebuffer;Q.isWebGLCubeRenderTarget?(Array.isArray(wt[be])?Se=wt[be][Ce]:Se=wt[be],Qe=!0):Q.samples>0&&te.useMultisampledRTT(Q)===!1?Se=Ne.get(Q).__webglMultisampledFramebuffer:Array.isArray(wt)?Se=wt[Ce]:Se=wt,W.copy(Q.viewport),O.copy(Q.scissor),B=Q.scissorTest}else W.copy(ae).multiplyScalar(se).floor(),O.copy(ce).multiplyScalar(se).floor(),B=ge;if(Ce!==0&&(Se=Xe),oe.bindFramebuffer(q.FRAMEBUFFER,Se)&&Te&&oe.drawBuffers(Q,Se),oe.viewport(W),oe.scissor(O),oe.setScissorTest(B),Qe){const xt=Ne.get(Q.texture);q.framebufferTexture2D(q.FRAMEBUFFER,q.COLOR_ATTACHMENT0,q.TEXTURE_CUBE_MAP_POSITIVE_X+be,xt.__webglTexture,Ce)}else if(dt){const xt=be;for(let Rt=0;Rt<Q.textures.length;Rt++){const wt=Ne.get(Q.textures[Rt]);q.framebufferTextureLayer(q.FRAMEBUFFER,q.COLOR_ATTACHMENT0+Rt,wt.__webglTexture,Ce,xt)}}else if(Q!==null&&Ce!==0){const xt=Ne.get(Q.texture);q.framebufferTexture2D(q.FRAMEBUFFER,q.COLOR_ATTACHMENT0,q.TEXTURE_2D,xt.__webglTexture,Ce)}F=-1},this.readRenderTargetPixels=function(Q,be,Ce,Te,Se,Qe,dt,vt=0){if(!(Q&&Q.isWebGLRenderTarget)){Di("WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let xt=Ne.get(Q).__webglFramebuffer;if(Q.isWebGLCubeRenderTarget&&dt!==void 0&&(xt=xt[dt]),xt){oe.bindFramebuffer(q.FRAMEBUFFER,xt);try{const Rt=Q.textures[vt],wt=Rt.format,mt=Rt.type;if(!ee.textureFormatReadable(wt)){Di("WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!ee.textureTypeReadable(mt)){Di("WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}be>=0&&be<=Q.width-Te&&Ce>=0&&Ce<=Q.height-Se&&(Q.textures.length>1&&q.readBuffer(q.COLOR_ATTACHMENT0+vt),q.readPixels(be,Ce,Te,Se,ut.convert(wt),ut.convert(mt),Qe))}finally{const Rt=D!==null?Ne.get(D).__webglFramebuffer:null;oe.bindFramebuffer(q.FRAMEBUFFER,Rt)}}},this.readRenderTargetPixelsAsync=async function(Q,be,Ce,Te,Se,Qe,dt,vt=0){if(!(Q&&Q.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let xt=Ne.get(Q).__webglFramebuffer;if(Q.isWebGLCubeRenderTarget&&dt!==void 0&&(xt=xt[dt]),xt)if(be>=0&&be<=Q.width-Te&&Ce>=0&&Ce<=Q.height-Se){oe.bindFramebuffer(q.FRAMEBUFFER,xt);const Rt=Q.textures[vt],wt=Rt.format,mt=Rt.type;if(!ee.textureFormatReadable(wt))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!ee.textureTypeReadable(mt))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");const $t=q.createBuffer();q.bindBuffer(q.PIXEL_PACK_BUFFER,$t),q.bufferData(q.PIXEL_PACK_BUFFER,Qe.byteLength,q.STREAM_READ),Q.textures.length>1&&q.readBuffer(q.COLOR_ATTACHMENT0+vt),q.readPixels(be,Ce,Te,Se,ut.convert(wt),ut.convert(mt),0);const Lt=D!==null?Ne.get(D).__webglFramebuffer:null;oe.bindFramebuffer(q.FRAMEBUFFER,Lt);const en=q.fenceSync(q.SYNC_GPU_COMMANDS_COMPLETE,0);return q.flush(),await Xce(q,en,4),q.bindBuffer(q.PIXEL_PACK_BUFFER,$t),q.getBufferSubData(q.PIXEL_PACK_BUFFER,0,Qe),q.deleteBuffer($t),q.deleteSync(en),Qe}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(Q,be=null,Ce=0){const Te=Math.pow(2,-Ce),Se=Math.floor(Q.image.width*Te),Qe=Math.floor(Q.image.height*Te),dt=be!==null?be.x:0,vt=be!==null?be.y:0;te.setTexture2D(Q,0),q.copyTexSubImage2D(q.TEXTURE_2D,Ce,0,0,dt,vt,Se,Qe),oe.unbindTexture()};const Ge=q.createFramebuffer(),_t=q.createFramebuffer();this.copyTextureToTexture=function(Q,be,Ce=null,Te=null,Se=0,Qe=null){Qe===null&&(Se!==0?($0("WebGLRenderer: copyTextureToTexture function signature has changed to support src and dst mipmap levels."),Qe=Se,Se=0):Qe=0);let dt,vt,xt,Rt,wt,mt,$t,Lt,en;const un=Q.isCompressedTexture?Q.mipmaps[Qe]:Q.image;if(Ce!==null)dt=Ce.max.x-Ce.min.x,vt=Ce.max.y-Ce.min.y,xt=Ce.isBox3?Ce.max.z-Ce.min.z:1,Rt=Ce.min.x,wt=Ce.min.y,mt=Ce.isBox3?Ce.min.z:0;else{const Qi=Math.pow(2,-Se);dt=Math.floor(un.width*Qi),vt=Math.floor(un.height*Qi),Q.isDataArrayTexture?xt=un.depth:Q.isData3DTexture?xt=Math.floor(un.depth*Qi):xt=1,Rt=0,wt=0,mt=0}Te!==null?($t=Te.x,Lt=Te.y,en=Te.z):($t=0,Lt=0,en=0);const mn=ut.convert(be.format),kt=ut.convert(be.type);let qt;be.isData3DTexture?(te.setTexture3D(be,0),qt=q.TEXTURE_3D):be.isDataArrayTexture||be.isCompressedArrayTexture?(te.setTexture2DArray(be,0),qt=q.TEXTURE_2D_ARRAY):(te.setTexture2D(be,0),qt=q.TEXTURE_2D),q.pixelStorei(q.UNPACK_FLIP_Y_WEBGL,be.flipY),q.pixelStorei(q.UNPACK_PREMULTIPLY_ALPHA_WEBGL,be.premultiplyAlpha),q.pixelStorei(q.UNPACK_ALIGNMENT,be.unpackAlignment);const Kt=q.getParameter(q.UNPACK_ROW_LENGTH),yi=q.getParameter(q.UNPACK_IMAGE_HEIGHT),Ti=q.getParameter(q.UNPACK_SKIP_PIXELS),Nn=q.getParameter(q.UNPACK_SKIP_ROWS),Qs=q.getParameter(q.UNPACK_SKIP_IMAGES);q.pixelStorei(q.UNPACK_ROW_LENGTH,un.width),q.pixelStorei(q.UNPACK_IMAGE_HEIGHT,un.height),q.pixelStorei(q.UNPACK_SKIP_PIXELS,Rt),q.pixelStorei(q.UNPACK_SKIP_ROWS,wt),q.pixelStorei(q.UNPACK_SKIP_IMAGES,mt);const Pn=Q.isDataArrayTexture||Q.isData3DTexture,mr=be.isDataArrayTexture||be.isData3DTexture;if(Q.isDepthTexture){const Qi=Ne.get(Q),gr=Ne.get(be),Rr=Ne.get(Qi.__renderTarget),To=Ne.get(gr.__renderTarget);oe.bindFramebuffer(q.READ_FRAMEBUFFER,Rr.__webglFramebuffer),oe.bindFramebuffer(q.DRAW_FRAMEBUFFER,To.__webglFramebuffer);for(let ll=0;ll<xt;ll++)Pn&&(q.framebufferTextureLayer(q.READ_FRAMEBUFFER,q.COLOR_ATTACHMENT0,Ne.get(Q).__webglTexture,Se,mt+ll),q.framebufferTextureLayer(q.DRAW_FRAMEBUFFER,q.COLOR_ATTACHMENT0,Ne.get(be).__webglTexture,Qe,en+ll)),q.blitFramebuffer(Rt,wt,dt,vt,$t,Lt,dt,vt,q.DEPTH_BUFFER_BIT,q.NEAREST);oe.bindFramebuffer(q.READ_FRAMEBUFFER,null),oe.bindFramebuffer(q.DRAW_FRAMEBUFFER,null)}else if(Se!==0||Q.isRenderTargetTexture||Ne.has(Q)){const Qi=Ne.get(Q),gr=Ne.get(be);oe.bindFramebuffer(q.READ_FRAMEBUFFER,Ge),oe.bindFramebuffer(q.DRAW_FRAMEBUFFER,_t);for(let Rr=0;Rr<xt;Rr++)Pn?q.framebufferTextureLayer(q.READ_FRAMEBUFFER,q.COLOR_ATTACHMENT0,Qi.__webglTexture,Se,mt+Rr):q.framebufferTexture2D(q.READ_FRAMEBUFFER,q.COLOR_ATTACHMENT0,q.TEXTURE_2D,Qi.__webglTexture,Se),mr?q.framebufferTextureLayer(q.DRAW_FRAMEBUFFER,q.COLOR_ATTACHMENT0,gr.__webglTexture,Qe,en+Rr):q.framebufferTexture2D(q.DRAW_FRAMEBUFFER,q.COLOR_ATTACHMENT0,q.TEXTURE_2D,gr.__webglTexture,Qe),Se!==0?q.blitFramebuffer(Rt,wt,dt,vt,$t,Lt,dt,vt,q.COLOR_BUFFER_BIT,q.NEAREST):mr?q.copyTexSubImage3D(qt,Qe,$t,Lt,en+Rr,Rt,wt,dt,vt):q.copyTexSubImage2D(qt,Qe,$t,Lt,Rt,wt,dt,vt);oe.bindFramebuffer(q.READ_FRAMEBUFFER,null),oe.bindFramebuffer(q.DRAW_FRAMEBUFFER,null)}else mr?Q.isDataTexture||Q.isData3DTexture?q.texSubImage3D(qt,Qe,$t,Lt,en,dt,vt,xt,mn,kt,un.data):be.isCompressedArrayTexture?q.compressedTexSubImage3D(qt,Qe,$t,Lt,en,dt,vt,xt,mn,un.data):q.texSubImage3D(qt,Qe,$t,Lt,en,dt,vt,xt,mn,kt,un):Q.isDataTexture?q.texSubImage2D(q.TEXTURE_2D,Qe,$t,Lt,dt,vt,mn,kt,un.data):Q.isCompressedTexture?q.compressedTexSubImage2D(q.TEXTURE_2D,Qe,$t,Lt,un.width,un.height,mn,un.data):q.texSubImage2D(q.TEXTURE_2D,Qe,$t,Lt,dt,vt,mn,kt,un);q.pixelStorei(q.UNPACK_ROW_LENGTH,Kt),q.pixelStorei(q.UNPACK_IMAGE_HEIGHT,yi),q.pixelStorei(q.UNPACK_SKIP_PIXELS,Ti),q.pixelStorei(q.UNPACK_SKIP_ROWS,Nn),q.pixelStorei(q.UNPACK_SKIP_IMAGES,Qs),Qe===0&&be.generateMipmaps&&q.generateMipmap(qt),oe.unbindTexture()},this.initRenderTarget=function(Q){Ne.get(Q).__webglFramebuffer===void 0&&te.setupRenderTarget(Q)},this.initTexture=function(Q){Q.isCubeTexture?te.setTextureCube(Q,0):Q.isData3DTexture?te.setTexture3D(Q,0):Q.isDataArrayTexture||Q.isCompressedArrayTexture?te.setTexture2DArray(Q,0):te.setTexture2D(Q,0),oe.unbindTexture()},this.resetState=function(){U=0,N=0,D=null,oe.reset(),de.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return $o}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const n=this.getContext();n.drawingBufferColorSpace=Mn._getDrawingBufferColorSpace(e),n.unpackColorSpace=Mn._getUnpackColorSpace()}};const XF={type:"change"},qP={type:"start"},$9={type:"end"},Ky=new HP,KF=new gu,Mme=Math.cos(70*Yce.DEG2RAD),er=new $e,Pa=2*Math.PI,Vn={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6},nT=1e-6;class Eme extends Iue{constructor(e,n=null){super(e,n),this.state=Vn.NONE,this.target=new $e,this.cursor=new $e,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:Mp.ROTATE,MIDDLE:Mp.DOLLY,RIGHT:Mp.PAN},this.touches={ONE:xp.ROTATE,TWO:xp.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this._domElementKeyEvents=null,this._lastPosition=new $e,this._lastQuaternion=new wf,this._lastTargetPosition=new $e,this._quat=new wf().setFromUnitVectors(e.up,new $e(0,1,0)),this._quatInverse=this._quat.clone().invert(),this._spherical=new wF,this._sphericalDelta=new wF,this._scale=1,this._panOffset=new $e,this._rotateStart=new an,this._rotateEnd=new an,this._rotateDelta=new an,this._panStart=new an,this._panEnd=new an,this._panDelta=new an,this._dollyStart=new an,this._dollyEnd=new an,this._dollyDelta=new an,this._dollyDirection=new $e,this._mouse=new an,this._performCursorZoom=!1,this._pointers=[],this._pointerPositions={},this._controlActive=!1,this._onPointerMove=Tme.bind(this),this._onPointerDown=Ame.bind(this),this._onPointerUp=Cme.bind(this),this._onContextMenu=Lme.bind(this),this._onMouseWheel=Pme.bind(this),this._onKeyDown=Dme.bind(this),this._onTouchStart=kme.bind(this),this._onTouchMove=Ome.bind(this),this._onMouseDown=Nme.bind(this),this._onMouseMove=Rme.bind(this),this._interceptControlDown=Ime.bind(this),this._interceptControlUp=Ume.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(XF),this.update(),this.state=Vn.NONE}update(e=null){const n=this.object.position;er.copy(n).sub(this.target),er.applyQuaternion(this._quat),this._spherical.setFromVector3(er),this.autoRotate&&this.state===Vn.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+=Pa:i>Math.PI&&(i-=Pa),r<-Math.PI?r+=Pa:r>Math.PI&&(r-=Pa),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(er.setFromSpherical(this._spherical),er.applyQuaternion(this._quatInverse),n.copy(this.target).add(er),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 o=er.length();s=this._clampDistance(o*this._scale);const l=o-s;this.object.position.addScaledVector(this._dollyDirection,l),this.object.updateMatrixWorld(),a=!!l}else if(this.object.isOrthographicCamera){const o=new $e(this._mouse.x,this._mouse.y,0);o.unproject(this.object);const l=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),this.object.updateProjectionMatrix(),a=l!==this.object.zoom;const c=new $e(this._mouse.x,this._mouse.y,0);c.unproject(this.object),this.object.position.sub(c).add(o),this.object.updateMatrixWorld(),s=er.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):(Ky.origin.copy(this.object.position),Ky.direction.set(0,0,-1).transformDirection(this.object.matrix),Math.abs(this.object.up.dot(Ky.direction))<Mme?this.object.lookAt(this.target):(KF.setFromNormalAndCoplanarPoint(this.object.up,this.target),Ky.intersectPlane(KF,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)>nT||8*(1-this._lastQuaternion.dot(this.object.quaternion))>nT||this._lastTargetPosition.distanceToSquared(this.target)>nT?(this.dispatchEvent(XF),this._lastPosition.copy(this.object.position),this._lastQuaternion.copy(this.object.quaternion),this._lastTargetPosition.copy(this.target),!0):!1}_getAutoRotationAngle(e){return e!==null?Pa/60*this.autoRotateSpeed*e:Pa/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){er.setFromMatrixColumn(n,0),er.multiplyScalar(-e),this._panOffset.add(er)}_panUp(e,n){this.screenSpacePanning===!0?er.setFromMatrixColumn(n,1):(er.setFromMatrixColumn(n,0),er.crossVectors(this.object.up,er)),er.multiplyScalar(e),this._panOffset.add(er)}_pan(e,n){const i=this.domElement;if(this.object.isPerspectiveCamera){const r=this.object.position;er.copy(r).sub(this.target);let a=er.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,o=i.height;this._mouse.x=r/s*2-1,this._mouse.y=-(a/o)*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(Pa*this._rotateDelta.x/n.clientHeight),this._rotateUp(Pa*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(Pa*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(-Pa*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(Pa*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(-Pa*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(Pa*this._rotateDelta.x/n.clientHeight),this._rotateUp(Pa*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,o=(e.pageY+n.y)*.5;this._updateZoomParameters(s,o)}_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 an,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 Ame(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 Tme(t){this.enabled!==!1&&(t.pointerType==="touch"?this._onTouchMove(t):this._onMouseMove(t))}function Cme(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($9),this.state=Vn.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 Nme(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 Mp.DOLLY:if(this.enableZoom===!1)return;this._handleMouseDownDolly(t),this.state=Vn.DOLLY;break;case Mp.ROTATE:if(t.ctrlKey||t.metaKey||t.shiftKey){if(this.enablePan===!1)return;this._handleMouseDownPan(t),this.state=Vn.PAN}else{if(this.enableRotate===!1)return;this._handleMouseDownRotate(t),this.state=Vn.ROTATE}break;case Mp.PAN:if(t.ctrlKey||t.metaKey||t.shiftKey){if(this.enableRotate===!1)return;this._handleMouseDownRotate(t),this.state=Vn.ROTATE}else{if(this.enablePan===!1)return;this._handleMouseDownPan(t),this.state=Vn.PAN}break;default:this.state=Vn.NONE}this.state!==Vn.NONE&&this.dispatchEvent(qP)}function Rme(t){switch(this.state){case Vn.ROTATE:if(this.enableRotate===!1)return;this._handleMouseMoveRotate(t);break;case Vn.DOLLY:if(this.enableZoom===!1)return;this._handleMouseMoveDolly(t);break;case Vn.PAN:if(this.enablePan===!1)return;this._handleMouseMovePan(t);break}}function Pme(t){this.enabled===!1||this.enableZoom===!1||this.state!==Vn.NONE||(t.preventDefault(),this.dispatchEvent(qP),this._handleMouseWheel(this._customWheelEvent(t)),this.dispatchEvent($9))}function Dme(t){this.enabled!==!1&&this._handleKeyDown(t)}function kme(t){switch(this._trackPointer(t),this._pointers.length){case 1:switch(this.touches.ONE){case xp.ROTATE:if(this.enableRotate===!1)return;this._handleTouchStartRotate(t),this.state=Vn.TOUCH_ROTATE;break;case xp.PAN:if(this.enablePan===!1)return;this._handleTouchStartPan(t),this.state=Vn.TOUCH_PAN;break;default:this.state=Vn.NONE}break;case 2:switch(this.touches.TWO){case xp.DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchStartDollyPan(t),this.state=Vn.TOUCH_DOLLY_PAN;break;case xp.DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchStartDollyRotate(t),this.state=Vn.TOUCH_DOLLY_ROTATE;break;default:this.state=Vn.NONE}break;default:this.state=Vn.NONE}this.state!==Vn.NONE&&this.dispatchEvent(qP)}function Ome(t){switch(this._trackPointer(t),this.state){case Vn.TOUCH_ROTATE:if(this.enableRotate===!1)return;this._handleTouchMoveRotate(t),this.update();break;case Vn.TOUCH_PAN:if(this.enablePan===!1)return;this._handleTouchMovePan(t),this.update();break;case Vn.TOUCH_DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchMoveDollyPan(t),this.update();break;case Vn.TOUCH_DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchMoveDollyRotate(t),this.update();break;default:this.state=Vn.NONE}}function Lme(t){this.enabled!==!1&&t.preventDefault()}function Ime(t){t.key==="Control"&&(this._controlActive=!0,this.domElement.getRootNode().addEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}function Ume(t){t.key==="Control"&&(this._controlActive=!1,this.domElement.getRootNode().removeEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}function jme(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={},o=t[0].morphTargetsRelative,l=new ol;let c=0;for(let d=0;d<t.length;++d){const f=t[d];let m=0;if(n!==(f.index!==null))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+d+". All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them."),null;for(const g in f.attributes){if(!i.has(g))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+d+'. All geometries must have compatible attributes; make sure "'+g+'" attribute exists among all geometries, or in none of them.'),null;a[g]===void 0&&(a[g]=[]),a[g].push(f.attributes[g]),m++}if(m!==i.size)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+d+". Make sure all geometries have the same number of attributes."),null;if(o!==f.morphTargetsRelative)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+d+". .morphTargetsRelative must be consistent throughout all geometries."),null;for(const g in f.morphAttributes){if(!r.has(g))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+d+". .morphAttributes must be consistent throughout all geometries."),null;s[g]===void 0&&(s[g]=[]),s[g].push(f.morphAttributes[g])}if(e){let g;if(n)g=f.index.count;else if(f.attributes.position!==void 0)g=f.attributes.position.count;else return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+d+". The geometry must have either an index or a position attribute"),null;l.addGroup(c,g,d),c+=g}}if(n){let d=0;const f=[];for(let m=0;m<t.length;++m){const g=t[m].index;for(let y=0;y<g.count;++y)f.push(g.getX(y)+d);d+=t[m].attributes.position.count}l.setIndex(f)}for(const d in a){const f=YF(a[d]);if(!f)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+d+" attribute."),null;l.setAttribute(d,f)}for(const d in s){const f=s[d][0].length;if(f===0)break;l.morphAttributes=l.morphAttributes||{},l.morphAttributes[d]=[];for(let m=0;m<f;++m){const g=[];for(let _=0;_<s[d].length;++_)g.push(s[d][_][m]);const y=YF(g);if(!y)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+d+" morphAttribute."),null;l.morphAttributes[d].push(y)}}return l}function YF(t){let e,n,i,r=-1,a=0;for(let c=0;c<t.length;++c){const d=t[c];if(e===void 0&&(e=d.array.constructor),e!==d.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=d.itemSize),n!==d.itemSize)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes."),null;if(i===void 0&&(i=d.normalized),i!==d.normalized)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes."),null;if(r===-1&&(r=d.gpuType),r!==d.gpuType)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.gpuType must be consistent across matching attributes."),null;a+=d.count*n}const s=new e(a),o=new Hs(s,n,i);let l=0;for(let c=0;c<t.length;++c){const d=t[c];if(d.isInterleavedBufferAttribute){const f=l/n;for(let m=0,g=d.count;m<g;m++)for(let y=0;y<n;y++){const _=d.getComponent(m,y);o.setComponent(m+f,y,_)}}else s.set(d.array,l);l+=d.count*n}return r!==void 0&&(o.gpuType=r),o}function Yy(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 iT={exports:{}};var ZF;function Fme(){return ZF||(ZF=1,(function(t,e){(function(n){t.exports=n()})(function(){return(function n(i,r,a){function s(c,d){if(!r[c]){if(!i[c]){var f=typeof Yy=="function"&&Yy;if(!d&&f)return f(c,!0);if(o)return o(c,!0);var m=new Error("Cannot find module '"+c+"'");throw m.code="MODULE_NOT_FOUND",m}var g=r[c]={exports:{}};i[c][0].call(g.exports,function(y){var _=i[c][1][y];return s(_||y)},g,g.exports,n,i,r,a)}return r[c].exports}for(var o=typeof Yy=="function"&&Yy,l=0;l<a.length;l++)s(a[l]);return s})({1:[function(n,i,r){var a=n("./utils"),s=n("./support"),o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";r.encode=function(l){for(var c,d,f,m,g,y,_,v=[],x=0,M=l.length,w=M,T=a.getTypeOf(l)!=="string";x<l.length;)w=M-x,f=T?(c=l[x++],d=x<M?l[x++]:0,x<M?l[x++]:0):(c=l.charCodeAt(x++),d=x<M?l.charCodeAt(x++):0,x<M?l.charCodeAt(x++):0),m=c>>2,g=(3&c)<<4|d>>4,y=1<w?(15&d)<<2|f>>6:64,_=2<w?63&f:64,v.push(o.charAt(m)+o.charAt(g)+o.charAt(y)+o.charAt(_));return v.join("")},r.decode=function(l){var c,d,f,m,g,y,_=0,v=0,x="data:";if(l.substr(0,x.length)===x)throw new Error("Invalid base64 input, it looks like a data url.");var M,w=3*(l=l.replace(/[^A-Za-z0-9+/=]/g,"")).length/4;if(l.charAt(l.length-1)===o.charAt(64)&&w--,l.charAt(l.length-2)===o.charAt(64)&&w--,w%1!=0)throw new Error("Invalid base64 input, bad content length.");for(M=s.uint8array?new Uint8Array(0|w):new Array(0|w);_<l.length;)c=o.indexOf(l.charAt(_++))<<2|(m=o.indexOf(l.charAt(_++)))>>4,d=(15&m)<<4|(g=o.indexOf(l.charAt(_++)))>>2,f=(3&g)<<6|(y=o.indexOf(l.charAt(_++))),M[v++]=c,g!==64&&(M[v++]=d),y!==64&&(M[v++]=f);return M}},{"./support":30,"./utils":32}],2:[function(n,i,r){var a=n("./external"),s=n("./stream/DataWorker"),o=n("./stream/Crc32Probe"),l=n("./stream/DataLengthProbe");function c(d,f,m,g,y){this.compressedSize=d,this.uncompressedSize=f,this.crc32=m,this.compression=g,this.compressedContent=y}c.prototype={getContentWorker:function(){var d=new s(a.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new l("data_length")),f=this;return d.on("end",function(){if(this.streamInfo.data_length!==f.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),d},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)}},c.createWorkerFrom=function(d,f,m){return d.pipe(new o).pipe(new l("uncompressedSize")).pipe(f.compressWorker(m)).pipe(new l("compressedSize")).withStreamInfo("compression",f)},i.exports=c},{"./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 o,l=[],c=0;c<256;c++){o=c;for(var d=0;d<8;d++)o=1&o?3988292384^o>>>1:o>>>1;l[c]=o}return l})();i.exports=function(o,l){return o!==void 0&&o.length?a.getTypeOf(o)!=="string"?(function(c,d,f,m){var g=s,y=m+f;c^=-1;for(var _=m;_<y;_++)c=c>>>8^g[255&(c^d[_])];return-1^c})(0|l,o,o.length,0):(function(c,d,f,m){var g=s,y=m+f;c^=-1;for(var _=m;_<y;_++)c=c>>>8^g[255&(c^d.charCodeAt(_))];return-1^c})(0|l,o,o.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"),o=n("./utils"),l=n("./stream/GenericWorker"),c=a?"uint8array":"array";function d(f,m){l.call(this,"FlateWorker/"+f),this._pako=null,this._pakoAction=f,this._pakoOptions=m,this.meta={}}r.magic="\b\0",o.inherits(d,l),d.prototype.processChunk=function(f){this.meta=f.meta,this._pako===null&&this._createPako(),this._pako.push(o.transformTo(c,f.data),!1)},d.prototype.flush=function(){l.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},d.prototype.cleanUp=function(){l.prototype.cleanUp.call(this),this._pako=null},d.prototype._createPako=function(){this._pako=new s[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var f=this;this._pako.onData=function(m){f.push({data:m,meta:f.meta})}},r.compressWorker=function(f){return new d("Deflate",f)},r.uncompressWorker=function(){return new d("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(n,i,r){function a(g,y){var _,v="";for(_=0;_<y;_++)v+=String.fromCharCode(255&g),g>>>=8;return v}function s(g,y,_,v,x,M){var w,T,C=g.file,P=g.compression,A=M!==c.utf8encode,U=o.transformTo("string",M(C.name)),N=o.transformTo("string",c.utf8encode(C.name)),D=C.comment,F=o.transformTo("string",M(D)),I=o.transformTo("string",c.utf8encode(D)),W=N.length!==C.name.length,O=I.length!==D.length,B="",H="",$="",K=C.dir,Z=C.date,se={crc32:0,compressedSize:0,uncompressedSize:0};y&&!_||(se.crc32=g.crc32,se.compressedSize=g.compressedSize,se.uncompressedSize=g.uncompressedSize);var V=0;y&&(V|=8),A||!W&&!O||(V|=2048);var X=0,ae=0;K&&(X|=16),x==="UNIX"?(ae=798,X|=(function(ge,ne){var ve=ge;return ge||(ve=ne?16893:33204),(65535&ve)<<16})(C.unixPermissions,K)):(ae=20,X|=(function(ge){return 63&(ge||0)})(C.dosPermissions)),w=Z.getUTCHours(),w<<=6,w|=Z.getUTCMinutes(),w<<=5,w|=Z.getUTCSeconds()/2,T=Z.getUTCFullYear()-1980,T<<=4,T|=Z.getUTCMonth()+1,T<<=5,T|=Z.getUTCDate(),W&&(H=a(1,1)+a(d(U),4)+N,B+="up"+a(H.length,2)+H),O&&($=a(1,1)+a(d(F),4)+I,B+="uc"+a($.length,2)+$);var ce="";return ce+=`
  3839. \0`,ce+=a(V,2),ce+=P.magic,ce+=a(w,2),ce+=a(T,2),ce+=a(se.crc32,4),ce+=a(se.compressedSize,4),ce+=a(se.uncompressedSize,4),ce+=a(U.length,2),ce+=a(B.length,2),{fileRecord:f.LOCAL_FILE_HEADER+ce+U+B,dirRecord:f.CENTRAL_FILE_HEADER+a(ae,2)+ce+a(F.length,2)+"\0\0\0\0"+a(X,4)+a(v,4)+U+B+F}}var o=n("../utils"),l=n("../stream/GenericWorker"),c=n("../utf8"),d=n("../crc32"),f=n("../signature");function m(g,y,_,v){l.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=y,this.zipPlatform=_,this.encodeFileName=v,this.streamFiles=g,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}o.inherits(m,l),m.prototype.push=function(g){var y=g.meta.percent||0,_=this.entriesCount,v=this._sources.length;this.accumulate?this.contentBuffer.push(g):(this.bytesWritten+=g.data.length,l.prototype.push.call(this,{data:g.data,meta:{currentFile:this.currentFile,percent:_?(y+100*(_-v-1))/_:100}}))},m.prototype.openedSource=function(g){this.currentSourceOffset=this.bytesWritten,this.currentFile=g.file.name;var y=this.streamFiles&&!g.file.dir;if(y){var _=s(g,y,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:_.fileRecord,meta:{percent:0}})}else this.accumulate=!0},m.prototype.closedSource=function(g){this.accumulate=!1;var y=this.streamFiles&&!g.file.dir,_=s(g,y,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(_.dirRecord),y)this.push({data:(function(v){return f.DATA_DESCRIPTOR+a(v.crc32,4)+a(v.compressedSize,4)+a(v.uncompressedSize,4)})(g),meta:{percent:100}});else for(this.push({data:_.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},m.prototype.flush=function(){for(var g=this.bytesWritten,y=0;y<this.dirRecords.length;y++)this.push({data:this.dirRecords[y],meta:{percent:100}});var _=this.bytesWritten-g,v=(function(x,M,w,T,C){var P=o.transformTo("string",C(T));return f.CENTRAL_DIRECTORY_END+"\0\0\0\0"+a(x,2)+a(x,2)+a(M,4)+a(w,4)+a(P.length,2)+P})(this.dirRecords.length,_,g,this.zipComment,this.encodeFileName);this.push({data:v,meta:{percent:100}})},m.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()},m.prototype.registerPrevious=function(g){this._sources.push(g);var y=this;return g.on("data",function(_){y.processChunk(_)}),g.on("end",function(){y.closedSource(y.previous.streamInfo),y._sources.length?y.prepareNextSource():y.end()}),g.on("error",function(_){y.error(_)}),this},m.prototype.resume=function(){return!!l.prototype.resume.call(this)&&(!this.previous&&this._sources.length?(this.prepareNextSource(),!0):this.previous||this._sources.length||this.generatedError?void 0:(this.end(),!0))},m.prototype.error=function(g){var y=this._sources;if(!l.prototype.error.call(this,g))return!1;for(var _=0;_<y.length;_++)try{y[_].error(g)}catch{}return!0},m.prototype.lock=function(){l.prototype.lock.call(this);for(var g=this._sources,y=0;y<g.length;y++)g[y].lock()},i.exports=m},{"../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(o,l,c){var d=new s(l.streamFiles,c,l.platform,l.encodeFileName),f=0;try{o.forEach(function(m,g){f++;var y=(function(M,w){var T=M||w,C=a[T];if(!C)throw new Error(T+" is not a valid compression method !");return C})(g.options.compression,l.compression),_=g.options.compressionOptions||l.compressionOptions||{},v=g.dir,x=g.date;g._compressWorker(y,_).withStreamInfo("file",{name:m,dir:v,date:x,comment:g.comment||"",unixPermissions:g.unixPermissions,dosPermissions:g.dosPermissions}).pipe(d)}),d.entriesCount=f}catch(m){d.error(m)}return d}},{"../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 o in this)typeof this[o]!="function"&&(s[o]=this[o]);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,o){return new a().loadAsync(s,o)},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"),o=n("./utf8"),l=n("./zipEntries"),c=n("./stream/Crc32Probe"),d=n("./nodejsUtils");function f(m){return new s.Promise(function(g,y){var _=m.decompressed.getContentWorker().pipe(new c);_.on("error",function(v){y(v)}).on("end",function(){_.streamInfo.crc32!==m.decompressed.crc32?y(new Error("Corrupted zip : CRC32 mismatch")):g()}).resume()})}i.exports=function(m,g){var y=this;return g=a.extend(g||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:o.utf8decode}),d.isNode&&d.isStream(m)?s.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):a.prepareContent("the loaded zip file",m,!0,g.optimizedBinaryString,g.base64).then(function(_){var v=new l(g);return v.load(_),v}).then(function(_){var v=[s.Promise.resolve(_)],x=_.files;if(g.checkCRC32)for(var M=0;M<x.length;M++)v.push(f(x[M]));return s.Promise.all(v)}).then(function(_){for(var v=_.shift(),x=v.files,M=0;M<x.length;M++){var w=x[M],T=w.fileNameStr,C=a.resolve(w.fileNameStr);y.file(C,w.decompressed,{binary:!0,optimizedBinaryString:!0,date:w.date,dir:w.dir,comment:w.fileCommentStr.length?w.fileCommentStr:null,unixPermissions:w.unixPermissions,dosPermissions:w.dosPermissions,createFolders:g.createFolders}),w.dir||(y.file(C).unsafeOriginalName=T)}return v.zipComment.length&&(y.comment=v.zipComment),y})}},{"./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 o(l,c){s.call(this,"Nodejs stream input adapter for "+l),this._upstreamEnded=!1,this._bindStream(c)}a.inherits(o,s),o.prototype._bindStream=function(l){var c=this;(this._stream=l).pause(),l.on("data",function(d){c.push({data:d,meta:{percent:0}})}).on("error",function(d){c.isPaused?this.generatedError=d:c.error(d)}).on("end",function(){c.isPaused?c._upstreamEnded=!0:c.end()})},o.prototype.pause=function(){return!!s.prototype.pause.call(this)&&(this._stream.pause(),!0)},o.prototype.resume=function(){return!!s.prototype.resume.call(this)&&(this._upstreamEnded?this.end():this._stream.resume(),!0)},i.exports=o},{"../stream/GenericWorker":28,"../utils":32}],13:[function(n,i,r){var a=n("readable-stream").Readable;function s(o,l,c){a.call(this,l),this._helper=o;var d=this;o.on("data",function(f,m){d.push(f)||d._helper.pause(),c&&c(m)}).on("error",function(f){d.emit("error",f)}).on("end",function(){d.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(C,P,A){var U,N=o.getTypeOf(P),D=o.extend(A||{},d);D.date=D.date||new Date,D.compression!==null&&(D.compression=D.compression.toUpperCase()),typeof D.unixPermissions=="string"&&(D.unixPermissions=parseInt(D.unixPermissions,8)),D.unixPermissions&&16384&D.unixPermissions&&(D.dir=!0),D.dosPermissions&&16&D.dosPermissions&&(D.dir=!0),D.dir&&(C=x(C)),D.createFolders&&(U=v(C))&&M.call(this,U,!0);var F=N==="string"&&D.binary===!1&&D.base64===!1;A&&A.binary!==void 0||(D.binary=!F),(P instanceof f&&P.uncompressedSize===0||D.dir||!P||P.length===0)&&(D.base64=!1,D.binary=!0,P="",D.compression="STORE",N="string");var I=null;I=P instanceof f||P instanceof l?P:y.isNode&&y.isStream(P)?new _(C,P):o.prepareContent(C,P,D.binary,D.optimizedBinaryString,D.base64);var W=new m(C,I,D);this.files[C]=W}var s=n("./utf8"),o=n("./utils"),l=n("./stream/GenericWorker"),c=n("./stream/StreamHelper"),d=n("./defaults"),f=n("./compressedObject"),m=n("./zipObject"),g=n("./generate"),y=n("./nodejsUtils"),_=n("./nodejs/NodejsStreamInputAdapter"),v=function(C){C.slice(-1)==="/"&&(C=C.substring(0,C.length-1));var P=C.lastIndexOf("/");return 0<P?C.substring(0,P):""},x=function(C){return C.slice(-1)!=="/"&&(C+="/"),C},M=function(C,P){return P=P!==void 0?P:d.createFolders,C=x(C),this.files[C]||a.call(this,C,null,{dir:!0,createFolders:P}),this.files[C]};function w(C){return Object.prototype.toString.call(C)==="[object RegExp]"}var T={load:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(C){var P,A,U;for(P in this.files)U=this.files[P],(A=P.slice(this.root.length,P.length))&&P.slice(0,this.root.length)===this.root&&C(A,U)},filter:function(C){var P=[];return this.forEach(function(A,U){C(A,U)&&P.push(U)}),P},file:function(C,P,A){if(arguments.length!==1)return C=this.root+C,a.call(this,C,P,A),this;if(w(C)){var U=C;return this.filter(function(D,F){return!F.dir&&U.test(D)})}var N=this.files[this.root+C];return N&&!N.dir?N:null},folder:function(C){if(!C)return this;if(w(C))return this.filter(function(N,D){return D.dir&&C.test(N)});var P=this.root+C,A=M.call(this,P),U=this.clone();return U.root=A.name,U},remove:function(C){C=this.root+C;var P=this.files[C];if(P||(C.slice(-1)!=="/"&&(C+="/"),P=this.files[C]),P&&!P.dir)delete this.files[C];else for(var A=this.filter(function(N,D){return D.name.slice(0,C.length)===C}),U=0;U<A.length;U++)delete this.files[A[U].name];return this},generate:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function(C){var P,A={};try{if((A=o.extend(C||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:s.utf8encode})).type=A.type.toLowerCase(),A.compression=A.compression.toUpperCase(),A.type==="binarystring"&&(A.type="string"),!A.type)throw new Error("No output type specified.");o.checkSupport(A.type),A.platform!=="darwin"&&A.platform!=="freebsd"&&A.platform!=="linux"&&A.platform!=="sunos"||(A.platform="UNIX"),A.platform==="win32"&&(A.platform="DOS");var U=A.comment||this.comment||"";P=g.generateWorker(this,A,U)}catch(N){(P=new l("error")).error(N)}return new c(P,A.type||"string",A.mimeType)},generateAsync:function(C,P){return this.generateInternalStream(C).accumulate(P)},generateNodeStream:function(C,P){return(C=C||{}).type||(C.type="nodebuffer"),this.generateInternalStream(C).toNodejsStream(P)}};i.exports=T},{"./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(o){a.call(this,o);for(var l=0;l<this.data.length;l++)o[l]=255&o[l]}n("../utils").inherits(s,a),s.prototype.byteAt=function(o){return this.data[this.zero+o]},s.prototype.lastIndexOfSignature=function(o){for(var l=o.charCodeAt(0),c=o.charCodeAt(1),d=o.charCodeAt(2),f=o.charCodeAt(3),m=this.length-4;0<=m;--m)if(this.data[m]===l&&this.data[m+1]===c&&this.data[m+2]===d&&this.data[m+3]===f)return m-this.zero;return-1},s.prototype.readAndCheckSignature=function(o){var l=o.charCodeAt(0),c=o.charCodeAt(1),d=o.charCodeAt(2),f=o.charCodeAt(3),m=this.readData(4);return l===m[0]&&c===m[1]&&d===m[2]&&f===m[3]},s.prototype.readData=function(o){if(this.checkOffset(o),o===0)return[];var l=this.data.slice(this.zero+this.index,this.zero+this.index+o);return this.index+=o,l},i.exports=s},{"../utils":32,"./DataReader":18}],18:[function(n,i,r){var a=n("../utils");function s(o){this.data=o,this.length=o.length,this.index=0,this.zero=0}s.prototype={checkOffset:function(o){this.checkIndex(this.index+o)},checkIndex:function(o){if(this.length<this.zero+o||o<0)throw new Error("End of data reached (data length = "+this.length+", asked index = "+o+"). Corrupted zip ?")},setIndex:function(o){this.checkIndex(o),this.index=o},skip:function(o){this.setIndex(this.index+o)},byteAt:function(){},readInt:function(o){var l,c=0;for(this.checkOffset(o),l=this.index+o-1;l>=this.index;l--)c=(c<<8)+this.byteAt(l);return this.index+=o,c},readString:function(o){return a.transformTo("string",this.readData(o))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var o=this.readInt(4);return new Date(Date.UTC(1980+(o>>25&127),(o>>21&15)-1,o>>16&31,o>>11&31,o>>5&63,(31&o)<<1))}},i.exports=s},{"../utils":32}],19:[function(n,i,r){var a=n("./Uint8ArrayReader");function s(o){a.call(this,o)}n("../utils").inherits(s,a),s.prototype.readData=function(o){this.checkOffset(o);var l=this.data.slice(this.zero+this.index,this.zero+this.index+o);return this.index+=o,l},i.exports=s},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(n,i,r){var a=n("./DataReader");function s(o){a.call(this,o)}n("../utils").inherits(s,a),s.prototype.byteAt=function(o){return this.data.charCodeAt(this.zero+o)},s.prototype.lastIndexOfSignature=function(o){return this.data.lastIndexOf(o)-this.zero},s.prototype.readAndCheckSignature=function(o){return o===this.readData(4)},s.prototype.readData=function(o){this.checkOffset(o);var l=this.data.slice(this.zero+this.index,this.zero+this.index+o);return this.index+=o,l},i.exports=s},{"../utils":32,"./DataReader":18}],21:[function(n,i,r){var a=n("./ArrayReader");function s(o){a.call(this,o)}n("../utils").inherits(s,a),s.prototype.readData=function(o){if(this.checkOffset(o),o===0)return new Uint8Array(0);var l=this.data.subarray(this.zero+this.index,this.zero+this.index+o);return this.index+=o,l},i.exports=s},{"../utils":32,"./ArrayReader":17}],22:[function(n,i,r){var a=n("../utils"),s=n("../support"),o=n("./ArrayReader"),l=n("./StringReader"),c=n("./NodeBufferReader"),d=n("./Uint8ArrayReader");i.exports=function(f){var m=a.getTypeOf(f);return a.checkSupport(m),m!=="string"||s.uint8array?m==="nodebuffer"?new c(f):s.uint8array?new d(a.transformTo("uint8array",f)):new o(a.transformTo("array",f)):new l(f)}},{"../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 o(l){a.call(this,"ConvertWorker to "+l),this.destType=l}s.inherits(o,a),o.prototype.processChunk=function(l){this.push({data:s.transformTo(this.destType,l.data),meta:l.meta})},i.exports=o},{"../utils":32,"./GenericWorker":28}],25:[function(n,i,r){var a=n("./GenericWorker"),s=n("../crc32");function o(){a.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}n("../utils").inherits(o,a),o.prototype.processChunk=function(l){this.streamInfo.crc32=s(l.data,this.streamInfo.crc32||0),this.push(l)},i.exports=o},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(n,i,r){var a=n("../utils"),s=n("./GenericWorker");function o(l){s.call(this,"DataLengthProbe for "+l),this.propName=l,this.withStreamInfo(l,0)}a.inherits(o,s),o.prototype.processChunk=function(l){if(l){var c=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=c+l.data.length}s.prototype.processChunk.call(this,l)},i.exports=o},{"../utils":32,"./GenericWorker":28}],27:[function(n,i,r){var a=n("../utils"),s=n("./GenericWorker");function o(l){s.call(this,"DataWorker");var c=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,l.then(function(d){c.dataIsReady=!0,c.data=d,c.max=d&&d.length||0,c.type=a.getTypeOf(d),c.isPaused||c._tickAndRepeat()},function(d){c.error(d)})}a.inherits(o,s),o.prototype.cleanUp=function(){s.prototype.cleanUp.call(this),this.data=null},o.prototype.resume=function(){return!!s.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,a.delay(this._tickAndRepeat,[],this)),!0)},o.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(a.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},o.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var l=null,c=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":l=this.data.substring(this.index,c);break;case"uint8array":l=this.data.subarray(this.index,c);break;case"array":case"nodebuffer":l=this.data.slice(this.index,c)}return this.index=c,this.push({data:l,meta:{percent:this.max?this.index/this.max*100:0}})},i.exports=o},{"../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,o){return this._listeners[s].push(o),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(s,o){if(this._listeners[s])for(var l=0;l<this._listeners[s].length;l++)this._listeners[s][l].call(this,o)},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 o=this;return s.on("data",function(l){o.processChunk(l)}),s.on("end",function(){o.end()}),s.on("error",function(l){o.error(l)}),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,o){return this.extraStreamInfo[s]=o,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"),o=n("./GenericWorker"),l=n("../base64"),c=n("../support"),d=n("../external"),f=null;if(c.nodestream)try{f=n("../nodejs/NodejsStreamOutputAdapter")}catch{}function m(y,_){return new d.Promise(function(v,x){var M=[],w=y._internalType,T=y._outputType,C=y._mimeType;y.on("data",function(P,A){M.push(P),_&&_(A)}).on("error",function(P){M=[],x(P)}).on("end",function(){try{var P=(function(A,U,N){switch(A){case"blob":return a.newBlob(a.transformTo("arraybuffer",U),N);case"base64":return l.encode(U);default:return a.transformTo(A,U)}})(T,(function(A,U){var N,D=0,F=null,I=0;for(N=0;N<U.length;N++)I+=U[N].length;switch(A){case"string":return U.join("");case"array":return Array.prototype.concat.apply([],U);case"uint8array":for(F=new Uint8Array(I),N=0;N<U.length;N++)F.set(U[N],D),D+=U[N].length;return F;case"nodebuffer":return Buffer.concat(U);default:throw new Error("concat : unsupported type '"+A+"'")}})(w,M),C);v(P)}catch(A){x(A)}M=[]}).resume()})}function g(y,_,v){var x=_;switch(_){case"blob":case"arraybuffer":x="uint8array";break;case"base64":x="string"}try{this._internalType=x,this._outputType=_,this._mimeType=v,a.checkSupport(x),this._worker=y.pipe(new s(x)),y.lock()}catch(M){this._worker=new o("error"),this._worker.error(M)}}g.prototype={accumulate:function(y){return m(this,y)},on:function(y,_){var v=this;return y==="data"?this._worker.on(y,function(x){_.call(v,x.data,x.meta)}):this._worker.on(y,function(){a.delay(_,arguments,v)}),this},resume:function(){return a.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(y){if(a.checkSupport("nodestream"),this._outputType!=="nodebuffer")throw new Error(this._outputType+" is not supported by this method");return new f(this,{objectMode:this._outputType!=="nodebuffer"},y)}},i.exports=g},{"../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"),o=n("./nodejsUtils"),l=n("./stream/GenericWorker"),c=new Array(256),d=0;d<256;d++)c[d]=252<=d?6:248<=d?5:240<=d?4:224<=d?3:192<=d?2:1;c[254]=c[254]=1;function f(){l.call(this,"utf-8 decode"),this.leftOver=null}function m(){l.call(this,"utf-8 encode")}r.utf8encode=function(g){return s.nodebuffer?o.newBufferFrom(g,"utf-8"):(function(y){var _,v,x,M,w,T=y.length,C=0;for(M=0;M<T;M++)(64512&(v=y.charCodeAt(M)))==55296&&M+1<T&&(64512&(x=y.charCodeAt(M+1)))==56320&&(v=65536+(v-55296<<10)+(x-56320),M++),C+=v<128?1:v<2048?2:v<65536?3:4;for(_=s.uint8array?new Uint8Array(C):new Array(C),M=w=0;w<C;M++)(64512&(v=y.charCodeAt(M)))==55296&&M+1<T&&(64512&(x=y.charCodeAt(M+1)))==56320&&(v=65536+(v-55296<<10)+(x-56320),M++),v<128?_[w++]=v:(v<2048?_[w++]=192|v>>>6:(v<65536?_[w++]=224|v>>>12:(_[w++]=240|v>>>18,_[w++]=128|v>>>12&63),_[w++]=128|v>>>6&63),_[w++]=128|63&v);return _})(g)},r.utf8decode=function(g){return s.nodebuffer?a.transformTo("nodebuffer",g).toString("utf-8"):(function(y){var _,v,x,M,w=y.length,T=new Array(2*w);for(_=v=0;_<w;)if((x=y[_++])<128)T[v++]=x;else if(4<(M=c[x]))T[v++]=65533,_+=M-1;else{for(x&=M===2?31:M===3?15:7;1<M&&_<w;)x=x<<6|63&y[_++],M--;1<M?T[v++]=65533:x<65536?T[v++]=x:(x-=65536,T[v++]=55296|x>>10&1023,T[v++]=56320|1023&x)}return T.length!==v&&(T.subarray?T=T.subarray(0,v):T.length=v),a.applyFromCharCode(T)})(g=a.transformTo(s.uint8array?"uint8array":"array",g))},a.inherits(f,l),f.prototype.processChunk=function(g){var y=a.transformTo(s.uint8array?"uint8array":"array",g.data);if(this.leftOver&&this.leftOver.length){if(s.uint8array){var _=y;(y=new Uint8Array(_.length+this.leftOver.length)).set(this.leftOver,0),y.set(_,this.leftOver.length)}else y=this.leftOver.concat(y);this.leftOver=null}var v=(function(M,w){var T;for((w=w||M.length)>M.length&&(w=M.length),T=w-1;0<=T&&(192&M[T])==128;)T--;return T<0||T===0?w:T+c[M[T]]>w?T:w})(y),x=y;v!==y.length&&(s.uint8array?(x=y.subarray(0,v),this.leftOver=y.subarray(v,y.length)):(x=y.slice(0,v),this.leftOver=y.slice(v,y.length))),this.push({data:r.utf8decode(x),meta:g.meta})},f.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:r.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},r.Utf8DecodeWorker=f,a.inherits(m,l),m.prototype.processChunk=function(g){this.push({data:r.utf8encode(g.data),meta:g.meta})},r.Utf8EncodeWorker=m},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(n,i,r){var a=n("./support"),s=n("./base64"),o=n("./nodejsUtils"),l=n("./external");function c(_){return _}function d(_,v){for(var x=0;x<_.length;++x)v[x]=255&_.charCodeAt(x);return v}n("setimmediate"),r.newBlob=function(_,v){r.checkSupport("blob");try{return new Blob([_],{type:v})}catch{try{var x=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);return x.append(_),x.getBlob(v)}catch{throw new Error("Bug : can't construct the Blob.")}}};var f={stringifyByChunk:function(_,v,x){var M=[],w=0,T=_.length;if(T<=x)return String.fromCharCode.apply(null,_);for(;w<T;)v==="array"||v==="nodebuffer"?M.push(String.fromCharCode.apply(null,_.slice(w,Math.min(w+x,T)))):M.push(String.fromCharCode.apply(null,_.subarray(w,Math.min(w+x,T)))),w+=x;return M.join("")},stringifyByChar:function(_){for(var v="",x=0;x<_.length;x++)v+=String.fromCharCode(_[x]);return v},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,o.allocBuffer(1)).length===1}catch{return!1}})()}};function m(_){var v=65536,x=r.getTypeOf(_),M=!0;if(x==="uint8array"?M=f.applyCanBeUsed.uint8array:x==="nodebuffer"&&(M=f.applyCanBeUsed.nodebuffer),M)for(;1<v;)try{return f.stringifyByChunk(_,x,v)}catch{v=Math.floor(v/2)}return f.stringifyByChar(_)}function g(_,v){for(var x=0;x<_.length;x++)v[x]=_[x];return v}r.applyFromCharCode=m;var y={};y.string={string:c,array:function(_){return d(_,new Array(_.length))},arraybuffer:function(_){return y.string.uint8array(_).buffer},uint8array:function(_){return d(_,new Uint8Array(_.length))},nodebuffer:function(_){return d(_,o.allocBuffer(_.length))}},y.array={string:m,array:c,arraybuffer:function(_){return new Uint8Array(_).buffer},uint8array:function(_){return new Uint8Array(_)},nodebuffer:function(_){return o.newBufferFrom(_)}},y.arraybuffer={string:function(_){return m(new Uint8Array(_))},array:function(_){return g(new Uint8Array(_),new Array(_.byteLength))},arraybuffer:c,uint8array:function(_){return new Uint8Array(_)},nodebuffer:function(_){return o.newBufferFrom(new Uint8Array(_))}},y.uint8array={string:m,array:function(_){return g(_,new Array(_.length))},arraybuffer:function(_){return _.buffer},uint8array:c,nodebuffer:function(_){return o.newBufferFrom(_)}},y.nodebuffer={string:m,array:function(_){return g(_,new Array(_.length))},arraybuffer:function(_){return y.nodebuffer.uint8array(_).buffer},uint8array:function(_){return g(_,new Uint8Array(_.length))},nodebuffer:c},r.transformTo=function(_,v){if(v=v||"",!_)return v;r.checkSupport(_);var x=r.getTypeOf(v);return y[x][_](v)},r.resolve=function(_){for(var v=_.split("/"),x=[],M=0;M<v.length;M++){var w=v[M];w==="."||w===""&&M!==0&&M!==v.length-1||(w===".."?x.pop():x.push(w))}return x.join("/")},r.getTypeOf=function(_){return typeof _=="string"?"string":Object.prototype.toString.call(_)==="[object Array]"?"array":a.nodebuffer&&o.isBuffer(_)?"nodebuffer":a.uint8array&&_ instanceof Uint8Array?"uint8array":a.arraybuffer&&_ instanceof ArrayBuffer?"arraybuffer":void 0},r.checkSupport=function(_){if(!a[_.toLowerCase()])throw new Error(_+" is not supported by this platform")},r.MAX_VALUE_16BITS=65535,r.MAX_VALUE_32BITS=-1,r.pretty=function(_){var v,x,M="";for(x=0;x<(_||"").length;x++)M+="\\x"+((v=_.charCodeAt(x))<16?"0":"")+v.toString(16).toUpperCase();return M},r.delay=function(_,v,x){setImmediate(function(){_.apply(x||null,v||[])})},r.inherits=function(_,v){function x(){}x.prototype=v.prototype,_.prototype=new x},r.extend=function(){var _,v,x={};for(_=0;_<arguments.length;_++)for(v in arguments[_])Object.prototype.hasOwnProperty.call(arguments[_],v)&&x[v]===void 0&&(x[v]=arguments[_][v]);return x},r.prepareContent=function(_,v,x,M,w){return l.Promise.resolve(v).then(function(T){return a.blob&&(T instanceof Blob||["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(T))!==-1)&&typeof FileReader<"u"?new l.Promise(function(C,P){var A=new FileReader;A.onload=function(U){C(U.target.result)},A.onerror=function(U){P(U.target.error)},A.readAsArrayBuffer(T)}):T}).then(function(T){var C=r.getTypeOf(T);return C?(C==="arraybuffer"?T=r.transformTo("uint8array",T):C==="string"&&(w?T=s.decode(T):x&&M!==!0&&(T=(function(P){return d(P,a.uint8array?new Uint8Array(P.length):new Array(P.length))})(T))),T):l.Promise.reject(new Error("Can't read the data of '"+_+"'. 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"),o=n("./signature"),l=n("./zipEntry"),c=n("./support");function d(f){this.files=[],this.loadOptions=f}d.prototype={checkSignature:function(f){if(!this.reader.readAndCheckSignature(f)){this.reader.index-=4;var m=this.reader.readString(4);throw new Error("Corrupted zip or bug: unexpected signature ("+s.pretty(m)+", expected "+s.pretty(f)+")")}},isSignature:function(f,m){var g=this.reader.index;this.reader.setIndex(f);var y=this.reader.readString(4)===m;return this.reader.setIndex(g),y},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 f=this.reader.readData(this.zipCommentLength),m=c.uint8array?"uint8array":"array",g=s.transformTo(m,f);this.zipComment=this.loadOptions.decodeFileName(g)},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 f,m,g,y=this.zip64EndOfCentralSize-44;0<y;)f=this.reader.readInt(2),m=this.reader.readInt(4),g=this.reader.readData(m),this.zip64ExtensibleData[f]={id:f,length:m,value:g}},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 f,m;for(f=0;f<this.files.length;f++)m=this.files[f],this.reader.setIndex(m.localHeaderOffset),this.checkSignature(o.LOCAL_FILE_HEADER),m.readLocalPart(this.reader),m.handleUTF8(),m.processAttributes()},readCentralDir:function(){var f;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(o.CENTRAL_FILE_HEADER);)(f=new l({zip64:this.zip64},this.loadOptions)).readCentralPart(this.reader),this.files.push(f);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 f=this.reader.lastIndexOfSignature(o.CENTRAL_DIRECTORY_END);if(f<0)throw this.isSignature(0,o.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(f);var m=f;if(this.checkSignature(o.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,(f=this.reader.lastIndexOfSignature(o.ZIP64_CENTRAL_DIRECTORY_LOCATOR))<0)throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex(f),this.checkSignature(o.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,o.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(o.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(o.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var g=this.centralDirOffset+this.centralDirSize;this.zip64&&(g+=20,g+=12+this.zip64EndOfCentralSize);var y=m-g;if(0<y)this.isSignature(m,o.CENTRAL_FILE_HEADER)||(this.reader.zero=y);else if(y<0)throw new Error("Corrupted zip: missing "+Math.abs(y)+" bytes.")},prepareReader:function(f){this.reader=a(f)},load:function(f){this.prepareReader(f),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}},i.exports=d},{"./reader/readerFor":22,"./signature":23,"./support":30,"./utils":32,"./zipEntry":34}],34:[function(n,i,r){var a=n("./reader/readerFor"),s=n("./utils"),o=n("./compressedObject"),l=n("./crc32"),c=n("./utf8"),d=n("./compressions"),f=n("./support");function m(g,y){this.options=g,this.loadOptions=y}m.prototype={isEncrypted:function(){return(1&this.bitFlag)==1},useUTF8:function(){return(2048&this.bitFlag)==2048},readLocalPart:function(g){var y,_;if(g.skip(22),this.fileNameLength=g.readInt(2),_=g.readInt(2),this.fileName=g.readData(this.fileNameLength),g.skip(_),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((y=(function(v){for(var x in d)if(Object.prototype.hasOwnProperty.call(d,x)&&d[x].magic===v)return d[x];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 o(this.compressedSize,this.uncompressedSize,this.crc32,y,g.readData(this.compressedSize))},readCentralPart:function(g){this.versionMadeBy=g.readInt(2),g.skip(2),this.bitFlag=g.readInt(2),this.compressionMethod=g.readString(2),this.date=g.readDate(),this.crc32=g.readInt(4),this.compressedSize=g.readInt(4),this.uncompressedSize=g.readInt(4);var y=g.readInt(2);if(this.extraFieldsLength=g.readInt(2),this.fileCommentLength=g.readInt(2),this.diskNumberStart=g.readInt(2),this.internalFileAttributes=g.readInt(2),this.externalFileAttributes=g.readInt(4),this.localHeaderOffset=g.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");g.skip(y),this.readExtraFields(g),this.parseZIP64ExtraField(g),this.fileComment=g.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var g=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),g==0&&(this.dosPermissions=63&this.externalFileAttributes),g==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var g=a(this.extraFields[1].value);this.uncompressedSize===s.MAX_VALUE_32BITS&&(this.uncompressedSize=g.readInt(8)),this.compressedSize===s.MAX_VALUE_32BITS&&(this.compressedSize=g.readInt(8)),this.localHeaderOffset===s.MAX_VALUE_32BITS&&(this.localHeaderOffset=g.readInt(8)),this.diskNumberStart===s.MAX_VALUE_32BITS&&(this.diskNumberStart=g.readInt(4))}},readExtraFields:function(g){var y,_,v,x=g.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});g.index+4<x;)y=g.readInt(2),_=g.readInt(2),v=g.readData(_),this.extraFields[y]={id:y,length:_,value:v};g.setIndex(x)},handleUTF8:function(){var g=f.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=c.utf8decode(this.fileName),this.fileCommentStr=c.utf8decode(this.fileComment);else{var y=this.findExtraFieldUnicodePath();if(y!==null)this.fileNameStr=y;else{var _=s.transformTo(g,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(_)}var v=this.findExtraFieldUnicodeComment();if(v!==null)this.fileCommentStr=v;else{var x=s.transformTo(g,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(x)}}},findExtraFieldUnicodePath:function(){var g=this.extraFields[28789];if(g){var y=a(g.value);return y.readInt(1)!==1||l(this.fileName)!==y.readInt(4)?null:c.utf8decode(y.readData(g.length-5))}return null},findExtraFieldUnicodeComment:function(){var g=this.extraFields[25461];if(g){var y=a(g.value);return y.readInt(1)!==1||l(this.fileComment)!==y.readInt(4)?null:c.utf8decode(y.readData(g.length-5))}return null}},i.exports=m},{"./compressedObject":2,"./compressions":3,"./crc32":4,"./reader/readerFor":22,"./support":30,"./utf8":31,"./utils":32}],35:[function(n,i,r){function a(y,_,v){this.name=y,this.dir=v.dir,this.date=v.date,this.comment=v.comment,this.unixPermissions=v.unixPermissions,this.dosPermissions=v.dosPermissions,this._data=_,this._dataBinary=v.binary,this.options={compression:v.compression,compressionOptions:v.compressionOptions}}var s=n("./stream/StreamHelper"),o=n("./stream/DataWorker"),l=n("./utf8"),c=n("./compressedObject"),d=n("./stream/GenericWorker");a.prototype={internalStream:function(y){var _=null,v="string";try{if(!y)throw new Error("No output type specified.");var x=(v=y.toLowerCase())==="string"||v==="text";v!=="binarystring"&&v!=="text"||(v="string"),_=this._decompressWorker();var M=!this._dataBinary;M&&!x&&(_=_.pipe(new l.Utf8EncodeWorker)),!M&&x&&(_=_.pipe(new l.Utf8DecodeWorker))}catch(w){(_=new d("error")).error(w)}return new s(_,v,"")},async:function(y,_){return this.internalStream(y).accumulate(_)},nodeStream:function(y,_){return this.internalStream(y||"nodebuffer").toNodejsStream(_)},_compressWorker:function(y,_){if(this._data instanceof c&&this._data.compression.magic===y.magic)return this._data.getCompressedWorker();var v=this._decompressWorker();return this._dataBinary||(v=v.pipe(new l.Utf8EncodeWorker)),c.createWorkerFrom(v,y,_)},_decompressWorker:function(){return this._data instanceof c?this._data.getContentWorker():this._data instanceof d?this._data:new o(this._data)}};for(var f=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],m=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},g=0;g<f.length;g++)a.prototype[f[g]]=m;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,o,l=a.MutationObserver||a.WebKitMutationObserver;if(l){var c=0,d=new l(y),f=a.document.createTextNode("");d.observe(f,{characterData:!0}),s=function(){f.data=c=++c%2}}else if(a.setImmediate||a.MessageChannel===void 0)s="document"in a&&"onreadystatechange"in a.document.createElement("script")?function(){var _=a.document.createElement("script");_.onreadystatechange=function(){y(),_.onreadystatechange=null,_.parentNode.removeChild(_),_=null},a.document.documentElement.appendChild(_)}:function(){setTimeout(y,0)};else{var m=new a.MessageChannel;m.port1.onmessage=y,s=function(){m.port2.postMessage(0)}}var g=[];function y(){var _,v;o=!0;for(var x=g.length;x;){for(v=g,g=[],_=-1;++_<x;)v[_]();x=g.length}o=!1}i.exports=function(_){g.push(_)!==1||o||s()}}).call(this,typeof wy<"u"?wy:typeof self<"u"?self:typeof window<"u"?window:{})},{}],37:[function(n,i,r){var a=n("immediate");function s(){}var o={},l=["REJECTED"],c=["FULFILLED"],d=["PENDING"];function f(x){if(typeof x!="function")throw new TypeError("resolver must be a function");this.state=d,this.queue=[],this.outcome=void 0,x!==s&&_(this,x)}function m(x,M,w){this.promise=x,typeof M=="function"&&(this.onFulfilled=M,this.callFulfilled=this.otherCallFulfilled),typeof w=="function"&&(this.onRejected=w,this.callRejected=this.otherCallRejected)}function g(x,M,w){a(function(){var T;try{T=M(w)}catch(C){return o.reject(x,C)}T===x?o.reject(x,new TypeError("Cannot resolve promise with itself")):o.resolve(x,T)})}function y(x){var M=x&&x.then;if(x&&(typeof x=="object"||typeof x=="function")&&typeof M=="function")return function(){M.apply(x,arguments)}}function _(x,M){var w=!1;function T(A){w||(w=!0,o.reject(x,A))}function C(A){w||(w=!0,o.resolve(x,A))}var P=v(function(){M(C,T)});P.status==="error"&&T(P.value)}function v(x,M){var w={};try{w.value=x(M),w.status="success"}catch(T){w.status="error",w.value=T}return w}(i.exports=f).prototype.finally=function(x){if(typeof x!="function")return this;var M=this.constructor;return this.then(function(w){return M.resolve(x()).then(function(){return w})},function(w){return M.resolve(x()).then(function(){throw w})})},f.prototype.catch=function(x){return this.then(null,x)},f.prototype.then=function(x,M){if(typeof x!="function"&&this.state===c||typeof M!="function"&&this.state===l)return this;var w=new this.constructor(s);return this.state!==d?g(w,this.state===c?x:M,this.outcome):this.queue.push(new m(w,x,M)),w},m.prototype.callFulfilled=function(x){o.resolve(this.promise,x)},m.prototype.otherCallFulfilled=function(x){g(this.promise,this.onFulfilled,x)},m.prototype.callRejected=function(x){o.reject(this.promise,x)},m.prototype.otherCallRejected=function(x){g(this.promise,this.onRejected,x)},o.resolve=function(x,M){var w=v(y,M);if(w.status==="error")return o.reject(x,w.value);var T=w.value;if(T)_(x,T);else{x.state=c,x.outcome=M;for(var C=-1,P=x.queue.length;++C<P;)x.queue[C].callFulfilled(M)}return x},o.reject=function(x,M){x.state=l,x.outcome=M;for(var w=-1,T=x.queue.length;++w<T;)x.queue[w].callRejected(M);return x},f.resolve=function(x){return x instanceof this?x:o.resolve(new this(s),x)},f.reject=function(x){var M=new this(s);return o.reject(M,x)},f.all=function(x){var M=this;if(Object.prototype.toString.call(x)!=="[object Array]")return this.reject(new TypeError("must be an array"));var w=x.length,T=!1;if(!w)return this.resolve([]);for(var C=new Array(w),P=0,A=-1,U=new this(s);++A<w;)N(x[A],A);return U;function N(D,F){M.resolve(D).then(function(I){C[F]=I,++P!==w||T||(T=!0,o.resolve(U,C))},function(I){T||(T=!0,o.reject(U,I))})}},f.race=function(x){var M=this;if(Object.prototype.toString.call(x)!=="[object Array]")return this.reject(new TypeError("must be an array"));var w=x.length,T=!1;if(!w)return this.resolve([]);for(var C=-1,P=new this(s);++C<w;)A=x[C],M.resolve(A).then(function(U){T||(T=!0,o.resolve(P,U))},function(U){T||(T=!0,o.reject(P,U))});var A;return P}},{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"),o=n("./utils/strings"),l=n("./zlib/messages"),c=n("./zlib/zstream"),d=Object.prototype.toString,f=0,m=-1,g=0,y=8;function _(x){if(!(this instanceof _))return new _(x);this.options=s.assign({level:m,method:y,chunkSize:16384,windowBits:15,memLevel:8,strategy:g,to:""},x||{});var M=this.options;M.raw&&0<M.windowBits?M.windowBits=-M.windowBits:M.gzip&&0<M.windowBits&&M.windowBits<16&&(M.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new c,this.strm.avail_out=0;var w=a.deflateInit2(this.strm,M.level,M.method,M.windowBits,M.memLevel,M.strategy);if(w!==f)throw new Error(l[w]);if(M.header&&a.deflateSetHeader(this.strm,M.header),M.dictionary){var T;if(T=typeof M.dictionary=="string"?o.string2buf(M.dictionary):d.call(M.dictionary)==="[object ArrayBuffer]"?new Uint8Array(M.dictionary):M.dictionary,(w=a.deflateSetDictionary(this.strm,T))!==f)throw new Error(l[w]);this._dict_set=!0}}function v(x,M){var w=new _(M);if(w.push(x,!0),w.err)throw w.msg||l[w.err];return w.result}_.prototype.push=function(x,M){var w,T,C=this.strm,P=this.options.chunkSize;if(this.ended)return!1;T=M===~~M?M:M===!0?4:0,typeof x=="string"?C.input=o.string2buf(x):d.call(x)==="[object ArrayBuffer]"?C.input=new Uint8Array(x):C.input=x,C.next_in=0,C.avail_in=C.input.length;do{if(C.avail_out===0&&(C.output=new s.Buf8(P),C.next_out=0,C.avail_out=P),(w=a.deflate(C,T))!==1&&w!==f)return this.onEnd(w),!(this.ended=!0);C.avail_out!==0&&(C.avail_in!==0||T!==4&&T!==2)||(this.options.to==="string"?this.onData(o.buf2binstring(s.shrinkBuf(C.output,C.next_out))):this.onData(s.shrinkBuf(C.output,C.next_out)))}while((0<C.avail_in||C.avail_out===0)&&w!==1);return T===4?(w=a.deflateEnd(this.strm),this.onEnd(w),this.ended=!0,w===f):T!==2||(this.onEnd(f),!(C.avail_out=0))},_.prototype.onData=function(x){this.chunks.push(x)},_.prototype.onEnd=function(x){x===f&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=s.flattenChunks(this.chunks)),this.chunks=[],this.err=x,this.msg=this.strm.msg},r.Deflate=_,r.deflate=v,r.deflateRaw=function(x,M){return(M=M||{}).raw=!0,v(x,M)},r.gzip=function(x,M){return(M=M||{}).gzip=!0,v(x,M)}},{"./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"),o=n("./utils/strings"),l=n("./zlib/constants"),c=n("./zlib/messages"),d=n("./zlib/zstream"),f=n("./zlib/gzheader"),m=Object.prototype.toString;function g(_){if(!(this instanceof g))return new g(_);this.options=s.assign({chunkSize:16384,windowBits:0,to:""},_||{});var v=this.options;v.raw&&0<=v.windowBits&&v.windowBits<16&&(v.windowBits=-v.windowBits,v.windowBits===0&&(v.windowBits=-15)),!(0<=v.windowBits&&v.windowBits<16)||_&&_.windowBits||(v.windowBits+=32),15<v.windowBits&&v.windowBits<48&&(15&v.windowBits)==0&&(v.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new d,this.strm.avail_out=0;var x=a.inflateInit2(this.strm,v.windowBits);if(x!==l.Z_OK)throw new Error(c[x]);this.header=new f,a.inflateGetHeader(this.strm,this.header)}function y(_,v){var x=new g(v);if(x.push(_,!0),x.err)throw x.msg||c[x.err];return x.result}g.prototype.push=function(_,v){var x,M,w,T,C,P,A=this.strm,U=this.options.chunkSize,N=this.options.dictionary,D=!1;if(this.ended)return!1;M=v===~~v?v:v===!0?l.Z_FINISH:l.Z_NO_FLUSH,typeof _=="string"?A.input=o.binstring2buf(_):m.call(_)==="[object ArrayBuffer]"?A.input=new Uint8Array(_):A.input=_,A.next_in=0,A.avail_in=A.input.length;do{if(A.avail_out===0&&(A.output=new s.Buf8(U),A.next_out=0,A.avail_out=U),(x=a.inflate(A,l.Z_NO_FLUSH))===l.Z_NEED_DICT&&N&&(P=typeof N=="string"?o.string2buf(N):m.call(N)==="[object ArrayBuffer]"?new Uint8Array(N):N,x=a.inflateSetDictionary(this.strm,P)),x===l.Z_BUF_ERROR&&D===!0&&(x=l.Z_OK,D=!1),x!==l.Z_STREAM_END&&x!==l.Z_OK)return this.onEnd(x),!(this.ended=!0);A.next_out&&(A.avail_out!==0&&x!==l.Z_STREAM_END&&(A.avail_in!==0||M!==l.Z_FINISH&&M!==l.Z_SYNC_FLUSH)||(this.options.to==="string"?(w=o.utf8border(A.output,A.next_out),T=A.next_out-w,C=o.buf2string(A.output,w),A.next_out=T,A.avail_out=U-T,T&&s.arraySet(A.output,A.output,w,T,0),this.onData(C)):this.onData(s.shrinkBuf(A.output,A.next_out)))),A.avail_in===0&&A.avail_out===0&&(D=!0)}while((0<A.avail_in||A.avail_out===0)&&x!==l.Z_STREAM_END);return x===l.Z_STREAM_END&&(M=l.Z_FINISH),M===l.Z_FINISH?(x=a.inflateEnd(this.strm),this.onEnd(x),this.ended=!0,x===l.Z_OK):M!==l.Z_SYNC_FLUSH||(this.onEnd(l.Z_OK),!(A.avail_out=0))},g.prototype.onData=function(_){this.chunks.push(_)},g.prototype.onEnd=function(_){_===l.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=s.flattenChunks(this.chunks)),this.chunks=[],this.err=_,this.msg=this.strm.msg},r.Inflate=g,r.inflate=y,r.inflateRaw=function(_,v){return(v=v||{}).raw=!0,y(_,v)},r.ungzip=y},{"./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(l){for(var c=Array.prototype.slice.call(arguments,1);c.length;){var d=c.shift();if(d){if(typeof d!="object")throw new TypeError(d+"must be non-object");for(var f in d)d.hasOwnProperty(f)&&(l[f]=d[f])}}return l},r.shrinkBuf=function(l,c){return l.length===c?l:l.subarray?l.subarray(0,c):(l.length=c,l)};var s={arraySet:function(l,c,d,f,m){if(c.subarray&&l.subarray)l.set(c.subarray(d,d+f),m);else for(var g=0;g<f;g++)l[m+g]=c[d+g]},flattenChunks:function(l){var c,d,f,m,g,y;for(c=f=0,d=l.length;c<d;c++)f+=l[c].length;for(y=new Uint8Array(f),c=m=0,d=l.length;c<d;c++)g=l[c],y.set(g,m),m+=g.length;return y}},o={arraySet:function(l,c,d,f,m){for(var g=0;g<f;g++)l[m+g]=c[d+g]},flattenChunks:function(l){return[].concat.apply([],l)}};r.setTyped=function(l){l?(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,o))},r.setTyped(a)},{}],42:[function(n,i,r){var a=n("./common"),s=!0,o=!0;try{String.fromCharCode.apply(null,[0])}catch{s=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{o=!1}for(var l=new a.Buf8(256),c=0;c<256;c++)l[c]=252<=c?6:248<=c?5:240<=c?4:224<=c?3:192<=c?2:1;function d(f,m){if(m<65537&&(f.subarray&&o||!f.subarray&&s))return String.fromCharCode.apply(null,a.shrinkBuf(f,m));for(var g="",y=0;y<m;y++)g+=String.fromCharCode(f[y]);return g}l[254]=l[254]=1,r.string2buf=function(f){var m,g,y,_,v,x=f.length,M=0;for(_=0;_<x;_++)(64512&(g=f.charCodeAt(_)))==55296&&_+1<x&&(64512&(y=f.charCodeAt(_+1)))==56320&&(g=65536+(g-55296<<10)+(y-56320),_++),M+=g<128?1:g<2048?2:g<65536?3:4;for(m=new a.Buf8(M),_=v=0;v<M;_++)(64512&(g=f.charCodeAt(_)))==55296&&_+1<x&&(64512&(y=f.charCodeAt(_+1)))==56320&&(g=65536+(g-55296<<10)+(y-56320),_++),g<128?m[v++]=g:(g<2048?m[v++]=192|g>>>6:(g<65536?m[v++]=224|g>>>12:(m[v++]=240|g>>>18,m[v++]=128|g>>>12&63),m[v++]=128|g>>>6&63),m[v++]=128|63&g);return m},r.buf2binstring=function(f){return d(f,f.length)},r.binstring2buf=function(f){for(var m=new a.Buf8(f.length),g=0,y=m.length;g<y;g++)m[g]=f.charCodeAt(g);return m},r.buf2string=function(f,m){var g,y,_,v,x=m||f.length,M=new Array(2*x);for(g=y=0;g<x;)if((_=f[g++])<128)M[y++]=_;else if(4<(v=l[_]))M[y++]=65533,g+=v-1;else{for(_&=v===2?31:v===3?15:7;1<v&&g<x;)_=_<<6|63&f[g++],v--;1<v?M[y++]=65533:_<65536?M[y++]=_:(_-=65536,M[y++]=55296|_>>10&1023,M[y++]=56320|1023&_)}return d(M,y)},r.utf8border=function(f,m){var g;for((m=m||f.length)>f.length&&(m=f.length),g=m-1;0<=g&&(192&f[g])==128;)g--;return g<0||g===0?m:g+l[f[g]]>m?g:m}},{"./common":41}],43:[function(n,i,r){i.exports=function(a,s,o,l){for(var c=65535&a|0,d=a>>>16&65535|0,f=0;o!==0;){for(o-=f=2e3<o?2e3:o;d=d+(c=c+s[l++]|0)|0,--f;);c%=65521,d%=65521}return c|d<<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,o=[],l=0;l<256;l++){s=l;for(var c=0;c<8;c++)s=1&s?3988292384^s>>>1:s>>>1;o[l]=s}return o})();i.exports=function(s,o,l,c){var d=a,f=c+l;s^=-1;for(var m=c;m<f;m++)s=s>>>8^d[255&(s^o[m])];return-1^s}},{}],46:[function(n,i,r){var a,s=n("../utils/common"),o=n("./trees"),l=n("./adler32"),c=n("./crc32"),d=n("./messages"),f=0,m=4,g=0,y=-2,_=-1,v=4,x=2,M=8,w=9,T=286,C=30,P=19,A=2*T+1,U=15,N=3,D=258,F=D+N+1,I=42,W=113,O=1,B=2,H=3,$=4;function K(z,q){return z.msg=d[q],q}function Z(z){return(z<<1)-(4<z?9:0)}function se(z){for(var q=z.length;0<=--q;)z[q]=0}function V(z){var q=z.state,re=q.pending;re>z.avail_out&&(re=z.avail_out),re!==0&&(s.arraySet(z.output,q.pending_buf,q.pending_out,re,z.next_out),z.next_out+=re,q.pending_out+=re,z.total_out+=re,z.avail_out-=re,q.pending-=re,q.pending===0&&(q.pending_out=0))}function X(z,q){o._tr_flush_block(z,0<=z.block_start?z.block_start:-1,z.strstart-z.block_start,q),z.block_start=z.strstart,V(z.strm)}function ae(z,q){z.pending_buf[z.pending++]=q}function ce(z,q){z.pending_buf[z.pending++]=q>>>8&255,z.pending_buf[z.pending++]=255&q}function ge(z,q){var re,J,ee=z.max_chain_length,oe=z.strstart,De=z.prev_length,Ne=z.nice_match,te=z.strstart>z.w_size-F?z.strstart-(z.w_size-F):0,j=z.window,L=z.w_mask,Y=z.prev,me=z.strstart+D,ye=j[oe+De-1],pe=j[oe+De];z.prev_length>=z.good_match&&(ee>>=2),Ne>z.lookahead&&(Ne=z.lookahead);do if(j[(re=q)+De]===pe&&j[re+De-1]===ye&&j[re]===j[oe]&&j[++re]===j[oe+1]){oe+=2,re++;do;while(j[++oe]===j[++re]&&j[++oe]===j[++re]&&j[++oe]===j[++re]&&j[++oe]===j[++re]&&j[++oe]===j[++re]&&j[++oe]===j[++re]&&j[++oe]===j[++re]&&j[++oe]===j[++re]&&oe<me);if(J=D-(me-oe),oe=me-D,De<J){if(z.match_start=q,Ne<=(De=J))break;ye=j[oe+De-1],pe=j[oe+De]}}while((q=Y[q&L])>te&&--ee!=0);return De<=z.lookahead?De:z.lookahead}function ne(z){var q,re,J,ee,oe,De,Ne,te,j,L,Y=z.w_size;do{if(ee=z.window_size-z.lookahead-z.strstart,z.strstart>=Y+(Y-F)){for(s.arraySet(z.window,z.window,Y,Y,0),z.match_start-=Y,z.strstart-=Y,z.block_start-=Y,q=re=z.hash_size;J=z.head[--q],z.head[q]=Y<=J?J-Y:0,--re;);for(q=re=Y;J=z.prev[--q],z.prev[q]=Y<=J?J-Y:0,--re;);ee+=Y}if(z.strm.avail_in===0)break;if(De=z.strm,Ne=z.window,te=z.strstart+z.lookahead,j=ee,L=void 0,L=De.avail_in,j<L&&(L=j),re=L===0?0:(De.avail_in-=L,s.arraySet(Ne,De.input,De.next_in,L,te),De.state.wrap===1?De.adler=l(De.adler,Ne,L,te):De.state.wrap===2&&(De.adler=c(De.adler,Ne,L,te)),De.next_in+=L,De.total_in+=L,L),z.lookahead+=re,z.lookahead+z.insert>=N)for(oe=z.strstart-z.insert,z.ins_h=z.window[oe],z.ins_h=(z.ins_h<<z.hash_shift^z.window[oe+1])&z.hash_mask;z.insert&&(z.ins_h=(z.ins_h<<z.hash_shift^z.window[oe+N-1])&z.hash_mask,z.prev[oe&z.w_mask]=z.head[z.ins_h],z.head[z.ins_h]=oe,oe++,z.insert--,!(z.lookahead+z.insert<N)););}while(z.lookahead<F&&z.strm.avail_in!==0)}function ve(z,q){for(var re,J;;){if(z.lookahead<F){if(ne(z),z.lookahead<F&&q===f)return O;if(z.lookahead===0)break}if(re=0,z.lookahead>=N&&(z.ins_h=(z.ins_h<<z.hash_shift^z.window[z.strstart+N-1])&z.hash_mask,re=z.prev[z.strstart&z.w_mask]=z.head[z.ins_h],z.head[z.ins_h]=z.strstart),re!==0&&z.strstart-re<=z.w_size-F&&(z.match_length=ge(z,re)),z.match_length>=N)if(J=o._tr_tally(z,z.strstart-z.match_start,z.match_length-N),z.lookahead-=z.match_length,z.match_length<=z.max_lazy_match&&z.lookahead>=N){for(z.match_length--;z.strstart++,z.ins_h=(z.ins_h<<z.hash_shift^z.window[z.strstart+N-1])&z.hash_mask,re=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 J=o._tr_tally(z,0,z.window[z.strstart]),z.lookahead--,z.strstart++;if(J&&(X(z,!1),z.strm.avail_out===0))return O}return z.insert=z.strstart<N-1?z.strstart:N-1,q===m?(X(z,!0),z.strm.avail_out===0?H:$):z.last_lit&&(X(z,!1),z.strm.avail_out===0)?O:B}function Pe(z,q){for(var re,J,ee;;){if(z.lookahead<F){if(ne(z),z.lookahead<F&&q===f)return O;if(z.lookahead===0)break}if(re=0,z.lookahead>=N&&(z.ins_h=(z.ins_h<<z.hash_shift^z.window[z.strstart+N-1])&z.hash_mask,re=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=N-1,re!==0&&z.prev_length<z.max_lazy_match&&z.strstart-re<=z.w_size-F&&(z.match_length=ge(z,re),z.match_length<=5&&(z.strategy===1||z.match_length===N&&4096<z.strstart-z.match_start)&&(z.match_length=N-1)),z.prev_length>=N&&z.match_length<=z.prev_length){for(ee=z.strstart+z.lookahead-N,J=o._tr_tally(z,z.strstart-1-z.prev_match,z.prev_length-N),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+N-1])&z.hash_mask,re=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=N-1,z.strstart++,J&&(X(z,!1),z.strm.avail_out===0))return O}else if(z.match_available){if((J=o._tr_tally(z,0,z.window[z.strstart-1]))&&X(z,!1),z.strstart++,z.lookahead--,z.strm.avail_out===0)return O}else z.match_available=1,z.strstart++,z.lookahead--}return z.match_available&&(J=o._tr_tally(z,0,z.window[z.strstart-1]),z.match_available=0),z.insert=z.strstart<N-1?z.strstart:N-1,q===m?(X(z,!0),z.strm.avail_out===0?H:$):z.last_lit&&(X(z,!1),z.strm.avail_out===0)?O:B}function he(z,q,re,J,ee){this.good_length=z,this.max_lazy=q,this.nice_length=re,this.max_chain=J,this.func=ee}function we(){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=M,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*A),this.dyn_dtree=new s.Buf16(2*(2*C+1)),this.bl_tree=new s.Buf16(2*(2*P+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(U+1),this.heap=new s.Buf16(2*T+1),se(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new s.Buf16(2*T+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 je(z){var q;return z&&z.state?(z.total_in=z.total_out=0,z.data_type=x,(q=z.state).pending=0,q.pending_out=0,q.wrap<0&&(q.wrap=-q.wrap),q.status=q.wrap?I:W,z.adler=q.wrap===2?0:1,q.last_flush=f,o._tr_init(q),g):K(z,y)}function ue(z){var q=je(z);return q===g&&(function(re){re.window_size=2*re.w_size,se(re.head),re.max_lazy_match=a[re.level].max_lazy,re.good_match=a[re.level].good_length,re.nice_match=a[re.level].nice_length,re.max_chain_length=a[re.level].max_chain,re.strstart=0,re.block_start=0,re.lookahead=0,re.insert=0,re.match_length=re.prev_length=N-1,re.match_available=0,re.ins_h=0})(z.state),q}function lt(z,q,re,J,ee,oe){if(!z)return y;var De=1;if(q===_&&(q=6),J<0?(De=0,J=-J):15<J&&(De=2,J-=16),ee<1||w<ee||re!==M||J<8||15<J||q<0||9<q||oe<0||v<oe)return K(z,y);J===8&&(J=9);var Ne=new we;return(z.state=Ne).strm=z,Ne.wrap=De,Ne.gzhead=null,Ne.w_bits=J,Ne.w_size=1<<Ne.w_bits,Ne.w_mask=Ne.w_size-1,Ne.hash_bits=ee+7,Ne.hash_size=1<<Ne.hash_bits,Ne.hash_mask=Ne.hash_size-1,Ne.hash_shift=~~((Ne.hash_bits+N-1)/N),Ne.window=new s.Buf8(2*Ne.w_size),Ne.head=new s.Buf16(Ne.hash_size),Ne.prev=new s.Buf16(Ne.w_size),Ne.lit_bufsize=1<<ee+6,Ne.pending_buf_size=4*Ne.lit_bufsize,Ne.pending_buf=new s.Buf8(Ne.pending_buf_size),Ne.d_buf=1*Ne.lit_bufsize,Ne.l_buf=3*Ne.lit_bufsize,Ne.level=q,Ne.strategy=oe,Ne.method=re,ue(z)}a=[new he(0,0,0,0,function(z,q){var re=65535;for(re>z.pending_buf_size-5&&(re=z.pending_buf_size-5);;){if(z.lookahead<=1){if(ne(z),z.lookahead===0&&q===f)return O;if(z.lookahead===0)break}z.strstart+=z.lookahead,z.lookahead=0;var J=z.block_start+re;if((z.strstart===0||z.strstart>=J)&&(z.lookahead=z.strstart-J,z.strstart=J,X(z,!1),z.strm.avail_out===0)||z.strstart-z.block_start>=z.w_size-F&&(X(z,!1),z.strm.avail_out===0))return O}return z.insert=0,q===m?(X(z,!0),z.strm.avail_out===0?H:$):(z.strstart>z.block_start&&(X(z,!1),z.strm.avail_out),O)}),new he(4,4,8,4,ve),new he(4,5,16,8,ve),new he(4,6,32,32,ve),new he(4,4,16,16,Pe),new he(8,16,32,32,Pe),new he(8,16,128,128,Pe),new he(8,32,128,256,Pe),new he(32,128,258,1024,Pe),new he(32,258,258,4096,Pe)],r.deflateInit=function(z,q){return lt(z,q,M,15,8,0)},r.deflateInit2=lt,r.deflateReset=ue,r.deflateResetKeep=je,r.deflateSetHeader=function(z,q){return z&&z.state?z.state.wrap!==2?y:(z.state.gzhead=q,g):y},r.deflate=function(z,q){var re,J,ee,oe;if(!z||!z.state||5<q||q<0)return z?K(z,y):y;if(J=z.state,!z.output||!z.input&&z.avail_in!==0||J.status===666&&q!==m)return K(z,z.avail_out===0?-5:y);if(J.strm=z,re=J.last_flush,J.last_flush=q,J.status===I)if(J.wrap===2)z.adler=0,ae(J,31),ae(J,139),ae(J,8),J.gzhead?(ae(J,(J.gzhead.text?1:0)+(J.gzhead.hcrc?2:0)+(J.gzhead.extra?4:0)+(J.gzhead.name?8:0)+(J.gzhead.comment?16:0)),ae(J,255&J.gzhead.time),ae(J,J.gzhead.time>>8&255),ae(J,J.gzhead.time>>16&255),ae(J,J.gzhead.time>>24&255),ae(J,J.level===9?2:2<=J.strategy||J.level<2?4:0),ae(J,255&J.gzhead.os),J.gzhead.extra&&J.gzhead.extra.length&&(ae(J,255&J.gzhead.extra.length),ae(J,J.gzhead.extra.length>>8&255)),J.gzhead.hcrc&&(z.adler=c(z.adler,J.pending_buf,J.pending,0)),J.gzindex=0,J.status=69):(ae(J,0),ae(J,0),ae(J,0),ae(J,0),ae(J,0),ae(J,J.level===9?2:2<=J.strategy||J.level<2?4:0),ae(J,3),J.status=W);else{var De=M+(J.w_bits-8<<4)<<8;De|=(2<=J.strategy||J.level<2?0:J.level<6?1:J.level===6?2:3)<<6,J.strstart!==0&&(De|=32),De+=31-De%31,J.status=W,ce(J,De),J.strstart!==0&&(ce(J,z.adler>>>16),ce(J,65535&z.adler)),z.adler=1}if(J.status===69)if(J.gzhead.extra){for(ee=J.pending;J.gzindex<(65535&J.gzhead.extra.length)&&(J.pending!==J.pending_buf_size||(J.gzhead.hcrc&&J.pending>ee&&(z.adler=c(z.adler,J.pending_buf,J.pending-ee,ee)),V(z),ee=J.pending,J.pending!==J.pending_buf_size));)ae(J,255&J.gzhead.extra[J.gzindex]),J.gzindex++;J.gzhead.hcrc&&J.pending>ee&&(z.adler=c(z.adler,J.pending_buf,J.pending-ee,ee)),J.gzindex===J.gzhead.extra.length&&(J.gzindex=0,J.status=73)}else J.status=73;if(J.status===73)if(J.gzhead.name){ee=J.pending;do{if(J.pending===J.pending_buf_size&&(J.gzhead.hcrc&&J.pending>ee&&(z.adler=c(z.adler,J.pending_buf,J.pending-ee,ee)),V(z),ee=J.pending,J.pending===J.pending_buf_size)){oe=1;break}oe=J.gzindex<J.gzhead.name.length?255&J.gzhead.name.charCodeAt(J.gzindex++):0,ae(J,oe)}while(oe!==0);J.gzhead.hcrc&&J.pending>ee&&(z.adler=c(z.adler,J.pending_buf,J.pending-ee,ee)),oe===0&&(J.gzindex=0,J.status=91)}else J.status=91;if(J.status===91)if(J.gzhead.comment){ee=J.pending;do{if(J.pending===J.pending_buf_size&&(J.gzhead.hcrc&&J.pending>ee&&(z.adler=c(z.adler,J.pending_buf,J.pending-ee,ee)),V(z),ee=J.pending,J.pending===J.pending_buf_size)){oe=1;break}oe=J.gzindex<J.gzhead.comment.length?255&J.gzhead.comment.charCodeAt(J.gzindex++):0,ae(J,oe)}while(oe!==0);J.gzhead.hcrc&&J.pending>ee&&(z.adler=c(z.adler,J.pending_buf,J.pending-ee,ee)),oe===0&&(J.status=103)}else J.status=103;if(J.status===103&&(J.gzhead.hcrc?(J.pending+2>J.pending_buf_size&&V(z),J.pending+2<=J.pending_buf_size&&(ae(J,255&z.adler),ae(J,z.adler>>8&255),z.adler=0,J.status=W)):J.status=W),J.pending!==0){if(V(z),z.avail_out===0)return J.last_flush=-1,g}else if(z.avail_in===0&&Z(q)<=Z(re)&&q!==m)return K(z,-5);if(J.status===666&&z.avail_in!==0)return K(z,-5);if(z.avail_in!==0||J.lookahead!==0||q!==f&&J.status!==666){var Ne=J.strategy===2?(function(te,j){for(var L;;){if(te.lookahead===0&&(ne(te),te.lookahead===0)){if(j===f)return O;break}if(te.match_length=0,L=o._tr_tally(te,0,te.window[te.strstart]),te.lookahead--,te.strstart++,L&&(X(te,!1),te.strm.avail_out===0))return O}return te.insert=0,j===m?(X(te,!0),te.strm.avail_out===0?H:$):te.last_lit&&(X(te,!1),te.strm.avail_out===0)?O:B})(J,q):J.strategy===3?(function(te,j){for(var L,Y,me,ye,pe=te.window;;){if(te.lookahead<=D){if(ne(te),te.lookahead<=D&&j===f)return O;if(te.lookahead===0)break}if(te.match_length=0,te.lookahead>=N&&0<te.strstart&&(Y=pe[me=te.strstart-1])===pe[++me]&&Y===pe[++me]&&Y===pe[++me]){ye=te.strstart+D;do;while(Y===pe[++me]&&Y===pe[++me]&&Y===pe[++me]&&Y===pe[++me]&&Y===pe[++me]&&Y===pe[++me]&&Y===pe[++me]&&Y===pe[++me]&&me<ye);te.match_length=D-(ye-me),te.match_length>te.lookahead&&(te.match_length=te.lookahead)}if(te.match_length>=N?(L=o._tr_tally(te,1,te.match_length-N),te.lookahead-=te.match_length,te.strstart+=te.match_length,te.match_length=0):(L=o._tr_tally(te,0,te.window[te.strstart]),te.lookahead--,te.strstart++),L&&(X(te,!1),te.strm.avail_out===0))return O}return te.insert=0,j===m?(X(te,!0),te.strm.avail_out===0?H:$):te.last_lit&&(X(te,!1),te.strm.avail_out===0)?O:B})(J,q):a[J.level].func(J,q);if(Ne!==H&&Ne!==$||(J.status=666),Ne===O||Ne===H)return z.avail_out===0&&(J.last_flush=-1),g;if(Ne===B&&(q===1?o._tr_align(J):q!==5&&(o._tr_stored_block(J,0,0,!1),q===3&&(se(J.head),J.lookahead===0&&(J.strstart=0,J.block_start=0,J.insert=0))),V(z),z.avail_out===0))return J.last_flush=-1,g}return q!==m?g:J.wrap<=0?1:(J.wrap===2?(ae(J,255&z.adler),ae(J,z.adler>>8&255),ae(J,z.adler>>16&255),ae(J,z.adler>>24&255),ae(J,255&z.total_in),ae(J,z.total_in>>8&255),ae(J,z.total_in>>16&255),ae(J,z.total_in>>24&255)):(ce(J,z.adler>>>16),ce(J,65535&z.adler)),V(z),0<J.wrap&&(J.wrap=-J.wrap),J.pending!==0?g:1)},r.deflateEnd=function(z){var q;return z&&z.state?(q=z.state.status)!==I&&q!==69&&q!==73&&q!==91&&q!==103&&q!==W&&q!==666?K(z,y):(z.state=null,q===W?K(z,-3):g):y},r.deflateSetDictionary=function(z,q){var re,J,ee,oe,De,Ne,te,j,L=q.length;if(!z||!z.state||(oe=(re=z.state).wrap)===2||oe===1&&re.status!==I||re.lookahead)return y;for(oe===1&&(z.adler=l(z.adler,q,L,0)),re.wrap=0,L>=re.w_size&&(oe===0&&(se(re.head),re.strstart=0,re.block_start=0,re.insert=0),j=new s.Buf8(re.w_size),s.arraySet(j,q,L-re.w_size,re.w_size,0),q=j,L=re.w_size),De=z.avail_in,Ne=z.next_in,te=z.input,z.avail_in=L,z.next_in=0,z.input=q,ne(re);re.lookahead>=N;){for(J=re.strstart,ee=re.lookahead-(N-1);re.ins_h=(re.ins_h<<re.hash_shift^re.window[J+N-1])&re.hash_mask,re.prev[J&re.w_mask]=re.head[re.ins_h],re.head[re.ins_h]=J,J++,--ee;);re.strstart=J,re.lookahead=N-1,ne(re)}return re.strstart+=re.lookahead,re.block_start=re.strstart,re.insert=re.lookahead,re.lookahead=0,re.match_length=re.prev_length=N-1,re.match_available=0,z.next_in=Ne,z.input=te,z.avail_in=De,re.wrap=oe,g},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 o,l,c,d,f,m,g,y,_,v,x,M,w,T,C,P,A,U,N,D,F,I,W,O,B;o=a.state,l=a.next_in,O=a.input,c=l+(a.avail_in-5),d=a.next_out,B=a.output,f=d-(s-a.avail_out),m=d+(a.avail_out-257),g=o.dmax,y=o.wsize,_=o.whave,v=o.wnext,x=o.window,M=o.hold,w=o.bits,T=o.lencode,C=o.distcode,P=(1<<o.lenbits)-1,A=(1<<o.distbits)-1;e:do{w<15&&(M+=O[l++]<<w,w+=8,M+=O[l++]<<w,w+=8),U=T[M&P];t:for(;;){if(M>>>=N=U>>>24,w-=N,(N=U>>>16&255)===0)B[d++]=65535&U;else{if(!(16&N)){if((64&N)==0){U=T[(65535&U)+(M&(1<<N)-1)];continue t}if(32&N){o.mode=12;break e}a.msg="invalid literal/length code",o.mode=30;break e}D=65535&U,(N&=15)&&(w<N&&(M+=O[l++]<<w,w+=8),D+=M&(1<<N)-1,M>>>=N,w-=N),w<15&&(M+=O[l++]<<w,w+=8,M+=O[l++]<<w,w+=8),U=C[M&A];n:for(;;){if(M>>>=N=U>>>24,w-=N,!(16&(N=U>>>16&255))){if((64&N)==0){U=C[(65535&U)+(M&(1<<N)-1)];continue n}a.msg="invalid distance code",o.mode=30;break e}if(F=65535&U,w<(N&=15)&&(M+=O[l++]<<w,(w+=8)<N&&(M+=O[l++]<<w,w+=8)),g<(F+=M&(1<<N)-1)){a.msg="invalid distance too far back",o.mode=30;break e}if(M>>>=N,w-=N,(N=d-f)<F){if(_<(N=F-N)&&o.sane){a.msg="invalid distance too far back",o.mode=30;break e}if(W=x,(I=0)===v){if(I+=y-N,N<D){for(D-=N;B[d++]=x[I++],--N;);I=d-F,W=B}}else if(v<N){if(I+=y+v-N,(N-=v)<D){for(D-=N;B[d++]=x[I++],--N;);if(I=0,v<D){for(D-=N=v;B[d++]=x[I++],--N;);I=d-F,W=B}}}else if(I+=v-N,N<D){for(D-=N;B[d++]=x[I++],--N;);I=d-F,W=B}for(;2<D;)B[d++]=W[I++],B[d++]=W[I++],B[d++]=W[I++],D-=3;D&&(B[d++]=W[I++],1<D&&(B[d++]=W[I++]))}else{for(I=d-F;B[d++]=B[I++],B[d++]=B[I++],B[d++]=B[I++],2<(D-=3););D&&(B[d++]=B[I++],1<D&&(B[d++]=B[I++]))}break}}break}}while(l<c&&d<m);l-=D=w>>3,M&=(1<<(w-=D<<3))-1,a.next_in=l,a.next_out=d,a.avail_in=l<c?c-l+5:5-(l-c),a.avail_out=d<m?m-d+257:257-(d-m),o.hold=M,o.bits=w}},{}],49:[function(n,i,r){var a=n("../utils/common"),s=n("./adler32"),o=n("./crc32"),l=n("./inffast"),c=n("./inftrees"),d=1,f=2,m=0,g=-2,y=1,_=852,v=592;function x(I){return(I>>>24&255)+(I>>>8&65280)+((65280&I)<<8)+((255&I)<<24)}function M(){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 w(I){var W;return I&&I.state?(W=I.state,I.total_in=I.total_out=W.total=0,I.msg="",W.wrap&&(I.adler=1&W.wrap),W.mode=y,W.last=0,W.havedict=0,W.dmax=32768,W.head=null,W.hold=0,W.bits=0,W.lencode=W.lendyn=new a.Buf32(_),W.distcode=W.distdyn=new a.Buf32(v),W.sane=1,W.back=-1,m):g}function T(I){var W;return I&&I.state?((W=I.state).wsize=0,W.whave=0,W.wnext=0,w(I)):g}function C(I,W){var O,B;return I&&I.state?(B=I.state,W<0?(O=0,W=-W):(O=1+(W>>4),W<48&&(W&=15)),W&&(W<8||15<W)?g:(B.window!==null&&B.wbits!==W&&(B.window=null),B.wrap=O,B.wbits=W,T(I))):g}function P(I,W){var O,B;return I?(B=new M,(I.state=B).window=null,(O=C(I,W))!==m&&(I.state=null),O):g}var A,U,N=!0;function D(I){if(N){var W;for(A=new a.Buf32(512),U=new a.Buf32(32),W=0;W<144;)I.lens[W++]=8;for(;W<256;)I.lens[W++]=9;for(;W<280;)I.lens[W++]=7;for(;W<288;)I.lens[W++]=8;for(c(d,I.lens,0,288,A,0,I.work,{bits:9}),W=0;W<32;)I.lens[W++]=5;c(f,I.lens,0,32,U,0,I.work,{bits:5}),N=!1}I.lencode=A,I.lenbits=9,I.distcode=U,I.distbits=5}function F(I,W,O,B){var H,$=I.state;return $.window===null&&($.wsize=1<<$.wbits,$.wnext=0,$.whave=0,$.window=new a.Buf8($.wsize)),B>=$.wsize?(a.arraySet($.window,W,O-$.wsize,$.wsize,0),$.wnext=0,$.whave=$.wsize):(B<(H=$.wsize-$.wnext)&&(H=B),a.arraySet($.window,W,O-B,H,$.wnext),(B-=H)?(a.arraySet($.window,W,O-B,B,0),$.wnext=B,$.whave=$.wsize):($.wnext+=H,$.wnext===$.wsize&&($.wnext=0),$.whave<$.wsize&&($.whave+=H))),0}r.inflateReset=T,r.inflateReset2=C,r.inflateResetKeep=w,r.inflateInit=function(I){return P(I,15)},r.inflateInit2=P,r.inflate=function(I,W){var O,B,H,$,K,Z,se,V,X,ae,ce,ge,ne,ve,Pe,he,we,je,ue,lt,z,q,re,J,ee=0,oe=new a.Buf8(4),De=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!I||!I.state||!I.output||!I.input&&I.avail_in!==0)return g;(O=I.state).mode===12&&(O.mode=13),K=I.next_out,H=I.output,se=I.avail_out,$=I.next_in,B=I.input,Z=I.avail_in,V=O.hold,X=O.bits,ae=Z,ce=se,q=m;e:for(;;)switch(O.mode){case y:if(O.wrap===0){O.mode=13;break}for(;X<16;){if(Z===0)break e;Z--,V+=B[$++]<<X,X+=8}if(2&O.wrap&&V===35615){oe[O.check=0]=255&V,oe[1]=V>>>8&255,O.check=o(O.check,oe,2,0),X=V=0,O.mode=2;break}if(O.flags=0,O.head&&(O.head.done=!1),!(1&O.wrap)||(((255&V)<<8)+(V>>8))%31){I.msg="incorrect header check",O.mode=30;break}if((15&V)!=8){I.msg="unknown compression method",O.mode=30;break}if(X-=4,z=8+(15&(V>>>=4)),O.wbits===0)O.wbits=z;else if(z>O.wbits){I.msg="invalid window size",O.mode=30;break}O.dmax=1<<z,I.adler=O.check=1,O.mode=512&V?10:12,X=V=0;break;case 2:for(;X<16;){if(Z===0)break e;Z--,V+=B[$++]<<X,X+=8}if(O.flags=V,(255&O.flags)!=8){I.msg="unknown compression method",O.mode=30;break}if(57344&O.flags){I.msg="unknown header flags set",O.mode=30;break}O.head&&(O.head.text=V>>8&1),512&O.flags&&(oe[0]=255&V,oe[1]=V>>>8&255,O.check=o(O.check,oe,2,0)),X=V=0,O.mode=3;case 3:for(;X<32;){if(Z===0)break e;Z--,V+=B[$++]<<X,X+=8}O.head&&(O.head.time=V),512&O.flags&&(oe[0]=255&V,oe[1]=V>>>8&255,oe[2]=V>>>16&255,oe[3]=V>>>24&255,O.check=o(O.check,oe,4,0)),X=V=0,O.mode=4;case 4:for(;X<16;){if(Z===0)break e;Z--,V+=B[$++]<<X,X+=8}O.head&&(O.head.xflags=255&V,O.head.os=V>>8),512&O.flags&&(oe[0]=255&V,oe[1]=V>>>8&255,O.check=o(O.check,oe,2,0)),X=V=0,O.mode=5;case 5:if(1024&O.flags){for(;X<16;){if(Z===0)break e;Z--,V+=B[$++]<<X,X+=8}O.length=V,O.head&&(O.head.extra_len=V),512&O.flags&&(oe[0]=255&V,oe[1]=V>>>8&255,O.check=o(O.check,oe,2,0)),X=V=0}else O.head&&(O.head.extra=null);O.mode=6;case 6:if(1024&O.flags&&(Z<(ge=O.length)&&(ge=Z),ge&&(O.head&&(z=O.head.extra_len-O.length,O.head.extra||(O.head.extra=new Array(O.head.extra_len)),a.arraySet(O.head.extra,B,$,ge,z)),512&O.flags&&(O.check=o(O.check,B,ge,$)),Z-=ge,$+=ge,O.length-=ge),O.length))break e;O.length=0,O.mode=7;case 7:if(2048&O.flags){if(Z===0)break e;for(ge=0;z=B[$+ge++],O.head&&z&&O.length<65536&&(O.head.name+=String.fromCharCode(z)),z&&ge<Z;);if(512&O.flags&&(O.check=o(O.check,B,ge,$)),Z-=ge,$+=ge,z)break e}else O.head&&(O.head.name=null);O.length=0,O.mode=8;case 8:if(4096&O.flags){if(Z===0)break e;for(ge=0;z=B[$+ge++],O.head&&z&&O.length<65536&&(O.head.comment+=String.fromCharCode(z)),z&&ge<Z;);if(512&O.flags&&(O.check=o(O.check,B,ge,$)),Z-=ge,$+=ge,z)break e}else O.head&&(O.head.comment=null);O.mode=9;case 9:if(512&O.flags){for(;X<16;){if(Z===0)break e;Z--,V+=B[$++]<<X,X+=8}if(V!==(65535&O.check)){I.msg="header crc mismatch",O.mode=30;break}X=V=0}O.head&&(O.head.hcrc=O.flags>>9&1,O.head.done=!0),I.adler=O.check=0,O.mode=12;break;case 10:for(;X<32;){if(Z===0)break e;Z--,V+=B[$++]<<X,X+=8}I.adler=O.check=x(V),X=V=0,O.mode=11;case 11:if(O.havedict===0)return I.next_out=K,I.avail_out=se,I.next_in=$,I.avail_in=Z,O.hold=V,O.bits=X,2;I.adler=O.check=1,O.mode=12;case 12:if(W===5||W===6)break e;case 13:if(O.last){V>>>=7&X,X-=7&X,O.mode=27;break}for(;X<3;){if(Z===0)break e;Z--,V+=B[$++]<<X,X+=8}switch(O.last=1&V,X-=1,3&(V>>>=1)){case 0:O.mode=14;break;case 1:if(D(O),O.mode=20,W!==6)break;V>>>=2,X-=2;break e;case 2:O.mode=17;break;case 3:I.msg="invalid block type",O.mode=30}V>>>=2,X-=2;break;case 14:for(V>>>=7&X,X-=7&X;X<32;){if(Z===0)break e;Z--,V+=B[$++]<<X,X+=8}if((65535&V)!=(V>>>16^65535)){I.msg="invalid stored block lengths",O.mode=30;break}if(O.length=65535&V,X=V=0,O.mode=15,W===6)break e;case 15:O.mode=16;case 16:if(ge=O.length){if(Z<ge&&(ge=Z),se<ge&&(ge=se),ge===0)break e;a.arraySet(H,B,$,ge,K),Z-=ge,$+=ge,se-=ge,K+=ge,O.length-=ge;break}O.mode=12;break;case 17:for(;X<14;){if(Z===0)break e;Z--,V+=B[$++]<<X,X+=8}if(O.nlen=257+(31&V),V>>>=5,X-=5,O.ndist=1+(31&V),V>>>=5,X-=5,O.ncode=4+(15&V),V>>>=4,X-=4,286<O.nlen||30<O.ndist){I.msg="too many length or distance symbols",O.mode=30;break}O.have=0,O.mode=18;case 18:for(;O.have<O.ncode;){for(;X<3;){if(Z===0)break e;Z--,V+=B[$++]<<X,X+=8}O.lens[De[O.have++]]=7&V,V>>>=3,X-=3}for(;O.have<19;)O.lens[De[O.have++]]=0;if(O.lencode=O.lendyn,O.lenbits=7,re={bits:O.lenbits},q=c(0,O.lens,0,19,O.lencode,0,O.work,re),O.lenbits=re.bits,q){I.msg="invalid code lengths set",O.mode=30;break}O.have=0,O.mode=19;case 19:for(;O.have<O.nlen+O.ndist;){for(;he=(ee=O.lencode[V&(1<<O.lenbits)-1])>>>16&255,we=65535&ee,!((Pe=ee>>>24)<=X);){if(Z===0)break e;Z--,V+=B[$++]<<X,X+=8}if(we<16)V>>>=Pe,X-=Pe,O.lens[O.have++]=we;else{if(we===16){for(J=Pe+2;X<J;){if(Z===0)break e;Z--,V+=B[$++]<<X,X+=8}if(V>>>=Pe,X-=Pe,O.have===0){I.msg="invalid bit length repeat",O.mode=30;break}z=O.lens[O.have-1],ge=3+(3&V),V>>>=2,X-=2}else if(we===17){for(J=Pe+3;X<J;){if(Z===0)break e;Z--,V+=B[$++]<<X,X+=8}X-=Pe,z=0,ge=3+(7&(V>>>=Pe)),V>>>=3,X-=3}else{for(J=Pe+7;X<J;){if(Z===0)break e;Z--,V+=B[$++]<<X,X+=8}X-=Pe,z=0,ge=11+(127&(V>>>=Pe)),V>>>=7,X-=7}if(O.have+ge>O.nlen+O.ndist){I.msg="invalid bit length repeat",O.mode=30;break}for(;ge--;)O.lens[O.have++]=z}}if(O.mode===30)break;if(O.lens[256]===0){I.msg="invalid code -- missing end-of-block",O.mode=30;break}if(O.lenbits=9,re={bits:O.lenbits},q=c(d,O.lens,0,O.nlen,O.lencode,0,O.work,re),O.lenbits=re.bits,q){I.msg="invalid literal/lengths set",O.mode=30;break}if(O.distbits=6,O.distcode=O.distdyn,re={bits:O.distbits},q=c(f,O.lens,O.nlen,O.ndist,O.distcode,0,O.work,re),O.distbits=re.bits,q){I.msg="invalid distances set",O.mode=30;break}if(O.mode=20,W===6)break e;case 20:O.mode=21;case 21:if(6<=Z&&258<=se){I.next_out=K,I.avail_out=se,I.next_in=$,I.avail_in=Z,O.hold=V,O.bits=X,l(I,ce),K=I.next_out,H=I.output,se=I.avail_out,$=I.next_in,B=I.input,Z=I.avail_in,V=O.hold,X=O.bits,O.mode===12&&(O.back=-1);break}for(O.back=0;he=(ee=O.lencode[V&(1<<O.lenbits)-1])>>>16&255,we=65535&ee,!((Pe=ee>>>24)<=X);){if(Z===0)break e;Z--,V+=B[$++]<<X,X+=8}if(he&&(240&he)==0){for(je=Pe,ue=he,lt=we;he=(ee=O.lencode[lt+((V&(1<<je+ue)-1)>>je)])>>>16&255,we=65535&ee,!(je+(Pe=ee>>>24)<=X);){if(Z===0)break e;Z--,V+=B[$++]<<X,X+=8}V>>>=je,X-=je,O.back+=je}if(V>>>=Pe,X-=Pe,O.back+=Pe,O.length=we,he===0){O.mode=26;break}if(32&he){O.back=-1,O.mode=12;break}if(64&he){I.msg="invalid literal/length code",O.mode=30;break}O.extra=15&he,O.mode=22;case 22:if(O.extra){for(J=O.extra;X<J;){if(Z===0)break e;Z--,V+=B[$++]<<X,X+=8}O.length+=V&(1<<O.extra)-1,V>>>=O.extra,X-=O.extra,O.back+=O.extra}O.was=O.length,O.mode=23;case 23:for(;he=(ee=O.distcode[V&(1<<O.distbits)-1])>>>16&255,we=65535&ee,!((Pe=ee>>>24)<=X);){if(Z===0)break e;Z--,V+=B[$++]<<X,X+=8}if((240&he)==0){for(je=Pe,ue=he,lt=we;he=(ee=O.distcode[lt+((V&(1<<je+ue)-1)>>je)])>>>16&255,we=65535&ee,!(je+(Pe=ee>>>24)<=X);){if(Z===0)break e;Z--,V+=B[$++]<<X,X+=8}V>>>=je,X-=je,O.back+=je}if(V>>>=Pe,X-=Pe,O.back+=Pe,64&he){I.msg="invalid distance code",O.mode=30;break}O.offset=we,O.extra=15&he,O.mode=24;case 24:if(O.extra){for(J=O.extra;X<J;){if(Z===0)break e;Z--,V+=B[$++]<<X,X+=8}O.offset+=V&(1<<O.extra)-1,V>>>=O.extra,X-=O.extra,O.back+=O.extra}if(O.offset>O.dmax){I.msg="invalid distance too far back",O.mode=30;break}O.mode=25;case 25:if(se===0)break e;if(ge=ce-se,O.offset>ge){if((ge=O.offset-ge)>O.whave&&O.sane){I.msg="invalid distance too far back",O.mode=30;break}ne=ge>O.wnext?(ge-=O.wnext,O.wsize-ge):O.wnext-ge,ge>O.length&&(ge=O.length),ve=O.window}else ve=H,ne=K-O.offset,ge=O.length;for(se<ge&&(ge=se),se-=ge,O.length-=ge;H[K++]=ve[ne++],--ge;);O.length===0&&(O.mode=21);break;case 26:if(se===0)break e;H[K++]=O.length,se--,O.mode=21;break;case 27:if(O.wrap){for(;X<32;){if(Z===0)break e;Z--,V|=B[$++]<<X,X+=8}if(ce-=se,I.total_out+=ce,O.total+=ce,ce&&(I.adler=O.check=O.flags?o(O.check,H,ce,K-ce):s(O.check,H,ce,K-ce)),ce=se,(O.flags?V:x(V))!==O.check){I.msg="incorrect data check",O.mode=30;break}X=V=0}O.mode=28;case 28:if(O.wrap&&O.flags){for(;X<32;){if(Z===0)break e;Z--,V+=B[$++]<<X,X+=8}if(V!==(4294967295&O.total)){I.msg="incorrect length check",O.mode=30;break}X=V=0}O.mode=29;case 29:q=1;break e;case 30:q=-3;break e;case 31:return-4;case 32:default:return g}return I.next_out=K,I.avail_out=se,I.next_in=$,I.avail_in=Z,O.hold=V,O.bits=X,(O.wsize||ce!==I.avail_out&&O.mode<30&&(O.mode<27||W!==4))&&F(I,I.output,I.next_out,ce-I.avail_out)?(O.mode=31,-4):(ae-=I.avail_in,ce-=I.avail_out,I.total_in+=ae,I.total_out+=ce,O.total+=ce,O.wrap&&ce&&(I.adler=O.check=O.flags?o(O.check,H,ce,I.next_out-ce):s(O.check,H,ce,I.next_out-ce)),I.data_type=O.bits+(O.last?64:0)+(O.mode===12?128:0)+(O.mode===20||O.mode===15?256:0),(ae==0&&ce===0||W===4)&&q===m&&(q=-5),q)},r.inflateEnd=function(I){if(!I||!I.state)return g;var W=I.state;return W.window&&(W.window=null),I.state=null,m},r.inflateGetHeader=function(I,W){var O;return I&&I.state?(2&(O=I.state).wrap)==0?g:((O.head=W).done=!1,m):g},r.inflateSetDictionary=function(I,W){var O,B=W.length;return I&&I.state?(O=I.state).wrap!==0&&O.mode!==11?g:O.mode===11&&s(1,W,B,0)!==O.check?-3:F(I,W,B,B)?(O.mode=31,-4):(O.havedict=1,m):g},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],o=[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],l=[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],c=[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(d,f,m,g,y,_,v,x){var M,w,T,C,P,A,U,N,D,F=x.bits,I=0,W=0,O=0,B=0,H=0,$=0,K=0,Z=0,se=0,V=0,X=null,ae=0,ce=new a.Buf16(16),ge=new a.Buf16(16),ne=null,ve=0;for(I=0;I<=15;I++)ce[I]=0;for(W=0;W<g;W++)ce[f[m+W]]++;for(H=F,B=15;1<=B&&ce[B]===0;B--);if(B<H&&(H=B),B===0)return y[_++]=20971520,y[_++]=20971520,x.bits=1,0;for(O=1;O<B&&ce[O]===0;O++);for(H<O&&(H=O),I=Z=1;I<=15;I++)if(Z<<=1,(Z-=ce[I])<0)return-1;if(0<Z&&(d===0||B!==1))return-1;for(ge[1]=0,I=1;I<15;I++)ge[I+1]=ge[I]+ce[I];for(W=0;W<g;W++)f[m+W]!==0&&(v[ge[f[m+W]]++]=W);if(A=d===0?(X=ne=v,19):d===1?(X=s,ae-=257,ne=o,ve-=257,256):(X=l,ne=c,-1),I=O,P=_,K=W=V=0,T=-1,C=(se=1<<($=H))-1,d===1&&852<se||d===2&&592<se)return 1;for(;;){for(U=I-K,D=v[W]<A?(N=0,v[W]):v[W]>A?(N=ne[ve+v[W]],X[ae+v[W]]):(N=96,0),M=1<<I-K,O=w=1<<$;y[P+(V>>K)+(w-=M)]=U<<24|N<<16|D|0,w!==0;);for(M=1<<I-1;V&M;)M>>=1;if(M!==0?(V&=M-1,V+=M):V=0,W++,--ce[I]==0){if(I===B)break;I=f[m+v[W]]}if(H<I&&(V&C)!==T){for(K===0&&(K=H),P+=O,Z=1<<($=I-K);$+K<B&&!((Z-=ce[$+K])<=0);)$++,Z<<=1;if(se+=1<<$,d===1&&852<se||d===2&&592<se)return 1;y[T=V&C]=H<<24|$<<16|P-_|0}}return V!==0&&(y[P+V]=I-K<<24|64<<16|0),x.bits=H,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,o=1;function l(ee){for(var oe=ee.length;0<=--oe;)ee[oe]=0}var c=0,d=29,f=256,m=f+1+d,g=30,y=19,_=2*m+1,v=15,x=16,M=7,w=256,T=16,C=17,P=18,A=[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],U=[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],N=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],D=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],F=new Array(2*(m+2));l(F);var I=new Array(2*g);l(I);var W=new Array(512);l(W);var O=new Array(256);l(O);var B=new Array(d);l(B);var H,$,K,Z=new Array(g);function se(ee,oe,De,Ne,te){this.static_tree=ee,this.extra_bits=oe,this.extra_base=De,this.elems=Ne,this.max_length=te,this.has_stree=ee&&ee.length}function V(ee,oe){this.dyn_tree=ee,this.max_code=0,this.stat_desc=oe}function X(ee){return ee<256?W[ee]:W[256+(ee>>>7)]}function ae(ee,oe){ee.pending_buf[ee.pending++]=255&oe,ee.pending_buf[ee.pending++]=oe>>>8&255}function ce(ee,oe,De){ee.bi_valid>x-De?(ee.bi_buf|=oe<<ee.bi_valid&65535,ae(ee,ee.bi_buf),ee.bi_buf=oe>>x-ee.bi_valid,ee.bi_valid+=De-x):(ee.bi_buf|=oe<<ee.bi_valid&65535,ee.bi_valid+=De)}function ge(ee,oe,De){ce(ee,De[2*oe],De[2*oe+1])}function ne(ee,oe){for(var De=0;De|=1&ee,ee>>>=1,De<<=1,0<--oe;);return De>>>1}function ve(ee,oe,De){var Ne,te,j=new Array(v+1),L=0;for(Ne=1;Ne<=v;Ne++)j[Ne]=L=L+De[Ne-1]<<1;for(te=0;te<=oe;te++){var Y=ee[2*te+1];Y!==0&&(ee[2*te]=ne(j[Y]++,Y))}}function Pe(ee){var oe;for(oe=0;oe<m;oe++)ee.dyn_ltree[2*oe]=0;for(oe=0;oe<g;oe++)ee.dyn_dtree[2*oe]=0;for(oe=0;oe<y;oe++)ee.bl_tree[2*oe]=0;ee.dyn_ltree[2*w]=1,ee.opt_len=ee.static_len=0,ee.last_lit=ee.matches=0}function he(ee){8<ee.bi_valid?ae(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 we(ee,oe,De,Ne){var te=2*oe,j=2*De;return ee[te]<ee[j]||ee[te]===ee[j]&&Ne[oe]<=Ne[De]}function je(ee,oe,De){for(var Ne=ee.heap[De],te=De<<1;te<=ee.heap_len&&(te<ee.heap_len&&we(oe,ee.heap[te+1],ee.heap[te],ee.depth)&&te++,!we(oe,Ne,ee.heap[te],ee.depth));)ee.heap[De]=ee.heap[te],De=te,te<<=1;ee.heap[De]=Ne}function ue(ee,oe,De){var Ne,te,j,L,Y=0;if(ee.last_lit!==0)for(;Ne=ee.pending_buf[ee.d_buf+2*Y]<<8|ee.pending_buf[ee.d_buf+2*Y+1],te=ee.pending_buf[ee.l_buf+Y],Y++,Ne===0?ge(ee,te,oe):(ge(ee,(j=O[te])+f+1,oe),(L=A[j])!==0&&ce(ee,te-=B[j],L),ge(ee,j=X(--Ne),De),(L=U[j])!==0&&ce(ee,Ne-=Z[j],L)),Y<ee.last_lit;);ge(ee,w,oe)}function lt(ee,oe){var De,Ne,te,j=oe.dyn_tree,L=oe.stat_desc.static_tree,Y=oe.stat_desc.has_stree,me=oe.stat_desc.elems,ye=-1;for(ee.heap_len=0,ee.heap_max=_,De=0;De<me;De++)j[2*De]!==0?(ee.heap[++ee.heap_len]=ye=De,ee.depth[De]=0):j[2*De+1]=0;for(;ee.heap_len<2;)j[2*(te=ee.heap[++ee.heap_len]=ye<2?++ye:0)]=1,ee.depth[te]=0,ee.opt_len--,Y&&(ee.static_len-=L[2*te+1]);for(oe.max_code=ye,De=ee.heap_len>>1;1<=De;De--)je(ee,j,De);for(te=me;De=ee.heap[1],ee.heap[1]=ee.heap[ee.heap_len--],je(ee,j,1),Ne=ee.heap[1],ee.heap[--ee.heap_max]=De,ee.heap[--ee.heap_max]=Ne,j[2*te]=j[2*De]+j[2*Ne],ee.depth[te]=(ee.depth[De]>=ee.depth[Ne]?ee.depth[De]:ee.depth[Ne])+1,j[2*De+1]=j[2*Ne+1]=te,ee.heap[1]=te++,je(ee,j,1),2<=ee.heap_len;);ee.heap[--ee.heap_max]=ee.heap[1],(function(pe,Ze){var Le,qe,at,Ie,Re,pt,nt=Ze.dyn_tree,tt=Ze.max_code,ut=Ze.stat_desc.static_tree,de=Ze.stat_desc.has_stree,it=Ze.stat_desc.extra_bits,fe=Ze.stat_desc.extra_base,Oe=Ze.stat_desc.max_length,Me=0;for(Ie=0;Ie<=v;Ie++)pe.bl_count[Ie]=0;for(nt[2*pe.heap[pe.heap_max]+1]=0,Le=pe.heap_max+1;Le<_;Le++)Oe<(Ie=nt[2*nt[2*(qe=pe.heap[Le])+1]+1]+1)&&(Ie=Oe,Me++),nt[2*qe+1]=Ie,tt<qe||(pe.bl_count[Ie]++,Re=0,fe<=qe&&(Re=it[qe-fe]),pt=nt[2*qe],pe.opt_len+=pt*(Ie+Re),de&&(pe.static_len+=pt*(ut[2*qe+1]+Re)));if(Me!==0){do{for(Ie=Oe-1;pe.bl_count[Ie]===0;)Ie--;pe.bl_count[Ie]--,pe.bl_count[Ie+1]+=2,pe.bl_count[Oe]--,Me-=2}while(0<Me);for(Ie=Oe;Ie!==0;Ie--)for(qe=pe.bl_count[Ie];qe!==0;)tt<(at=pe.heap[--Le])||(nt[2*at+1]!==Ie&&(pe.opt_len+=(Ie-nt[2*at+1])*nt[2*at],nt[2*at+1]=Ie),qe--)}})(ee,oe),ve(j,ye,ee.bl_count)}function z(ee,oe,De){var Ne,te,j=-1,L=oe[1],Y=0,me=7,ye=4;for(L===0&&(me=138,ye=3),oe[2*(De+1)+1]=65535,Ne=0;Ne<=De;Ne++)te=L,L=oe[2*(Ne+1)+1],++Y<me&&te===L||(Y<ye?ee.bl_tree[2*te]+=Y:te!==0?(te!==j&&ee.bl_tree[2*te]++,ee.bl_tree[2*T]++):Y<=10?ee.bl_tree[2*C]++:ee.bl_tree[2*P]++,j=te,ye=(Y=0)===L?(me=138,3):te===L?(me=6,3):(me=7,4))}function q(ee,oe,De){var Ne,te,j=-1,L=oe[1],Y=0,me=7,ye=4;for(L===0&&(me=138,ye=3),Ne=0;Ne<=De;Ne++)if(te=L,L=oe[2*(Ne+1)+1],!(++Y<me&&te===L)){if(Y<ye)for(;ge(ee,te,ee.bl_tree),--Y!=0;);else te!==0?(te!==j&&(ge(ee,te,ee.bl_tree),Y--),ge(ee,T,ee.bl_tree),ce(ee,Y-3,2)):Y<=10?(ge(ee,C,ee.bl_tree),ce(ee,Y-3,3)):(ge(ee,P,ee.bl_tree),ce(ee,Y-11,7));j=te,ye=(Y=0)===L?(me=138,3):te===L?(me=6,3):(me=7,4)}}l(Z);var re=!1;function J(ee,oe,De,Ne){ce(ee,(c<<1)+(Ne?1:0),3),(function(te,j,L,Y){he(te),ae(te,L),ae(te,~L),a.arraySet(te.pending_buf,te.window,j,L,te.pending),te.pending+=L})(ee,oe,De)}r._tr_init=function(ee){re||((function(){var oe,De,Ne,te,j,L=new Array(v+1);for(te=Ne=0;te<d-1;te++)for(B[te]=Ne,oe=0;oe<1<<A[te];oe++)O[Ne++]=te;for(O[Ne-1]=te,te=j=0;te<16;te++)for(Z[te]=j,oe=0;oe<1<<U[te];oe++)W[j++]=te;for(j>>=7;te<g;te++)for(Z[te]=j<<7,oe=0;oe<1<<U[te]-7;oe++)W[256+j++]=te;for(De=0;De<=v;De++)L[De]=0;for(oe=0;oe<=143;)F[2*oe+1]=8,oe++,L[8]++;for(;oe<=255;)F[2*oe+1]=9,oe++,L[9]++;for(;oe<=279;)F[2*oe+1]=7,oe++,L[7]++;for(;oe<=287;)F[2*oe+1]=8,oe++,L[8]++;for(ve(F,m+1,L),oe=0;oe<g;oe++)I[2*oe+1]=5,I[2*oe]=ne(oe,5);H=new se(F,A,f+1,m,v),$=new se(I,U,0,g,v),K=new se(new Array(0),N,0,y,M)})(),re=!0),ee.l_desc=new V(ee.dyn_ltree,H),ee.d_desc=new V(ee.dyn_dtree,$),ee.bl_desc=new V(ee.bl_tree,K),ee.bi_buf=0,ee.bi_valid=0,Pe(ee)},r._tr_stored_block=J,r._tr_flush_block=function(ee,oe,De,Ne){var te,j,L=0;0<ee.level?(ee.strm.data_type===2&&(ee.strm.data_type=(function(Y){var me,ye=4093624447;for(me=0;me<=31;me++,ye>>>=1)if(1&ye&&Y.dyn_ltree[2*me]!==0)return s;if(Y.dyn_ltree[18]!==0||Y.dyn_ltree[20]!==0||Y.dyn_ltree[26]!==0)return o;for(me=32;me<f;me++)if(Y.dyn_ltree[2*me]!==0)return o;return s})(ee)),lt(ee,ee.l_desc),lt(ee,ee.d_desc),L=(function(Y){var me;for(z(Y,Y.dyn_ltree,Y.l_desc.max_code),z(Y,Y.dyn_dtree,Y.d_desc.max_code),lt(Y,Y.bl_desc),me=y-1;3<=me&&Y.bl_tree[2*D[me]+1]===0;me--);return Y.opt_len+=3*(me+1)+5+5+4,me})(ee),te=ee.opt_len+3+7>>>3,(j=ee.static_len+3+7>>>3)<=te&&(te=j)):te=j=De+5,De+4<=te&&oe!==-1?J(ee,oe,De,Ne):ee.strategy===4||j===te?(ce(ee,2+(Ne?1:0),3),ue(ee,F,I)):(ce(ee,4+(Ne?1:0),3),(function(Y,me,ye,pe){var Ze;for(ce(Y,me-257,5),ce(Y,ye-1,5),ce(Y,pe-4,4),Ze=0;Ze<pe;Ze++)ce(Y,Y.bl_tree[2*D[Ze]+1],3);q(Y,Y.dyn_ltree,me-1),q(Y,Y.dyn_dtree,ye-1)})(ee,ee.l_desc.max_code+1,ee.d_desc.max_code+1,L+1),ue(ee,ee.dyn_ltree,ee.dyn_dtree)),Pe(ee),Ne&&he(ee)},r._tr_tally=function(ee,oe,De){return ee.pending_buf[ee.d_buf+2*ee.last_lit]=oe>>>8&255,ee.pending_buf[ee.d_buf+2*ee.last_lit+1]=255&oe,ee.pending_buf[ee.l_buf+ee.last_lit]=255&De,ee.last_lit++,oe===0?ee.dyn_ltree[2*De]++:(ee.matches++,oe--,ee.dyn_ltree[2*(O[De]+f+1)]++,ee.dyn_dtree[2*X(oe)]++),ee.last_lit===ee.lit_bufsize-1},r._tr_align=function(ee){ce(ee,2,3),ge(ee,w,F),(function(oe){oe.bi_valid===16?(ae(oe,oe.bi_buf),oe.bi_buf=0,oe.bi_valid=0):8<=oe.bi_valid&&(oe.pending_buf[oe.pending++]=255&oe.bi_buf,oe.bi_buf>>=8,oe.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,o){if(!s.setImmediate){var l,c,d,f,m=1,g={},y=!1,_=s.document,v=Object.getPrototypeOf&&Object.getPrototypeOf(s);v=v&&v.setTimeout?v:s,l={}.toString.call(s.process)==="[object process]"?function(T){process.nextTick(function(){M(T)})}:(function(){if(s.postMessage&&!s.importScripts){var T=!0,C=s.onmessage;return s.onmessage=function(){T=!1},s.postMessage("","*"),s.onmessage=C,T}})()?(f="setImmediate$"+Math.random()+"$",s.addEventListener?s.addEventListener("message",w,!1):s.attachEvent("onmessage",w),function(T){s.postMessage(f+T,"*")}):s.MessageChannel?((d=new MessageChannel).port1.onmessage=function(T){M(T.data)},function(T){d.port2.postMessage(T)}):_&&"onreadystatechange"in _.createElement("script")?(c=_.documentElement,function(T){var C=_.createElement("script");C.onreadystatechange=function(){M(T),C.onreadystatechange=null,c.removeChild(C),C=null},c.appendChild(C)}):function(T){setTimeout(M,0,T)},v.setImmediate=function(T){typeof T!="function"&&(T=new Function(""+T));for(var C=new Array(arguments.length-1),P=0;P<C.length;P++)C[P]=arguments[P+1];var A={callback:T,args:C};return g[m]=A,l(m),m++},v.clearImmediate=x}function x(T){delete g[T]}function M(T){if(y)setTimeout(M,0,T);else{var C=g[T];if(C){y=!0;try{(function(P){var A=P.callback,U=P.args;switch(U.length){case 0:A();break;case 1:A(U[0]);break;case 2:A(U[0],U[1]);break;case 3:A(U[0],U[1],U[2]);break;default:A.apply(o,U)}})(C)}finally{x(T),y=!1}}}}function w(T){T.source===s&&typeof T.data=="string"&&T.data.indexOf(f)===0&&M(+T.data.slice(f.length))}})(typeof self>"u"?a===void 0?this:a:self)}).call(this,typeof wy<"u"?wy:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})(iT)),iT.exports}var zme=Fme();const Bme=Ks(zme);function Hme(t){const e=new qi;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 QF=Hme;async function JF(t){const e=[],n=t.getElementsByTagName("mesh");for(let i=0;i<n.length;i++){const r=n[i],a=[],s=[],o=r.getElementsByTagName("vertex");for(let c=0;c<o.length;c++){const d=o[c];a.push(parseFloat(d.getAttribute("x")||"0"),parseFloat(d.getAttribute("y")||"0"),parseFloat(d.getAttribute("z")||"0"))}const l=r.getElementsByTagName("triangle");for(let c=0;c<l.length;c++){const d=l[c];s.push(parseInt(d.getAttribute("v1")||"0"),parseInt(d.getAttribute("v2")||"0"),parseInt(d.getAttribute("v3")||"0"))}a.length>0&&s.length>0&&e.push({vertices:a,triangles:s})}return e}async function Vme(t){const e=await Bme.loadAsync(t),n=new Map,i=[],r=new DOMParser;async function a(d){const f=d.startsWith("/")?d.slice(1):d,m=e.files[f];if(!m)return null;const g=await m.async("string");return r.parseFromString(g,"application/xml")}const s=Object.keys(e.files).find(d=>d==="3D/3dmodel.model"||d.endsWith("/3dmodel.model"));if(!s){const d=Object.keys(e.files).find(f=>f.endsWith(".model"));if(d){const f=await a(d);if(f){const m=await JF(f);m.length>0&&n.set("1",{id:"1",meshes:m})}}return{objects:n,buildItems:i}}const o=await a(s);if(!o)return{objects:n,buildItems:i};const l=o.getElementsByTagName("object");for(let d=0;d<l.length;d++){const f=l[d],m=f.getAttribute("id");if(!m)continue;const g=[],y=f.getElementsByTagName("mesh");for(let v=0;v<y.length;v++){const x=y[v],M=[],w=[],T=x.getElementsByTagName("vertex");for(let P=0;P<T.length;P++){const A=T[P];M.push(parseFloat(A.getAttribute("x")||"0"),parseFloat(A.getAttribute("y")||"0"),parseFloat(A.getAttribute("z")||"0"))}const C=x.getElementsByTagName("triangle");for(let P=0;P<C.length;P++){const A=C[P];w.push(parseInt(A.getAttribute("v1")||"0"),parseInt(A.getAttribute("v2")||"0"),parseInt(A.getAttribute("v3")||"0"))}M.length>0&&w.length>0&&g.push({vertices:M,triangles:w})}const _=f.getElementsByTagName("component");for(let v=0;v<_.length;v++){const x=_[v],M=x.getAttribute("p:path")||x.getAttributeNS("http://schemas.microsoft.com/3dmanufacturing/production/2015/06","path");if(M){const w=await a(M);if(w){const T=await JF(w),C=x.getAttribute("transform"),P=QF(C);for(const A of T)if(C){const U=[];for(let N=0;N<A.vertices.length;N+=3){const D=new $e(A.vertices[N],A.vertices[N+1],A.vertices[N+2]);D.applyMatrix4(P),U.push(D.x,D.y,D.z)}g.push({vertices:U,triangles:A.triangles})}else g.push(A)}}}g.length>0&&n.set(m,{id:m,meshes:g})}const c=o.getElementsByTagName("build");if(c.length>0){const d=c[0].getElementsByTagName("item");for(let f=0;f<d.length;f++){const m=d[f],g=m.getAttribute("objectid");if(!g)continue;const y=QF(m.getAttribute("transform"));i.push({objectId:g,transform:y})}}return{objects:n,buildItems:i}}function ez(t){const e=new ol,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 Hs(n,3)),e.setIndex(t.triangles),e.computeVertexNormals(),e}function $me({url:t,buildVolume:e={x:256,y:256,z:256},className:n=""}){const i=E.useRef(null),r=E.useRef(null),a=E.useRef(null),s=E.useRef(null),o=E.useRef(null),[l,c]=E.useState(!0),[d,f]=E.useState(null);E.useEffect(()=>{if(!i.current)return;const y=i.current,_=y.clientWidth,v=y.clientHeight,x=new _ue;x.background=new vn(1710618),a.current=x;const M=new Ls(45,_/v,.1,1e4);M.position.set(150,150,150),s.current=M;const w=new wme({antialias:!0});w.setSize(_,v),w.setPixelRatio(window.devicePixelRatio),y.appendChild(w.domElement),r.current=w;const T=new Eme(M,w.domElement);T.enableDamping=!0,T.dampingFactor=.05,o.current=T;const C=new kue(16777215,.6);x.add(C);const P=new SF(16777215,.8);P.position.set(100,100,100),x.add(P);const A=new SF(16777215,.4);A.position.set(-100,50,-100),x.add(A);const U=Math.max(e.x,e.y),N=Math.ceil(U/16),D=new Lue(U,N,4473924,3355443);x.add(D);const F=new WP(e.x,e.y),I=new VP({color:44610,transparent:!0,opacity:.15,side:Bo}),W=new Jo(F,I);W.rotation.x=-Math.PI/2,W.position.y=-.5,x.add(W);let O;const B=()=>{O=requestAnimationFrame(B),T.update(),w.render(x,M)};B(),fetch(t).then($=>{if(!$.ok)throw new Error("Failed to load file");return $.arrayBuffer()}).then(Vme).then(({objects:$,buildItems:K})=>{if($.size===0)throw new Error("No meshes found in 3MF file");const Z=new Cue({color:44610,shininess:30,flatShading:!1}),se=new Yg,V=[];if(K.length>0)for(const he of K){const we=$.get(he.objectId);if(we)for(const je of we.meshes){const ue=[];for(let z=0;z<je.vertices.length;z+=3){const q=new $e(je.vertices[z],je.vertices[z+1],je.vertices[z+2]);q.applyMatrix4(he.transform),ue.push(q.x,q.y,q.z)}const lt=ez({vertices:ue,triangles:je.triangles});V.push(lt)}}else for(const he of $.values())for(const we of he.meshes){const je=ez(we);V.push(je)}if(V.length>0){const he=V.length===1?V[0]:jme(V,!1);if(he){const we=new Jo(he,Z);se.add(we)}if(V.length>1)for(const we of V)we.dispose()}const X=new Ef().setFromObject(se),ae=X.getCenter(new $e);se.position.y=-X.min.y,K.length===0&&(se.position.x=-ae.x,se.position.z=-ae.z),x.add(se);const ce=new Ef().setFromObject(se),ge=ce.getCenter(new $e),ne=ce.getSize(new $e),Pe=Math.max(ne.x,ne.y,ne.z)*1.8;M.position.set(ge.x+Pe*.7,ge.y+Pe*.5,ge.z+Pe*.7),T.target.copy(ge),T.update(),c(!1)}).catch($=>{f($.message),c(!1)});const H=()=>{if(!y)return;const $=y.clientWidth,K=y.clientHeight;M.aspect=$/K,M.updateProjectionMatrix(),w.setSize($,K)};return window.addEventListener("resize",H),()=>{window.removeEventListener("resize",H),cancelAnimationFrame(O),T.dispose(),w.dispose(),y.removeChild(w.domElement)}},[t,e]);const m=()=>{s.current&&o.current&&(s.current.position.set(150,150,150),o.current.target.set(0,50,0),o.current.update())},g=y=>{s.current&&s.current.position.multiplyScalar(y)};return p.jsxs("div",{className:`relative ${n}`,children:[p.jsx("div",{ref:i,className:"w-full h-full min-h-[400px]"}),l&&p.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-bambu-dark/80",children:p.jsx(Yt,{className:"w-8 h-8 text-bambu-green animate-spin"})}),d&&p.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-bambu-dark/80",children:p.jsx("p",{className:"text-red-400",children:d})}),!l&&!d&&p.jsxs("div",{className:"absolute bottom-4 right-4 flex gap-2",children:[p.jsx(st,{variant:"secondary",size:"sm",onClick:()=>g(.8),children:p.jsx(gle,{className:"w-4 h-4"})}),p.jsx(st,{variant:"secondary",size:"sm",onClick:()=>g(1.25),children:p.jsx(yle,{className:"w-4 h-4"})}),p.jsx(st,{variant:"secondary",size:"sm",onClick:m,children:p.jsx(VS,{className:"w-4 h-4"})})]})]})}const XS="159",zh={ROTATE:0,DOLLY:1,PAN:2},Bh={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},Gme=0,tz=1,Wme=2,G9=1,qme=2,Bl=3,qu=0,Ua=1,Gl=2,Iu=0,Tp=1,nz=2,iz=3,rz=4,Xme=5,Gd=100,Kme=101,Yme=102,az=103,sz=104,Zme=200,Qme=201,Jme=202,ege=203,h3=204,p3=205,tge=206,nge=207,ige=208,rge=209,age=210,sge=211,oge=212,lge=213,cge=214,uge=0,dge=1,fge=2,$_=3,hge=4,pge=5,mge=6,gge=7,XP=0,xge=1,vge=2,Uu=0,yge=1,bge=2,_ge=3,Sge=4,wge=5,W9=300,Hp=301,Vp=302,m3=303,g3=304,KS=306,x3=1e3,co=1001,v3=1002,zr=1003,oz=1004,rT=1005,Is=1006,Mge=1007,G0=1008,ju=1009,Ege=1010,Age=1011,KP=1012,q9=1013,Nu=1014,Zl=1015,W0=1016,X9=1017,K9=1018,af=1020,Tge=1021,Us=1023,Cge=1024,Nge=1025,sf=1026,$p=1027,Rge=1028,Y9=1029,Pge=1030,Z9=1031,Q9=1033,aT=33776,sT=33777,oT=33778,lT=33779,lz=35840,cz=35841,uz=35842,dz=35843,J9=36196,fz=37492,hz=37496,pz=37808,mz=37809,gz=37810,xz=37811,vz=37812,yz=37813,bz=37814,_z=37815,Sz=37816,wz=37817,Mz=37818,Ez=37819,Az=37820,Tz=37821,cT=36492,Cz=36494,Nz=36495,Dge=36283,Rz=36284,Pz=36285,Dz=36286,e7=3e3,of=3001,kge=3200,Oge=3201,t7=0,Lge=1,js="",Br="srgb",mc="srgb-linear",YP="display-p3",YS="display-p3-linear",G_="linear",ii="srgb",W_="rec709",q_="p3",Hh=7680,kz=519,Ige=512,Uge=513,jge=514,n7=515,Fge=516,zge=517,Bge=518,Hge=519,y3=35044,Oz="300 es",b3=1035,Go=2e3,q0=2001;class Hf{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 Kr=["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 Lz=1234567;const c0=Math.PI/180,X0=180/Math.PI;function rc(){const t=Math.random()*4294967295|0,e=Math.random()*4294967295|0,n=Math.random()*4294967295|0,i=Math.random()*4294967295|0;return(Kr[t&255]+Kr[t>>8&255]+Kr[t>>16&255]+Kr[t>>24&255]+"-"+Kr[e&255]+Kr[e>>8&255]+"-"+Kr[e>>16&15|64]+Kr[e>>24&255]+"-"+Kr[n&63|128]+Kr[n>>8&255]+"-"+Kr[n>>16&255]+Kr[n>>24&255]+Kr[i&255]+Kr[i>>8&255]+Kr[i>>16&255]+Kr[i>>24&255]).toLowerCase()}function Hr(t,e,n){return Math.max(e,Math.min(n,t))}function ZP(t,e){return(t%e+e)%e}function Vge(t,e,n,i,r){return i+(t-e)*(r-i)/(n-e)}function $ge(t,e,n){return t!==e?(n-t)/(e-t):0}function u0(t,e,n){return(1-n)*t+n*e}function Gge(t,e,n,i){return u0(t,e,1-Math.exp(-n*i))}function Wge(t,e=1){return e-Math.abs(ZP(t,e*2)-e)}function qge(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e),t*t*(3-2*t))}function Xge(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e),t*t*t*(t*(t*6-15)+10))}function Kge(t,e){return t+Math.floor(Math.random()*(e-t+1))}function Yge(t,e){return t+Math.random()*(e-t)}function Zge(t){return t*(.5-Math.random())}function Qge(t){t!==void 0&&(Lz=t);let e=Lz+=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 Jge(t){return t*c0}function e0e(t){return t*X0}function _3(t){return(t&t-1)===0&&t!==0}function t0e(t){return Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))}function X_(t){return Math.pow(2,Math.floor(Math.log(t)/Math.LN2))}function n0e(t,e,n,i,r){const a=Math.cos,s=Math.sin,o=a(n/2),l=s(n/2),c=a((e+i)/2),d=s((e+i)/2),f=a((e-i)/2),m=s((e-i)/2),g=a((i-e)/2),y=s((i-e)/2);switch(r){case"XYX":t.set(o*d,l*f,l*m,o*c);break;case"YZY":t.set(l*m,o*d,l*f,o*c);break;case"ZXZ":t.set(l*f,l*m,o*d,o*c);break;case"XZX":t.set(o*d,l*y,l*g,o*c);break;case"YXY":t.set(l*g,o*d,l*y,o*c);break;case"ZYZ":t.set(l*y,l*g,o*d,o*c);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}}function Ho(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 Bn(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 i7={DEG2RAD:c0,RAD2DEG:X0,generateUUID:rc,clamp:Hr,euclideanModulo:ZP,mapLinear:Vge,inverseLerp:$ge,lerp:u0,damp:Gge,pingpong:Wge,smoothstep:qge,smootherstep:Xge,randInt:Kge,randFloat:Yge,randFloatSpread:Zge,seededRandom:Qge,degToRad:Jge,radToDeg:e0e,isPowerOfTwo:_3,ceilPowerOfTwo:t0e,floorPowerOfTwo:X_,setQuaternionFromProperEuler:n0e,normalize:Bn,denormalize:Ho};class Wt{constructor(e=0,n=0){Wt.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 dn{constructor(e,n,i,r,a,s,o,l,c){dn.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,o,l,c)}set(e,n,i,r,a,s,o,l,c){const d=this.elements;return d[0]=e,d[1]=r,d[2]=o,d[3]=n,d[4]=a,d[5]=l,d[6]=i,d[7]=s,d[8]=c,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],o=i[3],l=i[6],c=i[1],d=i[4],f=i[7],m=i[2],g=i[5],y=i[8],_=r[0],v=r[3],x=r[6],M=r[1],w=r[4],T=r[7],C=r[2],P=r[5],A=r[8];return a[0]=s*_+o*M+l*C,a[3]=s*v+o*w+l*P,a[6]=s*x+o*T+l*A,a[1]=c*_+d*M+f*C,a[4]=c*v+d*w+f*P,a[7]=c*x+d*T+f*A,a[2]=m*_+g*M+y*C,a[5]=m*v+g*w+y*P,a[8]=m*x+g*T+y*A,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],o=e[5],l=e[6],c=e[7],d=e[8];return n*s*d-n*o*c-i*a*d+i*o*l+r*a*c-r*s*l}invert(){const e=this.elements,n=e[0],i=e[1],r=e[2],a=e[3],s=e[4],o=e[5],l=e[6],c=e[7],d=e[8],f=d*s-o*c,m=o*l-d*a,g=c*a-s*l,y=n*f+i*m+r*g;if(y===0)return this.set(0,0,0,0,0,0,0,0,0);const _=1/y;return e[0]=f*_,e[1]=(r*c-d*i)*_,e[2]=(o*i-r*s)*_,e[3]=m*_,e[4]=(d*n-r*l)*_,e[5]=(r*a-o*n)*_,e[6]=g*_,e[7]=(i*l-c*n)*_,e[8]=(s*n-i*a)*_,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,o){const l=Math.cos(a),c=Math.sin(a);return this.set(i*l,i*c,-i*(l*s+c*o)+s+e,-r*c,r*l,-r*(-c*s+l*o)+o+n,0,0,1),this}scale(e,n){return this.premultiply(uT.makeScale(e,n)),this}rotate(e){return this.premultiply(uT.makeRotation(-e)),this}translate(e,n){return this.premultiply(uT.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 uT=new dn;function r7(t){for(let e=t.length-1;e>=0;--e)if(t[e]>=65535)return!0;return!1}function K_(t){return document.createElementNS("http://www.w3.org/1999/xhtml",t)}function i0e(){const t=K_("canvas");return t.style.display="block",t}const Iz={};function d0(t){t in Iz||(Iz[t]=!0,console.warn(t))}const Uz=new dn().set(.8224621,.177538,0,.0331941,.9668058,0,.0170827,.0723974,.9105199),jz=new dn().set(1.2249401,-.2249404,0,-.0420569,1.0420571,0,-.0196376,-.0786361,1.0982735),Zy={[mc]:{transfer:G_,primaries:W_,toReference:t=>t,fromReference:t=>t},[Br]:{transfer:ii,primaries:W_,toReference:t=>t.convertSRGBToLinear(),fromReference:t=>t.convertLinearToSRGB()},[YS]:{transfer:G_,primaries:q_,toReference:t=>t.applyMatrix3(jz),fromReference:t=>t.applyMatrix3(Uz)},[YP]:{transfer:ii,primaries:q_,toReference:t=>t.convertSRGBToLinear().applyMatrix3(jz),fromReference:t=>t.applyMatrix3(Uz).convertLinearToSRGB()}},r0e=new Set([mc,YS]),Hn={enabled:!0,_workingColorSpace:mc,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(!r0e.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=Zy[e].toReference,r=Zy[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 Zy[t].primaries},getTransfer:function(t){return t===js?G_:Zy[t].transfer}};function Cp(t){return t<.04045?t*.0773993808:Math.pow(t*.9478672986+.0521327014,2.4)}function dT(t){return t<.0031308?t*12.92:1.055*Math.pow(t,.41666)-.055}let Vh;class a7{static getDataURL(e){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let n;if(e instanceof HTMLCanvasElement)n=e;else{Vh===void 0&&(Vh=K_("canvas")),Vh.width=e.width,Vh.height=e.height;const i=Vh.getContext("2d");e instanceof ImageData?i.putImageData(e,0,0):i.drawImage(e,0,0,e.width,e.height),n=Vh}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=K_("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]=Cp(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(Cp(n[i]/255)*255):n[i]=Cp(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 a0e=0;class s7{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:a0e++}),this.uuid=rc(),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,o=r.length;s<o;s++)r[s].isDataTexture?a.push(fT(r[s].image)):a.push(fT(r[s]))}else a=fT(r);i.url=a}return n||(e.images[this.uuid]=i),i}}function fT(t){return typeof HTMLImageElement<"u"&&t instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&t instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&t instanceof ImageBitmap?a7.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 s0e=0;class ja extends Hf{constructor(e=ja.DEFAULT_IMAGE,n=ja.DEFAULT_MAPPING,i=co,r=co,a=Is,s=G0,o=Us,l=ju,c=ja.DEFAULT_ANISOTROPY,d=js){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:s0e++}),this.uuid=rc(),this.name="",this.source=new s7(e),this.mipmaps=[],this.mapping=n,this.channel=0,this.wrapS=i,this.wrapT=r,this.magFilter=a,this.minFilter=s,this.anisotropy=c,this.format=o,this.internalFormat=null,this.type=l,this.offset=new Wt(0,0),this.repeat=new Wt(1,1),this.center=new Wt(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new dn,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,typeof d=="string"?this.colorSpace=d:(d0("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace=d===of?Br:js),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!==W9)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case x3:e.x=e.x-Math.floor(e.x);break;case co:e.x=e.x<0?0:1;break;case v3: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 x3:e.y=e.y-Math.floor(e.y);break;case co:e.y=e.y<0?0:1;break;case v3: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 d0("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace===Br?of:e7}set encoding(e){d0("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace=e===of?Br:js}}ja.DEFAULT_IMAGE=null;ja.DEFAULT_MAPPING=W9;ja.DEFAULT_ANISOTROPY=1;class $n{constructor(e=0,n=0,i=0,r=1){$n.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 l=e.elements,c=l[0],d=l[4],f=l[8],m=l[1],g=l[5],y=l[9],_=l[2],v=l[6],x=l[10];if(Math.abs(d-m)<.01&&Math.abs(f-_)<.01&&Math.abs(y-v)<.01){if(Math.abs(d+m)<.1&&Math.abs(f+_)<.1&&Math.abs(y+v)<.1&&Math.abs(c+g+x-3)<.1)return this.set(1,0,0,0),this;n=Math.PI;const w=(c+1)/2,T=(g+1)/2,C=(x+1)/2,P=(d+m)/4,A=(f+_)/4,U=(y+v)/4;return w>T&&w>C?w<.01?(i=0,r=.707106781,a=.707106781):(i=Math.sqrt(w),r=P/i,a=A/i):T>C?T<.01?(i=.707106781,r=0,a=.707106781):(r=Math.sqrt(T),i=P/r,a=U/r):C<.01?(i=.707106781,r=.707106781,a=0):(a=Math.sqrt(C),i=A/a,r=U/a),this.set(i,r,a,n),this}let M=Math.sqrt((v-y)*(v-y)+(f-_)*(f-_)+(m-d)*(m-d));return Math.abs(M)<.001&&(M=1),this.x=(v-y)/M,this.y=(f-_)/M,this.z=(m-d)/M,this.w=Math.acos((c+g+x-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 o0e extends Hf{constructor(e=1,n=1,i={}){super(),this.isRenderTarget=!0,this.width=e,this.height=n,this.depth=1,this.scissor=new $n(0,0,e,n),this.scissorTest=!1,this.viewport=new $n(0,0,e,n);const r={width:e,height:n,depth:1};i.encoding!==void 0&&(d0("THREE.WebGLRenderTarget: option.encoding has been replaced by option.colorSpace."),i.colorSpace=i.encoding===of?Br:js),i=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:Is,depthBuffer:!0,stencilBuffer:!1,depthTexture:null,samples:0},i),this.texture=new ja(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 s7(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 Af extends o0e{constructor(e=1,n=1,i={}){super(e,n,i),this.isWebGLRenderTarget=!0}}class o7 extends ja{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=zr,this.minFilter=zr,this.wrapR=co,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class l0e extends ja{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=zr,this.minFilter=zr,this.wrapR=co,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class Tf{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,o){let l=i[r+0],c=i[r+1],d=i[r+2],f=i[r+3];const m=a[s+0],g=a[s+1],y=a[s+2],_=a[s+3];if(o===0){e[n+0]=l,e[n+1]=c,e[n+2]=d,e[n+3]=f;return}if(o===1){e[n+0]=m,e[n+1]=g,e[n+2]=y,e[n+3]=_;return}if(f!==_||l!==m||c!==g||d!==y){let v=1-o;const x=l*m+c*g+d*y+f*_,M=x>=0?1:-1,w=1-x*x;if(w>Number.EPSILON){const C=Math.sqrt(w),P=Math.atan2(C,x*M);v=Math.sin(v*P)/C,o=Math.sin(o*P)/C}const T=o*M;if(l=l*v+m*T,c=c*v+g*T,d=d*v+y*T,f=f*v+_*T,v===1-o){const C=1/Math.sqrt(l*l+c*c+d*d+f*f);l*=C,c*=C,d*=C,f*=C}}e[n]=l,e[n+1]=c,e[n+2]=d,e[n+3]=f}static multiplyQuaternionsFlat(e,n,i,r,a,s){const o=i[r],l=i[r+1],c=i[r+2],d=i[r+3],f=a[s],m=a[s+1],g=a[s+2],y=a[s+3];return e[n]=o*y+d*f+l*g-c*m,e[n+1]=l*y+d*m+c*f-o*g,e[n+2]=c*y+d*g+o*m-l*f,e[n+3]=d*y-o*f-l*m-c*g,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,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,o=Math.cos,l=Math.sin,c=o(i/2),d=o(r/2),f=o(a/2),m=l(i/2),g=l(r/2),y=l(a/2);switch(s){case"XYZ":this._x=m*d*f+c*g*y,this._y=c*g*f-m*d*y,this._z=c*d*y+m*g*f,this._w=c*d*f-m*g*y;break;case"YXZ":this._x=m*d*f+c*g*y,this._y=c*g*f-m*d*y,this._z=c*d*y-m*g*f,this._w=c*d*f+m*g*y;break;case"ZXY":this._x=m*d*f-c*g*y,this._y=c*g*f+m*d*y,this._z=c*d*y+m*g*f,this._w=c*d*f-m*g*y;break;case"ZYX":this._x=m*d*f-c*g*y,this._y=c*g*f+m*d*y,this._z=c*d*y-m*g*f,this._w=c*d*f+m*g*y;break;case"YZX":this._x=m*d*f+c*g*y,this._y=c*g*f+m*d*y,this._z=c*d*y-m*g*f,this._w=c*d*f-m*g*y;break;case"XZY":this._x=m*d*f-c*g*y,this._y=c*g*f-m*d*y,this._z=c*d*y+m*g*f,this._w=c*d*f+m*g*y;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],o=n[5],l=n[9],c=n[2],d=n[6],f=n[10],m=i+o+f;if(m>0){const g=.5/Math.sqrt(m+1);this._w=.25/g,this._x=(d-l)*g,this._y=(a-c)*g,this._z=(s-r)*g}else if(i>o&&i>f){const g=2*Math.sqrt(1+i-o-f);this._w=(d-l)/g,this._x=.25*g,this._y=(r+s)/g,this._z=(a+c)/g}else if(o>f){const g=2*Math.sqrt(1+o-i-f);this._w=(a-c)/g,this._x=(r+s)/g,this._y=.25*g,this._z=(l+d)/g}else{const g=2*Math.sqrt(1+f-i-o);this._w=(s-r)/g,this._x=(a+c)/g,this._y=(l+d)/g,this._z=.25*g}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,o=n._x,l=n._y,c=n._z,d=n._w;return this._x=i*d+s*o+r*c-a*l,this._y=r*d+s*l+a*o-i*c,this._z=a*d+s*c+i*l-r*o,this._w=s*d-i*o-r*l-a*c,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 o=s*e._w+i*e._x+r*e._y+a*e._z;if(o<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,o=-o):this.copy(e),o>=1)return this._w=s,this._x=i,this._y=r,this._z=a,this;const l=1-o*o;if(l<=Number.EPSILON){const g=1-n;return this._w=g*s+n*this._w,this._x=g*i+n*this._x,this._y=g*r+n*this._y,this._z=g*a+n*this._z,this.normalize(),this._onChangeCallback(),this}const c=Math.sqrt(l),d=Math.atan2(c,o),f=Math.sin((1-n)*d)/c,m=Math.sin(n*d)/c;return this._w=s*f+this._w*m,this._x=i*f+this._x*m,this._y=r*f+this._y*m,this._z=a*f+this._z*m,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 Ae{constructor(e=0,n=0,i=0){Ae.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(Fz.setFromEuler(e))}applyAxisAngle(e,n){return this.applyQuaternion(Fz.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,o=e.z,l=e.w,c=2*(s*r-o*i),d=2*(o*n-a*r),f=2*(a*i-s*n);return this.x=n+l*c+s*f-o*d,this.y=i+l*d+o*c-a*f,this.z=r+l*f+a*d-s*c,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,o=n.y,l=n.z;return this.x=r*l-a*o,this.y=a*s-i*l,this.z=i*o-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 hT.copy(this).projectOnVector(e),this.sub(hT)}reflect(e){return this.sub(hT.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 hT=new Ae,Fz=new Tf;class Vs{constructor(e=new Ae(1/0,1/0,1/0),n=new Ae(-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(ao.fromArray(e,n));return this}setFromBufferAttribute(e){this.makeEmpty();for(let n=0,i=e.count;n<i;n++)this.expandByPoint(ao.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=ao.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,o=a.count;s<o;s++)e.isMesh===!0?e.getVertexPosition(s,ao):ao.fromBufferAttribute(a,s),ao.applyMatrix4(e.matrixWorld),this.expandByPoint(ao);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),Qy.copy(e.boundingBox)):(i.boundingBox===null&&i.computeBoundingBox(),Qy.copy(i.boundingBox)),Qy.applyMatrix4(e.matrixWorld),this.union(Qy)}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,ao),ao.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(kg),Jy.subVectors(this.max,kg),$h.subVectors(e.a,kg),Gh.subVectors(e.b,kg),Wh.subVectors(e.c,kg),ou.subVectors(Gh,$h),lu.subVectors(Wh,Gh),kd.subVectors($h,Wh);let n=[0,-ou.z,ou.y,0,-lu.z,lu.y,0,-kd.z,kd.y,ou.z,0,-ou.x,lu.z,0,-lu.x,kd.z,0,-kd.x,-ou.y,ou.x,0,-lu.y,lu.x,0,-kd.y,kd.x,0];return!pT(n,$h,Gh,Wh,Jy)||(n=[1,0,0,0,1,0,0,0,1],!pT(n,$h,Gh,Wh,Jy))?!1:(eb.crossVectors(ou,lu),n=[eb.x,eb.y,eb.z],pT(n,$h,Gh,Wh,Jy))}clampPoint(e,n){return n.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,ao).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(ao).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:(Dl[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Dl[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Dl[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Dl[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Dl[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Dl[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Dl[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Dl[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Dl),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 Dl=[new Ae,new Ae,new Ae,new Ae,new Ae,new Ae,new Ae,new Ae],ao=new Ae,Qy=new Vs,$h=new Ae,Gh=new Ae,Wh=new Ae,ou=new Ae,lu=new Ae,kd=new Ae,kg=new Ae,Jy=new Ae,eb=new Ae,Od=new Ae;function pT(t,e,n,i,r){for(let a=0,s=t.length-3;a<=s;a+=3){Od.fromArray(t,a);const o=r.x*Math.abs(Od.x)+r.y*Math.abs(Od.y)+r.z*Math.abs(Od.z),l=e.dot(Od),c=n.dot(Od),d=i.dot(Od);if(Math.max(-Math.max(l,c,d),Math.min(l,c,d))>o)return!1}return!0}const c0e=new Vs,Og=new Ae,mT=new Ae;class qo{constructor(e=new Ae,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):c0e.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;Og.subVectors(e,this.center);const n=Og.lengthSq();if(n>this.radius*this.radius){const i=Math.sqrt(n),r=(i-this.radius)*.5;this.center.addScaledVector(Og,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):(mT.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(Og.copy(e.center).add(mT)),this.expandByPoint(Og.copy(e.center).sub(mT))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}}const kl=new Ae,gT=new Ae,tb=new Ae,cu=new Ae,xT=new Ae,nb=new Ae,vT=new Ae;class QP{constructor(e=new Ae,n=new Ae(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,kl)),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=kl.subVectors(e,this.origin).dot(this.direction);return n<0?this.origin.distanceToSquared(e):(kl.copy(this.origin).addScaledVector(this.direction,n),kl.distanceToSquared(e))}distanceSqToSegment(e,n,i,r){gT.copy(e).add(n).multiplyScalar(.5),tb.copy(n).sub(e).normalize(),cu.copy(this.origin).sub(gT);const a=e.distanceTo(n)*.5,s=-this.direction.dot(tb),o=cu.dot(this.direction),l=-cu.dot(tb),c=cu.lengthSq(),d=Math.abs(1-s*s);let f,m,g,y;if(d>0)if(f=s*l-o,m=s*o-l,y=a*d,f>=0)if(m>=-y)if(m<=y){const _=1/d;f*=_,m*=_,g=f*(f+s*m+2*o)+m*(s*f+m+2*l)+c}else m=a,f=Math.max(0,-(s*m+o)),g=-f*f+m*(m+2*l)+c;else m=-a,f=Math.max(0,-(s*m+o)),g=-f*f+m*(m+2*l)+c;else m<=-y?(f=Math.max(0,-(-s*a+o)),m=f>0?-a:Math.min(Math.max(-a,-l),a),g=-f*f+m*(m+2*l)+c):m<=y?(f=0,m=Math.min(Math.max(-a,-l),a),g=m*(m+2*l)+c):(f=Math.max(0,-(s*a+o)),m=f>0?a:Math.min(Math.max(-a,-l),a),g=-f*f+m*(m+2*l)+c);else m=s>0?-a:a,f=Math.max(0,-(s*m+o)),g=-f*f+m*(m+2*l)+c;return i&&i.copy(this.origin).addScaledVector(this.direction,f),r&&r.copy(gT).addScaledVector(tb,m),g}intersectSphere(e,n){kl.subVectors(e.center,this.origin);const i=kl.dot(this.direction),r=kl.dot(kl)-i*i,a=e.radius*e.radius;if(r>a)return null;const s=Math.sqrt(a-r),o=i-s,l=i+s;return l<0?null:o<0?this.at(l,n):this.at(o,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,o,l;const c=1/this.direction.x,d=1/this.direction.y,f=1/this.direction.z,m=this.origin;return c>=0?(i=(e.min.x-m.x)*c,r=(e.max.x-m.x)*c):(i=(e.max.x-m.x)*c,r=(e.min.x-m.x)*c),d>=0?(a=(e.min.y-m.y)*d,s=(e.max.y-m.y)*d):(a=(e.max.y-m.y)*d,s=(e.min.y-m.y)*d),i>s||a>r||((a>i||isNaN(i))&&(i=a),(s<r||isNaN(r))&&(r=s),f>=0?(o=(e.min.z-m.z)*f,l=(e.max.z-m.z)*f):(o=(e.max.z-m.z)*f,l=(e.min.z-m.z)*f),i>l||o>r)||((o>i||i!==i)&&(i=o),(l<r||r!==r)&&(r=l),r<0)?null:this.at(i>=0?i:r,n)}intersectsBox(e){return this.intersectBox(e,kl)!==null}intersectTriangle(e,n,i,r,a){xT.subVectors(n,e),nb.subVectors(i,e),vT.crossVectors(xT,nb);let s=this.direction.dot(vT),o;if(s>0){if(r)return null;o=1}else if(s<0)o=-1,s=-s;else return null;cu.subVectors(this.origin,e);const l=o*this.direction.dot(nb.crossVectors(cu,nb));if(l<0)return null;const c=o*this.direction.dot(xT.cross(cu));if(c<0||l+c>s)return null;const d=-o*cu.dot(vT);return d<0?null:this.at(d/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 Qn{constructor(e,n,i,r,a,s,o,l,c,d,f,m,g,y,_,v){Qn.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,o,l,c,d,f,m,g,y,_,v)}set(e,n,i,r,a,s,o,l,c,d,f,m,g,y,_,v){const x=this.elements;return x[0]=e,x[4]=n,x[8]=i,x[12]=r,x[1]=a,x[5]=s,x[9]=o,x[13]=l,x[2]=c,x[6]=d,x[10]=f,x[14]=m,x[3]=g,x[7]=y,x[11]=_,x[15]=v,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 Qn().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/qh.setFromMatrixColumn(e,0).length(),a=1/qh.setFromMatrixColumn(e,1).length(),s=1/qh.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),o=Math.sin(i),l=Math.cos(r),c=Math.sin(r),d=Math.cos(a),f=Math.sin(a);if(e.order==="XYZ"){const m=s*d,g=s*f,y=o*d,_=o*f;n[0]=l*d,n[4]=-l*f,n[8]=c,n[1]=g+y*c,n[5]=m-_*c,n[9]=-o*l,n[2]=_-m*c,n[6]=y+g*c,n[10]=s*l}else if(e.order==="YXZ"){const m=l*d,g=l*f,y=c*d,_=c*f;n[0]=m+_*o,n[4]=y*o-g,n[8]=s*c,n[1]=s*f,n[5]=s*d,n[9]=-o,n[2]=g*o-y,n[6]=_+m*o,n[10]=s*l}else if(e.order==="ZXY"){const m=l*d,g=l*f,y=c*d,_=c*f;n[0]=m-_*o,n[4]=-s*f,n[8]=y+g*o,n[1]=g+y*o,n[5]=s*d,n[9]=_-m*o,n[2]=-s*c,n[6]=o,n[10]=s*l}else if(e.order==="ZYX"){const m=s*d,g=s*f,y=o*d,_=o*f;n[0]=l*d,n[4]=y*c-g,n[8]=m*c+_,n[1]=l*f,n[5]=_*c+m,n[9]=g*c-y,n[2]=-c,n[6]=o*l,n[10]=s*l}else if(e.order==="YZX"){const m=s*l,g=s*c,y=o*l,_=o*c;n[0]=l*d,n[4]=_-m*f,n[8]=y*f+g,n[1]=f,n[5]=s*d,n[9]=-o*d,n[2]=-c*d,n[6]=g*f+y,n[10]=m-_*f}else if(e.order==="XZY"){const m=s*l,g=s*c,y=o*l,_=o*c;n[0]=l*d,n[4]=-f,n[8]=c*d,n[1]=m*f+_,n[5]=s*d,n[9]=g*f-y,n[2]=y*f-g,n[6]=o*d,n[10]=_*f+m}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(u0e,e,d0e)}lookAt(e,n,i){const r=this.elements;return es.subVectors(e,n),es.lengthSq()===0&&(es.z=1),es.normalize(),uu.crossVectors(i,es),uu.lengthSq()===0&&(Math.abs(i.z)===1?es.x+=1e-4:es.z+=1e-4,es.normalize(),uu.crossVectors(i,es)),uu.normalize(),ib.crossVectors(es,uu),r[0]=uu.x,r[4]=ib.x,r[8]=es.x,r[1]=uu.y,r[5]=ib.y,r[9]=es.y,r[2]=uu.z,r[6]=ib.z,r[10]=es.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],o=i[4],l=i[8],c=i[12],d=i[1],f=i[5],m=i[9],g=i[13],y=i[2],_=i[6],v=i[10],x=i[14],M=i[3],w=i[7],T=i[11],C=i[15],P=r[0],A=r[4],U=r[8],N=r[12],D=r[1],F=r[5],I=r[9],W=r[13],O=r[2],B=r[6],H=r[10],$=r[14],K=r[3],Z=r[7],se=r[11],V=r[15];return a[0]=s*P+o*D+l*O+c*K,a[4]=s*A+o*F+l*B+c*Z,a[8]=s*U+o*I+l*H+c*se,a[12]=s*N+o*W+l*$+c*V,a[1]=d*P+f*D+m*O+g*K,a[5]=d*A+f*F+m*B+g*Z,a[9]=d*U+f*I+m*H+g*se,a[13]=d*N+f*W+m*$+g*V,a[2]=y*P+_*D+v*O+x*K,a[6]=y*A+_*F+v*B+x*Z,a[10]=y*U+_*I+v*H+x*se,a[14]=y*N+_*W+v*$+x*V,a[3]=M*P+w*D+T*O+C*K,a[7]=M*A+w*F+T*B+C*Z,a[11]=M*U+w*I+T*H+C*se,a[15]=M*N+w*W+T*$+C*V,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],o=e[5],l=e[9],c=e[13],d=e[2],f=e[6],m=e[10],g=e[14],y=e[3],_=e[7],v=e[11],x=e[15];return y*(+a*l*f-r*c*f-a*o*m+i*c*m+r*o*g-i*l*g)+_*(+n*l*g-n*c*m+a*s*m-r*s*g+r*c*d-a*l*d)+v*(+n*c*f-n*o*g-a*s*f+i*s*g+a*o*d-i*c*d)+x*(-r*o*d-n*l*f+n*o*m+r*s*f-i*s*m+i*l*d)}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],o=e[5],l=e[6],c=e[7],d=e[8],f=e[9],m=e[10],g=e[11],y=e[12],_=e[13],v=e[14],x=e[15],M=f*v*c-_*m*c+_*l*g-o*v*g-f*l*x+o*m*x,w=y*m*c-d*v*c-y*l*g+s*v*g+d*l*x-s*m*x,T=d*_*c-y*f*c+y*o*g-s*_*g-d*o*x+s*f*x,C=y*f*l-d*_*l-y*o*m+s*_*m+d*o*v-s*f*v,P=n*M+i*w+r*T+a*C;if(P===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const A=1/P;return e[0]=M*A,e[1]=(_*m*a-f*v*a-_*r*g+i*v*g+f*r*x-i*m*x)*A,e[2]=(o*v*a-_*l*a+_*r*c-i*v*c-o*r*x+i*l*x)*A,e[3]=(f*l*a-o*m*a-f*r*c+i*m*c+o*r*g-i*l*g)*A,e[4]=w*A,e[5]=(d*v*a-y*m*a+y*r*g-n*v*g-d*r*x+n*m*x)*A,e[6]=(y*l*a-s*v*a-y*r*c+n*v*c+s*r*x-n*l*x)*A,e[7]=(s*m*a-d*l*a+d*r*c-n*m*c-s*r*g+n*l*g)*A,e[8]=T*A,e[9]=(y*f*a-d*_*a-y*i*g+n*_*g+d*i*x-n*f*x)*A,e[10]=(s*_*a-y*o*a+y*i*c-n*_*c-s*i*x+n*o*x)*A,e[11]=(d*o*a-s*f*a-d*i*c+n*f*c+s*i*g-n*o*g)*A,e[12]=C*A,e[13]=(d*_*r-y*f*r+y*i*m-n*_*m-d*i*v+n*f*v)*A,e[14]=(y*o*r-s*_*r-y*i*l+n*_*l+s*i*v-n*o*v)*A,e[15]=(s*f*r-d*o*r+d*i*l-n*f*l-s*i*m+n*o*m)*A,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,o=e.y,l=e.z,c=a*s,d=a*o;return this.set(c*s+i,c*o-r*l,c*l+r*o,0,c*o+r*l,d*o+i,d*l-r*s,0,c*l-r*o,d*l+r*s,a*l*l+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,o=n._z,l=n._w,c=a+a,d=s+s,f=o+o,m=a*c,g=a*d,y=a*f,_=s*d,v=s*f,x=o*f,M=l*c,w=l*d,T=l*f,C=i.x,P=i.y,A=i.z;return r[0]=(1-(_+x))*C,r[1]=(g+T)*C,r[2]=(y-w)*C,r[3]=0,r[4]=(g-T)*P,r[5]=(1-(m+x))*P,r[6]=(v+M)*P,r[7]=0,r[8]=(y+w)*A,r[9]=(v-M)*A,r[10]=(1-(m+_))*A,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=qh.set(r[0],r[1],r[2]).length();const s=qh.set(r[4],r[5],r[6]).length(),o=qh.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],so.copy(this);const c=1/a,d=1/s,f=1/o;return so.elements[0]*=c,so.elements[1]*=c,so.elements[2]*=c,so.elements[4]*=d,so.elements[5]*=d,so.elements[6]*=d,so.elements[8]*=f,so.elements[9]*=f,so.elements[10]*=f,n.setFromRotationMatrix(so),i.x=a,i.y=s,i.z=o,this}makePerspective(e,n,i,r,a,s,o=Go){const l=this.elements,c=2*a/(n-e),d=2*a/(i-r),f=(n+e)/(n-e),m=(i+r)/(i-r);let g,y;if(o===Go)g=-(s+a)/(s-a),y=-2*s*a/(s-a);else if(o===q0)g=-s/(s-a),y=-s*a/(s-a);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+o);return l[0]=c,l[4]=0,l[8]=f,l[12]=0,l[1]=0,l[5]=d,l[9]=m,l[13]=0,l[2]=0,l[6]=0,l[10]=g,l[14]=y,l[3]=0,l[7]=0,l[11]=-1,l[15]=0,this}makeOrthographic(e,n,i,r,a,s,o=Go){const l=this.elements,c=1/(n-e),d=1/(i-r),f=1/(s-a),m=(n+e)*c,g=(i+r)*d;let y,_;if(o===Go)y=(s+a)*f,_=-2*f;else if(o===q0)y=a*f,_=-1*f;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+o);return l[0]=2*c,l[4]=0,l[8]=0,l[12]=-m,l[1]=0,l[5]=2*d,l[9]=0,l[13]=-g,l[2]=0,l[6]=0,l[10]=_,l[14]=-y,l[3]=0,l[7]=0,l[11]=0,l[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 qh=new Ae,so=new Qn,u0e=new Ae(0,0,0),d0e=new Ae(1,1,1),uu=new Ae,ib=new Ae,es=new Ae,zz=new Qn,Bz=new Tf;class Dx{constructor(e=0,n=0,i=0,r=Dx.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],o=r[8],l=r[1],c=r[5],d=r[9],f=r[2],m=r[6],g=r[10];switch(n){case"XYZ":this._y=Math.asin(Hr(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-d,g),this._z=Math.atan2(-s,a)):(this._x=Math.atan2(m,c),this._z=0);break;case"YXZ":this._x=Math.asin(-Hr(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(o,g),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-f,a),this._z=0);break;case"ZXY":this._x=Math.asin(Hr(m,-1,1)),Math.abs(m)<.9999999?(this._y=Math.atan2(-f,g),this._z=Math.atan2(-s,c)):(this._y=0,this._z=Math.atan2(l,a));break;case"ZYX":this._y=Math.asin(-Hr(f,-1,1)),Math.abs(f)<.9999999?(this._x=Math.atan2(m,g),this._z=Math.atan2(l,a)):(this._x=0,this._z=Math.atan2(-s,c));break;case"YZX":this._z=Math.asin(Hr(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-d,c),this._y=Math.atan2(-f,a)):(this._x=0,this._y=Math.atan2(o,g));break;case"XZY":this._z=Math.asin(-Hr(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(m,c),this._y=Math.atan2(o,a)):(this._x=Math.atan2(-d,g),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 zz.makeRotationFromQuaternion(e),this.setFromRotationMatrix(zz,n,i)}setFromVector3(e,n=this._order){return this.set(e.x,e.y,e.z,n)}reorder(e){return Bz.setFromEuler(this),this.setFromQuaternion(Bz,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}}Dx.DEFAULT_ORDER="XYZ";class l7{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 f0e=0;const Hz=new Ae,Xh=new Tf,Ol=new Qn,rb=new Ae,Lg=new Ae,h0e=new Ae,p0e=new Tf,Vz=new Ae(1,0,0),$z=new Ae(0,1,0),Gz=new Ae(0,0,1),m0e={type:"added"},g0e={type:"removed"};class ga extends Hf{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:f0e++}),this.uuid=rc(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=ga.DEFAULT_UP.clone();const e=new Ae,n=new Dx,i=new Tf,r=new Ae(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 Qn},normalMatrix:{value:new dn}}),this.matrix=new Qn,this.matrixWorld=new Qn,this.matrixAutoUpdate=ga.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=ga.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new l7,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 Xh.setFromAxisAngle(e,n),this.quaternion.multiply(Xh),this}rotateOnWorldAxis(e,n){return Xh.setFromAxisAngle(e,n),this.quaternion.premultiply(Xh),this}rotateX(e){return this.rotateOnAxis(Vz,e)}rotateY(e){return this.rotateOnAxis($z,e)}rotateZ(e){return this.rotateOnAxis(Gz,e)}translateOnAxis(e,n){return Hz.copy(e).applyQuaternion(this.quaternion),this.position.add(Hz.multiplyScalar(n)),this}translateX(e){return this.translateOnAxis(Vz,e)}translateY(e){return this.translateOnAxis($z,e)}translateZ(e){return this.translateOnAxis(Gz,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(Ol.copy(this.matrixWorld).invert())}lookAt(e,n,i){e.isVector3?rb.copy(e):rb.set(e,n,i);const r=this.parent;this.updateWorldMatrix(!0,!1),Lg.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Ol.lookAt(Lg,rb,this.up):Ol.lookAt(rb,Lg,this.up),this.quaternion.setFromRotationMatrix(Ol),r&&(Ol.extractRotation(r.matrixWorld),Xh.setFromRotationMatrix(Ol),this.quaternion.premultiply(Xh.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(m0e)):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(g0e)),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),Ol.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),Ol.multiply(e.parent.matrixWorld)),e.applyMatrix4(Ol),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(Lg,e,h0e),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Lg,p0e,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 o=r[a];o.matrixWorldAutoUpdate===!0&&o.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(o=>({boxInitialized:o.boxInitialized,boxMin:o.box.min.toArray(),boxMax:o.box.max.toArray(),sphereInitialized:o.sphereInitialized,sphereRadius:o.sphere.radius,sphereCenter:o.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(o,l){return o[l.uuid]===void 0&&(o[l.uuid]=l.toJSON(e)),l.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 o=this.geometry.parameters;if(o!==void 0&&o.shapes!==void 0){const l=o.shapes;if(Array.isArray(l))for(let c=0,d=l.length;c<d;c++){const f=l[c];a(e.shapes,f)}else a(e.shapes,l)}}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 o=[];for(let l=0,c=this.material.length;l<c;l++)o.push(a(e.materials,this.material[l]));r.material=o}else r.material=a(e.materials,this.material);if(this.children.length>0){r.children=[];for(let o=0;o<this.children.length;o++)r.children.push(this.children[o].toJSON(e).object)}if(this.animations.length>0){r.animations=[];for(let o=0;o<this.animations.length;o++){const l=this.animations[o];r.animations.push(a(e.animations,l))}}if(n){const o=s(e.geometries),l=s(e.materials),c=s(e.textures),d=s(e.images),f=s(e.shapes),m=s(e.skeletons),g=s(e.animations),y=s(e.nodes);o.length>0&&(i.geometries=o),l.length>0&&(i.materials=l),c.length>0&&(i.textures=c),d.length>0&&(i.images=d),f.length>0&&(i.shapes=f),m.length>0&&(i.skeletons=m),g.length>0&&(i.animations=g),y.length>0&&(i.nodes=y)}return i.object=r,i;function s(o){const l=[];for(const c in o){const d=o[c];delete d.metadata,l.push(d)}return l}}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}}ga.DEFAULT_UP=new Ae(0,1,0);ga.DEFAULT_MATRIX_AUTO_UPDATE=!0;ga.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;const oo=new Ae,Ll=new Ae,yT=new Ae,Il=new Ae,Kh=new Ae,Yh=new Ae,Wz=new Ae,bT=new Ae,_T=new Ae,ST=new Ae;let ab=!1;class lo{constructor(e=new Ae,n=new Ae,i=new Ae){this.a=e,this.b=n,this.c=i}static getNormal(e,n,i,r){r.subVectors(i,n),oo.subVectors(e,n),r.cross(oo);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){oo.subVectors(r,n),Ll.subVectors(i,n),yT.subVectors(e,n);const s=oo.dot(oo),o=oo.dot(Ll),l=oo.dot(yT),c=Ll.dot(Ll),d=Ll.dot(yT),f=s*c-o*o;if(f===0)return a.set(-2,-1,-1);const m=1/f,g=(c*l-o*d)*m,y=(s*d-o*l)*m;return a.set(1-g-y,y,g)}static containsPoint(e,n,i,r){return this.getBarycoord(e,n,i,r,Il),Il.x>=0&&Il.y>=0&&Il.x+Il.y<=1}static getUV(e,n,i,r,a,s,o,l){return ab===!1&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."),ab=!0),this.getInterpolation(e,n,i,r,a,s,o,l)}static getInterpolation(e,n,i,r,a,s,o,l){return this.getBarycoord(e,n,i,r,Il),l.setScalar(0),l.addScaledVector(a,Il.x),l.addScaledVector(s,Il.y),l.addScaledVector(o,Il.z),l}static isFrontFacing(e,n,i,r){return oo.subVectors(i,n),Ll.subVectors(e,n),oo.cross(Ll).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 oo.subVectors(this.c,this.b),Ll.subVectors(this.a,this.b),oo.cross(Ll).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return lo.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,n){return lo.getBarycoord(e,this.a,this.b,this.c,n)}getUV(e,n,i,r,a){return ab===!1&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."),ab=!0),lo.getInterpolation(e,this.a,this.b,this.c,n,i,r,a)}getInterpolation(e,n,i,r,a){return lo.getInterpolation(e,this.a,this.b,this.c,n,i,r,a)}containsPoint(e){return lo.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return lo.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,o;Kh.subVectors(r,i),Yh.subVectors(a,i),bT.subVectors(e,i);const l=Kh.dot(bT),c=Yh.dot(bT);if(l<=0&&c<=0)return n.copy(i);_T.subVectors(e,r);const d=Kh.dot(_T),f=Yh.dot(_T);if(d>=0&&f<=d)return n.copy(r);const m=l*f-d*c;if(m<=0&&l>=0&&d<=0)return s=l/(l-d),n.copy(i).addScaledVector(Kh,s);ST.subVectors(e,a);const g=Kh.dot(ST),y=Yh.dot(ST);if(y>=0&&g<=y)return n.copy(a);const _=g*c-l*y;if(_<=0&&c>=0&&y<=0)return o=c/(c-y),n.copy(i).addScaledVector(Yh,o);const v=d*y-g*f;if(v<=0&&f-d>=0&&g-y>=0)return Wz.subVectors(a,r),o=(f-d)/(f-d+(g-y)),n.copy(r).addScaledVector(Wz,o);const x=1/(v+_+m);return s=_*x,o=m*x,n.copy(i).addScaledVector(Kh,s).addScaledVector(Yh,o)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}const c7={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},du={h:0,s:0,l:0},sb={h:0,s:0,l:0};function wT(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 zt=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=Br){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,Hn.toWorkingColorSpace(this,n),this}setRGB(e,n,i,r=Hn.workingColorSpace){return this.r=e,this.g=n,this.b=i,Hn.toWorkingColorSpace(this,r),this}setHSL(e,n,i,r=Hn.workingColorSpace){if(e=ZP(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=wT(s,a,e+1/3),this.g=wT(s,a,e),this.b=wT(s,a,e-1/3)}return Hn.toWorkingColorSpace(this,r),this}setStyle(e,n=Br){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],o=r[2];switch(s){case"rgb":case"rgba":if(a=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))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(o))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(o))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=Br){const i=c7[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=Cp(e.r),this.g=Cp(e.g),this.b=Cp(e.b),this}copyLinearToSRGB(e){return this.r=dT(e.r),this.g=dT(e.g),this.b=dT(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Br){return Hn.fromWorkingColorSpace(Yr.copy(this),e),Math.round(Hr(Yr.r*255,0,255))*65536+Math.round(Hr(Yr.g*255,0,255))*256+Math.round(Hr(Yr.b*255,0,255))}getHexString(e=Br){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,n=Hn.workingColorSpace){Hn.fromWorkingColorSpace(Yr.copy(this),n);const i=Yr.r,r=Yr.g,a=Yr.b,s=Math.max(i,r,a),o=Math.min(i,r,a);let l,c;const d=(o+s)/2;if(o===s)l=0,c=0;else{const f=s-o;switch(c=d<=.5?f/(s+o):f/(2-s-o),s){case i:l=(r-a)/f+(r<a?6:0);break;case r:l=(a-i)/f+2;break;case a:l=(i-r)/f+4;break}l/=6}return e.h=l,e.s=c,e.l=d,e}getRGB(e,n=Hn.workingColorSpace){return Hn.fromWorkingColorSpace(Yr.copy(this),n),e.r=Yr.r,e.g=Yr.g,e.b=Yr.b,e}getStyle(e=Br){Hn.fromWorkingColorSpace(Yr.copy(this),e);const n=Yr.r,i=Yr.g,r=Yr.b;return e!==Br?`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(du),this.setHSL(du.h+e,du.s+n,du.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(du),e.getHSL(sb);const i=u0(du.h,sb.h,n),r=u0(du.s,sb.s,n),a=u0(du.l,sb.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 Yr=new zt;zt.NAMES=c7;let x0e=0;class gm extends Hf{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:x0e++}),this.uuid=rc(),this.name="",this.type="Material",this.blending=Tp,this.side=qu,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=h3,this.blendDst=p3,this.blendEquation=Gd,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new zt(0,0,0),this.blendAlpha=0,this.depthFunc=$_,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=kz,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=Hh,this.stencilZFail=Hh,this.stencilZPass=Hh,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!==Tp&&(i.blending=this.blending),this.side!==qu&&(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!==h3&&(i.blendSrc=this.blendSrc),this.blendDst!==p3&&(i.blendDst=this.blendDst),this.blendEquation!==Gd&&(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!==$_&&(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!==kz&&(i.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(i.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(i.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==Hh&&(i.stencilFail=this.stencilFail),this.stencilZFail!==Hh&&(i.stencilZFail=this.stencilZFail),this.stencilZPass!==Hh&&(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 o in a){const l=a[o];delete l.metadata,s.push(l)}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 u7 extends gm{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new zt(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=XP,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 Bi=new Ae,ob=new Wt;class us{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=y3,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.gpuType=Zl,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++)ob.fromBufferAttribute(this,n),ob.applyMatrix3(e),this.setXY(n,ob.x,ob.y);else if(this.itemSize===3)for(let n=0,i=this.count;n<i;n++)Bi.fromBufferAttribute(this,n),Bi.applyMatrix3(e),this.setXYZ(n,Bi.x,Bi.y,Bi.z);return this}applyMatrix4(e){for(let n=0,i=this.count;n<i;n++)Bi.fromBufferAttribute(this,n),Bi.applyMatrix4(e),this.setXYZ(n,Bi.x,Bi.y,Bi.z);return this}applyNormalMatrix(e){for(let n=0,i=this.count;n<i;n++)Bi.fromBufferAttribute(this,n),Bi.applyNormalMatrix(e),this.setXYZ(n,Bi.x,Bi.y,Bi.z);return this}transformDirection(e){for(let n=0,i=this.count;n<i;n++)Bi.fromBufferAttribute(this,n),Bi.transformDirection(e),this.setXYZ(n,Bi.x,Bi.y,Bi.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=Ho(i,this.array)),i}setComponent(e,n,i){return this.normalized&&(i=Bn(i,this.array)),this.array[e*this.itemSize+n]=i,this}getX(e){let n=this.array[e*this.itemSize];return this.normalized&&(n=Ho(n,this.array)),n}setX(e,n){return this.normalized&&(n=Bn(n,this.array)),this.array[e*this.itemSize]=n,this}getY(e){let n=this.array[e*this.itemSize+1];return this.normalized&&(n=Ho(n,this.array)),n}setY(e,n){return this.normalized&&(n=Bn(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=Ho(n,this.array)),n}setZ(e,n){return this.normalized&&(n=Bn(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=Ho(n,this.array)),n}setW(e,n){return this.normalized&&(n=Bn(n,this.array)),this.array[e*this.itemSize+3]=n,this}setXY(e,n,i){return e*=this.itemSize,this.normalized&&(n=Bn(n,this.array),i=Bn(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=Bn(n,this.array),i=Bn(i,this.array),r=Bn(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=Bn(n,this.array),i=Bn(i,this.array),r=Bn(r,this.array),a=Bn(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!==y3&&(e.usage=this.usage),e}}class d7 extends us{constructor(e,n,i){super(new Uint16Array(e),n,i)}}class f7 extends us{constructor(e,n,i){super(new Uint32Array(e),n,i)}}class ki extends us{constructor(e,n,i){super(new Float32Array(e),n,i)}}let v0e=0;const Ms=new Qn,MT=new ga,Zh=new Ae,ts=new Vs,Ig=new Vs,yr=new Ae;class ra extends Hf{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:v0e++}),this.uuid=rc(),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(r7(e)?f7:d7)(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 dn().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 Ms.makeRotationFromQuaternion(e),this.applyMatrix4(Ms),this}rotateX(e){return Ms.makeRotationX(e),this.applyMatrix4(Ms),this}rotateY(e){return Ms.makeRotationY(e),this.applyMatrix4(Ms),this}rotateZ(e){return Ms.makeRotationZ(e),this.applyMatrix4(Ms),this}translate(e,n,i){return Ms.makeTranslation(e,n,i),this.applyMatrix4(Ms),this}scale(e,n,i){return Ms.makeScale(e,n,i),this.applyMatrix4(Ms),this}lookAt(e){return MT.lookAt(e),MT.updateMatrix(),this.applyMatrix4(MT.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Zh).negate(),this.translate(Zh.x,Zh.y,Zh.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 ki(n,3)),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Vs);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 Ae(-1/0,-1/0,-1/0),new Ae(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];ts.setFromBufferAttribute(a),this.morphTargetsRelative?(yr.addVectors(this.boundingBox.min,ts.min),this.boundingBox.expandByPoint(yr),yr.addVectors(this.boundingBox.max,ts.max),this.boundingBox.expandByPoint(yr)):(this.boundingBox.expandByPoint(ts.min),this.boundingBox.expandByPoint(ts.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 qo);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 Ae,1/0);return}if(e){const i=this.boundingSphere.center;if(ts.setFromBufferAttribute(e),n)for(let a=0,s=n.length;a<s;a++){const o=n[a];Ig.setFromBufferAttribute(o),this.morphTargetsRelative?(yr.addVectors(ts.min,Ig.min),ts.expandByPoint(yr),yr.addVectors(ts.max,Ig.max),ts.expandByPoint(yr)):(ts.expandByPoint(Ig.min),ts.expandByPoint(Ig.max))}ts.getCenter(i);let r=0;for(let a=0,s=e.count;a<s;a++)yr.fromBufferAttribute(e,a),r=Math.max(r,i.distanceToSquared(yr));if(n)for(let a=0,s=n.length;a<s;a++){const o=n[a],l=this.morphTargetsRelative;for(let c=0,d=o.count;c<d;c++)yr.fromBufferAttribute(o,c),l&&(Zh.fromBufferAttribute(e,c),yr.add(Zh)),r=Math.max(r,i.distanceToSquared(yr))}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,o=r.length/3;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new us(new Float32Array(4*o),4));const l=this.getAttribute("tangent").array,c=[],d=[];for(let D=0;D<o;D++)c[D]=new Ae,d[D]=new Ae;const f=new Ae,m=new Ae,g=new Ae,y=new Wt,_=new Wt,v=new Wt,x=new Ae,M=new Ae;function w(D,F,I){f.fromArray(r,D*3),m.fromArray(r,F*3),g.fromArray(r,I*3),y.fromArray(s,D*2),_.fromArray(s,F*2),v.fromArray(s,I*2),m.sub(f),g.sub(f),_.sub(y),v.sub(y);const W=1/(_.x*v.y-v.x*_.y);isFinite(W)&&(x.copy(m).multiplyScalar(v.y).addScaledVector(g,-_.y).multiplyScalar(W),M.copy(g).multiplyScalar(_.x).addScaledVector(m,-v.x).multiplyScalar(W),c[D].add(x),c[F].add(x),c[I].add(x),d[D].add(M),d[F].add(M),d[I].add(M))}let T=this.groups;T.length===0&&(T=[{start:0,count:i.length}]);for(let D=0,F=T.length;D<F;++D){const I=T[D],W=I.start,O=I.count;for(let B=W,H=W+O;B<H;B+=3)w(i[B+0],i[B+1],i[B+2])}const C=new Ae,P=new Ae,A=new Ae,U=new Ae;function N(D){A.fromArray(a,D*3),U.copy(A);const F=c[D];C.copy(F),C.sub(A.multiplyScalar(A.dot(F))).normalize(),P.crossVectors(U,F);const W=P.dot(d[D])<0?-1:1;l[D*4]=C.x,l[D*4+1]=C.y,l[D*4+2]=C.z,l[D*4+3]=W}for(let D=0,F=T.length;D<F;++D){const I=T[D],W=I.start,O=I.count;for(let B=W,H=W+O;B<H;B+=3)N(i[B+0]),N(i[B+1]),N(i[B+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 us(new Float32Array(n.count*3),3),this.setAttribute("normal",i);else for(let m=0,g=i.count;m<g;m++)i.setXYZ(m,0,0,0);const r=new Ae,a=new Ae,s=new Ae,o=new Ae,l=new Ae,c=new Ae,d=new Ae,f=new Ae;if(e)for(let m=0,g=e.count;m<g;m+=3){const y=e.getX(m+0),_=e.getX(m+1),v=e.getX(m+2);r.fromBufferAttribute(n,y),a.fromBufferAttribute(n,_),s.fromBufferAttribute(n,v),d.subVectors(s,a),f.subVectors(r,a),d.cross(f),o.fromBufferAttribute(i,y),l.fromBufferAttribute(i,_),c.fromBufferAttribute(i,v),o.add(d),l.add(d),c.add(d),i.setXYZ(y,o.x,o.y,o.z),i.setXYZ(_,l.x,l.y,l.z),i.setXYZ(v,c.x,c.y,c.z)}else for(let m=0,g=n.count;m<g;m+=3)r.fromBufferAttribute(n,m+0),a.fromBufferAttribute(n,m+1),s.fromBufferAttribute(n,m+2),d.subVectors(s,a),f.subVectors(r,a),d.cross(f),i.setXYZ(m+0,d.x,d.y,d.z),i.setXYZ(m+1,d.x,d.y,d.z),i.setXYZ(m+2,d.x,d.y,d.z);this.normalizeNormals(),i.needsUpdate=!0}}normalizeNormals(){const e=this.attributes.normal;for(let n=0,i=e.count;n<i;n++)yr.fromBufferAttribute(e,n),yr.normalize(),e.setXYZ(n,yr.x,yr.y,yr.z)}toNonIndexed(){function e(o,l){const c=o.array,d=o.itemSize,f=o.normalized,m=new c.constructor(l.length*d);let g=0,y=0;for(let _=0,v=l.length;_<v;_++){o.isInterleavedBufferAttribute?g=l[_]*o.data.stride+o.offset:g=l[_]*d;for(let x=0;x<d;x++)m[y++]=c[g++]}return new us(m,d,f)}if(this.index===null)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const n=new ra,i=this.index.array,r=this.attributes;for(const o in r){const l=r[o],c=e(l,i);n.setAttribute(o,c)}const a=this.morphAttributes;for(const o in a){const l=[],c=a[o];for(let d=0,f=c.length;d<f;d++){const m=c[d],g=e(m,i);l.push(g)}n.morphAttributes[o]=l}n.morphTargetsRelative=this.morphTargetsRelative;const s=this.groups;for(let o=0,l=s.length;o<l;o++){const c=s[o];n.addGroup(c.start,c.count,c.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 l=this.parameters;for(const c in l)l[c]!==void 0&&(e[c]=l[c]);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 l in i){const c=i[l];e.data.attributes[l]=c.toJSON(e.data)}const r={};let a=!1;for(const l in this.morphAttributes){const c=this.morphAttributes[l],d=[];for(let f=0,m=c.length;f<m;f++){const g=c[f];d.push(g.toJSON(e.data))}d.length>0&&(r[l]=d,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 o=this.boundingSphere;return o!==null&&(e.data.boundingSphere={center:o.center.toArray(),radius:o.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 c in r){const d=r[c];this.setAttribute(c,d.clone(n))}const a=e.morphAttributes;for(const c in a){const d=[],f=a[c];for(let m=0,g=f.length;m<g;m++)d.push(f[m].clone(n));this.morphAttributes[c]=d}this.morphTargetsRelative=e.morphTargetsRelative;const s=e.groups;for(let c=0,d=s.length;c<d;c++){const f=s[c];this.addGroup(f.start,f.count,f.materialIndex)}const o=e.boundingBox;o!==null&&(this.boundingBox=o.clone());const l=e.boundingSphere;return l!==null&&(this.boundingSphere=l.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}}const qz=new Qn,Ld=new QP,lb=new qo,Xz=new Ae,Qh=new Ae,Jh=new Ae,ep=new Ae,ET=new Ae,cb=new Ae,ub=new Wt,db=new Wt,fb=new Wt,Kz=new Ae,Yz=new Ae,Zz=new Ae,hb=new Ae,pb=new Ae;class go extends ga{constructor(e=new ra,n=new u7){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 o=r[a].name||String(a);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=a}}}}getVertexPosition(e,n){const i=this.geometry,r=i.attributes.position,a=i.morphAttributes.position,s=i.morphTargetsRelative;n.fromBufferAttribute(r,e);const o=this.morphTargetInfluences;if(a&&o){cb.set(0,0,0);for(let l=0,c=a.length;l<c;l++){const d=o[l],f=a[l];d!==0&&(ET.fromBufferAttribute(f,e),s?cb.addScaledVector(ET,d):cb.addScaledVector(ET.sub(n),d))}n.add(cb)}return n}raycast(e,n){const i=this.geometry,r=this.material,a=this.matrixWorld;r!==void 0&&(i.boundingSphere===null&&i.computeBoundingSphere(),lb.copy(i.boundingSphere),lb.applyMatrix4(a),Ld.copy(e.ray).recast(e.near),!(lb.containsPoint(Ld.origin)===!1&&(Ld.intersectSphere(lb,Xz)===null||Ld.origin.distanceToSquared(Xz)>(e.far-e.near)**2))&&(qz.copy(a).invert(),Ld.copy(e.ray).applyMatrix4(qz),!(i.boundingBox!==null&&Ld.intersectsBox(i.boundingBox)===!1)&&this._computeIntersections(e,n,Ld)))}_computeIntersections(e,n,i){let r;const a=this.geometry,s=this.material,o=a.index,l=a.attributes.position,c=a.attributes.uv,d=a.attributes.uv1,f=a.attributes.normal,m=a.groups,g=a.drawRange;if(o!==null)if(Array.isArray(s))for(let y=0,_=m.length;y<_;y++){const v=m[y],x=s[v.materialIndex],M=Math.max(v.start,g.start),w=Math.min(o.count,Math.min(v.start+v.count,g.start+g.count));for(let T=M,C=w;T<C;T+=3){const P=o.getX(T),A=o.getX(T+1),U=o.getX(T+2);r=mb(this,x,e,i,c,d,f,P,A,U),r&&(r.faceIndex=Math.floor(T/3),r.face.materialIndex=v.materialIndex,n.push(r))}}else{const y=Math.max(0,g.start),_=Math.min(o.count,g.start+g.count);for(let v=y,x=_;v<x;v+=3){const M=o.getX(v),w=o.getX(v+1),T=o.getX(v+2);r=mb(this,s,e,i,c,d,f,M,w,T),r&&(r.faceIndex=Math.floor(v/3),n.push(r))}}else if(l!==void 0)if(Array.isArray(s))for(let y=0,_=m.length;y<_;y++){const v=m[y],x=s[v.materialIndex],M=Math.max(v.start,g.start),w=Math.min(l.count,Math.min(v.start+v.count,g.start+g.count));for(let T=M,C=w;T<C;T+=3){const P=T,A=T+1,U=T+2;r=mb(this,x,e,i,c,d,f,P,A,U),r&&(r.faceIndex=Math.floor(T/3),r.face.materialIndex=v.materialIndex,n.push(r))}}else{const y=Math.max(0,g.start),_=Math.min(l.count,g.start+g.count);for(let v=y,x=_;v<x;v+=3){const M=v,w=v+1,T=v+2;r=mb(this,s,e,i,c,d,f,M,w,T),r&&(r.faceIndex=Math.floor(v/3),n.push(r))}}}}function y0e(t,e,n,i,r,a,s,o){let l;if(e.side===Ua?l=i.intersectTriangle(s,a,r,!0,o):l=i.intersectTriangle(r,a,s,e.side===qu,o),l===null)return null;pb.copy(o),pb.applyMatrix4(t.matrixWorld);const c=n.ray.origin.distanceTo(pb);return c<n.near||c>n.far?null:{distance:c,point:pb.clone(),object:t}}function mb(t,e,n,i,r,a,s,o,l,c){t.getVertexPosition(o,Qh),t.getVertexPosition(l,Jh),t.getVertexPosition(c,ep);const d=y0e(t,e,n,i,Qh,Jh,ep,hb);if(d){r&&(ub.fromBufferAttribute(r,o),db.fromBufferAttribute(r,l),fb.fromBufferAttribute(r,c),d.uv=lo.getInterpolation(hb,Qh,Jh,ep,ub,db,fb,new Wt)),a&&(ub.fromBufferAttribute(a,o),db.fromBufferAttribute(a,l),fb.fromBufferAttribute(a,c),d.uv1=lo.getInterpolation(hb,Qh,Jh,ep,ub,db,fb,new Wt),d.uv2=d.uv1),s&&(Kz.fromBufferAttribute(s,o),Yz.fromBufferAttribute(s,l),Zz.fromBufferAttribute(s,c),d.normal=lo.getInterpolation(hb,Qh,Jh,ep,Kz,Yz,Zz,new Ae),d.normal.dot(i.direction)>0&&d.normal.multiplyScalar(-1));const f={a:o,b:l,c,normal:new Ae,materialIndex:0};lo.getNormal(Qh,Jh,ep,f.normal),d.face=f}return d}class kx extends ra{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 o=this;r=Math.floor(r),a=Math.floor(a),s=Math.floor(s);const l=[],c=[],d=[],f=[];let m=0,g=0;y("z","y","x",-1,-1,i,n,e,s,a,0),y("z","y","x",1,-1,i,n,-e,s,a,1),y("x","z","y",1,1,e,i,n,r,s,2),y("x","z","y",1,-1,e,i,-n,r,s,3),y("x","y","z",1,-1,e,n,i,r,a,4),y("x","y","z",-1,-1,e,n,-i,r,a,5),this.setIndex(l),this.setAttribute("position",new ki(c,3)),this.setAttribute("normal",new ki(d,3)),this.setAttribute("uv",new ki(f,2));function y(_,v,x,M,w,T,C,P,A,U,N){const D=T/A,F=C/U,I=T/2,W=C/2,O=P/2,B=A+1,H=U+1;let $=0,K=0;const Z=new Ae;for(let se=0;se<H;se++){const V=se*F-W;for(let X=0;X<B;X++){const ae=X*D-I;Z[_]=ae*M,Z[v]=V*w,Z[x]=O,c.push(Z.x,Z.y,Z.z),Z[_]=0,Z[v]=0,Z[x]=P>0?1:-1,d.push(Z.x,Z.y,Z.z),f.push(X/A),f.push(1-se/U),$+=1}}for(let se=0;se<U;se++)for(let V=0;V<A;V++){const X=m+V+B*se,ae=m+V+B*(se+1),ce=m+(V+1)+B*(se+1),ge=m+(V+1)+B*se;l.push(X,ae,ge),l.push(ae,ce,ge),K+=6}o.addGroup(g,K,N),g+=K,m+=$}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new kx(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}function Gp(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 ua(t){const e={};for(let n=0;n<t.length;n++){const i=Gp(t[n]);for(const r in i)e[r]=i[r]}return e}function b0e(t){const e=[];for(let n=0;n<t.length;n++)e.push(t[n].clone());return e}function h7(t){return t.getRenderTarget()===null?t.outputColorSpace:Hn.workingColorSpace}const JP={clone:Gp,merge:ua};var _0e=`void main() {
  3840. gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
  3841. }`,S0e=`void main() {
  3842. gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
  3843. }`;class Xu extends gm{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=_0e,this.fragmentShader=S0e,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=Gp(e.uniforms),this.uniformsGroups=b0e(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 p7 extends ga{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new Qn,this.projectionMatrix=new Qn,this.projectionMatrixInverse=new Qn,this.coordinateSystem=Go}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 rs extends p7{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=X0*2*Math.atan(n),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(c0*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return X0*2*Math.atan(Math.tan(c0*.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(c0*.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 l=s.fullWidth,c=s.fullHeight;a+=s.offsetX*r/l,n-=s.offsetY*i/c,r*=s.width/l,i*=s.height/c}const o=this.filmOffset;o!==0&&(a+=e*o/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 tp=-90,np=1;class w0e extends ga{constructor(e,n,i){super(),this.type="CubeCamera",this.renderTarget=i,this.coordinateSystem=null,this.activeMipmapLevel=0;const r=new rs(tp,np,e,n);r.layers=this.layers,this.add(r);const a=new rs(tp,np,e,n);a.layers=this.layers,this.add(a);const s=new rs(tp,np,e,n);s.layers=this.layers,this.add(s);const o=new rs(tp,np,e,n);o.layers=this.layers,this.add(o);const l=new rs(tp,np,e,n);l.layers=this.layers,this.add(l);const c=new rs(tp,np,e,n);c.layers=this.layers,this.add(c)}updateCoordinateSystem(){const e=this.coordinateSystem,n=this.children.concat(),[i,r,a,s,o,l]=n;for(const c of n)this.remove(c);if(e===Go)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),o.up.set(0,1,0),o.lookAt(0,0,1),l.up.set(0,1,0),l.lookAt(0,0,-1);else if(e===q0)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),o.up.set(0,-1,0),o.lookAt(0,0,1),l.up.set(0,-1,0),l.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(const c of n)this.add(c),c.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,o,l,c,d]=this.children,f=e.getRenderTarget(),m=e.getActiveCubeFace(),g=e.getActiveMipmapLevel(),y=e.xr.enabled;e.xr.enabled=!1;const _=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,o),e.setRenderTarget(i,3,r),e.render(n,l),e.setRenderTarget(i,4,r),e.render(n,c),i.texture.generateMipmaps=_,e.setRenderTarget(i,5,r),e.render(n,d),e.setRenderTarget(f,m,g),e.xr.enabled=y,i.texture.needsPMREMUpdate=!0}}class m7 extends ja{constructor(e,n,i,r,a,s,o,l,c,d){e=e!==void 0?e:[],n=n!==void 0?n:Hp,super(e,n,i,r,a,s,o,l,c,d),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class M0e extends Af{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&&(d0("THREE.WebGLCubeRenderTarget: option.encoding has been replaced by option.colorSpace."),n.colorSpace=n.encoding===of?Br:js),this.texture=new m7(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:Is}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 kx(5,5,5),a=new Xu({name:"CubemapFromEquirect",uniforms:Gp(i.uniforms),vertexShader:i.vertexShader,fragmentShader:i.fragmentShader,side:Ua,blending:Iu});a.uniforms.tEquirect.value=n;const s=new go(r,a),o=n.minFilter;return n.minFilter===G0&&(n.minFilter=Is),new w0e(1,10,this).update(e,s),n.minFilter=o,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 AT=new Ae,E0e=new Ae,A0e=new dn;class xu{constructor(e=new Ae(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=AT.subVectors(i,n).cross(E0e.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(AT),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||A0e.getNormalMatrix(e),r=this.coplanarPoint(AT).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 Id=new qo,gb=new Ae;class ZS{constructor(e=new xu,n=new xu,i=new xu,r=new xu,a=new xu,s=new xu){this.planes=[e,n,i,r,a,s]}set(e,n,i,r,a,s){const o=this.planes;return o[0].copy(e),o[1].copy(n),o[2].copy(i),o[3].copy(r),o[4].copy(a),o[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=Go){const i=this.planes,r=e.elements,a=r[0],s=r[1],o=r[2],l=r[3],c=r[4],d=r[5],f=r[6],m=r[7],g=r[8],y=r[9],_=r[10],v=r[11],x=r[12],M=r[13],w=r[14],T=r[15];if(i[0].setComponents(l-a,m-c,v-g,T-x).normalize(),i[1].setComponents(l+a,m+c,v+g,T+x).normalize(),i[2].setComponents(l+s,m+d,v+y,T+M).normalize(),i[3].setComponents(l-s,m-d,v-y,T-M).normalize(),i[4].setComponents(l-o,m-f,v-_,T-w).normalize(),n===Go)i[5].setComponents(l+o,m+f,v+_,T+w).normalize();else if(n===q0)i[5].setComponents(o,f,_,w).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(),Id.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const n=e.geometry;n.boundingSphere===null&&n.computeBoundingSphere(),Id.copy(n.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(Id)}intersectsSprite(e){return Id.center.set(0,0,0),Id.radius=.7071067811865476,Id.applyMatrix4(e.matrixWorld),this.intersectsSphere(Id)}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(gb.x=r.normal.x>0?e.max.x:e.min.x,gb.y=r.normal.y>0?e.max.y:e.min.y,gb.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(gb)<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 g7(){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 T0e(t,e){const n=e.isWebGL2,i=new WeakMap;function r(c,d){const f=c.array,m=c.usage,g=f.byteLength,y=t.createBuffer();t.bindBuffer(d,y),t.bufferData(d,f,m),c.onUploadCallback();let _;if(f instanceof Float32Array)_=t.FLOAT;else if(f instanceof Uint16Array)if(c.isFloat16BufferAttribute)if(n)_=t.HALF_FLOAT;else throw new Error("THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2.");else _=t.UNSIGNED_SHORT;else if(f instanceof Int16Array)_=t.SHORT;else if(f instanceof Uint32Array)_=t.UNSIGNED_INT;else if(f instanceof Int32Array)_=t.INT;else if(f instanceof Int8Array)_=t.BYTE;else if(f instanceof Uint8Array)_=t.UNSIGNED_BYTE;else if(f instanceof Uint8ClampedArray)_=t.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+f);return{buffer:y,type:_,bytesPerElement:f.BYTES_PER_ELEMENT,version:c.version,size:g}}function a(c,d,f){const m=d.array,g=d._updateRange,y=d.updateRanges;if(t.bindBuffer(f,c),g.count===-1&&y.length===0&&t.bufferSubData(f,0,m),y.length!==0){for(let _=0,v=y.length;_<v;_++){const x=y[_];n?t.bufferSubData(f,x.start*m.BYTES_PER_ELEMENT,m,x.start,x.count):t.bufferSubData(f,x.start*m.BYTES_PER_ELEMENT,m.subarray(x.start,x.start+x.count))}d.clearUpdateRanges()}g.count!==-1&&(n?t.bufferSubData(f,g.offset*m.BYTES_PER_ELEMENT,m,g.offset,g.count):t.bufferSubData(f,g.offset*m.BYTES_PER_ELEMENT,m.subarray(g.offset,g.offset+g.count)),g.count=-1),d.onUploadCallback()}function s(c){return c.isInterleavedBufferAttribute&&(c=c.data),i.get(c)}function o(c){c.isInterleavedBufferAttribute&&(c=c.data);const d=i.get(c);d&&(t.deleteBuffer(d.buffer),i.delete(c))}function l(c,d){if(c.isGLBufferAttribute){const m=i.get(c);(!m||m.version<c.version)&&i.set(c,{buffer:c.buffer,type:c.type,bytesPerElement:c.elementSize,version:c.version});return}c.isInterleavedBufferAttribute&&(c=c.data);const f=i.get(c);if(f===void 0)i.set(c,r(c,d));else if(f.version<c.version){if(f.size!==c.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(f.buffer,c,d),f.version=c.version}}return{get:s,remove:o,update:l}}class eD extends ra{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,o=Math.floor(i),l=Math.floor(r),c=o+1,d=l+1,f=e/o,m=n/l,g=[],y=[],_=[],v=[];for(let x=0;x<d;x++){const M=x*m-s;for(let w=0;w<c;w++){const T=w*f-a;y.push(T,-M,0),_.push(0,0,1),v.push(w/o),v.push(1-x/l)}}for(let x=0;x<l;x++)for(let M=0;M<o;M++){const w=M+c*x,T=M+c*(x+1),C=M+1+c*(x+1),P=M+1+c*x;g.push(w,T,P),g.push(T,C,P)}this.setIndex(g),this.setAttribute("position",new ki(y,3)),this.setAttribute("normal",new ki(_,3)),this.setAttribute("uv",new ki(v,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new eD(e.width,e.height,e.widthSegments,e.heightSegments)}}var C0e=`#ifdef USE_ALPHAHASH
  3863. if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;
  3864. #endif`,N0e=`#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`,R0e=`#ifdef USE_ALPHAMAP
  3900. diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;
  3901. #endif`,P0e=`#ifdef USE_ALPHAMAP
  3902. uniform sampler2D alphaMap;
  3903. #endif`,D0e=`#ifdef USE_ALPHATEST
  3904. if ( diffuseColor.a < alphaTest ) discard;
  3905. #endif`,k0e=`#ifdef USE_ALPHATEST
  3906. uniform float alphaTest;
  3907. #endif`,O0e=`#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`,L0e=`#ifdef USE_AOMAP
  3921. uniform sampler2D aoMap;
  3922. uniform float aoMapIntensity;
  3923. #endif`,I0e=`#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`,U0e=`#ifdef USE_BATCHING
  3938. mat4 batchingMatrix = getBatchingMatrix( batchId );
  3939. #endif`,j0e=`vec3 transformed = vec3( position );
  3940. #ifdef USE_ALPHAHASH
  3941. vPosition = vec3( position );
  3942. #endif`,F0e=`vec3 objectNormal = vec3( normal );
  3943. #ifdef USE_TANGENT
  3944. vec3 objectTangent = vec3( tangent.xyz );
  3945. #endif`,z0e=`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`,B0e=`#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`,H0e=`#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`,V0e=`#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`,$0e=`#if NUM_CLIPPING_PLANES > 0
  4062. varying vec3 vClipPosition;
  4063. uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];
  4064. #endif`,G0e=`#if NUM_CLIPPING_PLANES > 0
  4065. varying vec3 vClipPosition;
  4066. #endif`,W0e=`#if NUM_CLIPPING_PLANES > 0
  4067. vClipPosition = - mvPosition.xyz;
  4068. #endif`,q0e=`#if defined( USE_COLOR_ALPHA )
  4069. diffuseColor *= vColor;
  4070. #elif defined( USE_COLOR )
  4071. diffuseColor.rgb *= vColor;
  4072. #endif`,X0e=`#if defined( USE_COLOR_ALPHA )
  4073. varying vec4 vColor;
  4074. #elif defined( USE_COLOR )
  4075. varying vec3 vColor;
  4076. #endif`,K0e=`#if defined( USE_COLOR_ALPHA )
  4077. varying vec4 vColor;
  4078. #elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )
  4079. varying vec3 vColor;
  4080. #endif`,Y0e=`#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`,Z0e=`#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`,Q0e=`#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`,J0e=`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`,exe=`#ifdef USE_DISPLACEMENTMAP
  4296. uniform sampler2D displacementMap;
  4297. uniform float displacementScale;
  4298. uniform float displacementBias;
  4299. #endif`,txe=`#ifdef USE_DISPLACEMENTMAP
  4300. transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );
  4301. #endif`,nxe=`#ifdef USE_EMISSIVEMAP
  4302. vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );
  4303. totalEmissiveRadiance *= emissiveColor.rgb;
  4304. #endif`,ixe=`#ifdef USE_EMISSIVEMAP
  4305. uniform sampler2D emissiveMap;
  4306. #endif`,rxe="gl_FragColor = linearToOutputTexel( gl_FragColor );",axe=`
  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. }`,sxe=`#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`,oxe=`#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`,lxe=`#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`,cxe=`#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`,uxe=`#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`,dxe=`#ifdef USE_FOG
  4410. vFogDepth = - mvPosition.z;
  4411. #endif`,fxe=`#ifdef USE_FOG
  4412. varying float vFogDepth;
  4413. #endif`,hxe=`#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`,pxe=`#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`,mxe=`#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. }`,gxe=`#ifdef USE_LIGHTMAP
  4442. vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
  4443. vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;
  4444. reflectedLight.indirectDiffuse += lightMapIrradiance;
  4445. #endif`,xxe=`#ifdef USE_LIGHTMAP
  4446. uniform sampler2D lightMap;
  4447. uniform float lightMapIntensity;
  4448. #endif`,vxe=`LambertMaterial material;
  4449. material.diffuseColor = diffuseColor.rgb;
  4450. material.specularStrength = specularStrength;`,yxe=`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`,bxe=`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`,_xe=`#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`,Sxe=`ToonMaterial material;
  4621. material.diffuseColor = diffuseColor.rgb;`,wxe=`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`,Mxe=`BlinnPhongMaterial material;
  4634. material.diffuseColor = diffuseColor.rgb;
  4635. material.specularColor = specular;
  4636. material.specularShininess = shininess;
  4637. material.specularStrength = specularStrength;`,Exe=`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`,Axe=`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`,Txe=`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. }`,Cxe=`
  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`,Nxe=`#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`,Rxe=`#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`,Pxe=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )
  5177. gl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;
  5178. #endif`,Dxe=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )
  5179. uniform float logDepthBufFC;
  5180. varying float vFragDepth;
  5181. varying float vIsPerspective;
  5182. #endif`,kxe=`#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`,Oxe=`#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`,Lxe=`#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`,Ixe=`#ifdef USE_MAP
  5206. uniform sampler2D map;
  5207. #endif`,Uxe=`#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`,jxe=`#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`,Fxe=`float metalnessFactor = metalness;
  5232. #ifdef USE_METALNESSMAP
  5233. vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );
  5234. metalnessFactor *= texelMetalness.b;
  5235. #endif`,zxe=`#ifdef USE_METALNESSMAP
  5236. uniform sampler2D metalnessMap;
  5237. #endif`,Bxe=`#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`,Hxe=`#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`,Vxe=`#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`,$xe=`#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`,Gxe=`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;`,Wxe=`#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`,qxe=`#ifndef FLAT_SHADED
  5353. varying vec3 vNormal;
  5354. #ifdef USE_TANGENT
  5355. varying vec3 vTangent;
  5356. varying vec3 vBitangent;
  5357. #endif
  5358. #endif`,Xxe=`#ifndef FLAT_SHADED
  5359. varying vec3 vNormal;
  5360. #ifdef USE_TANGENT
  5361. varying vec3 vTangent;
  5362. varying vec3 vBitangent;
  5363. #endif
  5364. #endif`,Kxe=`#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`,Yxe=`#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`,Zxe=`#ifdef USE_CLEARCOAT
  5393. vec3 clearcoatNormal = nonPerturbedNormal;
  5394. #endif`,Qxe=`#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`,Jxe=`#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`,eve=`#ifdef USE_IRIDESCENCEMAP
  5408. uniform sampler2D iridescenceMap;
  5409. #endif
  5410. #ifdef USE_IRIDESCENCE_THICKNESSMAP
  5411. uniform sampler2D iridescenceThicknessMap;
  5412. #endif`,tve=`#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 );`,nve=`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. }`,ive=`#ifdef PREMULTIPLIED_ALPHA
  5460. gl_FragColor.rgb *= gl_FragColor.a;
  5461. #endif`,rve=`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;`,ave=`#ifdef DITHERING
  5470. gl_FragColor.rgb = dithering( gl_FragColor.rgb );
  5471. #endif`,sve=`#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`,ove=`float roughnessFactor = roughness;
  5479. #ifdef USE_ROUGHNESSMAP
  5480. vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );
  5481. roughnessFactor *= texelRoughness.g;
  5482. #endif`,lve=`#ifdef USE_ROUGHNESSMAP
  5483. uniform sampler2D roughnessMap;
  5484. #endif`,cve=`#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`,uve=`#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`,dve=`#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`,fve=`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. }`,hve=`#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`,pve=`#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`,mve=`#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`,gve=`#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`,xve=`float specularStrength;
  5803. #ifdef USE_SPECULARMAP
  5804. vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );
  5805. specularStrength = texelSpecular.r;
  5806. #else
  5807. specularStrength = 1.0;
  5808. #endif`,vve=`#ifdef USE_SPECULARMAP
  5809. uniform sampler2D specularMap;
  5810. #endif`,yve=`#if defined( TONE_MAPPING )
  5811. gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );
  5812. #endif`,bve=`#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; }`,_ve=`#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`,Sve=`#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`,wve=`#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`,Mve=`#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`,Eve=`#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`,Ave=`#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 Tve=`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. }`,Cve=`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. }`,Nve=`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. }`,Rve=`#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. }`,Pve=`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. }`,Dve=`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. }`,kve=`#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. }`,Ove=`#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. }`,Lve=`#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. }`,Ive=`#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. }`,Uve=`varying vec3 vWorldDirection;
  6389. #include <common>
  6390. void main() {
  6391. vWorldDirection = transformDirection( position, modelMatrix );
  6392. #include <begin_vertex>
  6393. #include <project_vertex>
  6394. }`,jve=`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. }`,Fve=`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. }`,zve=`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. }`,Bve=`#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. }`,Hve=`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. }`,Vve=`#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. }`,$ve=`#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. }`,Gve=`#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. }`,Wve=`#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. }`,qve=`#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. }`,Xve=`#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. }`,Kve=`#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. }`,Yve=`#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. }`,Zve=`#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. }`,Qve=`#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. }`,Jve=`#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. }`,eye=`#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. }`,tye=`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. }`,nye=`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. }`,iye=`#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. }`,rye=`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. }`,aye=`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. }`,sye=`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. }`,rn={alphahash_fragment:C0e,alphahash_pars_fragment:N0e,alphamap_fragment:R0e,alphamap_pars_fragment:P0e,alphatest_fragment:D0e,alphatest_pars_fragment:k0e,aomap_fragment:O0e,aomap_pars_fragment:L0e,batching_pars_vertex:I0e,batching_vertex:U0e,begin_vertex:j0e,beginnormal_vertex:F0e,bsdfs:z0e,iridescence_fragment:B0e,bumpmap_pars_fragment:H0e,clipping_planes_fragment:V0e,clipping_planes_pars_fragment:$0e,clipping_planes_pars_vertex:G0e,clipping_planes_vertex:W0e,color_fragment:q0e,color_pars_fragment:X0e,color_pars_vertex:K0e,color_vertex:Y0e,common:Z0e,cube_uv_reflection_fragment:Q0e,defaultnormal_vertex:J0e,displacementmap_pars_vertex:exe,displacementmap_vertex:txe,emissivemap_fragment:nxe,emissivemap_pars_fragment:ixe,colorspace_fragment:rxe,colorspace_pars_fragment:axe,envmap_fragment:sxe,envmap_common_pars_fragment:oxe,envmap_pars_fragment:lxe,envmap_pars_vertex:cxe,envmap_physical_pars_fragment:_xe,envmap_vertex:uxe,fog_vertex:dxe,fog_pars_vertex:fxe,fog_fragment:hxe,fog_pars_fragment:pxe,gradientmap_pars_fragment:mxe,lightmap_fragment:gxe,lightmap_pars_fragment:xxe,lights_lambert_fragment:vxe,lights_lambert_pars_fragment:yxe,lights_pars_begin:bxe,lights_toon_fragment:Sxe,lights_toon_pars_fragment:wxe,lights_phong_fragment:Mxe,lights_phong_pars_fragment:Exe,lights_physical_fragment:Axe,lights_physical_pars_fragment:Txe,lights_fragment_begin:Cxe,lights_fragment_maps:Nxe,lights_fragment_end:Rxe,logdepthbuf_fragment:Pxe,logdepthbuf_pars_fragment:Dxe,logdepthbuf_pars_vertex:kxe,logdepthbuf_vertex:Oxe,map_fragment:Lxe,map_pars_fragment:Ixe,map_particle_fragment:Uxe,map_particle_pars_fragment:jxe,metalnessmap_fragment:Fxe,metalnessmap_pars_fragment:zxe,morphcolor_vertex:Bxe,morphnormal_vertex:Hxe,morphtarget_pars_vertex:Vxe,morphtarget_vertex:$xe,normal_fragment_begin:Gxe,normal_fragment_maps:Wxe,normal_pars_fragment:qxe,normal_pars_vertex:Xxe,normal_vertex:Kxe,normalmap_pars_fragment:Yxe,clearcoat_normal_fragment_begin:Zxe,clearcoat_normal_fragment_maps:Qxe,clearcoat_pars_fragment:Jxe,iridescence_pars_fragment:eve,opaque_fragment:tve,packing:nve,premultiplied_alpha_fragment:ive,project_vertex:rve,dithering_fragment:ave,dithering_pars_fragment:sve,roughnessmap_fragment:ove,roughnessmap_pars_fragment:lve,shadowmap_pars_fragment:cve,shadowmap_pars_vertex:uve,shadowmap_vertex:dve,shadowmask_pars_fragment:fve,skinbase_vertex:hve,skinning_pars_vertex:pve,skinning_vertex:mve,skinnormal_vertex:gve,specularmap_fragment:xve,specularmap_pars_fragment:vve,tonemapping_fragment:yve,tonemapping_pars_fragment:bve,transmission_fragment:_ve,transmission_pars_fragment:Sve,uv_pars_fragment:wve,uv_pars_vertex:Mve,uv_vertex:Eve,worldpos_vertex:Ave,background_vert:Tve,background_frag:Cve,backgroundCube_vert:Nve,backgroundCube_frag:Rve,cube_vert:Pve,cube_frag:Dve,depth_vert:kve,depth_frag:Ove,distanceRGBA_vert:Lve,distanceRGBA_frag:Ive,equirect_vert:Uve,equirect_frag:jve,linedashed_vert:Fve,linedashed_frag:zve,meshbasic_vert:Bve,meshbasic_frag:Hve,meshlambert_vert:Vve,meshlambert_frag:$ve,meshmatcap_vert:Gve,meshmatcap_frag:Wve,meshnormal_vert:qve,meshnormal_frag:Xve,meshphong_vert:Kve,meshphong_frag:Yve,meshphysical_vert:Zve,meshphysical_frag:Qve,meshtoon_vert:Jve,meshtoon_frag:eye,points_vert:tye,points_frag:nye,shadow_vert:iye,shadow_frag:rye,sprite_vert:aye,sprite_frag:sye},yt={common:{diffuse:{value:new zt(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new dn},alphaMap:{value:null},alphaMapTransform:{value:new dn},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new dn}},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 dn}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new dn}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new dn},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new dn},normalScale:{value:new Wt(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new dn},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new dn}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new dn}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new dn}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new zt(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 zt(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new dn},alphaTest:{value:0},uvTransform:{value:new dn}},sprite:{diffuse:{value:new zt(16777215)},opacity:{value:1},center:{value:new Wt(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new dn},alphaMap:{value:null},alphaMapTransform:{value:new dn},alphaTest:{value:0}}},ka={basic:{uniforms:ua([yt.common,yt.specularmap,yt.envmap,yt.aomap,yt.lightmap,yt.fog]),vertexShader:rn.meshbasic_vert,fragmentShader:rn.meshbasic_frag},lambert:{uniforms:ua([yt.common,yt.specularmap,yt.envmap,yt.aomap,yt.lightmap,yt.emissivemap,yt.bumpmap,yt.normalmap,yt.displacementmap,yt.fog,yt.lights,{emissive:{value:new zt(0)}}]),vertexShader:rn.meshlambert_vert,fragmentShader:rn.meshlambert_frag},phong:{uniforms:ua([yt.common,yt.specularmap,yt.envmap,yt.aomap,yt.lightmap,yt.emissivemap,yt.bumpmap,yt.normalmap,yt.displacementmap,yt.fog,yt.lights,{emissive:{value:new zt(0)},specular:{value:new zt(1118481)},shininess:{value:30}}]),vertexShader:rn.meshphong_vert,fragmentShader:rn.meshphong_frag},standard:{uniforms:ua([yt.common,yt.envmap,yt.aomap,yt.lightmap,yt.emissivemap,yt.bumpmap,yt.normalmap,yt.displacementmap,yt.roughnessmap,yt.metalnessmap,yt.fog,yt.lights,{emissive:{value:new zt(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:rn.meshphysical_vert,fragmentShader:rn.meshphysical_frag},toon:{uniforms:ua([yt.common,yt.aomap,yt.lightmap,yt.emissivemap,yt.bumpmap,yt.normalmap,yt.displacementmap,yt.gradientmap,yt.fog,yt.lights,{emissive:{value:new zt(0)}}]),vertexShader:rn.meshtoon_vert,fragmentShader:rn.meshtoon_frag},matcap:{uniforms:ua([yt.common,yt.bumpmap,yt.normalmap,yt.displacementmap,yt.fog,{matcap:{value:null}}]),vertexShader:rn.meshmatcap_vert,fragmentShader:rn.meshmatcap_frag},points:{uniforms:ua([yt.points,yt.fog]),vertexShader:rn.points_vert,fragmentShader:rn.points_frag},dashed:{uniforms:ua([yt.common,yt.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:rn.linedashed_vert,fragmentShader:rn.linedashed_frag},depth:{uniforms:ua([yt.common,yt.displacementmap]),vertexShader:rn.depth_vert,fragmentShader:rn.depth_frag},normal:{uniforms:ua([yt.common,yt.bumpmap,yt.normalmap,yt.displacementmap,{opacity:{value:1}}]),vertexShader:rn.meshnormal_vert,fragmentShader:rn.meshnormal_frag},sprite:{uniforms:ua([yt.sprite,yt.fog]),vertexShader:rn.sprite_vert,fragmentShader:rn.sprite_frag},background:{uniforms:{uvTransform:{value:new dn},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:rn.background_vert,fragmentShader:rn.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1}},vertexShader:rn.backgroundCube_vert,fragmentShader:rn.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:rn.cube_vert,fragmentShader:rn.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:rn.equirect_vert,fragmentShader:rn.equirect_frag},distanceRGBA:{uniforms:ua([yt.common,yt.displacementmap,{referencePosition:{value:new Ae},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:rn.distanceRGBA_vert,fragmentShader:rn.distanceRGBA_frag},shadow:{uniforms:ua([yt.lights,yt.fog,{color:{value:new zt(0)},opacity:{value:1}}]),vertexShader:rn.shadow_vert,fragmentShader:rn.shadow_frag}};ka.physical={uniforms:ua([ka.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new dn},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new dn},clearcoatNormalScale:{value:new Wt(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new dn},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new dn},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new dn},sheen:{value:0},sheenColor:{value:new zt(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new dn},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new dn},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new dn},transmissionSamplerSize:{value:new Wt},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new dn},attenuationDistance:{value:0},attenuationColor:{value:new zt(0)},specularColor:{value:new zt(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new dn},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new dn},anisotropyVector:{value:new Wt},anisotropyMap:{value:null},anisotropyMapTransform:{value:new dn}}]),vertexShader:rn.meshphysical_vert,fragmentShader:rn.meshphysical_frag};const xb={r:0,b:0,g:0};function oye(t,e,n,i,r,a,s){const o=new zt(0);let l=a===!0?0:1,c,d,f=null,m=0,g=null;function y(v,x){let M=!1,w=x.isScene===!0?x.background:null;w&&w.isTexture&&(w=(x.backgroundBlurriness>0?n:e).get(w)),w===null?_(o,l):w&&w.isColor&&(_(w,1),M=!0);const T=t.xr.getEnvironmentBlendMode();T==="additive"?i.buffers.color.setClear(0,0,0,1,s):T==="alpha-blend"&&i.buffers.color.setClear(0,0,0,0,s),(t.autoClear||M)&&t.clear(t.autoClearColor,t.autoClearDepth,t.autoClearStencil),w&&(w.isCubeTexture||w.mapping===KS)?(d===void 0&&(d=new go(new kx(1,1,1),new Xu({name:"BackgroundCubeMaterial",uniforms:Gp(ka.backgroundCube.uniforms),vertexShader:ka.backgroundCube.vertexShader,fragmentShader:ka.backgroundCube.fragmentShader,side:Ua,depthTest:!1,depthWrite:!1,fog:!1})),d.geometry.deleteAttribute("normal"),d.geometry.deleteAttribute("uv"),d.onBeforeRender=function(C,P,A){this.matrixWorld.copyPosition(A.matrixWorld)},Object.defineProperty(d.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),r.update(d)),d.material.uniforms.envMap.value=w,d.material.uniforms.flipEnvMap.value=w.isCubeTexture&&w.isRenderTargetTexture===!1?-1:1,d.material.uniforms.backgroundBlurriness.value=x.backgroundBlurriness,d.material.uniforms.backgroundIntensity.value=x.backgroundIntensity,d.material.toneMapped=Hn.getTransfer(w.colorSpace)!==ii,(f!==w||m!==w.version||g!==t.toneMapping)&&(d.material.needsUpdate=!0,f=w,m=w.version,g=t.toneMapping),d.layers.enableAll(),v.unshift(d,d.geometry,d.material,0,0,null)):w&&w.isTexture&&(c===void 0&&(c=new go(new eD(2,2),new Xu({name:"BackgroundMaterial",uniforms:Gp(ka.background.uniforms),vertexShader:ka.background.vertexShader,fragmentShader:ka.background.fragmentShader,side:qu,depthTest:!1,depthWrite:!1,fog:!1})),c.geometry.deleteAttribute("normal"),Object.defineProperty(c.material,"map",{get:function(){return this.uniforms.t2D.value}}),r.update(c)),c.material.uniforms.t2D.value=w,c.material.uniforms.backgroundIntensity.value=x.backgroundIntensity,c.material.toneMapped=Hn.getTransfer(w.colorSpace)!==ii,w.matrixAutoUpdate===!0&&w.updateMatrix(),c.material.uniforms.uvTransform.value.copy(w.matrix),(f!==w||m!==w.version||g!==t.toneMapping)&&(c.material.needsUpdate=!0,f=w,m=w.version,g=t.toneMapping),c.layers.enableAll(),v.unshift(c,c.geometry,c.material,0,0,null))}function _(v,x){v.getRGB(xb,h7(t)),i.buffers.color.setClear(xb.r,xb.g,xb.b,x,s)}return{getClearColor:function(){return o},setClearColor:function(v,x=1){o.set(v),l=x,_(o,l)},getClearAlpha:function(){return l},setClearAlpha:function(v){l=v,_(o,l)},render:y}}function lye(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,o={},l=v(null);let c=l,d=!1;function f(O,B,H,$,K){let Z=!1;if(s){const se=_($,H,B);c!==se&&(c=se,g(c.object)),Z=x(O,$,H,K),Z&&M(O,$,H,K)}else{const se=B.wireframe===!0;(c.geometry!==$.id||c.program!==H.id||c.wireframe!==se)&&(c.geometry=$.id,c.program=H.id,c.wireframe=se,Z=!0)}K!==null&&n.update(K,t.ELEMENT_ARRAY_BUFFER),(Z||d)&&(d=!1,U(O,B,H,$),K!==null&&t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,n.get(K).buffer))}function m(){return i.isWebGL2?t.createVertexArray():a.createVertexArrayOES()}function g(O){return i.isWebGL2?t.bindVertexArray(O):a.bindVertexArrayOES(O)}function y(O){return i.isWebGL2?t.deleteVertexArray(O):a.deleteVertexArrayOES(O)}function _(O,B,H){const $=H.wireframe===!0;let K=o[O.id];K===void 0&&(K={},o[O.id]=K);let Z=K[B.id];Z===void 0&&(Z={},K[B.id]=Z);let se=Z[$];return se===void 0&&(se=v(m()),Z[$]=se),se}function v(O){const B=[],H=[],$=[];for(let K=0;K<r;K++)B[K]=0,H[K]=0,$[K]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:B,enabledAttributes:H,attributeDivisors:$,object:O,attributes:{},index:null}}function x(O,B,H,$){const K=c.attributes,Z=B.attributes;let se=0;const V=H.getAttributes();for(const X in V)if(V[X].location>=0){const ce=K[X];let ge=Z[X];if(ge===void 0&&(X==="instanceMatrix"&&O.instanceMatrix&&(ge=O.instanceMatrix),X==="instanceColor"&&O.instanceColor&&(ge=O.instanceColor)),ce===void 0||ce.attribute!==ge||ge&&ce.data!==ge.data)return!0;se++}return c.attributesNum!==se||c.index!==$}function M(O,B,H,$){const K={},Z=B.attributes;let se=0;const V=H.getAttributes();for(const X in V)if(V[X].location>=0){let ce=Z[X];ce===void 0&&(X==="instanceMatrix"&&O.instanceMatrix&&(ce=O.instanceMatrix),X==="instanceColor"&&O.instanceColor&&(ce=O.instanceColor));const ge={};ge.attribute=ce,ce&&ce.data&&(ge.data=ce.data),K[X]=ge,se++}c.attributes=K,c.attributesNum=se,c.index=$}function w(){const O=c.newAttributes;for(let B=0,H=O.length;B<H;B++)O[B]=0}function T(O){C(O,0)}function C(O,B){const H=c.newAttributes,$=c.enabledAttributes,K=c.attributeDivisors;H[O]=1,$[O]===0&&(t.enableVertexAttribArray(O),$[O]=1),K[O]!==B&&((i.isWebGL2?t:e.get("ANGLE_instanced_arrays"))[i.isWebGL2?"vertexAttribDivisor":"vertexAttribDivisorANGLE"](O,B),K[O]=B)}function P(){const O=c.newAttributes,B=c.enabledAttributes;for(let H=0,$=B.length;H<$;H++)B[H]!==O[H]&&(t.disableVertexAttribArray(H),B[H]=0)}function A(O,B,H,$,K,Z,se){se===!0?t.vertexAttribIPointer(O,B,H,K,Z):t.vertexAttribPointer(O,B,H,$,K,Z)}function U(O,B,H,$){if(i.isWebGL2===!1&&(O.isInstancedMesh||$.isInstancedBufferGeometry)&&e.get("ANGLE_instanced_arrays")===null)return;w();const K=$.attributes,Z=H.getAttributes(),se=B.defaultAttributeValues;for(const V in Z){const X=Z[V];if(X.location>=0){let ae=K[V];if(ae===void 0&&(V==="instanceMatrix"&&O.instanceMatrix&&(ae=O.instanceMatrix),V==="instanceColor"&&O.instanceColor&&(ae=O.instanceColor)),ae!==void 0){const ce=ae.normalized,ge=ae.itemSize,ne=n.get(ae);if(ne===void 0)continue;const ve=ne.buffer,Pe=ne.type,he=ne.bytesPerElement,we=i.isWebGL2===!0&&(Pe===t.INT||Pe===t.UNSIGNED_INT||ae.gpuType===q9);if(ae.isInterleavedBufferAttribute){const je=ae.data,ue=je.stride,lt=ae.offset;if(je.isInstancedInterleavedBuffer){for(let z=0;z<X.locationSize;z++)C(X.location+z,je.meshPerAttribute);O.isInstancedMesh!==!0&&$._maxInstanceCount===void 0&&($._maxInstanceCount=je.meshPerAttribute*je.count)}else for(let z=0;z<X.locationSize;z++)T(X.location+z);t.bindBuffer(t.ARRAY_BUFFER,ve);for(let z=0;z<X.locationSize;z++)A(X.location+z,ge/X.locationSize,Pe,ce,ue*he,(lt+ge/X.locationSize*z)*he,we)}else{if(ae.isInstancedBufferAttribute){for(let je=0;je<X.locationSize;je++)C(X.location+je,ae.meshPerAttribute);O.isInstancedMesh!==!0&&$._maxInstanceCount===void 0&&($._maxInstanceCount=ae.meshPerAttribute*ae.count)}else for(let je=0;je<X.locationSize;je++)T(X.location+je);t.bindBuffer(t.ARRAY_BUFFER,ve);for(let je=0;je<X.locationSize;je++)A(X.location+je,ge/X.locationSize,Pe,ce,ge*he,ge/X.locationSize*je*he,we)}}else if(se!==void 0){const ce=se[V];if(ce!==void 0)switch(ce.length){case 2:t.vertexAttrib2fv(X.location,ce);break;case 3:t.vertexAttrib3fv(X.location,ce);break;case 4:t.vertexAttrib4fv(X.location,ce);break;default:t.vertexAttrib1fv(X.location,ce)}}}}P()}function N(){I();for(const O in o){const B=o[O];for(const H in B){const $=B[H];for(const K in $)y($[K].object),delete $[K];delete B[H]}delete o[O]}}function D(O){if(o[O.id]===void 0)return;const B=o[O.id];for(const H in B){const $=B[H];for(const K in $)y($[K].object),delete $[K];delete B[H]}delete o[O.id]}function F(O){for(const B in o){const H=o[B];if(H[O.id]===void 0)continue;const $=H[O.id];for(const K in $)y($[K].object),delete $[K];delete H[O.id]}}function I(){W(),d=!0,c!==l&&(c=l,g(c.object))}function W(){l.geometry=null,l.program=null,l.wireframe=!1}return{setup:f,reset:I,resetDefaultState:W,dispose:N,releaseStatesOfGeometry:D,releaseStatesOfProgram:F,initAttributes:w,enableAttribute:T,disableUnusedAttributes:P}}function cye(t,e,n,i){const r=i.isWebGL2;let a;function s(d){a=d}function o(d,f){t.drawArrays(a,d,f),n.update(f,a,1)}function l(d,f,m){if(m===0)return;let g,y;if(r)g=t,y="drawArraysInstanced";else if(g=e.get("ANGLE_instanced_arrays"),y="drawArraysInstancedANGLE",g===null){console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");return}g[y](a,d,f,m),n.update(f,a,m)}function c(d,f,m){if(m===0)return;const g=e.get("WEBGL_multi_draw");if(g===null)for(let y=0;y<m;y++)this.render(d[y],f[y]);else{g.multiDrawArraysWEBGL(a,d,0,f,0,m);let y=0;for(let _=0;_<m;_++)y+=f[_];n.update(y,a,1)}}this.setMode=s,this.render=o,this.renderInstances=l,this.renderMultiDraw=c}function uye(t,e,n){let i;function r(){if(i!==void 0)return i;if(e.has("EXT_texture_filter_anisotropic")===!0){const A=e.get("EXT_texture_filter_anisotropic");i=t.getParameter(A.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else i=0;return i}function a(A){if(A==="highp"){if(t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.HIGH_FLOAT).precision>0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.HIGH_FLOAT).precision>0)return"highp";A="mediump"}return A==="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 o=n.precision!==void 0?n.precision:"highp";const l=a(o);l!==o&&(console.warn("THREE.WebGLRenderer:",o,"not supported, using",l,"instead."),o=l);const c=s||e.has("WEBGL_draw_buffers"),d=n.logarithmicDepthBuffer===!0,f=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),m=t.getParameter(t.MAX_VERTEX_TEXTURE_IMAGE_UNITS),g=t.getParameter(t.MAX_TEXTURE_SIZE),y=t.getParameter(t.MAX_CUBE_MAP_TEXTURE_SIZE),_=t.getParameter(t.MAX_VERTEX_ATTRIBS),v=t.getParameter(t.MAX_VERTEX_UNIFORM_VECTORS),x=t.getParameter(t.MAX_VARYING_VECTORS),M=t.getParameter(t.MAX_FRAGMENT_UNIFORM_VECTORS),w=m>0,T=s||e.has("OES_texture_float"),C=w&&T,P=s?t.getParameter(t.MAX_SAMPLES):0;return{isWebGL2:s,drawBuffers:c,getMaxAnisotropy:r,getMaxPrecision:a,precision:o,logarithmicDepthBuffer:d,maxTextures:f,maxVertexTextures:m,maxTextureSize:g,maxCubemapSize:y,maxAttributes:_,maxVertexUniforms:v,maxVaryings:x,maxFragmentUniforms:M,vertexTextures:w,floatFragmentTextures:T,floatVertexTextures:C,maxSamples:P}}function dye(t){const e=this;let n=null,i=0,r=!1,a=!1;const s=new xu,o=new dn,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(f,m){const g=f.length!==0||m||i!==0||r;return r=m,i=f.length,g},this.beginShadows=function(){a=!0,d(null)},this.endShadows=function(){a=!1},this.setGlobalState=function(f,m){n=d(f,m,0)},this.setState=function(f,m,g){const y=f.clippingPlanes,_=f.clipIntersection,v=f.clipShadows,x=t.get(f);if(!r||y===null||y.length===0||a&&!v)a?d(null):c();else{const M=a?0:i,w=M*4;let T=x.clippingState||null;l.value=T,T=d(y,m,w,g);for(let C=0;C!==w;++C)T[C]=n[C];x.clippingState=T,this.numIntersection=_?this.numPlanes:0,this.numPlanes+=M}};function c(){l.value!==n&&(l.value=n,l.needsUpdate=i>0),e.numPlanes=i,e.numIntersection=0}function d(f,m,g,y){const _=f!==null?f.length:0;let v=null;if(_!==0){if(v=l.value,y!==!0||v===null){const x=g+_*4,M=m.matrixWorldInverse;o.getNormalMatrix(M),(v===null||v.length<x)&&(v=new Float32Array(x));for(let w=0,T=g;w!==_;++w,T+=4)s.copy(f[w]).applyMatrix4(M,o),s.normal.toArray(v,T),v[T+3]=s.constant}l.value=v,l.needsUpdate=!0}return e.numPlanes=_,e.numIntersection=0,v}}function fye(t){let e=new WeakMap;function n(s,o){return o===m3?s.mapping=Hp:o===g3&&(s.mapping=Vp),s}function i(s){if(s&&s.isTexture){const o=s.mapping;if(o===m3||o===g3)if(e.has(s)){const l=e.get(s).texture;return n(l,s.mapping)}else{const l=s.image;if(l&&l.height>0){const c=new M0e(l.height/2);return c.fromEquirectangularTexture(t,s),e.set(s,c),s.addEventListener("dispose",r),n(c.texture,s.mapping)}else return null}}return s}function r(s){const o=s.target;o.removeEventListener("dispose",r);const l=e.get(o);l!==void 0&&(e.delete(o),l.dispose())}function a(){e=new WeakMap}return{get:i,dispose:a}}class hye extends p7{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,o=r+n,l=r-n;if(this.view!==null&&this.view.enabled){const c=(this.right-this.left)/this.view.fullWidth/this.zoom,d=(this.top-this.bottom)/this.view.fullHeight/this.zoom;a+=c*this.view.offsetX,s=a+c*this.view.width,o-=d*this.view.offsetY,l=o-d*this.view.height}this.projectionMatrix.makeOrthographic(a,s,o,l,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 vp=4,Qz=[.125,.215,.35,.446,.526,.582],Wd=20,TT=new hye,Jz=new zt;let CT=null,NT=0,RT=0;const Fd=(1+Math.sqrt(5))/2,ip=1/Fd,e5=[new Ae(1,1,1),new Ae(-1,1,1),new Ae(1,1,-1),new Ae(-1,1,-1),new Ae(0,Fd,ip),new Ae(0,Fd,-ip),new Ae(ip,0,Fd),new Ae(-ip,0,Fd),new Ae(Fd,ip,0),new Ae(-Fd,ip,0)];class t5{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){CT=this._renderer.getRenderTarget(),NT=this._renderer.getActiveCubeFace(),RT=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=r5(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=i5(),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(CT,NT,RT),e.scissorTest=!1,vb(e,0,0,e.width,e.height)}_fromTexture(e,n){e.mapping===Hp||e.mapping===Vp?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),CT=this._renderer.getRenderTarget(),NT=this._renderer.getActiveCubeFace(),RT=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:Is,minFilter:Is,generateMipmaps:!1,type:W0,format:Us,colorSpace:mc,depthBuffer:!1},r=n5(e,n,i);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==n){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=n5(e,n,i);const{_lodMax:a}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=pye(a)),this._blurMaterial=mye(a,e,n)}return r}_compileMaterial(e){const n=new go(this._lodPlanes[0],e);this._renderer.compile(n,TT)}_sceneToCubeUV(e,n,i,r){const o=new rs(90,1,n,i),l=[1,-1,1,1,1,1],c=[1,1,1,-1,-1,-1],d=this._renderer,f=d.autoClear,m=d.toneMapping;d.getClearColor(Jz),d.toneMapping=Uu,d.autoClear=!1;const g=new u7({name:"PMREM.Background",side:Ua,depthWrite:!1,depthTest:!1}),y=new go(new kx,g);let _=!1;const v=e.background;v?v.isColor&&(g.color.copy(v),e.background=null,_=!0):(g.color.copy(Jz),_=!0);for(let x=0;x<6;x++){const M=x%3;M===0?(o.up.set(0,l[x],0),o.lookAt(c[x],0,0)):M===1?(o.up.set(0,0,l[x]),o.lookAt(0,c[x],0)):(o.up.set(0,l[x],0),o.lookAt(0,0,c[x]));const w=this._cubeSize;vb(r,M*w,x>2?w:0,w,w),d.setRenderTarget(r),_&&d.render(y,o),d.render(e,o)}y.geometry.dispose(),y.material.dispose(),d.toneMapping=m,d.autoClear=f,e.background=v}_textureToCubeUV(e,n){const i=this._renderer,r=e.mapping===Hp||e.mapping===Vp;r?(this._cubemapMaterial===null&&(this._cubemapMaterial=r5()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=i5());const a=r?this._cubemapMaterial:this._equirectMaterial,s=new go(this._lodPlanes[0],a),o=a.uniforms;o.envMap.value=e;const l=this._cubeSize;vb(n,0,0,3*l,2*l),i.setRenderTarget(n),i.render(s,TT)}_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=e5[(r-1)%e5.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,o){const l=this._renderer,c=this._blurMaterial;s!=="latitudinal"&&s!=="longitudinal"&&console.error("blur direction must be either latitudinal or longitudinal!");const d=3,f=new go(this._lodPlanes[r],c),m=c.uniforms,g=this._sizeLods[i]-1,y=isFinite(a)?Math.PI/(2*g):2*Math.PI/(2*Wd-1),_=a/y,v=isFinite(a)?1+Math.floor(d*_):Wd;v>Wd&&console.warn(`sigmaRadians, ${a}, is too large and will clip, as it requested ${v} samples when the maximum is set to ${Wd}`);const x=[];let M=0;for(let A=0;A<Wd;++A){const U=A/_,N=Math.exp(-U*U/2);x.push(N),A===0?M+=N:A<v&&(M+=2*N)}for(let A=0;A<x.length;A++)x[A]=x[A]/M;m.envMap.value=e.texture,m.samples.value=v,m.weights.value=x,m.latitudinal.value=s==="latitudinal",o&&(m.poleAxis.value=o);const{_lodMax:w}=this;m.dTheta.value=y,m.mipInt.value=w-i;const T=this._sizeLods[r],C=3*T*(r>w-vp?r-w+vp:0),P=4*(this._cubeSize-T);vb(n,C,P,3*T,2*T),l.setRenderTarget(n),l.render(f,TT)}}function pye(t){const e=[],n=[],i=[];let r=t;const a=t-vp+1+Qz.length;for(let s=0;s<a;s++){const o=Math.pow(2,r);n.push(o);let l=1/o;s>t-vp?l=Qz[s-t+vp-1]:s===0&&(l=0),i.push(l);const c=1/(o-2),d=-c,f=1+c,m=[d,d,f,d,f,f,d,d,f,f,d,f],g=6,y=6,_=3,v=2,x=1,M=new Float32Array(_*y*g),w=new Float32Array(v*y*g),T=new Float32Array(x*y*g);for(let P=0;P<g;P++){const A=P%3*2/3-1,U=P>2?0:-1,N=[A,U,0,A+2/3,U,0,A+2/3,U+1,0,A,U,0,A+2/3,U+1,0,A,U+1,0];M.set(N,_*y*P),w.set(m,v*y*P);const D=[P,P,P,P,P,P];T.set(D,x*y*P)}const C=new ra;C.setAttribute("position",new us(M,_)),C.setAttribute("uv",new us(w,v)),C.setAttribute("faceIndex",new us(T,x)),e.push(C),r>vp&&r--}return{lodPlanes:e,sizeLods:n,sigmas:i}}function n5(t,e,n){const i=new Af(t,e,n);return i.texture.mapping=KS,i.texture.name="PMREM.cubeUv",i.scissorTest=!0,i}function vb(t,e,n,i,r){t.viewport.set(e,n,i,r),t.scissor.set(e,n,i,r)}function mye(t,e,n){const i=new Float32Array(Wd),r=new Ae(0,1,0);return new Xu({name:"SphericalGaussianBlur",defines:{n:Wd,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:tD(),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:Iu,depthTest:!1,depthWrite:!1})}function i5(){return new Xu({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:tD(),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:Iu,depthTest:!1,depthWrite:!1})}function r5(){return new Xu({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:tD(),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:Iu,depthTest:!1,depthWrite:!1})}function tD(){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 gye(t){let e=new WeakMap,n=null;function i(o){if(o&&o.isTexture){const l=o.mapping,c=l===m3||l===g3,d=l===Hp||l===Vp;if(c||d)if(o.isRenderTargetTexture&&o.needsPMREMUpdate===!0){o.needsPMREMUpdate=!1;let f=e.get(o);return n===null&&(n=new t5(t)),f=c?n.fromEquirectangular(o,f):n.fromCubemap(o,f),e.set(o,f),f.texture}else{if(e.has(o))return e.get(o).texture;{const f=o.image;if(c&&f&&f.height>0||d&&f&&r(f)){n===null&&(n=new t5(t));const m=c?n.fromEquirectangular(o):n.fromCubemap(o);return e.set(o,m),o.addEventListener("dispose",a),m.texture}else return null}}}return o}function r(o){let l=0;const c=6;for(let d=0;d<c;d++)o[d]!==void 0&&l++;return l===c}function a(o){const l=o.target;l.removeEventListener("dispose",a);const c=e.get(l);c!==void 0&&(e.delete(l),c.dispose())}function s(){e=new WeakMap,n!==null&&(n.dispose(),n=null)}return{get:i,dispose:s}}function xye(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 vye(t,e,n,i){const r={},a=new WeakMap;function s(f){const m=f.target;m.index!==null&&e.remove(m.index);for(const y in m.attributes)e.remove(m.attributes[y]);for(const y in m.morphAttributes){const _=m.morphAttributes[y];for(let v=0,x=_.length;v<x;v++)e.remove(_[v])}m.removeEventListener("dispose",s),delete r[m.id];const g=a.get(m);g&&(e.remove(g),a.delete(m)),i.releaseStatesOfGeometry(m),m.isInstancedBufferGeometry===!0&&delete m._maxInstanceCount,n.memory.geometries--}function o(f,m){return r[m.id]===!0||(m.addEventListener("dispose",s),r[m.id]=!0,n.memory.geometries++),m}function l(f){const m=f.attributes;for(const y in m)e.update(m[y],t.ARRAY_BUFFER);const g=f.morphAttributes;for(const y in g){const _=g[y];for(let v=0,x=_.length;v<x;v++)e.update(_[v],t.ARRAY_BUFFER)}}function c(f){const m=[],g=f.index,y=f.attributes.position;let _=0;if(g!==null){const M=g.array;_=g.version;for(let w=0,T=M.length;w<T;w+=3){const C=M[w+0],P=M[w+1],A=M[w+2];m.push(C,P,P,A,A,C)}}else if(y!==void 0){const M=y.array;_=y.version;for(let w=0,T=M.length/3-1;w<T;w+=3){const C=w+0,P=w+1,A=w+2;m.push(C,P,P,A,A,C)}}else return;const v=new(r7(m)?f7:d7)(m,1);v.version=_;const x=a.get(f);x&&e.remove(x),a.set(f,v)}function d(f){const m=a.get(f);if(m){const g=f.index;g!==null&&m.version<g.version&&c(f)}else c(f);return a.get(f)}return{get:o,update:l,getWireframeAttribute:d}}function yye(t,e,n,i){const r=i.isWebGL2;let a;function s(g){a=g}let o,l;function c(g){o=g.type,l=g.bytesPerElement}function d(g,y){t.drawElements(a,y,o,g*l),n.update(y,a,1)}function f(g,y,_){if(_===0)return;let v,x;if(r)v=t,x="drawElementsInstanced";else if(v=e.get("ANGLE_instanced_arrays"),x="drawElementsInstancedANGLE",v===null){console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");return}v[x](a,y,o,g*l,_),n.update(y,a,_)}function m(g,y,_){if(_===0)return;const v=e.get("WEBGL_multi_draw");if(v===null)for(let x=0;x<_;x++)this.render(g[x]/l,y[x]);else{v.multiDrawElementsWEBGL(a,y,0,o,g,0,_);let x=0;for(let M=0;M<_;M++)x+=y[M];n.update(x,a,1)}}this.setMode=s,this.setIndex=c,this.render=d,this.renderInstances=f,this.renderMultiDraw=m}function bye(t){const e={geometries:0,textures:0},n={frame:0,calls:0,triangles:0,points:0,lines:0};function i(a,s,o){switch(n.calls++,s){case t.TRIANGLES:n.triangles+=o*(a/3);break;case t.LINES:n.lines+=o*(a/2);break;case t.LINE_STRIP:n.lines+=o*(a-1);break;case t.LINE_LOOP:n.lines+=o*a;break;case t.POINTS:n.points+=o*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 _ye(t,e){return t[0]-e[0]}function Sye(t,e){return Math.abs(e[1])-Math.abs(t[1])}function wye(t,e,n){const i={},r=new Float32Array(8),a=new WeakMap,s=new $n,o=[];for(let c=0;c<8;c++)o[c]=[c,0];function l(c,d,f){const m=c.morphTargetInfluences;if(e.isWebGL2===!0){const y=d.morphAttributes.position||d.morphAttributes.normal||d.morphAttributes.color,_=y!==void 0?y.length:0;let v=a.get(d);if(v===void 0||v.count!==_){let B=function(){W.dispose(),a.delete(d),d.removeEventListener("dispose",B)};var g=B;v!==void 0&&v.texture.dispose();const w=d.morphAttributes.position!==void 0,T=d.morphAttributes.normal!==void 0,C=d.morphAttributes.color!==void 0,P=d.morphAttributes.position||[],A=d.morphAttributes.normal||[],U=d.morphAttributes.color||[];let N=0;w===!0&&(N=1),T===!0&&(N=2),C===!0&&(N=3);let D=d.attributes.position.count*N,F=1;D>e.maxTextureSize&&(F=Math.ceil(D/e.maxTextureSize),D=e.maxTextureSize);const I=new Float32Array(D*F*4*_),W=new o7(I,D,F,_);W.type=Zl,W.needsUpdate=!0;const O=N*4;for(let H=0;H<_;H++){const $=P[H],K=A[H],Z=U[H],se=D*F*4*H;for(let V=0;V<$.count;V++){const X=V*O;w===!0&&(s.fromBufferAttribute($,V),I[se+X+0]=s.x,I[se+X+1]=s.y,I[se+X+2]=s.z,I[se+X+3]=0),T===!0&&(s.fromBufferAttribute(K,V),I[se+X+4]=s.x,I[se+X+5]=s.y,I[se+X+6]=s.z,I[se+X+7]=0),C===!0&&(s.fromBufferAttribute(Z,V),I[se+X+8]=s.x,I[se+X+9]=s.y,I[se+X+10]=s.z,I[se+X+11]=Z.itemSize===4?s.w:1)}}v={count:_,texture:W,size:new Wt(D,F)},a.set(d,v),d.addEventListener("dispose",B)}let x=0;for(let w=0;w<m.length;w++)x+=m[w];const M=d.morphTargetsRelative?1:1-x;f.getUniforms().setValue(t,"morphTargetBaseInfluence",M),f.getUniforms().setValue(t,"morphTargetInfluences",m),f.getUniforms().setValue(t,"morphTargetsTexture",v.texture,n),f.getUniforms().setValue(t,"morphTargetsTextureSize",v.size)}else{const y=m===void 0?0:m.length;let _=i[d.id];if(_===void 0||_.length!==y){_=[];for(let T=0;T<y;T++)_[T]=[T,0];i[d.id]=_}for(let T=0;T<y;T++){const C=_[T];C[0]=T,C[1]=m[T]}_.sort(Sye);for(let T=0;T<8;T++)T<y&&_[T][1]?(o[T][0]=_[T][0],o[T][1]=_[T][1]):(o[T][0]=Number.MAX_SAFE_INTEGER,o[T][1]=0);o.sort(_ye);const v=d.morphAttributes.position,x=d.morphAttributes.normal;let M=0;for(let T=0;T<8;T++){const C=o[T],P=C[0],A=C[1];P!==Number.MAX_SAFE_INTEGER&&A?(v&&d.getAttribute("morphTarget"+T)!==v[P]&&d.setAttribute("morphTarget"+T,v[P]),x&&d.getAttribute("morphNormal"+T)!==x[P]&&d.setAttribute("morphNormal"+T,x[P]),r[T]=A,M+=A):(v&&d.hasAttribute("morphTarget"+T)===!0&&d.deleteAttribute("morphTarget"+T),x&&d.hasAttribute("morphNormal"+T)===!0&&d.deleteAttribute("morphNormal"+T),r[T]=0)}const w=d.morphTargetsRelative?1:1-M;f.getUniforms().setValue(t,"morphTargetBaseInfluence",w),f.getUniforms().setValue(t,"morphTargetInfluences",r)}}return{update:l}}function Mye(t,e,n,i){let r=new WeakMap;function a(l){const c=i.render.frame,d=l.geometry,f=e.get(l,d);if(r.get(f)!==c&&(e.update(f),r.set(f,c)),l.isInstancedMesh&&(l.hasEventListener("dispose",o)===!1&&l.addEventListener("dispose",o),r.get(l)!==c&&(n.update(l.instanceMatrix,t.ARRAY_BUFFER),l.instanceColor!==null&&n.update(l.instanceColor,t.ARRAY_BUFFER),r.set(l,c))),l.isSkinnedMesh){const m=l.skeleton;r.get(m)!==c&&(m.update(),r.set(m,c))}return f}function s(){r=new WeakMap}function o(l){const c=l.target;c.removeEventListener("dispose",o),n.remove(c.instanceMatrix),c.instanceColor!==null&&n.remove(c.instanceColor)}return{update:a,dispose:s}}class x7 extends ja{constructor(e,n,i,r,a,s,o,l,c,d){if(d=d!==void 0?d:sf,d!==sf&&d!==$p)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");i===void 0&&d===sf&&(i=Nu),i===void 0&&d===$p&&(i=af),super(null,r,a,s,o,l,d,i,c),this.isDepthTexture=!0,this.image={width:e,height:n},this.magFilter=o!==void 0?o:zr,this.minFilter=l!==void 0?l:zr,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 v7=new ja,y7=new x7(1,1);y7.compareFunction=n7;const b7=new o7,_7=new l0e,S7=new m7,a5=[],s5=[],o5=new Float32Array(16),l5=new Float32Array(9),c5=new Float32Array(4);function xm(t,e,n){const i=t[0];if(i<=0||i>0)return t;const r=e*n;let a=a5[r];if(a===void 0&&(a=new Float32Array(r),a5[r]=a),e!==0){i.toArray(a,0);for(let s=1,o=0;s!==e;++s)o+=n,t[s].toArray(a,o)}return a}function sr(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 or(t,e){for(let n=0,i=e.length;n<i;n++)t[n]=e[n]}function QS(t,e){let n=s5[e];n===void 0&&(n=new Int32Array(e),s5[e]=n);for(let i=0;i!==e;++i)n[i]=t.allocateTextureUnit();return n}function Eye(t,e){const n=this.cache;n[0]!==e&&(t.uniform1f(this.addr,e),n[0]=e)}function Aye(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(sr(n,e))return;t.uniform2fv(this.addr,e),or(n,e)}}function Tye(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(sr(n,e))return;t.uniform3fv(this.addr,e),or(n,e)}}function Cye(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(sr(n,e))return;t.uniform4fv(this.addr,e),or(n,e)}}function Nye(t,e){const n=this.cache,i=e.elements;if(i===void 0){if(sr(n,e))return;t.uniformMatrix2fv(this.addr,!1,e),or(n,e)}else{if(sr(n,i))return;c5.set(i),t.uniformMatrix2fv(this.addr,!1,c5),or(n,i)}}function Rye(t,e){const n=this.cache,i=e.elements;if(i===void 0){if(sr(n,e))return;t.uniformMatrix3fv(this.addr,!1,e),or(n,e)}else{if(sr(n,i))return;l5.set(i),t.uniformMatrix3fv(this.addr,!1,l5),or(n,i)}}function Pye(t,e){const n=this.cache,i=e.elements;if(i===void 0){if(sr(n,e))return;t.uniformMatrix4fv(this.addr,!1,e),or(n,e)}else{if(sr(n,i))return;o5.set(i),t.uniformMatrix4fv(this.addr,!1,o5),or(n,i)}}function Dye(t,e){const n=this.cache;n[0]!==e&&(t.uniform1i(this.addr,e),n[0]=e)}function kye(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(sr(n,e))return;t.uniform2iv(this.addr,e),or(n,e)}}function Oye(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(sr(n,e))return;t.uniform3iv(this.addr,e),or(n,e)}}function Lye(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(sr(n,e))return;t.uniform4iv(this.addr,e),or(n,e)}}function Iye(t,e){const n=this.cache;n[0]!==e&&(t.uniform1ui(this.addr,e),n[0]=e)}function Uye(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(sr(n,e))return;t.uniform2uiv(this.addr,e),or(n,e)}}function jye(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(sr(n,e))return;t.uniform3uiv(this.addr,e),or(n,e)}}function Fye(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(sr(n,e))return;t.uniform4uiv(this.addr,e),or(n,e)}}function zye(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?y7:v7;n.setTexture2D(e||a,r)}function Bye(t,e,n){const i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(t.uniform1i(this.addr,r),i[0]=r),n.setTexture3D(e||_7,r)}function Hye(t,e,n){const i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(t.uniform1i(this.addr,r),i[0]=r),n.setTextureCube(e||S7,r)}function Vye(t,e,n){const i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(t.uniform1i(this.addr,r),i[0]=r),n.setTexture2DArray(e||b7,r)}function $ye(t){switch(t){case 5126:return Eye;case 35664:return Aye;case 35665:return Tye;case 35666:return Cye;case 35674:return Nye;case 35675:return Rye;case 35676:return Pye;case 5124:case 35670:return Dye;case 35667:case 35671:return kye;case 35668:case 35672:return Oye;case 35669:case 35673:return Lye;case 5125:return Iye;case 36294:return Uye;case 36295:return jye;case 36296:return Fye;case 35678:case 36198:case 36298:case 36306:case 35682:return zye;case 35679:case 36299:case 36307:return Bye;case 35680:case 36300:case 36308:case 36293:return Hye;case 36289:case 36303:case 36311:case 36292:return Vye}}function Gye(t,e){t.uniform1fv(this.addr,e)}function Wye(t,e){const n=xm(e,this.size,2);t.uniform2fv(this.addr,n)}function qye(t,e){const n=xm(e,this.size,3);t.uniform3fv(this.addr,n)}function Xye(t,e){const n=xm(e,this.size,4);t.uniform4fv(this.addr,n)}function Kye(t,e){const n=xm(e,this.size,4);t.uniformMatrix2fv(this.addr,!1,n)}function Yye(t,e){const n=xm(e,this.size,9);t.uniformMatrix3fv(this.addr,!1,n)}function Zye(t,e){const n=xm(e,this.size,16);t.uniformMatrix4fv(this.addr,!1,n)}function Qye(t,e){t.uniform1iv(this.addr,e)}function Jye(t,e){t.uniform2iv(this.addr,e)}function ebe(t,e){t.uniform3iv(this.addr,e)}function tbe(t,e){t.uniform4iv(this.addr,e)}function nbe(t,e){t.uniform1uiv(this.addr,e)}function ibe(t,e){t.uniform2uiv(this.addr,e)}function rbe(t,e){t.uniform3uiv(this.addr,e)}function abe(t,e){t.uniform4uiv(this.addr,e)}function sbe(t,e,n){const i=this.cache,r=e.length,a=QS(n,r);sr(i,a)||(t.uniform1iv(this.addr,a),or(i,a));for(let s=0;s!==r;++s)n.setTexture2D(e[s]||v7,a[s])}function obe(t,e,n){const i=this.cache,r=e.length,a=QS(n,r);sr(i,a)||(t.uniform1iv(this.addr,a),or(i,a));for(let s=0;s!==r;++s)n.setTexture3D(e[s]||_7,a[s])}function lbe(t,e,n){const i=this.cache,r=e.length,a=QS(n,r);sr(i,a)||(t.uniform1iv(this.addr,a),or(i,a));for(let s=0;s!==r;++s)n.setTextureCube(e[s]||S7,a[s])}function cbe(t,e,n){const i=this.cache,r=e.length,a=QS(n,r);sr(i,a)||(t.uniform1iv(this.addr,a),or(i,a));for(let s=0;s!==r;++s)n.setTexture2DArray(e[s]||b7,a[s])}function ube(t){switch(t){case 5126:return Gye;case 35664:return Wye;case 35665:return qye;case 35666:return Xye;case 35674:return Kye;case 35675:return Yye;case 35676:return Zye;case 5124:case 35670:return Qye;case 35667:case 35671:return Jye;case 35668:case 35672:return ebe;case 35669:case 35673:return tbe;case 5125:return nbe;case 36294:return ibe;case 36295:return rbe;case 36296:return abe;case 35678:case 36198:case 36298:case 36306:case 35682:return sbe;case 35679:case 36299:case 36307:return obe;case 35680:case 36300:case 36308:case 36293:return lbe;case 36289:case 36303:case 36311:case 36292:return cbe}}class dbe{constructor(e,n,i){this.id=e,this.addr=i,this.cache=[],this.type=n.type,this.setValue=$ye(n.type)}}class fbe{constructor(e,n,i){this.id=e,this.addr=i,this.cache=[],this.type=n.type,this.size=n.size,this.setValue=ube(n.type)}}class hbe{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 o=r[a];o.setValue(e,n[o.id],i)}}}const PT=/(\w+)(\])?(\[|\.)?/g;function u5(t,e){t.seq.push(e),t.map[e.id]=e}function pbe(t,e,n){const i=t.name,r=i.length;for(PT.lastIndex=0;;){const a=PT.exec(i),s=PT.lastIndex;let o=a[1];const l=a[2]==="]",c=a[3];if(l&&(o=o|0),c===void 0||c==="["&&s+2===r){u5(n,c===void 0?new dbe(o,t,e):new fbe(o,t,e));break}else{let f=n.map[o];f===void 0&&(f=new hbe(o),u5(n,f)),n=f}}}class p_{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);pbe(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 o=n[a],l=i[o.id];l.needsUpdate!==!1&&o.setValue(e,l.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 d5(t,e,n){const i=t.createShader(e);return t.shaderSource(i,n),t.compileShader(i),i}const mbe=37297;let gbe=0;function xbe(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 o=s+1;i.push(`${o===e?">":" "} ${o}: ${n[s]}`)}return i.join(`
  7343. `)}function vbe(t){const e=Hn.getPrimaries(Hn.workingColorSpace),n=Hn.getPrimaries(t);let i;switch(e===n?i="":e===q_&&n===W_?i="LinearDisplayP3ToLinearSRGB":e===W_&&n===q_&&(i="LinearSRGBToLinearDisplayP3"),t){case mc:case YS:return[i,"LinearTransferOETF"];case Br:case YP:return[i,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space:",t),[i,"LinearTransferOETF"]}}function f5(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. `+xbe(t.getShaderSource(e),s)}else return r}function ybe(t,e){const n=vbe(e);return`vec4 ${t}( vec4 value ) { return ${n[0]}( ${n[1]}( value ) ); }`}function bbe(t,e){let n;switch(e){case yge:n="Linear";break;case bge:n="Reinhard";break;case _ge:n="OptimizedCineon";break;case Sge:n="ACESFilmic";break;case wge:n="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),n="Linear"}return"vec3 "+t+"( vec3 color ) { return "+n+"ToneMapping( color ); }"}function _be(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(Qg).join(`
  7346. `)}function Sbe(t){const e=[];for(const n in t){const i=t[n];i!==!1&&e.push("#define "+n+" "+i)}return e.join(`
  7347. `)}function wbe(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 o=1;a.type===t.FLOAT_MAT2&&(o=2),a.type===t.FLOAT_MAT3&&(o=3),a.type===t.FLOAT_MAT4&&(o=4),n[s]={type:a.type,location:t.getAttribLocation(e,s),locationSize:o}}return n}function Qg(t){return t!==""}function h5(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 p5(t,e){return t.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const Mbe=/^[ \t]*#include +<([\w\d./]+)>/gm;function S3(t){return t.replace(Mbe,Abe)}const Ebe=new Map([["encodings_fragment","colorspace_fragment"],["encodings_pars_fragment","colorspace_pars_fragment"],["output_fragment","opaque_fragment"]]);function Abe(t,e){let n=rn[e];if(n===void 0){const i=Ebe.get(e);if(i!==void 0)n=rn[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 S3(n)}const Tbe=/#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 m5(t){return t.replace(Tbe,Cbe)}function Cbe(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 g5(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 Nbe(t){let e="SHADOWMAP_TYPE_BASIC";return t.shadowMapType===G9?e="SHADOWMAP_TYPE_PCF":t.shadowMapType===qme?e="SHADOWMAP_TYPE_PCF_SOFT":t.shadowMapType===Bl&&(e="SHADOWMAP_TYPE_VSM"),e}function Rbe(t){let e="ENVMAP_TYPE_CUBE";if(t.envMap)switch(t.envMapMode){case Hp:case Vp:e="ENVMAP_TYPE_CUBE";break;case KS:e="ENVMAP_TYPE_CUBE_UV";break}return e}function Pbe(t){let e="ENVMAP_MODE_REFLECTION";if(t.envMap)switch(t.envMapMode){case Vp:e="ENVMAP_MODE_REFRACTION";break}return e}function Dbe(t){let e="ENVMAP_BLENDING_NONE";if(t.envMap)switch(t.combine){case XP:e="ENVMAP_BLENDING_MULTIPLY";break;case xge:e="ENVMAP_BLENDING_MIX";break;case vge:e="ENVMAP_BLENDING_ADD";break}return e}function kbe(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 Obe(t,e,n,i){const r=t.getContext(),a=n.defines;let s=n.vertexShader,o=n.fragmentShader;const l=Nbe(n),c=Rbe(n),d=Pbe(n),f=Dbe(n),m=kbe(n),g=n.isWebGL2?"":_be(n),y=Sbe(a),_=r.createProgram();let v,x,M=n.glslVersion?"#version "+n.glslVersion+`
  7352. `:"";n.isRawShaderMaterial?(v=["#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,y].filter(Qg).join(`
  7353. `),v.length>0&&(v+=`
  7354. `),x=[g,"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,y].filter(Qg).join(`
  7355. `),x.length>0&&(x+=`
  7356. `)):(v=[g5(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,y,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 "+d:"",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 "+l:"",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(Qg).join(`
  7358. `),x=[g,g5(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,y,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 "+c:"",n.envMap?"#define "+d:"",n.envMap?"#define "+f:"",m?"#define CUBEUV_TEXEL_WIDTH "+m.texelWidth:"",m?"#define CUBEUV_TEXEL_HEIGHT "+m.texelHeight:"",m?"#define CUBEUV_MAX_MIP "+m.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 "+l:"",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!==Uu?"#define TONE_MAPPING":"",n.toneMapping!==Uu?rn.tonemapping_pars_fragment:"",n.toneMapping!==Uu?bbe("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",n.opaque?"#define OPAQUE":"",rn.colorspace_pars_fragment,ybe("linearToOutputTexel",n.outputColorSpace),n.useDepthPacking?"#define DEPTH_PACKING "+n.depthPacking:"",`
  7359. `].filter(Qg).join(`
  7360. `)),s=S3(s),s=h5(s,n),s=p5(s,n),o=S3(o),o=h5(o,n),o=p5(o,n),s=m5(s),o=m5(o),n.isWebGL2&&n.isRawShaderMaterial!==!0&&(M=`#version 300 es
  7361. `,v=["precision mediump sampler2DArray;","#define attribute in","#define varying out","#define texture2D texture"].join(`
  7362. `)+`
  7363. `+v,x=["precision mediump sampler2DArray;","#define varying in",n.glslVersion===Oz?"":"layout(location = 0) out highp vec4 pc_fragColor;",n.glslVersion===Oz?"":"#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. `+x);const w=M+v+s,T=M+x+o,C=d5(r,r.VERTEX_SHADER,w),P=d5(r,r.FRAGMENT_SHADER,T);r.attachShader(_,C),r.attachShader(_,P),n.index0AttributeName!==void 0?r.bindAttribLocation(_,0,n.index0AttributeName):n.morphTargets===!0&&r.bindAttribLocation(_,0,"position"),r.linkProgram(_);function A(F){if(t.debug.checkShaderErrors){const I=r.getProgramInfoLog(_).trim(),W=r.getShaderInfoLog(C).trim(),O=r.getShaderInfoLog(P).trim();let B=!0,H=!0;if(r.getProgramParameter(_,r.LINK_STATUS)===!1)if(B=!1,typeof t.debug.onShaderError=="function")t.debug.onShaderError(r,_,C,P);else{const $=f5(r,C,"vertex"),K=f5(r,P,"fragment");console.error("THREE.WebGLProgram: Shader Error "+r.getError()+" - VALIDATE_STATUS "+r.getProgramParameter(_,r.VALIDATE_STATUS)+`
  7366. Program Info Log: `+I+`
  7367. `+$+`
  7368. `+K)}else I!==""?console.warn("THREE.WebGLProgram: Program Info Log:",I):(W===""||O==="")&&(H=!1);H&&(F.diagnostics={runnable:B,programLog:I,vertexShader:{log:W,prefix:v},fragmentShader:{log:O,prefix:x}})}r.deleteShader(C),r.deleteShader(P),U=new p_(r,_),N=wbe(r,_)}let U;this.getUniforms=function(){return U===void 0&&A(this),U};let N;this.getAttributes=function(){return N===void 0&&A(this),N};let D=n.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return D===!1&&(D=r.getProgramParameter(_,mbe)),D},this.destroy=function(){i.releaseStatesOfProgram(this),r.deleteProgram(_),this.program=void 0},this.type=n.shaderType,this.name=n.shaderName,this.id=gbe++,this.cacheKey=e,this.usedTimes=1,this.program=_,this.vertexShader=C,this.fragmentShader=P,this}let Lbe=0;class Ibe{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 Ube(e),n.set(e,i)),i}}class Ube{constructor(e){this.id=Lbe++,this.code=e,this.usedTimes=0}}function jbe(t,e,n,i,r,a,s){const o=new l7,l=new Ibe,c=[],d=r.isWebGL2,f=r.logarithmicDepthBuffer,m=r.vertexTextures;let g=r.precision;const y={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 _(N){return N===0?"uv":`uv${N}`}function v(N,D,F,I,W){const O=I.fog,B=W.geometry,H=N.isMeshStandardMaterial?I.environment:null,$=(N.isMeshStandardMaterial?n:e).get(N.envMap||H),K=$&&$.mapping===KS?$.image.height:null,Z=y[N.type];N.precision!==null&&(g=r.getMaxPrecision(N.precision),g!==N.precision&&console.warn("THREE.WebGLProgram.getParameters:",N.precision,"not supported, using",g,"instead."));const se=B.morphAttributes.position||B.morphAttributes.normal||B.morphAttributes.color,V=se!==void 0?se.length:0;let X=0;B.morphAttributes.position!==void 0&&(X=1),B.morphAttributes.normal!==void 0&&(X=2),B.morphAttributes.color!==void 0&&(X=3);let ae,ce,ge,ne;if(Z){const on=ka[Z];ae=on.vertexShader,ce=on.fragmentShader}else ae=N.vertexShader,ce=N.fragmentShader,l.update(N),ge=l.getVertexShaderID(N),ne=l.getFragmentShaderID(N);const ve=t.getRenderTarget(),Pe=W.isInstancedMesh===!0,he=W.isBatchedMesh===!0,we=!!N.map,je=!!N.matcap,ue=!!$,lt=!!N.aoMap,z=!!N.lightMap,q=!!N.bumpMap,re=!!N.normalMap,J=!!N.displacementMap,ee=!!N.emissiveMap,oe=!!N.metalnessMap,De=!!N.roughnessMap,Ne=N.anisotropy>0,te=N.clearcoat>0,j=N.iridescence>0,L=N.sheen>0,Y=N.transmission>0,me=Ne&&!!N.anisotropyMap,ye=te&&!!N.clearcoatMap,pe=te&&!!N.clearcoatNormalMap,Ze=te&&!!N.clearcoatRoughnessMap,Le=j&&!!N.iridescenceMap,qe=j&&!!N.iridescenceThicknessMap,at=L&&!!N.sheenColorMap,Ie=L&&!!N.sheenRoughnessMap,Re=!!N.specularMap,pt=!!N.specularColorMap,nt=!!N.specularIntensityMap,tt=Y&&!!N.transmissionMap,ut=Y&&!!N.thicknessMap,de=!!N.gradientMap,it=!!N.alphaMap,fe=N.alphaTest>0,Oe=!!N.alphaHash,Me=!!N.extensions,xe=!!B.attributes.uv1,Be=!!B.attributes.uv2,ct=!!B.attributes.uv3;let bt=Uu;return N.toneMapped&&(ve===null||ve.isXRRenderTarget===!0)&&(bt=t.toneMapping),{isWebGL2:d,shaderID:Z,shaderType:N.type,shaderName:N.name,vertexShader:ae,fragmentShader:ce,defines:N.defines,customVertexShaderID:ge,customFragmentShaderID:ne,isRawShaderMaterial:N.isRawShaderMaterial===!0,glslVersion:N.glslVersion,precision:g,batching:he,instancing:Pe,instancingColor:Pe&&W.instanceColor!==null,supportsVertexTextures:m,outputColorSpace:ve===null?t.outputColorSpace:ve.isXRRenderTarget===!0?ve.texture.colorSpace:mc,map:we,matcap:je,envMap:ue,envMapMode:ue&&$.mapping,envMapCubeUVHeight:K,aoMap:lt,lightMap:z,bumpMap:q,normalMap:re,displacementMap:m&&J,emissiveMap:ee,normalMapObjectSpace:re&&N.normalMapType===Lge,normalMapTangentSpace:re&&N.normalMapType===t7,metalnessMap:oe,roughnessMap:De,anisotropy:Ne,anisotropyMap:me,clearcoat:te,clearcoatMap:ye,clearcoatNormalMap:pe,clearcoatRoughnessMap:Ze,iridescence:j,iridescenceMap:Le,iridescenceThicknessMap:qe,sheen:L,sheenColorMap:at,sheenRoughnessMap:Ie,specularMap:Re,specularColorMap:pt,specularIntensityMap:nt,transmission:Y,transmissionMap:tt,thicknessMap:ut,gradientMap:de,opaque:N.transparent===!1&&N.blending===Tp,alphaMap:it,alphaTest:fe,alphaHash:Oe,combine:N.combine,mapUv:we&&_(N.map.channel),aoMapUv:lt&&_(N.aoMap.channel),lightMapUv:z&&_(N.lightMap.channel),bumpMapUv:q&&_(N.bumpMap.channel),normalMapUv:re&&_(N.normalMap.channel),displacementMapUv:J&&_(N.displacementMap.channel),emissiveMapUv:ee&&_(N.emissiveMap.channel),metalnessMapUv:oe&&_(N.metalnessMap.channel),roughnessMapUv:De&&_(N.roughnessMap.channel),anisotropyMapUv:me&&_(N.anisotropyMap.channel),clearcoatMapUv:ye&&_(N.clearcoatMap.channel),clearcoatNormalMapUv:pe&&_(N.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:Ze&&_(N.clearcoatRoughnessMap.channel),iridescenceMapUv:Le&&_(N.iridescenceMap.channel),iridescenceThicknessMapUv:qe&&_(N.iridescenceThicknessMap.channel),sheenColorMapUv:at&&_(N.sheenColorMap.channel),sheenRoughnessMapUv:Ie&&_(N.sheenRoughnessMap.channel),specularMapUv:Re&&_(N.specularMap.channel),specularColorMapUv:pt&&_(N.specularColorMap.channel),specularIntensityMapUv:nt&&_(N.specularIntensityMap.channel),transmissionMapUv:tt&&_(N.transmissionMap.channel),thicknessMapUv:ut&&_(N.thicknessMap.channel),alphaMapUv:it&&_(N.alphaMap.channel),vertexTangents:!!B.attributes.tangent&&(re||Ne),vertexColors:N.vertexColors,vertexAlphas:N.vertexColors===!0&&!!B.attributes.color&&B.attributes.color.itemSize===4,vertexUv1s:xe,vertexUv2s:Be,vertexUv3s:ct,pointsUvs:W.isPoints===!0&&!!B.attributes.uv&&(we||it),fog:!!O,useFog:N.fog===!0,fogExp2:O&&O.isFogExp2,flatShading:N.flatShading===!0,sizeAttenuation:N.sizeAttenuation===!0,logarithmicDepthBuffer:f,skinning:W.isSkinnedMesh===!0,morphTargets:B.morphAttributes.position!==void 0,morphNormals:B.morphAttributes.normal!==void 0,morphColors:B.morphAttributes.color!==void 0,morphTargetsCount:V,morphTextureStride:X,numDirLights:D.directional.length,numPointLights:D.point.length,numSpotLights:D.spot.length,numSpotLightMaps:D.spotLightMap.length,numRectAreaLights:D.rectArea.length,numHemiLights:D.hemi.length,numDirLightShadows:D.directionalShadowMap.length,numPointLightShadows:D.pointShadowMap.length,numSpotLightShadows:D.spotShadowMap.length,numSpotLightShadowsWithMaps:D.numSpotLightShadowsWithMaps,numLightProbes:D.numLightProbes,numClippingPlanes:s.numPlanes,numClipIntersection:s.numIntersection,dithering:N.dithering,shadowMapEnabled:t.shadowMap.enabled&&F.length>0,shadowMapType:t.shadowMap.type,toneMapping:bt,useLegacyLights:t._useLegacyLights,decodeVideoTexture:we&&N.map.isVideoTexture===!0&&Hn.getTransfer(N.map.colorSpace)===ii,premultipliedAlpha:N.premultipliedAlpha,doubleSided:N.side===Gl,flipSided:N.side===Ua,useDepthPacking:N.depthPacking>=0,depthPacking:N.depthPacking||0,index0AttributeName:N.index0AttributeName,extensionDerivatives:Me&&N.extensions.derivatives===!0,extensionFragDepth:Me&&N.extensions.fragDepth===!0,extensionDrawBuffers:Me&&N.extensions.drawBuffers===!0,extensionShaderTextureLOD:Me&&N.extensions.shaderTextureLOD===!0,rendererExtensionFragDepth:d||i.has("EXT_frag_depth"),rendererExtensionDrawBuffers:d||i.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:d||i.has("EXT_shader_texture_lod"),rendererExtensionParallelShaderCompile:i.has("KHR_parallel_shader_compile"),customProgramCacheKey:N.customProgramCacheKey()}}function x(N){const D=[];if(N.shaderID?D.push(N.shaderID):(D.push(N.customVertexShaderID),D.push(N.customFragmentShaderID)),N.defines!==void 0)for(const F in N.defines)D.push(F),D.push(N.defines[F]);return N.isRawShaderMaterial===!1&&(M(D,N),w(D,N),D.push(t.outputColorSpace)),D.push(N.customProgramCacheKey),D.join()}function M(N,D){N.push(D.precision),N.push(D.outputColorSpace),N.push(D.envMapMode),N.push(D.envMapCubeUVHeight),N.push(D.mapUv),N.push(D.alphaMapUv),N.push(D.lightMapUv),N.push(D.aoMapUv),N.push(D.bumpMapUv),N.push(D.normalMapUv),N.push(D.displacementMapUv),N.push(D.emissiveMapUv),N.push(D.metalnessMapUv),N.push(D.roughnessMapUv),N.push(D.anisotropyMapUv),N.push(D.clearcoatMapUv),N.push(D.clearcoatNormalMapUv),N.push(D.clearcoatRoughnessMapUv),N.push(D.iridescenceMapUv),N.push(D.iridescenceThicknessMapUv),N.push(D.sheenColorMapUv),N.push(D.sheenRoughnessMapUv),N.push(D.specularMapUv),N.push(D.specularColorMapUv),N.push(D.specularIntensityMapUv),N.push(D.transmissionMapUv),N.push(D.thicknessMapUv),N.push(D.combine),N.push(D.fogExp2),N.push(D.sizeAttenuation),N.push(D.morphTargetsCount),N.push(D.morphAttributeCount),N.push(D.numDirLights),N.push(D.numPointLights),N.push(D.numSpotLights),N.push(D.numSpotLightMaps),N.push(D.numHemiLights),N.push(D.numRectAreaLights),N.push(D.numDirLightShadows),N.push(D.numPointLightShadows),N.push(D.numSpotLightShadows),N.push(D.numSpotLightShadowsWithMaps),N.push(D.numLightProbes),N.push(D.shadowMapType),N.push(D.toneMapping),N.push(D.numClippingPlanes),N.push(D.numClipIntersection),N.push(D.depthPacking)}function w(N,D){o.disableAll(),D.isWebGL2&&o.enable(0),D.supportsVertexTextures&&o.enable(1),D.instancing&&o.enable(2),D.instancingColor&&o.enable(3),D.matcap&&o.enable(4),D.envMap&&o.enable(5),D.normalMapObjectSpace&&o.enable(6),D.normalMapTangentSpace&&o.enable(7),D.clearcoat&&o.enable(8),D.iridescence&&o.enable(9),D.alphaTest&&o.enable(10),D.vertexColors&&o.enable(11),D.vertexAlphas&&o.enable(12),D.vertexUv1s&&o.enable(13),D.vertexUv2s&&o.enable(14),D.vertexUv3s&&o.enable(15),D.vertexTangents&&o.enable(16),D.anisotropy&&o.enable(17),D.alphaHash&&o.enable(18),D.batching&&o.enable(19),N.push(o.mask),o.disableAll(),D.fog&&o.enable(0),D.useFog&&o.enable(1),D.flatShading&&o.enable(2),D.logarithmicDepthBuffer&&o.enable(3),D.skinning&&o.enable(4),D.morphTargets&&o.enable(5),D.morphNormals&&o.enable(6),D.morphColors&&o.enable(7),D.premultipliedAlpha&&o.enable(8),D.shadowMapEnabled&&o.enable(9),D.useLegacyLights&&o.enable(10),D.doubleSided&&o.enable(11),D.flipSided&&o.enable(12),D.useDepthPacking&&o.enable(13),D.dithering&&o.enable(14),D.transmission&&o.enable(15),D.sheen&&o.enable(16),D.opaque&&o.enable(17),D.pointsUvs&&o.enable(18),D.decodeVideoTexture&&o.enable(19),N.push(o.mask)}function T(N){const D=y[N.type];let F;if(D){const I=ka[D];F=JP.clone(I.uniforms)}else F=N.uniforms;return F}function C(N,D){let F;for(let I=0,W=c.length;I<W;I++){const O=c[I];if(O.cacheKey===D){F=O,++F.usedTimes;break}}return F===void 0&&(F=new Obe(t,D,N,a),c.push(F)),F}function P(N){if(--N.usedTimes===0){const D=c.indexOf(N);c[D]=c[c.length-1],c.pop(),N.destroy()}}function A(N){l.remove(N)}function U(){l.dispose()}return{getParameters:v,getProgramCacheKey:x,getUniforms:T,acquireProgram:C,releaseProgram:P,releaseShaderCache:A,programs:c,dispose:U}}function Fbe(){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,o){t.get(a)[s]=o}function r(){t=new WeakMap}return{get:e,remove:n,update:i,dispose:r}}function zbe(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 x5(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 v5(){const t=[];let e=0;const n=[],i=[],r=[];function a(){e=0,n.length=0,i.length=0,r.length=0}function s(f,m,g,y,_,v){let x=t[e];return x===void 0?(x={id:f.id,object:f,geometry:m,material:g,groupOrder:y,renderOrder:f.renderOrder,z:_,group:v},t[e]=x):(x.id=f.id,x.object=f,x.geometry=m,x.material=g,x.groupOrder=y,x.renderOrder=f.renderOrder,x.z=_,x.group=v),e++,x}function o(f,m,g,y,_,v){const x=s(f,m,g,y,_,v);g.transmission>0?i.push(x):g.transparent===!0?r.push(x):n.push(x)}function l(f,m,g,y,_,v){const x=s(f,m,g,y,_,v);g.transmission>0?i.unshift(x):g.transparent===!0?r.unshift(x):n.unshift(x)}function c(f,m){n.length>1&&n.sort(f||zbe),i.length>1&&i.sort(m||x5),r.length>1&&r.sort(m||x5)}function d(){for(let f=e,m=t.length;f<m;f++){const g=t[f];if(g.id===null)break;g.id=null,g.object=null,g.geometry=null,g.material=null,g.group=null}}return{opaque:n,transmissive:i,transparent:r,init:a,push:o,unshift:l,finish:d,sort:c}}function Bbe(){let t=new WeakMap;function e(i,r){const a=t.get(i);let s;return a===void 0?(s=new v5,t.set(i,[s])):r>=a.length?(s=new v5,a.push(s)):s=a[r],s}function n(){t=new WeakMap}return{get:e,dispose:n}}function Hbe(){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 Ae,color:new zt};break;case"SpotLight":n={position:new Ae,direction:new Ae,color:new zt,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new Ae,color:new zt,distance:0,decay:0};break;case"HemisphereLight":n={direction:new Ae,skyColor:new zt,groundColor:new zt};break;case"RectAreaLight":n={color:new zt,position:new Ae,halfWidth:new Ae,halfHeight:new Ae};break}return t[e.id]=n,n}}}function Vbe(){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 Wt};break;case"SpotLight":n={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Wt};break;case"PointLight":n={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Wt,shadowCameraNear:1,shadowCameraFar:1e3};break}return t[e.id]=n,n}}}let $be=0;function Gbe(t,e){return(e.castShadow?2:0)-(t.castShadow?2:0)+(e.map?1:0)-(t.map?1:0)}function Wbe(t,e){const n=new Hbe,i=Vbe(),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 d=0;d<9;d++)r.probe.push(new Ae);const a=new Ae,s=new Qn,o=new Qn;function l(d,f){let m=0,g=0,y=0;for(let I=0;I<9;I++)r.probe[I].set(0,0,0);let _=0,v=0,x=0,M=0,w=0,T=0,C=0,P=0,A=0,U=0,N=0;d.sort(Gbe);const D=f===!0?Math.PI:1;for(let I=0,W=d.length;I<W;I++){const O=d[I],B=O.color,H=O.intensity,$=O.distance,K=O.shadow&&O.shadow.map?O.shadow.map.texture:null;if(O.isAmbientLight)m+=B.r*H*D,g+=B.g*H*D,y+=B.b*H*D;else if(O.isLightProbe){for(let Z=0;Z<9;Z++)r.probe[Z].addScaledVector(O.sh.coefficients[Z],H);N++}else if(O.isDirectionalLight){const Z=n.get(O);if(Z.color.copy(O.color).multiplyScalar(O.intensity*D),O.castShadow){const se=O.shadow,V=i.get(O);V.shadowBias=se.bias,V.shadowNormalBias=se.normalBias,V.shadowRadius=se.radius,V.shadowMapSize=se.mapSize,r.directionalShadow[_]=V,r.directionalShadowMap[_]=K,r.directionalShadowMatrix[_]=O.shadow.matrix,T++}r.directional[_]=Z,_++}else if(O.isSpotLight){const Z=n.get(O);Z.position.setFromMatrixPosition(O.matrixWorld),Z.color.copy(B).multiplyScalar(H*D),Z.distance=$,Z.coneCos=Math.cos(O.angle),Z.penumbraCos=Math.cos(O.angle*(1-O.penumbra)),Z.decay=O.decay,r.spot[x]=Z;const se=O.shadow;if(O.map&&(r.spotLightMap[A]=O.map,A++,se.updateMatrices(O),O.castShadow&&U++),r.spotLightMatrix[x]=se.matrix,O.castShadow){const V=i.get(O);V.shadowBias=se.bias,V.shadowNormalBias=se.normalBias,V.shadowRadius=se.radius,V.shadowMapSize=se.mapSize,r.spotShadow[x]=V,r.spotShadowMap[x]=K,P++}x++}else if(O.isRectAreaLight){const Z=n.get(O);Z.color.copy(B).multiplyScalar(H),Z.halfWidth.set(O.width*.5,0,0),Z.halfHeight.set(0,O.height*.5,0),r.rectArea[M]=Z,M++}else if(O.isPointLight){const Z=n.get(O);if(Z.color.copy(O.color).multiplyScalar(O.intensity*D),Z.distance=O.distance,Z.decay=O.decay,O.castShadow){const se=O.shadow,V=i.get(O);V.shadowBias=se.bias,V.shadowNormalBias=se.normalBias,V.shadowRadius=se.radius,V.shadowMapSize=se.mapSize,V.shadowCameraNear=se.camera.near,V.shadowCameraFar=se.camera.far,r.pointShadow[v]=V,r.pointShadowMap[v]=K,r.pointShadowMatrix[v]=O.shadow.matrix,C++}r.point[v]=Z,v++}else if(O.isHemisphereLight){const Z=n.get(O);Z.skyColor.copy(O.color).multiplyScalar(H*D),Z.groundColor.copy(O.groundColor).multiplyScalar(H*D),r.hemi[w]=Z,w++}}M>0&&(e.isWebGL2||t.has("OES_texture_float_linear")===!0?(r.rectAreaLTC1=yt.LTC_FLOAT_1,r.rectAreaLTC2=yt.LTC_FLOAT_2):t.has("OES_texture_half_float_linear")===!0?(r.rectAreaLTC1=yt.LTC_HALF_1,r.rectAreaLTC2=yt.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),r.ambient[0]=m,r.ambient[1]=g,r.ambient[2]=y;const F=r.hash;(F.directionalLength!==_||F.pointLength!==v||F.spotLength!==x||F.rectAreaLength!==M||F.hemiLength!==w||F.numDirectionalShadows!==T||F.numPointShadows!==C||F.numSpotShadows!==P||F.numSpotMaps!==A||F.numLightProbes!==N)&&(r.directional.length=_,r.spot.length=x,r.rectArea.length=M,r.point.length=v,r.hemi.length=w,r.directionalShadow.length=T,r.directionalShadowMap.length=T,r.pointShadow.length=C,r.pointShadowMap.length=C,r.spotShadow.length=P,r.spotShadowMap.length=P,r.directionalShadowMatrix.length=T,r.pointShadowMatrix.length=C,r.spotLightMatrix.length=P+A-U,r.spotLightMap.length=A,r.numSpotLightShadowsWithMaps=U,r.numLightProbes=N,F.directionalLength=_,F.pointLength=v,F.spotLength=x,F.rectAreaLength=M,F.hemiLength=w,F.numDirectionalShadows=T,F.numPointShadows=C,F.numSpotShadows=P,F.numSpotMaps=A,F.numLightProbes=N,r.version=$be++)}function c(d,f){let m=0,g=0,y=0,_=0,v=0;const x=f.matrixWorldInverse;for(let M=0,w=d.length;M<w;M++){const T=d[M];if(T.isDirectionalLight){const C=r.directional[m];C.direction.setFromMatrixPosition(T.matrixWorld),a.setFromMatrixPosition(T.target.matrixWorld),C.direction.sub(a),C.direction.transformDirection(x),m++}else if(T.isSpotLight){const C=r.spot[y];C.position.setFromMatrixPosition(T.matrixWorld),C.position.applyMatrix4(x),C.direction.setFromMatrixPosition(T.matrixWorld),a.setFromMatrixPosition(T.target.matrixWorld),C.direction.sub(a),C.direction.transformDirection(x),y++}else if(T.isRectAreaLight){const C=r.rectArea[_];C.position.setFromMatrixPosition(T.matrixWorld),C.position.applyMatrix4(x),o.identity(),s.copy(T.matrixWorld),s.premultiply(x),o.extractRotation(s),C.halfWidth.set(T.width*.5,0,0),C.halfHeight.set(0,T.height*.5,0),C.halfWidth.applyMatrix4(o),C.halfHeight.applyMatrix4(o),_++}else if(T.isPointLight){const C=r.point[g];C.position.setFromMatrixPosition(T.matrixWorld),C.position.applyMatrix4(x),g++}else if(T.isHemisphereLight){const C=r.hemi[v];C.direction.setFromMatrixPosition(T.matrixWorld),C.direction.transformDirection(x),v++}}}return{setup:l,setupView:c,state:r}}function y5(t,e){const n=new Wbe(t,e),i=[],r=[];function a(){i.length=0,r.length=0}function s(f){i.push(f)}function o(f){r.push(f)}function l(f){n.setup(i,f)}function c(f){n.setupView(i,f)}return{init:a,state:{lightsArray:i,shadowsArray:r,lights:n},setupLights:l,setupLightsView:c,pushLight:s,pushShadow:o}}function qbe(t,e){let n=new WeakMap;function i(a,s=0){const o=n.get(a);let l;return o===void 0?(l=new y5(t,e),n.set(a,[l])):s>=o.length?(l=new y5(t,e),o.push(l)):l=o[s],l}function r(){n=new WeakMap}return{get:i,dispose:r}}class Xbe extends gm{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=kge,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 Kbe extends gm{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 Ybe=`void main() {
  7369. gl_Position = vec4( position, 1.0 );
  7370. }`,Zbe=`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 Qbe(t,e,n){let i=new ZS;const r=new Wt,a=new Wt,s=new $n,o=new Xbe({depthPacking:Oge}),l=new Kbe,c={},d=n.maxTextureSize,f={[qu]:Ua,[Ua]:qu,[Gl]:Gl},m=new Xu({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Wt},radius:{value:4}},vertexShader:Ybe,fragmentShader:Zbe}),g=m.clone();g.defines.HORIZONTAL_PASS=1;const y=new ra;y.setAttribute("position",new us(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const _=new go(y,m),v=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=G9;let x=this.type;this.render=function(C,P,A){if(v.enabled===!1||v.autoUpdate===!1&&v.needsUpdate===!1||C.length===0)return;const U=t.getRenderTarget(),N=t.getActiveCubeFace(),D=t.getActiveMipmapLevel(),F=t.state;F.setBlending(Iu),F.buffers.color.setClear(1,1,1,1),F.buffers.depth.setTest(!0),F.setScissorTest(!1);const I=x!==Bl&&this.type===Bl,W=x===Bl&&this.type!==Bl;for(let O=0,B=C.length;O<B;O++){const H=C[O],$=H.shadow;if($===void 0){console.warn("THREE.WebGLShadowMap:",H,"has no shadow.");continue}if($.autoUpdate===!1&&$.needsUpdate===!1)continue;r.copy($.mapSize);const K=$.getFrameExtents();if(r.multiply(K),a.copy($.mapSize),(r.x>d||r.y>d)&&(r.x>d&&(a.x=Math.floor(d/K.x),r.x=a.x*K.x,$.mapSize.x=a.x),r.y>d&&(a.y=Math.floor(d/K.y),r.y=a.y*K.y,$.mapSize.y=a.y)),$.map===null||I===!0||W===!0){const se=this.type!==Bl?{minFilter:zr,magFilter:zr}:{};$.map!==null&&$.map.dispose(),$.map=new Af(r.x,r.y,se),$.map.texture.name=H.name+".shadowMap",$.camera.updateProjectionMatrix()}t.setRenderTarget($.map),t.clear();const Z=$.getViewportCount();for(let se=0;se<Z;se++){const V=$.getViewport(se);s.set(a.x*V.x,a.y*V.y,a.x*V.z,a.y*V.w),F.viewport(s),$.updateMatrices(H,se),i=$.getFrustum(),T(P,A,$.camera,H,this.type)}$.isPointLightShadow!==!0&&this.type===Bl&&M($,A),$.needsUpdate=!1}x=this.type,v.needsUpdate=!1,t.setRenderTarget(U,N,D)};function M(C,P){const A=e.update(_);m.defines.VSM_SAMPLES!==C.blurSamples&&(m.defines.VSM_SAMPLES=C.blurSamples,g.defines.VSM_SAMPLES=C.blurSamples,m.needsUpdate=!0,g.needsUpdate=!0),C.mapPass===null&&(C.mapPass=new Af(r.x,r.y)),m.uniforms.shadow_pass.value=C.map.texture,m.uniforms.resolution.value=C.mapSize,m.uniforms.radius.value=C.radius,t.setRenderTarget(C.mapPass),t.clear(),t.renderBufferDirect(P,null,A,m,_,null),g.uniforms.shadow_pass.value=C.mapPass.texture,g.uniforms.resolution.value=C.mapSize,g.uniforms.radius.value=C.radius,t.setRenderTarget(C.map),t.clear(),t.renderBufferDirect(P,null,A,g,_,null)}function w(C,P,A,U){let N=null;const D=A.isPointLight===!0?C.customDistanceMaterial:C.customDepthMaterial;if(D!==void 0)N=D;else if(N=A.isPointLight===!0?l:o,t.localClippingEnabled&&P.clipShadows===!0&&Array.isArray(P.clippingPlanes)&&P.clippingPlanes.length!==0||P.displacementMap&&P.displacementScale!==0||P.alphaMap&&P.alphaTest>0||P.map&&P.alphaTest>0){const F=N.uuid,I=P.uuid;let W=c[F];W===void 0&&(W={},c[F]=W);let O=W[I];O===void 0&&(O=N.clone(),W[I]=O),N=O}if(N.visible=P.visible,N.wireframe=P.wireframe,U===Bl?N.side=P.shadowSide!==null?P.shadowSide:P.side:N.side=P.shadowSide!==null?P.shadowSide:f[P.side],N.alphaMap=P.alphaMap,N.alphaTest=P.alphaTest,N.map=P.map,N.clipShadows=P.clipShadows,N.clippingPlanes=P.clippingPlanes,N.clipIntersection=P.clipIntersection,N.displacementMap=P.displacementMap,N.displacementScale=P.displacementScale,N.displacementBias=P.displacementBias,N.wireframeLinewidth=P.wireframeLinewidth,N.linewidth=P.linewidth,A.isPointLight===!0&&N.isMeshDistanceMaterial===!0){const F=t.properties.get(N);F.light=A}return N}function T(C,P,A,U,N){if(C.visible===!1)return;if(C.layers.test(P.layers)&&(C.isMesh||C.isLine||C.isPoints)&&(C.castShadow||C.receiveShadow&&N===Bl)&&(!C.frustumCulled||i.intersectsObject(C))){C.modelViewMatrix.multiplyMatrices(A.matrixWorldInverse,C.matrixWorld);const I=e.update(C),W=C.material;if(Array.isArray(W)){const O=I.groups;for(let B=0,H=O.length;B<H;B++){const $=O[B],K=W[$.materialIndex];if(K&&K.visible){const Z=w(C,K,U,N);C.onBeforeShadow(t,C,P,A,I,Z,$),t.renderBufferDirect(A,null,I,Z,C,$),C.onAfterShadow(t,C,P,A,I,Z,$)}}}else if(W.visible){const O=w(C,W,U,N);C.onBeforeShadow(t,C,P,A,I,O,null),t.renderBufferDirect(A,null,I,O,C,null),C.onAfterShadow(t,C,P,A,I,O,null)}}const F=C.children;for(let I=0,W=F.length;I<W;I++)T(F[I],P,A,U,N)}}function Jbe(t,e,n){const i=n.isWebGL2;function r(){let fe=!1;const Oe=new $n;let Me=null;const xe=new $n(0,0,0,0);return{setMask:function(Be){Me!==Be&&!fe&&(t.colorMask(Be,Be,Be,Be),Me=Be)},setLocked:function(Be){fe=Be},setClear:function(Be,ct,bt,Nt,on){on===!0&&(Be*=Nt,ct*=Nt,bt*=Nt),Oe.set(Be,ct,bt,Nt),xe.equals(Oe)===!1&&(t.clearColor(Be,ct,bt,Nt),xe.copy(Oe))},reset:function(){fe=!1,Me=null,xe.set(-1,0,0,0)}}}function a(){let fe=!1,Oe=null,Me=null,xe=null;return{setTest:function(Be){Be?he(t.DEPTH_TEST):we(t.DEPTH_TEST)},setMask:function(Be){Oe!==Be&&!fe&&(t.depthMask(Be),Oe=Be)},setFunc:function(Be){if(Me!==Be){switch(Be){case uge:t.depthFunc(t.NEVER);break;case dge:t.depthFunc(t.ALWAYS);break;case fge:t.depthFunc(t.LESS);break;case $_:t.depthFunc(t.LEQUAL);break;case hge:t.depthFunc(t.EQUAL);break;case pge:t.depthFunc(t.GEQUAL);break;case mge:t.depthFunc(t.GREATER);break;case gge:t.depthFunc(t.NOTEQUAL);break;default:t.depthFunc(t.LEQUAL)}Me=Be}},setLocked:function(Be){fe=Be},setClear:function(Be){xe!==Be&&(t.clearDepth(Be),xe=Be)},reset:function(){fe=!1,Oe=null,Me=null,xe=null}}}function s(){let fe=!1,Oe=null,Me=null,xe=null,Be=null,ct=null,bt=null,Nt=null,on=null;return{setTest:function(Dt){fe||(Dt?he(t.STENCIL_TEST):we(t.STENCIL_TEST))},setMask:function(Dt){Oe!==Dt&&!fe&&(t.stencilMask(Dt),Oe=Dt)},setFunc:function(Dt,Rn,Wn){(Me!==Dt||xe!==Rn||Be!==Wn)&&(t.stencilFunc(Dt,Rn,Wn),Me=Dt,xe=Rn,Be=Wn)},setOp:function(Dt,Rn,Wn){(ct!==Dt||bt!==Rn||Nt!==Wn)&&(t.stencilOp(Dt,Rn,Wn),ct=Dt,bt=Rn,Nt=Wn)},setLocked:function(Dt){fe=Dt},setClear:function(Dt){on!==Dt&&(t.clearStencil(Dt),on=Dt)},reset:function(){fe=!1,Oe=null,Me=null,xe=null,Be=null,ct=null,bt=null,Nt=null,on=null}}}const o=new r,l=new a,c=new s,d=new WeakMap,f=new WeakMap;let m={},g={},y=new WeakMap,_=[],v=null,x=!1,M=null,w=null,T=null,C=null,P=null,A=null,U=null,N=new zt(0,0,0),D=0,F=!1,I=null,W=null,O=null,B=null,H=null;const $=t.getParameter(t.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let K=!1,Z=0;const se=t.getParameter(t.VERSION);se.indexOf("WebGL")!==-1?(Z=parseFloat(/^WebGL (\d)/.exec(se)[1]),K=Z>=1):se.indexOf("OpenGL ES")!==-1&&(Z=parseFloat(/^OpenGL ES (\d)/.exec(se)[1]),K=Z>=2);let V=null,X={};const ae=t.getParameter(t.SCISSOR_BOX),ce=t.getParameter(t.VIEWPORT),ge=new $n().fromArray(ae),ne=new $n().fromArray(ce);function ve(fe,Oe,Me,xe){const Be=new Uint8Array(4),ct=t.createTexture();t.bindTexture(fe,ct),t.texParameteri(fe,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(fe,t.TEXTURE_MAG_FILTER,t.NEAREST);for(let bt=0;bt<Me;bt++)i&&(fe===t.TEXTURE_3D||fe===t.TEXTURE_2D_ARRAY)?t.texImage3D(Oe,0,t.RGBA,1,1,xe,0,t.RGBA,t.UNSIGNED_BYTE,Be):t.texImage2D(Oe+bt,0,t.RGBA,1,1,0,t.RGBA,t.UNSIGNED_BYTE,Be);return ct}const Pe={};Pe[t.TEXTURE_2D]=ve(t.TEXTURE_2D,t.TEXTURE_2D,1),Pe[t.TEXTURE_CUBE_MAP]=ve(t.TEXTURE_CUBE_MAP,t.TEXTURE_CUBE_MAP_POSITIVE_X,6),i&&(Pe[t.TEXTURE_2D_ARRAY]=ve(t.TEXTURE_2D_ARRAY,t.TEXTURE_2D_ARRAY,1,1),Pe[t.TEXTURE_3D]=ve(t.TEXTURE_3D,t.TEXTURE_3D,1,1)),o.setClear(0,0,0,1),l.setClear(1),c.setClear(0),he(t.DEPTH_TEST),l.setFunc($_),ee(!1),oe(tz),he(t.CULL_FACE),re(Iu);function he(fe){m[fe]!==!0&&(t.enable(fe),m[fe]=!0)}function we(fe){m[fe]!==!1&&(t.disable(fe),m[fe]=!1)}function je(fe,Oe){return g[fe]!==Oe?(t.bindFramebuffer(fe,Oe),g[fe]=Oe,i&&(fe===t.DRAW_FRAMEBUFFER&&(g[t.FRAMEBUFFER]=Oe),fe===t.FRAMEBUFFER&&(g[t.DRAW_FRAMEBUFFER]=Oe)),!0):!1}function ue(fe,Oe){let Me=_,xe=!1;if(fe)if(Me=y.get(Oe),Me===void 0&&(Me=[],y.set(Oe,Me)),fe.isWebGLMultipleRenderTargets){const Be=fe.texture;if(Me.length!==Be.length||Me[0]!==t.COLOR_ATTACHMENT0){for(let ct=0,bt=Be.length;ct<bt;ct++)Me[ct]=t.COLOR_ATTACHMENT0+ct;Me.length=Be.length,xe=!0}}else Me[0]!==t.COLOR_ATTACHMENT0&&(Me[0]=t.COLOR_ATTACHMENT0,xe=!0);else Me[0]!==t.BACK&&(Me[0]=t.BACK,xe=!0);xe&&(n.isWebGL2?t.drawBuffers(Me):e.get("WEBGL_draw_buffers").drawBuffersWEBGL(Me))}function lt(fe){return v!==fe?(t.useProgram(fe),v=fe,!0):!1}const z={[Gd]:t.FUNC_ADD,[Kme]:t.FUNC_SUBTRACT,[Yme]:t.FUNC_REVERSE_SUBTRACT};if(i)z[az]=t.MIN,z[sz]=t.MAX;else{const fe=e.get("EXT_blend_minmax");fe!==null&&(z[az]=fe.MIN_EXT,z[sz]=fe.MAX_EXT)}const q={[Zme]:t.ZERO,[Qme]:t.ONE,[Jme]:t.SRC_COLOR,[h3]:t.SRC_ALPHA,[age]:t.SRC_ALPHA_SATURATE,[ige]:t.DST_COLOR,[tge]:t.DST_ALPHA,[ege]:t.ONE_MINUS_SRC_COLOR,[p3]:t.ONE_MINUS_SRC_ALPHA,[rge]:t.ONE_MINUS_DST_COLOR,[nge]:t.ONE_MINUS_DST_ALPHA,[sge]:t.CONSTANT_COLOR,[oge]:t.ONE_MINUS_CONSTANT_COLOR,[lge]:t.CONSTANT_ALPHA,[cge]:t.ONE_MINUS_CONSTANT_ALPHA};function re(fe,Oe,Me,xe,Be,ct,bt,Nt,on,Dt){if(fe===Iu){x===!0&&(we(t.BLEND),x=!1);return}if(x===!1&&(he(t.BLEND),x=!0),fe!==Xme){if(fe!==M||Dt!==F){if((w!==Gd||P!==Gd)&&(t.blendEquation(t.FUNC_ADD),w=Gd,P=Gd),Dt)switch(fe){case Tp:t.blendFuncSeparate(t.ONE,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA);break;case nz:t.blendFunc(t.ONE,t.ONE);break;case iz:t.blendFuncSeparate(t.ZERO,t.ONE_MINUS_SRC_COLOR,t.ZERO,t.ONE);break;case rz:t.blendFuncSeparate(t.ZERO,t.SRC_COLOR,t.ZERO,t.SRC_ALPHA);break;default:console.error("THREE.WebGLState: Invalid blending: ",fe);break}else switch(fe){case Tp:t.blendFuncSeparate(t.SRC_ALPHA,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA);break;case nz:t.blendFunc(t.SRC_ALPHA,t.ONE);break;case iz:t.blendFuncSeparate(t.ZERO,t.ONE_MINUS_SRC_COLOR,t.ZERO,t.ONE);break;case rz:t.blendFunc(t.ZERO,t.SRC_COLOR);break;default:console.error("THREE.WebGLState: Invalid blending: ",fe);break}T=null,C=null,A=null,U=null,N.set(0,0,0),D=0,M=fe,F=Dt}return}Be=Be||Oe,ct=ct||Me,bt=bt||xe,(Oe!==w||Be!==P)&&(t.blendEquationSeparate(z[Oe],z[Be]),w=Oe,P=Be),(Me!==T||xe!==C||ct!==A||bt!==U)&&(t.blendFuncSeparate(q[Me],q[xe],q[ct],q[bt]),T=Me,C=xe,A=ct,U=bt),(Nt.equals(N)===!1||on!==D)&&(t.blendColor(Nt.r,Nt.g,Nt.b,on),N.copy(Nt),D=on),M=fe,F=!1}function J(fe,Oe){fe.side===Gl?we(t.CULL_FACE):he(t.CULL_FACE);let Me=fe.side===Ua;Oe&&(Me=!Me),ee(Me),fe.blending===Tp&&fe.transparent===!1?re(Iu):re(fe.blending,fe.blendEquation,fe.blendSrc,fe.blendDst,fe.blendEquationAlpha,fe.blendSrcAlpha,fe.blendDstAlpha,fe.blendColor,fe.blendAlpha,fe.premultipliedAlpha),l.setFunc(fe.depthFunc),l.setTest(fe.depthTest),l.setMask(fe.depthWrite),o.setMask(fe.colorWrite);const xe=fe.stencilWrite;c.setTest(xe),xe&&(c.setMask(fe.stencilWriteMask),c.setFunc(fe.stencilFunc,fe.stencilRef,fe.stencilFuncMask),c.setOp(fe.stencilFail,fe.stencilZFail,fe.stencilZPass)),Ne(fe.polygonOffset,fe.polygonOffsetFactor,fe.polygonOffsetUnits),fe.alphaToCoverage===!0?he(t.SAMPLE_ALPHA_TO_COVERAGE):we(t.SAMPLE_ALPHA_TO_COVERAGE)}function ee(fe){I!==fe&&(fe?t.frontFace(t.CW):t.frontFace(t.CCW),I=fe)}function oe(fe){fe!==Gme?(he(t.CULL_FACE),fe!==W&&(fe===tz?t.cullFace(t.BACK):fe===Wme?t.cullFace(t.FRONT):t.cullFace(t.FRONT_AND_BACK))):we(t.CULL_FACE),W=fe}function De(fe){fe!==O&&(K&&t.lineWidth(fe),O=fe)}function Ne(fe,Oe,Me){fe?(he(t.POLYGON_OFFSET_FILL),(B!==Oe||H!==Me)&&(t.polygonOffset(Oe,Me),B=Oe,H=Me)):we(t.POLYGON_OFFSET_FILL)}function te(fe){fe?he(t.SCISSOR_TEST):we(t.SCISSOR_TEST)}function j(fe){fe===void 0&&(fe=t.TEXTURE0+$-1),V!==fe&&(t.activeTexture(fe),V=fe)}function L(fe,Oe,Me){Me===void 0&&(V===null?Me=t.TEXTURE0+$-1:Me=V);let xe=X[Me];xe===void 0&&(xe={type:void 0,texture:void 0},X[Me]=xe),(xe.type!==fe||xe.texture!==Oe)&&(V!==Me&&(t.activeTexture(Me),V=Me),t.bindTexture(fe,Oe||Pe[fe]),xe.type=fe,xe.texture=Oe)}function Y(){const fe=X[V];fe!==void 0&&fe.type!==void 0&&(t.bindTexture(fe.type,null),fe.type=void 0,fe.texture=void 0)}function me(){try{t.compressedTexImage2D.apply(t,arguments)}catch(fe){console.error("THREE.WebGLState:",fe)}}function ye(){try{t.compressedTexImage3D.apply(t,arguments)}catch(fe){console.error("THREE.WebGLState:",fe)}}function pe(){try{t.texSubImage2D.apply(t,arguments)}catch(fe){console.error("THREE.WebGLState:",fe)}}function Ze(){try{t.texSubImage3D.apply(t,arguments)}catch(fe){console.error("THREE.WebGLState:",fe)}}function Le(){try{t.compressedTexSubImage2D.apply(t,arguments)}catch(fe){console.error("THREE.WebGLState:",fe)}}function qe(){try{t.compressedTexSubImage3D.apply(t,arguments)}catch(fe){console.error("THREE.WebGLState:",fe)}}function at(){try{t.texStorage2D.apply(t,arguments)}catch(fe){console.error("THREE.WebGLState:",fe)}}function Ie(){try{t.texStorage3D.apply(t,arguments)}catch(fe){console.error("THREE.WebGLState:",fe)}}function Re(){try{t.texImage2D.apply(t,arguments)}catch(fe){console.error("THREE.WebGLState:",fe)}}function pt(){try{t.texImage3D.apply(t,arguments)}catch(fe){console.error("THREE.WebGLState:",fe)}}function nt(fe){ge.equals(fe)===!1&&(t.scissor(fe.x,fe.y,fe.z,fe.w),ge.copy(fe))}function tt(fe){ne.equals(fe)===!1&&(t.viewport(fe.x,fe.y,fe.z,fe.w),ne.copy(fe))}function ut(fe,Oe){let Me=f.get(Oe);Me===void 0&&(Me=new WeakMap,f.set(Oe,Me));let xe=Me.get(fe);xe===void 0&&(xe=t.getUniformBlockIndex(Oe,fe.name),Me.set(fe,xe))}function de(fe,Oe){const xe=f.get(Oe).get(fe);d.get(Oe)!==xe&&(t.uniformBlockBinding(Oe,xe,fe.__bindingPointIndex),d.set(Oe,xe))}function it(){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),m={},V=null,X={},g={},y=new WeakMap,_=[],v=null,x=!1,M=null,w=null,T=null,C=null,P=null,A=null,U=null,N=new zt(0,0,0),D=0,F=!1,I=null,W=null,O=null,B=null,H=null,ge.set(0,0,t.canvas.width,t.canvas.height),ne.set(0,0,t.canvas.width,t.canvas.height),o.reset(),l.reset(),c.reset()}return{buffers:{color:o,depth:l,stencil:c},enable:he,disable:we,bindFramebuffer:je,drawBuffers:ue,useProgram:lt,setBlending:re,setMaterial:J,setFlipSided:ee,setCullFace:oe,setLineWidth:De,setPolygonOffset:Ne,setScissorTest:te,activeTexture:j,bindTexture:L,unbindTexture:Y,compressedTexImage2D:me,compressedTexImage3D:ye,texImage2D:Re,texImage3D:pt,updateUBOMapping:ut,uniformBlockBinding:de,texStorage2D:at,texStorage3D:Ie,texSubImage2D:pe,texSubImage3D:Ze,compressedTexSubImage2D:Le,compressedTexSubImage3D:qe,scissor:nt,viewport:tt,reset:it}}function e_e(t,e,n,i,r,a,s){const o=r.isWebGL2,l=r.maxTextures,c=r.maxCubemapSize,d=r.maxTextureSize,f=r.maxSamples,m=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,g=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),y=new WeakMap;let _;const v=new WeakMap;let x=!1;try{x=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function M(j,L){return x?new OffscreenCanvas(j,L):K_("canvas")}function w(j,L,Y,me){let ye=1;if((j.width>me||j.height>me)&&(ye=me/Math.max(j.width,j.height)),ye<1||L===!0)if(typeof HTMLImageElement<"u"&&j instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&j instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&j instanceof ImageBitmap){const pe=L?X_:Math.floor,Ze=pe(ye*j.width),Le=pe(ye*j.height);_===void 0&&(_=M(Ze,Le));const qe=Y?M(Ze,Le):_;return qe.width=Ze,qe.height=Le,qe.getContext("2d").drawImage(j,0,0,Ze,Le),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+j.width+"x"+j.height+") to ("+Ze+"x"+Le+")."),qe}else return"data"in j&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+j.width+"x"+j.height+")."),j;return j}function T(j){return _3(j.width)&&_3(j.height)}function C(j){return o?!1:j.wrapS!==co||j.wrapT!==co||j.minFilter!==zr&&j.minFilter!==Is}function P(j,L){return j.generateMipmaps&&L&&j.minFilter!==zr&&j.minFilter!==Is}function A(j){t.generateMipmap(j)}function U(j,L,Y,me,ye=!1){if(o===!1)return L;if(j!==null){if(t[j]!==void 0)return t[j];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+j+"'")}let pe=L;if(L===t.RED&&(Y===t.FLOAT&&(pe=t.R32F),Y===t.HALF_FLOAT&&(pe=t.R16F),Y===t.UNSIGNED_BYTE&&(pe=t.R8)),L===t.RED_INTEGER&&(Y===t.UNSIGNED_BYTE&&(pe=t.R8UI),Y===t.UNSIGNED_SHORT&&(pe=t.R16UI),Y===t.UNSIGNED_INT&&(pe=t.R32UI),Y===t.BYTE&&(pe=t.R8I),Y===t.SHORT&&(pe=t.R16I),Y===t.INT&&(pe=t.R32I)),L===t.RG&&(Y===t.FLOAT&&(pe=t.RG32F),Y===t.HALF_FLOAT&&(pe=t.RG16F),Y===t.UNSIGNED_BYTE&&(pe=t.RG8)),L===t.RGBA){const Ze=ye?G_:Hn.getTransfer(me);Y===t.FLOAT&&(pe=t.RGBA32F),Y===t.HALF_FLOAT&&(pe=t.RGBA16F),Y===t.UNSIGNED_BYTE&&(pe=Ze===ii?t.SRGB8_ALPHA8:t.RGBA8),Y===t.UNSIGNED_SHORT_4_4_4_4&&(pe=t.RGBA4),Y===t.UNSIGNED_SHORT_5_5_5_1&&(pe=t.RGB5_A1)}return(pe===t.R16F||pe===t.R32F||pe===t.RG16F||pe===t.RG32F||pe===t.RGBA16F||pe===t.RGBA32F)&&e.get("EXT_color_buffer_float"),pe}function N(j,L,Y){return P(j,Y)===!0||j.isFramebufferTexture&&j.minFilter!==zr&&j.minFilter!==Is?Math.log2(Math.max(L.width,L.height))+1:j.mipmaps!==void 0&&j.mipmaps.length>0?j.mipmaps.length:j.isCompressedTexture&&Array.isArray(j.image)?L.mipmaps.length:1}function D(j){return j===zr||j===oz||j===rT?t.NEAREST:t.LINEAR}function F(j){const L=j.target;L.removeEventListener("dispose",F),W(L),L.isVideoTexture&&y.delete(L)}function I(j){const L=j.target;L.removeEventListener("dispose",I),B(L)}function W(j){const L=i.get(j);if(L.__webglInit===void 0)return;const Y=j.source,me=v.get(Y);if(me){const ye=me[L.__cacheKey];ye.usedTimes--,ye.usedTimes===0&&O(j),Object.keys(me).length===0&&v.delete(Y)}i.remove(j)}function O(j){const L=i.get(j);t.deleteTexture(L.__webglTexture);const Y=j.source,me=v.get(Y);delete me[L.__cacheKey],s.memory.textures--}function B(j){const L=j.texture,Y=i.get(j),me=i.get(L);if(me.__webglTexture!==void 0&&(t.deleteTexture(me.__webglTexture),s.memory.textures--),j.depthTexture&&j.depthTexture.dispose(),j.isWebGLCubeRenderTarget)for(let ye=0;ye<6;ye++){if(Array.isArray(Y.__webglFramebuffer[ye]))for(let pe=0;pe<Y.__webglFramebuffer[ye].length;pe++)t.deleteFramebuffer(Y.__webglFramebuffer[ye][pe]);else t.deleteFramebuffer(Y.__webglFramebuffer[ye]);Y.__webglDepthbuffer&&t.deleteRenderbuffer(Y.__webglDepthbuffer[ye])}else{if(Array.isArray(Y.__webglFramebuffer))for(let ye=0;ye<Y.__webglFramebuffer.length;ye++)t.deleteFramebuffer(Y.__webglFramebuffer[ye]);else t.deleteFramebuffer(Y.__webglFramebuffer);if(Y.__webglDepthbuffer&&t.deleteRenderbuffer(Y.__webglDepthbuffer),Y.__webglMultisampledFramebuffer&&t.deleteFramebuffer(Y.__webglMultisampledFramebuffer),Y.__webglColorRenderbuffer)for(let ye=0;ye<Y.__webglColorRenderbuffer.length;ye++)Y.__webglColorRenderbuffer[ye]&&t.deleteRenderbuffer(Y.__webglColorRenderbuffer[ye]);Y.__webglDepthRenderbuffer&&t.deleteRenderbuffer(Y.__webglDepthRenderbuffer)}if(j.isWebGLMultipleRenderTargets)for(let ye=0,pe=L.length;ye<pe;ye++){const Ze=i.get(L[ye]);Ze.__webglTexture&&(t.deleteTexture(Ze.__webglTexture),s.memory.textures--),i.remove(L[ye])}i.remove(L),i.remove(j)}let H=0;function $(){H=0}function K(){const j=H;return j>=l&&console.warn("THREE.WebGLTextures: Trying to use "+j+" texture units while this GPU supports only "+l),H+=1,j}function Z(j){const L=[];return L.push(j.wrapS),L.push(j.wrapT),L.push(j.wrapR||0),L.push(j.magFilter),L.push(j.minFilter),L.push(j.anisotropy),L.push(j.internalFormat),L.push(j.format),L.push(j.type),L.push(j.generateMipmaps),L.push(j.premultiplyAlpha),L.push(j.flipY),L.push(j.unpackAlignment),L.push(j.colorSpace),L.join()}function se(j,L){const Y=i.get(j);if(j.isVideoTexture&&Ne(j),j.isRenderTargetTexture===!1&&j.version>0&&Y.__version!==j.version){const me=j.image;if(me===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(me.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{he(Y,j,L);return}}n.bindTexture(t.TEXTURE_2D,Y.__webglTexture,t.TEXTURE0+L)}function V(j,L){const Y=i.get(j);if(j.version>0&&Y.__version!==j.version){he(Y,j,L);return}n.bindTexture(t.TEXTURE_2D_ARRAY,Y.__webglTexture,t.TEXTURE0+L)}function X(j,L){const Y=i.get(j);if(j.version>0&&Y.__version!==j.version){he(Y,j,L);return}n.bindTexture(t.TEXTURE_3D,Y.__webglTexture,t.TEXTURE0+L)}function ae(j,L){const Y=i.get(j);if(j.version>0&&Y.__version!==j.version){we(Y,j,L);return}n.bindTexture(t.TEXTURE_CUBE_MAP,Y.__webglTexture,t.TEXTURE0+L)}const ce={[x3]:t.REPEAT,[co]:t.CLAMP_TO_EDGE,[v3]:t.MIRRORED_REPEAT},ge={[zr]:t.NEAREST,[oz]:t.NEAREST_MIPMAP_NEAREST,[rT]:t.NEAREST_MIPMAP_LINEAR,[Is]:t.LINEAR,[Mge]:t.LINEAR_MIPMAP_NEAREST,[G0]:t.LINEAR_MIPMAP_LINEAR},ne={[Ige]:t.NEVER,[Hge]:t.ALWAYS,[Uge]:t.LESS,[n7]:t.LEQUAL,[jge]:t.EQUAL,[Bge]:t.GEQUAL,[Fge]:t.GREATER,[zge]:t.NOTEQUAL};function ve(j,L,Y){if(Y?(t.texParameteri(j,t.TEXTURE_WRAP_S,ce[L.wrapS]),t.texParameteri(j,t.TEXTURE_WRAP_T,ce[L.wrapT]),(j===t.TEXTURE_3D||j===t.TEXTURE_2D_ARRAY)&&t.texParameteri(j,t.TEXTURE_WRAP_R,ce[L.wrapR]),t.texParameteri(j,t.TEXTURE_MAG_FILTER,ge[L.magFilter]),t.texParameteri(j,t.TEXTURE_MIN_FILTER,ge[L.minFilter])):(t.texParameteri(j,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(j,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),(j===t.TEXTURE_3D||j===t.TEXTURE_2D_ARRAY)&&t.texParameteri(j,t.TEXTURE_WRAP_R,t.CLAMP_TO_EDGE),(L.wrapS!==co||L.wrapT!==co)&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),t.texParameteri(j,t.TEXTURE_MAG_FILTER,D(L.magFilter)),t.texParameteri(j,t.TEXTURE_MIN_FILTER,D(L.minFilter)),L.minFilter!==zr&&L.minFilter!==Is&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),L.compareFunction&&(t.texParameteri(j,t.TEXTURE_COMPARE_MODE,t.COMPARE_REF_TO_TEXTURE),t.texParameteri(j,t.TEXTURE_COMPARE_FUNC,ne[L.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){const me=e.get("EXT_texture_filter_anisotropic");if(L.magFilter===zr||L.minFilter!==rT&&L.minFilter!==G0||L.type===Zl&&e.has("OES_texture_float_linear")===!1||o===!1&&L.type===W0&&e.has("OES_texture_half_float_linear")===!1)return;(L.anisotropy>1||i.get(L).__currentAnisotropy)&&(t.texParameterf(j,me.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(L.anisotropy,r.getMaxAnisotropy())),i.get(L).__currentAnisotropy=L.anisotropy)}}function Pe(j,L){let Y=!1;j.__webglInit===void 0&&(j.__webglInit=!0,L.addEventListener("dispose",F));const me=L.source;let ye=v.get(me);ye===void 0&&(ye={},v.set(me,ye));const pe=Z(L);if(pe!==j.__cacheKey){ye[pe]===void 0&&(ye[pe]={texture:t.createTexture(),usedTimes:0},s.memory.textures++,Y=!0),ye[pe].usedTimes++;const Ze=ye[j.__cacheKey];Ze!==void 0&&(ye[j.__cacheKey].usedTimes--,Ze.usedTimes===0&&O(L)),j.__cacheKey=pe,j.__webglTexture=ye[pe].texture}return Y}function he(j,L,Y){let me=t.TEXTURE_2D;(L.isDataArrayTexture||L.isCompressedArrayTexture)&&(me=t.TEXTURE_2D_ARRAY),L.isData3DTexture&&(me=t.TEXTURE_3D);const ye=Pe(j,L),pe=L.source;n.bindTexture(me,j.__webglTexture,t.TEXTURE0+Y);const Ze=i.get(pe);if(pe.version!==Ze.__version||ye===!0){n.activeTexture(t.TEXTURE0+Y);const Le=Hn.getPrimaries(Hn.workingColorSpace),qe=L.colorSpace===js?null:Hn.getPrimaries(L.colorSpace),at=L.colorSpace===js||Le===qe?t.NONE:t.BROWSER_DEFAULT_WEBGL;t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,L.flipY),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,L.premultiplyAlpha),t.pixelStorei(t.UNPACK_ALIGNMENT,L.unpackAlignment),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,at);const Ie=C(L)&&T(L.image)===!1;let Re=w(L.image,Ie,!1,d);Re=te(L,Re);const pt=T(Re)||o,nt=a.convert(L.format,L.colorSpace);let tt=a.convert(L.type),ut=U(L.internalFormat,nt,tt,L.colorSpace,L.isVideoTexture);ve(me,L,pt);let de;const it=L.mipmaps,fe=o&&L.isVideoTexture!==!0&&ut!==J9,Oe=Ze.__version===void 0||ye===!0,Me=N(L,Re,pt);if(L.isDepthTexture)ut=t.DEPTH_COMPONENT,o?L.type===Zl?ut=t.DEPTH_COMPONENT32F:L.type===Nu?ut=t.DEPTH_COMPONENT24:L.type===af?ut=t.DEPTH24_STENCIL8:ut=t.DEPTH_COMPONENT16:L.type===Zl&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),L.format===sf&&ut===t.DEPTH_COMPONENT&&L.type!==KP&&L.type!==Nu&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),L.type=Nu,tt=a.convert(L.type)),L.format===$p&&ut===t.DEPTH_COMPONENT&&(ut=t.DEPTH_STENCIL,L.type!==af&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),L.type=af,tt=a.convert(L.type))),Oe&&(fe?n.texStorage2D(t.TEXTURE_2D,1,ut,Re.width,Re.height):n.texImage2D(t.TEXTURE_2D,0,ut,Re.width,Re.height,0,nt,tt,null));else if(L.isDataTexture)if(it.length>0&&pt){fe&&Oe&&n.texStorage2D(t.TEXTURE_2D,Me,ut,it[0].width,it[0].height);for(let xe=0,Be=it.length;xe<Be;xe++)de=it[xe],fe?n.texSubImage2D(t.TEXTURE_2D,xe,0,0,de.width,de.height,nt,tt,de.data):n.texImage2D(t.TEXTURE_2D,xe,ut,de.width,de.height,0,nt,tt,de.data);L.generateMipmaps=!1}else fe?(Oe&&n.texStorage2D(t.TEXTURE_2D,Me,ut,Re.width,Re.height),n.texSubImage2D(t.TEXTURE_2D,0,0,0,Re.width,Re.height,nt,tt,Re.data)):n.texImage2D(t.TEXTURE_2D,0,ut,Re.width,Re.height,0,nt,tt,Re.data);else if(L.isCompressedTexture)if(L.isCompressedArrayTexture){fe&&Oe&&n.texStorage3D(t.TEXTURE_2D_ARRAY,Me,ut,it[0].width,it[0].height,Re.depth);for(let xe=0,Be=it.length;xe<Be;xe++)de=it[xe],L.format!==Us?nt!==null?fe?n.compressedTexSubImage3D(t.TEXTURE_2D_ARRAY,xe,0,0,0,de.width,de.height,Re.depth,nt,de.data,0,0):n.compressedTexImage3D(t.TEXTURE_2D_ARRAY,xe,ut,de.width,de.height,Re.depth,0,de.data,0,0):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):fe?n.texSubImage3D(t.TEXTURE_2D_ARRAY,xe,0,0,0,de.width,de.height,Re.depth,nt,tt,de.data):n.texImage3D(t.TEXTURE_2D_ARRAY,xe,ut,de.width,de.height,Re.depth,0,nt,tt,de.data)}else{fe&&Oe&&n.texStorage2D(t.TEXTURE_2D,Me,ut,it[0].width,it[0].height);for(let xe=0,Be=it.length;xe<Be;xe++)de=it[xe],L.format!==Us?nt!==null?fe?n.compressedTexSubImage2D(t.TEXTURE_2D,xe,0,0,de.width,de.height,nt,de.data):n.compressedTexImage2D(t.TEXTURE_2D,xe,ut,de.width,de.height,0,de.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):fe?n.texSubImage2D(t.TEXTURE_2D,xe,0,0,de.width,de.height,nt,tt,de.data):n.texImage2D(t.TEXTURE_2D,xe,ut,de.width,de.height,0,nt,tt,de.data)}else if(L.isDataArrayTexture)fe?(Oe&&n.texStorage3D(t.TEXTURE_2D_ARRAY,Me,ut,Re.width,Re.height,Re.depth),n.texSubImage3D(t.TEXTURE_2D_ARRAY,0,0,0,0,Re.width,Re.height,Re.depth,nt,tt,Re.data)):n.texImage3D(t.TEXTURE_2D_ARRAY,0,ut,Re.width,Re.height,Re.depth,0,nt,tt,Re.data);else if(L.isData3DTexture)fe?(Oe&&n.texStorage3D(t.TEXTURE_3D,Me,ut,Re.width,Re.height,Re.depth),n.texSubImage3D(t.TEXTURE_3D,0,0,0,0,Re.width,Re.height,Re.depth,nt,tt,Re.data)):n.texImage3D(t.TEXTURE_3D,0,ut,Re.width,Re.height,Re.depth,0,nt,tt,Re.data);else if(L.isFramebufferTexture){if(Oe)if(fe)n.texStorage2D(t.TEXTURE_2D,Me,ut,Re.width,Re.height);else{let xe=Re.width,Be=Re.height;for(let ct=0;ct<Me;ct++)n.texImage2D(t.TEXTURE_2D,ct,ut,xe,Be,0,nt,tt,null),xe>>=1,Be>>=1}}else if(it.length>0&&pt){fe&&Oe&&n.texStorage2D(t.TEXTURE_2D,Me,ut,it[0].width,it[0].height);for(let xe=0,Be=it.length;xe<Be;xe++)de=it[xe],fe?n.texSubImage2D(t.TEXTURE_2D,xe,0,0,nt,tt,de):n.texImage2D(t.TEXTURE_2D,xe,ut,nt,tt,de);L.generateMipmaps=!1}else fe?(Oe&&n.texStorage2D(t.TEXTURE_2D,Me,ut,Re.width,Re.height),n.texSubImage2D(t.TEXTURE_2D,0,0,0,nt,tt,Re)):n.texImage2D(t.TEXTURE_2D,0,ut,nt,tt,Re);P(L,pt)&&A(me),Ze.__version=pe.version,L.onUpdate&&L.onUpdate(L)}j.__version=L.version}function we(j,L,Y){if(L.image.length!==6)return;const me=Pe(j,L),ye=L.source;n.bindTexture(t.TEXTURE_CUBE_MAP,j.__webglTexture,t.TEXTURE0+Y);const pe=i.get(ye);if(ye.version!==pe.__version||me===!0){n.activeTexture(t.TEXTURE0+Y);const Ze=Hn.getPrimaries(Hn.workingColorSpace),Le=L.colorSpace===js?null:Hn.getPrimaries(L.colorSpace),qe=L.colorSpace===js||Ze===Le?t.NONE:t.BROWSER_DEFAULT_WEBGL;t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,L.flipY),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,L.premultiplyAlpha),t.pixelStorei(t.UNPACK_ALIGNMENT,L.unpackAlignment),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,qe);const at=L.isCompressedTexture||L.image[0].isCompressedTexture,Ie=L.image[0]&&L.image[0].isDataTexture,Re=[];for(let xe=0;xe<6;xe++)!at&&!Ie?Re[xe]=w(L.image[xe],!1,!0,c):Re[xe]=Ie?L.image[xe].image:L.image[xe],Re[xe]=te(L,Re[xe]);const pt=Re[0],nt=T(pt)||o,tt=a.convert(L.format,L.colorSpace),ut=a.convert(L.type),de=U(L.internalFormat,tt,ut,L.colorSpace),it=o&&L.isVideoTexture!==!0,fe=pe.__version===void 0||me===!0;let Oe=N(L,pt,nt);ve(t.TEXTURE_CUBE_MAP,L,nt);let Me;if(at){it&&fe&&n.texStorage2D(t.TEXTURE_CUBE_MAP,Oe,de,pt.width,pt.height);for(let xe=0;xe<6;xe++){Me=Re[xe].mipmaps;for(let Be=0;Be<Me.length;Be++){const ct=Me[Be];L.format!==Us?tt!==null?it?n.compressedTexSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+xe,Be,0,0,ct.width,ct.height,tt,ct.data):n.compressedTexImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+xe,Be,de,ct.width,ct.height,0,ct.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):it?n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+xe,Be,0,0,ct.width,ct.height,tt,ut,ct.data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+xe,Be,de,ct.width,ct.height,0,tt,ut,ct.data)}}}else{Me=L.mipmaps,it&&fe&&(Me.length>0&&Oe++,n.texStorage2D(t.TEXTURE_CUBE_MAP,Oe,de,Re[0].width,Re[0].height));for(let xe=0;xe<6;xe++)if(Ie){it?n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+xe,0,0,0,Re[xe].width,Re[xe].height,tt,ut,Re[xe].data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+xe,0,de,Re[xe].width,Re[xe].height,0,tt,ut,Re[xe].data);for(let Be=0;Be<Me.length;Be++){const bt=Me[Be].image[xe].image;it?n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+xe,Be+1,0,0,bt.width,bt.height,tt,ut,bt.data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+xe,Be+1,de,bt.width,bt.height,0,tt,ut,bt.data)}}else{it?n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+xe,0,0,0,tt,ut,Re[xe]):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+xe,0,de,tt,ut,Re[xe]);for(let Be=0;Be<Me.length;Be++){const ct=Me[Be];it?n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+xe,Be+1,0,0,tt,ut,ct.image[xe]):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+xe,Be+1,de,tt,ut,ct.image[xe])}}}P(L,nt)&&A(t.TEXTURE_CUBE_MAP),pe.__version=ye.version,L.onUpdate&&L.onUpdate(L)}j.__version=L.version}function je(j,L,Y,me,ye,pe){const Ze=a.convert(Y.format,Y.colorSpace),Le=a.convert(Y.type),qe=U(Y.internalFormat,Ze,Le,Y.colorSpace);if(!i.get(L).__hasExternalTextures){const Ie=Math.max(1,L.width>>pe),Re=Math.max(1,L.height>>pe);ye===t.TEXTURE_3D||ye===t.TEXTURE_2D_ARRAY?n.texImage3D(ye,pe,qe,Ie,Re,L.depth,0,Ze,Le,null):n.texImage2D(ye,pe,qe,Ie,Re,0,Ze,Le,null)}n.bindFramebuffer(t.FRAMEBUFFER,j),De(L)?m.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,me,ye,i.get(Y).__webglTexture,0,oe(L)):(ye===t.TEXTURE_2D||ye>=t.TEXTURE_CUBE_MAP_POSITIVE_X&&ye<=t.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&t.framebufferTexture2D(t.FRAMEBUFFER,me,ye,i.get(Y).__webglTexture,pe),n.bindFramebuffer(t.FRAMEBUFFER,null)}function ue(j,L,Y){if(t.bindRenderbuffer(t.RENDERBUFFER,j),L.depthBuffer&&!L.stencilBuffer){let me=o===!0?t.DEPTH_COMPONENT24:t.DEPTH_COMPONENT16;if(Y||De(L)){const ye=L.depthTexture;ye&&ye.isDepthTexture&&(ye.type===Zl?me=t.DEPTH_COMPONENT32F:ye.type===Nu&&(me=t.DEPTH_COMPONENT24));const pe=oe(L);De(L)?m.renderbufferStorageMultisampleEXT(t.RENDERBUFFER,pe,me,L.width,L.height):t.renderbufferStorageMultisample(t.RENDERBUFFER,pe,me,L.width,L.height)}else t.renderbufferStorage(t.RENDERBUFFER,me,L.width,L.height);t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.RENDERBUFFER,j)}else if(L.depthBuffer&&L.stencilBuffer){const me=oe(L);Y&&De(L)===!1?t.renderbufferStorageMultisample(t.RENDERBUFFER,me,t.DEPTH24_STENCIL8,L.width,L.height):De(L)?m.renderbufferStorageMultisampleEXT(t.RENDERBUFFER,me,t.DEPTH24_STENCIL8,L.width,L.height):t.renderbufferStorage(t.RENDERBUFFER,t.DEPTH_STENCIL,L.width,L.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.RENDERBUFFER,j)}else{const me=L.isWebGLMultipleRenderTargets===!0?L.texture:[L.texture];for(let ye=0;ye<me.length;ye++){const pe=me[ye],Ze=a.convert(pe.format,pe.colorSpace),Le=a.convert(pe.type),qe=U(pe.internalFormat,Ze,Le,pe.colorSpace),at=oe(L);Y&&De(L)===!1?t.renderbufferStorageMultisample(t.RENDERBUFFER,at,qe,L.width,L.height):De(L)?m.renderbufferStorageMultisampleEXT(t.RENDERBUFFER,at,qe,L.width,L.height):t.renderbufferStorage(t.RENDERBUFFER,qe,L.width,L.height)}}t.bindRenderbuffer(t.RENDERBUFFER,null)}function lt(j,L){if(L&&L.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(n.bindFramebuffer(t.FRAMEBUFFER,j),!(L.depthTexture&&L.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");(!i.get(L.depthTexture).__webglTexture||L.depthTexture.image.width!==L.width||L.depthTexture.image.height!==L.height)&&(L.depthTexture.image.width=L.width,L.depthTexture.image.height=L.height,L.depthTexture.needsUpdate=!0),se(L.depthTexture,0);const me=i.get(L.depthTexture).__webglTexture,ye=oe(L);if(L.depthTexture.format===sf)De(L)?m.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.TEXTURE_2D,me,0,ye):t.framebufferTexture2D(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.TEXTURE_2D,me,0);else if(L.depthTexture.format===$p)De(L)?m.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.TEXTURE_2D,me,0,ye):t.framebufferTexture2D(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.TEXTURE_2D,me,0);else throw new Error("Unknown depthTexture format")}function z(j){const L=i.get(j),Y=j.isWebGLCubeRenderTarget===!0;if(j.depthTexture&&!L.__autoAllocateDepthBuffer){if(Y)throw new Error("target.depthTexture not supported in Cube render targets");lt(L.__webglFramebuffer,j)}else if(Y){L.__webglDepthbuffer=[];for(let me=0;me<6;me++)n.bindFramebuffer(t.FRAMEBUFFER,L.__webglFramebuffer[me]),L.__webglDepthbuffer[me]=t.createRenderbuffer(),ue(L.__webglDepthbuffer[me],j,!1)}else n.bindFramebuffer(t.FRAMEBUFFER,L.__webglFramebuffer),L.__webglDepthbuffer=t.createRenderbuffer(),ue(L.__webglDepthbuffer,j,!1);n.bindFramebuffer(t.FRAMEBUFFER,null)}function q(j,L,Y){const me=i.get(j);L!==void 0&&je(me.__webglFramebuffer,j,j.texture,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,0),Y!==void 0&&z(j)}function re(j){const L=j.texture,Y=i.get(j),me=i.get(L);j.addEventListener("dispose",I),j.isWebGLMultipleRenderTargets!==!0&&(me.__webglTexture===void 0&&(me.__webglTexture=t.createTexture()),me.__version=L.version,s.memory.textures++);const ye=j.isWebGLCubeRenderTarget===!0,pe=j.isWebGLMultipleRenderTargets===!0,Ze=T(j)||o;if(ye){Y.__webglFramebuffer=[];for(let Le=0;Le<6;Le++)if(o&&L.mipmaps&&L.mipmaps.length>0){Y.__webglFramebuffer[Le]=[];for(let qe=0;qe<L.mipmaps.length;qe++)Y.__webglFramebuffer[Le][qe]=t.createFramebuffer()}else Y.__webglFramebuffer[Le]=t.createFramebuffer()}else{if(o&&L.mipmaps&&L.mipmaps.length>0){Y.__webglFramebuffer=[];for(let Le=0;Le<L.mipmaps.length;Le++)Y.__webglFramebuffer[Le]=t.createFramebuffer()}else Y.__webglFramebuffer=t.createFramebuffer();if(pe)if(r.drawBuffers){const Le=j.texture;for(let qe=0,at=Le.length;qe<at;qe++){const Ie=i.get(Le[qe]);Ie.__webglTexture===void 0&&(Ie.__webglTexture=t.createTexture(),s.memory.textures++)}}else console.warn("THREE.WebGLRenderer: WebGLMultipleRenderTargets can only be used with WebGL2 or WEBGL_draw_buffers extension.");if(o&&j.samples>0&&De(j)===!1){const Le=pe?L:[L];Y.__webglMultisampledFramebuffer=t.createFramebuffer(),Y.__webglColorRenderbuffer=[],n.bindFramebuffer(t.FRAMEBUFFER,Y.__webglMultisampledFramebuffer);for(let qe=0;qe<Le.length;qe++){const at=Le[qe];Y.__webglColorRenderbuffer[qe]=t.createRenderbuffer(),t.bindRenderbuffer(t.RENDERBUFFER,Y.__webglColorRenderbuffer[qe]);const Ie=a.convert(at.format,at.colorSpace),Re=a.convert(at.type),pt=U(at.internalFormat,Ie,Re,at.colorSpace,j.isXRRenderTarget===!0),nt=oe(j);t.renderbufferStorageMultisample(t.RENDERBUFFER,nt,pt,j.width,j.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+qe,t.RENDERBUFFER,Y.__webglColorRenderbuffer[qe])}t.bindRenderbuffer(t.RENDERBUFFER,null),j.depthBuffer&&(Y.__webglDepthRenderbuffer=t.createRenderbuffer(),ue(Y.__webglDepthRenderbuffer,j,!0)),n.bindFramebuffer(t.FRAMEBUFFER,null)}}if(ye){n.bindTexture(t.TEXTURE_CUBE_MAP,me.__webglTexture),ve(t.TEXTURE_CUBE_MAP,L,Ze);for(let Le=0;Le<6;Le++)if(o&&L.mipmaps&&L.mipmaps.length>0)for(let qe=0;qe<L.mipmaps.length;qe++)je(Y.__webglFramebuffer[Le][qe],j,L,t.COLOR_ATTACHMENT0,t.TEXTURE_CUBE_MAP_POSITIVE_X+Le,qe);else je(Y.__webglFramebuffer[Le],j,L,t.COLOR_ATTACHMENT0,t.TEXTURE_CUBE_MAP_POSITIVE_X+Le,0);P(L,Ze)&&A(t.TEXTURE_CUBE_MAP),n.unbindTexture()}else if(pe){const Le=j.texture;for(let qe=0,at=Le.length;qe<at;qe++){const Ie=Le[qe],Re=i.get(Ie);n.bindTexture(t.TEXTURE_2D,Re.__webglTexture),ve(t.TEXTURE_2D,Ie,Ze),je(Y.__webglFramebuffer,j,Ie,t.COLOR_ATTACHMENT0+qe,t.TEXTURE_2D,0),P(Ie,Ze)&&A(t.TEXTURE_2D)}n.unbindTexture()}else{let Le=t.TEXTURE_2D;if((j.isWebGL3DRenderTarget||j.isWebGLArrayRenderTarget)&&(o?Le=j.isWebGL3DRenderTarget?t.TEXTURE_3D:t.TEXTURE_2D_ARRAY:console.error("THREE.WebGLTextures: THREE.Data3DTexture and THREE.DataArrayTexture only supported with WebGL2.")),n.bindTexture(Le,me.__webglTexture),ve(Le,L,Ze),o&&L.mipmaps&&L.mipmaps.length>0)for(let qe=0;qe<L.mipmaps.length;qe++)je(Y.__webglFramebuffer[qe],j,L,t.COLOR_ATTACHMENT0,Le,qe);else je(Y.__webglFramebuffer,j,L,t.COLOR_ATTACHMENT0,Le,0);P(L,Ze)&&A(Le),n.unbindTexture()}j.depthBuffer&&z(j)}function J(j){const L=T(j)||o,Y=j.isWebGLMultipleRenderTargets===!0?j.texture:[j.texture];for(let me=0,ye=Y.length;me<ye;me++){const pe=Y[me];if(P(pe,L)){const Ze=j.isWebGLCubeRenderTarget?t.TEXTURE_CUBE_MAP:t.TEXTURE_2D,Le=i.get(pe).__webglTexture;n.bindTexture(Ze,Le),A(Ze),n.unbindTexture()}}}function ee(j){if(o&&j.samples>0&&De(j)===!1){const L=j.isWebGLMultipleRenderTargets?j.texture:[j.texture],Y=j.width,me=j.height;let ye=t.COLOR_BUFFER_BIT;const pe=[],Ze=j.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,Le=i.get(j),qe=j.isWebGLMultipleRenderTargets===!0;if(qe)for(let at=0;at<L.length;at++)n.bindFramebuffer(t.FRAMEBUFFER,Le.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+at,t.RENDERBUFFER,null),n.bindFramebuffer(t.FRAMEBUFFER,Le.__webglFramebuffer),t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0+at,t.TEXTURE_2D,null,0);n.bindFramebuffer(t.READ_FRAMEBUFFER,Le.__webglMultisampledFramebuffer),n.bindFramebuffer(t.DRAW_FRAMEBUFFER,Le.__webglFramebuffer);for(let at=0;at<L.length;at++){pe.push(t.COLOR_ATTACHMENT0+at),j.depthBuffer&&pe.push(Ze);const Ie=Le.__ignoreDepthValues!==void 0?Le.__ignoreDepthValues:!1;if(Ie===!1&&(j.depthBuffer&&(ye|=t.DEPTH_BUFFER_BIT),j.stencilBuffer&&(ye|=t.STENCIL_BUFFER_BIT)),qe&&t.framebufferRenderbuffer(t.READ_FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.RENDERBUFFER,Le.__webglColorRenderbuffer[at]),Ie===!0&&(t.invalidateFramebuffer(t.READ_FRAMEBUFFER,[Ze]),t.invalidateFramebuffer(t.DRAW_FRAMEBUFFER,[Ze])),qe){const Re=i.get(L[at]).__webglTexture;t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,Re,0)}t.blitFramebuffer(0,0,Y,me,0,0,Y,me,ye,t.NEAREST),g&&t.invalidateFramebuffer(t.READ_FRAMEBUFFER,pe)}if(n.bindFramebuffer(t.READ_FRAMEBUFFER,null),n.bindFramebuffer(t.DRAW_FRAMEBUFFER,null),qe)for(let at=0;at<L.length;at++){n.bindFramebuffer(t.FRAMEBUFFER,Le.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+at,t.RENDERBUFFER,Le.__webglColorRenderbuffer[at]);const Ie=i.get(L[at]).__webglTexture;n.bindFramebuffer(t.FRAMEBUFFER,Le.__webglFramebuffer),t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0+at,t.TEXTURE_2D,Ie,0)}n.bindFramebuffer(t.DRAW_FRAMEBUFFER,Le.__webglMultisampledFramebuffer)}}function oe(j){return Math.min(f,j.samples)}function De(j){const L=i.get(j);return o&&j.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&L.__useRenderToTexture!==!1}function Ne(j){const L=s.render.frame;y.get(j)!==L&&(y.set(j,L),j.update())}function te(j,L){const Y=j.colorSpace,me=j.format,ye=j.type;return j.isCompressedTexture===!0||j.isVideoTexture===!0||j.format===b3||Y!==mc&&Y!==js&&(Hn.getTransfer(Y)===ii?o===!1?e.has("EXT_sRGB")===!0&&me===Us?(j.format=b3,j.minFilter=Is,j.generateMipmaps=!1):L=a7.sRGBToLinear(L):(me!==Us||ye!==ju)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",Y)),L}this.allocateTextureUnit=K,this.resetTextureUnits=$,this.setTexture2D=se,this.setTexture2DArray=V,this.setTexture3D=X,this.setTextureCube=ae,this.rebindTextures=q,this.setupRenderTarget=re,this.updateRenderTargetMipmap=J,this.updateMultisampleRenderTarget=ee,this.setupDepthRenderbuffer=z,this.setupFrameBufferTexture=je,this.useMultisampledRTT=De}function t_e(t,e,n){const i=n.isWebGL2;function r(a,s=js){let o;const l=Hn.getTransfer(s);if(a===ju)return t.UNSIGNED_BYTE;if(a===X9)return t.UNSIGNED_SHORT_4_4_4_4;if(a===K9)return t.UNSIGNED_SHORT_5_5_5_1;if(a===Ege)return t.BYTE;if(a===Age)return t.SHORT;if(a===KP)return t.UNSIGNED_SHORT;if(a===q9)return t.INT;if(a===Nu)return t.UNSIGNED_INT;if(a===Zl)return t.FLOAT;if(a===W0)return i?t.HALF_FLOAT:(o=e.get("OES_texture_half_float"),o!==null?o.HALF_FLOAT_OES:null);if(a===Tge)return t.ALPHA;if(a===Us)return t.RGBA;if(a===Cge)return t.LUMINANCE;if(a===Nge)return t.LUMINANCE_ALPHA;if(a===sf)return t.DEPTH_COMPONENT;if(a===$p)return t.DEPTH_STENCIL;if(a===b3)return o=e.get("EXT_sRGB"),o!==null?o.SRGB_ALPHA_EXT:null;if(a===Rge)return t.RED;if(a===Y9)return t.RED_INTEGER;if(a===Pge)return t.RG;if(a===Z9)return t.RG_INTEGER;if(a===Q9)return t.RGBA_INTEGER;if(a===aT||a===sT||a===oT||a===lT)if(l===ii)if(o=e.get("WEBGL_compressed_texture_s3tc_srgb"),o!==null){if(a===aT)return o.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(a===sT)return o.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(a===oT)return o.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(a===lT)return o.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(o=e.get("WEBGL_compressed_texture_s3tc"),o!==null){if(a===aT)return o.COMPRESSED_RGB_S3TC_DXT1_EXT;if(a===sT)return o.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(a===oT)return o.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(a===lT)return o.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(a===lz||a===cz||a===uz||a===dz)if(o=e.get("WEBGL_compressed_texture_pvrtc"),o!==null){if(a===lz)return o.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(a===cz)return o.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(a===uz)return o.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(a===dz)return o.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(a===J9)return o=e.get("WEBGL_compressed_texture_etc1"),o!==null?o.COMPRESSED_RGB_ETC1_WEBGL:null;if(a===fz||a===hz)if(o=e.get("WEBGL_compressed_texture_etc"),o!==null){if(a===fz)return l===ii?o.COMPRESSED_SRGB8_ETC2:o.COMPRESSED_RGB8_ETC2;if(a===hz)return l===ii?o.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:o.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(a===pz||a===mz||a===gz||a===xz||a===vz||a===yz||a===bz||a===_z||a===Sz||a===wz||a===Mz||a===Ez||a===Az||a===Tz)if(o=e.get("WEBGL_compressed_texture_astc"),o!==null){if(a===pz)return l===ii?o.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:o.COMPRESSED_RGBA_ASTC_4x4_KHR;if(a===mz)return l===ii?o.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:o.COMPRESSED_RGBA_ASTC_5x4_KHR;if(a===gz)return l===ii?o.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:o.COMPRESSED_RGBA_ASTC_5x5_KHR;if(a===xz)return l===ii?o.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:o.COMPRESSED_RGBA_ASTC_6x5_KHR;if(a===vz)return l===ii?o.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:o.COMPRESSED_RGBA_ASTC_6x6_KHR;if(a===yz)return l===ii?o.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:o.COMPRESSED_RGBA_ASTC_8x5_KHR;if(a===bz)return l===ii?o.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:o.COMPRESSED_RGBA_ASTC_8x6_KHR;if(a===_z)return l===ii?o.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:o.COMPRESSED_RGBA_ASTC_8x8_KHR;if(a===Sz)return l===ii?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:o.COMPRESSED_RGBA_ASTC_10x5_KHR;if(a===wz)return l===ii?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:o.COMPRESSED_RGBA_ASTC_10x6_KHR;if(a===Mz)return l===ii?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:o.COMPRESSED_RGBA_ASTC_10x8_KHR;if(a===Ez)return l===ii?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:o.COMPRESSED_RGBA_ASTC_10x10_KHR;if(a===Az)return l===ii?o.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:o.COMPRESSED_RGBA_ASTC_12x10_KHR;if(a===Tz)return l===ii?o.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:o.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(a===cT||a===Cz||a===Nz)if(o=e.get("EXT_texture_compression_bptc"),o!==null){if(a===cT)return l===ii?o.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:o.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(a===Cz)return o.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(a===Nz)return o.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(a===Dge||a===Rz||a===Pz||a===Dz)if(o=e.get("EXT_texture_compression_rgtc"),o!==null){if(a===cT)return o.COMPRESSED_RED_RGTC1_EXT;if(a===Rz)return o.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(a===Pz)return o.COMPRESSED_RED_GREEN_RGTC2_EXT;if(a===Dz)return o.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return a===af?i?t.UNSIGNED_INT_24_8:(o=e.get("WEBGL_depth_texture"),o!==null?o.UNSIGNED_INT_24_8_WEBGL:null):t[a]!==void 0?t[a]:null}return{convert:r}}class n_e extends rs{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}}class Jg extends ga{constructor(){super(),this.isGroup=!0,this.type="Group"}}const i_e={type:"move"};class DT{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Jg,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 Jg,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new Ae,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new Ae),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new Jg,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new Ae,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new Ae),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 o=this._targetRay,l=this._grip,c=this._hand;if(e&&n.session.visibilityState!=="visible-blurred"){if(c&&e.hand){s=!0;for(const _ of e.hand.values()){const v=n.getJointPose(_,i),x=this._getHandJoint(c,_);v!==null&&(x.matrix.fromArray(v.transform.matrix),x.matrix.decompose(x.position,x.rotation,x.scale),x.matrixWorldNeedsUpdate=!0,x.jointRadius=v.radius),x.visible=v!==null}const d=c.joints["index-finger-tip"],f=c.joints["thumb-tip"],m=d.position.distanceTo(f.position),g=.02,y=.005;c.inputState.pinching&&m>g+y?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&m<=g-y&&(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else l!==null&&e.gripSpace&&(a=n.getPose(e.gripSpace,i),a!==null&&(l.matrix.fromArray(a.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),l.matrixWorldNeedsUpdate=!0,a.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(a.linearVelocity)):l.hasLinearVelocity=!1,a.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(a.angularVelocity)):l.hasAngularVelocity=!1));o!==null&&(r=n.getPose(e.targetRaySpace,i),r===null&&a!==null&&(r=a),r!==null&&(o.matrix.fromArray(r.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,r.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(r.linearVelocity)):o.hasLinearVelocity=!1,r.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(r.angularVelocity)):o.hasAngularVelocity=!1,this.dispatchEvent(i_e)))}return o!==null&&(o.visible=r!==null),l!==null&&(l.visible=a!==null),c!==null&&(c.visible=s!==null),this}_getHandJoint(e,n){if(e.joints[n.jointName]===void 0){const i=new Jg;i.matrixAutoUpdate=!1,i.visible=!1,e.joints[n.jointName]=i,e.add(i)}return e.joints[n.jointName]}}class r_e extends Hf{constructor(e,n){super();const i=this;let r=null,a=1,s=null,o="local-floor",l=1,c=null,d=null,f=null,m=null,g=null,y=null;const _=n.getContextAttributes();let v=null,x=null;const M=[],w=[],T=new Wt;let C=null;const P=new rs;P.layers.enable(1),P.viewport=new $n;const A=new rs;A.layers.enable(2),A.viewport=new $n;const U=[P,A],N=new n_e;N.layers.enable(1),N.layers.enable(2);let D=null,F=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(ae){let ce=M[ae];return ce===void 0&&(ce=new DT,M[ae]=ce),ce.getTargetRaySpace()},this.getControllerGrip=function(ae){let ce=M[ae];return ce===void 0&&(ce=new DT,M[ae]=ce),ce.getGripSpace()},this.getHand=function(ae){let ce=M[ae];return ce===void 0&&(ce=new DT,M[ae]=ce),ce.getHandSpace()};function I(ae){const ce=w.indexOf(ae.inputSource);if(ce===-1)return;const ge=M[ce];ge!==void 0&&(ge.update(ae.inputSource,ae.frame,c||s),ge.dispatchEvent({type:ae.type,data:ae.inputSource}))}function W(){r.removeEventListener("select",I),r.removeEventListener("selectstart",I),r.removeEventListener("selectend",I),r.removeEventListener("squeeze",I),r.removeEventListener("squeezestart",I),r.removeEventListener("squeezeend",I),r.removeEventListener("end",W),r.removeEventListener("inputsourceschange",O);for(let ae=0;ae<M.length;ae++){const ce=w[ae];ce!==null&&(w[ae]=null,M[ae].disconnect(ce))}D=null,F=null,e.setRenderTarget(v),g=null,m=null,f=null,r=null,x=null,X.stop(),i.isPresenting=!1,e.setPixelRatio(C),e.setSize(T.width,T.height,!1),i.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(ae){a=ae,i.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(ae){o=ae,i.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return c||s},this.setReferenceSpace=function(ae){c=ae},this.getBaseLayer=function(){return m!==null?m:g},this.getBinding=function(){return f},this.getFrame=function(){return y},this.getSession=function(){return r},this.setSession=async function(ae){if(r=ae,r!==null){if(v=e.getRenderTarget(),r.addEventListener("select",I),r.addEventListener("selectstart",I),r.addEventListener("selectend",I),r.addEventListener("squeeze",I),r.addEventListener("squeezestart",I),r.addEventListener("squeezeend",I),r.addEventListener("end",W),r.addEventListener("inputsourceschange",O),_.xrCompatible!==!0&&await n.makeXRCompatible(),C=e.getPixelRatio(),e.getSize(T),r.renderState.layers===void 0||e.capabilities.isWebGL2===!1){const ce={antialias:r.renderState.layers===void 0?_.antialias:!0,alpha:!0,depth:_.depth,stencil:_.stencil,framebufferScaleFactor:a};g=new XRWebGLLayer(r,n,ce),r.updateRenderState({baseLayer:g}),e.setPixelRatio(1),e.setSize(g.framebufferWidth,g.framebufferHeight,!1),x=new Af(g.framebufferWidth,g.framebufferHeight,{format:Us,type:ju,colorSpace:e.outputColorSpace,stencilBuffer:_.stencil})}else{let ce=null,ge=null,ne=null;_.depth&&(ne=_.stencil?n.DEPTH24_STENCIL8:n.DEPTH_COMPONENT24,ce=_.stencil?$p:sf,ge=_.stencil?af:Nu);const ve={colorFormat:n.RGBA8,depthFormat:ne,scaleFactor:a};f=new XRWebGLBinding(r,n),m=f.createProjectionLayer(ve),r.updateRenderState({layers:[m]}),e.setPixelRatio(1),e.setSize(m.textureWidth,m.textureHeight,!1),x=new Af(m.textureWidth,m.textureHeight,{format:Us,type:ju,depthTexture:new x7(m.textureWidth,m.textureHeight,ge,void 0,void 0,void 0,void 0,void 0,void 0,ce),stencilBuffer:_.stencil,colorSpace:e.outputColorSpace,samples:_.antialias?4:0});const Pe=e.properties.get(x);Pe.__ignoreDepthValues=m.ignoreDepthValues}x.isXRRenderTarget=!0,this.setFoveation(l),c=null,s=await r.requestReferenceSpace(o),X.setContext(r),X.start(),i.isPresenting=!0,i.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(r!==null)return r.environmentBlendMode};function O(ae){for(let ce=0;ce<ae.removed.length;ce++){const ge=ae.removed[ce],ne=w.indexOf(ge);ne>=0&&(w[ne]=null,M[ne].disconnect(ge))}for(let ce=0;ce<ae.added.length;ce++){const ge=ae.added[ce];let ne=w.indexOf(ge);if(ne===-1){for(let Pe=0;Pe<M.length;Pe++)if(Pe>=w.length){w.push(ge),ne=Pe;break}else if(w[Pe]===null){w[Pe]=ge,ne=Pe;break}if(ne===-1)break}const ve=M[ne];ve&&ve.connect(ge)}}const B=new Ae,H=new Ae;function $(ae,ce,ge){B.setFromMatrixPosition(ce.matrixWorld),H.setFromMatrixPosition(ge.matrixWorld);const ne=B.distanceTo(H),ve=ce.projectionMatrix.elements,Pe=ge.projectionMatrix.elements,he=ve[14]/(ve[10]-1),we=ve[14]/(ve[10]+1),je=(ve[9]+1)/ve[5],ue=(ve[9]-1)/ve[5],lt=(ve[8]-1)/ve[0],z=(Pe[8]+1)/Pe[0],q=he*lt,re=he*z,J=ne/(-lt+z),ee=J*-lt;ce.matrixWorld.decompose(ae.position,ae.quaternion,ae.scale),ae.translateX(ee),ae.translateZ(J),ae.matrixWorld.compose(ae.position,ae.quaternion,ae.scale),ae.matrixWorldInverse.copy(ae.matrixWorld).invert();const oe=he+J,De=we+J,Ne=q-ee,te=re+(ne-ee),j=je*we/De*oe,L=ue*we/De*oe;ae.projectionMatrix.makePerspective(Ne,te,j,L,oe,De),ae.projectionMatrixInverse.copy(ae.projectionMatrix).invert()}function K(ae,ce){ce===null?ae.matrixWorld.copy(ae.matrix):ae.matrixWorld.multiplyMatrices(ce.matrixWorld,ae.matrix),ae.matrixWorldInverse.copy(ae.matrixWorld).invert()}this.updateCamera=function(ae){if(r===null)return;N.near=A.near=P.near=ae.near,N.far=A.far=P.far=ae.far,(D!==N.near||F!==N.far)&&(r.updateRenderState({depthNear:N.near,depthFar:N.far}),D=N.near,F=N.far);const ce=ae.parent,ge=N.cameras;K(N,ce);for(let ne=0;ne<ge.length;ne++)K(ge[ne],ce);ge.length===2?$(N,P,A):N.projectionMatrix.copy(P.projectionMatrix),Z(ae,N,ce)};function Z(ae,ce,ge){ge===null?ae.matrix.copy(ce.matrixWorld):(ae.matrix.copy(ge.matrixWorld),ae.matrix.invert(),ae.matrix.multiply(ce.matrixWorld)),ae.matrix.decompose(ae.position,ae.quaternion,ae.scale),ae.updateMatrixWorld(!0),ae.projectionMatrix.copy(ce.projectionMatrix),ae.projectionMatrixInverse.copy(ce.projectionMatrixInverse),ae.isPerspectiveCamera&&(ae.fov=X0*2*Math.atan(1/ae.projectionMatrix.elements[5]),ae.zoom=1)}this.getCamera=function(){return N},this.getFoveation=function(){if(!(m===null&&g===null))return l},this.setFoveation=function(ae){l=ae,m!==null&&(m.fixedFoveation=ae),g!==null&&g.fixedFoveation!==void 0&&(g.fixedFoveation=ae)};let se=null;function V(ae,ce){if(d=ce.getViewerPose(c||s),y=ce,d!==null){const ge=d.views;g!==null&&(e.setRenderTargetFramebuffer(x,g.framebuffer),e.setRenderTarget(x));let ne=!1;ge.length!==N.cameras.length&&(N.cameras.length=0,ne=!0);for(let ve=0;ve<ge.length;ve++){const Pe=ge[ve];let he=null;if(g!==null)he=g.getViewport(Pe);else{const je=f.getViewSubImage(m,Pe);he=je.viewport,ve===0&&(e.setRenderTargetTextures(x,je.colorTexture,m.ignoreDepthValues?void 0:je.depthStencilTexture),e.setRenderTarget(x))}let we=U[ve];we===void 0&&(we=new rs,we.layers.enable(ve),we.viewport=new $n,U[ve]=we),we.matrix.fromArray(Pe.transform.matrix),we.matrix.decompose(we.position,we.quaternion,we.scale),we.projectionMatrix.fromArray(Pe.projectionMatrix),we.projectionMatrixInverse.copy(we.projectionMatrix).invert(),we.viewport.set(he.x,he.y,he.width,he.height),ve===0&&(N.matrix.copy(we.matrix),N.matrix.decompose(N.position,N.quaternion,N.scale)),ne===!0&&N.cameras.push(we)}}for(let ge=0;ge<M.length;ge++){const ne=w[ge],ve=M[ge];ne!==null&&ve!==void 0&&ve.update(ne,ce,c||s)}se&&se(ae,ce),ce.detectedPlanes&&i.dispatchEvent({type:"planesdetected",data:ce}),y=null}const X=new g7;X.setAnimationLoop(V),this.setAnimationLoop=function(ae){se=ae},this.dispose=function(){}}}function a_e(t,e){function n(v,x){v.matrixAutoUpdate===!0&&v.updateMatrix(),x.value.copy(v.matrix)}function i(v,x){x.color.getRGB(v.fogColor.value,h7(t)),x.isFog?(v.fogNear.value=x.near,v.fogFar.value=x.far):x.isFogExp2&&(v.fogDensity.value=x.density)}function r(v,x,M,w,T){x.isMeshBasicMaterial||x.isMeshLambertMaterial?a(v,x):x.isMeshToonMaterial?(a(v,x),f(v,x)):x.isMeshPhongMaterial?(a(v,x),d(v,x)):x.isMeshStandardMaterial?(a(v,x),m(v,x),x.isMeshPhysicalMaterial&&g(v,x,T)):x.isMeshMatcapMaterial?(a(v,x),y(v,x)):x.isMeshDepthMaterial?a(v,x):x.isMeshDistanceMaterial?(a(v,x),_(v,x)):x.isMeshNormalMaterial?a(v,x):x.isLineBasicMaterial?(s(v,x),x.isLineDashedMaterial&&o(v,x)):x.isPointsMaterial?l(v,x,M,w):x.isSpriteMaterial?c(v,x):x.isShadowMaterial?(v.color.value.copy(x.color),v.opacity.value=x.opacity):x.isShaderMaterial&&(x.uniformsNeedUpdate=!1)}function a(v,x){v.opacity.value=x.opacity,x.color&&v.diffuse.value.copy(x.color),x.emissive&&v.emissive.value.copy(x.emissive).multiplyScalar(x.emissiveIntensity),x.map&&(v.map.value=x.map,n(x.map,v.mapTransform)),x.alphaMap&&(v.alphaMap.value=x.alphaMap,n(x.alphaMap,v.alphaMapTransform)),x.bumpMap&&(v.bumpMap.value=x.bumpMap,n(x.bumpMap,v.bumpMapTransform),v.bumpScale.value=x.bumpScale,x.side===Ua&&(v.bumpScale.value*=-1)),x.normalMap&&(v.normalMap.value=x.normalMap,n(x.normalMap,v.normalMapTransform),v.normalScale.value.copy(x.normalScale),x.side===Ua&&v.normalScale.value.negate()),x.displacementMap&&(v.displacementMap.value=x.displacementMap,n(x.displacementMap,v.displacementMapTransform),v.displacementScale.value=x.displacementScale,v.displacementBias.value=x.displacementBias),x.emissiveMap&&(v.emissiveMap.value=x.emissiveMap,n(x.emissiveMap,v.emissiveMapTransform)),x.specularMap&&(v.specularMap.value=x.specularMap,n(x.specularMap,v.specularMapTransform)),x.alphaTest>0&&(v.alphaTest.value=x.alphaTest);const M=e.get(x).envMap;if(M&&(v.envMap.value=M,v.flipEnvMap.value=M.isCubeTexture&&M.isRenderTargetTexture===!1?-1:1,v.reflectivity.value=x.reflectivity,v.ior.value=x.ior,v.refractionRatio.value=x.refractionRatio),x.lightMap){v.lightMap.value=x.lightMap;const w=t._useLegacyLights===!0?Math.PI:1;v.lightMapIntensity.value=x.lightMapIntensity*w,n(x.lightMap,v.lightMapTransform)}x.aoMap&&(v.aoMap.value=x.aoMap,v.aoMapIntensity.value=x.aoMapIntensity,n(x.aoMap,v.aoMapTransform))}function s(v,x){v.diffuse.value.copy(x.color),v.opacity.value=x.opacity,x.map&&(v.map.value=x.map,n(x.map,v.mapTransform))}function o(v,x){v.dashSize.value=x.dashSize,v.totalSize.value=x.dashSize+x.gapSize,v.scale.value=x.scale}function l(v,x,M,w){v.diffuse.value.copy(x.color),v.opacity.value=x.opacity,v.size.value=x.size*M,v.scale.value=w*.5,x.map&&(v.map.value=x.map,n(x.map,v.uvTransform)),x.alphaMap&&(v.alphaMap.value=x.alphaMap,n(x.alphaMap,v.alphaMapTransform)),x.alphaTest>0&&(v.alphaTest.value=x.alphaTest)}function c(v,x){v.diffuse.value.copy(x.color),v.opacity.value=x.opacity,v.rotation.value=x.rotation,x.map&&(v.map.value=x.map,n(x.map,v.mapTransform)),x.alphaMap&&(v.alphaMap.value=x.alphaMap,n(x.alphaMap,v.alphaMapTransform)),x.alphaTest>0&&(v.alphaTest.value=x.alphaTest)}function d(v,x){v.specular.value.copy(x.specular),v.shininess.value=Math.max(x.shininess,1e-4)}function f(v,x){x.gradientMap&&(v.gradientMap.value=x.gradientMap)}function m(v,x){v.metalness.value=x.metalness,x.metalnessMap&&(v.metalnessMap.value=x.metalnessMap,n(x.metalnessMap,v.metalnessMapTransform)),v.roughness.value=x.roughness,x.roughnessMap&&(v.roughnessMap.value=x.roughnessMap,n(x.roughnessMap,v.roughnessMapTransform)),e.get(x).envMap&&(v.envMapIntensity.value=x.envMapIntensity)}function g(v,x,M){v.ior.value=x.ior,x.sheen>0&&(v.sheenColor.value.copy(x.sheenColor).multiplyScalar(x.sheen),v.sheenRoughness.value=x.sheenRoughness,x.sheenColorMap&&(v.sheenColorMap.value=x.sheenColorMap,n(x.sheenColorMap,v.sheenColorMapTransform)),x.sheenRoughnessMap&&(v.sheenRoughnessMap.value=x.sheenRoughnessMap,n(x.sheenRoughnessMap,v.sheenRoughnessMapTransform))),x.clearcoat>0&&(v.clearcoat.value=x.clearcoat,v.clearcoatRoughness.value=x.clearcoatRoughness,x.clearcoatMap&&(v.clearcoatMap.value=x.clearcoatMap,n(x.clearcoatMap,v.clearcoatMapTransform)),x.clearcoatRoughnessMap&&(v.clearcoatRoughnessMap.value=x.clearcoatRoughnessMap,n(x.clearcoatRoughnessMap,v.clearcoatRoughnessMapTransform)),x.clearcoatNormalMap&&(v.clearcoatNormalMap.value=x.clearcoatNormalMap,n(x.clearcoatNormalMap,v.clearcoatNormalMapTransform),v.clearcoatNormalScale.value.copy(x.clearcoatNormalScale),x.side===Ua&&v.clearcoatNormalScale.value.negate())),x.iridescence>0&&(v.iridescence.value=x.iridescence,v.iridescenceIOR.value=x.iridescenceIOR,v.iridescenceThicknessMinimum.value=x.iridescenceThicknessRange[0],v.iridescenceThicknessMaximum.value=x.iridescenceThicknessRange[1],x.iridescenceMap&&(v.iridescenceMap.value=x.iridescenceMap,n(x.iridescenceMap,v.iridescenceMapTransform)),x.iridescenceThicknessMap&&(v.iridescenceThicknessMap.value=x.iridescenceThicknessMap,n(x.iridescenceThicknessMap,v.iridescenceThicknessMapTransform))),x.transmission>0&&(v.transmission.value=x.transmission,v.transmissionSamplerMap.value=M.texture,v.transmissionSamplerSize.value.set(M.width,M.height),x.transmissionMap&&(v.transmissionMap.value=x.transmissionMap,n(x.transmissionMap,v.transmissionMapTransform)),v.thickness.value=x.thickness,x.thicknessMap&&(v.thicknessMap.value=x.thicknessMap,n(x.thicknessMap,v.thicknessMapTransform)),v.attenuationDistance.value=x.attenuationDistance,v.attenuationColor.value.copy(x.attenuationColor)),x.anisotropy>0&&(v.anisotropyVector.value.set(x.anisotropy*Math.cos(x.anisotropyRotation),x.anisotropy*Math.sin(x.anisotropyRotation)),x.anisotropyMap&&(v.anisotropyMap.value=x.anisotropyMap,n(x.anisotropyMap,v.anisotropyMapTransform))),v.specularIntensity.value=x.specularIntensity,v.specularColor.value.copy(x.specularColor),x.specularColorMap&&(v.specularColorMap.value=x.specularColorMap,n(x.specularColorMap,v.specularColorMapTransform)),x.specularIntensityMap&&(v.specularIntensityMap.value=x.specularIntensityMap,n(x.specularIntensityMap,v.specularIntensityMapTransform))}function y(v,x){x.matcap&&(v.matcap.value=x.matcap)}function _(v,x){const M=e.get(x).light;v.referencePosition.value.setFromMatrixPosition(M.matrixWorld),v.nearDistance.value=M.shadow.camera.near,v.farDistance.value=M.shadow.camera.far}return{refreshFogUniforms:i,refreshMaterialUniforms:r}}function s_e(t,e,n,i){let r={},a={},s=[];const o=n.isWebGL2?t.getParameter(t.MAX_UNIFORM_BUFFER_BINDINGS):0;function l(M,w){const T=w.program;i.uniformBlockBinding(M,T)}function c(M,w){let T=r[M.id];T===void 0&&(y(M),T=d(M),r[M.id]=T,M.addEventListener("dispose",v));const C=w.program;i.updateUBOMapping(M,C);const P=e.render.frame;a[M.id]!==P&&(m(M),a[M.id]=P)}function d(M){const w=f();M.__bindingPointIndex=w;const T=t.createBuffer(),C=M.__size,P=M.usage;return t.bindBuffer(t.UNIFORM_BUFFER,T),t.bufferData(t.UNIFORM_BUFFER,C,P),t.bindBuffer(t.UNIFORM_BUFFER,null),t.bindBufferBase(t.UNIFORM_BUFFER,w,T),T}function f(){for(let M=0;M<o;M++)if(s.indexOf(M)===-1)return s.push(M),M;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function m(M){const w=r[M.id],T=M.uniforms,C=M.__cache;t.bindBuffer(t.UNIFORM_BUFFER,w);for(let P=0,A=T.length;P<A;P++){const U=T[P];if(g(U,P,C)===!0){const N=U.__offset,D=Array.isArray(U.value)?U.value:[U.value];let F=0;for(let I=0;I<D.length;I++){const W=D[I],O=_(W);typeof W=="number"?(U.__data[0]=W,t.bufferSubData(t.UNIFORM_BUFFER,N+F,U.__data)):W.isMatrix3?(U.__data[0]=W.elements[0],U.__data[1]=W.elements[1],U.__data[2]=W.elements[2],U.__data[3]=W.elements[0],U.__data[4]=W.elements[3],U.__data[5]=W.elements[4],U.__data[6]=W.elements[5],U.__data[7]=W.elements[0],U.__data[8]=W.elements[6],U.__data[9]=W.elements[7],U.__data[10]=W.elements[8],U.__data[11]=W.elements[0]):(W.toArray(U.__data,F),F+=O.storage/Float32Array.BYTES_PER_ELEMENT)}t.bufferSubData(t.UNIFORM_BUFFER,N,U.__data)}}t.bindBuffer(t.UNIFORM_BUFFER,null)}function g(M,w,T){const C=M.value;if(T[w]===void 0){if(typeof C=="number")T[w]=C;else{const P=Array.isArray(C)?C:[C],A=[];for(let U=0;U<P.length;U++)A.push(P[U].clone());T[w]=A}return!0}else if(typeof C=="number"){if(T[w]!==C)return T[w]=C,!0}else{const P=Array.isArray(T[w])?T[w]:[T[w]],A=Array.isArray(C)?C:[C];for(let U=0;U<P.length;U++){const N=P[U];if(N.equals(A[U])===!1)return N.copy(A[U]),!0}}return!1}function y(M){const w=M.uniforms;let T=0;const C=16;let P=0;for(let A=0,U=w.length;A<U;A++){const N=w[A],D={boundary:0,storage:0},F=Array.isArray(N.value)?N.value:[N.value];for(let I=0,W=F.length;I<W;I++){const O=F[I],B=_(O);D.boundary+=B.boundary,D.storage+=B.storage}if(N.__data=new Float32Array(D.storage/Float32Array.BYTES_PER_ELEMENT),N.__offset=T,A>0){P=T%C;const I=C-P;P!==0&&I-D.boundary<0&&(T+=C-P,N.__offset=T)}T+=D.storage}return P=T%C,P>0&&(T+=C-P),M.__size=T,M.__cache={},this}function _(M){const w={boundary:0,storage:0};return typeof M=="number"?(w.boundary=4,w.storage=4):M.isVector2?(w.boundary=8,w.storage=8):M.isVector3||M.isColor?(w.boundary=16,w.storage=12):M.isVector4?(w.boundary=16,w.storage=16):M.isMatrix3?(w.boundary=48,w.storage=48):M.isMatrix4?(w.boundary=64,w.storage=64):M.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",M),w}function v(M){const w=M.target;w.removeEventListener("dispose",v);const T=s.indexOf(w.__bindingPointIndex);s.splice(T,1),t.deleteBuffer(r[w.id]),delete r[w.id],delete a[w.id]}function x(){for(const M in r)t.deleteBuffer(r[M]);s=[],r={},a={}}return{bind:l,update:c,dispose:x}}class w3{constructor(e={}){const{canvas:n=i0e(),context:i=null,depth:r=!0,stencil:a=!0,alpha:s=!1,antialias:o=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:c=!1,powerPreference:d="default",failIfMajorPerformanceCaveat:f=!1}=e;this.isWebGLRenderer=!0;let m;i!==null?m=i.getContextAttributes().alpha:m=s;const g=new Uint32Array(4),y=new Int32Array(4);let _=null,v=null;const x=[],M=[];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=Br,this._useLegacyLights=!1,this.toneMapping=Uu,this.toneMappingExposure=1;const w=this;let T=!1,C=0,P=0,A=null,U=-1,N=null;const D=new $n,F=new $n;let I=null;const W=new zt(0);let O=0,B=n.width,H=n.height,$=1,K=null,Z=null;const se=new $n(0,0,B,H),V=new $n(0,0,B,H);let X=!1;const ae=new ZS;let ce=!1,ge=!1,ne=null;const ve=new Qn,Pe=new Wt,he=new Ae,we={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function je(){return A===null?$:1}let ue=i;function lt(le,Ue){for(let We=0;We<le.length;We++){const Xe=le[We],Ge=n.getContext(Xe,Ue);if(Ge!==null)return Ge}return null}try{const le={alpha:!0,depth:r,stencil:a,antialias:o,premultipliedAlpha:l,preserveDrawingBuffer:c,powerPreference:d,failIfMajorPerformanceCaveat:f};if("setAttribute"in n&&n.setAttribute("data-engine",`three.js r${XS}`),n.addEventListener("webglcontextlost",it,!1),n.addEventListener("webglcontextrestored",fe,!1),n.addEventListener("webglcontextcreationerror",Oe,!1),ue===null){const Ue=["webgl2","webgl","experimental-webgl"];if(w.isWebGL1Renderer===!0&&Ue.shift(),ue=lt(Ue,le),ue===null)throw lt(Ue)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}typeof WebGLRenderingContext<"u"&&ue instanceof WebGLRenderingContext&&console.warn("THREE.WebGLRenderer: WebGL 1 support was deprecated in r153 and will be removed in r163."),ue.getShaderPrecisionFormat===void 0&&(ue.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(le){throw console.error("THREE.WebGLRenderer: "+le.message),le}let z,q,re,J,ee,oe,De,Ne,te,j,L,Y,me,ye,pe,Ze,Le,qe,at,Ie,Re,pt,nt,tt;function ut(){z=new xye(ue),q=new uye(ue,z,e),z.init(q),pt=new t_e(ue,z,q),re=new Jbe(ue,z,q),J=new bye(ue),ee=new Fbe,oe=new e_e(ue,z,re,ee,q,pt,J),De=new fye(w),Ne=new gye(w),te=new T0e(ue,q),nt=new lye(ue,z,te,q),j=new vye(ue,te,J,nt),L=new Mye(ue,j,te,J),at=new wye(ue,q,oe),Ze=new dye(ee),Y=new jbe(w,De,Ne,z,q,nt,Ze),me=new a_e(w,ee),ye=new Bbe,pe=new qbe(z,q),qe=new oye(w,De,Ne,re,L,m,l),Le=new Qbe(w,L,q),tt=new s_e(ue,J,q,re),Ie=new cye(ue,z,J,q),Re=new yye(ue,z,J,q),J.programs=Y.programs,w.capabilities=q,w.extensions=z,w.properties=ee,w.renderLists=ye,w.shadowMap=Le,w.state=re,w.info=J}ut();const de=new r_e(w,ue);this.xr=de,this.getContext=function(){return ue},this.getContextAttributes=function(){return ue.getContextAttributes()},this.forceContextLoss=function(){const le=z.get("WEBGL_lose_context");le&&le.loseContext()},this.forceContextRestore=function(){const le=z.get("WEBGL_lose_context");le&&le.restoreContext()},this.getPixelRatio=function(){return $},this.setPixelRatio=function(le){le!==void 0&&($=le,this.setSize(B,H,!1))},this.getSize=function(le){return le.set(B,H)},this.setSize=function(le,Ue,We=!0){if(de.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}B=le,H=Ue,n.width=Math.floor(le*$),n.height=Math.floor(Ue*$),We===!0&&(n.style.width=le+"px",n.style.height=Ue+"px"),this.setViewport(0,0,le,Ue)},this.getDrawingBufferSize=function(le){return le.set(B*$,H*$).floor()},this.setDrawingBufferSize=function(le,Ue,We){B=le,H=Ue,$=We,n.width=Math.floor(le*We),n.height=Math.floor(Ue*We),this.setViewport(0,0,le,Ue)},this.getCurrentViewport=function(le){return le.copy(D)},this.getViewport=function(le){return le.copy(se)},this.setViewport=function(le,Ue,We,Xe){le.isVector4?se.set(le.x,le.y,le.z,le.w):se.set(le,Ue,We,Xe),re.viewport(D.copy(se).multiplyScalar($).floor())},this.getScissor=function(le){return le.copy(V)},this.setScissor=function(le,Ue,We,Xe){le.isVector4?V.set(le.x,le.y,le.z,le.w):V.set(le,Ue,We,Xe),re.scissor(F.copy(V).multiplyScalar($).floor())},this.getScissorTest=function(){return X},this.setScissorTest=function(le){re.setScissorTest(X=le)},this.setOpaqueSort=function(le){K=le},this.setTransparentSort=function(le){Z=le},this.getClearColor=function(le){return le.copy(qe.getClearColor())},this.setClearColor=function(){qe.setClearColor.apply(qe,arguments)},this.getClearAlpha=function(){return qe.getClearAlpha()},this.setClearAlpha=function(){qe.setClearAlpha.apply(qe,arguments)},this.clear=function(le=!0,Ue=!0,We=!0){let Xe=0;if(le){let Ge=!1;if(A!==null){const _t=A.texture.format;Ge=_t===Q9||_t===Z9||_t===Y9}if(Ge){const _t=A.texture.type,Q=_t===ju||_t===Nu||_t===KP||_t===af||_t===X9||_t===K9,be=qe.getClearColor(),Ce=qe.getClearAlpha(),Te=be.r,Se=be.g,Qe=be.b;Q?(g[0]=Te,g[1]=Se,g[2]=Qe,g[3]=Ce,ue.clearBufferuiv(ue.COLOR,0,g)):(y[0]=Te,y[1]=Se,y[2]=Qe,y[3]=Ce,ue.clearBufferiv(ue.COLOR,0,y))}else Xe|=ue.COLOR_BUFFER_BIT}Ue&&(Xe|=ue.DEPTH_BUFFER_BIT),We&&(Xe|=ue.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),ue.clear(Xe)},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",it,!1),n.removeEventListener("webglcontextrestored",fe,!1),n.removeEventListener("webglcontextcreationerror",Oe,!1),ye.dispose(),pe.dispose(),ee.dispose(),De.dispose(),Ne.dispose(),L.dispose(),nt.dispose(),tt.dispose(),Y.dispose(),de.dispose(),de.removeEventListener("sessionstart",on),de.removeEventListener("sessionend",Dt),ne&&(ne.dispose(),ne=null),Rn.stop()};function it(le){le.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),T=!0}function fe(){console.log("THREE.WebGLRenderer: Context Restored."),T=!1;const le=J.autoReset,Ue=Le.enabled,We=Le.autoUpdate,Xe=Le.needsUpdate,Ge=Le.type;ut(),J.autoReset=le,Le.enabled=Ue,Le.autoUpdate=We,Le.needsUpdate=Xe,Le.type=Ge}function Oe(le){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",le.statusMessage)}function Me(le){const Ue=le.target;Ue.removeEventListener("dispose",Me),xe(Ue)}function xe(le){Be(le),ee.remove(le)}function Be(le){const Ue=ee.get(le).programs;Ue!==void 0&&(Ue.forEach(function(We){Y.releaseProgram(We)}),le.isShaderMaterial&&Y.releaseShaderCache(le))}this.renderBufferDirect=function(le,Ue,We,Xe,Ge,_t){Ue===null&&(Ue=we);const Q=Ge.isMesh&&Ge.matrixWorld.determinant()<0,be=Ai(le,Ue,We,Xe,Ge);re.setMaterial(Xe,Q);let Ce=We.index,Te=1;if(Xe.wireframe===!0){if(Ce=j.getWireframeAttribute(We),Ce===void 0)return;Te=2}const Se=We.drawRange,Qe=We.attributes.position;let dt=Se.start*Te,vt=(Se.start+Se.count)*Te;_t!==null&&(dt=Math.max(dt,_t.start*Te),vt=Math.min(vt,(_t.start+_t.count)*Te)),Ce!==null?(dt=Math.max(dt,0),vt=Math.min(vt,Ce.count)):Qe!=null&&(dt=Math.max(dt,0),vt=Math.min(vt,Qe.count));const xt=vt-dt;if(xt<0||xt===1/0)return;nt.setup(Ge,Xe,be,We,Ce);let Rt,wt=Ie;if(Ce!==null&&(Rt=te.get(Ce),wt=Re,wt.setIndex(Rt)),Ge.isMesh)Xe.wireframe===!0?(re.setLineWidth(Xe.wireframeLinewidth*je()),wt.setMode(ue.LINES)):wt.setMode(ue.TRIANGLES);else if(Ge.isLine){let mt=Xe.linewidth;mt===void 0&&(mt=1),re.setLineWidth(mt*je()),Ge.isLineSegments?wt.setMode(ue.LINES):Ge.isLineLoop?wt.setMode(ue.LINE_LOOP):wt.setMode(ue.LINE_STRIP)}else Ge.isPoints?wt.setMode(ue.POINTS):Ge.isSprite&&wt.setMode(ue.TRIANGLES);if(Ge.isBatchedMesh)wt.renderMultiDraw(Ge._multiDrawStarts,Ge._multiDrawCounts,Ge._multiDrawCount);else if(Ge.isInstancedMesh)wt.renderInstances(dt,xt,Ge.count);else if(We.isInstancedBufferGeometry){const mt=We._maxInstanceCount!==void 0?We._maxInstanceCount:1/0,$t=Math.min(We.instanceCount,mt);wt.renderInstances(dt,xt,$t)}else wt.render(dt,xt)};function ct(le,Ue,We){le.transparent===!0&&le.side===Gl&&le.forceSinglePass===!1?(le.side=Ua,le.needsUpdate=!0,Gr(le,Ue,We),le.side=qu,le.needsUpdate=!0,Gr(le,Ue,We),le.side=Gl):Gr(le,Ue,We)}this.compile=function(le,Ue,We=null){We===null&&(We=le),v=pe.get(We),v.init(),M.push(v),We.traverseVisible(function(Ge){Ge.isLight&&Ge.layers.test(Ue.layers)&&(v.pushLight(Ge),Ge.castShadow&&v.pushShadow(Ge))}),le!==We&&le.traverseVisible(function(Ge){Ge.isLight&&Ge.layers.test(Ue.layers)&&(v.pushLight(Ge),Ge.castShadow&&v.pushShadow(Ge))}),v.setupLights(w._useLegacyLights);const Xe=new Set;return le.traverse(function(Ge){const _t=Ge.material;if(_t)if(Array.isArray(_t))for(let Q=0;Q<_t.length;Q++){const be=_t[Q];ct(be,We,Ge),Xe.add(be)}else ct(_t,We,Ge),Xe.add(_t)}),M.pop(),v=null,Xe},this.compileAsync=function(le,Ue,We=null){const Xe=this.compile(le,Ue,We);return new Promise(Ge=>{function _t(){if(Xe.forEach(function(Q){ee.get(Q).currentProgram.isReady()&&Xe.delete(Q)}),Xe.size===0){Ge(le);return}setTimeout(_t,10)}z.get("KHR_parallel_shader_compile")!==null?_t():setTimeout(_t,10)})};let bt=null;function Nt(le){bt&&bt(le)}function on(){Rn.stop()}function Dt(){Rn.start()}const Rn=new g7;Rn.setAnimationLoop(Nt),typeof self<"u"&&Rn.setContext(self),this.setAnimationLoop=function(le){bt=le,de.setAnimationLoop(le),le===null?Rn.stop():Rn.start()},de.addEventListener("sessionstart",on),de.addEventListener("sessionend",Dt),this.render=function(le,Ue){if(Ue!==void 0&&Ue.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(T===!0)return;le.matrixWorldAutoUpdate===!0&&le.updateMatrixWorld(),Ue.parent===null&&Ue.matrixWorldAutoUpdate===!0&&Ue.updateMatrixWorld(),de.enabled===!0&&de.isPresenting===!0&&(de.cameraAutoUpdate===!0&&de.updateCamera(Ue),Ue=de.getCamera()),le.isScene===!0&&le.onBeforeRender(w,le,Ue,A),v=pe.get(le,M.length),v.init(),M.push(v),ve.multiplyMatrices(Ue.projectionMatrix,Ue.matrixWorldInverse),ae.setFromProjectionMatrix(ve),ge=this.localClippingEnabled,ce=Ze.init(this.clippingPlanes,ge),_=ye.get(le,x.length),_.init(),x.push(_),Wn(le,Ue,0,w.sortObjects),_.finish(),w.sortObjects===!0&&_.sort(K,Z),this.info.render.frame++,ce===!0&&Ze.beginShadows();const We=v.state.shadowsArray;if(Le.render(We,le,Ue),ce===!0&&Ze.endShadows(),this.info.autoReset===!0&&this.info.reset(),qe.render(_,le),v.setupLights(w._useLegacyLights),Ue.isArrayCamera){const Xe=Ue.cameras;for(let Ge=0,_t=Xe.length;Ge<_t;Ge++){const Q=Xe[Ge];hr(_,le,Q,Q.viewport)}}else hr(_,le,Ue);A!==null&&(oe.updateMultisampleRenderTarget(A),oe.updateRenderTargetMipmap(A)),le.isScene===!0&&le.onAfterRender(w,le,Ue),nt.resetDefaultState(),U=-1,N=null,M.pop(),M.length>0?v=M[M.length-1]:v=null,x.pop(),x.length>0?_=x[x.length-1]:_=null};function Wn(le,Ue,We,Xe){if(le.visible===!1)return;if(le.layers.test(Ue.layers)){if(le.isGroup)We=le.renderOrder;else if(le.isLOD)le.autoUpdate===!0&&le.update(Ue);else if(le.isLight)v.pushLight(le),le.castShadow&&v.pushShadow(le);else if(le.isSprite){if(!le.frustumCulled||ae.intersectsSprite(le)){Xe&&he.setFromMatrixPosition(le.matrixWorld).applyMatrix4(ve);const Q=L.update(le),be=le.material;be.visible&&_.push(le,Q,be,We,he.z,null)}}else if((le.isMesh||le.isLine||le.isPoints)&&(!le.frustumCulled||ae.intersectsObject(le))){const Q=L.update(le),be=le.material;if(Xe&&(le.boundingSphere!==void 0?(le.boundingSphere===null&&le.computeBoundingSphere(),he.copy(le.boundingSphere.center)):(Q.boundingSphere===null&&Q.computeBoundingSphere(),he.copy(Q.boundingSphere.center)),he.applyMatrix4(le.matrixWorld).applyMatrix4(ve)),Array.isArray(be)){const Ce=Q.groups;for(let Te=0,Se=Ce.length;Te<Se;Te++){const Qe=Ce[Te],dt=be[Qe.materialIndex];dt&&dt.visible&&_.push(le,Q,dt,We,he.z,Qe)}}else be.visible&&_.push(le,Q,be,We,he.z,null)}}const _t=le.children;for(let Q=0,be=_t.length;Q<be;Q++)Wn(_t[Q],Ue,We,Xe)}function hr(le,Ue,We,Xe){const Ge=le.opaque,_t=le.transmissive,Q=le.transparent;v.setupLightsView(We),ce===!0&&Ze.setGlobalState(w.clippingPlanes,We),_t.length>0&&Zi(Ge,_t,Ue,We),Xe&&re.viewport(D.copy(Xe)),Ge.length>0&&pr(Ge,Ue,We),_t.length>0&&pr(_t,Ue,We),Q.length>0&&pr(Q,Ue,We),re.buffers.depth.setTest(!0),re.buffers.depth.setMask(!0),re.buffers.color.setMask(!0),re.setPolygonOffset(!1)}function Zi(le,Ue,We,Xe){if((We.isScene===!0?We.overrideMaterial:null)!==null)return;const _t=q.isWebGL2;ne===null&&(ne=new Af(1,1,{generateMipmaps:!0,type:z.has("EXT_color_buffer_half_float")?W0:ju,minFilter:G0,samples:_t?4:0})),w.getDrawingBufferSize(Pe),_t?ne.setSize(Pe.x,Pe.y):ne.setSize(X_(Pe.x),X_(Pe.y));const Q=w.getRenderTarget();w.setRenderTarget(ne),w.getClearColor(W),O=w.getClearAlpha(),O<1&&w.setClearColor(16777215,.5),w.clear();const be=w.toneMapping;w.toneMapping=Uu,pr(le,We,Xe),oe.updateMultisampleRenderTarget(ne),oe.updateRenderTargetMipmap(ne);let Ce=!1;for(let Te=0,Se=Ue.length;Te<Se;Te++){const Qe=Ue[Te],dt=Qe.object,vt=Qe.geometry,xt=Qe.material,Rt=Qe.group;if(xt.side===Gl&&dt.layers.test(Xe.layers)){const wt=xt.side;xt.side=Ua,xt.needsUpdate=!0,Nr(dt,We,Xe,vt,xt,Rt),xt.side=wt,xt.needsUpdate=!0,Ce=!0}}Ce===!0&&(oe.updateMultisampleRenderTarget(ne),oe.updateRenderTargetMipmap(ne)),w.setRenderTarget(Q),w.setClearColor(W,O),w.toneMapping=be}function pr(le,Ue,We){const Xe=Ue.isScene===!0?Ue.overrideMaterial:null;for(let Ge=0,_t=le.length;Ge<_t;Ge++){const Q=le[Ge],be=Q.object,Ce=Q.geometry,Te=Xe===null?Q.material:Xe,Se=Q.group;be.layers.test(We.layers)&&Nr(be,Ue,We,Ce,Te,Se)}}function Nr(le,Ue,We,Xe,Ge,_t){le.onBeforeRender(w,Ue,We,Xe,Ge,_t),le.modelViewMatrix.multiplyMatrices(We.matrixWorldInverse,le.matrixWorld),le.normalMatrix.getNormalMatrix(le.modelViewMatrix),Ge.onBeforeRender(w,Ue,We,Xe,le,_t),Ge.transparent===!0&&Ge.side===Gl&&Ge.forceSinglePass===!1?(Ge.side=Ua,Ge.needsUpdate=!0,w.renderBufferDirect(We,Ue,Xe,Ge,le,_t),Ge.side=qu,Ge.needsUpdate=!0,w.renderBufferDirect(We,Ue,Xe,Ge,le,_t),Ge.side=Gl):w.renderBufferDirect(We,Ue,Xe,Ge,le,_t),le.onAfterRender(w,Ue,We,Xe,Ge,_t)}function Gr(le,Ue,We){Ue.isScene!==!0&&(Ue=we);const Xe=ee.get(le),Ge=v.state.lights,_t=v.state.shadowsArray,Q=Ge.state.version,be=Y.getParameters(le,Ge.state,_t,Ue,We),Ce=Y.getProgramCacheKey(be);let Te=Xe.programs;Xe.environment=le.isMeshStandardMaterial?Ue.environment:null,Xe.fog=Ue.fog,Xe.envMap=(le.isMeshStandardMaterial?Ne:De).get(le.envMap||Xe.environment),Te===void 0&&(le.addEventListener("dispose",Me),Te=new Map,Xe.programs=Te);let Se=Te.get(Ce);if(Se!==void 0){if(Xe.currentProgram===Se&&Xe.lightsStateVersion===Q)return hi(le,be),Se}else be.uniforms=Y.getUniforms(le),le.onBuild(We,be,w),le.onBeforeCompile(be,w),Se=Y.acquireProgram(be,Ce),Te.set(Ce,Se),Xe.uniforms=be.uniforms;const Qe=Xe.uniforms;return(!le.isShaderMaterial&&!le.isRawShaderMaterial||le.clipping===!0)&&(Qe.clippingPlanes=Ze.uniform),hi(le,be),Xe.needsLights=Pc(le),Xe.lightsStateVersion=Q,Xe.needsLights&&(Qe.ambientLightColor.value=Ge.state.ambient,Qe.lightProbe.value=Ge.state.probe,Qe.directionalLights.value=Ge.state.directional,Qe.directionalLightShadows.value=Ge.state.directionalShadow,Qe.spotLights.value=Ge.state.spot,Qe.spotLightShadows.value=Ge.state.spotShadow,Qe.rectAreaLights.value=Ge.state.rectArea,Qe.ltc_1.value=Ge.state.rectAreaLTC1,Qe.ltc_2.value=Ge.state.rectAreaLTC2,Qe.pointLights.value=Ge.state.point,Qe.pointLightShadows.value=Ge.state.pointShadow,Qe.hemisphereLights.value=Ge.state.hemi,Qe.directionalShadowMap.value=Ge.state.directionalShadowMap,Qe.directionalShadowMatrix.value=Ge.state.directionalShadowMatrix,Qe.spotShadowMap.value=Ge.state.spotShadowMap,Qe.spotLightMatrix.value=Ge.state.spotLightMatrix,Qe.spotLightMap.value=Ge.state.spotLightMap,Qe.pointShadowMap.value=Ge.state.pointShadowMap,Qe.pointShadowMatrix.value=Ge.state.pointShadowMatrix),Xe.currentProgram=Se,Xe.uniformsList=null,Se}function Li(le){if(le.uniformsList===null){const Ue=le.currentProgram.getUniforms();le.uniformsList=p_.seqWithValue(Ue.seq,le.uniforms)}return le.uniformsList}function hi(le,Ue){const We=ee.get(le);We.outputColorSpace=Ue.outputColorSpace,We.batching=Ue.batching,We.instancing=Ue.instancing,We.instancingColor=Ue.instancingColor,We.skinning=Ue.skinning,We.morphTargets=Ue.morphTargets,We.morphNormals=Ue.morphNormals,We.morphColors=Ue.morphColors,We.morphTargetsCount=Ue.morphTargetsCount,We.numClippingPlanes=Ue.numClippingPlanes,We.numIntersection=Ue.numClipIntersection,We.vertexAlphas=Ue.vertexAlphas,We.vertexTangents=Ue.vertexTangents,We.toneMapping=Ue.toneMapping}function Ai(le,Ue,We,Xe,Ge){Ue.isScene!==!0&&(Ue=we),oe.resetTextureUnits();const _t=Ue.fog,Q=Xe.isMeshStandardMaterial?Ue.environment:null,be=A===null?w.outputColorSpace:A.isXRRenderTarget===!0?A.texture.colorSpace:mc,Ce=(Xe.isMeshStandardMaterial?Ne:De).get(Xe.envMap||Q),Te=Xe.vertexColors===!0&&!!We.attributes.color&&We.attributes.color.itemSize===4,Se=!!We.attributes.tangent&&(!!Xe.normalMap||Xe.anisotropy>0),Qe=!!We.morphAttributes.position,dt=!!We.morphAttributes.normal,vt=!!We.morphAttributes.color;let xt=Uu;Xe.toneMapped&&(A===null||A.isXRRenderTarget===!0)&&(xt=w.toneMapping);const Rt=We.morphAttributes.position||We.morphAttributes.normal||We.morphAttributes.color,wt=Rt!==void 0?Rt.length:0,mt=ee.get(Xe),$t=v.state.lights;if(ce===!0&&(ge===!0||le!==N)){const Ti=le===N&&Xe.id===U;Ze.setState(Xe,le,Ti)}let Lt=!1;Xe.version===mt.__version?(mt.needsLights&&mt.lightsStateVersion!==$t.state.version||mt.outputColorSpace!==be||Ge.isBatchedMesh&&mt.batching===!1||!Ge.isBatchedMesh&&mt.batching===!0||Ge.isInstancedMesh&&mt.instancing===!1||!Ge.isInstancedMesh&&mt.instancing===!0||Ge.isSkinnedMesh&&mt.skinning===!1||!Ge.isSkinnedMesh&&mt.skinning===!0||Ge.isInstancedMesh&&mt.instancingColor===!0&&Ge.instanceColor===null||Ge.isInstancedMesh&&mt.instancingColor===!1&&Ge.instanceColor!==null||mt.envMap!==Ce||Xe.fog===!0&&mt.fog!==_t||mt.numClippingPlanes!==void 0&&(mt.numClippingPlanes!==Ze.numPlanes||mt.numIntersection!==Ze.numIntersection)||mt.vertexAlphas!==Te||mt.vertexTangents!==Se||mt.morphTargets!==Qe||mt.morphNormals!==dt||mt.morphColors!==vt||mt.toneMapping!==xt||q.isWebGL2===!0&&mt.morphTargetsCount!==wt)&&(Lt=!0):(Lt=!0,mt.__version=Xe.version);let en=mt.currentProgram;Lt===!0&&(en=Gr(Xe,Ue,Ge));let un=!1,mn=!1,kt=!1;const qt=en.getUniforms(),Kt=mt.uniforms;if(re.useProgram(en.program)&&(un=!0,mn=!0,kt=!0),Xe.id!==U&&(U=Xe.id,mn=!0),un||N!==le){qt.setValue(ue,"projectionMatrix",le.projectionMatrix),qt.setValue(ue,"viewMatrix",le.matrixWorldInverse);const Ti=qt.map.cameraPosition;Ti!==void 0&&Ti.setValue(ue,he.setFromMatrixPosition(le.matrixWorld)),q.logarithmicDepthBuffer&&qt.setValue(ue,"logDepthBufFC",2/(Math.log(le.far+1)/Math.LN2)),(Xe.isMeshPhongMaterial||Xe.isMeshToonMaterial||Xe.isMeshLambertMaterial||Xe.isMeshBasicMaterial||Xe.isMeshStandardMaterial||Xe.isShaderMaterial)&&qt.setValue(ue,"isOrthographic",le.isOrthographicCamera===!0),N!==le&&(N=le,mn=!0,kt=!0)}if(Ge.isSkinnedMesh){qt.setOptional(ue,Ge,"bindMatrix"),qt.setOptional(ue,Ge,"bindMatrixInverse");const Ti=Ge.skeleton;Ti&&(q.floatVertexTextures?(Ti.boneTexture===null&&Ti.computeBoneTexture(),qt.setValue(ue,"boneTexture",Ti.boneTexture,oe)):console.warn("THREE.WebGLRenderer: SkinnedMesh can only be used with WebGL 2. With WebGL 1 OES_texture_float and vertex textures support is required."))}Ge.isBatchedMesh&&(qt.setOptional(ue,Ge,"batchingTexture"),qt.setValue(ue,"batchingTexture",Ge._matricesTexture,oe));const yi=We.morphAttributes;if((yi.position!==void 0||yi.normal!==void 0||yi.color!==void 0&&q.isWebGL2===!0)&&at.update(Ge,We,en),(mn||mt.receiveShadow!==Ge.receiveShadow)&&(mt.receiveShadow=Ge.receiveShadow,qt.setValue(ue,"receiveShadow",Ge.receiveShadow)),Xe.isMeshGouraudMaterial&&Xe.envMap!==null&&(Kt.envMap.value=Ce,Kt.flipEnvMap.value=Ce.isCubeTexture&&Ce.isRenderTargetTexture===!1?-1:1),mn&&(qt.setValue(ue,"toneMappingExposure",w.toneMappingExposure),mt.needsLights&&Zs(Kt,kt),_t&&Xe.fog===!0&&me.refreshFogUniforms(Kt,_t),me.refreshMaterialUniforms(Kt,Xe,$,H,ne),p_.upload(ue,Li(mt),Kt,oe)),Xe.isShaderMaterial&&Xe.uniformsNeedUpdate===!0&&(p_.upload(ue,Li(mt),Kt,oe),Xe.uniformsNeedUpdate=!1),Xe.isSpriteMaterial&&qt.setValue(ue,"center",Ge.center),qt.setValue(ue,"modelViewMatrix",Ge.modelViewMatrix),qt.setValue(ue,"normalMatrix",Ge.normalMatrix),qt.setValue(ue,"modelMatrix",Ge.matrixWorld),Xe.isShaderMaterial||Xe.isRawShaderMaterial){const Ti=Xe.uniformsGroups;for(let Nn=0,Qs=Ti.length;Nn<Qs;Nn++)if(q.isWebGL2){const Pn=Ti[Nn];tt.update(Pn,en),tt.bind(Pn,en)}else console.warn("THREE.WebGLRenderer: Uniform Buffer Objects can only be used with WebGL 2.")}return en}function Zs(le,Ue){le.ambientLightColor.needsUpdate=Ue,le.lightProbe.needsUpdate=Ue,le.directionalLights.needsUpdate=Ue,le.directionalLightShadows.needsUpdate=Ue,le.pointLights.needsUpdate=Ue,le.pointLightShadows.needsUpdate=Ue,le.spotLights.needsUpdate=Ue,le.spotLightShadows.needsUpdate=Ue,le.rectAreaLights.needsUpdate=Ue,le.hemisphereLights.needsUpdate=Ue}function Pc(le){return le.isMeshLambertMaterial||le.isMeshToonMaterial||le.isMeshPhongMaterial||le.isMeshStandardMaterial||le.isShadowMaterial||le.isShaderMaterial&&le.lights===!0}this.getActiveCubeFace=function(){return C},this.getActiveMipmapLevel=function(){return P},this.getRenderTarget=function(){return A},this.setRenderTargetTextures=function(le,Ue,We){ee.get(le.texture).__webglTexture=Ue,ee.get(le.depthTexture).__webglTexture=We;const Xe=ee.get(le);Xe.__hasExternalTextures=!0,Xe.__hasExternalTextures&&(Xe.__autoAllocateDepthBuffer=We===void 0,Xe.__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"),Xe.__useRenderToTexture=!1))},this.setRenderTargetFramebuffer=function(le,Ue){const We=ee.get(le);We.__webglFramebuffer=Ue,We.__useDefaultFramebuffer=Ue===void 0},this.setRenderTarget=function(le,Ue=0,We=0){A=le,C=Ue,P=We;let Xe=!0,Ge=null,_t=!1,Q=!1;if(le){const Ce=ee.get(le);Ce.__useDefaultFramebuffer!==void 0?(re.bindFramebuffer(ue.FRAMEBUFFER,null),Xe=!1):Ce.__webglFramebuffer===void 0?oe.setupRenderTarget(le):Ce.__hasExternalTextures&&oe.rebindTextures(le,ee.get(le.texture).__webglTexture,ee.get(le.depthTexture).__webglTexture);const Te=le.texture;(Te.isData3DTexture||Te.isDataArrayTexture||Te.isCompressedArrayTexture)&&(Q=!0);const Se=ee.get(le).__webglFramebuffer;le.isWebGLCubeRenderTarget?(Array.isArray(Se[Ue])?Ge=Se[Ue][We]:Ge=Se[Ue],_t=!0):q.isWebGL2&&le.samples>0&&oe.useMultisampledRTT(le)===!1?Ge=ee.get(le).__webglMultisampledFramebuffer:Array.isArray(Se)?Ge=Se[We]:Ge=Se,D.copy(le.viewport),F.copy(le.scissor),I=le.scissorTest}else D.copy(se).multiplyScalar($).floor(),F.copy(V).multiplyScalar($).floor(),I=X;if(re.bindFramebuffer(ue.FRAMEBUFFER,Ge)&&q.drawBuffers&&Xe&&re.drawBuffers(le,Ge),re.viewport(D),re.scissor(F),re.setScissorTest(I),_t){const Ce=ee.get(le.texture);ue.framebufferTexture2D(ue.FRAMEBUFFER,ue.COLOR_ATTACHMENT0,ue.TEXTURE_CUBE_MAP_POSITIVE_X+Ue,Ce.__webglTexture,We)}else if(Q){const Ce=ee.get(le.texture),Te=Ue||0;ue.framebufferTextureLayer(ue.FRAMEBUFFER,ue.COLOR_ATTACHMENT0,Ce.__webglTexture,We||0,Te)}U=-1},this.readRenderTargetPixels=function(le,Ue,We,Xe,Ge,_t,Q){if(!(le&&le.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let be=ee.get(le).__webglFramebuffer;if(le.isWebGLCubeRenderTarget&&Q!==void 0&&(be=be[Q]),be){re.bindFramebuffer(ue.FRAMEBUFFER,be);try{const Ce=le.texture,Te=Ce.format,Se=Ce.type;if(Te!==Us&&pt.convert(Te)!==ue.getParameter(ue.IMPLEMENTATION_COLOR_READ_FORMAT)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}const Qe=Se===W0&&(z.has("EXT_color_buffer_half_float")||q.isWebGL2&&z.has("EXT_color_buffer_float"));if(Se!==ju&&pt.convert(Se)!==ue.getParameter(ue.IMPLEMENTATION_COLOR_READ_TYPE)&&!(Se===Zl&&(q.isWebGL2||z.has("OES_texture_float")||z.has("WEBGL_color_buffer_float")))&&!Qe){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}Ue>=0&&Ue<=le.width-Xe&&We>=0&&We<=le.height-Ge&&ue.readPixels(Ue,We,Xe,Ge,pt.convert(Te),pt.convert(Se),_t)}finally{const Ce=A!==null?ee.get(A).__webglFramebuffer:null;re.bindFramebuffer(ue.FRAMEBUFFER,Ce)}}},this.copyFramebufferToTexture=function(le,Ue,We=0){const Xe=Math.pow(2,-We),Ge=Math.floor(Ue.image.width*Xe),_t=Math.floor(Ue.image.height*Xe);oe.setTexture2D(Ue,0),ue.copyTexSubImage2D(ue.TEXTURE_2D,We,0,0,le.x,le.y,Ge,_t),re.unbindTexture()},this.copyTextureToTexture=function(le,Ue,We,Xe=0){const Ge=Ue.image.width,_t=Ue.image.height,Q=pt.convert(We.format),be=pt.convert(We.type);oe.setTexture2D(We,0),ue.pixelStorei(ue.UNPACK_FLIP_Y_WEBGL,We.flipY),ue.pixelStorei(ue.UNPACK_PREMULTIPLY_ALPHA_WEBGL,We.premultiplyAlpha),ue.pixelStorei(ue.UNPACK_ALIGNMENT,We.unpackAlignment),Ue.isDataTexture?ue.texSubImage2D(ue.TEXTURE_2D,Xe,le.x,le.y,Ge,_t,Q,be,Ue.image.data):Ue.isCompressedTexture?ue.compressedTexSubImage2D(ue.TEXTURE_2D,Xe,le.x,le.y,Ue.mipmaps[0].width,Ue.mipmaps[0].height,Q,Ue.mipmaps[0].data):ue.texSubImage2D(ue.TEXTURE_2D,Xe,le.x,le.y,Q,be,Ue.image),Xe===0&&We.generateMipmaps&&ue.generateMipmap(ue.TEXTURE_2D),re.unbindTexture()},this.copyTextureToTexture3D=function(le,Ue,We,Xe,Ge=0){if(w.isWebGL1Renderer){console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");return}const _t=le.max.x-le.min.x+1,Q=le.max.y-le.min.y+1,be=le.max.z-le.min.z+1,Ce=pt.convert(Xe.format),Te=pt.convert(Xe.type);let Se;if(Xe.isData3DTexture)oe.setTexture3D(Xe,0),Se=ue.TEXTURE_3D;else if(Xe.isDataArrayTexture)oe.setTexture2DArray(Xe,0),Se=ue.TEXTURE_2D_ARRAY;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}ue.pixelStorei(ue.UNPACK_FLIP_Y_WEBGL,Xe.flipY),ue.pixelStorei(ue.UNPACK_PREMULTIPLY_ALPHA_WEBGL,Xe.premultiplyAlpha),ue.pixelStorei(ue.UNPACK_ALIGNMENT,Xe.unpackAlignment);const Qe=ue.getParameter(ue.UNPACK_ROW_LENGTH),dt=ue.getParameter(ue.UNPACK_IMAGE_HEIGHT),vt=ue.getParameter(ue.UNPACK_SKIP_PIXELS),xt=ue.getParameter(ue.UNPACK_SKIP_ROWS),Rt=ue.getParameter(ue.UNPACK_SKIP_IMAGES),wt=We.isCompressedTexture?We.mipmaps[0]:We.image;ue.pixelStorei(ue.UNPACK_ROW_LENGTH,wt.width),ue.pixelStorei(ue.UNPACK_IMAGE_HEIGHT,wt.height),ue.pixelStorei(ue.UNPACK_SKIP_PIXELS,le.min.x),ue.pixelStorei(ue.UNPACK_SKIP_ROWS,le.min.y),ue.pixelStorei(ue.UNPACK_SKIP_IMAGES,le.min.z),We.isDataTexture||We.isData3DTexture?ue.texSubImage3D(Se,Ge,Ue.x,Ue.y,Ue.z,_t,Q,be,Ce,Te,wt.data):We.isCompressedArrayTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),ue.compressedTexSubImage3D(Se,Ge,Ue.x,Ue.y,Ue.z,_t,Q,be,Ce,wt.data)):ue.texSubImage3D(Se,Ge,Ue.x,Ue.y,Ue.z,_t,Q,be,Ce,Te,wt),ue.pixelStorei(ue.UNPACK_ROW_LENGTH,Qe),ue.pixelStorei(ue.UNPACK_IMAGE_HEIGHT,dt),ue.pixelStorei(ue.UNPACK_SKIP_PIXELS,vt),ue.pixelStorei(ue.UNPACK_SKIP_ROWS,xt),ue.pixelStorei(ue.UNPACK_SKIP_IMAGES,Rt),Ge===0&&Xe.generateMipmaps&&ue.generateMipmap(Se),re.unbindTexture()},this.initTexture=function(le){le.isCubeTexture?oe.setTextureCube(le,0):le.isData3DTexture?oe.setTexture3D(le,0):le.isDataArrayTexture||le.isCompressedArrayTexture?oe.setTexture2DArray(le,0):oe.setTexture2D(le,0),re.unbindTexture()},this.resetState=function(){C=0,P=0,A=null,re.reset(),nt.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return Go}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const n=this.getContext();n.drawingBufferColorSpace=e===YP?"display-p3":"srgb",n.unpackColorSpace=Hn.workingColorSpace===YS?"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===Br?of:e7}set outputEncoding(e){console.warn("THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead."),this.outputColorSpace=e===of?Br:mc}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 o_e extends w3{}o_e.prototype.isWebGL1Renderer=!0;class nD{constructor(e,n=1,i=1e3){this.isFog=!0,this.name="",this.color=new zt(e),this.near=n,this.far=i}clone(){return new nD(this.color,this.near,this.far)}toJSON(){return{type:"Fog",name:this.name,color:this.color.getHex(),near:this.near,far:this.far}}}class l_e extends ga{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 c_e{constructor(e,n){this.isInterleavedBuffer=!0,this.array=e,this.stride=n,this.count=e!==void 0?e.length/n:0,this.usage=y3,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.version=0,this.uuid=rc()}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=rc()),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=rc()),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 la=new Ae;class Ru{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++)la.fromBufferAttribute(this,n),la.applyMatrix4(e),this.setXYZ(n,la.x,la.y,la.z);return this}applyNormalMatrix(e){for(let n=0,i=this.count;n<i;n++)la.fromBufferAttribute(this,n),la.applyNormalMatrix(e),this.setXYZ(n,la.x,la.y,la.z);return this}transformDirection(e){for(let n=0,i=this.count;n<i;n++)la.fromBufferAttribute(this,n),la.transformDirection(e),this.setXYZ(n,la.x,la.y,la.z);return this}setX(e,n){return this.normalized&&(n=Bn(n,this.array)),this.data.array[e*this.data.stride+this.offset]=n,this}setY(e,n){return this.normalized&&(n=Bn(n,this.array)),this.data.array[e*this.data.stride+this.offset+1]=n,this}setZ(e,n){return this.normalized&&(n=Bn(n,this.array)),this.data.array[e*this.data.stride+this.offset+2]=n,this}setW(e,n){return this.normalized&&(n=Bn(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=Ho(n,this.array)),n}getY(e){let n=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(n=Ho(n,this.array)),n}getZ(e){let n=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(n=Ho(n,this.array)),n}getW(e){let n=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(n=Ho(n,this.array)),n}setXY(e,n,i){return e=e*this.data.stride+this.offset,this.normalized&&(n=Bn(n,this.array),i=Bn(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=Bn(n,this.array),i=Bn(i,this.array),r=Bn(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=Bn(n,this.array),i=Bn(i,this.array),r=Bn(r,this.array),a=Bn(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 us(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 Ru(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 u_e extends ja{constructor(e=null,n=1,i=1,r,a,s,o,l,c=zr,d=zr,f,m){super(null,s,o,l,c,d,r,a,f,m),this.isDataTexture=!0,this.image={data:e,width:n,height:i},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}function d_e(t,e){return t.z-e.z}function f_e(t,e){return e.z-t.z}class h_e{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 rp="batchId",fu=new Qn,b5=new Qn,p_e=new Qn,_5=new Qn,kT=new ZS,yb=new Vs,Ud=new qo,Ug=new Ae,OT=new h_e,Zr=new go,bb=[];function m_e(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 g_e extends go{get maxGeometryCount(){return this._maxGeometryCount}constructor(e,n,i=n*2,r){super(new ra,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 u_e(n,e,e,Us,Zl);this._matricesTexture=i}_initializeGeometry(e){const n=this.geometry,i=this._maxVertexCount,r=this._maxGeometryCount,a=this._maxIndexCount;if(this._geometryInitialized===!1){for(const o in e.attributes){const l=e.getAttribute(o),{array:c,itemSize:d,normalized:f}=l,m=new c.constructor(i*d),g=new l.constructor(m,d,f);g.setUsage(l.usage),n.setAttribute(o,g)}if(e.getIndex()!==null){const o=i>65536?new Uint32Array(a):new Uint16Array(a);n.setIndex(new us(o,1))}const s=r>65536?new Uint32Array(i):new Uint16Array(i);n.setAttribute(rp,new us(s,1)),this._geometryInitialized=!0}}_validateGeometry(e){if(e.getAttribute(rp))throw new Error(`BatchedMesh: Geometry cannot use attribute "${rp}"`);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===rp)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 Vs);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,fu),this.getBoundingBoxAt(r,yb).applyMatrix4(fu),n.union(yb))}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new qo);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,fu),this.getBoundingSphereAt(r,Ud).applyMatrix4(fu),n.union(Ud))}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,o=this._drawRanges,l=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 c=e.getIndex(),d=c!==null;if(d&&(i===-1?r.indexCount=c.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 f=this._visibility,m=this._active,g=this._matricesTexture,y=this._matricesTexture.image.data;f.push(!0),m.push(!0);const _=this._geometryCount;this._geometryCount++,p_e.toArray(y,_*16),g.needsUpdate=!0,s.push(r),o.push({start:d?r.indexStart:r.vertexStart,count:-1}),l.push({boxInitialized:!1,box:new Vs,sphereInitialized:!1,sphere:new qo});const v=this.geometry.getAttribute(rp);for(let x=0;x<r.vertexCount;x++)v.setX(r.vertexStart+x,_);return v.needsUpdate=!0,this.setGeometryAt(_,e),_}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(),o=this._reservedRanges[e];if(r&&s.count>o.indexCount||n.attributes.position.count>o.vertexCount)throw new Error("BatchedMesh: Reserved space not large enough for provided geometry.");const l=o.vertexStart,c=o.vertexCount;for(const g in i.attributes){if(g===rp)continue;const y=n.getAttribute(g),_=i.getAttribute(g);m_e(y,_,l);const v=y.itemSize;for(let x=y.count,M=c;x<M;x++){const w=l+x;for(let T=0;T<v;T++)_.setComponent(w,T,0)}_.needsUpdate=!0}if(r){const g=o.indexStart;for(let y=0;y<s.count;y++)a.setX(g+y,l+s.getX(y));for(let y=s.count,_=o.indexCount;y<_;y++)a.setX(g+y,l);a.needsUpdate=!0}const d=this._bounds[e];n.boundingBox!==null?(d.box.copy(n.boundingBox),d.boxInitialized=!0):d.boxInitialized=!1,n.boundingSphere!==null?(d.sphere.copy(n.boundingSphere),d.sphereInitialized=!0):d.sphereInitialized=!1;const f=this._drawRanges[e],m=n.getAttribute("position");return f.count=r?s.count:m.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 o=s.index,l=s.attributes.position,c=this._drawRanges[e];for(let d=c.start,f=c.start+c.count;d<f;d++){let m=d;o&&(m=o.getX(m)),a.expandByPoint(Ug.fromBufferAttribute(l,m))}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,yb),yb.getCenter(a.center);const o=s.index,l=s.attributes.position,c=this._drawRanges[e];let d=0;for(let f=c.start,m=c.start+c.count;f<m;f++){let g=f;o&&(g=o.getX(g)),Ug.fromBufferAttribute(l,g),d=Math.max(d,a.center.distanceToSquared(Ug))}a.radius=Math.sqrt(d),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,o=this.matrixWorld,l=this.geometry;Zr.material=this.material,Zr.geometry.index=l.index,Zr.geometry.attributes=l.attributes,Zr.geometry.boundingBox===null&&(Zr.geometry.boundingBox=new Vs),Zr.geometry.boundingSphere===null&&(Zr.geometry.boundingSphere=new qo);for(let c=0;c<s;c++){if(!i[c]||!r[c])continue;const d=a[c];Zr.geometry.setDrawRange(d.start,d.count),this.getMatrixAt(c,Zr.matrixWorld).premultiply(o),this.getBoundingBoxAt(c,Zr.geometry.boundingBox),this.getBoundingSphereAt(c,Zr.geometry.boundingSphere),Zr.raycast(e,bb);for(let f=0,m=bb.length;f<m;f++){const g=bb[f];g.object=this,g.batchId=c,n.push(g)}bb.length=0}Zr.material=null,Zr.geometry.index=null,Zr.geometry.attributes={},Zr.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(),o=s===null?1:s.array.BYTES_PER_ELEMENT,l=this._visibility,c=this._multiDrawStarts,d=this._multiDrawCounts,f=this._drawRanges,m=this.perObjectFrustumCulled;m&&(_5.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse).multiply(this.matrixWorld),kT.setFromProjectionMatrix(_5,e.isWebGPURenderer?q0:Go));let g=0;if(this.sortObjects){b5.copy(this.matrixWorld).invert(),Ug.setFromMatrixPosition(i.matrixWorld).applyMatrix4(b5);for(let v=0,x=l.length;v<x;v++)if(l[v]){this.getMatrixAt(v,fu),this.getBoundingSphereAt(v,Ud).applyMatrix4(fu);let M=!1;if(m&&(M=!kT.intersectsSphere(Ud)),!M){const w=Ug.distanceTo(Ud.center);OT.push(f[v],w)}}const y=OT.list,_=this.customSort;_===null?y.sort(a.transparent?f_e:d_e):_.call(this,y,i);for(let v=0,x=y.length;v<x;v++){const M=y[v];c[g]=M.start*o,d[g]=M.count,g++}OT.reset()}else for(let y=0,_=l.length;y<_;y++)if(l[y]){let v=!1;if(m&&(this.getMatrixAt(y,fu),this.getBoundingSphereAt(y,Ud).applyMatrix4(fu),v=!kT.intersectsSphere(Ud)),!v){const x=f[y];c[g]=x.start*o,d[g]=x.count,g++}}this._multiDrawCount=g,this._visibilityChanged=!1}onBeforeShadow(e,n,i,r,a,s){this.onBeforeRender(e,null,r,a,s)}}class Ox extends gm{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new zt(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 S5=new Ae,w5=new Ae,M5=new Qn,LT=new QP,_b=new qo;class x_e extends ga{constructor(e=new ra,n=new Ox){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++)S5.fromBufferAttribute(n,r-1),w5.fromBufferAttribute(n,r),i[r]=i[r-1],i[r]+=S5.distanceTo(w5);e.setAttribute("lineDistance",new ki(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(),_b.copy(i.boundingSphere),_b.applyMatrix4(r),_b.radius+=a,e.ray.intersectsSphere(_b)===!1)return;M5.copy(r).invert(),LT.copy(e.ray).applyMatrix4(M5);const o=a/((this.scale.x+this.scale.y+this.scale.z)/3),l=o*o,c=new Ae,d=new Ae,f=new Ae,m=new Ae,g=this.isLineSegments?2:1,y=i.index,v=i.attributes.position;if(y!==null){const x=Math.max(0,s.start),M=Math.min(y.count,s.start+s.count);for(let w=x,T=M-1;w<T;w+=g){const C=y.getX(w),P=y.getX(w+1);if(c.fromBufferAttribute(v,C),d.fromBufferAttribute(v,P),LT.distanceSqToSegment(c,d,m,f)>l)continue;m.applyMatrix4(this.matrixWorld);const U=e.ray.origin.distanceTo(m);U<e.near||U>e.far||n.push({distance:U,point:f.clone().applyMatrix4(this.matrixWorld),index:w,face:null,faceIndex:null,object:this})}}else{const x=Math.max(0,s.start),M=Math.min(v.count,s.start+s.count);for(let w=x,T=M-1;w<T;w+=g){if(c.fromBufferAttribute(v,w),d.fromBufferAttribute(v,w+1),LT.distanceSqToSegment(c,d,m,f)>l)continue;m.applyMatrix4(this.matrixWorld);const P=e.ray.origin.distanceTo(m);P<e.near||P>e.far||n.push({distance:P,point:f.clone().applyMatrix4(this.matrixWorld),index:w,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 o=r[a].name||String(a);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=a}}}}}const E5=new Ae,A5=new Ae;class JS extends x_e{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)E5.fromBufferAttribute(n,r),A5.fromBufferAttribute(n,r+1),i[r]=r===0?0:i[r-1],i[r+1]=i[r]+E5.distanceTo(A5);e.setAttribute("lineDistance",new ki(i,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class v_e extends ra{constructor(e=null){if(super(),this.type="WireframeGeometry",this.parameters={geometry:e},e!==null){const n=[],i=new Set,r=new Ae,a=new Ae;if(e.index!==null){const s=e.attributes.position,o=e.index;let l=e.groups;l.length===0&&(l=[{start:0,count:o.count,materialIndex:0}]);for(let c=0,d=l.length;c<d;++c){const f=l[c],m=f.start,g=f.count;for(let y=m,_=m+g;y<_;y+=3)for(let v=0;v<3;v++){const x=o.getX(y+v),M=o.getX(y+(v+1)%3);r.fromBufferAttribute(s,x),a.fromBufferAttribute(s,M),T5(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 o=0,l=s.count/3;o<l;o++)for(let c=0;c<3;c++){const d=3*o+c,f=3*o+(c+1)%3;r.fromBufferAttribute(s,d),a.fromBufferAttribute(s,f),T5(r,a,i)===!0&&(n.push(r.x,r.y,r.z),n.push(a.x,a.y,a.z))}}this.setAttribute("position",new ki(n,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}}function T5(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 y_e extends gm{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new zt(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new zt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=t7,this.normalScale=new Wt(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=XP,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 b_e extends Ox{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 w7 extends ga{constructor(e,n=1){super(),this.isLight=!0,this.type="Light",this.color=new zt(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 IT=new Qn,C5=new Ae,N5=new Ae;class __e{constructor(e){this.camera=e,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new Wt(512,512),this.map=null,this.mapPass=null,this.matrix=new Qn,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new ZS,this._frameExtents=new Wt(1,1),this._viewportCount=1,this._viewports=[new $n(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const n=this.camera,i=this.matrix;C5.setFromMatrixPosition(e.matrixWorld),n.position.copy(C5),N5.setFromMatrixPosition(e.target.matrixWorld),n.lookAt(N5),n.updateMatrixWorld(),IT.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(IT),i.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),i.multiply(IT)}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 R5=new Qn,jg=new Ae,UT=new Ae;class S_e extends __e{constructor(){super(new rs(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new Wt(4,2),this._viewportCount=6,this._viewports=[new $n(2,1,1,1),new $n(0,1,1,1),new $n(3,1,1,1),new $n(1,1,1,1),new $n(3,0,1,1),new $n(1,0,1,1)],this._cubeDirections=[new Ae(1,0,0),new Ae(-1,0,0),new Ae(0,0,1),new Ae(0,0,-1),new Ae(0,1,0),new Ae(0,-1,0)],this._cubeUps=[new Ae(0,1,0),new Ae(0,1,0),new Ae(0,1,0),new Ae(0,1,0),new Ae(0,0,1),new Ae(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()),jg.setFromMatrixPosition(e.matrixWorld),i.position.copy(jg),UT.copy(i.position),UT.add(this._cubeDirections[n]),i.up.copy(this._cubeUps[n]),i.lookAt(UT),i.updateMatrixWorld(),r.makeTranslation(-jg.x,-jg.y,-jg.z),R5.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),this._frustum.setFromProjectionMatrix(R5)}}class w_e extends w7{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 S_e}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 M_e extends w7{constructor(e,n){super(e,n),this.isAmbientLight=!0,this.type="AmbientLight"}}class E_e extends ra{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 M3 extends c_e{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 P5{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 D5=new Ae,Sb=new Ae;class A_e{constructor(e=new Ae,n=new Ae){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){D5.subVectors(e,this.start),Sb.subVectors(this.end,this.start);const i=Sb.dot(Sb);let a=Sb.dot(D5)/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 T_e extends JS{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 ra;r.setAttribute("position",new ki(n,3)),r.setAttribute("color",new ki(i,3));const a=new Ox({vertexColors:!0,toneMapped:!1});super(r,a),this.type="AxesHelper"}setColors(e,n,i){const r=new zt,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:XS}}));typeof window<"u"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=XS);class Xo{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"),Xo.nextNameID=Xo.nextNameID||0,this.$name.id=`lil-gui-name-${++Xo.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 C_e extends Xo{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 E3(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 N_e={isPrimitive:!0,match:t=>typeof t=="string",fromHexString:E3,toHexString:E3},K0={isPrimitive:!0,match:t=>typeof t=="number",fromHexString:t=>parseInt(t.substring(1),16),toHexString:t=>"#"+t.toString(16).padStart(6,0)},R_e={isPrimitive:!1,match:t=>Array.isArray(t),fromHexString(t,e,n=1){const i=K0.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 K0.toHexString(r)}},P_e={isPrimitive:!1,match:t=>Object(t)===t,fromHexString(t,e,n=1){const i=K0.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 K0.toHexString(r)}},D_e=[N_e,K0,R_e,P_e];function k_e(t){return D_e.find(e=>e.match(t))}class O_e extends Xo{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=k_e(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=E3(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 jT extends Xo{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 L_e extends Xo{constructor(e,n,i,r,a,s){super(e,n,i,"number"),this._initInput(),this.min(r),this.max(a);const o=s!==void 0;this.step(o?s:this._getImplicitStep(),o),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 M=parseFloat(this.$input.value);isNaN(M)||(this._stepExplicit&&(M=this._snap(M)),this.setValue(this._clamp(M)))},i=M=>{const w=parseFloat(this.$input.value);isNaN(w)||(this._snapClampSetValue(w+M),this.$input.value=this.getValue())},r=M=>{M.key==="Enter"&&this.$input.blur(),M.code==="ArrowUp"&&(M.preventDefault(),i(this._step*this._arrowKeyMultiplier(M))),M.code==="ArrowDown"&&(M.preventDefault(),i(this._step*this._arrowKeyMultiplier(M)*-1))},a=M=>{this._inputFocused&&(M.preventDefault(),i(this._step*this._normalizeMouseWheel(M)))};let s=!1,o,l,c,d,f;const m=5,g=M=>{o=M.clientX,l=c=M.clientY,s=!0,d=this.getValue(),f=0,window.addEventListener("mousemove",y),window.addEventListener("mouseup",_)},y=M=>{if(s){const w=M.clientX-o,T=M.clientY-l;Math.abs(T)>m?(M.preventDefault(),this.$input.blur(),s=!1,this._setDraggingStyle(!0,"vertical")):Math.abs(w)>m&&_()}if(!s){const w=M.clientY-c;f-=w*this._step*this._arrowKeyMultiplier(M),d+f>this._max?f=this._max-d:d+f<this._min&&(f=this._min-d),this._snapClampSetValue(d+f)}c=M.clientY},_=()=>{this._setDraggingStyle(!1,"vertical"),this._callOnFinishChange(),window.removeEventListener("mousemove",y),window.removeEventListener("mouseup",_)},v=()=>{this._inputFocused=!0},x=()=>{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",g),this.$input.addEventListener("focus",v),this.$input.addEventListener("blur",x)}_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=(x,M,w,T,C)=>(x-M)/(w-M)*(C-T)+T,n=x=>{const M=this.$slider.getBoundingClientRect();let w=e(x,M.left,M.right,this._min,this._max);this._snapClampSetValue(w)},i=x=>{this._setDraggingStyle(!0),n(x.clientX),window.addEventListener("mousemove",r),window.addEventListener("mouseup",a)},r=x=>{n(x.clientX)},a=()=>{this._callOnFinishChange(),this._setDraggingStyle(!1),window.removeEventListener("mousemove",r),window.removeEventListener("mouseup",a)};let s=!1,o,l;const c=x=>{x.preventDefault(),this._setDraggingStyle(!0),n(x.touches[0].clientX),s=!1},d=x=>{x.touches.length>1||(this._hasScrollBar?(o=x.touches[0].clientX,l=x.touches[0].clientY,s=!0):c(x),window.addEventListener("touchmove",f,{passive:!1}),window.addEventListener("touchend",m))},f=x=>{if(s){const M=x.touches[0].clientX-o,w=x.touches[0].clientY-l;Math.abs(M)>Math.abs(w)?c(x):(window.removeEventListener("touchmove",f),window.removeEventListener("touchend",m))}else x.preventDefault(),n(x.touches[0].clientX)},m=()=>{this._callOnFinishChange(),this._setDraggingStyle(!1),window.removeEventListener("touchmove",f),window.removeEventListener("touchend",m)},g=this._callOnFinishChange.bind(this),y=400;let _;const v=x=>{if(Math.abs(x.deltaX)<Math.abs(x.deltaY)&&this._hasScrollBar)return;x.preventDefault();const w=this._normalizeMouseWheel(x)*this._step;this._snapClampSetValue(this.getValue()+w),this.$input.value=this.getValue(),clearTimeout(_),_=setTimeout(g,y)};this.$slider.addEventListener("mousedown",i),this.$slider.addEventListener("touchstart",d,{passive:!1}),this.$slider.addEventListener("wheel",v,{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 I_e extends Xo{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 U_e extends Xo{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 j_e=`.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 F_e(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 k5=!1;class Y_{constructor({parent:e,autoPlace:n=e===void 0,container:i,width:r,title:a="Controls",closeFolders:s=!1,injectStyles:o=!0,touchStyles:l=!0}={}){if(this.parent=e,this.root=e?e.root:this,this.children=[],this.controllers=[],this.folders=[],this._closed=!1,this._hidden=!1,this.domElement=document.createElement("div"),this.domElement.classList.add("lil-gui"),this.$title=document.createElement("div"),this.$title.classList.add("title"),this.$title.setAttribute("role","button"),this.$title.setAttribute("aria-expanded",!0),this.$title.setAttribute("tabindex",0),this.$title.addEventListener("click",()=>this.openAnimated(this._closed)),this.$title.addEventListener("keydown",c=>{(c.code==="Enter"||c.code==="Space")&&(c.preventDefault(),this.$title.click())}),this.$title.addEventListener("touchstart",()=>{},{passive:!0}),this.$children=document.createElement("div"),this.$children.classList.add("children"),this.domElement.appendChild(this.$title),this.domElement.appendChild(this.$children),this.title(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"),l&&this.domElement.classList.add("allow-touch-styles"),!k5&&o&&(F_e(j_e),k5=!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 I_e(this,e,n,i);const s=e[n];switch(typeof s){case"number":return new L_e(this,e,n,i,r,a);case"boolean":return new C_e(this,e,n);case"string":return new U_e(this,e,n);case"function":return new jT(this,e,n)}console.error(`gui.add failed
  7812. property:`,n,`
  7813. object:`,e,`
  7814. value:`,s)}addColor(e,n,i=1){return new O_e(this,e,n,i)}addFolder(e){const n=new Y_({parent:this,title:e});return this.root._closeFolders&&n.close(),n}load(e,n=!0){return e.controllers&&this.controllers.forEach(i=>{i instanceof jT||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 jT)){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 FT(t,e,n,i){return new(n||(n=Promise))((function(r,a){function s(c){try{l(i.next(c))}catch(d){a(d)}}function o(c){try{l(i.throw(c))}catch(d){a(d)}}function l(c){var d;c.done?r(c.value):(d=c.value,d instanceof n?d:new n((function(f){f(d)}))).then(s,o)}l((i=i.apply(t,[])).next())}))}class iD{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 iD(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 rD{constructor(e,n,i,r){this.src=e,this.gcode=n,this.params=i,this.comment=r}}class O5 extends rD{constructor(e,n,i,r){super(e,n,i,r),this.params=i}}class hu extends rD{constructor(e,n,i,r){super(e,n,void 0,i),this.toolIndex=r}}class L5{constructor(e,n,i,r=0){this.layer=e,this.commands=n,this.lineNumber=i,this.height=r}}class Z_{constructor(e){this.lines=[],this.preamble=new L5(-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,o=a.split(/([a-zA-Z])/g).slice(1).map((d=>d.trim())),l=o.length?`${(i=o[0])===null||i===void 0?void 0:i.toLowerCase()}${o[1]}`:"",c=this.parseParams(o.slice(2));switch(l){case"g0":case"g00":case"g1":case"g01":case"g2":case"g02":case"g3":case"g03":return new O5(e,l,c,s);case"t0":return new hu(e,l,s,0);case"t1":return new hu(e,l,s,1);case"t2":return new hu(e,l,s,2);case"t3":return new hu(e,l,s,3);case"t4":return new hu(e,l,s,4);case"t5":return new hu(e,l,s,5);case"t6":return new hu(e,l,s,6);case"t7":return new hu(e,l,s,7);default:return new rD(e,l,c,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 O5){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 L5(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"),o=a.indexOf("thumbnail end");s>-1?i=iD.parse(a.slice(s+15).trim()):i&&(o==-1?i.chars+=a.trim():(i.isValid&&(n[i.size]=i),i=void 0))}return{thumbnails:n}}}Z_.prototype.parseGcode=Z_.prototype.parseGCode;const I5={type:"change"},zT={type:"start"},U5={type:"end"},wb=new QP,j5=new xu,z_e=Math.cos(70*i7.DEG2RAD);class B_e extends Hf{constructor(e,n){super(),this.object=e,this.domElement=n,this.domElement.style.touchAction="none",this.enabled=!0,this.target=new Ae,this.cursor=new Ae,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:zh.ROTATE,MIDDLE:zh.DOLLY,RIGHT:zh.PAN},this.touches={ONE:Bh.ROTATE,TWO:Bh.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 o.phi},this.getAzimuthalAngle=function(){return o.theta},this.getDistance=function(){return this.object.position.distanceTo(this.target)},this.listenToKeyEvents=function(q){q.addEventListener("keydown",je),this._domElementKeyEvents=q},this.stopListenToKeyEvents=function(){this._domElementKeyEvents.removeEventListener("keydown",je),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(I5),i.update(),a=r.NONE},this.update=(function(){const q=new Ae,re=new Tf().setFromUnitVectors(e.up,new Ae(0,1,0)),J=re.clone().invert(),ee=new Ae,oe=new Tf,De=new Ae,Ne=2*Math.PI;return function(te=null){const j=i.object.position;q.copy(j).sub(i.target),q.applyQuaternion(re),o.setFromVector3(q),i.autoRotate&&a===r.NONE&&D((function(ye){return ye!==null?2*Math.PI/60*i.autoRotateSpeed*ye:2*Math.PI/60/60*i.autoRotateSpeed})(te)),i.enableDamping?(o.theta+=l.theta*i.dampingFactor,o.phi+=l.phi*i.dampingFactor):(o.theta+=l.theta,o.phi+=l.phi);let L=i.minAzimuthAngle,Y=i.maxAzimuthAngle;isFinite(L)&&isFinite(Y)&&(L<-Math.PI?L+=Ne:L>Math.PI&&(L-=Ne),Y<-Math.PI?Y+=Ne:Y>Math.PI&&(Y-=Ne),o.theta=L<=Y?Math.max(L,Math.min(Y,o.theta)):o.theta>(L+Y)/2?Math.max(L,o.theta):Math.min(Y,o.theta)),o.phi=Math.max(i.minPolarAngle,Math.min(i.maxPolarAngle,o.phi)),o.makeSafe(),i.enableDamping===!0?i.target.addScaledVector(d,i.dampingFactor):i.target.add(d),i.target.sub(i.cursor),i.target.clampLength(i.minTargetRadius,i.maxTargetRadius),i.target.add(i.cursor),i.zoomToCursor&&P||i.object.isOrthographicCamera?o.radius=K(o.radius):o.radius=K(o.radius*c),q.setFromSpherical(o),q.applyQuaternion(J),j.copy(i.target).add(q),i.object.lookAt(i.target),i.enableDamping===!0?(l.theta*=1-i.dampingFactor,l.phi*=1-i.dampingFactor,d.multiplyScalar(1-i.dampingFactor)):(l.set(0,0,0),d.set(0,0,0));let me=!1;if(i.zoomToCursor&&P){let ye=null;if(i.object.isPerspectiveCamera){const pe=q.length();ye=K(pe*c);const Ze=pe-ye;i.object.position.addScaledVector(T,Ze),i.object.updateMatrixWorld()}else if(i.object.isOrthographicCamera){const pe=new Ae(C.x,C.y,0);pe.unproject(i.object),i.object.zoom=Math.max(i.minZoom,Math.min(i.maxZoom,i.object.zoom/c)),i.object.updateProjectionMatrix(),me=!0;const Ze=new Ae(C.x,C.y,0);Ze.unproject(i.object),i.object.position.sub(Ze).add(pe),i.object.updateMatrixWorld(),ye=q.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),i.zoomToCursor=!1;ye!==null&&(this.screenSpacePanning?i.target.set(0,0,-1).transformDirection(i.object.matrix).multiplyScalar(ye).add(i.object.position):(wb.origin.copy(i.object.position),wb.direction.set(0,0,-1).transformDirection(i.object.matrix),Math.abs(i.object.up.dot(wb.direction))<z_e?e.lookAt(i.target):(j5.setFromNormalAndCoplanarPoint(i.object.up,i.target),wb.intersectPlane(j5,i.target))))}else i.object.isOrthographicCamera&&(i.object.zoom=Math.max(i.minZoom,Math.min(i.maxZoom,i.object.zoom/c)),i.object.updateProjectionMatrix(),me=!0);return c=1,P=!1,!!(me||ee.distanceToSquared(i.object.position)>s||8*(1-oe.dot(i.object.quaternion))>s||De.distanceToSquared(i.target)>0)&&(i.dispatchEvent(I5),ee.copy(i.object.position),oe.copy(i.object.quaternion),De.copy(i.target),!0)}})(),this.dispose=function(){i.domElement.removeEventListener("contextmenu",ue),i.domElement.removeEventListener("pointerdown",ve),i.domElement.removeEventListener("pointercancel",he),i.domElement.removeEventListener("wheel",we),i.domElement.removeEventListener("pointermove",Pe),i.domElement.removeEventListener("pointerup",he),i._domElementKeyEvents!==null&&(i._domElementKeyEvents.removeEventListener("keydown",je),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,o=new P5,l=new P5;let c=1;const d=new Ae,f=new Wt,m=new Wt,g=new Wt,y=new Wt,_=new Wt,v=new Wt,x=new Wt,M=new Wt,w=new Wt,T=new Ae,C=new Wt;let P=!1;const A=[],U={};function N(){return Math.pow(.95,i.zoomSpeed)}function D(q){l.theta-=q}function F(q){l.phi-=q}const I=(function(){const q=new Ae;return function(re,J){q.setFromMatrixColumn(J,0),q.multiplyScalar(-re),d.add(q)}})(),W=(function(){const q=new Ae;return function(re,J){i.screenSpacePanning===!0?q.setFromMatrixColumn(J,1):(q.setFromMatrixColumn(J,0),q.crossVectors(i.object.up,q)),q.multiplyScalar(re),d.add(q)}})(),O=(function(){const q=new Ae;return function(re,J){const ee=i.domElement;if(i.object.isPerspectiveCamera){const oe=i.object.position;q.copy(oe).sub(i.target);let De=q.length();De*=Math.tan(i.object.fov/2*Math.PI/180),I(2*re*De/ee.clientHeight,i.object.matrix),W(2*J*De/ee.clientHeight,i.object.matrix)}else i.object.isOrthographicCamera?(I(re*(i.object.right-i.object.left)/i.object.zoom/ee.clientWidth,i.object.matrix),W(J*(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 B(q){i.object.isPerspectiveCamera||i.object.isOrthographicCamera?c/=q:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),i.enableZoom=!1)}function H(q){i.object.isPerspectiveCamera||i.object.isOrthographicCamera?c*=q:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),i.enableZoom=!1)}function $(q){if(!i.zoomToCursor)return;P=!0;const re=i.domElement.getBoundingClientRect(),J=q.clientX-re.left,ee=q.clientY-re.top,oe=re.width,De=re.height;C.x=J/oe*2-1,C.y=-ee/De*2+1,T.set(C.x,C.y,1).unproject(i.object).sub(i.object.position).normalize()}function K(q){return Math.max(i.minDistance,Math.min(i.maxDistance,q))}function Z(q){f.set(q.clientX,q.clientY)}function se(q){y.set(q.clientX,q.clientY)}function V(){if(A.length===1)f.set(A[0].pageX,A[0].pageY);else{const q=.5*(A[0].pageX+A[1].pageX),re=.5*(A[0].pageY+A[1].pageY);f.set(q,re)}}function X(){if(A.length===1)y.set(A[0].pageX,A[0].pageY);else{const q=.5*(A[0].pageX+A[1].pageX),re=.5*(A[0].pageY+A[1].pageY);y.set(q,re)}}function ae(){const q=A[0].pageX-A[1].pageX,re=A[0].pageY-A[1].pageY,J=Math.sqrt(q*q+re*re);x.set(0,J)}function ce(q){if(A.length==1)m.set(q.pageX,q.pageY);else{const J=z(q),ee=.5*(q.pageX+J.x),oe=.5*(q.pageY+J.y);m.set(ee,oe)}g.subVectors(m,f).multiplyScalar(i.rotateSpeed);const re=i.domElement;D(2*Math.PI*g.x/re.clientHeight),F(2*Math.PI*g.y/re.clientHeight),f.copy(m)}function ge(q){if(A.length===1)_.set(q.pageX,q.pageY);else{const re=z(q),J=.5*(q.pageX+re.x),ee=.5*(q.pageY+re.y);_.set(J,ee)}v.subVectors(_,y).multiplyScalar(i.panSpeed),O(v.x,v.y),y.copy(_)}function ne(q){const re=z(q),J=q.pageX-re.x,ee=q.pageY-re.y,oe=Math.sqrt(J*J+ee*ee);M.set(0,oe),w.set(0,Math.pow(M.y/x.y,i.zoomSpeed)),B(w.y),x.copy(M)}function ve(q){i.enabled!==!1&&(A.length===0&&(i.domElement.setPointerCapture(q.pointerId),i.domElement.addEventListener("pointermove",Pe),i.domElement.addEventListener("pointerup",he)),(function(re){A.push(re)})(q),q.pointerType==="touch"?(function(re){switch(lt(re),A.length){case 1:switch(i.touches.ONE){case Bh.ROTATE:if(i.enableRotate===!1)return;V(),a=r.TOUCH_ROTATE;break;case Bh.PAN:if(i.enablePan===!1)return;X(),a=r.TOUCH_PAN;break;default:a=r.NONE}break;case 2:switch(i.touches.TWO){case Bh.DOLLY_PAN:if(i.enableZoom===!1&&i.enablePan===!1)return;i.enableZoom&&ae(),i.enablePan&&X(),a=r.TOUCH_DOLLY_PAN;break;case Bh.DOLLY_ROTATE:if(i.enableZoom===!1&&i.enableRotate===!1)return;i.enableZoom&&ae(),i.enableRotate&&V(),a=r.TOUCH_DOLLY_ROTATE;break;default:a=r.NONE}break;default:a=r.NONE}a!==r.NONE&&i.dispatchEvent(zT)})(q):(function(re){let J;switch(re.button){case 0:J=i.mouseButtons.LEFT;break;case 1:J=i.mouseButtons.MIDDLE;break;case 2:J=i.mouseButtons.RIGHT;break;default:J=-1}switch(J){case zh.DOLLY:if(i.enableZoom===!1)return;(function(ee){$(ee),x.set(ee.clientX,ee.clientY)})(re),a=r.DOLLY;break;case zh.ROTATE:if(re.ctrlKey||re.metaKey||re.shiftKey){if(i.enablePan===!1)return;se(re),a=r.PAN}else{if(i.enableRotate===!1)return;Z(re),a=r.ROTATE}break;case zh.PAN:if(re.ctrlKey||re.metaKey||re.shiftKey){if(i.enableRotate===!1)return;Z(re),a=r.ROTATE}else{if(i.enablePan===!1)return;se(re),a=r.PAN}break;default:a=r.NONE}a!==r.NONE&&i.dispatchEvent(zT)})(q))}function Pe(q){i.enabled!==!1&&(q.pointerType==="touch"?(function(re){switch(lt(re),a){case r.TOUCH_ROTATE:if(i.enableRotate===!1)return;ce(re),i.update();break;case r.TOUCH_PAN:if(i.enablePan===!1)return;ge(re),i.update();break;case r.TOUCH_DOLLY_PAN:if(i.enableZoom===!1&&i.enablePan===!1)return;(function(J){i.enableZoom&&ne(J),i.enablePan&&ge(J)})(re),i.update();break;case r.TOUCH_DOLLY_ROTATE:if(i.enableZoom===!1&&i.enableRotate===!1)return;(function(J){i.enableZoom&&ne(J),i.enableRotate&&ce(J)})(re),i.update();break;default:a=r.NONE}})(q):(function(re){switch(a){case r.ROTATE:if(i.enableRotate===!1)return;(function(J){m.set(J.clientX,J.clientY),g.subVectors(m,f).multiplyScalar(i.rotateSpeed);const ee=i.domElement;D(2*Math.PI*g.x/ee.clientHeight),F(2*Math.PI*g.y/ee.clientHeight),f.copy(m),i.update()})(re);break;case r.DOLLY:if(i.enableZoom===!1)return;(function(J){M.set(J.clientX,J.clientY),w.subVectors(M,x),w.y>0?B(N()):w.y<0&&H(N()),x.copy(M),i.update()})(re);break;case r.PAN:if(i.enablePan===!1)return;(function(J){_.set(J.clientX,J.clientY),v.subVectors(_,y).multiplyScalar(i.panSpeed),O(v.x,v.y),y.copy(_),i.update()})(re)}})(q))}function he(q){(function(re){delete U[re.pointerId];for(let J=0;J<A.length;J++)if(A[J].pointerId==re.pointerId)return void A.splice(J,1)})(q),A.length===0&&(i.domElement.releasePointerCapture(q.pointerId),i.domElement.removeEventListener("pointermove",Pe),i.domElement.removeEventListener("pointerup",he)),i.dispatchEvent(U5),a=r.NONE}function we(q){i.enabled!==!1&&i.enableZoom!==!1&&a===r.NONE&&(q.preventDefault(),i.dispatchEvent(zT),(function(re){$(re),re.deltaY<0?H(N()):re.deltaY>0&&B(N()),i.update()})(q),i.dispatchEvent(U5))}function je(q){i.enabled!==!1&&i.enablePan!==!1&&(function(re){let J=!1;switch(re.code){case i.keys.UP:re.ctrlKey||re.metaKey||re.shiftKey?F(2*Math.PI*i.rotateSpeed/i.domElement.clientHeight):O(0,i.keyPanSpeed),J=!0;break;case i.keys.BOTTOM:re.ctrlKey||re.metaKey||re.shiftKey?F(-2*Math.PI*i.rotateSpeed/i.domElement.clientHeight):O(0,-i.keyPanSpeed),J=!0;break;case i.keys.LEFT:re.ctrlKey||re.metaKey||re.shiftKey?D(2*Math.PI*i.rotateSpeed/i.domElement.clientHeight):O(i.keyPanSpeed,0),J=!0;break;case i.keys.RIGHT:re.ctrlKey||re.metaKey||re.shiftKey?D(-2*Math.PI*i.rotateSpeed/i.domElement.clientHeight):O(-i.keyPanSpeed,0),J=!0}J&&(re.preventDefault(),i.update())})(q)}function ue(q){i.enabled!==!1&&q.preventDefault()}function lt(q){let re=U[q.pointerId];re===void 0&&(re=new Wt,U[q.pointerId]=re),re.set(q.pageX,q.pageY)}function z(q){const re=q.pointerId===A[0].pointerId?A[1]:A[0];return U[re.pointerId]}i.domElement.addEventListener("contextmenu",ue),i.domElement.addEventListener("pointerdown",ve),i.domElement.addEventListener("pointercancel",he),i.domElement.addEventListener("wheel",we,{passive:!1}),this.update()}}yt.line={worldUnits:{value:1},linewidth:{value:1},resolution:{value:new Wt(1,1)},dashOffset:{value:0},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1}},ka.line={uniforms:JP.merge([yt.common,yt.fog,yt.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 M7 extends Xu{constructor(e){super({type:"LineMaterial",uniforms:JP.clone(ka.line.uniforms),vertexShader:ka.line.vertexShader,fragmentShader:ka.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 F5=new Vs,Mb=new Ae;class E7 extends E_e{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 ki([-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 ki([-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 M3(n,6,1);return this.setAttribute("instanceStart",new Ru(i,3,0)),this.setAttribute("instanceEnd",new Ru(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 M3(n,6,1);return this.setAttribute("instanceColorStart",new Ru(i,3,0)),this.setAttribute("instanceColorEnd",new Ru(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 v_e(e.geometry)),this}fromLineSegments(e){const n=e.geometry;return this.setPositions(n.attributes.position.array),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Vs);const e=this.attributes.instanceStart,n=this.attributes.instanceEnd;e!==void 0&&n!==void 0&&(this.boundingBox.setFromBufferAttribute(e),F5.setFromBufferAttribute(n),this.boundingBox.union(F5))}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new qo),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++)Mb.fromBufferAttribute(e,a),r=Math.max(r,i.distanceToSquared(Mb)),Mb.fromBufferAttribute(n,a),r=Math.max(r,i.distanceToSquared(Mb));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 z5=new Ae,B5=new Ae,Lr=new $n,Ir=new $n,Do=new $n,BT=new Ae,HT=new Qn,Ur=new A_e,H5=new Ae,Eb=new Vs,Ab=new qo,ko=new $n;let Oo,qd;function V5(t,e,n){return ko.set(0,0,-e,1).applyMatrix4(t.projectionMatrix),ko.multiplyScalar(1/ko.w),ko.x=qd/n.width,ko.y=qd/n.height,ko.applyMatrix4(t.projectionMatrixInverse),ko.multiplyScalar(1/ko.w),Math.abs(Math.max(ko.x,ko.y))}class H_e extends go{constructor(e=new E7,n=new M7({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,o=0,l=n.count;s<l;s++,o+=2)z5.fromBufferAttribute(n,s),B5.fromBufferAttribute(i,s),r[o]=o===0?0:r[o-1],r[o+1]=r[o]+z5.distanceTo(B5);const a=new M3(r,2,1);return e.setAttribute("instanceDistanceStart",new Ru(a,1,0)),e.setAttribute("instanceDistanceEnd",new Ru(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;Oo=e.ray;const s=this.matrixWorld,o=this.geometry,l=this.material;let c,d;qd=l.linewidth+a,o.boundingSphere===null&&o.computeBoundingSphere(),Ab.copy(o.boundingSphere).applyMatrix4(s),i?c=.5*qd:c=V5(r,Math.max(r.near,Ab.distanceToPoint(Oo.origin)),l.resolution),Ab.radius+=c,Oo.intersectsSphere(Ab)!==!1&&(o.boundingBox===null&&o.computeBoundingBox(),Eb.copy(o.boundingBox).applyMatrix4(s),i?d=.5*qd:d=V5(r,Math.max(r.near,Eb.distanceToPoint(Oo.origin)),l.resolution),Eb.expandByScalar(d),Oo.intersectsBox(Eb)!==!1&&(i?(function(f,m){const g=f.matrixWorld,y=f.geometry,_=y.attributes.instanceStart,v=y.attributes.instanceEnd;for(let x=0,M=Math.min(y.instanceCount,_.count);x<M;x++){Ur.start.fromBufferAttribute(_,x),Ur.end.fromBufferAttribute(v,x),Ur.applyMatrix4(g);const w=new Ae,T=new Ae;Oo.distanceSqToSegment(Ur.start,Ur.end,T,w),T.distanceTo(w)<.5*qd&&m.push({point:T,pointOnLine:w,distance:Oo.origin.distanceTo(T),object:f,face:null,faceIndex:x,uv:null,uv1:null})}})(this,n):(function(f,m,g){const y=m.projectionMatrix,_=f.material.resolution,v=f.matrixWorld,x=f.geometry,M=x.attributes.instanceStart,w=x.attributes.instanceEnd,T=Math.min(x.instanceCount,M.count),C=-m.near;Oo.at(1,Do),Do.w=1,Do.applyMatrix4(m.matrixWorldInverse),Do.applyMatrix4(y),Do.multiplyScalar(1/Do.w),Do.x*=_.x/2,Do.y*=_.y/2,Do.z=0,BT.copy(Do),HT.multiplyMatrices(m.matrixWorldInverse,v);for(let P=0,A=T;P<A;P++){if(Lr.fromBufferAttribute(M,P),Ir.fromBufferAttribute(w,P),Lr.w=1,Ir.w=1,Lr.applyMatrix4(HT),Ir.applyMatrix4(HT),Lr.z>C&&Ir.z>C)continue;if(Lr.z>C){const I=Lr.z-Ir.z,W=(Lr.z-C)/I;Lr.lerp(Ir,W)}else if(Ir.z>C){const I=Ir.z-Lr.z,W=(Ir.z-C)/I;Ir.lerp(Lr,W)}Lr.applyMatrix4(y),Ir.applyMatrix4(y),Lr.multiplyScalar(1/Lr.w),Ir.multiplyScalar(1/Ir.w),Lr.x*=_.x/2,Lr.y*=_.y/2,Ir.x*=_.x/2,Ir.y*=_.y/2,Ur.start.copy(Lr),Ur.start.z=0,Ur.end.copy(Ir),Ur.end.z=0;const U=Ur.closestPointToPointParameter(BT,!0);Ur.at(U,H5);const N=i7.lerp(Lr.z,Ir.z,U),D=N>=-1&&N<=1,F=BT.distanceTo(H5)<.5*qd;if(D&&F){Ur.start.fromBufferAttribute(M,P),Ur.end.fromBufferAttribute(w,P),Ur.start.applyMatrix4(v),Ur.end.applyMatrix4(v);const I=new Ae,W=new Ae;Oo.distanceSqToSegment(Ur.start,Ur.end,W,I),g.push({point:W,pointOnLine:I,distance:Oo.origin.distanceTo(W),object:f,face:null,faceIndex:P,uv:null,uv1:null})}}})(this,r,n)))}}class V_e extends JS{constructor(e,n,i,r,a=4473924,s=8947848){a=new zt(a),s=new zt(s);const o=Math.round(e/n);i=Math.round(i/r)*r/2;const l=[],c=[];let d=0;for(let m=-1*(e=o*n/2);m<=e;m+=n){l.push(m,0,-1*i,m,0,i);const g=m===0?a:s;g.toArray(c,d),d+=3,g.toArray(c,d),d+=3,g.toArray(c,d),d+=3,g.toArray(c,d),d+=3}for(let m=-1*i;m<=i;m+=r){l.push(-1*e,0,m,e,0,m);const g=m===0?a:s;g.toArray(c,d),d+=3,g.toArray(c,d),d+=3,g.toArray(c,d),d+=3,g.toArray(c,d),d+=3}const f=new ra;f.setAttribute("position",new ki(l,3)),f.setAttribute("color",new ki(c,3)),super(f,new Ox({vertexColors:!0,toneMapped:!1}))}}function $_e(t,e,n,i){const r=(function(s,o,l){s*=.5,o*=.5,l*=.5;const c=new ra,d=[];return d.push(-s,-o,-l,-s,o,-l,-s,o,-l,s,o,-l,s,o,-l,s,-o,-l,s,-o,-l,-s,-o,-l,-s,-o,l,-s,o,l,-s,o,l,s,o,l,s,o,l,s,-o,l,s,-o,l,-s,-o,l,-s,-o,-l,-s,-o,l,-s,o,-l,-s,o,l,s,o,-l,s,o,l,s,-o,-l,s,-o,l),c.setAttribute("position",new ki(d,3)),c})(t,e,n),a=new JS(r,new b_e({color:new zt(i),dashSize:3,gapSize:1}));return a.computeLineDistances(),a}var f0=function(){var t=0,e=document.createElement("div");function n(d){return e.appendChild(d.dom),d}function i(d){for(var f=0;f<e.children.length;f++)e.children[f].style.display=f===d?"block":"none";t=d}e.style.cssText="position:fixed;top:0;left:0;cursor:pointer;opacity:0.9;z-index:10000",e.addEventListener("click",(function(d){d.preventDefault(),i(++t%e.children.length)}),!1);var r=(performance||Date).now(),a=r,s=0,o=n(new f0.Panel("FPS","#0ff","#002")),l=n(new f0.Panel("MS","#0f0","#020"));if(self.performance&&self.performance.memory)var c=n(new f0.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 d=(performance||Date).now();if(l.update(d-r,200),d>=a+1e3&&(o.update(1e3*s/(d-a),100),a=d,s=0,c)){var f=performance.memory;c.update(f.usedJSHeapSize/1048576,f.jsHeapSizeLimit/1048576)}return d},update:function(){r=this.end()},domElement:e,setMode:i}};f0.Panel=function(t,e,n){var i=1/0,r=0,a=Math.round,s=a(window.devicePixelRatio||1),o=80*s,l=48*s,c=3*s,d=2*s,f=3*s,m=15*s,g=74*s,y=30*s,_=document.createElement("canvas");_.width=o,_.height=l,_.style.cssText="width:80px;height:48px";var v=_.getContext("2d");return v.font="bold "+9*s+"px Helvetica,Arial,sans-serif",v.textBaseline="top",v.fillStyle=n,v.fillRect(0,0,o,l),v.fillStyle=e,v.fillText(t,c,d),v.fillRect(f,m,g,y),v.fillStyle=n,v.globalAlpha=.9,v.fillRect(f,m,g,y),{dom:_,update:function(x,M){i=Math.min(i,x),r=Math.max(r,x),v.fillStyle=n,v.globalAlpha=1,v.fillRect(0,0,o,m),v.fillStyle=e,v.fillText(a(x)+" "+t+" ("+a(i)+"-"+a(r)+")",c,d),v.drawImage(_,f+s,m,g-s,y,f,m,g-s,y),v.fillRect(f+g-s,m,s,y),v.fillStyle=n,v.globalAlpha=.9,v.fillRect(f+g-s,m,s,a((1-x/M)*y))}}};var G_e=f0;class $5{constructor(e,n){this.openFolders=[],this.watchedObject=e,this.options=n,this.gui=new Y_,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 Y_,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 W_e extends ra{constructor(e=[new Ae],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 Ae,s=new Ae,o=new Wt,l=[],c=[],d=[],f=[];function m(g){const[y,_,v]=(function(x){const M=e[x],w=new Ae,T=new Ae,C=new Ae,P=new Ae;w.copy(M).sub(e[x-1]||M).normalize().add((e[x+1]||M).clone().sub(M).normalize()).normalize();let A=Number.MAX_VALUE;const U=Math.abs(w.x),N=Math.abs(w.y),D=Math.abs(w.z);return U<=A&&(A=U,T.set(1,0,0)),N<=A&&(A=N,T.set(0,1,0)),D<=A&&T.set(0,0,1),P.crossVectors(w,T).normalize(),T.crossVectors(w,P),C.crossVectors(w,T),[M,T,C]})(g);for(let x=0;x<=r;x++){const M=x/r*Math.PI*2,w=Math.sin(M),T=-Math.cos(M);s.x=T*_.x+w*v.x,s.y=T*_.y+w*v.y,s.z=T*_.z+w*v.z,s.normalize(),c.push(s.x,s.y,s.z),a.x=y.x+n*s.x*.5,a.y=y.y+n*s.y*.5,a.z=y.z+i*s.z*.5,l.push(a.x,a.y,a.z)}}(function(){for(let g=0;g<e.length;g++)m(g);m(closed===!1?e.length-1:0),(function(){for(let g=0;g<e.length;g++)for(let y=0;y<=r;y++)o.x=g/e.length,o.y=y/r,d.push(o.x,o.y)})(),(function(){for(let g=1;g<e.length;g++)for(let y=1;y<=r;y++){const _=(r+1)*(g-1)+(y-1),v=(r+1)*g+(y-1),x=(r+1)*g+y,M=(r+1)*(g-1)+y;f.push(_,v,M),f.push(v,x,M)}})()})(),this.setIndex(f),this.setAttribute("position",new ki(l,3)),this.setAttribute("normal",new ki(c,3)),this.setAttribute("uv",new ki(d,2))}}class h0{static get initial(){const e=new h0;return Object.assign(e,{x:0,y:0,z:0,r:0,e:0,i:0,j:0,t:0}),e}}const VT={h:0,s:0,l:0};class Np{constructor(e){var n,i,r,a,s,o,l,c,d;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=h0.initial,this.beyondFirstMove=!1,this.disposables=[],this._extrusionColor=Np.defaultExtrusionColor,this.renderLayerIndex=0,this._geometries={},this._backgroundColor=new zt(14737632),this._travelColor=new zt(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 Z_(this.minLayerThreshold),this.scene=new l_e,this.scene.background=this._backgroundColor,e.backgroundColor!==void 0&&(this.backgroundColor=new zt(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=(o=e.nonTravelMoves)!==null&&o!==void 0?o:this.nonTravelmoves,this.renderTubes=(l=e.renderTubes)!==null&&l!==void 0?l:this.renderTubes,this.extrusionWidth=(c=e.extrusionWidth)!==null&&c!==void 0?c:this.extrusionWidth,this.devMode=(d=e.devMode)!==null&&d!==void 0?d:this.devMode,this.stats=this.devMode?new G_e:void 0,e.extrusionColor!==void 0&&(this.extrusionColor=e.extrusionColor),e.travelColor!==void 0&&(this.travelColor=new zt(e.travelColor)),e.topLayerColor!==void 0&&(this.topLayerColor=new zt(e.topLayerColor)),e.lastSegmentColor!==void 0&&(this.lastSegmentColor=new zt(e.lastSegmentColor)),e.toolColors){this._toolColors={};for(const[g,y]of Object.entries(e.toolColors))this._toolColors[parseInt(g)]=new zt(y)}if(e.disableGradient!==void 0&&(this.disableGradient=e.disableGradient),console.info("Using THREE r"+XS),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 w3({canvas:this.canvas,preserveDrawingBuffer:!0});else{if(!this.targetId)throw Error("Set either opts.canvas or opts.targetId");const g=document.getElementById(this.targetId);if(!g)throw new Error("Unable to find element "+this.targetId);this.renderer=new w3({preserveDrawingBuffer:!0}),this.canvas=this.renderer.domElement,g.appendChild(this.canvas)}this.camera=new rs(25,this.canvas.offsetWidth/this.canvas.offsetHeight,10,5e3),this.camera.position.fromArray(this.initialCameraPosition);const f=this.camera.far,m=.8*f;this.scene.fog=new nD(this._backgroundColor,m,f),this.resize(),this.controls=new B_e(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 zt(i)}else this._extrusionColor=new zt(e)}get currentToolColor(){var e;return this._extrusionColor===void 0?Np.defaultExtrusionColor:this._extrusionColor instanceof zt?this._extrusionColor:(e=this._extrusionColor[this.state.t])!==null&&e!==void 0?e:Np.defaultExtrusionColor}get backgroundColor(){return this._backgroundColor}set backgroundColor(e){this._backgroundColor=new zt(e),this.scene.background=this._backgroundColor}get travelColor(){return this._travelColor}set travelColor(e){this._travelColor=new zt(e)}get topLayerColor(){return this._topLayerColor}set topLayerColor(e){this._topLayerColor=e!==void 0?new zt(e):void 0}get lastSegmentColor(){return this._lastSegmentColor}set lastSegmentColor(e){this._lastSegmentColor=e!==void 0?new zt(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 T_e(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 M_e(13421772,.3*Math.PI),n=new w_e(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 Jg;return n.name=e,n.quaternion.setFromEuler(new Dx(-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=h0.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 FT(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,o,l,c;if(e>this.maxLayerIndex)return;const d=this.layers[e],f={extrusion:[],travel:[],z:this.state.z,height:d.height};for(const m of d.commands)if(m.gcode!="g20"){if(m.gcode.startsWith("t")){this.doRenderExtrusion(f,e),f.extrusion=[];const g=m;this.state.t=g.toolIndex}else if(["g0","g00","g1","g01","g2","g02","g3","g03"].indexOf(m.gcode)>-1){const g=m,y={x:(n=g.params.x)!==null&&n!==void 0?n:this.state.x,y:(i=g.params.y)!==null&&i!==void 0?i:this.state.y,z:(r=g.params.z)!==null&&r!==void 0?r:this.state.z,r:(a=g.params.r)!==null&&a!==void 0?a:this.state.r,e:(s=g.params.e)!==null&&s!==void 0?s:this.state.e,i:(o=g.params.i)!==null&&o!==void 0?o:this.state.i,j:(l=g.params.j)!==null&&l!==void 0?l:this.state.j,t:this.state.t};if(e>=this.minLayerIndex){const _=((c=g.params.e)!==null&&c!==void 0?c:0)>0||this.nonTravelmoves.indexOf(m.gcode)>-1;(y.x!=this.state.x||y.y!=this.state.y||y.z!=this.state.z)&&(_&&this.renderExtrusion||!_&&this.renderTravel)&&(m.gcode=="g2"||m.gcode=="g3"||m.gcode=="g02"||m.gcode=="g03"?this.addArcSegment(f,this.state,y,_,m.gcode=="g2"||m.gcode=="g02"):this.addLineSegment(f,this.state,y,_))}this.state.x=y.x,this.state.y=y.y,this.state.z=y.z,this.beyondFirstMove||(this.beyondFirstMove=!0)}}else this.setInches();this.doRenderExtrusion(f,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(VT),a=new zt().setHSL(VT.h,VT.s,s)}if(n==this.layers.length-1){const s=(i=this._topLayerColor)!==null&&i!==void 0?i:a,o=(r=this._lastSegmentColor)!==null&&r!==void 0?r:s,l=e.extrusion.splice(-3),c=e.extrusion.splice(-3);this.renderTubes?(this.addTubeLine(e.extrusion,s.getHex(),e.height),this.addTubeLine([...c,...l],o.getHex(),e.height)):(this.addLine(e.extrusion,s.getHex()),this.addLine([...c,...l],o.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 V_e(this.buildVolume.x,10,this.buildVolume.y,10));const e=$_e(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 Z_(this.minLayerThreshold)}resetState(){var e;this.startLayer=1,this.endLayer=1/0,this.singleLayerMode=!1,this.beyondFirstMove=!1,this.state=h0.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,o=n.x,l=n.y,c=n.z,d=i.x,f=i.y,m=i.z;let g=i.r,y=i.i,_=i.j;if(g){const B=d-o,H=f-l,$=Math.sqrt(Math.pow(B/2,2)+Math.pow(H/2,2));g=Math.max(g,$);const K=Math.pow(B,2)+Math.pow(H,2),Z=Math.pow(g,2)-K/4;let se=Math.sqrt(Z/K);(a&&g<0||!a&&g>0)&&(se=-se),y=B/2+H*se,_=H/2-B*se}const v=o==d&&l==f,x=o+y,M=l+_,w=Math.sqrt(y*y+_*_),T=Math.atan2(-_,-y),C=Math.atan2(f-M,d-x);let P;v?P=2*Math.PI:(P=a?T-C:C-T,P<0&&(P+=2*Math.PI));let A=w*P/1.8;this.inches&&(A*=25),A<1&&(A=1);let U=P/A;U*=a?-1:1;const N=[];N.push({x:o,y:l,z:c});const D=(c-m)/A;let F=o,I=l,W=c,O=T;for(let B=0;B<A-1;B++)O+=U,F=x+w*Math.cos(O),I=M+w*Math.sin(O),W+=D,N.push({x:F,y:I,z:W});N.push({x:i.x,y:i.y,z:i.z});for(let B=0;B<N.length-1;B++)s.push(N[B].x,N[B].y,N[B].z,N[B+1].x,N[B+1].y,N[B+1].z)}addLine(e,n){var i;if(typeof this.lineWidth=="number"&&this.lineWidth>0)return void this.addThickLine(e,n);const r=new ra;r.setAttribute("position",new ki(e,3)),this.disposables.push(r);const a=new Ox({color:n});this.disposables.push(a);const s=new JS(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 o=e.slice(s,s+9),l=new Ae(o[0],o[1],o[2]),c=new Ae(o[3],o[4],o[5]),d=new Ae(o[6],o[7],o[8]);r.push(l),c.equals(d)||(r.push(c),a.push(r),r=[])}a.forEach((s=>{var o;const l=new W_e(s,this.extrusionWidth,this.lineHeight||i,4);(o=this._geometries)[n]||(o[n]=[]),this._geometries[n].push(l)}))}addThickLine(e,n){var i;if(!e.length||!this.lineWidth)return;const r=new E7;this.disposables.push(r);const a=new M7({color:n,linewidth:this.lineWidth/(1e3*window.devicePixelRatio)});this.disposables.push(a),r.setPositions(e);const s=new H_e(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=>FT(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 y_e({color:e,wireframe:this._wireframe});this.disposables.push(r);const a=i.reduce(((o,l)=>3*l.attributes.position.count+o),0),s=new g_e(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 FT(this,void 0,void 0,(function*(){const r=e.getReader();let a,s="",o=0;do{console.debug("reading from stream"),a=yield r.read(),o+=(i=(n=a.value)===null||n===void 0?void 0:n.length)!==null&&i!==void 0?i:0;const c=(l=a.value,new TextDecoder("utf-8").decode(l)),d=c.lastIndexOf(`
  8059. `),f=c.slice(0,d);this.parser.parseGCode(s+f),s=c.slice(d)}while(!a.done);var l;console.debug("read from stream",o)}))}initGui(){typeof this.devMode=="boolean"&&this.devMode===!0?this.devGui=new $5(this):typeof this.devMode=="object"&&(this.devGui=new $5(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())}}Np.defaultExtrusionColor=new zt("hotpink");const q_e=function(t){return new Np(t)};function X_e({gcodeUrl:t,buildVolume:e={x:256,y:256,z:256},className:n=""}){const i=E.useRef(null),r=E.useRef(null),[a,s]=E.useState(!0),[o,l]=E.useState(null),[c,d]=E.useState(!1),[f,m]=E.useState(0),[g,y]=E.useState(0);E.useEffect(()=>{if(!i.current)return;const x=i.current,M=q_e({canvas:x,buildVolume:e,backgroundColor:1710618,travelColor:4473924,extrusionColor:44610,topLayerColor:65370,lastSegmentColor:16777215,lineWidth:2,renderTravel:!1,renderExtrusion:!0});r.current=M,s(!0),l(null),d(!1),fetch(t).then(async T=>{if(!T.ok)throw T.status===404&&(await T.json().catch(()=>({}))).detail?.includes("sliced")?(d(!0),new Error("not_sliced")):new Error("Failed to load G-code");return T.text()}).then(T=>{M.processGCode(T);const C=M.layers?.length||0;y(C),m(C),M.render(),s(!1)}).catch(T=>{l(T.message),s(!1)});const w=()=>{if(x.parentElement){const T=x.parentElement.getBoundingClientRect();x.width=T.width,x.height=T.height,M.resize()}};return w(),window.addEventListener("resize",w),()=>{window.removeEventListener("resize",w),M.dispose()}},[t,e]);const _=x=>{if(!r.current)return;const M=Math.max(1,Math.min(x,g));m(M),r.current.render()},v=x=>{_(parseInt(x.target.value,10))};return p.jsxs("div",{className:`relative flex flex-col h-full ${n}`,children:[p.jsxs("div",{className:"flex-1 relative bg-bambu-dark rounded-lg overflow-hidden",children:[p.jsx("canvas",{ref:i,className:"w-full h-full"}),a&&p.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-bambu-dark/80",children:p.jsxs("div",{className:"text-center",children:[p.jsx(Yt,{className:"w-8 h-8 animate-spin text-bambu-green mx-auto mb-2"}),p.jsx("p",{className:"text-bambu-gray text-sm",children:"Loading G-code..."})]})}),c&&p.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-bambu-dark/80",children:p.jsxs("div",{className:"text-center max-w-sm px-4",children:[p.jsx(use,{className:"w-12 h-12 text-bambu-gray mx-auto mb-3"}),p.jsx("p",{className:"text-white font-medium mb-2",children:"G-code not available"}),p.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."})]})}),o&&!c&&p.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-bambu-dark/80",children:p.jsx("div",{className:"text-center text-red-400",children:p.jsx("p",{className:"text-sm",children:o})})})]}),!a&&!o&&!c&&g>0&&p.jsx("div",{className:"mt-4 px-2",children:p.jsxs("div",{className:"flex items-center gap-3",children:[p.jsx(L_,{className:"w-4 h-4 text-bambu-gray flex-shrink-0"}),p.jsx("button",{onClick:()=>_(f-1),disabled:f<=1,className:"p-1 rounded hover:bg-bambu-dark-tertiary disabled:opacity-30 disabled:cursor-not-allowed",children:p.jsx(_f,{className:"w-4 h-4"})}),p.jsx("input",{type:"range",min:1,max:g,value:f,onChange:v,className:"flex-1 h-2 bg-bambu-dark-tertiary rounded-lg appearance-none cursor-pointer accent-bambu-green"}),p.jsx("button",{onClick:()=>_(f+1),disabled:f>=g,className:"p-1 rounded hover:bg-bambu-dark-tertiary disabled:opacity-30 disabled:cursor-not-allowed",children:p.jsx(zf,{className:"w-4 h-4"})}),p.jsxs("span",{className:"text-sm text-bambu-gray min-w-[80px] text-right",children:[f," / ",g]})]})})]})}function K_e({archiveId:t,title:e,onClose:n}){const[i,r]=E.useState(null),[a,s]=E.useState(null),[o,l]=E.useState(!0);E.useEffect(()=>{const d=f=>{f.key==="Escape"&&n()};return window.addEventListener("keydown",d),()=>window.removeEventListener("keydown",d)},[n]),E.useEffect(()=>{Ye.getArchiveCapabilities(t).then(d=>{s(d),d.has_model?r("3d"):d.has_gcode&&r("gcode"),l(!1)}).catch(()=>{s({has_model:!0,has_gcode:!1,build_volume:{x:256,y:256,z:256}}),r("3d"),l(!1)})},[t]);const c=()=>{const d=e||"model",f=`${window.location.origin}${Ye.getArchiveForSlicer(t,d)}`;window.location.href=`bambustudioopen://${encodeURIComponent(f)}`};return p.jsx("div",{className:"fixed inset-0 bg-black/70 flex items-center justify-center z-50 p-8",onClick:n,children:p.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:d=>d.stopPropagation(),children:[p.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-bambu-dark-tertiary",children:[p.jsx("h2",{className:"text-lg font-semibold text-white truncate flex-1 mr-4",children:e}),p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsxs(st,{variant:"secondary",size:"sm",onClick:c,children:[p.jsx(uc,{className:"w-4 h-4"}),"Open in Slicer"]}),p.jsx(st,{variant:"ghost",size:"sm",onClick:n,children:p.jsx(Cn,{className:"w-5 h-5"})})]})]}),a&&p.jsxs("div",{className:"flex border-b border-bambu-dark-tertiary",children:[p.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:[p.jsx(k0,{className:"w-4 h-4"}),"3D Model",!a.has_model&&p.jsx("span",{className:"text-xs",children:"(not available)"})]}),p.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:[p.jsx(Wae,{className:"w-4 h-4"}),"G-code Preview",!a.has_gcode&&p.jsx("span",{className:"text-xs",children:"(not sliced)"})]})]}),p.jsx("div",{className:"flex-1 overflow-hidden p-4",children:o?p.jsx("div",{className:"w-full h-full flex items-center justify-center",children:p.jsx(Yt,{className:"w-8 h-8 animate-spin text-bambu-green"})}):i==="3d"&&a?p.jsx($me,{url:Ye.getArchiveDownload(t),buildVolume:a.build_volume,className:"w-full h-full"}):i==="gcode"&&a?p.jsx(X_e,{gcodeUrl:Ye.getArchiveGcode(t),buildVolume:a.build_volume,className:"w-full h-full"}):p.jsx("div",{className:"w-full h-full flex items-center justify-center text-bambu-gray",children:"No preview available for this file"})})]})})}function Y_e({archiveId:t,archiveName:e,onClose:n,onSuccess:i}){const[r,a]=E.useState(null);E.useEffect(()=>{const d=f=>{f.key==="Escape"&&n()};return window.addEventListener("keydown",d),()=>window.removeEventListener("keydown",d)},[n]);const{data:s,isLoading:o}=It({queryKey:["printers"],queryFn:Ye.getPrinters}),l=Ot({mutationFn:()=>{if(!r)throw new Error("No printer selected");return Ye.reprintArchive(t,r)},onSuccess:()=>{i(),n()}}),c=s?.filter(d=>d.is_active)||[];return p.jsx("div",{className:"fixed inset-0 bg-black/70 flex items-center justify-center z-50 p-8",children:p.jsx(Zt,{className:"w-full max-w-md",children:p.jsxs(cn,{children:[p.jsxs("div",{className:"flex items-center justify-between mb-4",children:[p.jsx("h2",{className:"text-lg font-semibold text-white",children:"Re-print"}),p.jsx(st,{variant:"ghost",size:"sm",onClick:n,children:p.jsx(Cn,{className:"w-5 h-5"})})]}),p.jsxs("p",{className:"text-sm text-bambu-gray mb-4",children:["Send ",p.jsx("span",{className:"text-white",children:e})," to a printer"]}),o?p.jsx("div",{className:"flex justify-center py-8",children:p.jsx(Yt,{className:"w-6 h-6 text-bambu-green animate-spin"})}):c.length===0?p.jsx("div",{className:"text-center py-8 text-bambu-gray",children:"No active printers available"}):p.jsx("div",{className:"space-y-2 mb-6",children:c.map(d=>p.jsxs("button",{onClick:()=>a(d.id),className:`w-full flex items-center gap-3 p-3 rounded-lg border transition-colors ${r===d.id?"border-bambu-green bg-bambu-green/10":"border-bambu-dark-tertiary bg-bambu-dark hover:border-bambu-gray"}`,children:[p.jsx("div",{className:`p-2 rounded-lg ${r===d.id?"bg-bambu-green/20":"bg-bambu-dark-tertiary"}`,children:p.jsx(fc,{className:`w-5 h-5 ${r===d.id?"text-bambu-green":"text-bambu-gray"}`})}),p.jsxs("div",{className:"text-left",children:[p.jsx("p",{className:"text-white font-medium",children:d.name}),p.jsxs("p",{className:"text-xs text-bambu-gray",children:[d.model||"Unknown model"," • ",d.ip_address]})]})]},d.id))}),l.isError&&p.jsx("div",{className:"mb-4 p-3 bg-red-500/20 border border-red-500/50 rounded-lg text-sm text-red-400",children:l.error.message||"Failed to start print"}),p.jsxs("div",{className:"flex gap-3",children:[p.jsx(st,{variant:"secondary",onClick:n,className:"flex-1",children:"Cancel"}),p.jsx(st,{onClick:()=>l.mutate(),disabled:!r||l.isPending,className:"flex-1",children:l.isPending?p.jsxs(p.Fragment,{children:[p.jsx(Yt,{className:"w-4 h-4 animate-spin"}),"Sending..."]}):p.jsxs(p.Fragment,{children:[p.jsx(fc,{className:"w-4 h-4"}),"Print"]})})]})]})})})}function Z_e({onClose:t,initialFiles:e}){const n=Jn(),{showToast:i}=Mo(),r=E.useRef(null),[a,s]=E.useState(()=>e?.filter(A=>A.name.endsWith(".3mf")).map(A=>({file:A,status:"pending"}))||[]),[o,l]=E.useState(!1),[c,d]=E.useState(),[f,m]=E.useState(null);E.useEffect(()=>{const A=U=>{U.key==="Escape"&&t()};return window.addEventListener("keydown",A),()=>window.removeEventListener("keydown",A)},[t]);const{data:g}=It({queryKey:["printers"],queryFn:Ye.getPrinters}),y=Ot({mutationFn:A=>Ye.uploadArchivesBulk(A,c),onSuccess:A=>{m(A),n.invalidateQueries({queryKey:["archives"]}),n.invalidateQueries({queryKey:["archiveStats"]}),s(U=>U.map(N=>{const D=A.results.find(I=>I.filename===N.file.name),F=A.errors.find(I=>I.filename===N.file.name);return D?{...N,status:"success",archiveId:D.id}:F?{...N,status:"error",error:F.error}:N})),A.failed===0?i(`${A.uploaded} file${A.uploaded!==1?"s":""} uploaded`):A.uploaded===0?i(`Failed to upload ${A.failed} file${A.failed!==1?"s":""}`,"error"):i(`${A.uploaded} uploaded, ${A.failed} failed`,"warning")},onError:()=>{s(A=>A.map(U=>({...U,status:"error",error:"Upload failed"}))),i("Upload failed","error")}}),_=E.useCallback(A=>{A.preventDefault(),l(!0)},[]),v=E.useCallback(A=>{A.preventDefault(),l(!1)},[]),x=E.useCallback(A=>{A.preventDefault(),l(!1);const U=Array.from(A.dataTransfer.files).filter(N=>N.name.endsWith(".3mf"));U.length>0&&s(N=>[...N,...U.map(D=>({file:D,status:"pending"}))])},[]),M=E.useCallback(A=>{const U=Array.from(A.target.files||[]).filter(N=>N.name.endsWith(".3mf"));U.length>0&&s(N=>[...N,...U.map(D=>({file:D,status:"pending"}))]),r.current&&(r.current.value="")},[]),w=E.useCallback(A=>{s(U=>U.filter((N,D)=>D!==A))},[]),T=()=>{if(a.length===0)return;const A=a.filter(U=>U.status==="pending");A.length!==0&&(s(U=>U.map(N=>N.status==="pending"?{...N,status:"uploading"}:N)),y.mutate(A.map(U=>U.file)))},C=a.filter(A=>A.status==="pending").length,P=y.isPending;return p.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4",children:p.jsx(Zt,{className:"w-full max-w-2xl max-h-[90vh] flex flex-col",children:p.jsxs(cn,{className:"p-0 flex flex-col h-full",children:[p.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-bambu-dark-tertiary",children:[p.jsx("h2",{className:"text-xl font-semibold text-white",children:"Upload 3MF Files"}),p.jsx("button",{onClick:t,className:"text-bambu-gray hover:text-white transition-colors",children:p.jsx(Cn,{className:"w-5 h-5"})})]}),p.jsx("div",{className:"p-4",children:p.jsxs("div",{className:`border-2 border-dashed rounded-lg p-8 text-center transition-colors ${o?"border-bambu-green bg-bambu-green/10":"border-bambu-dark-tertiary hover:border-bambu-gray"}`,onDragOver:_,onDragLeave:v,onDrop:x,children:[p.jsx(F0,{className:"w-12 h-12 mx-auto mb-4 text-bambu-gray"}),p.jsx("p",{className:"text-white mb-2",children:"Drag & drop .3mf files here"}),p.jsx("p",{className:"text-bambu-gray text-sm mb-4",children:"or"}),p.jsx(st,{variant:"secondary",onClick:()=>r.current?.click(),disabled:P,children:"Browse Files"}),p.jsx("input",{ref:r,type:"file",accept:".3mf",multiple:!0,className:"hidden",onChange:M})]})}),p.jsxs("div",{className:"px-4 pb-4",children:[p.jsx("label",{className:"block text-sm text-bambu-gray mb-2",children:"Associate with printer (optional)"}),p.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:c||"",onChange:A=>d(A.target.value?Number(A.target.value):void 0),disabled:P,children:[p.jsx("option",{value:"",children:"No printer"}),g?.map(A=>p.jsx("option",{value:A.id,children:A.name},A.id))]})]}),a.length>0&&p.jsx("div",{className:"px-4 pb-4 max-h-60 overflow-y-auto",children:p.jsx("div",{className:"space-y-2",children:a.map((A,U)=>p.jsxs("div",{className:"flex items-center gap-3 p-3 bg-bambu-dark rounded-lg",children:[p.jsx(HG,{className:"w-5 h-5 text-bambu-gray flex-shrink-0"}),p.jsx("span",{className:"flex-1 text-white text-sm truncate",children:A.file.name}),p.jsxs("span",{className:"text-xs text-bambu-gray",children:[(A.file.size/(1024*1024)).toFixed(1)," MB"]}),A.status==="pending"&&p.jsx("button",{onClick:()=>w(U),className:"text-bambu-gray hover:text-red-400 transition-colors",disabled:P,children:p.jsx(Cn,{className:"w-4 h-4"})}),A.status==="uploading"&&p.jsx(Yt,{className:"w-4 h-4 text-bambu-green animate-spin"}),A.status==="success"&&p.jsx(rd,{className:"w-4 h-4 text-bambu-green"}),A.status==="error"&&p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("span",{className:"text-xs text-red-400",children:A.error}),p.jsx(id,{className:"w-4 h-4 text-red-400"})]})]},`${A.file.name}-${U}`))})}),f&&p.jsx("div",{className:"px-4 pb-4",children:p.jsx("div",{className:"p-3 bg-bambu-dark rounded-lg",children:p.jsxs("p",{className:"text-sm text-white",children:[p.jsx("span",{className:"text-bambu-green",children:f.uploaded})," uploaded",f.failed>0&&p.jsxs(p.Fragment,{children:[", ",p.jsx("span",{className:"text-red-400",children:f.failed})," failed"]})]})})}),p.jsxs("div",{className:"flex gap-3 p-4 border-t border-bambu-dark-tertiary",children:[p.jsx(st,{variant:"secondary",onClick:t,className:"flex-1",children:f?"Close":"Cancel"}),!f&&p.jsx(st,{onClick:T,disabled:C===0||P,className:"flex-1",children:P?p.jsxs(p.Fragment,{children:[p.jsx(Yt,{className:"w-4 h-4 animate-spin"}),"Uploading..."]}):p.jsxs(p.Fragment,{children:[p.jsx(F0,{className:"w-4 h-4"}),"Upload ",C>0&&`(${C})`]})})]})]})})})}const Q_e=["Adhesion failure","Spaghetti / Detached","Layer shift","Clogged nozzle","Filament runout","Warping","Stringing","Under-extrusion","Power failure","User cancelled","Other"];function J_e({archive:t,onClose:e,existingTags:n=[]}){E.useEffect(()=>{const K=Z=>{Z.key==="Escape"&&e()};return window.addEventListener("keydown",K),()=>window.removeEventListener("keydown",K)},[e]);const i=Jn(),[r,a]=E.useState(t.print_name||""),[s,o]=E.useState(t.printer_id),[l,c]=E.useState(t.notes||""),[d,f]=E.useState(t.tags||""),[m,g]=E.useState(t.failure_reason||""),[y,_]=E.useState(t.photos||[]),[v,x]=E.useState(!1),[M,w]=E.useState(!1),T=E.useRef(null),C=E.useRef(null),P=E.useRef(null),{data:A}=It({queryKey:["printers"],queryFn:Ye.getPrinters}),{data:U}=It({queryKey:["archives"],queryFn:()=>Ye.getArchives(void 0,1e3,0),enabled:n.length===0}),N=n.length>0?n:[...new Set(U?.flatMap(K=>K.tags?.split(",").map(Z=>Z.trim())||[]).filter(Boolean)||[])].sort(),D=d.split(",").map(K=>K.trim()).filter(Boolean),F=N.filter(K=>!D.includes(K)),I=K=>{if(!D.includes(K)){const Z=[...D,K].join(", ");f(Z)}P.current!==null&&clearTimeout(P.current),T.current?.focus()},W=K=>{const Z=D.filter(se=>se!==K).join(", ");f(Z)},O=Ot({mutationFn:K=>Ye.updateArchive(t.id,K),onSuccess:()=>{i.invalidateQueries({queryKey:["archives"]}),e()}}),B=async K=>{const Z=K.target.files?.[0];if(Z){x(!0);try{const se=await Ye.uploadArchivePhoto(t.id,Z);_(se.photos),i.invalidateQueries({queryKey:["archives"]})}catch(se){console.error("Failed to upload photo:",se)}finally{x(!1),C.current&&(C.current.value="")}}},H=async K=>{try{const Z=await Ye.deleteArchivePhoto(t.id,K);_(Z.photos||[]),i.invalidateQueries({queryKey:["archives"]})}catch(Z){console.error("Failed to delete photo:",Z)}},$=K=>{K.preventDefault(),O.mutate({print_name:r||void 0,printer_id:s,notes:l||void 0,tags:d||void 0,failure_reason:t.status==="failed"&&m||void 0})};return p.jsx("div",{className:"fixed inset-0 bg-black/70 flex items-center justify-center z-50 p-4",onClick:e,children:p.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:K=>K.stopPropagation(),children:[p.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-bambu-dark-tertiary",children:[p.jsx("h2",{className:"text-lg font-semibold text-white",children:"Edit Archive"}),p.jsx("button",{onClick:e,className:"text-bambu-gray hover:text-white transition-colors",children:p.jsx(Cn,{className:"w-5 h-5"})})]}),p.jsxs("form",{onSubmit:$,className:"p-6 space-y-4 overflow-y-auto flex-1",children:[p.jsxs("div",{children:[p.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:"Name"}),p.jsx("input",{type:"text",value:r,onChange:K=>a(K.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"})]}),p.jsxs("div",{children:[p.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:"Printer"}),p.jsxs("select",{value:s??"",onChange:K=>o(K.target.value?Number(K.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:[p.jsx("option",{value:"",children:"No printer"}),A?.map(K=>p.jsx("option",{value:K.id,children:K.name},K.id))]})]}),p.jsxs("div",{children:[p.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:"Notes"}),p.jsx("textarea",{value:l,onChange:K=>c(K.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..."})]}),p.jsxs("div",{children:[p.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:"Tags"}),D.length>0&&p.jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:D.map(K=>p.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 bg-bambu-dark-tertiary rounded text-sm text-white",children:[p.jsx(j0,{className:"w-3 h-3"}),K,p.jsx("button",{type:"button",onClick:()=>W(K),className:"ml-0.5 text-bambu-gray hover:text-white",children:p.jsx(Cn,{className:"w-3 h-3"})})]},K))}),p.jsxs("div",{className:"relative",children:[p.jsx("input",{ref:T,type:"text",value:d,onChange:K=>f(K.target.value),onFocus:()=>{P.current!==null&&clearTimeout(P.current),w(!0)},onBlur:()=>{P.current=window.setTimeout(()=>w(!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:D.length>0?"Add more tags...":"Add tags..."}),M&&F.length>0&&p.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:[p.jsx("div",{className:"p-2 text-xs text-bambu-gray border-b border-bambu-dark-tertiary",children:"Existing tags (click to add)"}),p.jsx("div",{className:"p-2 flex flex-wrap gap-1.5",children:F.map(K=>p.jsx("button",{type:"button",onClick:()=>I(K),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:K},K))})]})]})]}),t.status==="failed"&&p.jsxs("div",{children:[p.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:"Failure Reason"}),p.jsxs("select",{value:m,onChange:K=>g(K.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:[p.jsx("option",{value:"",children:"Select reason..."}),Q_e.map(K=>p.jsx("option",{value:K,children:K},K))]})]}),p.jsxs("div",{children:[p.jsxs("label",{className:"block text-sm text-bambu-gray mb-1",children:[p.jsx(k_,{className:"w-4 h-4 inline mr-1"}),"Photos of Printed Result"]}),p.jsxs("div",{className:"flex flex-wrap gap-2 mb-2",children:[y.map(K=>p.jsxs("div",{className:"relative group",children:[p.jsx("img",{src:Ye.getArchivePhotoUrl(t.id,K),alt:"Print result",className:"w-20 h-20 object-cover rounded-lg border border-bambu-dark-tertiary"}),p.jsx("button",{type:"button",onClick:()=>H(K),className:"absolute -top-1 -right-1 p-1 bg-red-500 rounded-full opacity-0 group-hover:opacity-100 transition-opacity",children:p.jsx(na,{className:"w-3 h-3 text-white"})})]},K)),p.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:[p.jsx("input",{ref:C,type:"file",accept:"image/jpeg,image/png,image/webp",onChange:B,className:"hidden",disabled:v}),v?p.jsx(Yt,{className:"w-6 h-6 text-bambu-gray animate-spin"}):p.jsx(dc,{className:"w-6 h-6 text-bambu-gray"})]})]}),p.jsx("p",{className:"text-xs text-bambu-gray",children:"Click + to add photos of your printed result"})]}),p.jsxs("div",{className:"flex gap-3 pt-2",children:[p.jsx(st,{type:"button",variant:"secondary",onClick:e,className:"flex-1",children:"Cancel"}),p.jsxs(st,{type:"submit",disabled:O.isPending,className:"flex-1",children:[p.jsx(Rx,{className:"w-4 h-4"}),O.isPending?"Saving...":"Save"]})]})]})]})})}function e1e({x:t,y:e,items:n,onClose:i}){const r=E.useRef(null);return E.useEffect(()=>{const a=l=>{r.current&&!r.current.contains(l.target)&&i()},s=l=>{l.key==="Escape"&&i()},o=()=>{i()};return document.addEventListener("mousedown",a),document.addEventListener("keydown",s),document.addEventListener("scroll",o,!0),()=>{document.removeEventListener("mousedown",a),document.removeEventListener("keydown",s),document.removeEventListener("scroll",o,!0)}},[i]),E.useEffect(()=>{if(r.current){const a=r.current.getBoundingClientRect(),s=window.innerWidth,o=window.innerHeight;let l=t,c=e;t+a.width>s&&(l=s-a.width-8),e+a.height>o&&(c=o-a.height-8),r.current.style.left=`${l}px`,r.current.style.top=`${c}px`}},[t,e]),p.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?p.jsx("div",{className:"my-1 border-t border-bambu-dark-tertiary"},s):p.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&&p.jsx("span",{className:"w-4 h-4 flex-shrink-0",children:a.icon}),a.label]},s))})}function t1e({selectedIds:t,existingTags:e,onClose:n}){const i=Jn(),{showToast:r}=Mo(),[a,s]=E.useState(""),[o,l]=E.useState(new Set),[c,d]=E.useState("add");E.useEffect(()=>{const _=v=>{v.key==="Escape"&&n()};return window.addEventListener("keydown",_),()=>window.removeEventListener("keydown",_)},[n]);const f=Ot({mutationFn:async()=>{const _=Array.from(o);return await Promise.all(t.map(async v=>{const x=await Ye.getArchive(v),M=x.tags?x.tags.split(",").map(T=>T.trim()).filter(Boolean):[];let w;return c==="add"?w=[...new Set([...M,..._])]:w=M.filter(T=>!o.has(T)),Ye.updateArchive(v,{tags:w.join(", ")})})),{count:t.length,mode:c,tags:_}},onSuccess:({count:_,mode:v,tags:x})=>{i.invalidateQueries({queryKey:["archives"]}),r(`${v==="add"?"Added":"Removed"} ${x.length} tag${x.length!==1?"s":""} ${v==="add"?"to":"from"} ${_} archive${_!==1?"s":""}`),n()},onError:()=>{r("Failed to update tags","error")}}),m=_=>{l(v=>{const x=new Set(v);return x.has(_)?x.delete(_):x.add(_),x})},g=()=>{a.trim()&&!o.has(a.trim())&&(l(_=>new Set([..._,a.trim()])),s(""))},y=_=>{_.key==="Enter"&&(_.preventDefault(),g())};return p.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4",children:p.jsx(Zt,{className:"w-full max-w-md",children:p.jsxs(cn,{className:"p-0",children:[p.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-bambu-dark-tertiary",children:[p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx(j0,{className:"w-5 h-5 text-bambu-green"}),p.jsx("h2",{className:"text-xl font-semibold text-white",children:c==="add"?"Add Tags":"Remove Tags"})]}),p.jsx("button",{onClick:n,className:"text-bambu-gray hover:text-white transition-colors",children:p.jsx(Cn,{className:"w-5 h-5"})})]}),p.jsxs("div",{className:"p-4 space-y-4",children:[p.jsxs("p",{className:"text-sm text-bambu-gray",children:[c==="add"?"Add":"Remove"," tags for ",t.length," selected archive",t.length!==1?"s":""]}),p.jsxs("div",{className:"flex gap-2",children:[p.jsx(st,{size:"sm",variant:c==="add"?"primary":"secondary",onClick:()=>d("add"),children:"Add Tags"}),p.jsx(st,{size:"sm",variant:c==="remove"?"primary":"secondary",onClick:()=>d("remove"),children:"Remove Tags"})]}),c==="add"&&p.jsxs("div",{className:"flex gap-2",children:[p.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:_=>s(_.target.value),onKeyDown:y}),p.jsx(st,{size:"sm",variant:"secondary",onClick:g,disabled:!a.trim(),children:p.jsx(dc,{className:"w-4 h-4"})})]}),e.length>0&&p.jsxs("div",{children:[p.jsx("p",{className:"text-xs text-bambu-gray mb-2",children:"Existing tags:"}),p.jsx("div",{className:"flex flex-wrap gap-2",children:e.map(_=>p.jsx("button",{onClick:()=>m(_),className:`px-2 py-1 rounded text-sm transition-colors ${o.has(_)?"bg-bambu-green text-white":"bg-bambu-dark-tertiary text-bambu-gray-light hover:bg-bambu-dark"}`,children:_},_))})]}),o.size>0&&p.jsxs("div",{children:[p.jsxs("p",{className:"text-xs text-bambu-gray mb-2",children:["Tags to ",c==="add"?"add":"remove",":"]}),p.jsx("div",{className:"flex flex-wrap gap-2",children:Array.from(o).map(_=>p.jsxs("span",{className:`px-2 py-1 rounded text-sm flex items-center gap-1 ${c==="add"?"bg-green-500/20 text-green-400":"bg-red-500/20 text-red-400"}`,children:[_,p.jsx("button",{onClick:()=>m(_),className:"hover:opacity-70",children:p.jsx(Cn,{className:"w-3 h-3"})})]},_))})]})]}),p.jsxs("div",{className:"flex gap-3 p-4 border-t border-bambu-dark-tertiary",children:[p.jsx(st,{variant:"secondary",onClick:n,className:"flex-1",children:"Cancel"}),p.jsx(st,{onClick:()=>f.mutate(),disabled:o.size===0||f.isPending,className:"flex-1",children:f.isPending?p.jsxs(p.Fragment,{children:[p.jsx(Yt,{className:"w-4 h-4 animate-spin"}),"Processing..."]}):p.jsxs(p.Fragment,{children:[p.jsx(j0,{className:"w-4 h-4"}),c==="add"?"Add Tags":"Remove Tags"]})})]})]})})})}function n1e(t,e){return new Date(t,e+1,0).getDate()}function i1e(t,e){return new Date(t,e,1).getDay()}const r1e=["January","February","March","April","May","June","July","August","September","October","November","December"],a1e=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];function s1e({archives:t,onArchiveClick:e}){const n=new Date,[i,r]=E.useState(n.getMonth()),[a,s]=E.useState(n.getFullYear()),[o,l]=E.useState(null),c=E.useMemo(()=>{const x=new Map;return t.forEach(M=>{const w=new Date(M.completed_at||M.created_at),T=`${w.getFullYear()}-${String(w.getMonth()+1).padStart(2,"0")}-${String(w.getDate()).padStart(2,"0")}`,C=x.get(T)||[];C.push(M),x.set(T,C)}),x},[t]),d=n1e(a,i),f=i1e(a,i),m=()=>{i===0?(r(11),s(a-1)):r(i-1)},g=()=>{i===11?(r(0),s(a+1)):r(i+1)},y=()=>{r(n.getMonth()),s(n.getFullYear())},_=[];for(let x=0;x<f;x++)_.push(null);for(let x=1;x<=d;x++)_.push(x);const v=o?c.get(o)||[]:[];return p.jsxs("div",{className:"flex flex-col lg:flex-row gap-6",children:[p.jsxs("div",{className:"flex-1",children:[p.jsxs("div",{className:"flex items-center justify-between mb-4",children:[p.jsx("button",{onClick:m,className:"p-2 hover:bg-bambu-dark-tertiary rounded-lg transition-colors",children:p.jsx(_f,{className:"w-5 h-5 text-bambu-gray"})}),p.jsxs("div",{className:"flex items-center gap-3",children:[p.jsxs("h2",{className:"text-lg font-semibold text-white",children:[r1e[i]," ",a]}),p.jsx("button",{onClick:y,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"})]}),p.jsx("button",{onClick:g,className:"p-2 hover:bg-bambu-dark-tertiary rounded-lg transition-colors",children:p.jsx(zf,{className:"w-5 h-5 text-bambu-gray"})})]}),p.jsx("div",{className:"grid grid-cols-7 gap-1 mb-1",children:a1e.map(x=>p.jsx("div",{className:"text-center text-xs text-bambu-gray py-2",children:x},x))}),p.jsx("div",{className:"grid grid-cols-7 gap-1",children:_.map((x,M)=>{if(x===null)return p.jsx("div",{className:"aspect-square"},`empty-${M}`);const w=`${a}-${String(i+1).padStart(2,"0")}-${String(x).padStart(2,"0")}`,T=c.get(w)||[],C=T.length>0,P=x===n.getDate()&&i===n.getMonth()&&a===n.getFullYear(),A=w===o,U=T.filter(D=>D.status==="completed").length,N=T.filter(D=>D.status==="failed").length;return p.jsxs("button",{onClick:()=>l(A?null:w),className:`aspect-square rounded-lg p-1 flex flex-col items-center justify-center transition-colors relative ${A?"bg-bambu-green text-white":P?"bg-bambu-green/20 text-white ring-2 ring-bambu-green":C?"bg-bambu-dark-tertiary hover:bg-bambu-dark-tertiary/70 text-white":"hover:bg-bambu-dark-tertiary/50 text-bambu-gray"}`,children:[p.jsx("span",{className:`text-sm font-medium ${P&&!A?"text-bambu-green":""}`,children:x}),C&&p.jsxs("div",{className:"absolute bottom-1 left-1/2 -translate-x-1/2 flex items-center gap-1",children:[p.jsx("div",{className:`w-2 h-2 rounded-full ${N>0&&U===0?"bg-red-400":N>0?"bg-yellow-400":"bg-green-400"}`}),p.jsx("span",{className:"text-xs font-medium",children:T.length})]})]},x)})}),p.jsx("div",{className:"mt-4 pt-4 border-t border-bambu-dark-tertiary",children:p.jsxs("div",{className:"grid grid-cols-3 gap-4 text-center",children:[p.jsxs("div",{children:[p.jsx("div",{className:"text-2xl font-bold text-white",children:t.filter(x=>{const M=new Date(x.completed_at||x.created_at);return M.getMonth()===i&&M.getFullYear()===a}).length}),p.jsx("div",{className:"text-xs text-bambu-gray",children:"Prints this month"})]}),p.jsxs("div",{children:[p.jsx("div",{className:"text-2xl font-bold text-green-400",children:t.filter(x=>{const M=new Date(x.completed_at||x.created_at);return M.getMonth()===i&&M.getFullYear()===a&&x.status==="completed"}).length}),p.jsx("div",{className:"text-xs text-bambu-gray",children:"Successful"})]}),p.jsxs("div",{children:[p.jsx("div",{className:"text-2xl font-bold text-red-400",children:t.filter(x=>{const M=new Date(x.completed_at||x.created_at);return M.getMonth()===i&&M.getFullYear()===a&&x.status==="failed"}).length}),p.jsx("div",{className:"text-xs text-bambu-gray",children:"Failed"})]})]})})]}),p.jsx("div",{className:"lg:w-80 bg-bambu-dark rounded-xl p-4",children:o?p.jsxs(p.Fragment,{children:[p.jsx("h3",{className:"text-sm font-medium text-bambu-gray mb-3",children:new Date(o+"T12:00:00").toLocaleDateString("en-US",{weekday:"long",month:"long",day:"numeric",year:"numeric"})}),v.length>0?p.jsx("div",{className:"space-y-2 max-h-96 overflow-y-auto",children:v.map(x=>p.jsxs("button",{onClick:()=>e?.(x),className:"w-full flex items-center gap-3 p-2 rounded-lg hover:bg-bambu-dark-tertiary transition-colors text-left",children:[x.thumbnail_path?p.jsx("img",{src:Ye.getArchiveThumbnail(x.id),alt:"",className:"w-12 h-12 rounded object-cover"}):p.jsx("div",{className:"w-12 h-12 rounded bg-bambu-dark-tertiary flex items-center justify-center",children:p.jsx("span",{className:"text-xs text-bambu-gray",children:"3MF"})}),p.jsxs("div",{className:"flex-1 min-w-0",children:[p.jsx("p",{className:"text-sm text-white truncate",children:x.print_name||x.filename}),p.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[p.jsx("span",{className:x.status==="failed"?"text-red-400":"text-green-400",children:x.status==="failed"?"Failed":"Completed"}),x.filament_color&&p.jsx("div",{className:"flex gap-0.5",children:x.filament_color.split(",").map((M,w)=>p.jsx("div",{className:"w-3 h-3 rounded-full border border-white/20",style:{backgroundColor:M}},w))})]})]})]},x.id))}):p.jsx("p",{className:"text-sm text-bambu-gray",children:"No prints on this day"})]}):p.jsx("div",{className:"text-center py-8",children:p.jsx("p",{className:"text-sm text-bambu-gray",children:"Select a day to see prints"})})})]})}function o1e({archiveId:t,archiveName:e,onClose:n}){const i=Ye.getArchiveQRCodeUrl(t,300);E.useEffect(()=>{const a=s=>{s.key==="Escape"&&n()};return window.addEventListener("keydown",a),()=>window.removeEventListener("keydown",a)},[n]);const r=()=>{const a=document.createElement("a");a.href=i,a.download=`${e}_qrcode.png`,a.click()};return p.jsx("div",{className:"fixed inset-0 bg-black/70 flex items-center justify-center z-50 p-4",onClick:n,children:p.jsxs("div",{className:"bg-bambu-dark-secondary rounded-xl border border-bambu-dark-tertiary w-full max-w-sm",onClick:a=>a.stopPropagation(),children:[p.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-bambu-dark-tertiary",children:[p.jsx("h2",{className:"text-lg font-semibold text-white",children:"QR Code"}),p.jsx("button",{onClick:n,className:"text-bambu-gray hover:text-white transition-colors",children:p.jsx(Cn,{className:"w-5 h-5"})})]}),p.jsxs("div",{className:"p-6 flex flex-col items-center",children:[p.jsx("p",{className:"text-sm text-bambu-gray mb-4 text-center truncate max-w-full",children:e}),p.jsx("div",{className:"bg-white p-4 rounded-lg mb-4",children:p.jsx("img",{src:i,alt:"QR Code",className:"w-64 h-64"})}),p.jsx("p",{className:"text-xs text-bambu-gray mb-4 text-center",children:"Scan to open this archive"}),p.jsxs(st,{onClick:r,className:"w-full",children:[p.jsx($u,{className:"w-4 h-4"}),"Download QR Code"]})]})]})})}function l1e({archiveId:t,archiveName:e,photos:n,onClose:i,onDelete:r}){const[a,s]=E.useState(0),[o,l]=E.useState(!1);if(E.useEffect(()=>{const g=y=>{y.key==="Escape"&&i(),y.key==="ArrowLeft"&&s(_=>Math.max(0,_-1)),y.key==="ArrowRight"&&s(_=>Math.min(n.length-1,_+1))};return window.addEventListener("keydown",g),()=>window.removeEventListener("keydown",g)},[i,n.length]),E.useEffect(()=>{a>=n.length&&s(Math.max(0,n.length-1))},[n.length,a]),n.length===0)return i(),null;const c=n[a],d=Ye.getArchivePhotoUrl(t,c),f=()=>{const g=document.createElement("a");g.href=d,g.download=`${e}_photo_${a+1}.jpg`,g.click()},m=()=>{r&&l(!0)};return p.jsxs("div",{className:"fixed inset-0 bg-black/90 flex items-center justify-center z-50",onClick:i,children:[p.jsxs("div",{className:"relative w-full h-full flex flex-col",onClick:g=>g.stopPropagation(),children:[p.jsxs("div",{className:"flex items-center justify-between px-6 py-4 bg-black/50",children:[p.jsxs("div",{children:[p.jsx("h2",{className:"text-lg font-semibold text-white",children:e}),p.jsxs("p",{className:"text-sm text-bambu-gray",children:["Photo ",a+1," of ",n.length]})]}),p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsxs(st,{variant:"secondary",size:"sm",onClick:f,children:[p.jsx($u,{className:"w-4 h-4"}),"Download"]}),r&&p.jsx(st,{variant:"secondary",size:"sm",onClick:m,className:"text-red-400 hover:text-red-300",children:p.jsx(na,{className:"w-4 h-4"})}),p.jsx("button",{onClick:i,className:"p-2 text-bambu-gray hover:text-white transition-colors",children:p.jsx(Cn,{className:"w-6 h-6"})})]})]}),p.jsxs("div",{className:"flex-1 min-h-0 flex items-center justify-center p-4 relative overflow-hidden",children:[a>0&&p.jsx("button",{onClick:()=>s(g=>g-1),className:"absolute left-4 z-10 p-3 bg-black/50 hover:bg-black/70 rounded-full transition-colors",children:p.jsx(_f,{className:"w-8 h-8 text-white"})}),p.jsx("img",{src:d,alt:`Photo ${a+1}`,className:"max-w-full max-h-full object-contain rounded-lg",style:{maxHeight:"calc(100vh - 200px)"}}),a<n.length-1&&p.jsx("button",{onClick:()=>s(g=>g+1),className:"absolute right-4 z-10 p-3 bg-black/50 hover:bg-black/70 rounded-full transition-colors",children:p.jsx(zf,{className:"w-8 h-8 text-white"})})]}),n.length>1&&p.jsx("div",{className:"flex justify-center gap-2 p-4 bg-black/50",children:n.map((g,y)=>p.jsx("button",{onClick:()=>s(y),className:`w-16 h-16 rounded-lg overflow-hidden border-2 transition-colors ${y===a?"border-bambu-green":"border-transparent hover:border-bambu-gray"}`,children:p.jsx("img",{src:Ye.getArchivePhotoUrl(t,g),alt:`Thumbnail ${y+1}`,className:"w-full h-full object-cover"})},g))})]}),o&&p.jsx(ma,{title:"Delete Photo",message:"Delete this photo? This cannot be undone.",confirmText:"Delete",variant:"danger",onConfirm:()=>{r?.(c),l(!1)},onCancel:()=>l(!1)})]})}function Fr(t){this.content=t}Fr.prototype={constructor:Fr,find:function(t){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===t)return e;return-1},get:function(t){var e=this.find(t);return e==-1?void 0:this.content[e+1]},update:function(t,e,n){var i=n&&n!=t?this.remove(n):this,r=i.find(t),a=i.content.slice();return r==-1?a.push(n||t,e):(a[r+1]=e,n&&(a[r]=n)),new Fr(a)},remove:function(t){var e=this.find(t);if(e==-1)return this;var n=this.content.slice();return n.splice(e,2),new Fr(n)},addToStart:function(t,e){return new Fr([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new Fr(n)},addBefore:function(t,e,n){var i=this.remove(e),r=i.content.slice(),a=i.find(t);return r.splice(a==-1?r.length:a,0,e,n),new Fr(r)},forEach:function(t){for(var e=0;e<this.content.length;e+=2)t(this.content[e],this.content[e+1])},prepend:function(t){return t=Fr.from(t),t.size?new Fr(t.content.concat(this.subtract(t).content)):this},append:function(t){return t=Fr.from(t),t.size?new Fr(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=Fr.from(t);for(var n=0;n<t.content.length;n+=2)e=e.remove(t.content[n]);return e},toObject:function(){var t={};return this.forEach(function(e,n){t[e]=n}),t},get size(){return this.content.length>>1}};Fr.from=function(t){if(t instanceof Fr)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new Fr(e)};function A7(t,e,n){for(let i=0;;i++){if(i==t.childCount||i==e.childCount)return t.childCount==e.childCount?null:n;let r=t.child(i),a=e.child(i);if(r==a){n+=r.nodeSize;continue}if(!r.sameMarkup(a))return n;if(r.isText&&r.text!=a.text){for(let s=0;r.text[s]==a.text[s];s++)n++;return n}if(r.content.size||a.content.size){let s=A7(r.content,a.content,n+1);if(s!=null)return s}n+=r.nodeSize}}function T7(t,e,n,i){for(let r=t.childCount,a=e.childCount;;){if(r==0||a==0)return r==a?null:{a:n,b:i};let s=t.child(--r),o=e.child(--a),l=s.nodeSize;if(s==o){n-=l,i-=l;continue}if(!s.sameMarkup(o))return{a:n,b:i};if(s.isText&&s.text!=o.text){let c=0,d=Math.min(s.text.length,o.text.length);for(;c<d&&s.text[s.text.length-c-1]==o.text[o.text.length-c-1];)c++,n--,i--;return{a:n,b:i}}if(s.content.size||o.content.size){let c=T7(s.content,o.content,n-1,i-1);if(c)return c}n-=l,i-=l}}class ht{constructor(e,n){if(this.content=e,this.size=n||0,n==null)for(let i=0;i<e.length;i++)this.size+=e[i].nodeSize}nodesBetween(e,n,i,r=0,a){for(let s=0,o=0;o<n;s++){let l=this.content[s],c=o+l.nodeSize;if(c>e&&i(l,r+o,a||null,s)!==!1&&l.content.size){let d=o+1;l.nodesBetween(Math.max(0,e-d),Math.min(l.content.size,n-d),i,r+d)}o=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,i,r){let a="",s=!0;return this.nodesBetween(e,n,(o,l)=>{let c=o.isText?o.text.slice(Math.max(e,l)-l,n-l):o.isLeaf?r?typeof r=="function"?r(o):r:o.type.spec.leafText?o.type.spec.leafText(o):"":"";o.isBlock&&(o.isLeaf&&c||o.isTextblock)&&i&&(s?s=!1:a+=i),a+=c},0),a}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,i=e.firstChild,r=this.content.slice(),a=0;for(n.isText&&n.sameMarkup(i)&&(r[r.length-1]=n.withText(n.text+i.text),a=1);a<e.content.length;a++)r.push(e.content[a]);return new ht(r,this.size+e.size)}cut(e,n=this.size){if(e==0&&n==this.size)return this;let i=[],r=0;if(n>e)for(let a=0,s=0;s<n;a++){let o=this.content[a],l=s+o.nodeSize;l>e&&((s<e||l>n)&&(o.isText?o=o.cut(Math.max(0,e-s),Math.min(o.text.length,n-s)):o=o.cut(Math.max(0,e-s-1),Math.min(o.content.size,n-s-1))),i.push(o),r+=o.nodeSize),s=l}return new ht(i,r)}cutByIndex(e,n){return e==n?ht.empty:e==0&&n==this.content.length?this:new ht(this.content.slice(e,n))}replaceChild(e,n){let i=this.content[e];if(i==n)return this;let r=this.content.slice(),a=this.size+n.nodeSize-i.nodeSize;return r[e]=n,new ht(r,a)}addToStart(e){return new ht([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new ht(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let n=0;n<this.content.length;n++)if(!this.content[n].eq(e.content[n]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let n=this.content[e];if(!n)throw new RangeError("Index "+e+" out of range for "+this);return n}maybeChild(e){return this.content[e]||null}forEach(e){for(let n=0,i=0;n<this.content.length;n++){let r=this.content[n];e(r,i,n),i+=r.nodeSize}}findDiffStart(e,n=0){return A7(this,e,n)}findDiffEnd(e,n=this.size,i=e.size){return T7(this,e,n,i)}findIndex(e){if(e==0)return Tb(0,e);if(e==this.size)return Tb(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let n=0,i=0;;n++){let r=this.child(n),a=i+r.nodeSize;if(a>=e)return a==e?Tb(n+1,a):Tb(n,i);i=a}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,n){if(!n)return ht.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new ht(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return ht.empty;let n,i=0;for(let r=0;r<e.length;r++){let a=e[r];i+=a.nodeSize,r&&a.isText&&e[r-1].sameMarkup(a)?(n||(n=e.slice(0,r)),n[n.length-1]=a.withText(n[n.length-1].text+a.text)):n&&n.push(a)}return new ht(n||e,i)}static from(e){if(!e)return ht.empty;if(e instanceof ht)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new ht([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}ht.empty=new ht([],0);const $T={index:0,offset:0};function Tb(t,e){return $T.index=t,$T.offset=e,$T}function Q_(t,e){if(t===e)return!0;if(!(t&&typeof t=="object")||!(e&&typeof e=="object"))return!1;let n=Array.isArray(t);if(Array.isArray(e)!=n)return!1;if(n){if(t.length!=e.length)return!1;for(let i=0;i<t.length;i++)if(!Q_(t[i],e[i]))return!1}else{for(let i in t)if(!(i in e)||!Q_(t[i],e[i]))return!1;for(let i in e)if(!(i in t))return!1}return!0}let Xn=class A3{constructor(e,n){this.type=e,this.attrs=n}addToSet(e){let n,i=!1;for(let r=0;r<e.length;r++){let a=e[r];if(this.eq(a))return e;if(this.type.excludes(a.type))n||(n=e.slice(0,r));else{if(a.type.excludes(this.type))return e;!i&&a.type.rank>this.type.rank&&(n||(n=e.slice(0,r)),n.push(this),i=!0),n&&n.push(a)}}return n||(n=e.slice()),i||n.push(this),n}removeFromSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return e.slice(0,n).concat(e.slice(n+1));return e}isInSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return!0;return!1}eq(e){return this==e||this.type==e.type&&Q_(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Mark.fromJSON");let i=e.marks[n.type];if(!i)throw new RangeError(`There is no mark type ${n.type} in this schema`);let r=i.create(n.attrs);return i.checkAttrs(r.attrs),r}static sameSet(e,n){if(e==n)return!0;if(e.length!=n.length)return!1;for(let i=0;i<e.length;i++)if(!e[i].eq(n[i]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return A3.none;if(e instanceof A3)return[e];let n=e.slice();return n.sort((i,r)=>i.type.rank-r.type.rank),n}};Xn.none=[];class J_ extends Error{}class Mt{constructor(e,n,i){this.content=e,this.openStart=n,this.openEnd=i}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,n){let i=N7(this.content,e+this.openStart,n);return i&&new Mt(i,this.openStart,this.openEnd)}removeBetween(e,n){return new Mt(C7(this.content,e+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,n){if(!n)return Mt.empty;let i=n.openStart||0,r=n.openEnd||0;if(typeof i!="number"||typeof r!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new Mt(ht.fromJSON(e,n.content),i,r)}static maxOpen(e,n=!0){let i=0,r=0;for(let a=e.firstChild;a&&!a.isLeaf&&(n||!a.type.spec.isolating);a=a.firstChild)i++;for(let a=e.lastChild;a&&!a.isLeaf&&(n||!a.type.spec.isolating);a=a.lastChild)r++;return new Mt(e,i,r)}}Mt.empty=new Mt(ht.empty,0,0);function C7(t,e,n){let{index:i,offset:r}=t.findIndex(e),a=t.maybeChild(i),{index:s,offset:o}=t.findIndex(n);if(r==e||a.isText){if(o!=n&&!t.child(s).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(i!=s)throw new RangeError("Removing non-flat range");return t.replaceChild(i,a.copy(C7(a.content,e-r-1,n-r-1)))}function N7(t,e,n,i){let{index:r,offset:a}=t.findIndex(e),s=t.maybeChild(r);if(a==e||s.isText)return i&&!i.canReplace(r,r,n)?null:t.cut(0,e).append(n).append(t.cut(e));let o=N7(s.content,e-a-1,n,s);return o&&t.replaceChild(r,s.copy(o))}function c1e(t,e,n){if(n.openStart>t.depth)throw new J_("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new J_("Inconsistent open depths");return R7(t,e,n,0)}function R7(t,e,n,i){let r=t.index(i),a=t.node(i);if(r==e.index(i)&&i<t.depth-n.openStart){let s=R7(t,e,n,i+1);return a.copy(a.content.replaceChild(r,s))}else if(n.content.size)if(!n.openStart&&!n.openEnd&&t.depth==i&&e.depth==i){let s=t.parent,o=s.content;return cf(s,o.cut(0,t.parentOffset).append(n.content).append(o.cut(e.parentOffset)))}else{let{start:s,end:o}=u1e(n,t);return cf(a,D7(t,s,o,e,i))}else return cf(a,e1(t,e,i))}function P7(t,e){if(!e.type.compatibleContent(t.type))throw new J_("Cannot join "+e.type.name+" onto "+t.type.name)}function T3(t,e,n){let i=t.node(n);return P7(i,e.node(n)),i}function lf(t,e){let n=e.length-1;n>=0&&t.isText&&t.sameMarkup(e[n])?e[n]=t.withText(e[n].text+t.text):e.push(t)}function p0(t,e,n,i){let r=(e||t).node(n),a=0,s=e?e.index(n):r.childCount;t&&(a=t.index(n),t.depth>n?a++:t.textOffset&&(lf(t.nodeAfter,i),a++));for(let o=a;o<s;o++)lf(r.child(o),i);e&&e.depth==n&&e.textOffset&&lf(e.nodeBefore,i)}function cf(t,e){return t.type.checkContent(e),t.copy(e)}function D7(t,e,n,i,r){let a=t.depth>r&&T3(t,e,r+1),s=i.depth>r&&T3(n,i,r+1),o=[];return p0(null,t,r,o),a&&s&&e.index(r)==n.index(r)?(P7(a,s),lf(cf(a,D7(t,e,n,i,r+1)),o)):(a&&lf(cf(a,e1(t,e,r+1)),o),p0(e,n,r,o),s&&lf(cf(s,e1(n,i,r+1)),o)),p0(i,null,r,o),new ht(o)}function e1(t,e,n){let i=[];if(p0(null,t,n,i),t.depth>n){let r=T3(t,e,n+1);lf(cf(r,e1(t,e,n+1)),i)}return p0(e,null,n,i),new ht(i)}function u1e(t,e){let n=e.depth-t.openStart,r=e.node(n).copy(t.content);for(let a=n-1;a>=0;a--)r=e.node(a).copy(ht.from(r));return{start:r.resolveNoCache(t.openStart+n),end:r.resolveNoCache(r.content.size-t.openEnd-n)}}class Y0{constructor(e,n,i){this.pos=e,this.path=n,this.parentOffset=i,this.depth=n.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,n=this.index(this.depth);if(n==e.childCount)return null;let i=this.pos-this.path[this.path.length-1],r=e.child(n);return i?e.child(n).cut(i):r}get nodeBefore(){let e=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(e).cut(0,n):e==0?null:this.parent.child(e-1)}posAtIndex(e,n){n=this.resolveDepth(n);let i=this.path[n*3],r=n==0?0:this.path[n*3-1]+1;for(let a=0;a<e;a++)r+=i.child(a).nodeSize;return r}marks(){let e=this.parent,n=this.index();if(e.content.size==0)return Xn.none;if(this.textOffset)return e.child(n).marks;let i=e.maybeChild(n-1),r=e.maybeChild(n);if(!i){let o=i;i=r,r=o}let a=i.marks;for(var s=0;s<a.length;s++)a[s].type.spec.inclusive===!1&&(!r||!a[s].isInSet(r.marks))&&(a=a[s--].removeFromSet(a));return a}marksAcross(e){let n=this.parent.maybeChild(this.index());if(!n||!n.isInline)return null;let i=n.marks,r=e.parent.maybeChild(e.index());for(var a=0;a<i.length;a++)i[a].type.spec.inclusive===!1&&(!r||!i[a].isInSet(r.marks))&&(i=i[a--].removeFromSet(i));return i}sharedDepth(e){for(let n=this.depth;n>0;n--)if(this.start(n)<=e&&this.end(n)>=e)return n;return 0}blockRange(e=this,n){if(e.pos<this.pos)return e.blockRange(this);for(let i=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);i>=0;i--)if(e.pos<=this.end(i)&&(!n||n(this.node(i))))return new t1(this,e,i);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let n=1;n<=this.depth;n++)e+=(e?"/":"")+this.node(n).type.name+"_"+this.index(n-1);return e+":"+this.parentOffset}static resolve(e,n){if(!(n>=0&&n<=e.content.size))throw new RangeError("Position "+n+" out of range");let i=[],r=0,a=n;for(let s=e;;){let{index:o,offset:l}=s.content.findIndex(a),c=a-l;if(i.push(s,o,r+l),!c||(s=s.child(o),s.isText))break;a=c-1,r+=l+1}return new Y0(n,i,a)}static resolveCached(e,n){let i=G5.get(e);if(i)for(let a=0;a<i.elts.length;a++){let s=i.elts[a];if(s.pos==n)return s}else G5.set(e,i=new d1e);let r=i.elts[i.i]=Y0.resolve(e,n);return i.i=(i.i+1)%f1e,r}}class d1e{constructor(){this.elts=[],this.i=0}}const f1e=12,G5=new WeakMap;class t1{constructor(e,n,i){this.$from=e,this.$to=n,this.depth=i}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const h1e=Object.create(null);let Fu=class C3{constructor(e,n,i,r=Xn.none){this.type=e,this.attrs=n,this.marks=r,this.content=i||ht.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,n,i,r=0){this.content.nodesBetween(e,n,i,r,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,n,i,r){return this.content.textBetween(e,n,i,r)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,n,i){return this.type==e&&Q_(this.attrs,n||e.defaultAttrs||h1e)&&Xn.sameSet(this.marks,i||Xn.none)}copy(e=null){return e==this.content?this:new C3(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new C3(this.type,this.attrs,this.content,e)}cut(e,n=this.content.size){return e==0&&n==this.content.size?this:this.copy(this.content.cut(e,n))}slice(e,n=this.content.size,i=!1){if(e==n)return Mt.empty;let r=this.resolve(e),a=this.resolve(n),s=i?0:r.sharedDepth(n),o=r.start(s),c=r.node(s).content.cut(r.pos-o,a.pos-o);return new Mt(c,r.depth-s,a.depth-s)}replace(e,n,i){return c1e(this.resolve(e),this.resolve(n),i)}nodeAt(e){for(let n=this;;){let{index:i,offset:r}=n.content.findIndex(e);if(n=n.maybeChild(i),!n)return null;if(r==e||n.isText)return n;e-=r+1}}childAfter(e){let{index:n,offset:i}=this.content.findIndex(e);return{node:this.content.maybeChild(n),index:n,offset:i}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:n,offset:i}=this.content.findIndex(e);if(i<e)return{node:this.content.child(n),index:n,offset:i};let r=this.content.child(n-1);return{node:r,index:n-1,offset:i-r.nodeSize}}resolve(e){return Y0.resolveCached(this,e)}resolveNoCache(e){return Y0.resolve(this,e)}rangeHasMark(e,n,i){let r=!1;return n>e&&this.nodesBetween(e,n,a=>(i.isInSet(a.marks)&&(r=!0),!r)),r}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),k7(this.marks,e)}contentMatchAt(e){let n=this.type.contentMatch.matchFragment(this.content,0,e);if(!n)throw new Error("Called contentMatchAt on a node with invalid content");return n}canReplace(e,n,i=ht.empty,r=0,a=i.childCount){let s=this.contentMatchAt(e).matchFragment(i,r,a),o=s&&s.matchFragment(this.content,n);if(!o||!o.validEnd)return!1;for(let l=r;l<a;l++)if(!this.type.allowsMarks(i.child(l).marks))return!1;return!0}canReplaceWith(e,n,i,r){if(r&&!this.type.allowsMarks(r))return!1;let a=this.contentMatchAt(e).matchType(i),s=a&&a.matchFragment(this.content,n);return s?s.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=Xn.none;for(let n=0;n<this.marks.length;n++){let i=this.marks[n];i.type.checkAttrs(i.attrs),e=i.addToSet(e)}if(!Xn.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(n=>n.type.name)}`);this.content.forEach(n=>n.check())}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(n=>n.toJSON())),e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Node.fromJSON");let i;if(n.marks){if(!Array.isArray(n.marks))throw new RangeError("Invalid mark data for Node.fromJSON");i=n.marks.map(e.markFromJSON)}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(n.text,i)}let r=ht.fromJSON(e,n.content),a=e.nodeType(n.type).create(n.attrs,r,i);return a.type.checkAttrs(a.attrs),a}};Fu.prototype.text=void 0;class n1 extends Fu{constructor(e,n,i,r){if(super(e,n,null,r),!i)throw new RangeError("Empty text nodes are not allowed");this.text=i}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):k7(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,n){return this.text.slice(e,n)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new n1(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new n1(this.type,this.attrs,e,this.marks)}cut(e=0,n=this.text.length){return e==0&&n==this.text.length?this:this.withText(this.text.slice(e,n))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function k7(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class Cf{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let i=new p1e(e,n);if(i.next==null)return Cf.empty;let r=O7(i);i.next&&i.err("Unexpected trailing text");let a=_1e(b1e(r));return S1e(a,i),a}matchType(e){for(let n=0;n<this.next.length;n++)if(this.next[n].type==e)return this.next[n].next;return null}matchFragment(e,n=0,i=e.childCount){let r=this;for(let a=n;r&&a<i;a++)r=r.matchType(e.child(a).type);return r}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:n}=this.next[e];if(!(n.isText||n.hasRequiredAttrs()))return n}return null}compatible(e){for(let n=0;n<this.next.length;n++)for(let i=0;i<e.next.length;i++)if(this.next[n].type==e.next[i].type)return!0;return!1}fillBefore(e,n=!1,i=0){let r=[this];function a(s,o){let l=s.matchFragment(e,i);if(l&&(!n||l.validEnd))return ht.from(o.map(c=>c.createAndFill()));for(let c=0;c<s.next.length;c++){let{type:d,next:f}=s.next[c];if(!(d.isText||d.hasRequiredAttrs())&&r.indexOf(f)==-1){r.push(f);let m=a(f,o.concat(d));if(m)return m}}return null}return a(this,[])}findWrapping(e){for(let i=0;i<this.wrapCache.length;i+=2)if(this.wrapCache[i]==e)return this.wrapCache[i+1];let n=this.computeWrapping(e);return this.wrapCache.push(e,n),n}computeWrapping(e){let n=Object.create(null),i=[{match:this,type:null,via:null}];for(;i.length;){let r=i.shift(),a=r.match;if(a.matchType(e)){let s=[];for(let o=r;o.type;o=o.via)s.push(o.type);return s.reverse()}for(let s=0;s<a.next.length;s++){let{type:o,next:l}=a.next[s];!o.isLeaf&&!o.hasRequiredAttrs()&&!(o.name in n)&&(!r.type||l.validEnd)&&(i.push({match:o.contentMatch,type:o,via:r}),n[o.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function n(i){e.push(i);for(let r=0;r<i.next.length;r++)e.indexOf(i.next[r].next)==-1&&n(i.next[r].next)}return n(this),e.map((i,r)=>{let a=r+(i.validEnd?"*":" ")+" ";for(let s=0;s<i.next.length;s++)a+=(s?", ":"")+i.next[s].type.name+"->"+e.indexOf(i.next[s].next);return a}).join(`
  8060. `)}}Cf.empty=new Cf(!0);class p1e{constructor(e,n){this.string=e,this.nodeTypes=n,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function O7(t){let e=[];do e.push(m1e(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function m1e(t){let e=[];do e.push(g1e(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function g1e(t){let e=y1e(t);for(;;)if(t.eat("+"))e={type:"plus",expr:e};else if(t.eat("*"))e={type:"star",expr:e};else if(t.eat("?"))e={type:"opt",expr:e};else if(t.eat("{"))e=x1e(t,e);else break;return e}function W5(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function x1e(t,e){let n=W5(t),i=n;return t.eat(",")&&(t.next!="}"?i=W5(t):i=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:i,expr:e}}function v1e(t,e){let n=t.nodeTypes,i=n[e];if(i)return[i];let r=[];for(let a in n){let s=n[a];s.isInGroup(e)&&r.push(s)}return r.length==0&&t.err("No node type or group '"+e+"' found"),r}function y1e(t){if(t.eat("(")){let e=O7(t);return t.eat(")")||t.err("Missing closing paren"),e}else if(/\W/.test(t.next))t.err("Unexpected token '"+t.next+"'");else{let e=v1e(t,t.next).map(n=>(t.inline==null?t.inline=n.isInline:t.inline!=n.isInline&&t.err("Mixing inline and block content"),{type:"name",value:n}));return t.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function b1e(t){let e=[[]];return r(a(t,0),n()),e;function n(){return e.push([])-1}function i(s,o,l){let c={term:l,to:o};return e[s].push(c),c}function r(s,o){s.forEach(l=>l.to=o)}function a(s,o){if(s.type=="choice")return s.exprs.reduce((l,c)=>l.concat(a(c,o)),[]);if(s.type=="seq")for(let l=0;;l++){let c=a(s.exprs[l],o);if(l==s.exprs.length-1)return c;r(c,o=n())}else if(s.type=="star"){let l=n();return i(o,l),r(a(s.expr,l),l),[i(l)]}else if(s.type=="plus"){let l=n();return r(a(s.expr,o),l),r(a(s.expr,l),l),[i(l)]}else{if(s.type=="opt")return[i(o)].concat(a(s.expr,o));if(s.type=="range"){let l=o;for(let c=0;c<s.min;c++){let d=n();r(a(s.expr,l),d),l=d}if(s.max==-1)r(a(s.expr,l),l);else for(let c=s.min;c<s.max;c++){let d=n();i(l,d),r(a(s.expr,l),d),l=d}return[i(l)]}else{if(s.type=="name")return[i(o,void 0,s.value)];throw new Error("Unknown expr type")}}}}function L7(t,e){return e-t}function q5(t,e){let n=[];return i(e),n.sort(L7);function i(r){let a=t[r];if(a.length==1&&!a[0].term)return i(a[0].to);n.push(r);for(let s=0;s<a.length;s++){let{term:o,to:l}=a[s];!o&&n.indexOf(l)==-1&&i(l)}}}function _1e(t){let e=Object.create(null);return n(q5(t,0));function n(i){let r=[];i.forEach(s=>{t[s].forEach(({term:o,to:l})=>{if(!o)return;let c;for(let d=0;d<r.length;d++)r[d][0]==o&&(c=r[d][1]);q5(t,l).forEach(d=>{c||r.push([o,c=[]]),c.indexOf(d)==-1&&c.push(d)})})});let a=e[i.join(",")]=new Cf(i.indexOf(t.length-1)>-1);for(let s=0;s<r.length;s++){let o=r[s][1].sort(L7);a.next.push({type:r[s][0],next:e[o.join(",")]||n(o)})}return a}}function S1e(t,e){for(let n=0,i=[t];n<i.length;n++){let r=i[n],a=!r.validEnd,s=[];for(let o=0;o<r.next.length;o++){let{type:l,next:c}=r.next[o];s.push(l.name),a&&!(l.isText||l.hasRequiredAttrs())&&(a=!1),i.indexOf(c)==-1&&i.push(c)}a&&e.err("Only non-generatable nodes ("+s.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function I7(t){let e=Object.create(null);for(let n in t){let i=t[n];if(!i.hasDefault)return null;e[n]=i.default}return e}function U7(t,e){let n=Object.create(null);for(let i in t){let r=e&&e[i];if(r===void 0){let a=t[i];if(a.hasDefault)r=a.default;else throw new RangeError("No value supplied for attribute "+i)}n[i]=r}return n}function j7(t,e,n,i){for(let r in e)if(!(r in t))throw new RangeError(`Unsupported attribute ${r} for ${n} of type ${r}`);for(let r in t){let a=t[r];a.validate&&a.validate(e[r])}}function F7(t,e){let n=Object.create(null);if(e)for(let i in e)n[i]=new M1e(t,i,e[i]);return n}let X5=class z7{constructor(e,n,i){this.name=e,this.schema=n,this.spec=i,this.markSet=null,this.groups=i.group?i.group.split(" "):[],this.attrs=F7(e,i.attrs),this.defaultAttrs=I7(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(i.inline||e=="text"),this.isText=e=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==Cf.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:U7(this.attrs,e)}create(e=null,n,i){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new Fu(this,this.computeAttrs(e),ht.from(n),Xn.setFrom(i))}createChecked(e=null,n,i){return n=ht.from(n),this.checkContent(n),new Fu(this,this.computeAttrs(e),n,Xn.setFrom(i))}createAndFill(e=null,n,i){if(e=this.computeAttrs(e),n=ht.from(n),n.size){let s=this.contentMatch.fillBefore(n);if(!s)return null;n=s.append(n)}let r=this.contentMatch.matchFragment(n),a=r&&r.fillBefore(ht.empty,!0);return a?new Fu(this,e,n.append(a),Xn.setFrom(i)):null}validContent(e){let n=this.contentMatch.matchFragment(e);if(!n||!n.validEnd)return!1;for(let i=0;i<e.childCount;i++)if(!this.allowsMarks(e.child(i).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){j7(this.attrs,e,"node",this.name)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let n=0;n<e.length;n++)if(!this.allowsMarkType(e[n].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let n;for(let i=0;i<e.length;i++)this.allowsMarkType(e[i].type)?n&&n.push(e[i]):n||(n=e.slice(0,i));return n?n.length?n:Xn.none:e}static compile(e,n){let i=Object.create(null);e.forEach((a,s)=>i[a]=new z7(a,n,s));let r=n.spec.topNode||"doc";if(!i[r])throw new RangeError("Schema is missing its top node type ('"+r+"')");if(!i.text)throw new RangeError("Every schema needs a 'text' type");for(let a in i.text.attrs)throw new RangeError("The text node type should not have attributes");return i}};function w1e(t,e,n){let i=n.split("|");return r=>{let a=r===null?"null":typeof r;if(i.indexOf(a)<0)throw new RangeError(`Expected value of type ${i} for attribute ${e} on type ${t}, got ${a}`)}}class M1e{constructor(e,n,i){this.hasDefault=Object.prototype.hasOwnProperty.call(i,"default"),this.default=i.default,this.validate=typeof i.validate=="string"?w1e(e,n,i.validate):i.validate}get isRequired(){return!this.hasDefault}}class ew{constructor(e,n,i,r){this.name=e,this.rank=n,this.schema=i,this.spec=r,this.attrs=F7(e,r.attrs),this.excluded=null;let a=I7(this.attrs);this.instance=a?new Xn(this,a):null}create(e=null){return!e&&this.instance?this.instance:new Xn(this,U7(this.attrs,e))}static compile(e,n){let i=Object.create(null),r=0;return e.forEach((a,s)=>i[a]=new ew(a,r++,n,s)),i}removeFromSet(e){for(var n=0;n<e.length;n++)e[n].type==this&&(e=e.slice(0,n).concat(e.slice(n+1)),n--);return e}isInSet(e){for(let n=0;n<e.length;n++)if(e[n].type==this)return e[n]}checkAttrs(e){j7(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class B7{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let r in e)n[r]=e[r];n.nodes=Fr.from(e.nodes),n.marks=Fr.from(e.marks||{}),this.nodes=X5.compile(this.spec.nodes,this),this.marks=ew.compile(this.spec.marks,this);let i=Object.create(null);for(let r in this.nodes){if(r in this.marks)throw new RangeError(r+" can not be both a node and a mark");let a=this.nodes[r],s=a.spec.content||"",o=a.spec.marks;if(a.contentMatch=i[s]||(i[s]=Cf.parse(s,this.nodes)),a.inlineContent=a.contentMatch.inlineContent,a.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!a.isInline||!a.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=a}a.markSet=o=="_"?null:o?K5(this,o.split(" ")):o==""||!a.inlineContent?[]:null}for(let r in this.marks){let a=this.marks[r],s=a.spec.excludes;a.excluded=s==null?[a]:s==""?[]:K5(this,s.split(" "))}this.nodeFromJSON=r=>Fu.fromJSON(this,r),this.markFromJSON=r=>Xn.fromJSON(this,r),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,n=null,i,r){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof X5){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(n,i,r)}text(e,n){let i=this.nodes.text;return new n1(i,i.defaultAttrs,e,Xn.setFrom(n))}mark(e,n){return typeof e=="string"&&(e=this.marks[e]),e.create(n)}nodeType(e){let n=this.nodes[e];if(!n)throw new RangeError("Unknown node type: "+e);return n}}function K5(t,e){let n=[];for(let i=0;i<e.length;i++){let r=e[i],a=t.marks[r],s=a;if(a)n.push(a);else for(let o in t.marks){let l=t.marks[o];(r=="_"||l.spec.group&&l.spec.group.split(" ").indexOf(r)>-1)&&n.push(s=l)}if(!s)throw new SyntaxError("Unknown mark type: '"+e[i]+"'")}return n}function E1e(t){return t.tag!=null}function A1e(t){return t.style!=null}let m0=class N3{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let i=this.matchedStyles=[];n.forEach(r=>{if(E1e(r))this.tags.push(r);else if(A1e(r)){let a=/[^=]*/.exec(r.style)[0];i.indexOf(a)<0&&i.push(a),this.styles.push(r)}}),this.normalizeLists=!this.tags.some(r=>{if(!/^(ul|ol)\b/.test(r.tag)||!r.node)return!1;let a=e.nodes[r.node];return a.contentMatch.matchType(a)})}parse(e,n={}){let i=new Z5(this,n,!1);return i.addAll(e,Xn.none,n.from,n.to),i.finish()}parseSlice(e,n={}){let i=new Z5(this,n,!0);return i.addAll(e,Xn.none,n.from,n.to),Mt.maxOpen(i.finish())}matchTag(e,n,i){for(let r=i?this.tags.indexOf(i)+1:0;r<this.tags.length;r++){let a=this.tags[r];if(N1e(e,a.tag)&&(a.namespace===void 0||e.namespaceURI==a.namespace)&&(!a.context||n.matchesContext(a.context))){if(a.getAttrs){let s=a.getAttrs(e);if(s===!1)continue;a.attrs=s||void 0}return a}}}matchStyle(e,n,i,r){for(let a=r?this.styles.indexOf(r)+1:0;a<this.styles.length;a++){let s=this.styles[a],o=s.style;if(!(o.indexOf(e)!=0||s.context&&!i.matchesContext(s.context)||o.length>e.length&&(o.charCodeAt(e.length)!=61||o.slice(e.length+1)!=n))){if(s.getAttrs){let l=s.getAttrs(n);if(l===!1)continue;s.attrs=l||void 0}return s}}}static schemaRules(e){let n=[];function i(r){let a=r.priority==null?50:r.priority,s=0;for(;s<n.length;s++){let o=n[s];if((o.priority==null?50:o.priority)<a)break}n.splice(s,0,r)}for(let r in e.marks){let a=e.marks[r].spec.parseDOM;a&&a.forEach(s=>{i(s=Q5(s)),s.mark||s.ignore||s.clearMark||(s.mark=r)})}for(let r in e.nodes){let a=e.nodes[r].spec.parseDOM;a&&a.forEach(s=>{i(s=Q5(s)),s.node||s.ignore||s.mark||(s.node=r)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new N3(e,N3.schemaRules(e)))}};const H7={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},T1e={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},V7={ol:!0,ul:!0},Z0=1,R3=2,g0=4;function Y5(t,e,n){return e!=null?(e?Z0:0)|(e==="full"?R3:0):t&&t.whitespace=="pre"?Z0|R3:n&~g0}class Cb{constructor(e,n,i,r,a,s){this.type=e,this.attrs=n,this.marks=i,this.solid=r,this.options=s,this.content=[],this.activeMarks=Xn.none,this.match=a||(s&g0?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(ht.from(e));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let i=this.type.contentMatch,r;return(r=i.findWrapping(e.type))?(this.match=i,r):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&Z0)){let i=this.content[this.content.length-1],r;if(i&&i.isText&&(r=/[ \t\r\n\u000c]+$/.exec(i.text))){let a=i;i.text.length==r[0].length?this.content.pop():this.content[this.content.length-1]=a.withText(a.text.slice(0,a.text.length-r[0].length))}}let n=ht.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(ht.empty,!0))),this.type?this.type.create(this.attrs,n,this.marks):n}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!H7.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class Z5{constructor(e,n,i){this.parser=e,this.options=n,this.isOpen=i,this.open=0,this.localPreserveWS=!1;let r=n.topNode,a,s=Y5(null,n.preserveWhitespace,0)|(i?g0:0);r?a=new Cb(r.type,r.attrs,Xn.none,!0,n.topMatch||r.type.contentMatch,s):i?a=new Cb(null,null,Xn.none,!0,null,s):a=new Cb(e.schema.topNodeType,null,Xn.none,!0,null,s),this.nodes=[a],this.find=n.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,n){e.nodeType==3?this.addTextNode(e,n):e.nodeType==1&&this.addElement(e,n)}addTextNode(e,n){let i=e.nodeValue,r=this.top,a=r.options&R3?"full":this.localPreserveWS||(r.options&Z0)>0,{schema:s}=this.parser;if(a==="full"||r.inlineContext(e)||/[^ \t\r\n\u000c]/.test(i)){if(a)if(a==="full")i=i.replace(/\r\n?/g,`
  8061. `);else if(s.linebreakReplacement&&/[\r\n]/.test(i)&&this.top.findWrapping(s.linebreakReplacement.create())){let o=i.split(/\r?\n|\r/);for(let l=0;l<o.length;l++)l&&this.insertNode(s.linebreakReplacement.create(),n,!0),o[l]&&this.insertNode(s.text(o[l]),n,!/\S/.test(o[l]));i=""}else i=i.replace(/\r?\n|\r/g," ");else if(i=i.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(i)&&this.open==this.nodes.length-1){let o=r.content[r.content.length-1],l=e.previousSibling;(!o||l&&l.nodeName=="BR"||o.isText&&/[ \t\r\n\u000c]$/.test(o.text))&&(i=i.slice(1))}i&&this.insertNode(s.text(i),n,!/\S/.test(i)),this.findInText(e)}else this.findInside(e)}addElement(e,n,i){let r=this.localPreserveWS,a=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let s=e.nodeName.toLowerCase(),o;V7.hasOwnProperty(s)&&this.parser.normalizeLists&&C1e(e);let l=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(o=this.parser.matchTag(e,this,i));e:if(l?l.ignore:T1e.hasOwnProperty(s))this.findInside(e),this.ignoreFallback(e,n);else if(!l||l.skip||l.closeParent){l&&l.closeParent?this.open=Math.max(0,this.open-1):l&&l.skip.nodeType&&(e=l.skip);let c,d=this.needsBlock;if(H7.hasOwnProperty(s))a.content.length&&a.content[0].isInline&&this.open&&(this.open--,a=this.top),c=!0,a.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,n);break e}let f=l&&l.skip?n:this.readStyles(e,n);f&&this.addAll(e,f),c&&this.sync(a),this.needsBlock=d}else{let c=this.readStyles(e,n);c&&this.addElementByRule(e,l,c,l.consuming===!1?o:void 0)}this.localPreserveWS=r}leafFallback(e,n){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
  8062. `),n)}ignoreFallback(e,n){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),n,!0)}readStyles(e,n){let i=e.style;if(i&&i.length)for(let r=0;r<this.parser.matchedStyles.length;r++){let a=this.parser.matchedStyles[r],s=i.getPropertyValue(a);if(s)for(let o=void 0;;){let l=this.parser.matchStyle(a,s,this,o);if(!l)break;if(l.ignore)return null;if(l.clearMark?n=n.filter(c=>!l.clearMark(c)):n=n.concat(this.parser.schema.marks[l.mark].create(l.attrs)),l.consuming===!1)o=l;else break}}return n}addElementByRule(e,n,i,r){let a,s;if(n.node)if(s=this.parser.schema.nodes[n.node],s.isLeaf)this.insertNode(s.create(n.attrs),i,e.nodeName=="BR")||this.leafFallback(e,i);else{let l=this.enter(s,n.attrs||null,i,n.preserveWhitespace);l&&(a=!0,i=l)}else{let l=this.parser.schema.marks[n.mark];i=i.concat(l.create(n.attrs))}let o=this.top;if(s&&s.isLeaf)this.findInside(e);else if(r)this.addElement(e,i,r);else if(n.getContent)this.findInside(e),n.getContent(e,this.parser.schema).forEach(l=>this.insertNode(l,i,!1));else{let l=e;typeof n.contentElement=="string"?l=e.querySelector(n.contentElement):typeof n.contentElement=="function"?l=n.contentElement(e):n.contentElement&&(l=n.contentElement),this.findAround(e,l,!0),this.addAll(l,i),this.findAround(e,l,!1)}a&&this.sync(o)&&this.open--}addAll(e,n,i,r){let a=i||0;for(let s=i?e.childNodes[i]:e.firstChild,o=r==null?null:e.childNodes[r];s!=o;s=s.nextSibling,++a)this.findAtPoint(e,a),this.addDOM(s,n);this.findAtPoint(e,a)}findPlace(e,n,i){let r,a;for(let s=this.open,o=0;s>=0;s--){let l=this.nodes[s],c=l.findWrapping(e);if(c&&(!r||r.length>c.length+o)&&(r=c,a=l,!c.length))break;if(l.solid){if(i)break;o+=2}}if(!r)return null;this.sync(a);for(let s=0;s<r.length;s++)n=this.enterInner(r[s],null,n,!1);return n}insertNode(e,n,i){if(e.isInline&&this.needsBlock&&!this.top.type){let a=this.textblockFromContext();a&&(n=this.enterInner(a,null,n))}let r=this.findPlace(e,n,i);if(r){this.closeExtra();let a=this.top;a.match&&(a.match=a.match.matchType(e.type));let s=Xn.none;for(let o of r.concat(e.marks))(a.type?a.type.allowsMarkType(o.type):J5(o.type,e.type))&&(s=o.addToSet(s));return a.content.push(e.mark(s)),!0}return!1}enter(e,n,i,r){let a=this.findPlace(e.create(n),i,!1);return a&&(a=this.enterInner(e,n,i,!0,r)),a}enterInner(e,n,i,r=!1,a){this.closeExtra();let s=this.top;s.match=s.match&&s.match.matchType(e);let o=Y5(e,a,s.options);s.options&g0&&s.content.length==0&&(o|=g0);let l=Xn.none;return i=i.filter(c=>(s.type?s.type.allowsMarkType(c.type):J5(c.type,e))?(l=c.addToSet(l),!1):!0),this.nodes.push(new Cb(e,n,l,r,null,o)),this.open++,i}closeExtra(e=!1){let n=this.nodes.length-1;if(n>this.open){for(;n>this.open;n--)this.nodes[n-1].content.push(this.nodes[n].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let n=this.open;n>=0;n--){if(this.nodes[n]==e)return this.open=n,!0;this.localPreserveWS&&(this.nodes[n].options|=Z0)}return!1}get currentPos(){this.closeExtra();let e=0;for(let n=this.open;n>=0;n--){let i=this.nodes[n].content;for(let r=i.length-1;r>=0;r--)e+=i[r].nodeSize;n&&e++}return e}findAtPoint(e,n){if(this.find)for(let i=0;i<this.find.length;i++)this.find[i].node==e&&this.find[i].offset==n&&(this.find[i].pos=this.currentPos)}findInside(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].pos==null&&e.nodeType==1&&e.contains(this.find[n].node)&&(this.find[n].pos=this.currentPos)}findAround(e,n,i){if(e!=n&&this.find)for(let r=0;r<this.find.length;r++)this.find[r].pos==null&&e.nodeType==1&&e.contains(this.find[r].node)&&n.compareDocumentPosition(this.find[r].node)&(i?2:4)&&(this.find[r].pos=this.currentPos)}findInText(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&(this.find[n].pos=this.currentPos-(e.nodeValue.length-this.find[n].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let n=e.split("/"),i=this.options.context,r=!this.isOpen&&(!i||i.parent.type==this.nodes[0].type),a=-(i?i.depth+1:0)+(r?0:1),s=(o,l)=>{for(;o>=0;o--){let c=n[o];if(c==""){if(o==n.length-1||o==0)continue;for(;l>=a;l--)if(s(o-1,l))return!0;return!1}else{let d=l>0||l==0&&r?this.nodes[l].type:i&&l>=a?i.node(l-a).type:null;if(!d||d.name!=c&&!d.isInGroup(c))return!1;l--}}return!0};return s(n.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let n=e.depth;n>=0;n--){let i=e.node(n).contentMatchAt(e.indexAfter(n)).defaultType;if(i&&i.isTextblock&&i.defaultAttrs)return i}for(let n in this.parser.schema.nodes){let i=this.parser.schema.nodes[n];if(i.isTextblock&&i.defaultAttrs)return i}}}function C1e(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let i=e.nodeType==1?e.nodeName.toLowerCase():null;i&&V7.hasOwnProperty(i)&&n?(n.appendChild(e),e=n):i=="li"?n=e:i&&(n=null)}}function N1e(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function Q5(t){let e={};for(let n in t)e[n]=t[n];return e}function J5(t,e){let n=e.schema.nodes;for(let i in n){let r=n[i];if(!r.allowsMarkType(t))continue;let a=[],s=o=>{a.push(o);for(let l=0;l<o.edgeCount;l++){let{type:c,next:d}=o.edge(l);if(c==e||a.indexOf(d)<0&&s(d))return!0}};if(s(r.contentMatch))return!0}}class Vf{constructor(e,n){this.nodes=e,this.marks=n}serializeFragment(e,n={},i){i||(i=GT(n).createDocumentFragment());let r=i,a=[];return e.forEach(s=>{if(a.length||s.marks.length){let o=0,l=0;for(;o<a.length&&l<s.marks.length;){let c=s.marks[l];if(!this.marks[c.type.name]){l++;continue}if(!c.eq(a[o][0])||c.type.spec.spanning===!1)break;o++,l++}for(;o<a.length;)r=a.pop()[1];for(;l<s.marks.length;){let c=s.marks[l++],d=this.serializeMark(c,s.isInline,n);d&&(a.push([c,r]),r.appendChild(d.dom),r=d.contentDOM||d.dom)}}r.appendChild(this.serializeNodeInner(s,n))}),i}serializeNodeInner(e,n){let{dom:i,contentDOM:r}=m_(GT(n),this.nodes[e.type.name](e),null,e.attrs);if(r){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,n,r)}return i}serializeNode(e,n={}){let i=this.serializeNodeInner(e,n);for(let r=e.marks.length-1;r>=0;r--){let a=this.serializeMark(e.marks[r],e.isInline,n);a&&((a.contentDOM||a.dom).appendChild(i),i=a.dom)}return i}serializeMark(e,n,i={}){let r=this.marks[e.type.name];return r&&m_(GT(i),r(e,n),null,e.attrs)}static renderSpec(e,n,i=null,r){return m_(e,n,i,r)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new Vf(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=eB(e.nodes);return n.text||(n.text=i=>i.text),n}static marksFromSchema(e){return eB(e.marks)}}function eB(t){let e={};for(let n in t){let i=t[n].spec.toDOM;i&&(e[n]=i)}return e}function GT(t){return t.document||window.document}const tB=new WeakMap;function R1e(t){let e=tB.get(t);return e===void 0&&tB.set(t,e=P1e(t)),e}function P1e(t){let e=null;function n(i){if(i&&typeof i=="object")if(Array.isArray(i))if(typeof i[0]=="string")e||(e=[]),e.push(i);else for(let r=0;r<i.length;r++)n(i[r]);else for(let r in i)n(i[r])}return n(t),e}function m_(t,e,n,i){if(typeof e=="string")return{dom:t.createTextNode(e)};if(e.nodeType!=null)return{dom:e};if(e.dom&&e.dom.nodeType!=null)return e;let r=e[0],a;if(typeof r!="string")throw new RangeError("Invalid array passed to renderSpec");if(i&&(a=R1e(i))&&a.indexOf(e)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let s=r.indexOf(" ");s>0&&(n=r.slice(0,s),r=r.slice(s+1));let o,l=n?t.createElementNS(n,r):t.createElement(r),c=e[1],d=1;if(c&&typeof c=="object"&&c.nodeType==null&&!Array.isArray(c)){d=2;for(let f in c)if(c[f]!=null){let m=f.indexOf(" ");m>0?l.setAttributeNS(f.slice(0,m),f.slice(m+1),c[f]):f=="style"&&l.style?l.style.cssText=c[f]:l.setAttribute(f,c[f])}}for(let f=d;f<e.length;f++){let m=e[f];if(m===0){if(f<e.length-1||f>d)throw new RangeError("Content hole must be the only child of its parent node");return{dom:l,contentDOM:l}}else{let{dom:g,contentDOM:y}=m_(t,m,n,i);if(l.appendChild(g),y){if(o)throw new RangeError("Multiple content holes");o=y}}}return{dom:l,contentDOM:o}}const $7=65535,G7=Math.pow(2,16);function D1e(t,e){return t+e*G7}function nB(t){return t&$7}function k1e(t){return(t-(t&$7))/G7}const W7=1,q7=2,g_=4,X7=8;class P3{constructor(e,n,i){this.pos=e,this.delInfo=n,this.recover=i}get deleted(){return(this.delInfo&X7)>0}get deletedBefore(){return(this.delInfo&(W7|g_))>0}get deletedAfter(){return(this.delInfo&(q7|g_))>0}get deletedAcross(){return(this.delInfo&g_)>0}}class as{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&as.empty)return as.empty}recover(e){let n=0,i=nB(e);if(!this.inverted)for(let r=0;r<i;r++)n+=this.ranges[r*3+2]-this.ranges[r*3+1];return this.ranges[i*3]+n+k1e(e)}mapResult(e,n=1){return this._map(e,n,!1)}map(e,n=1){return this._map(e,n,!0)}_map(e,n,i){let r=0,a=this.inverted?2:1,s=this.inverted?1:2;for(let o=0;o<this.ranges.length;o+=3){let l=this.ranges[o]-(this.inverted?r:0);if(l>e)break;let c=this.ranges[o+a],d=this.ranges[o+s],f=l+c;if(e<=f){let m=c?e==l?-1:e==f?1:n:n,g=l+r+(m<0?0:d);if(i)return g;let y=e==(n<0?l:f)?null:D1e(o/3,e-l),_=e==l?q7:e==f?W7:g_;return(n<0?e!=l:e!=f)&&(_|=X7),new P3(g,_,y)}r+=d-c}return i?e+r:new P3(e+r,0,null)}touches(e,n){let i=0,r=nB(n),a=this.inverted?2:1,s=this.inverted?1:2;for(let o=0;o<this.ranges.length;o+=3){let l=this.ranges[o]-(this.inverted?i:0);if(l>e)break;let c=this.ranges[o+a],d=l+c;if(e<=d&&o==r*3)return!0;i+=this.ranges[o+s]-c}return!1}forEach(e){let n=this.inverted?2:1,i=this.inverted?1:2;for(let r=0,a=0;r<this.ranges.length;r+=3){let s=this.ranges[r],o=s-(this.inverted?a:0),l=s+(this.inverted?0:a),c=this.ranges[r+n],d=this.ranges[r+i];e(o,o+c,l,l+d),a+=d-c}}invert(){return new as(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?as.empty:new as(e<0?[0,-e,0]:[0,0,e])}}as.empty=new as([]);class Q0{constructor(e,n,i=0,r=e?e.length:0){this.mirror=n,this.from=i,this.to=r,this._maps=e||[],this.ownData=!(e||n)}get maps(){return this._maps}slice(e=0,n=this.maps.length){return new Q0(this._maps,this.mirror,e,n)}appendMap(e,n){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),n!=null&&this.setMirror(this._maps.length-1,n)}appendMapping(e){for(let n=0,i=this._maps.length;n<e._maps.length;n++){let r=e.getMirror(n);this.appendMap(e._maps[n],r!=null&&r<n?i+r:void 0)}}getMirror(e){if(this.mirror){for(let n=0;n<this.mirror.length;n++)if(this.mirror[n]==e)return this.mirror[n+(n%2?-1:1)]}}setMirror(e,n){this.mirror||(this.mirror=[]),this.mirror.push(e,n)}appendMappingInverted(e){for(let n=e.maps.length-1,i=this._maps.length+e._maps.length;n>=0;n--){let r=e.getMirror(n);this.appendMap(e._maps[n].invert(),r!=null&&r>n?i-r-1:void 0)}}invert(){let e=new Q0;return e.appendMappingInverted(this),e}map(e,n=1){if(this.mirror)return this._map(e,n,!0);for(let i=this.from;i<this.to;i++)e=this._maps[i].map(e,n);return e}mapResult(e,n=1){return this._map(e,n,!1)}_map(e,n,i){let r=0;for(let a=this.from;a<this.to;a++){let s=this._maps[a],o=s.mapResult(e,n);if(o.recover!=null){let l=this.getMirror(a);if(l!=null&&l>a&&l<this.to){a=l,e=this._maps[l].recover(o.recover);continue}}r|=o.delInfo,e=o.pos}return i?e:new P3(e,r,null)}}const WT=Object.create(null);let aa=class{getMap(){return as.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let i=WT[n.stepType];if(!i)throw new RangeError(`No step type ${n.stepType} defined`);return i.fromJSON(e,n)}static jsonID(e,n){if(e in WT)throw new RangeError("Duplicate use of step JSON ID "+e);return WT[e]=n,n.prototype.jsonID=e,n}};class $i{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new $i(e,null)}static fail(e){return new $i(null,e)}static fromReplace(e,n,i,r){try{return $i.ok(e.replace(n,i,r))}catch(a){if(a instanceof J_)return $i.fail(a.message);throw a}}}function aD(t,e,n){let i=[];for(let r=0;r<t.childCount;r++){let a=t.child(r);a.content.size&&(a=a.copy(aD(a.content,e,a))),a.isInline&&(a=e(a,n,r)),i.push(a)}return ht.fromArray(i)}class Pu extends aa{constructor(e,n,i){super(),this.from=e,this.to=n,this.mark=i}apply(e){let n=e.slice(this.from,this.to),i=e.resolve(this.from),r=i.node(i.sharedDepth(this.to)),a=new Mt(aD(n.content,(s,o)=>!s.isAtom||!o.type.allowsMarkType(this.mark.type)?s:s.mark(this.mark.addToSet(s.marks)),r),n.openStart,n.openEnd);return $i.fromReplace(e,this.from,this.to,a)}invert(){return new xo(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),i=e.mapResult(this.to,-1);return n.deleted&&i.deleted||n.pos>=i.pos?null:new Pu(n.pos,i.pos,this.mark)}merge(e){return e instanceof Pu&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Pu(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new Pu(n.from,n.to,e.markFromJSON(n.mark))}}aa.jsonID("addMark",Pu);class xo extends aa{constructor(e,n,i){super(),this.from=e,this.to=n,this.mark=i}apply(e){let n=e.slice(this.from,this.to),i=new Mt(aD(n.content,r=>r.mark(this.mark.removeFromSet(r.marks)),e),n.openStart,n.openEnd);return $i.fromReplace(e,this.from,this.to,i)}invert(){return new Pu(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),i=e.mapResult(this.to,-1);return n.deleted&&i.deleted||n.pos>=i.pos?null:new xo(n.pos,i.pos,this.mark)}merge(e){return e instanceof xo&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new xo(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new xo(n.from,n.to,e.markFromJSON(n.mark))}}aa.jsonID("removeMark",xo);class Du extends aa{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return $i.fail("No node at mark step's position");let i=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return $i.fromReplace(e,this.pos,this.pos+1,new Mt(ht.from(i),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);if(n){let i=this.mark.addToSet(n.marks);if(i.length==n.marks.length){for(let r=0;r<n.marks.length;r++)if(!n.marks[r].isInSet(i))return new Du(this.pos,n.marks[r]);return new Du(this.pos,this.mark)}}return new Nf(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Du(n.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new Du(n.pos,e.markFromJSON(n.mark))}}aa.jsonID("addNodeMark",Du);class Nf extends aa{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return $i.fail("No node at mark step's position");let i=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return $i.fromReplace(e,this.pos,this.pos+1,new Mt(ht.from(i),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new Du(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Nf(n.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new Nf(n.pos,e.markFromJSON(n.mark))}}aa.jsonID("removeNodeMark",Nf);class Mr extends aa{constructor(e,n,i,r=!1){super(),this.from=e,this.to=n,this.slice=i,this.structure=r}apply(e){return this.structure&&D3(e,this.from,this.to)?$i.fail("Structure replace would overwrite content"):$i.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new as([this.from,this.to-this.from,this.slice.size])}invert(e){return new Mr(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let n=e.mapResult(this.from,1),i=e.mapResult(this.to,-1);return n.deletedAcross&&i.deletedAcross?null:new Mr(n.pos,Math.max(n.pos,i.pos),this.slice,this.structure)}merge(e){if(!(e instanceof Mr)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let n=this.slice.size+e.slice.size==0?Mt.empty:new Mt(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new Mr(this.from,this.to+(e.to-e.from),n,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let n=this.slice.size+e.slice.size==0?Mt.empty:new Mt(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new Mr(e.from,this.to,n,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new Mr(n.from,n.to,Mt.fromJSON(e,n.slice),!!n.structure)}}aa.jsonID("replace",Mr);class Ar extends aa{constructor(e,n,i,r,a,s,o=!1){super(),this.from=e,this.to=n,this.gapFrom=i,this.gapTo=r,this.slice=a,this.insert=s,this.structure=o}apply(e){if(this.structure&&(D3(e,this.from,this.gapFrom)||D3(e,this.gapTo,this.to)))return $i.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return $i.fail("Gap is not a flat range");let i=this.slice.insertAt(this.insert,n.content);return i?$i.fromReplace(e,this.from,this.to,i):$i.fail("Content does not fit in gap")}getMap(){return new as([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let n=this.gapTo-this.gapFrom;return new Ar(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let n=e.mapResult(this.from,1),i=e.mapResult(this.to,-1),r=this.from==this.gapFrom?n.pos:e.map(this.gapFrom,-1),a=this.to==this.gapTo?i.pos:e.map(this.gapTo,1);return n.deletedAcross&&i.deletedAcross||r<n.pos||a>i.pos?null:new Ar(n.pos,i.pos,r,a,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number"||typeof n.gapFrom!="number"||typeof n.gapTo!="number"||typeof n.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new Ar(n.from,n.to,n.gapFrom,n.gapTo,Mt.fromJSON(e,n.slice),n.insert,!!n.structure)}}aa.jsonID("replaceAround",Ar);function D3(t,e,n){let i=t.resolve(e),r=n-e,a=i.depth;for(;r>0&&a>0&&i.indexAfter(a)==i.node(a).childCount;)a--,r--;if(r>0){let s=i.node(a).maybeChild(i.indexAfter(a));for(;r>0;){if(!s||s.isLeaf)return!0;s=s.firstChild,r--}}return!1}function O1e(t,e,n,i){let r=[],a=[],s,o;t.doc.nodesBetween(e,n,(l,c,d)=>{if(!l.isInline)return;let f=l.marks;if(!i.isInSet(f)&&d.type.allowsMarkType(i.type)){let m=Math.max(c,e),g=Math.min(c+l.nodeSize,n),y=i.addToSet(f);for(let _=0;_<f.length;_++)f[_].isInSet(y)||(s&&s.to==m&&s.mark.eq(f[_])?s.to=g:r.push(s=new xo(m,g,f[_])));o&&o.to==m?o.to=g:a.push(o=new Pu(m,g,i))}}),r.forEach(l=>t.step(l)),a.forEach(l=>t.step(l))}function L1e(t,e,n,i){let r=[],a=0;t.doc.nodesBetween(e,n,(s,o)=>{if(!s.isInline)return;a++;let l=null;if(i instanceof ew){let c=s.marks,d;for(;d=i.isInSet(c);)(l||(l=[])).push(d),c=d.removeFromSet(c)}else i?i.isInSet(s.marks)&&(l=[i]):l=s.marks;if(l&&l.length){let c=Math.min(o+s.nodeSize,n);for(let d=0;d<l.length;d++){let f=l[d],m;for(let g=0;g<r.length;g++){let y=r[g];y.step==a-1&&f.eq(r[g].style)&&(m=y)}m?(m.to=c,m.step=a):r.push({style:f,from:Math.max(o,e),to:c,step:a})}}}),r.forEach(s=>t.step(new xo(s.from,s.to,s.style)))}function sD(t,e,n,i=n.contentMatch,r=!0){let a=t.doc.nodeAt(e),s=[],o=e+1;for(let l=0;l<a.childCount;l++){let c=a.child(l),d=o+c.nodeSize,f=i.matchType(c.type);if(!f)s.push(new Mr(o,d,Mt.empty));else{i=f;for(let m=0;m<c.marks.length;m++)n.allowsMarkType(c.marks[m].type)||t.step(new xo(o,d,c.marks[m]));if(r&&c.isText&&n.whitespace!="pre"){let m,g=/\r?\n|\r/g,y;for(;m=g.exec(c.text);)y||(y=new Mt(ht.from(n.schema.text(" ",n.allowedMarks(c.marks))),0,0)),s.push(new Mr(o+m.index,o+m.index+m[0].length,y))}}o=d}if(!i.validEnd){let l=i.fillBefore(ht.empty,!0);t.replace(o,o,new Mt(l,0,0))}for(let l=s.length-1;l>=0;l--)t.step(s[l])}function I1e(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function vm(t){let n=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let i=t.depth,r=0,a=0;;--i){let s=t.$from.node(i),o=t.$from.index(i)+r,l=t.$to.indexAfter(i)-a;if(i<t.depth&&s.canReplace(o,l,n))return i;if(i==0||s.type.spec.isolating||!I1e(s,o,l))break;o&&(r=1),l<s.childCount&&(a=1)}return null}function U1e(t,e,n){let{$from:i,$to:r,depth:a}=e,s=i.before(a+1),o=r.after(a+1),l=s,c=o,d=ht.empty,f=0;for(let y=a,_=!1;y>n;y--)_||i.index(y)>0?(_=!0,d=ht.from(i.node(y).copy(d)),f++):l--;let m=ht.empty,g=0;for(let y=a,_=!1;y>n;y--)_||r.after(y+1)<r.end(y)?(_=!0,m=ht.from(r.node(y).copy(m)),g++):c++;t.step(new Ar(l,c,s,o,new Mt(d.append(m),f,g),d.size-f,!0))}function oD(t,e,n=null,i=t){let r=j1e(t,e),a=r&&F1e(i,e);return a?r.map(iB).concat({type:e,attrs:n}).concat(a.map(iB)):null}function iB(t){return{type:t,attrs:null}}function j1e(t,e){let{parent:n,startIndex:i,endIndex:r}=t,a=n.contentMatchAt(i).findWrapping(e);if(!a)return null;let s=a.length?a[0]:e;return n.canReplaceWith(i,r,s)?a:null}function F1e(t,e){let{parent:n,startIndex:i,endIndex:r}=t,a=n.child(i),s=e.contentMatch.findWrapping(a.type);if(!s)return null;let l=(s.length?s[s.length-1]:e).contentMatch;for(let c=i;l&&c<r;c++)l=l.matchType(n.child(c).type);return!l||!l.validEnd?null:s}function z1e(t,e,n){let i=ht.empty;for(let s=n.length-1;s>=0;s--){if(i.size){let o=n[s].type.contentMatch.matchFragment(i);if(!o||!o.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}i=ht.from(n[s].type.create(n[s].attrs,i))}let r=e.start,a=e.end;t.step(new Ar(r,a,r,a,new Mt(i,0,0),n.length,!0))}function B1e(t,e,n,i,r){if(!i.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let a=t.steps.length;t.doc.nodesBetween(e,n,(s,o)=>{let l=typeof r=="function"?r(s):r;if(s.isTextblock&&!s.hasMarkup(i,l)&&H1e(t.doc,t.mapping.slice(a).map(o),i)){let c=null;if(i.schema.linebreakReplacement){let g=i.whitespace=="pre",y=!!i.contentMatch.matchType(i.schema.linebreakReplacement);g&&!y?c=!1:!g&&y&&(c=!0)}c===!1&&Y7(t,s,o,a),sD(t,t.mapping.slice(a).map(o,1),i,void 0,c===null);let d=t.mapping.slice(a),f=d.map(o,1),m=d.map(o+s.nodeSize,1);return t.step(new Ar(f,m,f+1,m-1,new Mt(ht.from(i.create(l,null,s.marks)),0,0),1,!0)),c===!0&&K7(t,s,o,a),!1}})}function K7(t,e,n,i){e.forEach((r,a)=>{if(r.isText){let s,o=/\r?\n|\r/g;for(;s=o.exec(r.text);){let l=t.mapping.slice(i).map(n+1+a+s.index);t.replaceWith(l,l+1,e.type.schema.linebreakReplacement.create())}}})}function Y7(t,e,n,i){e.forEach((r,a)=>{if(r.type==r.type.schema.linebreakReplacement){let s=t.mapping.slice(i).map(n+1+a);t.replaceWith(s,s+1,e.type.schema.text(`
  8063. `))}})}function H1e(t,e,n){let i=t.resolve(e),r=i.index();return i.parent.canReplaceWith(r,r+1,n)}function V1e(t,e,n,i,r){let a=t.doc.nodeAt(e);if(!a)throw new RangeError("No node at given position");n||(n=a.type);let s=n.create(i,null,r||a.marks);if(a.isLeaf)return t.replaceWith(e,e+a.nodeSize,s);if(!n.validContent(a.content))throw new RangeError("Invalid content for node type "+n.name);t.step(new Ar(e,e+a.nodeSize,e+1,e+a.nodeSize-1,new Mt(ht.from(s),0,0),1,!0))}function ac(t,e,n=1,i){let r=t.resolve(e),a=r.depth-n,s=i&&i[i.length-1]||r.parent;if(a<0||r.parent.type.spec.isolating||!r.parent.canReplace(r.index(),r.parent.childCount)||!s.type.validContent(r.parent.content.cutByIndex(r.index(),r.parent.childCount)))return!1;for(let c=r.depth-1,d=n-2;c>a;c--,d--){let f=r.node(c),m=r.index(c);if(f.type.spec.isolating)return!1;let g=f.content.cutByIndex(m,f.childCount),y=i&&i[d+1];y&&(g=g.replaceChild(0,y.type.create(y.attrs)));let _=i&&i[d]||f;if(!f.canReplace(m+1,f.childCount)||!_.type.validContent(g))return!1}let o=r.indexAfter(a),l=i&&i[0];return r.node(a).canReplaceWith(o,o,l?l.type:r.node(a+1).type)}function $1e(t,e,n=1,i){let r=t.doc.resolve(e),a=ht.empty,s=ht.empty;for(let o=r.depth,l=r.depth-n,c=n-1;o>l;o--,c--){a=ht.from(r.node(o).copy(a));let d=i&&i[c];s=ht.from(d?d.type.create(d.attrs,s):r.node(o).copy(s))}t.step(new Mr(e,e,new Mt(a.append(s),n,n),!0))}function ad(t,e){let n=t.resolve(e),i=n.index();return Z7(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(i,i+1)}function G1e(t,e){e.content.size||t.type.compatibleContent(e.type);let n=t.contentMatchAt(t.childCount),{linebreakReplacement:i}=t.type.schema;for(let r=0;r<e.childCount;r++){let a=e.child(r),s=a.type==i?t.type.schema.nodes.text:a.type;if(n=n.matchType(s),!n||!t.type.allowsMarks(a.marks))return!1}return n.validEnd}function Z7(t,e){return!!(t&&e&&!t.isLeaf&&G1e(t,e))}function tw(t,e,n=-1){let i=t.resolve(e);for(let r=i.depth;;r--){let a,s,o=i.index(r);if(r==i.depth?(a=i.nodeBefore,s=i.nodeAfter):n>0?(a=i.node(r+1),o++,s=i.node(r).maybeChild(o)):(a=i.node(r).maybeChild(o-1),s=i.node(r+1)),a&&!a.isTextblock&&Z7(a,s)&&i.node(r).canReplace(o,o+1))return e;if(r==0)break;e=n<0?i.before(r):i.after(r)}}function W1e(t,e,n){let i=null,{linebreakReplacement:r}=t.doc.type.schema,a=t.doc.resolve(e-n),s=a.node().type;if(r&&s.inlineContent){let d=s.whitespace=="pre",f=!!s.contentMatch.matchType(r);d&&!f?i=!1:!d&&f&&(i=!0)}let o=t.steps.length;if(i===!1){let d=t.doc.resolve(e+n);Y7(t,d.node(),d.before(),o)}s.inlineContent&&sD(t,e+n-1,s,a.node().contentMatchAt(a.index()),i==null);let l=t.mapping.slice(o),c=l.map(e-n);if(t.step(new Mr(c,l.map(e+n,-1),Mt.empty,!0)),i===!0){let d=t.doc.resolve(c);K7(t,d.node(),d.before(),t.steps.length)}return t}function q1e(t,e,n){let i=t.resolve(e);if(i.parent.canReplaceWith(i.index(),i.index(),n))return e;if(i.parentOffset==0)for(let r=i.depth-1;r>=0;r--){let a=i.index(r);if(i.node(r).canReplaceWith(a,a,n))return i.before(r+1);if(a>0)return null}if(i.parentOffset==i.parent.content.size)for(let r=i.depth-1;r>=0;r--){let a=i.indexAfter(r);if(i.node(r).canReplaceWith(a,a,n))return i.after(r+1);if(a<i.node(r).childCount)return null}return null}function Q7(t,e,n){let i=t.resolve(e);if(!n.content.size)return e;let r=n.content;for(let a=0;a<n.openStart;a++)r=r.firstChild.content;for(let a=1;a<=(n.openStart==0&&n.size?2:1);a++)for(let s=i.depth;s>=0;s--){let o=s==i.depth?0:i.pos<=(i.start(s+1)+i.end(s+1))/2?-1:1,l=i.index(s)+(o>0?1:0),c=i.node(s),d=!1;if(a==1)d=c.canReplace(l,l,r);else{let f=c.contentMatchAt(l).findWrapping(r.firstChild.type);d=f&&c.canReplaceWith(l,l,f[0])}if(d)return o==0?i.pos:o<0?i.before(s+1):i.after(s+1)}return null}function nw(t,e,n=e,i=Mt.empty){if(e==n&&!i.size)return null;let r=t.resolve(e),a=t.resolve(n);return J7(r,a,i)?new Mr(e,n,i):new X1e(r,a,i).fit()}function J7(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}class X1e{constructor(e,n,i){this.$from=e,this.$to=n,this.unplaced=i,this.frontier=[],this.placed=ht.empty;for(let r=0;r<=e.depth;r++){let a=e.node(r);this.frontier.push({type:a.type,match:a.contentMatchAt(e.indexAfter(r))})}for(let r=e.depth;r>0;r--)this.placed=ht.from(e.node(r).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let c=this.findFittable();c?this.placeNodes(c):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),n=this.placed.size-this.depth-this.$from.depth,i=this.$from,r=this.close(e<0?this.$to:i.doc.resolve(e));if(!r)return null;let a=this.placed,s=i.depth,o=r.depth;for(;s&&o&&a.childCount==1;)a=a.firstChild.content,s--,o--;let l=new Mt(a,s,o);return e>-1?new Ar(i.pos,e,this.$to.pos,this.$to.end(),l,n):l.size||i.pos!=this.$to.pos?new Mr(i.pos,r.pos,l):null}findFittable(){let e=this.unplaced.openStart;for(let n=this.unplaced.content,i=0,r=this.unplaced.openEnd;i<e;i++){let a=n.firstChild;if(n.childCount>1&&(r=0),a.type.spec.isolating&&r<=i){e=i;break}n=a.content}for(let n=1;n<=2;n++)for(let i=n==1?e:this.unplaced.openStart;i>=0;i--){let r,a=null;i?(a=qT(this.unplaced.content,i-1).firstChild,r=a.content):r=this.unplaced.content;let s=r.firstChild;for(let o=this.depth;o>=0;o--){let{type:l,match:c}=this.frontier[o],d,f=null;if(n==1&&(s?c.matchType(s.type)||(f=c.fillBefore(ht.from(s),!1)):a&&l.compatibleContent(a.type)))return{sliceDepth:i,frontierDepth:o,parent:a,inject:f};if(n==2&&s&&(d=c.findWrapping(s.type)))return{sliceDepth:i,frontierDepth:o,parent:a,wrap:d};if(a&&c.matchType(a.type))break}}}openMore(){let{content:e,openStart:n,openEnd:i}=this.unplaced,r=qT(e,n);return!r.childCount||r.firstChild.isLeaf?!1:(this.unplaced=new Mt(e,n+1,Math.max(i,r.size+n>=e.size-i?n+1:0)),!0)}dropNode(){let{content:e,openStart:n,openEnd:i}=this.unplaced,r=qT(e,n);if(r.childCount<=1&&n>0){let a=e.size-n<=n+r.size;this.unplaced=new Mt(e0(e,n-1,1),n-1,a?n-1:i)}else this.unplaced=new Mt(e0(e,n,1),n,i)}placeNodes({sliceDepth:e,frontierDepth:n,parent:i,inject:r,wrap:a}){for(;this.depth>n;)this.closeFrontierNode();if(a)for(let _=0;_<a.length;_++)this.openFrontierNode(a[_]);let s=this.unplaced,o=i?i.content:s.content,l=s.openStart-e,c=0,d=[],{match:f,type:m}=this.frontier[n];if(r){for(let _=0;_<r.childCount;_++)d.push(r.child(_));f=f.matchFragment(r)}let g=o.size+e-(s.content.size-s.openEnd);for(;c<o.childCount;){let _=o.child(c),v=f.matchType(_.type);if(!v)break;c++,(c>1||l==0||_.content.size)&&(f=v,d.push(eW(_.mark(m.allowedMarks(_.marks)),c==1?l:0,c==o.childCount?g:-1)))}let y=c==o.childCount;y||(g=-1),this.placed=t0(this.placed,n,ht.from(d)),this.frontier[n].match=f,y&&g<0&&i&&i.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let _=0,v=o;_<g;_++){let x=v.lastChild;this.frontier.push({type:x.type,match:x.contentMatchAt(x.childCount)}),v=x.content}this.unplaced=y?e==0?Mt.empty:new Mt(e0(s.content,e-1,1),e-1,g<0?s.openEnd:e-1):new Mt(e0(s.content,e,c),s.openStart,s.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],n;if(!e.type.isTextblock||!XT(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(n=this.findCloseLevel(this.$to))&&n.depth==this.depth)return-1;let{depth:i}=this.$to,r=this.$to.after(i);for(;i>1&&r==this.$to.end(--i);)++r;return r}findCloseLevel(e){e:for(let n=Math.min(this.depth,e.depth);n>=0;n--){let{match:i,type:r}=this.frontier[n],a=n<e.depth&&e.end(n+1)==e.pos+(e.depth-(n+1)),s=XT(e,n,r,i,a);if(s){for(let o=n-1;o>=0;o--){let{match:l,type:c}=this.frontier[o],d=XT(e,o,c,l,!0);if(!d||d.childCount)continue e}return{depth:n,fit:s,move:a?e.doc.resolve(e.after(n+1)):e}}}}close(e){let n=this.findCloseLevel(e);if(!n)return null;for(;this.depth>n.depth;)this.closeFrontierNode();n.fit.childCount&&(this.placed=t0(this.placed,n.depth,n.fit)),e=n.move;for(let i=n.depth+1;i<=e.depth;i++){let r=e.node(i),a=r.type.contentMatch.fillBefore(r.content,!0,e.index(i));this.openFrontierNode(r.type,r.attrs,a)}return e}openFrontierNode(e,n=null,i){let r=this.frontier[this.depth];r.match=r.match.matchType(e),this.placed=t0(this.placed,this.depth,ht.from(e.create(n,i))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(ht.empty,!0);n.childCount&&(this.placed=t0(this.placed,this.frontier.length,n))}}function e0(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(e0(t.firstChild.content,e-1,n)))}function t0(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(t0(t.lastChild.content,e-1,n)))}function qT(t,e){for(let n=0;n<e;n++)t=t.firstChild.content;return t}function eW(t,e,n){if(e<=0)return t;let i=t.content;return e>1&&(i=i.replaceChild(0,eW(i.firstChild,e-1,i.childCount==1?n-1:0))),e>0&&(i=t.type.contentMatch.fillBefore(i).append(i),n<=0&&(i=i.append(t.type.contentMatch.matchFragment(i).fillBefore(ht.empty,!0)))),t.copy(i)}function XT(t,e,n,i,r){let a=t.node(e),s=r?t.indexAfter(e):t.index(e);if(s==a.childCount&&!n.compatibleContent(a.type))return null;let o=i.fillBefore(a.content,!0,s);return o&&!K1e(n,a.content,s)?o:null}function K1e(t,e,n){for(let i=n;i<e.childCount;i++)if(!t.allowsMarks(e.child(i).marks))return!0;return!1}function Y1e(t){return t.spec.defining||t.spec.definingForContent}function Z1e(t,e,n,i){if(!i.size)return t.deleteRange(e,n);let r=t.doc.resolve(e),a=t.doc.resolve(n);if(J7(r,a,i))return t.step(new Mr(e,n,i));let s=nW(r,a);s[s.length-1]==0&&s.pop();let o=-(r.depth+1);s.unshift(o);for(let m=r.depth,g=r.pos-1;m>0;m--,g--){let y=r.node(m).type.spec;if(y.defining||y.definingAsContext||y.isolating)break;s.indexOf(m)>-1?o=m:r.before(m)==g&&s.splice(1,0,-m)}let l=s.indexOf(o),c=[],d=i.openStart;for(let m=i.content,g=0;;g++){let y=m.firstChild;if(c.push(y),g==i.openStart)break;m=y.content}for(let m=d-1;m>=0;m--){let g=c[m],y=Y1e(g.type);if(y&&!g.sameMarkup(r.node(Math.abs(o)-1)))d=m;else if(y||!g.type.isTextblock)break}for(let m=i.openStart;m>=0;m--){let g=(m+d+1)%(i.openStart+1),y=c[g];if(y)for(let _=0;_<s.length;_++){let v=s[(_+l)%s.length],x=!0;v<0&&(x=!1,v=-v);let M=r.node(v-1),w=r.index(v-1);if(M.canReplaceWith(w,w,y.type,y.marks))return t.replace(r.before(v),x?a.after(v):n,new Mt(tW(i.content,0,i.openStart,g),g,i.openEnd))}}let f=t.steps.length;for(let m=s.length-1;m>=0&&(t.replace(e,n,i),!(t.steps.length>f));m--){let g=s[m];g<0||(e=r.before(g),n=a.after(g))}}function tW(t,e,n,i,r){if(e<n){let a=t.firstChild;t=t.replaceChild(0,a.copy(tW(a.content,e+1,n,i,a)))}if(e>i){let a=r.contentMatchAt(0),s=a.fillBefore(t).append(t);t=s.append(a.matchFragment(s).fillBefore(ht.empty,!0))}return t}function Q1e(t,e,n,i){if(!i.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let r=q1e(t.doc,e,i.type);r!=null&&(e=n=r)}t.replaceRange(e,n,new Mt(ht.from(i),0,0))}function J1e(t,e,n){let i=t.doc.resolve(e),r=t.doc.resolve(n),a=nW(i,r);for(let s=0;s<a.length;s++){let o=a[s],l=s==a.length-1;if(l&&o==0||i.node(o).type.contentMatch.validEnd)return t.delete(i.start(o),r.end(o));if(o>0&&(l||i.node(o-1).canReplace(i.index(o-1),r.indexAfter(o-1))))return t.delete(i.before(o),r.after(o))}for(let s=1;s<=i.depth&&s<=r.depth;s++)if(e-i.start(s)==i.depth-s&&n>i.end(s)&&r.end(s)-n!=r.depth-s&&i.start(s-1)==r.start(s-1)&&i.node(s-1).canReplace(i.index(s-1),r.index(s-1)))return t.delete(i.before(s),n);t.delete(e,n)}function nW(t,e){let n=[],i=Math.min(t.depth,e.depth);for(let r=i;r>=0;r--){let a=t.start(r);if(a<t.pos-(t.depth-r)||e.end(r)>e.pos+(e.depth-r)||t.node(r).type.spec.isolating||e.node(r).type.spec.isolating)break;(a==e.start(r)||r==t.depth&&r==e.depth&&t.parent.inlineContent&&e.parent.inlineContent&&r&&e.start(r-1)==a-1)&&n.push(r)}return n}class Rp extends aa{constructor(e,n,i){super(),this.pos=e,this.attr=n,this.value=i}apply(e){let n=e.nodeAt(this.pos);if(!n)return $i.fail("No node at attribute step's position");let i=Object.create(null);for(let a in n.attrs)i[a]=n.attrs[a];i[this.attr]=this.value;let r=n.type.create(i,null,n.marks);return $i.fromReplace(e,this.pos,this.pos+1,new Mt(ht.from(r),0,n.isLeaf?0:1))}getMap(){return as.empty}invert(e){return new Rp(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Rp(n.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.pos!="number"||typeof n.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new Rp(n.pos,n.attr,n.value)}}aa.jsonID("attr",Rp);class J0 extends aa{constructor(e,n){super(),this.attr=e,this.value=n}apply(e){let n=Object.create(null);for(let r in e.attrs)n[r]=e.attrs[r];n[this.attr]=this.value;let i=e.type.create(n,e.content,e.marks);return $i.ok(i)}getMap(){return as.empty}invert(e){return new J0(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new J0(n.attr,n.value)}}aa.jsonID("docAttr",J0);let Wp=class extends Error{};Wp=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};Wp.prototype=Object.create(Error.prototype);Wp.prototype.constructor=Wp;Wp.prototype.name="TransformError";class iW{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new Q0}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let n=this.maybeStep(e);if(n.failed)throw new Wp(n.failed);return this}maybeStep(e){let n=e.apply(this.doc);return n.failed||this.addStep(e,n.doc),n}get docChanged(){return this.steps.length>0}addStep(e,n){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=n}replace(e,n=e,i=Mt.empty){let r=nw(this.doc,e,n,i);return r&&this.step(r),this}replaceWith(e,n,i){return this.replace(e,n,new Mt(ht.from(i),0,0))}delete(e,n){return this.replace(e,n,Mt.empty)}insert(e,n){return this.replaceWith(e,e,n)}replaceRange(e,n,i){return Z1e(this,e,n,i),this}replaceRangeWith(e,n,i){return Q1e(this,e,n,i),this}deleteRange(e,n){return J1e(this,e,n),this}lift(e,n){return U1e(this,e,n),this}join(e,n=1){return W1e(this,e,n),this}wrap(e,n){return z1e(this,e,n),this}setBlockType(e,n=e,i,r=null){return B1e(this,e,n,i,r),this}setNodeMarkup(e,n,i=null,r){return V1e(this,e,n,i,r),this}setNodeAttribute(e,n,i){return this.step(new Rp(e,n,i)),this}setDocAttribute(e,n){return this.step(new J0(e,n)),this}addNodeMark(e,n){return this.step(new Du(e,n)),this}removeNodeMark(e,n){let i=this.doc.nodeAt(e);if(!i)throw new RangeError("No node at position "+e);if(n instanceof Xn)n.isInSet(i.marks)&&this.step(new Nf(e,n));else{let r=i.marks,a,s=[];for(;a=n.isInSet(r);)s.push(new Nf(e,a)),r=a.removeFromSet(r);for(let o=s.length-1;o>=0;o--)this.step(s[o])}return this}split(e,n=1,i){return $1e(this,e,n,i),this}addMark(e,n,i){return O1e(this,e,n,i),this}removeMark(e,n,i){return L1e(this,e,n,i),this}clearIncompatible(e,n,i){return sD(this,e,n,i),this}}const KT=Object.create(null);class sn{constructor(e,n,i){this.$anchor=e,this.$head=n,this.ranges=i||[new eSe(e.min(n),e.max(n))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let n=0;n<e.length;n++)if(e[n].$from.pos!=e[n].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,n=Mt.empty){let i=n.content.lastChild,r=null;for(let o=0;o<n.openEnd;o++)r=i,i=i.lastChild;let a=e.steps.length,s=this.ranges;for(let o=0;o<s.length;o++){let{$from:l,$to:c}=s[o],d=e.mapping.slice(a);e.replaceRange(d.map(l.pos),d.map(c.pos),o?Mt.empty:n),o==0&&sB(e,a,(i?i.isInline:r&&r.isTextblock)?-1:1)}}replaceWith(e,n){let i=e.steps.length,r=this.ranges;for(let a=0;a<r.length;a++){let{$from:s,$to:o}=r[a],l=e.mapping.slice(i),c=l.map(s.pos),d=l.map(o.pos);a?e.deleteRange(c,d):(e.replaceRangeWith(c,d,n),sB(e,i,n.isInline?-1:1))}}static findFrom(e,n,i=!1){let r=e.parent.inlineContent?new Vt(e):dp(e.node(0),e.parent,e.pos,e.index(),n,i);if(r)return r;for(let a=e.depth-1;a>=0;a--){let s=n<0?dp(e.node(0),e.node(a),e.before(a+1),e.index(a),n,i):dp(e.node(0),e.node(a),e.after(a+1),e.index(a)+1,n,i);if(s)return s}return null}static near(e,n=1){return this.findFrom(e,n)||this.findFrom(e,-n)||new ds(e.node(0))}static atStart(e){return dp(e,e,0,0,1)||new ds(e)}static atEnd(e){return dp(e,e,e.content.size,e.childCount,-1)||new ds(e)}static fromJSON(e,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let i=KT[n.type];if(!i)throw new RangeError(`No selection type ${n.type} defined`);return i.fromJSON(e,n)}static jsonID(e,n){if(e in KT)throw new RangeError("Duplicate use of selection JSON ID "+e);return KT[e]=n,n.prototype.jsonID=e,n}getBookmark(){return Vt.between(this.$anchor,this.$head).getBookmark()}}sn.prototype.visible=!0;class eSe{constructor(e,n){this.$from=e,this.$to=n}}let rB=!1;function aB(t){!rB&&!t.parent.inlineContent&&(rB=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}class Vt extends sn{constructor(e,n=e){aB(e),aB(n),super(e,n)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,n){let i=e.resolve(n.map(this.head));if(!i.parent.inlineContent)return sn.near(i);let r=e.resolve(n.map(this.anchor));return new Vt(r.parent.inlineContent?r:i,i)}replace(e,n=Mt.empty){if(super.replace(e,n),n==Mt.empty){let i=this.$from.marksAcross(this.$to);i&&e.ensureMarks(i)}}eq(e){return e instanceof Vt&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new iw(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,n){if(typeof n.anchor!="number"||typeof n.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new Vt(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,i=n){let r=e.resolve(n);return new this(r,i==n?r:e.resolve(i))}static between(e,n,i){let r=e.pos-n.pos;if((!i||r)&&(i=r>=0?1:-1),!n.parent.inlineContent){let a=sn.findFrom(n,i,!0)||sn.findFrom(n,-i,!0);if(a)n=a.$head;else return sn.near(n,i)}return e.parent.inlineContent||(r==0?e=n:(e=(sn.findFrom(e,-i,!0)||sn.findFrom(e,i,!0)).$anchor,e.pos<n.pos!=r<0&&(e=n))),new Vt(e,n)}}sn.jsonID("text",Vt);class iw{constructor(e,n){this.anchor=e,this.head=n}map(e){return new iw(e.map(this.anchor),e.map(this.head))}resolve(e){return Vt.between(e.resolve(this.anchor),e.resolve(this.head))}}class Ft extends sn{constructor(e){let n=e.nodeAfter,i=e.node(0).resolve(e.pos+n.nodeSize);super(e,i),this.node=n}map(e,n){let{deleted:i,pos:r}=n.mapResult(this.anchor),a=e.resolve(r);return i?sn.near(a):new Ft(a)}content(){return new Mt(ht.from(this.node),0,0)}eq(e){return e instanceof Ft&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new lD(this.anchor)}static fromJSON(e,n){if(typeof n.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new Ft(e.resolve(n.anchor))}static create(e,n){return new Ft(e.resolve(n))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}Ft.prototype.visible=!1;sn.jsonID("node",Ft);class lD{constructor(e){this.anchor=e}map(e){let{deleted:n,pos:i}=e.mapResult(this.anchor);return n?new iw(i,i):new lD(i)}resolve(e){let n=e.resolve(this.anchor),i=n.nodeAfter;return i&&Ft.isSelectable(i)?new Ft(n):sn.near(n)}}class ds extends sn{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,n=Mt.empty){if(n==Mt.empty){e.delete(0,e.doc.content.size);let i=sn.atStart(e.doc);i.eq(e.selection)||e.setSelection(i)}else super.replace(e,n)}toJSON(){return{type:"all"}}static fromJSON(e){return new ds(e)}map(e){return new ds(e)}eq(e){return e instanceof ds}getBookmark(){return tSe}}sn.jsonID("all",ds);const tSe={map(){return this},resolve(t){return new ds(t)}};function dp(t,e,n,i,r,a=!1){if(e.inlineContent)return Vt.create(t,n);for(let s=i-(r>0?0:1);r>0?s<e.childCount:s>=0;s+=r){let o=e.child(s);if(o.isAtom){if(!a&&Ft.isSelectable(o))return Ft.create(t,n-(r<0?o.nodeSize:0))}else{let l=dp(t,o,n+r,r<0?o.childCount:0,r,a);if(l)return l}n+=o.nodeSize*r}return null}function sB(t,e,n){let i=t.steps.length-1;if(i<e)return;let r=t.steps[i];if(!(r instanceof Mr||r instanceof Ar))return;let a=t.mapping.maps[i],s;a.forEach((o,l,c,d)=>{s==null&&(s=d)}),t.setSelection(sn.near(t.doc.resolve(s),n))}const oB=1,Nb=2,lB=4;class nSe extends iW{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.storedMarks}get selection(){return this.curSelectionFor<this.steps.length&&(this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor)),this.curSelectionFor=this.steps.length),this.curSelection}setSelection(e){if(e.$from.doc!=this.doc)throw new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=e,this.curSelectionFor=this.steps.length,this.updated=(this.updated|oB)&~Nb,this.storedMarks=null,this}get selectionSet(){return(this.updated&oB)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=Nb,this}ensureMarks(e){return Xn.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&Nb)>0}addStep(e,n){super.addStep(e,n),this.updated=this.updated&~Nb,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,n=!0){let i=this.selection;return n&&(e=e.mark(this.storedMarks||(i.empty?i.$from.marks():i.$from.marksAcross(i.$to)||Xn.none))),i.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,n,i){let r=this.doc.type.schema;if(n==null)return e?this.replaceSelectionWith(r.text(e),!0):this.deleteSelection();{if(i==null&&(i=n),!e)return this.deleteRange(n,i);let a=this.storedMarks;if(!a){let s=this.doc.resolve(n);a=i==n?s.marks():s.marksAcross(this.doc.resolve(i))}return this.replaceRangeWith(n,i,r.text(e,a)),!this.selection.empty&&this.selection.to==n+e.length&&this.setSelection(sn.near(this.selection.$to)),this}}setMeta(e,n){return this.meta[typeof e=="string"?e:e.key]=n,this}getMeta(e){return this.meta[typeof e=="string"?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=lB,this}get scrolledIntoView(){return(this.updated&lB)>0}}function cB(t,e){return!e||!t?t:t.bind(e)}class n0{constructor(e,n,i){this.name=e,this.init=cB(n.init,i),this.apply=cB(n.apply,i)}}const iSe=[new n0("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new n0("selection",{init(t,e){return t.selection||sn.atStart(e.doc)},apply(t){return t.selection}}),new n0("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,i){return i.selection.$cursor?t.storedMarks:null}}),new n0("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})];class YT{constructor(e,n){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=iSe.slice(),n&&n.forEach(i=>{if(this.pluginsByKey[i.key])throw new RangeError("Adding different instances of a keyed plugin ("+i.key+")");this.plugins.push(i),this.pluginsByKey[i.key]=i,i.spec.state&&this.fields.push(new n0(i.key,i.spec.state,i))})}}class yp{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,n=-1){for(let i=0;i<this.config.plugins.length;i++)if(i!=n){let r=this.config.plugins[i];if(r.spec.filterTransaction&&!r.spec.filterTransaction.call(r,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let n=[e],i=this.applyInner(e),r=null;for(;;){let a=!1;for(let s=0;s<this.config.plugins.length;s++){let o=this.config.plugins[s];if(o.spec.appendTransaction){let l=r?r[s].n:0,c=r?r[s].state:this,d=l<n.length&&o.spec.appendTransaction.call(o,l?n.slice(l):n,c,i);if(d&&i.filterTransaction(d,s)){if(d.setMeta("appendedTransaction",e),!r){r=[];for(let f=0;f<this.config.plugins.length;f++)r.push(f<s?{state:i,n:n.length}:{state:this,n:0})}n.push(d),i=i.applyInner(d),a=!0}r&&(r[s]={state:i,n:n.length})}}if(!a)return{state:i,transactions:n}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let n=new yp(this.config),i=this.config.fields;for(let r=0;r<i.length;r++){let a=i[r];n[a.name]=a.apply(e,this[a.name],this,n)}return n}get tr(){return new nSe(this)}static create(e){let n=new YT(e.doc?e.doc.type.schema:e.schema,e.plugins),i=new yp(n);for(let r=0;r<n.fields.length;r++)i[n.fields[r].name]=n.fields[r].init(e,i);return i}reconfigure(e){let n=new YT(this.schema,e.plugins),i=n.fields,r=new yp(n);for(let a=0;a<i.length;a++){let s=i[a].name;r[s]=this.hasOwnProperty(s)?this[s]:i[a].init(e,r)}return r}toJSON(e){let n={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(n.storedMarks=this.storedMarks.map(i=>i.toJSON())),e&&typeof e=="object")for(let i in e){if(i=="doc"||i=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let r=e[i],a=r.spec.state;a&&a.toJSON&&(n[i]=a.toJSON.call(r,this[r.key]))}return n}static fromJSON(e,n,i){if(!n)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let r=new YT(e.schema,e.plugins),a=new yp(r);return r.fields.forEach(s=>{if(s.name=="doc")a.doc=Fu.fromJSON(e.schema,n.doc);else if(s.name=="selection")a.selection=sn.fromJSON(a.doc,n.selection);else if(s.name=="storedMarks")n.storedMarks&&(a.storedMarks=n.storedMarks.map(e.schema.markFromJSON));else{if(i)for(let o in i){let l=i[o],c=l.spec.state;if(l.key==s.name&&c&&c.fromJSON&&Object.prototype.hasOwnProperty.call(n,o)){a[s.name]=c.fromJSON.call(l,e,n[o],a);return}}a[s.name]=s.init(e,a)}}),a}}function rW(t,e,n){for(let i in t){let r=t[i];r instanceof Function?r=r.bind(e):i=="handleDOMEvents"&&(r=rW(r,e,{})),n[i]=r}return n}class xi{constructor(e){this.spec=e,this.props={},e.props&&rW(e.props,this,this.props),this.key=e.key?e.key.key:aW("plugin")}getState(e){return e[this.key]}}const ZT=Object.create(null);function aW(t){return t in ZT?t+"$"+ ++ZT[t]:(ZT[t]=0,t+"$")}class lr{constructor(e="key"){this.key=aW(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const cD=(t,e)=>t.selection.empty?!1:(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function sW(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}const oW=(t,e,n)=>{let i=sW(t,n);if(!i)return!1;let r=uD(i);if(!r){let s=i.blockRange(),o=s&&vm(s);return o==null?!1:(e&&e(t.tr.lift(s,o).scrollIntoView()),!0)}let a=r.nodeBefore;if(gW(t,r,e,-1))return!0;if(i.parent.content.size==0&&(qp(a,"end")||Ft.isSelectable(a)))for(let s=i.depth;;s--){let o=nw(t.doc,i.before(s),i.after(s),Mt.empty);if(o&&o.slice.size<o.to-o.from){if(e){let l=t.tr.step(o);l.setSelection(qp(a,"end")?sn.findFrom(l.doc.resolve(l.mapping.map(r.pos,-1)),-1):Ft.create(l.doc,r.pos-a.nodeSize)),e(l.scrollIntoView())}return!0}if(s==1||i.node(s-1).childCount>1)break}return a.isAtom&&r.depth==i.depth-1?(e&&e(t.tr.delete(r.pos-a.nodeSize,r.pos).scrollIntoView()),!0):!1},rSe=(t,e,n)=>{let i=sW(t,n);if(!i)return!1;let r=uD(i);return r?lW(t,r,e):!1},aSe=(t,e,n)=>{let i=uW(t,n);if(!i)return!1;let r=dD(i);return r?lW(t,r,e):!1};function lW(t,e,n){let i=e.nodeBefore,r=i,a=e.pos-1;for(;!r.isTextblock;a--){if(r.type.spec.isolating)return!1;let d=r.lastChild;if(!d)return!1;r=d}let s=e.nodeAfter,o=s,l=e.pos+1;for(;!o.isTextblock;l++){if(o.type.spec.isolating)return!1;let d=o.firstChild;if(!d)return!1;o=d}let c=nw(t.doc,a,l,Mt.empty);if(!c||c.from!=a||c instanceof Mr&&c.slice.size>=l-a)return!1;if(n){let d=t.tr.step(c);d.setSelection(Vt.create(d.doc,a)),n(d.scrollIntoView())}return!0}function qp(t,e,n=!1){for(let i=t;i;i=e=="start"?i.firstChild:i.lastChild){if(i.isTextblock)return!0;if(n&&i.childCount!=1)return!1}return!1}const cW=(t,e,n)=>{let{$head:i,empty:r}=t.selection,a=i;if(!r)return!1;if(i.parent.isTextblock){if(n?!n.endOfTextblock("backward",t):i.parentOffset>0)return!1;a=uD(i)}let s=a&&a.nodeBefore;return!s||!Ft.isSelectable(s)?!1:(e&&e(t.tr.setSelection(Ft.create(t.doc,a.pos-s.nodeSize)).scrollIntoView()),!0)};function uD(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){if(t.index(e)>0)return t.doc.resolve(t.before(e+1));if(t.node(e).type.spec.isolating)break}return null}function uW(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("forward",t):n.parentOffset<n.parent.content.size)?null:n}const dW=(t,e,n)=>{let i=uW(t,n);if(!i)return!1;let r=dD(i);if(!r)return!1;let a=r.nodeAfter;if(gW(t,r,e,1))return!0;if(i.parent.content.size==0&&(qp(a,"start")||Ft.isSelectable(a))){let s=nw(t.doc,i.before(),i.after(),Mt.empty);if(s&&s.slice.size<s.to-s.from){if(e){let o=t.tr.step(s);o.setSelection(qp(a,"start")?sn.findFrom(o.doc.resolve(o.mapping.map(r.pos)),1):Ft.create(o.doc,o.mapping.map(r.pos))),e(o.scrollIntoView())}return!0}}return a.isAtom&&r.depth==i.depth-1?(e&&e(t.tr.delete(r.pos,r.pos+a.nodeSize).scrollIntoView()),!0):!1},fW=(t,e,n)=>{let{$head:i,empty:r}=t.selection,a=i;if(!r)return!1;if(i.parent.isTextblock){if(n?!n.endOfTextblock("forward",t):i.parentOffset<i.parent.content.size)return!1;a=dD(i)}let s=a&&a.nodeAfter;return!s||!Ft.isSelectable(s)?!1:(e&&e(t.tr.setSelection(Ft.create(t.doc,a.pos)).scrollIntoView()),!0)};function dD(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){let n=t.node(e);if(t.index(e)+1<n.childCount)return t.doc.resolve(t.after(e+1));if(n.type.spec.isolating)break}return null}const sSe=(t,e)=>{let n=t.selection,i=n instanceof Ft,r;if(i){if(n.node.isTextblock||!ad(t.doc,n.from))return!1;r=n.from}else if(r=tw(t.doc,n.from,-1),r==null)return!1;if(e){let a=t.tr.join(r);i&&a.setSelection(Ft.create(a.doc,r-t.doc.resolve(r).nodeBefore.nodeSize)),e(a.scrollIntoView())}return!0},oSe=(t,e)=>{let n=t.selection,i;if(n instanceof Ft){if(n.node.isTextblock||!ad(t.doc,n.to))return!1;i=n.to}else if(i=tw(t.doc,n.to,1),i==null)return!1;return e&&e(t.tr.join(i).scrollIntoView()),!0},lSe=(t,e)=>{let{$from:n,$to:i}=t.selection,r=n.blockRange(i),a=r&&vm(r);return a==null?!1:(e&&e(t.tr.lift(r,a).scrollIntoView()),!0)},hW=(t,e)=>{let{$head:n,$anchor:i}=t.selection;return!n.parent.type.spec.code||!n.sameParent(i)?!1:(e&&e(t.tr.insertText(`
  8064. `).scrollIntoView()),!0)};function fD(t){for(let e=0;e<t.edgeCount;e++){let{type:n}=t.edge(e);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}const cSe=(t,e)=>{let{$head:n,$anchor:i}=t.selection;if(!n.parent.type.spec.code||!n.sameParent(i))return!1;let r=n.node(-1),a=n.indexAfter(-1),s=fD(r.contentMatchAt(a));if(!s||!r.canReplaceWith(a,a,s))return!1;if(e){let o=n.after(),l=t.tr.replaceWith(o,o,s.createAndFill());l.setSelection(sn.near(l.doc.resolve(o),1)),e(l.scrollIntoView())}return!0},pW=(t,e)=>{let n=t.selection,{$from:i,$to:r}=n;if(n instanceof ds||i.parent.inlineContent||r.parent.inlineContent)return!1;let a=fD(r.parent.contentMatchAt(r.indexAfter()));if(!a||!a.isTextblock)return!1;if(e){let s=(!i.parentOffset&&r.index()<r.parent.childCount?i:r).pos,o=t.tr.insert(s,a.createAndFill());o.setSelection(Vt.create(o.doc,s+1)),e(o.scrollIntoView())}return!0},mW=(t,e)=>{let{$cursor:n}=t.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let a=n.before();if(ac(t.doc,a))return e&&e(t.tr.split(a).scrollIntoView()),!0}let i=n.blockRange(),r=i&&vm(i);return r==null?!1:(e&&e(t.tr.lift(i,r).scrollIntoView()),!0)};function uSe(t){return(e,n)=>{let{$from:i,$to:r}=e.selection;if(e.selection instanceof Ft&&e.selection.node.isBlock)return!i.parentOffset||!ac(e.doc,i.pos)?!1:(n&&n(e.tr.split(i.pos).scrollIntoView()),!0);if(!i.depth)return!1;let a=[],s,o,l=!1,c=!1;for(let g=i.depth;;g--)if(i.node(g).isBlock){l=i.end(g)==i.pos+(i.depth-g),c=i.start(g)==i.pos-(i.depth-g),o=fD(i.node(g-1).contentMatchAt(i.indexAfter(g-1))),a.unshift(l&&o?{type:o}:null),s=g;break}else{if(g==1)return!1;a.unshift(null)}let d=e.tr;(e.selection instanceof Vt||e.selection instanceof ds)&&d.deleteSelection();let f=d.mapping.map(i.pos),m=ac(d.doc,f,a.length,a);if(m||(a[0]=o?{type:o}:null,m=ac(d.doc,f,a.length,a)),!m)return!1;if(d.split(f,a.length,a),!l&&c&&i.node(s).type!=o){let g=d.mapping.map(i.before(s)),y=d.doc.resolve(g);o&&i.node(s-1).canReplaceWith(y.index(),y.index()+1,o)&&d.setNodeMarkup(d.mapping.map(i.before(s)),o)}return n&&n(d.scrollIntoView()),!0}}const dSe=uSe(),fSe=(t,e)=>{let{$from:n,to:i}=t.selection,r,a=n.sharedDepth(i);return a==0?!1:(r=n.before(a),e&&e(t.tr.setSelection(Ft.create(t.doc,r))),!0)};function hSe(t,e,n){let i=e.nodeBefore,r=e.nodeAfter,a=e.index();return!i||!r||!i.type.compatibleContent(r.type)?!1:!i.content.size&&e.parent.canReplace(a-1,a)?(n&&n(t.tr.delete(e.pos-i.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(a,a+1)||!(r.isTextblock||ad(t.doc,e.pos))?!1:(n&&n(t.tr.join(e.pos).scrollIntoView()),!0)}function gW(t,e,n,i){let r=e.nodeBefore,a=e.nodeAfter,s,o,l=r.type.spec.isolating||a.type.spec.isolating;if(!l&&hSe(t,e,n))return!0;let c=!l&&e.parent.canReplace(e.index(),e.index()+1);if(c&&(s=(o=r.contentMatchAt(r.childCount)).findWrapping(a.type))&&o.matchType(s[0]||a.type).validEnd){if(n){let g=e.pos+a.nodeSize,y=ht.empty;for(let x=s.length-1;x>=0;x--)y=ht.from(s[x].create(null,y));y=ht.from(r.copy(y));let _=t.tr.step(new Ar(e.pos-1,g,e.pos,g,new Mt(y,1,0),s.length,!0)),v=_.doc.resolve(g+2*s.length);v.nodeAfter&&v.nodeAfter.type==r.type&&ad(_.doc,v.pos)&&_.join(v.pos),n(_.scrollIntoView())}return!0}let d=a.type.spec.isolating||i>0&&l?null:sn.findFrom(e,1),f=d&&d.$from.blockRange(d.$to),m=f&&vm(f);if(m!=null&&m>=e.depth)return n&&n(t.tr.lift(f,m).scrollIntoView()),!0;if(c&&qp(a,"start",!0)&&qp(r,"end")){let g=r,y=[];for(;y.push(g),!g.isTextblock;)g=g.lastChild;let _=a,v=1;for(;!_.isTextblock;_=_.firstChild)v++;if(g.canReplace(g.childCount,g.childCount,_.content)){if(n){let x=ht.empty;for(let w=y.length-1;w>=0;w--)x=ht.from(y[w].copy(x));let M=t.tr.step(new Ar(e.pos-y.length,e.pos+a.nodeSize,e.pos+v,e.pos+a.nodeSize-v,new Mt(x,y.length,0),0,!0));n(M.scrollIntoView())}return!0}}return!1}function xW(t){return function(e,n){let i=e.selection,r=t<0?i.$from:i.$to,a=r.depth;for(;r.node(a).isInline;){if(!a)return!1;a--}return r.node(a).isTextblock?(n&&n(e.tr.setSelection(Vt.create(e.doc,t<0?r.start(a):r.end(a)))),!0):!1}}const pSe=xW(-1),mSe=xW(1);function gSe(t,e=null){return function(n,i){let{$from:r,$to:a}=n.selection,s=r.blockRange(a),o=s&&oD(s,t,e);return o?(i&&i(n.tr.wrap(s,o).scrollIntoView()),!0):!1}}function uB(t,e=null){return function(n,i){let r=!1;for(let a=0;a<n.selection.ranges.length&&!r;a++){let{$from:{pos:s},$to:{pos:o}}=n.selection.ranges[a];n.doc.nodesBetween(s,o,(l,c)=>{if(r)return!1;if(!(!l.isTextblock||l.hasMarkup(t,e)))if(l.type==t)r=!0;else{let d=n.doc.resolve(c),f=d.index();r=d.parent.canReplaceWith(f,f+1,t)}})}if(!r)return!1;if(i){let a=n.tr;for(let s=0;s<n.selection.ranges.length;s++){let{$from:{pos:o},$to:{pos:l}}=n.selection.ranges[s];a.setBlockType(o,l,t,e)}i(a.scrollIntoView())}return!0}}function hD(...t){return function(e,n,i){for(let r=0;r<t.length;r++)if(t[r](e,n,i))return!0;return!1}}hD(cD,oW,cW);hD(cD,dW,fW);hD(hW,pW,mW,dSe);typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function xSe(t,e=null){return function(n,i){let{$from:r,$to:a}=n.selection,s=r.blockRange(a);if(!s)return!1;let o=i?n.tr:null;return vSe(o,s,t,e)?(i&&i(o.scrollIntoView()),!0):!1}}function vSe(t,e,n,i=null){let r=!1,a=e,s=e.$from.doc;if(e.depth>=2&&e.$from.node(e.depth-1).type.compatibleContent(n)&&e.startIndex==0){if(e.$from.index(e.depth-1)==0)return!1;let l=s.resolve(e.start-2);a=new t1(l,l,e.depth),e.endIndex<e.parent.childCount&&(e=new t1(e.$from,s.resolve(e.$to.end(e.depth)),e.depth)),r=!0}let o=oD(a,n,i,e);return o?(t&&ySe(t,e,o,r,n),!0):!1}function ySe(t,e,n,i,r){let a=ht.empty;for(let d=n.length-1;d>=0;d--)a=ht.from(n[d].type.create(n[d].attrs,a));t.step(new Ar(e.start-(i?2:0),e.end,e.start,e.end,new Mt(a,0,0),n.length,!0));let s=0;for(let d=0;d<n.length;d++)n[d].type==r&&(s=d+1);let o=n.length-s,l=e.start+n.length-(i?2:0),c=e.parent;for(let d=e.startIndex,f=e.endIndex,m=!0;d<f;d++,m=!1)!m&&ac(t.doc,l,o)&&(t.split(l,o),l+=2*o),l+=c.child(d).nodeSize;return t}function bSe(t){return function(e,n){let{$from:i,$to:r}=e.selection,a=i.blockRange(r,s=>s.childCount>0&&s.firstChild.type==t);return a?n?i.node(a.depth-1).type==t?_Se(e,n,t,a):SSe(e,n,a):!0:!1}}function _Se(t,e,n,i){let r=t.tr,a=i.end,s=i.$to.end(i.depth);a<s&&(r.step(new Ar(a-1,s,a,s,new Mt(ht.from(n.create(null,i.parent.copy())),1,0),1,!0)),i=new t1(r.doc.resolve(i.$from.pos),r.doc.resolve(s),i.depth));const o=vm(i);if(o==null)return!1;r.lift(i,o);let l=r.doc.resolve(r.mapping.map(a,-1)-1);return ad(r.doc,l.pos)&&l.nodeBefore.type==l.nodeAfter.type&&r.join(l.pos),e(r.scrollIntoView()),!0}function SSe(t,e,n){let i=t.tr,r=n.parent;for(let g=n.end,y=n.endIndex-1,_=n.startIndex;y>_;y--)g-=r.child(y).nodeSize,i.delete(g-1,g+1);let a=i.doc.resolve(n.start),s=a.nodeAfter;if(i.mapping.map(n.end)!=n.start+a.nodeAfter.nodeSize)return!1;let o=n.startIndex==0,l=n.endIndex==r.childCount,c=a.node(-1),d=a.index(-1);if(!c.canReplace(d+(o?0:1),d+1,s.content.append(l?ht.empty:ht.from(r))))return!1;let f=a.pos,m=f+s.nodeSize;return i.step(new Ar(f-(o?1:0),m+(l?1:0),f+1,m-1,new Mt((o?ht.empty:ht.from(r.copy(ht.empty))).append(l?ht.empty:ht.from(r.copy(ht.empty))),o?0:1,l?0:1),o?0:1)),e(i.scrollIntoView()),!0}function wSe(t){return function(e,n){let{$from:i,$to:r}=e.selection,a=i.blockRange(r,c=>c.childCount>0&&c.firstChild.type==t);if(!a)return!1;let s=a.startIndex;if(s==0)return!1;let o=a.parent,l=o.child(s-1);if(l.type!=t)return!1;if(n){let c=l.lastChild&&l.lastChild.type==o.type,d=ht.from(c?t.create():null),f=new Mt(ht.from(t.create(null,ht.from(o.type.create(null,d)))),c?3:1,0),m=a.start,g=a.end;n(e.tr.step(new Ar(m-(c?3:1),g,m,g,f,1,!0)).scrollIntoView())}return!0}}const Vr=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},Xp=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e};let k3=null;const Vl=function(t,e,n){let i=k3||(k3=document.createRange());return i.setEnd(t,n??t.nodeValue.length),i.setStart(t,e||0),i},MSe=function(){k3=null},Rf=function(t,e,n,i){return n&&(dB(t,e,n,i,-1)||dB(t,e,n,i,1))},ESe=/^(img|br|input|textarea|hr)$/i;function dB(t,e,n,i,r){for(var a;;){if(t==n&&e==i)return!0;if(e==(r<0?0:Fs(t))){let s=t.parentNode;if(!s||s.nodeType!=1||Lx(t)||ESe.test(t.nodeName)||t.contentEditable=="false")return!1;e=Vr(t)+(r<0?0:1),t=s}else if(t.nodeType==1){let s=t.childNodes[e+(r<0?-1:0)];if(s.nodeType==1&&s.contentEditable=="false")if(!((a=s.pmViewDesc)===null||a===void 0)&&a.ignoreForSelection)e+=r;else return!1;else t=s,e=r<0?Fs(t):0}else return!1}}function Fs(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function ASe(t,e){for(;;){if(t.nodeType==3&&e)return t;if(t.nodeType==1&&e>0){if(t.contentEditable=="false")return null;t=t.childNodes[e-1],e=Fs(t)}else if(t.parentNode&&!Lx(t))e=Vr(t),t=t.parentNode;else return null}}function TSe(t,e){for(;;){if(t.nodeType==3&&e<t.nodeValue.length)return t;if(t.nodeType==1&&e<t.childNodes.length){if(t.contentEditable=="false")return null;t=t.childNodes[e],e=0}else if(t.parentNode&&!Lx(t))e=Vr(t)+1,t=t.parentNode;else return null}}function CSe(t,e,n){for(let i=e==0,r=e==Fs(t);i||r;){if(t==n)return!0;let a=Vr(t);if(t=t.parentNode,!t)return!1;i=i&&a==0,r=r&&a==Fs(t)}}function Lx(t){let e;for(let n=t;n&&!(e=n.pmViewDesc);n=n.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==t||e.contentDOM==t)}const rw=function(t){return t.focusNode&&Rf(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)};function Xd(t,e){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=t,n.key=n.code=e,n}function NSe(t){let e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function RSe(t,e,n){if(t.caretPositionFromPoint)try{let i=t.caretPositionFromPoint(e,n);if(i)return{node:i.offsetNode,offset:Math.min(Fs(i.offsetNode),i.offset)}}catch{}if(t.caretRangeFromPoint){let i=t.caretRangeFromPoint(e,n);if(i)return{node:i.startContainer,offset:Math.min(Fs(i.startContainer),i.startOffset)}}}const el=typeof navigator<"u"?navigator:null,fB=typeof document<"u"?document:null,sd=el&&el.userAgent||"",O3=/Edge\/(\d+)/.exec(sd),vW=/MSIE \d/.exec(sd),L3=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(sd),Fa=!!(vW||L3||O3),zu=vW?document.documentMode:L3?+L3[1]:O3?+O3[1]:0,$s=!Fa&&/gecko\/(\d+)/i.test(sd);$s&&+(/Firefox\/(\d+)/.exec(sd)||[0,0])[1];const I3=!Fa&&/Chrome\/(\d+)/.exec(sd),ta=!!I3,yW=I3?+I3[1]:0,va=!Fa&&!!el&&/Apple Computer/.test(el.vendor),Kp=va&&(/Mobile\/\w+/.test(sd)||!!el&&el.maxTouchPoints>2),ks=Kp||(el?/Mac/.test(el.platform):!1),PSe=el?/Win/.test(el.platform):!1,Ql=/Android \d/.test(sd),Ix=!!fB&&"webkitFontSmoothing"in fB.documentElement.style,DSe=Ix?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function kSe(t){let e=t.defaultView&&t.defaultView.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:t.documentElement.clientWidth,top:0,bottom:t.documentElement.clientHeight}}function Ul(t,e){return typeof t=="number"?t:t[e]}function OSe(t){let e=t.getBoundingClientRect(),n=e.width/t.offsetWidth||1,i=e.height/t.offsetHeight||1;return{left:e.left,right:e.left+t.clientWidth*n,top:e.top,bottom:e.top+t.clientHeight*i}}function hB(t,e,n){let i=t.someProp("scrollThreshold")||0,r=t.someProp("scrollMargin")||5,a=t.dom.ownerDocument;for(let s=n||t.dom;s;){if(s.nodeType!=1){s=Xp(s);continue}let o=s,l=o==a.body,c=l?kSe(a):OSe(o),d=0,f=0;if(e.top<c.top+Ul(i,"top")?f=-(c.top-e.top+Ul(r,"top")):e.bottom>c.bottom-Ul(i,"bottom")&&(f=e.bottom-e.top>c.bottom-c.top?e.top+Ul(r,"top")-c.top:e.bottom-c.bottom+Ul(r,"bottom")),e.left<c.left+Ul(i,"left")?d=-(c.left-e.left+Ul(r,"left")):e.right>c.right-Ul(i,"right")&&(d=e.right-c.right+Ul(r,"right")),d||f)if(l)a.defaultView.scrollBy(d,f);else{let g=o.scrollLeft,y=o.scrollTop;f&&(o.scrollTop+=f),d&&(o.scrollLeft+=d);let _=o.scrollLeft-g,v=o.scrollTop-y;e={left:e.left-_,top:e.top-v,right:e.right-_,bottom:e.bottom-v}}let m=l?"fixed":getComputedStyle(s).position;if(/^(fixed|sticky)$/.test(m))break;s=m=="absolute"?s.offsetParent:Xp(s)}}function LSe(t){let e=t.dom.getBoundingClientRect(),n=Math.max(0,e.top),i,r;for(let a=(e.left+e.right)/2,s=n+1;s<Math.min(innerHeight,e.bottom);s+=5){let o=t.root.elementFromPoint(a,s);if(!o||o==t.dom||!t.dom.contains(o))continue;let l=o.getBoundingClientRect();if(l.top>=n-20){i=o,r=l.top;break}}return{refDOM:i,refTop:r,stack:bW(t.dom)}}function bW(t){let e=[],n=t.ownerDocument;for(let i=t;i&&(e.push({dom:i,top:i.scrollTop,left:i.scrollLeft}),t!=n);i=Xp(i));return e}function ISe({refDOM:t,refTop:e,stack:n}){let i=t?t.getBoundingClientRect().top:0;_W(n,i==0?0:i-e)}function _W(t,e){for(let n=0;n<t.length;n++){let{dom:i,top:r,left:a}=t[n];i.scrollTop!=r+e&&(i.scrollTop=r+e),i.scrollLeft!=a&&(i.scrollLeft=a)}}let ap=null;function USe(t){if(t.setActive)return t.setActive();if(ap)return t.focus(ap);let e=bW(t);t.focus(ap==null?{get preventScroll(){return ap={preventScroll:!0},!0}}:void 0),ap||(ap=!1,_W(e,0))}function SW(t,e){let n,i=2e8,r,a=0,s=e.top,o=e.top,l,c;for(let d=t.firstChild,f=0;d;d=d.nextSibling,f++){let m;if(d.nodeType==1)m=d.getClientRects();else if(d.nodeType==3)m=Vl(d).getClientRects();else continue;for(let g=0;g<m.length;g++){let y=m[g];if(y.top<=s&&y.bottom>=o){s=Math.max(y.bottom,s),o=Math.min(y.top,o);let _=y.left>e.left?y.left-e.left:y.right<e.left?e.left-y.right:0;if(_<i){n=d,i=_,r=_&&n.nodeType==3?{left:y.right<e.left?y.right:y.left,top:e.top}:e,d.nodeType==1&&_&&(a=f+(e.left>=(y.left+y.right)/2?1:0));continue}}else y.top>e.top&&!l&&y.left<=e.left&&y.right>=e.left&&(l=d,c={left:Math.max(y.left,Math.min(y.right,e.left)),top:y.top});!n&&(e.left>=y.right&&e.top>=y.top||e.left>=y.left&&e.top>=y.bottom)&&(a=f+1)}}return!n&&l&&(n=l,r=c,i=0),n&&n.nodeType==3?jSe(n,r):!n||i&&n.nodeType==1?{node:t,offset:a}:SW(n,r)}function jSe(t,e){let n=t.nodeValue.length,i=document.createRange();for(let r=0;r<n;r++){i.setEnd(t,r+1),i.setStart(t,r);let a=mu(i,1);if(a.top!=a.bottom&&pD(e,a))return{node:t,offset:r+(e.left>=(a.left+a.right)/2?1:0)}}return{node:t,offset:0}}function pD(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function FSe(t,e){let n=t.parentNode;return n&&/^li$/i.test(n.nodeName)&&e.left<t.getBoundingClientRect().left?n:t}function zSe(t,e,n){let{node:i,offset:r}=SW(e,n),a=-1;if(i.nodeType==1&&!i.firstChild){let s=i.getBoundingClientRect();a=s.left!=s.right&&n.left>(s.left+s.right)/2?1:-1}return t.docView.posFromDOM(i,r,a)}function BSe(t,e,n,i){let r=-1;for(let a=e,s=!1;a!=t.dom;){let o=t.docView.nearestDesc(a,!0),l;if(!o)return null;if(o.dom.nodeType==1&&(o.node.isBlock&&o.parent||!o.contentDOM)&&((l=o.dom.getBoundingClientRect()).width||l.height)&&(o.node.isBlock&&o.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(o.dom.nodeName)&&(!s&&l.left>i.left||l.top>i.top?r=o.posBefore:(!s&&l.right<i.left||l.bottom<i.top)&&(r=o.posAfter),s=!0),!o.contentDOM&&r<0&&!o.node.isText))return(o.node.isBlock?i.top<(l.top+l.bottom)/2:i.left<(l.left+l.right)/2)?o.posBefore:o.posAfter;a=o.dom.parentNode}return r>-1?r:t.docView.posFromDOM(e,n,-1)}function wW(t,e,n){let i=t.childNodes.length;if(i&&n.top<n.bottom)for(let r=Math.max(0,Math.min(i-1,Math.floor(i*(e.top-n.top)/(n.bottom-n.top))-2)),a=r;;){let s=t.childNodes[a];if(s.nodeType==1){let o=s.getClientRects();for(let l=0;l<o.length;l++){let c=o[l];if(pD(e,c))return wW(s,e,c)}}if((a=(a+1)%i)==r)break}return t}function HSe(t,e){let n=t.dom.ownerDocument,i,r=0,a=RSe(n,e.left,e.top);a&&({node:i,offset:r}=a);let s=(t.root.elementFromPoint?t.root:n).elementFromPoint(e.left,e.top),o;if(!s||!t.dom.contains(s.nodeType!=1?s.parentNode:s)){let c=t.dom.getBoundingClientRect();if(!pD(e,c)||(s=wW(t.dom,e,c),!s))return null}if(va)for(let c=s;i&&c;c=Xp(c))c.draggable&&(i=void 0);if(s=FSe(s,e),i){if($s&&i.nodeType==1&&(r=Math.min(r,i.childNodes.length),r<i.childNodes.length)){let d=i.childNodes[r],f;d.nodeName=="IMG"&&(f=d.getBoundingClientRect()).right<=e.left&&f.bottom>e.top&&r++}let c;Ix&&r&&i.nodeType==1&&(c=i.childNodes[r-1]).nodeType==1&&c.contentEditable=="false"&&c.getBoundingClientRect().top>=e.top&&r--,i==t.dom&&r==i.childNodes.length-1&&i.lastChild.nodeType==1&&e.top>i.lastChild.getBoundingClientRect().bottom?o=t.state.doc.content.size:(r==0||i.nodeType!=1||i.childNodes[r-1].nodeName!="BR")&&(o=BSe(t,i,r,e))}o==null&&(o=zSe(t,s,e));let l=t.docView.nearestDesc(s,!0);return{pos:o,inside:l?l.posAtStart-l.border:-1}}function pB(t){return t.top<t.bottom||t.left<t.right}function mu(t,e){let n=t.getClientRects();if(n.length){let i=n[e<0?0:n.length-1];if(pB(i))return i}return Array.prototype.find.call(n,pB)||t.getBoundingClientRect()}const VSe=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function MW(t,e,n){let{node:i,offset:r,atom:a}=t.docView.domFromPos(e,n<0?-1:1),s=Ix||$s;if(i.nodeType==3)if(s&&(VSe.test(i.nodeValue)||(n<0?!r:r==i.nodeValue.length))){let l=mu(Vl(i,r,r),n);if($s&&r&&/\s/.test(i.nodeValue[r-1])&&r<i.nodeValue.length){let c=mu(Vl(i,r-1,r-1),-1);if(c.top==l.top){let d=mu(Vl(i,r,r+1),-1);if(d.top!=l.top)return Fg(d,d.left<c.left)}}return l}else{let l=r,c=r,d=n<0?1:-1;return n<0&&!r?(c++,d=-1):n>=0&&r==i.nodeValue.length?(l--,d=1):n<0?l--:c++,Fg(mu(Vl(i,l,c),d),d<0)}if(!t.state.doc.resolve(e-(a||0)).parent.inlineContent){if(a==null&&r&&(n<0||r==Fs(i))){let l=i.childNodes[r-1];if(l.nodeType==1)return QT(l.getBoundingClientRect(),!1)}if(a==null&&r<Fs(i)){let l=i.childNodes[r];if(l.nodeType==1)return QT(l.getBoundingClientRect(),!0)}return QT(i.getBoundingClientRect(),n>=0)}if(a==null&&r&&(n<0||r==Fs(i))){let l=i.childNodes[r-1],c=l.nodeType==3?Vl(l,Fs(l)-(s?0:1)):l.nodeType==1&&(l.nodeName!="BR"||!l.nextSibling)?l:null;if(c)return Fg(mu(c,1),!1)}if(a==null&&r<Fs(i)){let l=i.childNodes[r];for(;l.pmViewDesc&&l.pmViewDesc.ignoreForCoords;)l=l.nextSibling;let c=l?l.nodeType==3?Vl(l,0,s?0:1):l.nodeType==1?l:null:null;if(c)return Fg(mu(c,-1),!0)}return Fg(mu(i.nodeType==3?Vl(i):i,-n),n>=0)}function Fg(t,e){if(t.width==0)return t;let n=e?t.left:t.right;return{top:t.top,bottom:t.bottom,left:n,right:n}}function QT(t,e){if(t.height==0)return t;let n=e?t.top:t.bottom;return{top:n,bottom:n,left:t.left,right:t.right}}function EW(t,e,n){let i=t.state,r=t.root.activeElement;i!=e&&t.updateState(e),r!=t.dom&&t.focus();try{return n()}finally{i!=e&&t.updateState(i),r!=t.dom&&r&&r.focus()}}function $Se(t,e,n){let i=e.selection,r=n=="up"?i.$from:i.$to;return EW(t,e,()=>{let{node:a}=t.docView.domFromPos(r.pos,n=="up"?-1:1);for(;;){let o=t.docView.nearestDesc(a,!0);if(!o)break;if(o.node.isBlock){a=o.contentDOM||o.dom;break}a=o.dom.parentNode}let s=MW(t,r.pos,1);for(let o=a.firstChild;o;o=o.nextSibling){let l;if(o.nodeType==1)l=o.getClientRects();else if(o.nodeType==3)l=Vl(o,0,o.nodeValue.length).getClientRects();else continue;for(let c=0;c<l.length;c++){let d=l[c];if(d.bottom>d.top+1&&(n=="up"?s.top-d.top>(d.bottom-s.top)*2:d.bottom-s.bottom>(s.bottom-d.top)*2))return!1}}return!0})}const GSe=/[\u0590-\u08ac]/;function WSe(t,e,n){let{$head:i}=e.selection;if(!i.parent.isTextblock)return!1;let r=i.parentOffset,a=!r,s=r==i.parent.content.size,o=t.domSelection();return o?!GSe.test(i.parent.textContent)||!o.modify?n=="left"||n=="backward"?a:s:EW(t,e,()=>{let{focusNode:l,focusOffset:c,anchorNode:d,anchorOffset:f}=t.domSelectionRange(),m=o.caretBidiLevel;o.modify("move",n,"character");let g=i.depth?t.docView.domAfterPos(i.before()):t.dom,{focusNode:y,focusOffset:_}=t.domSelectionRange(),v=y&&!g.contains(y.nodeType==1?y:y.parentNode)||l==y&&c==_;try{o.collapse(d,f),l&&(l!=d||c!=f)&&o.extend&&o.extend(l,c)}catch{}return m!=null&&(o.caretBidiLevel=m),v}):i.pos==i.start()||i.pos==i.end()}let mB=null,gB=null,xB=!1;function qSe(t,e,n){return mB==e&&gB==n?xB:(mB=e,gB=n,xB=n=="up"||n=="down"?$Se(t,e,n):WSe(t,e,n))}const Gs=0,vB=1,Zd=2,tl=3;class Ux{constructor(e,n,i,r){this.parent=e,this.children=n,this.dom=i,this.contentDOM=r,this.dirty=Gs,i.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,n,i){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let n=0;n<this.children.length;n++)e+=this.children[n].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let n=0,i=this.posAtStart;;n++){let r=this.children[n];if(r==e)return i;i+=r.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(e,n,i){if(this.contentDOM&&this.contentDOM.contains(e.nodeType==1?e:e.parentNode))if(i<0){let a,s;if(e==this.contentDOM)a=e.childNodes[n-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;a=e.previousSibling}for(;a&&!((s=a.pmViewDesc)&&s.parent==this);)a=a.previousSibling;return a?this.posBeforeChild(s)+s.size:this.posAtStart}else{let a,s;if(e==this.contentDOM)a=e.childNodes[n];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;a=e.nextSibling}for(;a&&!((s=a.pmViewDesc)&&s.parent==this);)a=a.nextSibling;return a?this.posBeforeChild(s):this.posAtEnd}let r;if(e==this.dom&&this.contentDOM)r=n>Vr(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))r=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(n==0)for(let a=e;;a=a.parentNode){if(a==this.dom){r=!1;break}if(a.previousSibling)break}if(r==null&&n==e.childNodes.length)for(let a=e;;a=a.parentNode){if(a==this.dom){r=!0;break}if(a.nextSibling)break}}return r??i>0?this.posAtEnd:this.posAtStart}nearestDesc(e,n=!1){for(let i=!0,r=e;r;r=r.parentNode){let a=this.getDesc(r),s;if(a&&(!n||a.node))if(i&&(s=a.nodeDOM)&&!(s.nodeType==1?s.contains(e.nodeType==1?e:e.parentNode):s==e))i=!1;else return a}}getDesc(e){let n=e.pmViewDesc;for(let i=n;i;i=i.parent)if(i==this)return n}posFromDOM(e,n,i){for(let r=e;r;r=r.parentNode){let a=this.getDesc(r);if(a)return a.localPosFromDOM(e,n,i)}return-1}descAt(e){for(let n=0,i=0;n<this.children.length;n++){let r=this.children[n],a=i+r.size;if(i==e&&a!=i){for(;!r.border&&r.children.length;)for(let s=0;s<r.children.length;s++){let o=r.children[s];if(o.size){r=o;break}}return r}if(e<a)return r.descAt(e-i-r.border);i=a}}domFromPos(e,n){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let i=0,r=0;for(let a=0;i<this.children.length;i++){let s=this.children[i],o=a+s.size;if(o>e||s instanceof TW){r=e-a;break}a=o}if(r)return this.children[i].domFromPos(r-this.children[i].border,n);for(let a;i&&!(a=this.children[i-1]).size&&a instanceof AW&&a.side>=0;i--);if(n<=0){let a,s=!0;for(;a=i?this.children[i-1]:null,!(!a||a.dom.parentNode==this.contentDOM);i--,s=!1);return a&&n&&s&&!a.border&&!a.domAtom?a.domFromPos(a.size,n):{node:this.contentDOM,offset:a?Vr(a.dom)+1:0}}else{let a,s=!0;for(;a=i<this.children.length?this.children[i]:null,!(!a||a.dom.parentNode==this.contentDOM);i++,s=!1);return a&&s&&!a.border&&!a.domAtom?a.domFromPos(0,n):{node:this.contentDOM,offset:a?Vr(a.dom):this.contentDOM.childNodes.length}}}parseRange(e,n,i=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:n,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let r=-1,a=-1;for(let s=i,o=0;;o++){let l=this.children[o],c=s+l.size;if(r==-1&&e<=c){let d=s+l.border;if(e>=d&&n<=c-l.border&&l.node&&l.contentDOM&&this.contentDOM.contains(l.contentDOM))return l.parseRange(e,n,d);e=s;for(let f=o;f>0;f--){let m=this.children[f-1];if(m.size&&m.dom.parentNode==this.contentDOM&&!m.emptyChildAt(1)){r=Vr(m.dom)+1;break}e-=m.size}r==-1&&(r=0)}if(r>-1&&(c>n||o==this.children.length-1)){n=c;for(let d=o+1;d<this.children.length;d++){let f=this.children[d];if(f.size&&f.dom.parentNode==this.contentDOM&&!f.emptyChildAt(-1)){a=Vr(f.dom);break}n+=f.size}a==-1&&(a=this.contentDOM.childNodes.length);break}s=c}return{node:this.contentDOM,from:e,to:n,fromOffset:r,toOffset:a}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let n=this.children[e<0?0:this.children.length-1];return n.size==0||n.emptyChildAt(e)}domAfterPos(e){let{node:n,offset:i}=this.domFromPos(e,0);if(n.nodeType!=1||i==n.childNodes.length)throw new RangeError("No node after pos "+e);return n.childNodes[i]}setSelection(e,n,i,r=!1){let a=Math.min(e,n),s=Math.max(e,n);for(let g=0,y=0;g<this.children.length;g++){let _=this.children[g],v=y+_.size;if(a>y&&s<v)return _.setSelection(e-y-_.border,n-y-_.border,i,r);y=v}let o=this.domFromPos(e,e?-1:1),l=n==e?o:this.domFromPos(n,n?-1:1),c=i.root.getSelection(),d=i.domSelectionRange(),f=!1;if(($s||va)&&e==n){let{node:g,offset:y}=o;if(g.nodeType==3){if(f=!!(y&&g.nodeValue[y-1]==`
  8065. `),f&&y==g.nodeValue.length)for(let _=g,v;_;_=_.parentNode){if(v=_.nextSibling){v.nodeName=="BR"&&(o=l={node:v.parentNode,offset:Vr(v)+1});break}let x=_.pmViewDesc;if(x&&x.node&&x.node.isBlock)break}}else{let _=g.childNodes[y-1];f=_&&(_.nodeName=="BR"||_.contentEditable=="false")}}if($s&&d.focusNode&&d.focusNode!=l.node&&d.focusNode.nodeType==1){let g=d.focusNode.childNodes[d.focusOffset];g&&g.contentEditable=="false"&&(r=!0)}if(!(r||f&&va)&&Rf(o.node,o.offset,d.anchorNode,d.anchorOffset)&&Rf(l.node,l.offset,d.focusNode,d.focusOffset))return;let m=!1;if((c.extend||e==n)&&!(f&&$s)){c.collapse(o.node,o.offset);try{e!=n&&c.extend(l.node,l.offset),m=!0}catch{}}if(!m){if(e>n){let y=o;o=l,l=y}let g=document.createRange();g.setEnd(l.node,l.offset),g.setStart(o.node,o.offset),c.removeAllRanges(),c.addRange(g)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,n){for(let i=0,r=0;r<this.children.length;r++){let a=this.children[r],s=i+a.size;if(i==s?e<=s&&n>=i:e<s&&n>i){let o=i+a.border,l=s-a.border;if(e>=o&&n<=l){this.dirty=e==i||n==s?Zd:vB,e==o&&n==l&&(a.contentLost||a.dom.parentNode!=this.contentDOM)?a.dirty=tl:a.markDirty(e-o,n-o);return}else a.dirty=a.dom==a.contentDOM&&a.dom.parentNode==this.contentDOM&&!a.children.length?Zd:tl}i=s}this.dirty=Zd}markParentsDirty(){let e=1;for(let n=this.parent;n;n=n.parent,e++){let i=e==1?Zd:vB;n.dirty<i&&(n.dirty=i)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class AW extends Ux{constructor(e,n,i,r){let a,s=n.type.toDOM;if(typeof s=="function"&&(s=s(i,()=>{if(!a)return r;if(a.parent)return a.parent.posBeforeChild(a)})),!n.type.spec.raw){if(s.nodeType!=1){let o=document.createElement("span");o.appendChild(s),s=o}s.contentEditable="false",s.classList.add("ProseMirror-widget")}super(e,[],s,null),this.widget=n,this.widget=n,a=this}matchesWidget(e){return this.dirty==Gs&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let n=this.widget.spec.stopEvent;return n?n(e):!1}ignoreMutation(e){return e.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}}class XSe extends Ux{constructor(e,n,i,r){super(e,[],n,null),this.textDOM=i,this.text=r}get size(){return this.text.length}localPosFromDOM(e,n){return e!=this.textDOM?this.posAtStart+(n?this.size:0):this.posAtStart+n}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}}class Pf extends Ux{constructor(e,n,i,r,a){super(e,[],i,r),this.mark=n,this.spec=a}static create(e,n,i,r){let a=r.nodeViews[n.type.name],s=a&&a(n,r,i);return(!s||!s.dom)&&(s=Vf.renderSpec(document,n.type.spec.toDOM(n,i),null,n.attrs)),new Pf(e,n,s.dom,s.contentDOM||s.dom,s)}parseRule(){return this.dirty&tl||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=tl&&this.mark.eq(e)}markDirty(e,n){if(super.markDirty(e,n),this.dirty!=Gs){let i=this.parent;for(;!i.node;)i=i.parent;i.dirty<this.dirty&&(i.dirty=this.dirty),this.dirty=Gs}}slice(e,n,i){let r=Pf.create(this.parent,this.mark,!0,i),a=this.children,s=this.size;n<s&&(a=j3(a,n,s,i)),e>0&&(a=j3(a,0,e,i));for(let o=0;o<a.length;o++)a[o].parent=r;return r.children=a,r}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class Bu extends Ux{constructor(e,n,i,r,a,s,o,l,c){super(e,[],a,s),this.node=n,this.outerDeco=i,this.innerDeco=r,this.nodeDOM=o}static create(e,n,i,r,a,s){let o=a.nodeViews[n.type.name],l,c=o&&o(n,a,()=>{if(!l)return s;if(l.parent)return l.parent.posBeforeChild(l)},i,r),d=c&&c.dom,f=c&&c.contentDOM;if(n.isText){if(!d)d=document.createTextNode(n.text);else if(d.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else d||({dom:d,contentDOM:f}=Vf.renderSpec(document,n.type.spec.toDOM(n),null,n.attrs));!f&&!n.isText&&d.nodeName!="BR"&&(d.hasAttribute("contenteditable")||(d.contentEditable="false"),n.type.spec.draggable&&(d.draggable=!0));let m=d;return d=RW(d,i,n),c?l=new KSe(e,n,i,r,d,f||null,m,c,a,s+1):n.isText?new aw(e,n,i,r,d,m,a):new Bu(e,n,i,r,d,f||null,m,a,s+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(e.preserveWhitespace="full"),!this.contentDOM)e.getContent=()=>this.node.content;else if(!this.contentLost)e.contentElement=this.contentDOM;else{for(let n=this.children.length-1;n>=0;n--){let i=this.children[n];if(this.dom.contains(i.dom.parentNode)){e.contentElement=i.dom.parentNode;break}}e.contentElement||(e.getContent=()=>ht.empty)}return e}matchesNode(e,n,i){return this.dirty==Gs&&e.eq(this.node)&&i1(n,this.outerDeco)&&i.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,n){let i=this.node.inlineContent,r=n,a=e.composing?this.localCompositionInfo(e,n):null,s=a&&a.pos>-1?a:null,o=a&&a.pos<0,l=new ZSe(this,s&&s.node,e);ewe(this.node,this.innerDeco,(c,d,f)=>{c.spec.marks?l.syncToMarks(c.spec.marks,i,e):c.type.side>=0&&!f&&l.syncToMarks(d==this.node.childCount?Xn.none:this.node.child(d).marks,i,e),l.placeWidget(c,e,r)},(c,d,f,m)=>{l.syncToMarks(c.marks,i,e);let g;l.findNodeMatch(c,d,f,m)||o&&e.state.selection.from>r&&e.state.selection.to<r+c.nodeSize&&(g=l.findIndexWithChild(a.node))>-1&&l.updateNodeAt(c,d,f,g,e)||l.updateNextNode(c,d,f,e,m,r)||l.addNode(c,d,f,e,r),r+=c.nodeSize}),l.syncToMarks([],i,e),this.node.isTextblock&&l.addTextblockHacks(),l.destroyRest(),(l.changed||this.dirty==Zd)&&(s&&this.protectLocalComposition(e,s),CW(this.contentDOM,this.children,e),Kp&&twe(this.dom))}localCompositionInfo(e,n){let{from:i,to:r}=e.state.selection;if(!(e.state.selection instanceof Vt)||i<n||r>n+this.node.content.size)return null;let a=e.input.compositionNode;if(!a||!this.dom.contains(a.parentNode))return null;if(this.node.inlineContent){let s=a.nodeValue,o=nwe(this.node.content,s,i-n,r-n);return o<0?null:{node:a,pos:o,text:s}}else return{node:a,pos:-1,text:""}}protectLocalComposition(e,{node:n,pos:i,text:r}){if(this.getDesc(n))return;let a=n;for(;a.parentNode!=this.contentDOM;a=a.parentNode){for(;a.previousSibling;)a.parentNode.removeChild(a.previousSibling);for(;a.nextSibling;)a.parentNode.removeChild(a.nextSibling);a.pmViewDesc&&(a.pmViewDesc=void 0)}let s=new XSe(this,a,n,r);e.input.compositionNodes.push(s),this.children=j3(this.children,i,i+r.length,e,s)}update(e,n,i,r){return this.dirty==tl||!e.sameMarkup(this.node)?!1:(this.updateInner(e,n,i,r),!0)}updateInner(e,n,i,r){this.updateOuterDeco(n),this.node=e,this.innerDeco=i,this.contentDOM&&this.updateChildren(r,this.posAtStart),this.dirty=Gs}updateOuterDeco(e){if(i1(e,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,i=this.dom;this.dom=NW(this.dom,this.nodeDOM,U3(this.outerDeco,this.node,n),U3(e,this.node,n)),this.dom!=i&&(i.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.nodeDOM.draggable=!0))}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.nodeDOM.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function yB(t,e,n,i,r){RW(i,e,t);let a=new Bu(void 0,t,e,n,i,i,i,r,0);return a.contentDOM&&a.updateChildren(r,0),a}class aw extends Bu{constructor(e,n,i,r,a,s,o){super(e,n,i,r,a,null,s,o,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,n,i,r){return this.dirty==tl||this.dirty!=Gs&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=Gs||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,r.trackWrites==this.nodeDOM&&(r.trackWrites=null)),this.node=e,this.dirty=Gs,!0)}inParent(){let e=this.parent.contentDOM;for(let n=this.nodeDOM;n;n=n.parentNode)if(n==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,n,i){return e==this.nodeDOM?this.posAtStart+Math.min(n,this.node.text.length):super.localPosFromDOM(e,n,i)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,n,i){let r=this.node.cut(e,n),a=document.createTextNode(r.text);return new aw(this.parent,r,this.outerDeco,this.innerDeco,a,a,i)}markDirty(e,n){super.markDirty(e,n),this.dom!=this.nodeDOM&&(e==0||n==this.nodeDOM.nodeValue.length)&&(this.dirty=tl)}get domAtom(){return!1}isText(e){return this.node.text==e}}class TW extends Ux{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==Gs&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class KSe extends Bu{constructor(e,n,i,r,a,s,o,l,c,d){super(e,n,i,r,a,s,o,c,d),this.spec=l}update(e,n,i,r){if(this.dirty==tl)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let a=this.spec.update(e,n,i);return a&&this.updateInner(e,n,i,r),a}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,n,i,r)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,n,i,r){this.spec.setSelection?this.spec.setSelection(e,n,i.root):super.setSelection(e,n,i,r)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return this.spec.stopEvent?this.spec.stopEvent(e):!1}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}}function CW(t,e,n){let i=t.firstChild,r=!1;for(let a=0;a<e.length;a++){let s=e[a],o=s.dom;if(o.parentNode==t){for(;o!=i;)i=bB(i),r=!0;i=i.nextSibling}else r=!0,t.insertBefore(o,i);if(s instanceof Pf){let l=i?i.previousSibling:t.lastChild;CW(s.contentDOM,s.children,n),i=l?l.nextSibling:t.firstChild}}for(;i;)i=bB(i),r=!0;r&&n.trackWrites==t&&(n.trackWrites=null)}const x0=function(t){t&&(this.nodeName=t)};x0.prototype=Object.create(null);const Qd=[new x0];function U3(t,e,n){if(t.length==0)return Qd;let i=n?Qd[0]:new x0,r=[i];for(let a=0;a<t.length;a++){let s=t[a].type.attrs;if(s){s.nodeName&&r.push(i=new x0(s.nodeName));for(let o in s){let l=s[o];l!=null&&(n&&r.length==1&&r.push(i=new x0(e.isInline?"span":"div")),o=="class"?i.class=(i.class?i.class+" ":"")+l:o=="style"?i.style=(i.style?i.style+";":"")+l:o!="nodeName"&&(i[o]=l))}}}return r}function NW(t,e,n,i){if(n==Qd&&i==Qd)return e;let r=e;for(let a=0;a<i.length;a++){let s=i[a],o=n[a];if(a){let l;o&&o.nodeName==s.nodeName&&r!=t&&(l=r.parentNode)&&l.nodeName.toLowerCase()==s.nodeName||(l=document.createElement(s.nodeName),l.pmIsDeco=!0,l.appendChild(r),o=Qd[0]),r=l}YSe(r,o||Qd[0],s)}return r}function YSe(t,e,n){for(let i in e)i!="class"&&i!="style"&&i!="nodeName"&&!(i in n)&&t.removeAttribute(i);for(let i in n)i!="class"&&i!="style"&&i!="nodeName"&&n[i]!=e[i]&&t.setAttribute(i,n[i]);if(e.class!=n.class){let i=e.class?e.class.split(" ").filter(Boolean):[],r=n.class?n.class.split(" ").filter(Boolean):[];for(let a=0;a<i.length;a++)r.indexOf(i[a])==-1&&t.classList.remove(i[a]);for(let a=0;a<r.length;a++)i.indexOf(r[a])==-1&&t.classList.add(r[a]);t.classList.length==0&&t.removeAttribute("class")}if(e.style!=n.style){if(e.style){let i=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,r;for(;r=i.exec(e.style);)t.style.removeProperty(r[1])}n.style&&(t.style.cssText+=n.style)}}function RW(t,e,n){return NW(t,t,Qd,U3(e,n,t.nodeType!=1))}function i1(t,e){if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++)if(!t[n].type.eq(e[n].type))return!1;return!0}function bB(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}class ZSe{constructor(e,n,i){this.lock=n,this.view=i,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=QSe(e.node.content,e)}destroyBetween(e,n){if(e!=n){for(let i=e;i<n;i++)this.top.children[i].destroy();this.top.children.splice(e,n-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,n,i){let r=0,a=this.stack.length>>1,s=Math.min(a,e.length);for(;r<s&&(r==a-1?this.top:this.stack[r+1<<1]).matchesMark(e[r])&&e[r].type.spec.spanning!==!1;)r++;for(;r<a;)this.destroyRest(),this.top.dirty=Gs,this.index=this.stack.pop(),this.top=this.stack.pop(),a--;for(;a<e.length;){this.stack.push(this.top,this.index+1);let o=-1;for(let l=this.index;l<Math.min(this.index+3,this.top.children.length);l++){let c=this.top.children[l];if(c.matchesMark(e[a])&&!this.isLocked(c.dom)){o=l;break}}if(o>-1)o>this.index&&(this.changed=!0,this.destroyBetween(this.index,o)),this.top=this.top.children[this.index];else{let l=Pf.create(this.top,e[a],n,i);this.top.children.splice(this.index,0,l),this.top=l,this.changed=!0}this.index=0,a++}}findNodeMatch(e,n,i,r){let a=-1,s;if(r>=this.preMatch.index&&(s=this.preMatch.matches[r-this.preMatch.index]).parent==this.top&&s.matchesNode(e,n,i))a=this.top.children.indexOf(s,this.index);else for(let o=this.index,l=Math.min(this.top.children.length,o+5);o<l;o++){let c=this.top.children[o];if(c.matchesNode(e,n,i)&&!this.preMatch.matched.has(c)){a=o;break}}return a<0?!1:(this.destroyBetween(this.index,a),this.index++,!0)}updateNodeAt(e,n,i,r,a){let s=this.top.children[r];return s.dirty==tl&&s.dom==s.contentDOM&&(s.dirty=Zd),s.update(e,n,i,a)?(this.destroyBetween(this.index,r),this.index++,!0):!1}findIndexWithChild(e){for(;;){let n=e.parentNode;if(!n)return-1;if(n==this.top.contentDOM){let i=e.pmViewDesc;if(i){for(let r=this.index;r<this.top.children.length;r++)if(this.top.children[r]==i)return r}return-1}e=n}}updateNextNode(e,n,i,r,a,s){for(let o=this.index;o<this.top.children.length;o++){let l=this.top.children[o];if(l instanceof Bu){let c=this.preMatch.matched.get(l);if(c!=null&&c!=a)return!1;let d=l.dom,f,m=this.isLocked(d)&&!(e.isText&&l.node&&l.node.isText&&l.nodeDOM.nodeValue==e.text&&l.dirty!=tl&&i1(n,l.outerDeco));if(!m&&l.update(e,n,i,r))return this.destroyBetween(this.index,o),l.dom!=d&&(this.changed=!0),this.index++,!0;if(!m&&(f=this.recreateWrapper(l,e,n,i,r,s)))return this.destroyBetween(this.index,o),this.top.children[this.index]=f,f.contentDOM&&(f.dirty=Zd,f.updateChildren(r,s+1),f.dirty=Gs),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,n,i,r,a,s){if(e.dirty||n.isAtom||!e.children.length||!e.node.content.eq(n.content)||!i1(i,e.outerDeco)||!r.eq(e.innerDeco))return null;let o=Bu.create(this.top,n,i,r,a,s);if(o.contentDOM){o.children=e.children,e.children=[];for(let l of o.children)l.parent=o}return e.destroy(),o}addNode(e,n,i,r,a){let s=Bu.create(this.top,e,n,i,r,a);s.contentDOM&&s.updateChildren(r,a+1),this.top.children.splice(this.index++,0,s),this.changed=!0}placeWidget(e,n,i){let r=this.index<this.top.children.length?this.top.children[this.index]:null;if(r&&r.matchesWidget(e)&&(e==r.widget||!r.widget.type.toDOM.parentNode))this.index++;else{let a=new AW(this.top,e,n,i);this.top.children.splice(this.index++,0,a),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],n=this.top;for(;e instanceof Pf;)n=e,e=n.children[n.children.length-1];(!e||!(e instanceof aw)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((va||ta)&&e&&e.dom.contentEditable=="false"&&this.addHackNode("IMG",n),this.addHackNode("BR",this.top))}addHackNode(e,n){if(n==this.top&&this.index<n.children.length&&n.children[this.index].matchesHack(e))this.index++;else{let i=document.createElement(e);e=="IMG"&&(i.className="ProseMirror-separator",i.alt=""),e=="BR"&&(i.className="ProseMirror-trailingBreak");let r=new TW(this.top,[],i,null);n!=this.top?n.children.push(r):n.children.splice(this.index++,0,r),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||e.nodeType==1&&e.contains(this.lock.parentNode))}}function QSe(t,e){let n=e,i=n.children.length,r=t.childCount,a=new Map,s=[];e:for(;r>0;){let o;for(;;)if(i){let c=n.children[i-1];if(c instanceof Pf)n=c,i=c.children.length;else{o=c,i--;break}}else{if(n==e)break e;i=n.parent.children.indexOf(n),n=n.parent}let l=o.node;if(l){if(l!=t.child(r-1))break;--r,a.set(o,r),s.push(o)}}return{index:r,matched:a,matches:s.reverse()}}function JSe(t,e){return t.type.side-e.type.side}function ewe(t,e,n,i){let r=e.locals(t),a=0;if(r.length==0){for(let c=0;c<t.childCount;c++){let d=t.child(c);i(d,r,e.forChild(a,d),c),a+=d.nodeSize}return}let s=0,o=[],l=null;for(let c=0;;){let d,f;for(;s<r.length&&r[s].to==a;){let v=r[s++];v.widget&&(d?(f||(f=[d])).push(v):d=v)}if(d)if(f){f.sort(JSe);for(let v=0;v<f.length;v++)n(f[v],c,!!l)}else n(d,c,!!l);let m,g;if(l)g=-1,m=l,l=null;else if(c<t.childCount)g=c,m=t.child(c++);else break;for(let v=0;v<o.length;v++)o[v].to<=a&&o.splice(v--,1);for(;s<r.length&&r[s].from<=a&&r[s].to>a;)o.push(r[s++]);let y=a+m.nodeSize;if(m.isText){let v=y;s<r.length&&r[s].from<v&&(v=r[s].from);for(let x=0;x<o.length;x++)o[x].to<v&&(v=o[x].to);v<y&&(l=m.cut(v-a),m=m.cut(0,v-a),y=v,g=-1)}else for(;s<r.length&&r[s].to<y;)s++;let _=m.isInline&&!m.isLeaf?o.filter(v=>!v.inline):o.slice();i(m,_,e.forChild(a,m),g),a=y}}function twe(t){if(t.nodeName=="UL"||t.nodeName=="OL"){let e=t.style.cssText;t.style.cssText=e+"; list-style: square !important",window.getComputedStyle(t).listStyle,t.style.cssText=e}}function nwe(t,e,n,i){for(let r=0,a=0;r<t.childCount&&a<=i;){let s=t.child(r++),o=a;if(a+=s.nodeSize,!s.isText)continue;let l=s.text;for(;r<t.childCount;){let c=t.child(r++);if(a+=c.nodeSize,!c.isText)break;l+=c.text}if(a>=n){if(a>=i&&l.slice(i-e.length-o,i-o)==e)return i-e.length;let c=o<i?l.lastIndexOf(e,i-o-1):-1;if(c>=0&&c+e.length+o>=n)return o+c;if(n==i&&l.length>=i+e.length-o&&l.slice(i-o,i-o+e.length)==e)return i}}return-1}function j3(t,e,n,i,r){let a=[];for(let s=0,o=0;s<t.length;s++){let l=t[s],c=o,d=o+=l.size;c>=n||d<=e?a.push(l):(c<e&&a.push(l.slice(0,e-c,i)),r&&(a.push(r),r=void 0),d>n&&a.push(l.slice(n-c,l.size,i)))}return a}function mD(t,e=null){let n=t.domSelectionRange(),i=t.state.doc;if(!n.focusNode)return null;let r=t.docView.nearestDesc(n.focusNode),a=r&&r.size==0,s=t.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(s<0)return null;let o=i.resolve(s),l,c;if(rw(n)){for(l=s;r&&!r.node;)r=r.parent;let f=r.node;if(r&&f.isAtom&&Ft.isSelectable(f)&&r.parent&&!(f.isInline&&CSe(n.focusNode,n.focusOffset,r.dom))){let m=r.posBefore;c=new Ft(s==m?o:i.resolve(m))}}else{if(n instanceof t.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let f=s,m=s;for(let g=0;g<n.rangeCount;g++){let y=n.getRangeAt(g);f=Math.min(f,t.docView.posFromDOM(y.startContainer,y.startOffset,1)),m=Math.max(m,t.docView.posFromDOM(y.endContainer,y.endOffset,-1))}if(f<0)return null;[l,s]=m==t.state.selection.anchor?[m,f]:[f,m],o=i.resolve(s)}else l=t.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(l<0)return null}let d=i.resolve(l);if(!c){let f=e=="pointer"||t.state.selection.head<o.pos&&!a?1:-1;c=gD(t,d,o,f)}return c}function PW(t){return t.editable?t.hasFocus():kW(t)&&document.activeElement&&document.activeElement.contains(t.dom)}function sc(t,e=!1){let n=t.state.selection;if(DW(t,n),!!PW(t)){if(!e&&t.input.mouseDown&&t.input.mouseDown.allowDefault&&ta){let i=t.domSelectionRange(),r=t.domObserver.currentSelection;if(i.anchorNode&&r.anchorNode&&Rf(i.anchorNode,i.anchorOffset,r.anchorNode,r.anchorOffset)){t.input.mouseDown.delayedSelectionSync=!0,t.domObserver.setCurSelection();return}}if(t.domObserver.disconnectSelection(),t.cursorWrapper)rwe(t);else{let{anchor:i,head:r}=n,a,s;_B&&!(n instanceof Vt)&&(n.$from.parent.inlineContent||(a=SB(t,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(s=SB(t,n.to))),t.docView.setSelection(i,r,t,e),_B&&(a&&wB(a),s&&wB(s)),n.visible?t.dom.classList.remove("ProseMirror-hideselection"):(t.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&iwe(t))}t.domObserver.setCurSelection(),t.domObserver.connectSelection()}}const _B=va||ta&&yW<63;function SB(t,e){let{node:n,offset:i}=t.docView.domFromPos(e,0),r=i<n.childNodes.length?n.childNodes[i]:null,a=i?n.childNodes[i-1]:null;if(va&&r&&r.contentEditable=="false")return JT(r);if((!r||r.contentEditable=="false")&&(!a||a.contentEditable=="false")){if(r)return JT(r);if(a)return JT(a)}}function JT(t){return t.contentEditable="true",va&&t.draggable&&(t.draggable=!1,t.wasDraggable=!0),t}function wB(t){t.contentEditable="false",t.wasDraggable&&(t.draggable=!0,t.wasDraggable=null)}function iwe(t){let e=t.dom.ownerDocument;e.removeEventListener("selectionchange",t.input.hideSelectionGuard);let n=t.domSelectionRange(),i=n.anchorNode,r=n.anchorOffset;e.addEventListener("selectionchange",t.input.hideSelectionGuard=()=>{(n.anchorNode!=i||n.anchorOffset!=r)&&(e.removeEventListener("selectionchange",t.input.hideSelectionGuard),setTimeout(()=>{(!PW(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function rwe(t){let e=t.domSelection();if(!e)return;let n=t.cursorWrapper.dom,i=n.nodeName=="IMG";i?e.collapse(n.parentNode,Vr(n)+1):e.collapse(n,0),!i&&!t.state.selection.visible&&Fa&&zu<=11&&(n.disabled=!0,n.disabled=!1)}function DW(t,e){if(e instanceof Ft){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(MB(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else MB(t)}function MB(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function gD(t,e,n,i){return t.someProp("createSelectionBetween",r=>r(t,e,n))||Vt.between(e,n,i)}function EB(t){return t.editable&&!t.hasFocus()?!1:kW(t)}function kW(t){let e=t.domSelectionRange();if(!e.anchorNode)return!1;try{return t.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(t.editable||t.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function awe(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),n=t.domSelectionRange();return Rf(e.node,e.offset,n.anchorNode,n.anchorOffset)}function F3(t,e){let{$anchor:n,$head:i}=t.selection,r=e>0?n.max(i):n.min(i),a=r.parent.inlineContent?r.depth?t.doc.resolve(e>0?r.after():r.before()):null:r;return a&&sn.findFrom(a,e)}function vu(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function AB(t,e,n){let i=t.state.selection;if(i instanceof Vt)if(n.indexOf("s")>-1){let{$head:r}=i,a=r.textOffset?null:e<0?r.nodeBefore:r.nodeAfter;if(!a||a.isText||!a.isLeaf)return!1;let s=t.state.doc.resolve(r.pos+a.nodeSize*(e<0?-1:1));return vu(t,new Vt(i.$anchor,s))}else if(i.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let r=F3(t.state,e);return r&&r instanceof Ft?vu(t,r):!1}else if(!(ks&&n.indexOf("m")>-1)){let r=i.$head,a=r.textOffset?null:e<0?r.nodeBefore:r.nodeAfter,s;if(!a||a.isText)return!1;let o=e<0?r.pos-a.nodeSize:r.pos;return a.isAtom||(s=t.docView.descAt(o))&&!s.contentDOM?Ft.isSelectable(a)?vu(t,new Ft(e<0?t.state.doc.resolve(r.pos-a.nodeSize):r)):Ix?vu(t,new Vt(t.state.doc.resolve(e<0?o:o+a.nodeSize))):!1:!1}}else return!1;else{if(i instanceof Ft&&i.node.isInline)return vu(t,new Vt(e>0?i.$to:i.$from));{let r=F3(t.state,e);return r?vu(t,r):!1}}}function r1(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function v0(t,e){let n=t.pmViewDesc;return n&&n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function sp(t,e){return e<0?swe(t):owe(t)}function swe(t){let e=t.domSelectionRange(),n=e.focusNode,i=e.focusOffset;if(!n)return;let r,a,s=!1;for($s&&n.nodeType==1&&i<r1(n)&&v0(n.childNodes[i],-1)&&(s=!0);;)if(i>0){if(n.nodeType!=1)break;{let o=n.childNodes[i-1];if(v0(o,-1))r=n,a=--i;else if(o.nodeType==3)n=o,i=n.nodeValue.length;else break}}else{if(OW(n))break;{let o=n.previousSibling;for(;o&&v0(o,-1);)r=n.parentNode,a=Vr(o),o=o.previousSibling;if(o)n=o,i=r1(n);else{if(n=n.parentNode,n==t.dom)break;i=0}}}s?z3(t,n,i):r&&z3(t,r,a)}function owe(t){let e=t.domSelectionRange(),n=e.focusNode,i=e.focusOffset;if(!n)return;let r=r1(n),a,s;for(;;)if(i<r){if(n.nodeType!=1)break;let o=n.childNodes[i];if(v0(o,1))a=n,s=++i;else break}else{if(OW(n))break;{let o=n.nextSibling;for(;o&&v0(o,1);)a=o.parentNode,s=Vr(o)+1,o=o.nextSibling;if(o)n=o,i=0,r=r1(n);else{if(n=n.parentNode,n==t.dom)break;i=r=0}}}a&&z3(t,a,s)}function OW(t){let e=t.pmViewDesc;return e&&e.node&&e.node.isBlock}function lwe(t,e){for(;t&&e==t.childNodes.length&&!Lx(t);)e=Vr(t)+1,t=t.parentNode;for(;t&&e<t.childNodes.length;){let n=t.childNodes[e];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;t=n,e=0}}function cwe(t,e){for(;t&&!e&&!Lx(t);)e=Vr(t),t=t.parentNode;for(;t&&e;){let n=t.childNodes[e-1];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;t=n,e=t.childNodes.length}}function z3(t,e,n){if(e.nodeType!=3){let a,s;(s=lwe(e,n))?(e=s,n=0):(a=cwe(e,n))&&(e=a,n=a.nodeValue.length)}let i=t.domSelection();if(!i)return;if(rw(i)){let a=document.createRange();a.setEnd(e,n),a.setStart(e,n),i.removeAllRanges(),i.addRange(a)}else i.extend&&i.extend(e,n);t.domObserver.setCurSelection();let{state:r}=t;setTimeout(()=>{t.state==r&&sc(t)},50)}function TB(t,e){let n=t.state.doc.resolve(e);if(!(ta||PSe)&&n.parent.inlineContent){let r=t.coordsAtPos(e);if(e>n.start()){let a=t.coordsAtPos(e-1),s=(a.top+a.bottom)/2;if(s>r.top&&s<r.bottom&&Math.abs(a.left-r.left)>1)return a.left<r.left?"ltr":"rtl"}if(e<n.end()){let a=t.coordsAtPos(e+1),s=(a.top+a.bottom)/2;if(s>r.top&&s<r.bottom&&Math.abs(a.left-r.left)>1)return a.left>r.left?"ltr":"rtl"}}return getComputedStyle(t.dom).direction=="rtl"?"rtl":"ltr"}function CB(t,e,n){let i=t.state.selection;if(i instanceof Vt&&!i.empty||n.indexOf("s")>-1||ks&&n.indexOf("m")>-1)return!1;let{$from:r,$to:a}=i;if(!r.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let s=F3(t.state,e);if(s&&s instanceof Ft)return vu(t,s)}if(!r.parent.inlineContent){let s=e<0?r:a,o=i instanceof ds?sn.near(s,e):sn.findFrom(s,e);return o?vu(t,o):!1}return!1}function NB(t,e){if(!(t.state.selection instanceof Vt))return!0;let{$head:n,$anchor:i,empty:r}=t.state.selection;if(!n.sameParent(i))return!0;if(!r)return!1;if(t.endOfTextblock(e>0?"forward":"backward"))return!0;let a=!n.textOffset&&(e<0?n.nodeBefore:n.nodeAfter);if(a&&!a.isText){let s=t.state.tr;return e<0?s.delete(n.pos-a.nodeSize,n.pos):s.delete(n.pos,n.pos+a.nodeSize),t.dispatch(s),!0}return!1}function RB(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function uwe(t){if(!va||t.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(e&&e.nodeType==1&&n==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let i=e.firstChild;RB(t,i,"true"),setTimeout(()=>RB(t,i,"false"),20)}return!1}function dwe(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function fwe(t,e){let n=e.keyCode,i=dwe(e);if(n==8||ks&&n==72&&i=="c")return NB(t,-1)||sp(t,-1);if(n==46&&!e.shiftKey||ks&&n==68&&i=="c")return NB(t,1)||sp(t,1);if(n==13||n==27)return!0;if(n==37||ks&&n==66&&i=="c"){let r=n==37?TB(t,t.state.selection.from)=="ltr"?-1:1:-1;return AB(t,r,i)||sp(t,r)}else if(n==39||ks&&n==70&&i=="c"){let r=n==39?TB(t,t.state.selection.from)=="ltr"?1:-1:1;return AB(t,r,i)||sp(t,r)}else{if(n==38||ks&&n==80&&i=="c")return CB(t,-1,i)||sp(t,-1);if(n==40||ks&&n==78&&i=="c")return uwe(t)||CB(t,1,i)||sp(t,1);if(i==(ks?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function xD(t,e){t.someProp("transformCopied",g=>{e=g(e,t)});let n=[],{content:i,openStart:r,openEnd:a}=e;for(;r>1&&a>1&&i.childCount==1&&i.firstChild.childCount==1;){r--,a--;let g=i.firstChild;n.push(g.type.name,g.attrs!=g.type.defaultAttrs?g.attrs:null),i=g.content}let s=t.someProp("clipboardSerializer")||Vf.fromSchema(t.state.schema),o=zW(),l=o.createElement("div");l.appendChild(s.serializeFragment(i,{document:o}));let c=l.firstChild,d,f=0;for(;c&&c.nodeType==1&&(d=FW[c.nodeName.toLowerCase()]);){for(let g=d.length-1;g>=0;g--){let y=o.createElement(d[g]);for(;l.firstChild;)y.appendChild(l.firstChild);l.appendChild(y),f++}c=l.firstChild}c&&c.nodeType==1&&c.setAttribute("data-pm-slice",`${r} ${a}${f?` -${f}`:""} ${JSON.stringify(n)}`);let m=t.someProp("clipboardTextSerializer",g=>g(e,t))||e.content.textBetween(0,e.content.size,`
  8066. `);return{dom:l,text:m,slice:e}}function LW(t,e,n,i,r){let a=r.parent.type.spec.code,s,o;if(!n&&!e)return null;let l=!!e&&(i||a||!n);if(l){if(t.someProp("transformPastedText",m=>{e=m(e,a||i,t)}),a)return o=new Mt(ht.from(t.state.schema.text(e.replace(/\r\n?/g,`
  8067. `))),0,0),t.someProp("transformPasted",m=>{o=m(o,t,!0)}),o;let f=t.someProp("clipboardTextParser",m=>m(e,r,i,t));if(f)o=f;else{let m=r.marks(),{schema:g}=t.state,y=Vf.fromSchema(g);s=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(_=>{let v=s.appendChild(document.createElement("p"));_&&v.appendChild(y.serializeNode(g.text(_,m)))})}}else t.someProp("transformPastedHTML",f=>{n=f(n,t)}),s=gwe(n),Ix&&xwe(s);let c=s&&s.querySelector("[data-pm-slice]"),d=c&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(c.getAttribute("data-pm-slice")||"");if(d&&d[3])for(let f=+d[3];f>0;f--){let m=s.firstChild;for(;m&&m.nodeType!=1;)m=m.nextSibling;if(!m)break;s=m}if(o||(o=(t.someProp("clipboardParser")||t.someProp("domParser")||m0.fromSchema(t.state.schema)).parseSlice(s,{preserveWhitespace:!!(l||d),context:r,ruleFromNode(m){return m.nodeName=="BR"&&!m.nextSibling&&m.parentNode&&!hwe.test(m.parentNode.nodeName)?{ignore:!0}:null}})),d)o=vwe(PB(o,+d[1],+d[2]),d[4]);else if(o=Mt.maxOpen(pwe(o.content,r),!0),o.openStart||o.openEnd){let f=0,m=0;for(let g=o.content.firstChild;f<o.openStart&&!g.type.spec.isolating;f++,g=g.firstChild);for(let g=o.content.lastChild;m<o.openEnd&&!g.type.spec.isolating;m++,g=g.lastChild);o=PB(o,f,m)}return t.someProp("transformPasted",f=>{o=f(o,t,l)}),o}const hwe=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function pwe(t,e){if(t.childCount<2)return t;for(let n=e.depth;n>=0;n--){let r=e.node(n).contentMatchAt(e.index(n)),a,s=[];if(t.forEach(o=>{if(!s)return;let l=r.findWrapping(o.type),c;if(!l)return s=null;if(c=s.length&&a.length&&UW(l,a,o,s[s.length-1],0))s[s.length-1]=c;else{s.length&&(s[s.length-1]=jW(s[s.length-1],a.length));let d=IW(o,l);s.push(d),r=r.matchType(d.type),a=l}}),s)return ht.from(s)}return t}function IW(t,e,n=0){for(let i=e.length-1;i>=n;i--)t=e[i].create(null,ht.from(t));return t}function UW(t,e,n,i,r){if(r<t.length&&r<e.length&&t[r]==e[r]){let a=UW(t,e,n,i.lastChild,r+1);if(a)return i.copy(i.content.replaceChild(i.childCount-1,a));if(i.contentMatchAt(i.childCount).matchType(r==t.length-1?n.type:t[r+1]))return i.copy(i.content.append(ht.from(IW(n,t,r+1))))}}function jW(t,e){if(e==0)return t;let n=t.content.replaceChild(t.childCount-1,jW(t.lastChild,e-1)),i=t.contentMatchAt(t.childCount).fillBefore(ht.empty,!0);return t.copy(n.append(i))}function B3(t,e,n,i,r,a){let s=e<0?t.firstChild:t.lastChild,o=s.content;return t.childCount>1&&(a=0),r<i-1&&(o=B3(o,e,n,i,r+1,a)),r>=n&&(o=e<0?s.contentMatchAt(0).fillBefore(o,a<=r).append(o):o.append(s.contentMatchAt(s.childCount).fillBefore(ht.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,s.copy(o))}function PB(t,e,n){return e<t.openStart&&(t=new Mt(B3(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd)),n<t.openEnd&&(t=new Mt(B3(t.content,1,n,t.openEnd,0,0),t.openStart,n)),t}const FW={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};let DB=null;function zW(){return DB||(DB=document.implementation.createHTMLDocument("title"))}let e2=null;function mwe(t){let e=window.trustedTypes;return e?(e2||(e2=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:n=>n})),e2.createHTML(t)):t}function gwe(t){let e=/^(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=zW().createElement("div"),i=/<([a-z][^>\s]+)/i.exec(t),r;if((r=i&&FW[i[1].toLowerCase()])&&(t=r.map(a=>"<"+a+">").join("")+t+r.map(a=>"</"+a+">").reverse().join("")),n.innerHTML=mwe(t),r)for(let a=0;a<r.length;a++)n=n.querySelector(r[a])||n;return n}function xwe(t){let e=t.querySelectorAll(ta?"span:not([class]):not([style])":"span.Apple-converted-space");for(let n=0;n<e.length;n++){let i=e[n];i.childNodes.length==1&&i.textContent==" "&&i.parentNode&&i.parentNode.replaceChild(t.ownerDocument.createTextNode(" "),i)}}function vwe(t,e){if(!t.size)return t;let n=t.content.firstChild.type.schema,i;try{i=JSON.parse(e)}catch{return t}let{content:r,openStart:a,openEnd:s}=t;for(let o=i.length-2;o>=0;o-=2){let l=n.nodes[i[o]];if(!l||l.hasRequiredAttrs())break;r=ht.from(l.create(i[o+1],r)),a++,s++}return new Mt(r,a,s)}const ya={},ba={},ywe={touchstart:!0,touchmove:!0};class bwe{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:"",button:0},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function _we(t){for(let e in ya){let n=ya[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=i=>{wwe(t,i)&&!vD(t,i)&&(t.editable||!(i.type in ba))&&n(t,i)},ywe[e]?{passive:!0}:void 0)}va&&t.dom.addEventListener("input",()=>null),H3(t)}function ku(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function Swe(t){t.domObserver.stop();for(let e in t.input.eventHandlers)t.dom.removeEventListener(e,t.input.eventHandlers[e]);clearTimeout(t.input.composingTimeout),clearTimeout(t.input.lastIOSEnterFallbackTimeout)}function H3(t){t.someProp("handleDOMEvents",e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=i=>vD(t,i))})}function vD(t,e){return t.someProp("handleDOMEvents",n=>{let i=n[e.type];return i?i(t,e)||e.defaultPrevented:!1})}function wwe(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let n=e.target;n!=t.dom;n=n.parentNode)if(!n||n.nodeType==11||n.pmViewDesc&&n.pmViewDesc.stopEvent(e))return!1;return!0}function Mwe(t,e){!vD(t,e)&&ya[e.type]&&(t.editable||!(e.type in ba))&&ya[e.type](t,e)}ba.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!HW(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(Ql&&ta&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),Kp&&n.keyCode==13&&!n.ctrlKey&&!n.altKey&&!n.metaKey){let i=Date.now();t.input.lastIOSEnter=i,t.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{t.input.lastIOSEnter==i&&(t.someProp("handleKeyDown",r=>r(t,Xd(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",i=>i(t,n))||fwe(t,n)?n.preventDefault():ku(t,"key")};ba.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)};ba.keypress=(t,e)=>{let n=e;if(HW(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||ks&&n.metaKey)return;if(t.someProp("handleKeyPress",r=>r(t,n))){n.preventDefault();return}let i=t.state.selection;if(!(i instanceof Vt)||!i.$from.sameParent(i.$to)){let r=String.fromCharCode(n.charCode),a=()=>t.state.tr.insertText(r).scrollIntoView();!/[\r\n]/.test(r)&&!t.someProp("handleTextInput",s=>s(t,i.$from.pos,i.$to.pos,r,a))&&t.dispatch(a()),n.preventDefault()}};function sw(t){return{left:t.clientX,top:t.clientY}}function Ewe(t,e){let n=e.x-t.clientX,i=e.y-t.clientY;return n*n+i*i<100}function yD(t,e,n,i,r){if(i==-1)return!1;let a=t.state.doc.resolve(i);for(let s=a.depth+1;s>0;s--)if(t.someProp(e,o=>s>a.depth?o(t,n,a.nodeAfter,a.before(s),r,!0):o(t,n,a.node(s),a.before(s),r,!1)))return!0;return!1}function Pp(t,e,n){if(t.focused||t.focus(),t.state.selection.eq(e))return;let i=t.state.tr.setSelection(e);i.setMeta("pointer",!0),t.dispatch(i)}function Awe(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),i=n.nodeAfter;return i&&i.isAtom&&Ft.isSelectable(i)?(Pp(t,new Ft(n)),!0):!1}function Twe(t,e){if(e==-1)return!1;let n=t.state.selection,i,r;n instanceof Ft&&(i=n.node);let a=t.state.doc.resolve(e);for(let s=a.depth+1;s>0;s--){let o=s>a.depth?a.nodeAfter:a.node(s);if(Ft.isSelectable(o)){i&&n.$from.depth>0&&s>=n.$from.depth&&a.before(n.$from.depth+1)==n.$from.pos?r=a.before(n.$from.depth):r=a.before(s);break}}return r!=null?(Pp(t,Ft.create(t.state.doc,r)),!0):!1}function Cwe(t,e,n,i,r){return yD(t,"handleClickOn",e,n,i)||t.someProp("handleClick",a=>a(t,e,i))||(r?Twe(t,n):Awe(t,n))}function Nwe(t,e,n,i){return yD(t,"handleDoubleClickOn",e,n,i)||t.someProp("handleDoubleClick",r=>r(t,e,i))}function Rwe(t,e,n,i){return yD(t,"handleTripleClickOn",e,n,i)||t.someProp("handleTripleClick",r=>r(t,e,i))||Pwe(t,n,i)}function Pwe(t,e,n){if(n.button!=0)return!1;let i=t.state.doc;if(e==-1)return i.inlineContent?(Pp(t,Vt.create(i,0,i.content.size)),!0):!1;let r=i.resolve(e);for(let a=r.depth+1;a>0;a--){let s=a>r.depth?r.nodeAfter:r.node(a),o=r.before(a);if(s.inlineContent)Pp(t,Vt.create(i,o+1,o+1+s.content.size));else if(Ft.isSelectable(s))Pp(t,Ft.create(i,o));else continue;return!0}}function bD(t){return a1(t)}const BW=ks?"metaKey":"ctrlKey";ya.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let i=bD(t),r=Date.now(),a="singleClick";r-t.input.lastClick.time<500&&Ewe(n,t.input.lastClick)&&!n[BW]&&t.input.lastClick.button==n.button&&(t.input.lastClick.type=="singleClick"?a="doubleClick":t.input.lastClick.type=="doubleClick"&&(a="tripleClick")),t.input.lastClick={time:r,x:n.clientX,y:n.clientY,type:a,button:n.button};let s=t.posAtCoords(sw(n));s&&(a=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new Dwe(t,s,n,!!i)):(a=="doubleClick"?Nwe:Rwe)(t,s.pos,s.inside,n)?n.preventDefault():ku(t,"pointer"))};class Dwe{constructor(e,n,i,r){this.view=e,this.pos=n,this.event=i,this.flushed=r,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!i[BW],this.allowDefault=i.shiftKey;let a,s;if(n.inside>-1)a=e.state.doc.nodeAt(n.inside),s=n.inside;else{let d=e.state.doc.resolve(n.pos);a=d.parent,s=d.depth?d.before():0}const o=r?null:i.target,l=o?e.docView.nearestDesc(o,!0):null;this.target=l&&l.nodeDOM.nodeType==1?l.nodeDOM:null;let{selection:c}=e.state;(i.button==0&&a.type.spec.draggable&&a.type.spec.selectable!==!1||c instanceof Ft&&c.from<=s&&c.to>s)&&(this.mightDrag={node:a,pos:s,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&$s&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),ku(e,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>sc(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let n=this.pos;this.view.state.doc!=this.startDoc&&(n=this.view.posAtCoords(sw(e))),this.updateAllowDefault(e),this.allowDefault||!n?ku(this.view,"pointer"):Cwe(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||va&&this.mightDrag&&!this.mightDrag.node.isAtom||ta&&!this.view.state.selection.visible&&Math.min(Math.abs(n.pos-this.view.state.selection.from),Math.abs(n.pos-this.view.state.selection.to))<=2)?(Pp(this.view,sn.near(this.view.state.doc.resolve(n.pos))),e.preventDefault()):ku(this.view,"pointer")}move(e){this.updateAllowDefault(e),ku(this.view,"pointer"),e.buttons==0&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}}ya.touchstart=t=>{t.input.lastTouch=Date.now(),bD(t),ku(t,"pointer")};ya.touchmove=t=>{t.input.lastTouch=Date.now(),ku(t,"pointer")};ya.contextmenu=t=>bD(t);function HW(t,e){return t.composing?!0:va&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const kwe=Ql?5e3:-1;ba.compositionstart=ba.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof Vt&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(i=>i.type.spec.inclusive===!1)))t.markCursor=t.state.storedMarks||n.marks(),a1(t,!0),t.markCursor=null;else if(a1(t,!e.selection.empty),$s&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let i=t.domSelectionRange();for(let r=i.focusNode,a=i.focusOffset;r&&r.nodeType==1&&a!=0;){let s=a<0?r.lastChild:r.childNodes[a-1];if(!s)break;if(s.nodeType==3){let o=t.domSelection();o&&o.collapse(s,s.nodeValue.length);break}else r=s,a=-1}}t.input.composing=!0}VW(t,kwe)};ba.compositionend=(t,e)=>{t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=e.timeStamp,t.input.compositionPendingChanges=t.domObserver.pendingRecords().length?t.input.compositionID:0,t.input.compositionNode=null,t.input.compositionPendingChanges&&Promise.resolve().then(()=>t.domObserver.flush()),t.input.compositionID++,VW(t,20))};function VW(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>a1(t),e))}function $W(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=Lwe());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function Owe(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let n=ASe(e.focusNode,e.focusOffset),i=TSe(e.focusNode,e.focusOffset);if(n&&i&&n!=i){let r=i.pmViewDesc,a=t.domObserver.lastChangedTextNode;if(n==a||i==a)return a;if(!r||!r.isText(i.nodeValue))return i;if(t.input.compositionNode==i){let s=n.pmViewDesc;if(!(!s||!s.isText(n.nodeValue)))return i}}return n||i}function Lwe(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function a1(t,e=!1){if(!(Ql&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),$W(t),e||t.docView&&t.docView.dirty){let n=mD(t),i=t.state.selection;return n&&!n.eq(i)?t.dispatch(t.state.tr.setSelection(n)):(t.markCursor||e)&&!i.$from.node(i.$from.sharedDepth(i.to)).inlineContent?t.dispatch(t.state.tr.deleteSelection()):t.updateState(t.state),!0}return!1}}function Iwe(t,e){if(!t.dom.parentNode)return;let n=t.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(e),n.style.cssText="position: fixed; left: -10000px; top: 10px";let i=getSelection(),r=document.createRange();r.selectNodeContents(e),t.dom.blur(),i.removeAllRanges(),i.addRange(r),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),t.focus()},50)}const ex=Fa&&zu<15||Kp&&DSe<604;ya.copy=ba.cut=(t,e)=>{let n=e,i=t.state.selection,r=n.type=="cut";if(i.empty)return;let a=ex?null:n.clipboardData,s=i.content(),{dom:o,text:l}=xD(t,s);a?(n.preventDefault(),a.clearData(),a.setData("text/html",o.innerHTML),a.setData("text/plain",l)):Iwe(t,o),r&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function Uwe(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function jwe(t,e){if(!t.dom.parentNode)return;let n=t.input.shiftKey||t.state.selection.$from.parent.type.spec.code,i=t.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(i.contentEditable="true"),i.style.cssText="position: fixed; left: -10000px; top: 10px",i.focus();let r=t.input.shiftKey&&t.input.lastKeyCode!=45;setTimeout(()=>{t.focus(),i.parentNode&&i.parentNode.removeChild(i),n?tx(t,i.value,null,r,e):tx(t,i.textContent,i.innerHTML,r,e)},50)}function tx(t,e,n,i,r){let a=LW(t,e,n,i,t.state.selection.$from);if(t.someProp("handlePaste",l=>l(t,r,a||Mt.empty)))return!0;if(!a)return!1;let s=Uwe(a),o=s?t.state.tr.replaceSelectionWith(s,i):t.state.tr.replaceSelection(a);return t.dispatch(o.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function GW(t){let e=t.getData("text/plain")||t.getData("Text");if(e)return e;let n=t.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}ba.paste=(t,e)=>{let n=e;if(t.composing&&!Ql)return;let i=ex?null:n.clipboardData,r=t.input.shiftKey&&t.input.lastKeyCode!=45;i&&tx(t,GW(i),i.getData("text/html"),r,n)?n.preventDefault():jwe(t,n)};class WW{constructor(e,n,i){this.slice=e,this.move=n,this.node=i}}const Fwe=ks?"altKey":"ctrlKey";function qW(t,e){let n=t.someProp("dragCopies",i=>!i(e));return n??!e[Fwe]}ya.dragstart=(t,e)=>{let n=e,i=t.input.mouseDown;if(i&&i.done(),!n.dataTransfer)return;let r=t.state.selection,a=r.empty?null:t.posAtCoords(sw(n)),s;if(!(a&&a.pos>=r.from&&a.pos<=(r instanceof Ft?r.to-1:r.to))){if(i&&i.mightDrag)s=Ft.create(t.state.doc,i.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let f=t.docView.nearestDesc(n.target,!0);f&&f.node.type.spec.draggable&&f!=t.docView&&(s=Ft.create(t.state.doc,f.posBefore))}}let o=(s||t.state.selection).content(),{dom:l,text:c,slice:d}=xD(t,o);(!n.dataTransfer.files.length||!ta||yW>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(ex?"Text":"text/html",l.innerHTML),n.dataTransfer.effectAllowed="copyMove",ex||n.dataTransfer.setData("text/plain",c),t.dragging=new WW(d,qW(t,n),s)};ya.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)};ba.dragover=ba.dragenter=(t,e)=>e.preventDefault();ba.drop=(t,e)=>{let n=e,i=t.dragging;if(t.dragging=null,!n.dataTransfer)return;let r=t.posAtCoords(sw(n));if(!r)return;let a=t.state.doc.resolve(r.pos),s=i&&i.slice;s?t.someProp("transformPasted",y=>{s=y(s,t,!1)}):s=LW(t,GW(n.dataTransfer),ex?null:n.dataTransfer.getData("text/html"),!1,a);let o=!!(i&&qW(t,n));if(t.someProp("handleDrop",y=>y(t,n,s||Mt.empty,o))){n.preventDefault();return}if(!s)return;n.preventDefault();let l=s?Q7(t.state.doc,a.pos,s):a.pos;l==null&&(l=a.pos);let c=t.state.tr;if(o){let{node:y}=i;y?y.replace(c):c.deleteSelection()}let d=c.mapping.map(l),f=s.openStart==0&&s.openEnd==0&&s.content.childCount==1,m=c.doc;if(f?c.replaceRangeWith(d,d,s.content.firstChild):c.replaceRange(d,d,s),c.doc.eq(m))return;let g=c.doc.resolve(d);if(f&&Ft.isSelectable(s.content.firstChild)&&g.nodeAfter&&g.nodeAfter.sameMarkup(s.content.firstChild))c.setSelection(new Ft(g));else{let y=c.mapping.map(l);c.mapping.maps[c.mapping.maps.length-1].forEach((_,v,x,M)=>y=M),c.setSelection(gD(t,g,c.doc.resolve(y)))}t.focus(),t.dispatch(c.setMeta("uiEvent","drop"))};ya.focus=t=>{t.input.lastFocus=Date.now(),t.focused||(t.domObserver.stop(),t.dom.classList.add("ProseMirror-focused"),t.domObserver.start(),t.focused=!0,setTimeout(()=>{t.docView&&t.hasFocus()&&!t.domObserver.currentSelection.eq(t.domSelectionRange())&&sc(t)},20))};ya.blur=(t,e)=>{let n=e;t.focused&&(t.domObserver.stop(),t.dom.classList.remove("ProseMirror-focused"),t.domObserver.start(),n.relatedTarget&&t.dom.contains(n.relatedTarget)&&t.domObserver.currentSelection.clear(),t.focused=!1)};ya.beforeinput=(t,e)=>{if(ta&&Ql&&e.inputType=="deleteContentBackward"){t.domObserver.flushSoon();let{domChangeCount:i}=t.input;setTimeout(()=>{if(t.input.domChangeCount!=i||(t.dom.blur(),t.focus(),t.someProp("handleKeyDown",a=>a(t,Xd(8,"Backspace")))))return;let{$cursor:r}=t.state.selection;r&&r.pos>0&&t.dispatch(t.state.tr.delete(r.pos-1,r.pos).scrollIntoView())},50)}};for(let t in ba)ya[t]=ba[t];function nx(t,e){if(t==e)return!0;for(let n in t)if(t[n]!==e[n])return!1;for(let n in e)if(!(n in t))return!1;return!0}class s1{constructor(e,n){this.toDOM=e,this.spec=n||uf,this.side=this.spec.side||0}map(e,n,i,r){let{pos:a,deleted:s}=e.mapResult(n.from+r,this.side<0?-1:1);return s?null:new ha(a-i,a-i,this)}valid(){return!0}eq(e){return this==e||e instanceof s1&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&nx(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class Hu{constructor(e,n){this.attrs=e,this.spec=n||uf}map(e,n,i,r){let a=e.map(n.from+r,this.spec.inclusiveStart?-1:1)-i,s=e.map(n.to+r,this.spec.inclusiveEnd?1:-1)-i;return a>=s?null:new ha(a,s,this)}valid(e,n){return n.from<n.to}eq(e){return this==e||e instanceof Hu&&nx(this.attrs,e.attrs)&&nx(this.spec,e.spec)}static is(e){return e.type instanceof Hu}destroy(){}}class _D{constructor(e,n){this.attrs=e,this.spec=n||uf}map(e,n,i,r){let a=e.mapResult(n.from+r,1);if(a.deleted)return null;let s=e.mapResult(n.to+r,-1);return s.deleted||s.pos<=a.pos?null:new ha(a.pos-i,s.pos-i,this)}valid(e,n){let{index:i,offset:r}=e.content.findIndex(n.from),a;return r==n.from&&!(a=e.child(i)).isText&&r+a.nodeSize==n.to}eq(e){return this==e||e instanceof _D&&nx(this.attrs,e.attrs)&&nx(this.spec,e.spec)}destroy(){}}class ha{constructor(e,n,i){this.from=e,this.to=n,this.type=i}copy(e,n){return new ha(e,n,this.type)}eq(e,n=0){return this.type.eq(e.type)&&this.from+n==e.from&&this.to+n==e.to}map(e,n,i){return this.type.map(e,this,n,i)}static widget(e,n,i){return new ha(e,e,new s1(n,i))}static inline(e,n,i,r){return new ha(e,n,new Hu(i,r))}static node(e,n,i,r){return new ha(e,n,new _D(i,r))}get spec(){return this.type.spec}get inline(){return this.type instanceof Hu}get widget(){return this.type instanceof s1}}const fp=[],uf={};class pi{constructor(e,n){this.local=e.length?e:fp,this.children=n.length?n:fp}static create(e,n){return n.length?o1(n,e,0,uf):Qr}find(e,n,i){let r=[];return this.findInner(e??0,n??1e9,r,0,i),r}findInner(e,n,i,r,a){for(let s=0;s<this.local.length;s++){let o=this.local[s];o.from<=n&&o.to>=e&&(!a||a(o.spec))&&i.push(o.copy(o.from+r,o.to+r))}for(let s=0;s<this.children.length;s+=3)if(this.children[s]<n&&this.children[s+1]>e){let o=this.children[s]+1;this.children[s+2].findInner(e-o,n-o,i,r+o,a)}}map(e,n,i){return this==Qr||e.maps.length==0?this:this.mapInner(e,n,0,0,i||uf)}mapInner(e,n,i,r,a){let s;for(let o=0;o<this.local.length;o++){let l=this.local[o].map(e,i,r);l&&l.type.valid(n,l)?(s||(s=[])).push(l):a.onRemove&&a.onRemove(this.local[o].spec)}return this.children.length?zwe(this.children,s||[],e,n,i,r,a):s?new pi(s.sort(df),fp):Qr}add(e,n){return n.length?this==Qr?pi.create(e,n):this.addInner(e,n,0):this}addInner(e,n,i){let r,a=0;e.forEach((o,l)=>{let c=l+i,d;if(d=KW(n,o,c)){for(r||(r=this.children.slice());a<r.length&&r[a]<l;)a+=3;r[a]==l?r[a+2]=r[a+2].addInner(o,d,c+1):r.splice(a,0,l,l+o.nodeSize,o1(d,o,c+1,uf)),a+=3}});let s=XW(a?YW(n):n,-i);for(let o=0;o<s.length;o++)s[o].type.valid(e,s[o])||s.splice(o--,1);return new pi(s.length?this.local.concat(s).sort(df):this.local,r||this.children)}remove(e){return e.length==0||this==Qr?this:this.removeInner(e,0)}removeInner(e,n){let i=this.children,r=this.local;for(let a=0;a<i.length;a+=3){let s,o=i[a]+n,l=i[a+1]+n;for(let d=0,f;d<e.length;d++)(f=e[d])&&f.from>o&&f.to<l&&(e[d]=null,(s||(s=[])).push(f));if(!s)continue;i==this.children&&(i=this.children.slice());let c=i[a+2].removeInner(s,o+1);c!=Qr?i[a+2]=c:(i.splice(a,3),a-=3)}if(r.length){for(let a=0,s;a<e.length;a++)if(s=e[a])for(let o=0;o<r.length;o++)r[o].eq(s,n)&&(r==this.local&&(r=this.local.slice()),r.splice(o--,1))}return i==this.children&&r==this.local?this:r.length||i.length?new pi(r,i):Qr}forChild(e,n){if(this==Qr)return this;if(n.isLeaf)return pi.empty;let i,r;for(let o=0;o<this.children.length;o+=3)if(this.children[o]>=e){this.children[o]==e&&(i=this.children[o+2]);break}let a=e+1,s=a+n.content.size;for(let o=0;o<this.local.length;o++){let l=this.local[o];if(l.from<s&&l.to>a&&l.type instanceof Hu){let c=Math.max(a,l.from)-a,d=Math.min(s,l.to)-a;c<d&&(r||(r=[])).push(l.copy(c,d))}}if(r){let o=new pi(r.sort(df),fp);return i?new Eu([o,i]):o}return i||Qr}eq(e){if(this==e)return!0;if(!(e instanceof pi)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let n=0;n<this.local.length;n++)if(!this.local[n].eq(e.local[n]))return!1;for(let n=0;n<this.children.length;n+=3)if(this.children[n]!=e.children[n]||this.children[n+1]!=e.children[n+1]||!this.children[n+2].eq(e.children[n+2]))return!1;return!0}locals(e){return SD(this.localsInner(e))}localsInner(e){if(this==Qr)return fp;if(e.inlineContent||!this.local.some(Hu.is))return this.local;let n=[];for(let i=0;i<this.local.length;i++)this.local[i].type instanceof Hu||n.push(this.local[i]);return n}forEachSet(e){e(this)}}pi.empty=new pi([],[]);pi.removeOverlap=SD;const Qr=pi.empty;class Eu{constructor(e){this.members=e}map(e,n){const i=this.members.map(r=>r.map(e,n,uf));return Eu.from(i)}forChild(e,n){if(n.isLeaf)return pi.empty;let i=[];for(let r=0;r<this.members.length;r++){let a=this.members[r].forChild(e,n);a!=Qr&&(a instanceof Eu?i=i.concat(a.members):i.push(a))}return Eu.from(i)}eq(e){if(!(e instanceof Eu)||e.members.length!=this.members.length)return!1;for(let n=0;n<this.members.length;n++)if(!this.members[n].eq(e.members[n]))return!1;return!0}locals(e){let n,i=!0;for(let r=0;r<this.members.length;r++){let a=this.members[r].localsInner(e);if(a.length)if(!n)n=a;else{i&&(n=n.slice(),i=!1);for(let s=0;s<a.length;s++)n.push(a[s])}}return n?SD(i?n:n.sort(df)):fp}static from(e){switch(e.length){case 0:return Qr;case 1:return e[0];default:return new Eu(e.every(n=>n instanceof pi)?e:e.reduce((n,i)=>n.concat(i instanceof pi?i:i.members),[]))}}forEachSet(e){for(let n=0;n<this.members.length;n++)this.members[n].forEachSet(e)}}function zwe(t,e,n,i,r,a,s){let o=t.slice();for(let c=0,d=a;c<n.maps.length;c++){let f=0;n.maps[c].forEach((m,g,y,_)=>{let v=_-y-(g-m);for(let x=0;x<o.length;x+=3){let M=o[x+1];if(M<0||m>M+d-f)continue;let w=o[x]+d-f;g>=w?o[x+1]=m<=w?-2:-1:m>=d&&v&&(o[x]+=v,o[x+1]+=v)}f+=v}),d=n.maps[c].map(d,-1)}let l=!1;for(let c=0;c<o.length;c+=3)if(o[c+1]<0){if(o[c+1]==-2){l=!0,o[c+1]=-1;continue}let d=n.map(t[c]+a),f=d-r;if(f<0||f>=i.content.size){l=!0;continue}let m=n.map(t[c+1]+a,-1),g=m-r,{index:y,offset:_}=i.content.findIndex(f),v=i.maybeChild(y);if(v&&_==f&&_+v.nodeSize==g){let x=o[c+2].mapInner(n,v,d+1,t[c]+a+1,s);x!=Qr?(o[c]=f,o[c+1]=g,o[c+2]=x):(o[c+1]=-2,l=!0)}else l=!0}if(l){let c=Bwe(o,t,e,n,r,a,s),d=o1(c,i,0,s);e=d.local;for(let f=0;f<o.length;f+=3)o[f+1]<0&&(o.splice(f,3),f-=3);for(let f=0,m=0;f<d.children.length;f+=3){let g=d.children[f];for(;m<o.length&&o[m]<g;)m+=3;o.splice(m,0,d.children[f],d.children[f+1],d.children[f+2])}}return new pi(e.sort(df),o)}function XW(t,e){if(!e||!t.length)return t;let n=[];for(let i=0;i<t.length;i++){let r=t[i];n.push(new ha(r.from+e,r.to+e,r.type))}return n}function Bwe(t,e,n,i,r,a,s){function o(l,c){for(let d=0;d<l.local.length;d++){let f=l.local[d].map(i,r,c);f?n.push(f):s.onRemove&&s.onRemove(l.local[d].spec)}for(let d=0;d<l.children.length;d+=3)o(l.children[d+2],l.children[d]+c+1)}for(let l=0;l<t.length;l+=3)t[l+1]==-1&&o(t[l+2],e[l]+a+1);return n}function KW(t,e,n){if(e.isLeaf)return null;let i=n+e.nodeSize,r=null;for(let a=0,s;a<t.length;a++)(s=t[a])&&s.from>n&&s.to<i&&((r||(r=[])).push(s),t[a]=null);return r}function YW(t){let e=[];for(let n=0;n<t.length;n++)t[n]!=null&&e.push(t[n]);return e}function o1(t,e,n,i){let r=[],a=!1;e.forEach((o,l)=>{let c=KW(t,o,l+n);if(c){a=!0;let d=o1(c,o,n+l+1,i);d!=Qr&&r.push(l,l+o.nodeSize,d)}});let s=XW(a?YW(t):t,-n).sort(df);for(let o=0;o<s.length;o++)s[o].type.valid(e,s[o])||(i.onRemove&&i.onRemove(s[o].spec),s.splice(o--,1));return s.length||r.length?new pi(s,r):Qr}function df(t,e){return t.from-e.from||t.to-e.to}function SD(t){let e=t;for(let n=0;n<e.length-1;n++){let i=e[n];if(i.from!=i.to)for(let r=n+1;r<e.length;r++){let a=e[r];if(a.from==i.from){a.to!=i.to&&(e==t&&(e=t.slice()),e[r]=a.copy(a.from,i.to),kB(e,r+1,a.copy(i.to,a.to)));continue}else{a.from<i.to&&(e==t&&(e=t.slice()),e[n]=i.copy(i.from,a.from),kB(e,r,i.copy(a.from,i.to)));break}}}return e}function kB(t,e,n){for(;e<t.length&&df(n,t[e])>0;)e++;t.splice(e,0,n)}function t2(t){let e=[];return t.someProp("decorations",n=>{let i=n(t.state);i&&i!=Qr&&e.push(i)}),t.cursorWrapper&&e.push(pi.create(t.state.doc,[t.cursorWrapper.deco])),Eu.from(e)}const Hwe={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},Vwe=Fa&&zu<=11;class $we{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}}class Gwe{constructor(e,n){this.view=e,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new $we,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(i=>{for(let r=0;r<i.length;r++)this.queue.push(i[r]);Fa&&zu<=11&&i.some(r=>r.type=="childList"&&r.removedNodes.length||r.type=="characterData"&&r.oldValue.length>r.target.nodeValue.length)?this.flushSoon():this.flush()}),Vwe&&(this.onCharData=i=>{this.queue.push({target:i.target,type:"characterData",oldValue:i.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,Hwe)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let n=0;n<e.length;n++)this.queue.push(e[n]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(EB(this.view)){if(this.suppressingSelectionUpdates)return sc(this.view);if(Fa&&zu<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&Rf(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let n=new Set,i;for(let a=e.focusNode;a;a=Xp(a))n.add(a);for(let a=e.anchorNode;a;a=Xp(a))if(n.has(a)){i=a;break}let r=i&&this.view.docView.nearestDesc(i);if(r&&r.ignoreMutation({type:"selection",target:i.nodeType==3?i.parentNode:i}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let n=this.pendingRecords();n.length&&(this.queue=[]);let i=e.domSelectionRange(),r=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(i)&&EB(e)&&!this.ignoreSelectionChange(i),a=-1,s=-1,o=!1,l=[];if(e.editable)for(let d=0;d<n.length;d++){let f=this.registerMutation(n[d],l);f&&(a=a<0?f.from:Math.min(f.from,a),s=s<0?f.to:Math.max(f.to,s),f.typeOver&&(o=!0))}if($s&&l.length){let d=l.filter(f=>f.nodeName=="BR");if(d.length==2){let[f,m]=d;f.parentNode&&f.parentNode.parentNode==m.parentNode?m.remove():f.remove()}else{let{focusNode:f}=this.currentSelection;for(let m of d){let g=m.parentNode;g&&g.nodeName=="LI"&&(!f||Xwe(e,f)!=g)&&m.remove()}}}let c=null;a<0&&r&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&rw(i)&&(c=mD(e))&&c.eq(sn.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,sc(e),this.currentSelection.set(i),e.scrollToSelection()):(a>-1||r)&&(a>-1&&(e.docView.markDirty(a,s),Wwe(e)),this.handleDOMChange(a,s,o,l),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(i)||sc(e),this.currentSelection.set(i))}registerMutation(e,n){if(n.indexOf(e.target)>-1)return null;let i=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(i==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!i||i.ignoreMutation(e))return null;if(e.type=="childList"){for(let d=0;d<e.addedNodes.length;d++){let f=e.addedNodes[d];n.push(f),f.nodeType==3&&(this.lastChangedTextNode=f)}if(i.contentDOM&&i.contentDOM!=i.dom&&!i.contentDOM.contains(e.target))return{from:i.posBefore,to:i.posAfter};let r=e.previousSibling,a=e.nextSibling;if(Fa&&zu<=11&&e.addedNodes.length)for(let d=0;d<e.addedNodes.length;d++){let{previousSibling:f,nextSibling:m}=e.addedNodes[d];(!f||Array.prototype.indexOf.call(e.addedNodes,f)<0)&&(r=f),(!m||Array.prototype.indexOf.call(e.addedNodes,m)<0)&&(a=m)}let s=r&&r.parentNode==e.target?Vr(r)+1:0,o=i.localPosFromDOM(e.target,s,-1),l=a&&a.parentNode==e.target?Vr(a):e.target.childNodes.length,c=i.localPosFromDOM(e.target,l,1);return{from:o,to:c}}else return e.type=="attributes"?{from:i.posAtStart-i.border,to:i.posAtEnd+i.border}:(this.lastChangedTextNode=e.target,{from:i.posAtStart,to:i.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let OB=new WeakMap,LB=!1;function Wwe(t){if(!OB.has(t)&&(OB.set(t,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(t.dom).whiteSpace)!==-1)){if(t.requiresGeckoHackNode=$s,LB)return;console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package."),LB=!0}}function IB(t,e){let n=e.startContainer,i=e.startOffset,r=e.endContainer,a=e.endOffset,s=t.domAtPos(t.state.selection.anchor);return Rf(s.node,s.offset,r,a)&&([n,i,r,a]=[r,a,n,i]),{anchorNode:n,anchorOffset:i,focusNode:r,focusOffset:a}}function qwe(t,e){if(e.getComposedRanges){let r=e.getComposedRanges(t.root)[0];if(r)return IB(t,r)}let n;function i(r){r.preventDefault(),r.stopImmediatePropagation(),n=r.getTargetRanges()[0]}return t.dom.addEventListener("beforeinput",i,!0),document.execCommand("indent"),t.dom.removeEventListener("beforeinput",i,!0),n?IB(t,n):null}function Xwe(t,e){for(let n=e.parentNode;n&&n!=t.dom;n=n.parentNode){let i=t.docView.nearestDesc(n,!0);if(i&&i.node.isBlock)return n}return null}function Kwe(t,e,n){let{node:i,fromOffset:r,toOffset:a,from:s,to:o}=t.docView.parseRange(e,n),l=t.domSelectionRange(),c,d=l.anchorNode;if(d&&t.dom.contains(d.nodeType==1?d:d.parentNode)&&(c=[{node:d,offset:l.anchorOffset}],rw(l)||c.push({node:l.focusNode,offset:l.focusOffset})),ta&&t.input.lastKeyCode===8)for(let v=a;v>r;v--){let x=i.childNodes[v-1],M=x.pmViewDesc;if(x.nodeName=="BR"&&!M){a=v;break}if(!M||M.size)break}let f=t.state.doc,m=t.someProp("domParser")||m0.fromSchema(t.state.schema),g=f.resolve(s),y=null,_=m.parse(i,{topNode:g.parent,topMatch:g.parent.contentMatchAt(g.index()),topOpen:!0,from:r,to:a,preserveWhitespace:g.parent.type.whitespace=="pre"?"full":!0,findPositions:c,ruleFromNode:Ywe,context:g});if(c&&c[0].pos!=null){let v=c[0].pos,x=c[1]&&c[1].pos;x==null&&(x=v),y={anchor:v+s,head:x+s}}return{doc:_,sel:y,from:s,to:o}}function Ywe(t){let e=t.pmViewDesc;if(e)return e.parseRule();if(t.nodeName=="BR"&&t.parentNode){if(va&&/^(ul|ol)$/i.test(t.parentNode.nodeName)){let n=document.createElement("div");return n.appendChild(document.createElement("li")),{skip:n}}else if(t.parentNode.lastChild==t||va&&/^(tr|table)$/i.test(t.parentNode.nodeName))return{ignore:!0}}else if(t.nodeName=="IMG"&&t.getAttribute("mark-placeholder"))return{ignore:!0};return null}const Zwe=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function Qwe(t,e,n,i,r){let a=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,e<0){let A=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,U=mD(t,A);if(U&&!t.state.selection.eq(U)){if(ta&&Ql&&t.input.lastKeyCode===13&&Date.now()-100<t.input.lastKeyCodeTime&&t.someProp("handleKeyDown",D=>D(t,Xd(13,"Enter"))))return;let N=t.state.tr.setSelection(U);A=="pointer"?N.setMeta("pointer",!0):A=="key"&&N.scrollIntoView(),a&&N.setMeta("composition",a),t.dispatch(N)}return}let s=t.state.doc.resolve(e),o=s.sharedDepth(n);e=s.before(o+1),n=t.state.doc.resolve(n).after(o+1);let l=t.state.selection,c=Kwe(t,e,n),d=t.state.doc,f=d.slice(c.from,c.to),m,g;t.input.lastKeyCode===8&&Date.now()-100<t.input.lastKeyCodeTime?(m=t.state.selection.to,g="end"):(m=t.state.selection.from,g="start"),t.input.lastKeyCode=null;let y=tMe(f.content,c.doc.content,c.from,m,g);if(y&&t.input.domChangeCount++,(Kp&&t.input.lastIOSEnter>Date.now()-225||Ql)&&r.some(A=>A.nodeType==1&&!Zwe.test(A.nodeName))&&(!y||y.endA>=y.endB)&&t.someProp("handleKeyDown",A=>A(t,Xd(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!y)if(i&&l instanceof Vt&&!l.empty&&l.$head.sameParent(l.$anchor)&&!t.composing&&!(c.sel&&c.sel.anchor!=c.sel.head))y={start:l.from,endA:l.to,endB:l.to};else{if(c.sel){let A=UB(t,t.state.doc,c.sel);if(A&&!A.eq(t.state.selection)){let U=t.state.tr.setSelection(A);a&&U.setMeta("composition",a),t.dispatch(U)}}return}t.state.selection.from<t.state.selection.to&&y.start==y.endB&&t.state.selection instanceof Vt&&(y.start>t.state.selection.from&&y.start<=t.state.selection.from+2&&t.state.selection.from>=c.from?y.start=t.state.selection.from:y.endA<t.state.selection.to&&y.endA>=t.state.selection.to-2&&t.state.selection.to<=c.to&&(y.endB+=t.state.selection.to-y.endA,y.endA=t.state.selection.to)),Fa&&zu<=11&&y.endB==y.start+1&&y.endA==y.start&&y.start>c.from&&c.doc.textBetween(y.start-c.from-1,y.start-c.from+1)=="  "&&(y.start--,y.endA--,y.endB--);let _=c.doc.resolveNoCache(y.start-c.from),v=c.doc.resolveNoCache(y.endB-c.from),x=d.resolve(y.start),M=_.sameParent(v)&&_.parent.inlineContent&&x.end()>=y.endA;if((Kp&&t.input.lastIOSEnter>Date.now()-225&&(!M||r.some(A=>A.nodeName=="DIV"||A.nodeName=="P"))||!M&&_.pos<c.doc.content.size&&(!_.sameParent(v)||!_.parent.inlineContent)&&_.pos<v.pos&&!/\S/.test(c.doc.textBetween(_.pos,v.pos,"","")))&&t.someProp("handleKeyDown",A=>A(t,Xd(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>y.start&&eMe(d,y.start,y.endA,_,v)&&t.someProp("handleKeyDown",A=>A(t,Xd(8,"Backspace")))){Ql&&ta&&t.domObserver.suppressSelectionUpdates();return}ta&&y.endB==y.start&&(t.input.lastChromeDelete=Date.now()),Ql&&!M&&_.start()!=v.start()&&v.parentOffset==0&&_.depth==v.depth&&c.sel&&c.sel.anchor==c.sel.head&&c.sel.head==y.endA&&(y.endB-=2,v=c.doc.resolveNoCache(y.endB-c.from),setTimeout(()=>{t.someProp("handleKeyDown",function(A){return A(t,Xd(13,"Enter"))})},20));let w=y.start,T=y.endA,C=A=>{let U=A||t.state.tr.replace(w,T,c.doc.slice(y.start-c.from,y.endB-c.from));if(c.sel){let N=UB(t,U.doc,c.sel);N&&!(ta&&t.composing&&N.empty&&(y.start!=y.endB||t.input.lastChromeDelete<Date.now()-100)&&(N.head==w||N.head==U.mapping.map(T)-1)||Fa&&N.empty&&N.head==w)&&U.setSelection(N)}return a&&U.setMeta("composition",a),U.scrollIntoView()},P;if(M)if(_.pos==v.pos){Fa&&zu<=11&&_.parentOffset==0&&(t.domObserver.suppressSelectionUpdates(),setTimeout(()=>sc(t),20));let A=C(t.state.tr.delete(w,T)),U=d.resolve(y.start).marksAcross(d.resolve(y.endA));U&&A.ensureMarks(U),t.dispatch(A)}else if(y.endA==y.endB&&(P=Jwe(_.parent.content.cut(_.parentOffset,v.parentOffset),x.parent.content.cut(x.parentOffset,y.endA-x.start())))){let A=C(t.state.tr);P.type=="add"?A.addMark(w,T,P.mark):A.removeMark(w,T,P.mark),t.dispatch(A)}else if(_.parent.child(_.index()).isText&&_.index()==v.index()-(v.textOffset?0:1)){let A=_.parent.textBetween(_.parentOffset,v.parentOffset),U=()=>C(t.state.tr.insertText(A,w,T));t.someProp("handleTextInput",N=>N(t,w,T,A,U))||t.dispatch(U())}else t.dispatch(C());else t.dispatch(C())}function UB(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:gD(t,e.resolve(n.anchor),e.resolve(n.head))}function Jwe(t,e){let n=t.firstChild.marks,i=e.firstChild.marks,r=n,a=i,s,o,l;for(let d=0;d<i.length;d++)r=i[d].removeFromSet(r);for(let d=0;d<n.length;d++)a=n[d].removeFromSet(a);if(r.length==1&&a.length==0)o=r[0],s="add",l=d=>d.mark(o.addToSet(d.marks));else if(r.length==0&&a.length==1)o=a[0],s="remove",l=d=>d.mark(o.removeFromSet(d.marks));else return null;let c=[];for(let d=0;d<e.childCount;d++)c.push(l(e.child(d)));if(ht.from(c).eq(t))return{mark:o,type:s}}function eMe(t,e,n,i,r){if(n-e<=r.pos-i.pos||n2(i,!0,!1)<r.pos)return!1;let a=t.resolve(e);if(!i.parent.isTextblock){let o=a.nodeAfter;return o!=null&&n==e+o.nodeSize}if(a.parentOffset<a.parent.content.size||!a.parent.isTextblock)return!1;let s=t.resolve(n2(a,!0,!0));return!s.parent.isTextblock||s.pos>n||n2(s,!0,!1)<n?!1:i.parent.content.cut(i.parentOffset).eq(s.parent.content)}function n2(t,e,n){let i=t.depth,r=e?t.end():t.pos;for(;i>0&&(e||t.indexAfter(i)==t.node(i).childCount);)i--,r++,e=!1;if(n){let a=t.node(i).maybeChild(t.indexAfter(i));for(;a&&!a.isLeaf;)a=a.firstChild,r++}return r}function tMe(t,e,n,i,r){let a=t.findDiffStart(e,n);if(a==null)return null;let{a:s,b:o}=t.findDiffEnd(e,n+t.size,n+e.size);if(r=="end"){let l=Math.max(0,a-Math.min(s,o));i-=s+l-a}if(s<a&&t.size<e.size){let l=i<=a&&i>=s?a-i:0;a-=l,a&&a<e.size&&jB(e.textBetween(a-1,a+1))&&(a+=l?1:-1),o=a+(o-s),s=a}else if(o<a){let l=i<=a&&i>=o?a-i:0;a-=l,a&&a<t.size&&jB(t.textBetween(a-1,a+1))&&(a+=l?1:-1),s=a+(s-o),o=a}return{start:a,endA:s,endB:o}}function jB(t){if(t.length!=2)return!1;let e=t.charCodeAt(0),n=t.charCodeAt(1);return e>=56320&&e<=57343&&n>=55296&&n<=56319}class ZW{constructor(e,n){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new bwe,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(VB),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):typeof e=="function"?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=BB(this),zB(this),this.nodeViews=HB(this),this.docView=yB(this.state.doc,FB(this),t2(this),this.dom,this),this.domObserver=new Gwe(this,(i,r,a,s)=>Qwe(this,i,r,a,s)),this.domObserver.start(),_we(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let n in e)this._props[n]=e[n];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&H3(this);let n=this._props;this._props=e,e.plugins&&(e.plugins.forEach(VB),this.directPlugins=e.plugins),this.updateStateInner(e.state,n)}setProps(e){let n={};for(let i in this._props)n[i]=this._props[i];n.state=this.state;for(let i in e)n[i]=e[i];this.update(n)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,n){var i;let r=this.state,a=!1,s=!1;e.storedMarks&&this.composing&&($W(this),s=!0),this.state=e;let o=r.plugins!=e.plugins||this._props.plugins!=n.plugins;if(o||this._props.plugins!=n.plugins||this._props.nodeViews!=n.nodeViews){let g=HB(this);iMe(g,this.nodeViews)&&(this.nodeViews=g,a=!0)}(o||n.handleDOMEvents!=this._props.handleDOMEvents)&&H3(this),this.editable=BB(this),zB(this);let l=t2(this),c=FB(this),d=r.plugins!=e.plugins&&!r.doc.eq(e.doc)?"reset":e.scrollToSelection>r.scrollToSelection?"to selection":"preserve",f=a||!this.docView.matchesNode(e.doc,c,l);(f||!e.selection.eq(r.selection))&&(s=!0);let m=d=="preserve"&&s&&this.dom.style.overflowAnchor==null&&LSe(this);if(s){this.domObserver.stop();let g=f&&(Fa||ta)&&!this.composing&&!r.selection.empty&&!e.selection.empty&&nMe(r.selection,e.selection);if(f){let y=ta?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=Owe(this)),(a||!this.docView.update(e.doc,c,l,this))&&(this.docView.updateOuterDeco(c),this.docView.destroy(),this.docView=yB(e.doc,c,l,this.dom,this)),y&&!this.trackWrites&&(g=!0)}g||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&awe(this))?sc(this,g):(DW(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(r),!((i=this.dragging)===null||i===void 0)&&i.node&&!r.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,r),d=="reset"?this.dom.scrollTop=0:d=="to selection"?this.scrollToSelection():m&&ISe(m)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!this.dom.contains(e.nodeType==1?e:e.parentNode))){if(!this.someProp("handleScrollToSelection",n=>n(this)))if(this.state.selection instanceof Ft){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&hB(this,n.getBoundingClientRect(),e)}else hB(this,this.coordsAtPos(this.state.selection.head,1),e)}}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let n=0;n<this.directPlugins.length;n++){let i=this.directPlugins[n];i.spec.view&&this.pluginViews.push(i.spec.view(this))}for(let n=0;n<this.state.plugins.length;n++){let i=this.state.plugins[n];i.spec.view&&this.pluginViews.push(i.spec.view(this))}}else for(let n=0;n<this.pluginViews.length;n++){let i=this.pluginViews[n];i.update&&i.update(this,e)}}updateDraggedNode(e,n){let i=e.node,r=-1;if(this.state.doc.nodeAt(i.from)==i.node)r=i.from;else{let a=i.from+(this.state.doc.content.size-n.doc.content.size);(a>0&&this.state.doc.nodeAt(a))==i.node&&(r=a)}this.dragging=new WW(e.slice,e.move,r<0?void 0:Ft.create(this.state.doc,r))}someProp(e,n){let i=this._props&&this._props[e],r;if(i!=null&&(r=n?n(i):i))return r;for(let s=0;s<this.directPlugins.length;s++){let o=this.directPlugins[s].props[e];if(o!=null&&(r=n?n(o):o))return r}let a=this.state.plugins;if(a)for(let s=0;s<a.length;s++){let o=a[s].props[e];if(o!=null&&(r=n?n(o):o))return r}}hasFocus(){if(Fa){let e=this.root.activeElement;if(e==this.dom)return!0;if(!e||!this.dom.contains(e))return!1;for(;e&&this.dom!=e&&this.dom.contains(e);){if(e.contentEditable=="false")return!1;e=e.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&USe(this.dom),sc(this),this.domObserver.start()}get root(){let e=this._root;if(e==null){for(let n=this.dom.parentNode;n;n=n.parentNode)if(n.nodeType==9||n.nodeType==11&&n.host)return n.getSelection||(Object.getPrototypeOf(n).getSelection=()=>n.ownerDocument.getSelection()),this._root=n}return e||document}updateRoot(){this._root=null}posAtCoords(e){return HSe(this,e)}coordsAtPos(e,n=1){return MW(this,e,n)}domAtPos(e,n=0){return this.docView.domFromPos(e,n)}nodeDOM(e){let n=this.docView.descAt(e);return n?n.nodeDOM:null}posAtDOM(e,n,i=-1){let r=this.docView.posFromDOM(e,n,i);if(r==null)throw new RangeError("DOM position not inside the editor");return r}endOfTextblock(e,n){return qSe(this,n||this.state,e)}pasteHTML(e,n){return tx(this,"",e,!1,n||new ClipboardEvent("paste"))}pasteText(e,n){return tx(this,e,null,!0,n||new ClipboardEvent("paste"))}serializeForClipboard(e){return xD(this,e)}destroy(){this.docView&&(Swe(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],t2(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,MSe())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return Mwe(this,e)}domSelectionRange(){let e=this.domSelection();return e?va&&this.root.nodeType===11&&NSe(this.dom.ownerDocument)==this.dom&&qwe(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}ZW.prototype.dispatch=function(t){let e=this._props.dispatchTransaction;e?e.call(this,t):this.updateState(this.state.apply(t))};function FB(t){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(t.editable),t.someProp("attributes",n=>{if(typeof n=="function"&&(n=n(t.state)),n)for(let i in n)i=="class"?e.class+=" "+n[i]:i=="style"?e.style=(e.style?e.style+";":"")+n[i]:!e[i]&&i!="contenteditable"&&i!="nodeName"&&(e[i]=String(n[i]))}),e.translate||(e.translate="no"),[ha.node(0,t.state.doc.content.size,e)]}function zB(t){if(t.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),t.cursorWrapper={dom:e,deco:ha.widget(t.state.selection.from,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function BB(t){return!t.someProp("editable",e=>e(t.state)===!1)}function nMe(t,e){let n=Math.min(t.$anchor.sharedDepth(t.head),e.$anchor.sharedDepth(e.head));return t.$anchor.start(n)!=e.$anchor.start(n)}function HB(t){let e=Object.create(null);function n(i){for(let r in i)Object.prototype.hasOwnProperty.call(e,r)||(e[r]=i[r])}return t.someProp("nodeViews",n),t.someProp("markViews",n),e}function iMe(t,e){let n=0,i=0;for(let r in t){if(t[r]!=e[r])return!0;n++}for(let r in e)i++;return n!=i}function VB(t){if(t.spec.state||t.spec.filterTransaction||t.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}var Ku={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},l1={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},rMe=typeof navigator<"u"&&/Mac/.test(navigator.platform),aMe=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var $r=0;$r<10;$r++)Ku[48+$r]=Ku[96+$r]=String($r);for(var $r=1;$r<=24;$r++)Ku[$r+111]="F"+$r;for(var $r=65;$r<=90;$r++)Ku[$r]=String.fromCharCode($r+32),l1[$r]=String.fromCharCode($r);for(var i2 in Ku)l1.hasOwnProperty(i2)||(l1[i2]=Ku[i2]);function sMe(t){var e=rMe&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||aMe&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?l1:Ku)[t.keyCode]||t.key||"Unidentified";return n=="Esc"&&(n="Escape"),n=="Del"&&(n="Delete"),n=="Left"&&(n="ArrowLeft"),n=="Up"&&(n="ArrowUp"),n=="Right"&&(n="ArrowRight"),n=="Down"&&(n="ArrowDown"),n}const oMe=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),lMe=typeof navigator<"u"&&/Win/.test(navigator.platform);function cMe(t){let e=t.split(/-(?!$)/),n=e[e.length-1];n=="Space"&&(n=" ");let i,r,a,s;for(let o=0;o<e.length-1;o++){let l=e[o];if(/^(cmd|meta|m)$/i.test(l))s=!0;else if(/^a(lt)?$/i.test(l))i=!0;else if(/^(c|ctrl|control)$/i.test(l))r=!0;else if(/^s(hift)?$/i.test(l))a=!0;else if(/^mod$/i.test(l))oMe?s=!0:r=!0;else throw new Error("Unrecognized modifier name: "+l)}return i&&(n="Alt-"+n),r&&(n="Ctrl-"+n),s&&(n="Meta-"+n),a&&(n="Shift-"+n),n}function uMe(t){let e=Object.create(null);for(let n in t)e[cMe(n)]=t[n];return e}function r2(t,e,n=!0){return e.altKey&&(t="Alt-"+t),e.ctrlKey&&(t="Ctrl-"+t),e.metaKey&&(t="Meta-"+t),n&&e.shiftKey&&(t="Shift-"+t),t}function dMe(t){return new xi({props:{handleKeyDown:QW(t)}})}function QW(t){let e=uMe(t);return function(n,i){let r=sMe(i),a,s=e[r2(r,i)];if(s&&s(n.state,n.dispatch,n))return!0;if(r.length==1&&r!=" "){if(i.shiftKey){let o=e[r2(r,i,!1)];if(o&&o(n.state,n.dispatch,n))return!0}if((i.altKey||i.metaKey||i.ctrlKey)&&!(lMe&&i.ctrlKey&&i.altKey)&&(a=Ku[i.keyCode])&&a!=r){let o=e[r2(a,i)];if(o&&o(n.state,n.dispatch,n))return!0}}return!1}}var fMe=Object.defineProperty,wD=(t,e)=>{for(var n in e)fMe(t,n,{get:e[n],enumerable:!0})};function ow(t){const{state:e,transaction:n}=t;let{selection:i}=n,{doc:r}=n,{storedMarks:a}=n;return{...e,apply:e.apply.bind(e),applyTransaction:e.applyTransaction.bind(e),plugins:e.plugins,schema:e.schema,reconfigure:e.reconfigure.bind(e),toJSON:e.toJSON.bind(e),get storedMarks(){return a},get selection(){return i},get doc(){return r},get tr(){return i=n.selection,r=n.doc,a=n.storedMarks,n}}}var lw=class{constructor(t){this.editor=t.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=t.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:t,editor:e,state:n}=this,{view:i}=e,{tr:r}=n,a=this.buildProps(r);return Object.fromEntries(Object.entries(t).map(([s,o])=>[s,(...c)=>{const d=o(...c)(a);return!r.getMeta("preventDispatch")&&!this.hasCustomState&&i.dispatch(r),d}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(t,e=!0){const{rawCommands:n,editor:i,state:r}=this,{view:a}=i,s=[],o=!!t,l=t||r.tr,c=()=>(!o&&e&&!l.getMeta("preventDispatch")&&!this.hasCustomState&&a.dispatch(l),s.every(f=>f===!0)),d={...Object.fromEntries(Object.entries(n).map(([f,m])=>[f,(...y)=>{const _=this.buildProps(l,e),v=m(...y)(_);return s.push(v),d}])),run:c};return d}createCan(t){const{rawCommands:e,state:n}=this,i=!1,r=t||n.tr,a=this.buildProps(r,i);return{...Object.fromEntries(Object.entries(e).map(([o,l])=>[o,(...c)=>l(...c)({...a,dispatch:void 0})])),chain:()=>this.createChain(r,i)}}buildProps(t,e=!0){const{rawCommands:n,editor:i,state:r}=this,{view:a}=i,s={tr:t,editor:i,view:a,state:ow({state:r,transaction:t}),dispatch:e?()=>{}:void 0,chain:()=>this.createChain(t,e),can:()=>this.createCan(t),get commands(){return Object.fromEntries(Object.entries(n).map(([o,l])=>[o,(...c)=>l(...c)(s)]))}};return s}},JW={};wD(JW,{blur:()=>hMe,clearContent:()=>pMe,clearNodes:()=>mMe,command:()=>gMe,createParagraphNear:()=>xMe,cut:()=>vMe,deleteCurrentNode:()=>yMe,deleteNode:()=>bMe,deleteRange:()=>_Me,deleteSelection:()=>SMe,enter:()=>wMe,exitCode:()=>MMe,extendMarkRange:()=>EMe,first:()=>AMe,focus:()=>CMe,forEach:()=>NMe,insertContent:()=>RMe,insertContentAt:()=>kMe,joinBackward:()=>IMe,joinDown:()=>LMe,joinForward:()=>UMe,joinItemBackward:()=>jMe,joinItemForward:()=>FMe,joinTextblockBackward:()=>zMe,joinTextblockForward:()=>BMe,joinUp:()=>OMe,keyboardShortcut:()=>VMe,lift:()=>$Me,liftEmptyBlock:()=>GMe,liftListItem:()=>WMe,newlineInCode:()=>qMe,resetAttributes:()=>XMe,scrollIntoView:()=>KMe,selectAll:()=>YMe,selectNodeBackward:()=>ZMe,selectNodeForward:()=>QMe,selectParentNode:()=>JMe,selectTextblockEnd:()=>eEe,selectTextblockStart:()=>tEe,setContent:()=>nEe,setMark:()=>bEe,setMeta:()=>_Ee,setNode:()=>SEe,setNodeSelection:()=>wEe,setTextDirection:()=>MEe,setTextSelection:()=>EEe,sinkListItem:()=>AEe,splitBlock:()=>TEe,splitListItem:()=>CEe,toggleList:()=>NEe,toggleMark:()=>REe,toggleNode:()=>PEe,toggleWrap:()=>DEe,undoInputRule:()=>kEe,unsetAllMarks:()=>OEe,unsetMark:()=>LEe,unsetTextDirection:()=>IEe,updateAttributes:()=>UEe,wrapIn:()=>jEe,wrapInList:()=>FEe});var hMe=()=>({editor:t,view:e})=>(requestAnimationFrame(()=>{var n;t.isDestroyed||(e.dom.blur(),(n=window?.getSelection())==null||n.removeAllRanges())}),!0),pMe=(t=!0)=>({commands:e})=>e.setContent("",{emitUpdate:t}),mMe=()=>({state:t,tr:e,dispatch:n})=>{const{selection:i}=e,{ranges:r}=i;return n&&r.forEach(({$from:a,$to:s})=>{t.doc.nodesBetween(a.pos,s.pos,(o,l)=>{if(o.type.isText)return;const{doc:c,mapping:d}=e,f=c.resolve(d.map(l)),m=c.resolve(d.map(l+o.nodeSize)),g=f.blockRange(m);if(!g)return;const y=vm(g);if(o.type.isTextblock){const{defaultType:_}=f.parent.contentMatchAt(f.index());e.setNodeMarkup(g.start,_)}(y||y===0)&&e.lift(g,y)})}),!0},gMe=t=>e=>t(e),xMe=()=>({state:t,dispatch:e})=>pW(t,e),vMe=(t,e)=>({editor:n,tr:i})=>{const{state:r}=n,a=r.doc.slice(t.from,t.to);i.deleteRange(t.from,t.to);const s=i.mapping.map(e);return i.insert(s,a.content),i.setSelection(new Vt(i.doc.resolve(Math.max(s-1,0)))),!0},yMe=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,i=n.$anchor.node();if(i.content.size>0)return!1;const r=t.selection.$anchor;for(let a=r.depth;a>0;a-=1)if(r.node(a).type===i.type){if(e){const o=r.before(a),l=r.after(a);t.delete(o,l).scrollIntoView()}return!0}return!1};function Ki(t,e){if(typeof t=="string"){if(!e.nodes[t])throw Error(`There is no node type named '${t}'. Maybe you forgot to add the extension?`);return e.nodes[t]}return t}var bMe=t=>({tr:e,state:n,dispatch:i})=>{const r=Ki(t,n.schema),a=e.selection.$anchor;for(let s=a.depth;s>0;s-=1)if(a.node(s).type===r){if(i){const l=a.before(s),c=a.after(s);e.delete(l,c).scrollIntoView()}return!0}return!1},_Me=t=>({tr:e,dispatch:n})=>{const{from:i,to:r}=t;return n&&e.delete(i,r),!0},SMe=()=>({state:t,dispatch:e})=>cD(t,e),wMe=()=>({commands:t})=>t.keyboardShortcut("Enter"),MMe=()=>({state:t,dispatch:e})=>cSe(t,e);function MD(t){return Object.prototype.toString.call(t)==="[object RegExp]"}function c1(t,e,n={strict:!0}){const i=Object.keys(e);return i.length?i.every(r=>n.strict?e[r]===t[r]:MD(e[r])?e[r].test(t[r]):e[r]===t[r]):!0}function eq(t,e,n={}){return t.find(i=>i.type===e&&c1(Object.fromEntries(Object.keys(n).map(r=>[r,i.attrs[r]])),n))}function $B(t,e,n={}){return!!eq(t,e,n)}function ED(t,e,n){var i;if(!t||!e)return;let r=t.parent.childAfter(t.parentOffset);if((!r.node||!r.node.marks.some(d=>d.type===e))&&(r=t.parent.childBefore(t.parentOffset)),!r.node||!r.node.marks.some(d=>d.type===e)||(n=n||((i=r.node.marks[0])==null?void 0:i.attrs),!eq([...r.node.marks],e,n)))return;let s=r.index,o=t.start()+r.offset,l=s+1,c=o+r.node.nodeSize;for(;s>0&&$B([...t.parent.child(s-1).marks],e,n);)s-=1,o-=t.parent.child(s).nodeSize;for(;l<t.parent.childCount&&$B([...t.parent.child(l).marks],e,n);)c+=t.parent.child(l).nodeSize,l+=1;return{from:o,to:c}}function wc(t,e){if(typeof t=="string"){if(!e.marks[t])throw Error(`There is no mark type named '${t}'. Maybe you forgot to add the extension?`);return e.marks[t]}return t}var EMe=(t,e={})=>({tr:n,state:i,dispatch:r})=>{const a=wc(t,i.schema),{doc:s,selection:o}=n,{$from:l,from:c,to:d}=o;if(r){const f=ED(l,a,e);if(f&&f.from<=c&&f.to>=d){const m=Vt.create(s,f.from,f.to);n.setSelection(m)}}return!0},AMe=t=>e=>{const n=typeof t=="function"?t(e):t;for(let i=0;i<n.length;i+=1)if(n[i](e))return!0;return!1};function tq(t){return t instanceof Vt}function Jd(t=0,e=0,n=0){return Math.min(Math.max(t,e),n)}function nq(t,e=null){if(!e)return null;const n=sn.atStart(t),i=sn.atEnd(t);if(e==="start"||e===!0)return n;if(e==="end")return i;const r=n.from,a=i.to;return e==="all"?Vt.create(t,Jd(0,r,a),Jd(t.content.size,r,a)):Vt.create(t,Jd(e,r,a),Jd(e,r,a))}function TMe(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}function AD(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}var CMe=(t=null,e={})=>({editor:n,view:i,tr:r,dispatch:a})=>{e={scrollIntoView:!0,...e};const s=()=>{(AD()||TMe())&&i.dom.focus(),requestAnimationFrame(()=>{n.isDestroyed||(i.focus(),e?.scrollIntoView&&n.commands.scrollIntoView())})};if(i.hasFocus()&&t===null||t===!1)return!0;if(a&&t===null&&!tq(n.state.selection))return s(),!0;const o=nq(r.doc,t)||n.state.selection,l=n.state.selection.eq(o);return a&&(l||r.setSelection(o),l&&r.storedMarks&&r.setStoredMarks(r.storedMarks),s()),!0},NMe=(t,e)=>n=>t.every((i,r)=>e(i,{...n,index:r})),RMe=(t,e)=>({tr:n,commands:i})=>i.insertContentAt({from:n.selection.from,to:n.selection.to},t,e),iq=t=>{const e=t.childNodes;for(let n=e.length-1;n>=0;n-=1){const i=e[n];i.nodeType===3&&i.nodeValue&&/^(\n\s\s|\n)$/.test(i.nodeValue)?t.removeChild(i):i.nodeType===1&&iq(i)}return t};function Rb(t){if(typeof window>"u")throw new Error("[tiptap error]: there is no window object available, so this function cannot be used");const e=`<body>${t}</body>`,n=new window.DOMParser().parseFromString(e,"text/html").body;return iq(n)}function ix(t,e,n){if(t instanceof Fu||t instanceof ht)return t;n={slice:!0,parseOptions:{},...n};const i=typeof t=="object"&&t!==null,r=typeof t=="string";if(i)try{if(Array.isArray(t)&&t.length>0)return ht.fromArray(t.map(o=>e.nodeFromJSON(o)));const s=e.nodeFromJSON(t);return n.errorOnInvalidContent&&s.check(),s}catch(a){if(n.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:a});return console.warn("[tiptap warn]: Invalid content.","Passed value:",t,"Error:",a),ix("",e,n)}if(r){if(n.errorOnInvalidContent){let s=!1,o="";const l=new B7({topNode:e.spec.topNode,marks:e.spec.marks,nodes:e.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:c=>(s=!0,o=typeof c=="string"?c:c.outerHTML,null)}]}})});if(n.slice?m0.fromSchema(l).parseSlice(Rb(t),n.parseOptions):m0.fromSchema(l).parse(Rb(t),n.parseOptions),n.errorOnInvalidContent&&s)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${o}`)})}const a=m0.fromSchema(e);return n.slice?a.parseSlice(Rb(t),n.parseOptions).content:a.parse(Rb(t),n.parseOptions)}return ix("",e,n)}function PMe(t,e,n){const i=t.steps.length-1;if(i<e)return;const r=t.steps[i];if(!(r instanceof Mr||r instanceof Ar))return;const a=t.mapping.maps[i];let s=0;a.forEach((o,l,c,d)=>{s===0&&(s=d)}),t.setSelection(sn.near(t.doc.resolve(s),n))}var DMe=t=>!("type"in t),kMe=(t,e,n)=>({tr:i,dispatch:r,editor:a})=>{var s;if(r){n={parseOptions:a.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let o;const l=v=>{a.emit("contentError",{editor:a,error:v,disableCollaboration:()=>{"collaboration"in a.storage&&typeof a.storage.collaboration=="object"&&a.storage.collaboration&&(a.storage.collaboration.isDisabled=!0)}})},c={preserveWhitespace:"full",...n.parseOptions};if(!n.errorOnInvalidContent&&!a.options.enableContentCheck&&a.options.emitContentError)try{ix(e,a.schema,{parseOptions:c,errorOnInvalidContent:!0})}catch(v){l(v)}try{o=ix(e,a.schema,{parseOptions:c,errorOnInvalidContent:(s=n.errorOnInvalidContent)!=null?s:a.options.enableContentCheck})}catch(v){return l(v),!1}let{from:d,to:f}=typeof t=="number"?{from:t,to:t}:{from:t.from,to:t.to},m=!0,g=!0;if((DMe(o)?o:[o]).forEach(v=>{v.check(),m=m?v.isText&&v.marks.length===0:!1,g=g?v.isBlock:!1}),d===f&&g){const{parent:v}=i.doc.resolve(d);v.isTextblock&&!v.type.spec.code&&!v.childCount&&(d-=1,f+=1)}let _;if(m){if(Array.isArray(e))_=e.map(v=>v.text||"").join("");else if(e instanceof ht){let v="";e.forEach(x=>{x.text&&(v+=x.text)}),_=v}else typeof e=="object"&&e&&e.text?_=e.text:_=e;i.insertText(_,d,f)}else{_=o;const v=i.doc.resolve(d),x=v.node(),M=v.parentOffset===0,w=x.isText||x.isTextblock,T=x.content.size>0;M&&w&&T&&(d=Math.max(0,d-1)),i.replaceWith(d,f,_)}n.updateSelection&&PMe(i,i.steps.length-1,-1),n.applyInputRules&&i.setMeta("applyInputRules",{from:d,text:_}),n.applyPasteRules&&i.setMeta("applyPasteRules",{from:d,text:_})}return!0},OMe=()=>({state:t,dispatch:e})=>sSe(t,e),LMe=()=>({state:t,dispatch:e})=>oSe(t,e),IMe=()=>({state:t,dispatch:e})=>oW(t,e),UMe=()=>({state:t,dispatch:e})=>dW(t,e),jMe=()=>({state:t,dispatch:e,tr:n})=>{try{const i=tw(t.doc,t.selection.$from.pos,-1);return i==null?!1:(n.join(i,2),e&&e(n),!0)}catch{return!1}},FMe=()=>({state:t,dispatch:e,tr:n})=>{try{const i=tw(t.doc,t.selection.$from.pos,1);return i==null?!1:(n.join(i,2),e&&e(n),!0)}catch{return!1}},zMe=()=>({state:t,dispatch:e})=>rSe(t,e),BMe=()=>({state:t,dispatch:e})=>aSe(t,e);function rq(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function HMe(t){const e=t.split(/-(?!$)/);let n=e[e.length-1];n==="Space"&&(n=" ");let i,r,a,s;for(let o=0;o<e.length-1;o+=1){const l=e[o];if(/^(cmd|meta|m)$/i.test(l))s=!0;else if(/^a(lt)?$/i.test(l))i=!0;else if(/^(c|ctrl|control)$/i.test(l))r=!0;else if(/^s(hift)?$/i.test(l))a=!0;else if(/^mod$/i.test(l))AD()||rq()?s=!0:r=!0;else throw new Error(`Unrecognized modifier name: ${l}`)}return i&&(n=`Alt-${n}`),r&&(n=`Ctrl-${n}`),s&&(n=`Meta-${n}`),a&&(n=`Shift-${n}`),n}var VMe=t=>({editor:e,view:n,tr:i,dispatch:r})=>{const a=HMe(t).split(/-(?!$)/),s=a.find(c=>!["Alt","Ctrl","Meta","Shift"].includes(c)),o=new KeyboardEvent("keydown",{key:s==="Space"?" ":s,altKey:a.includes("Alt"),ctrlKey:a.includes("Ctrl"),metaKey:a.includes("Meta"),shiftKey:a.includes("Shift"),bubbles:!0,cancelable:!0}),l=e.captureTransaction(()=>{n.someProp("handleKeyDown",c=>c(n,o))});return l?.steps.forEach(c=>{const d=c.map(i.mapping);d&&r&&i.maybeStep(d)}),!0};function Yu(t,e,n={}){const{from:i,to:r,empty:a}=t.selection,s=e?Ki(e,t.schema):null,o=[];t.doc.nodesBetween(i,r,(f,m)=>{if(f.isText)return;const g=Math.max(i,m),y=Math.min(r,m+f.nodeSize);o.push({node:f,from:g,to:y})});const l=r-i,c=o.filter(f=>s?s.name===f.node.type.name:!0).filter(f=>c1(f.node.attrs,n,{strict:!1}));return a?!!c.length:c.reduce((f,m)=>f+m.to-m.from,0)>=l}var $Me=(t,e={})=>({state:n,dispatch:i})=>{const r=Ki(t,n.schema);return Yu(n,r,e)?lSe(n,i):!1},GMe=()=>({state:t,dispatch:e})=>mW(t,e),WMe=t=>({state:e,dispatch:n})=>{const i=Ki(t,e.schema);return bSe(i)(e,n)},qMe=()=>({state:t,dispatch:e})=>hW(t,e);function cw(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}function GB(t,e){const n=typeof e=="string"?[e]:e;return Object.keys(t).reduce((i,r)=>(n.includes(r)||(i[r]=t[r]),i),{})}var XMe=(t,e)=>({tr:n,state:i,dispatch:r})=>{let a=null,s=null;const o=cw(typeof t=="string"?t:t.name,i.schema);if(!o)return!1;o==="node"&&(a=Ki(t,i.schema)),o==="mark"&&(s=wc(t,i.schema));let l=!1;return n.selection.ranges.forEach(c=>{i.doc.nodesBetween(c.$from.pos,c.$to.pos,(d,f)=>{a&&a===d.type&&(l=!0,r&&n.setNodeMarkup(f,void 0,GB(d.attrs,e))),s&&d.marks.length&&d.marks.forEach(m=>{s===m.type&&(l=!0,r&&n.addMark(f,f+d.nodeSize,s.create(GB(m.attrs,e))))})})}),l},KMe=()=>({tr:t,dispatch:e})=>(e&&t.scrollIntoView(),!0),YMe=()=>({tr:t,dispatch:e})=>{if(e){const n=new ds(t.doc);t.setSelection(n)}return!0},ZMe=()=>({state:t,dispatch:e})=>cW(t,e),QMe=()=>({state:t,dispatch:e})=>fW(t,e),JMe=()=>({state:t,dispatch:e})=>fSe(t,e),eEe=()=>({state:t,dispatch:e})=>mSe(t,e),tEe=()=>({state:t,dispatch:e})=>pSe(t,e);function V3(t,e,n={},i={}){return ix(t,e,{slice:!1,parseOptions:n,errorOnInvalidContent:i.errorOnInvalidContent})}var nEe=(t,{errorOnInvalidContent:e,emitUpdate:n=!0,parseOptions:i={}}={})=>({editor:r,tr:a,dispatch:s,commands:o})=>{const{doc:l}=a;if(i.preserveWhitespace!=="full"){const c=V3(t,r.schema,i,{errorOnInvalidContent:e??r.options.enableContentCheck});return s&&a.replaceWith(0,l.content.size,c).setMeta("preventUpdate",!n),!0}return s&&a.setMeta("preventUpdate",!n),o.insertContentAt({from:0,to:l.content.size},t,{parseOptions:i,errorOnInvalidContent:e??r.options.enableContentCheck})};function aq(t,e){const n=wc(e,t.schema),{from:i,to:r,empty:a}=t.selection,s=[];a?(t.storedMarks&&s.push(...t.storedMarks),s.push(...t.selection.$head.marks())):t.doc.nodesBetween(i,r,l=>{s.push(...l.marks)});const o=s.find(l=>l.type.name===n.name);return o?{...o.attrs}:{}}function sq(t,e){const n=new iW(t);return e.forEach(i=>{i.steps.forEach(r=>{n.step(r)})}),n}function iEe(t){for(let e=0;e<t.edgeCount;e+=1){const{type:n}=t.edge(e);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}function rEe(t,e,n){const i=[];return t.nodesBetween(e.from,e.to,(r,a)=>{n(r)&&i.push({node:r,pos:a})}),i}function aEe(t,e){for(let n=t.depth;n>0;n-=1){const i=t.node(n);if(e(i))return{pos:n>0?t.before(n):0,start:t.start(n),depth:n,node:i}}}function uw(t){return e=>aEe(e.$from,t)}function jt(t,e,n){return t.config[e]===void 0&&t.parent?jt(t.parent,e,n):typeof t.config[e]=="function"?t.config[e].bind({...n,parent:t.parent?jt(t.parent,e,n):null}):t.config[e]}function TD(t){return t.map(e=>{const n={name:e.name,options:e.options,storage:e.storage},i=jt(e,"addExtensions",n);return i?[e,...TD(i())]:e}).flat(10)}function CD(t,e){const n=Vf.fromSchema(e).serializeFragment(t),r=document.implementation.createHTMLDocument().createElement("div");return r.appendChild(n),r.innerHTML}function oq(t){return typeof t=="function"}function On(t,e=void 0,...n){return oq(t)?e?t.bind(e)(...n):t(...n):t}function sEe(t={}){return Object.keys(t).length===0&&t.constructor===Object}function Yp(t){const e=t.filter(r=>r.type==="extension"),n=t.filter(r=>r.type==="node"),i=t.filter(r=>r.type==="mark");return{baseExtensions:e,nodeExtensions:n,markExtensions:i}}function lq(t){const e=[],{nodeExtensions:n,markExtensions:i}=Yp(t),r=[...n,...i],a={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return t.forEach(s=>{const o={name:s.name,options:s.options,storage:s.storage,extensions:r},l=jt(s,"addGlobalAttributes",o);if(!l)return;l().forEach(d=>{d.types.forEach(f=>{Object.entries(d.attributes).forEach(([m,g])=>{e.push({type:f,name:m,attribute:{...a,...g}})})})})}),r.forEach(s=>{const o={name:s.name,options:s.options,storage:s.storage},l=jt(s,"addAttributes",o);if(!l)return;const c=l();Object.entries(c).forEach(([d,f])=>{const m={...a,...f};typeof m?.default=="function"&&(m.default=m.default()),m?.isRequired&&m?.default===void 0&&delete m.default,e.push({type:s.name,name:d,attribute:m})})}),e}function Ei(...t){return t.filter(e=>!!e).reduce((e,n)=>{const i={...e};return Object.entries(n).forEach(([r,a])=>{if(!i[r]){i[r]=a;return}if(r==="class"){const o=a?String(a).split(" "):[],l=i[r]?i[r].split(" "):[],c=o.filter(d=>!l.includes(d));i[r]=[...l,...c].join(" ")}else if(r==="style"){const o=a?a.split(";").map(d=>d.trim()).filter(Boolean):[],l=i[r]?i[r].split(";").map(d=>d.trim()).filter(Boolean):[],c=new Map;l.forEach(d=>{const[f,m]=d.split(":").map(g=>g.trim());c.set(f,m)}),o.forEach(d=>{const[f,m]=d.split(":").map(g=>g.trim());c.set(f,m)}),i[r]=Array.from(c.entries()).map(([d,f])=>`${d}: ${f}`).join("; ")}else i[r]=a}),i},{})}function u1(t,e){return e.filter(n=>n.type===t.type.name).filter(n=>n.attribute.rendered).map(n=>n.attribute.renderHTML?n.attribute.renderHTML(t.attrs)||{}:{[n.name]:t.attrs[n.name]}).reduce((n,i)=>Ei(n,i),{})}function oEe(t){return typeof t!="string"?t:t.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(t):t==="true"?!0:t==="false"?!1:t}function WB(t,e){return"style"in t?t:{...t,getAttrs:n=>{const i=t.getAttrs?t.getAttrs(n):t.attrs;if(i===!1)return!1;const r=e.reduce((a,s)=>{const o=s.attribute.parseHTML?s.attribute.parseHTML(n):oEe(n.getAttribute(s.name));return o==null?a:{...a,[s.name]:o}},{});return{...i,...r}}}}function qB(t){return Object.fromEntries(Object.entries(t).filter(([e,n])=>e==="attrs"&&sEe(n)?!1:n!=null))}function XB(t){var e,n;const i={};return!((e=t?.attribute)!=null&&e.isRequired)&&"default"in(t?.attribute||{})&&(i.default=t.attribute.default),((n=t?.attribute)==null?void 0:n.validate)!==void 0&&(i.validate=t.attribute.validate),[t.name,i]}function lEe(t,e){var n;const i=lq(t),{nodeExtensions:r,markExtensions:a}=Yp(t),s=(n=r.find(c=>jt(c,"topNode")))==null?void 0:n.name,o=Object.fromEntries(r.map(c=>{const d=i.filter(x=>x.type===c.name),f={name:c.name,options:c.options,storage:c.storage,editor:e},m=t.reduce((x,M)=>{const w=jt(M,"extendNodeSchema",f);return{...x,...w?w(c):{}}},{}),g=qB({...m,content:On(jt(c,"content",f)),marks:On(jt(c,"marks",f)),group:On(jt(c,"group",f)),inline:On(jt(c,"inline",f)),atom:On(jt(c,"atom",f)),selectable:On(jt(c,"selectable",f)),draggable:On(jt(c,"draggable",f)),code:On(jt(c,"code",f)),whitespace:On(jt(c,"whitespace",f)),linebreakReplacement:On(jt(c,"linebreakReplacement",f)),defining:On(jt(c,"defining",f)),isolating:On(jt(c,"isolating",f)),attrs:Object.fromEntries(d.map(XB))}),y=On(jt(c,"parseHTML",f));y&&(g.parseDOM=y.map(x=>WB(x,d)));const _=jt(c,"renderHTML",f);_&&(g.toDOM=x=>_({node:x,HTMLAttributes:u1(x,d)}));const v=jt(c,"renderText",f);return v&&(g.toText=v),[c.name,g]})),l=Object.fromEntries(a.map(c=>{const d=i.filter(v=>v.type===c.name),f={name:c.name,options:c.options,storage:c.storage,editor:e},m=t.reduce((v,x)=>{const M=jt(x,"extendMarkSchema",f);return{...v,...M?M(c):{}}},{}),g=qB({...m,inclusive:On(jt(c,"inclusive",f)),excludes:On(jt(c,"excludes",f)),group:On(jt(c,"group",f)),spanning:On(jt(c,"spanning",f)),code:On(jt(c,"code",f)),attrs:Object.fromEntries(d.map(XB))}),y=On(jt(c,"parseHTML",f));y&&(g.parseDOM=y.map(v=>WB(v,d)));const _=jt(c,"renderHTML",f);return _&&(g.toDOM=v=>_({mark:v,HTMLAttributes:u1(v,d)})),[c.name,g]}));return new B7({topNode:s,nodes:o,marks:l})}function cEe(t){const e=t.filter((n,i)=>t.indexOf(n)!==i);return Array.from(new Set(e))}function ND(t){return t.sort((n,i)=>{const r=jt(n,"priority")||100,a=jt(i,"priority")||100;return r>a?-1:r<a?1:0})}function cq(t){const e=ND(TD(t)),n=cEe(e.map(i=>i.name));return n.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${n.map(i=>`'${i}'`).join(", ")}]. This can lead to issues.`),e}function uq(t,e,n){const{from:i,to:r}=e,{blockSeparator:a=`
  8068. `,textSerializers:s={}}=n||{};let o="";return t.nodesBetween(i,r,(l,c,d,f)=>{var m;l.isBlock&&c>i&&(o+=a);const g=s?.[l.type.name];if(g)return d&&(o+=g({node:l,pos:c,parent:d,index:f,range:e})),!1;l.isText&&(o+=(m=l?.text)==null?void 0:m.slice(Math.max(i,c)-c,r-c))}),o}function uEe(t,e){const n={from:0,to:t.content.size};return uq(t,n,e)}function dq(t){return Object.fromEntries(Object.entries(t.nodes).filter(([,e])=>e.spec.toText).map(([e,n])=>[e,n.spec.toText]))}function dEe(t,e){const n=Ki(e,t.schema),{from:i,to:r}=t.selection,a=[];t.doc.nodesBetween(i,r,o=>{a.push(o)});const s=a.reverse().find(o=>o.type.name===n.name);return s?{...s.attrs}:{}}function fq(t,e){const n=cw(typeof e=="string"?e:e.name,t.schema);return n==="node"?dEe(t,e):n==="mark"?aq(t,e):{}}function fEe(t,e=JSON.stringify){const n={};return t.filter(i=>{const r=e(i);return Object.prototype.hasOwnProperty.call(n,r)?!1:n[r]=!0})}function hEe(t){const e=fEe(t);return e.length===1?e:e.filter((n,i)=>!e.filter((a,s)=>s!==i).some(a=>n.oldRange.from>=a.oldRange.from&&n.oldRange.to<=a.oldRange.to&&n.newRange.from>=a.newRange.from&&n.newRange.to<=a.newRange.to))}function hq(t){const{mapping:e,steps:n}=t,i=[];return e.maps.forEach((r,a)=>{const s=[];if(r.ranges.length)r.forEach((o,l)=>{s.push({from:o,to:l})});else{const{from:o,to:l}=n[a];if(o===void 0||l===void 0)return;s.push({from:o,to:l})}s.forEach(({from:o,to:l})=>{const c=e.slice(a).map(o,-1),d=e.slice(a).map(l),f=e.invert().map(c,-1),m=e.invert().map(d);i.push({oldRange:{from:f,to:m},newRange:{from:c,to:d}})})}),hEe(i)}function RD(t,e,n){const i=[];return t===e?n.resolve(t).marks().forEach(r=>{const a=n.resolve(t),s=ED(a,r.type);s&&i.push({mark:r,...s})}):n.nodesBetween(t,e,(r,a)=>{!r||r?.nodeSize===void 0||i.push(...r.marks.map(s=>({from:a,to:a+r.nodeSize,mark:s})))}),i}var pEe=(t,e,n,i=20)=>{const r=t.doc.resolve(n);let a=i,s=null;for(;a>0&&s===null;){const o=r.node(a);o?.type.name===e?s=o:a-=1}return[s,a]};function a2(t,e){return e.nodes[t]||e.marks[t]||null}function x_(t,e,n){return Object.fromEntries(Object.entries(n).filter(([i])=>{const r=t.find(a=>a.type===e&&a.name===i);return r?r.attribute.keepOnSplit:!1}))}var mEe=(t,e=500)=>{let n="";const i=t.parentOffset;return t.parent.nodesBetween(Math.max(0,i-e),i,(r,a,s,o)=>{var l,c;const d=((c=(l=r.type.spec).toText)==null?void 0:c.call(l,{node:r,pos:a,parent:s,index:o}))||r.textContent||"%leaf%";n+=r.isAtom&&!r.isText?d:d.slice(0,Math.max(0,i-a))}),n};function $3(t,e,n={}){const{empty:i,ranges:r}=t.selection,a=e?wc(e,t.schema):null;if(i)return!!(t.storedMarks||t.selection.$from.marks()).filter(f=>a?a.name===f.type.name:!0).find(f=>c1(f.attrs,n,{strict:!1}));let s=0;const o=[];if(r.forEach(({$from:f,$to:m})=>{const g=f.pos,y=m.pos;t.doc.nodesBetween(g,y,(_,v)=>{if(!_.isText&&!_.marks.length)return;const x=Math.max(g,v),M=Math.min(y,v+_.nodeSize),w=M-x;s+=w,o.push(..._.marks.map(T=>({mark:T,from:x,to:M})))})}),s===0)return!1;const l=o.filter(f=>a?a.name===f.mark.type.name:!0).filter(f=>c1(f.mark.attrs,n,{strict:!1})).reduce((f,m)=>f+m.to-m.from,0),c=o.filter(f=>a?f.mark.type!==a&&f.mark.type.excludes(a):!0).reduce((f,m)=>f+m.to-m.from,0);return(l>0?l+c:l)>=s}function gEe(t,e,n={}){if(!e)return Yu(t,null,n)||$3(t,null,n);const i=cw(e,t.schema);return i==="node"?Yu(t,e,n):i==="mark"?$3(t,e,n):!1}var xEe=(t,e)=>{const{$from:n,$to:i,$anchor:r}=t.selection;if(e){const a=uw(o=>o.type.name===e)(t.selection);if(!a)return!1;const s=t.doc.resolve(a.pos+1);return r.pos+1===s.end()}return!(i.parentOffset<i.parent.nodeSize-2||n.pos!==i.pos)},vEe=t=>{const{$from:e,$to:n}=t.selection;return!(e.parentOffset>0||e.pos!==n.pos)};function KB(t,e){return Array.isArray(e)?e.some(n=>(typeof n=="string"?n:n.name)===t.name):e}function YB(t,e){const{nodeExtensions:n}=Yp(e),i=n.find(s=>s.name===t);if(!i)return!1;const r={name:i.name,options:i.options,storage:i.storage},a=On(jt(i,"group",r));return typeof a!="string"?!1:a.split(" ").includes("list")}function dw(t,{checkChildren:e=!0,ignoreWhitespace:n=!1}={}){var i;if(n){if(t.type.name==="hardBreak")return!0;if(t.isText)return/^\s*$/m.test((i=t.text)!=null?i:"")}if(t.isText)return!t.text;if(t.isAtom||t.isLeaf)return!1;if(t.content.childCount===0)return!0;if(e){let r=!0;return t.content.forEach(a=>{r!==!1&&(dw(a,{ignoreWhitespace:n,checkChildren:e})||(r=!1))}),r}return!1}function pq(t){return t instanceof Ft}function yEe(t,e,n){var i;const{selection:r}=e;let a=null;if(tq(r)&&(a=r.$cursor),a){const o=(i=t.storedMarks)!=null?i:a.marks();return a.parent.type.allowsMarkType(n)&&(!!n.isInSet(o)||!o.some(c=>c.type.excludes(n)))}const{ranges:s}=r;return s.some(({$from:o,$to:l})=>{let c=o.depth===0?t.doc.inlineContent&&t.doc.type.allowsMarkType(n):!1;return t.doc.nodesBetween(o.pos,l.pos,(d,f,m)=>{if(c)return!1;if(d.isInline){const g=!m||m.type.allowsMarkType(n),y=!!n.isInSet(d.marks)||!d.marks.some(_=>_.type.excludes(n));c=g&&y}return!c}),c})}var bEe=(t,e={})=>({tr:n,state:i,dispatch:r})=>{const{selection:a}=n,{empty:s,ranges:o}=a,l=wc(t,i.schema);if(r)if(s){const c=aq(i,l);n.addStoredMark(l.create({...c,...e}))}else o.forEach(c=>{const d=c.$from.pos,f=c.$to.pos;i.doc.nodesBetween(d,f,(m,g)=>{const y=Math.max(g,d),_=Math.min(g+m.nodeSize,f);m.marks.find(x=>x.type===l)?m.marks.forEach(x=>{l===x.type&&n.addMark(y,_,l.create({...x.attrs,...e}))}):n.addMark(y,_,l.create(e))})});return yEe(i,n,l)},_Ee=(t,e)=>({tr:n})=>(n.setMeta(t,e),!0),SEe=(t,e={})=>({state:n,dispatch:i,chain:r})=>{const a=Ki(t,n.schema);let s;return n.selection.$anchor.sameParent(n.selection.$head)&&(s=n.selection.$anchor.parent.attrs),a.isTextblock?r().command(({commands:o})=>uB(a,{...s,...e})(n)?!0:o.clearNodes()).command(({state:o})=>uB(a,{...s,...e})(o,i)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},wEe=t=>({tr:e,dispatch:n})=>{if(n){const{doc:i}=e,r=Jd(t,0,i.content.size),a=Ft.create(i,r);e.setSelection(a)}return!0},MEe=(t,e)=>({tr:n,state:i,dispatch:r})=>{const{selection:a}=i;let s,o;return typeof e=="number"?(s=e,o=e):e&&"from"in e&&"to"in e?(s=e.from,o=e.to):(s=a.from,o=a.to),r&&n.doc.nodesBetween(s,o,(l,c)=>{l.isText||n.setNodeMarkup(c,void 0,{...l.attrs,dir:t})}),!0},EEe=t=>({tr:e,dispatch:n})=>{if(n){const{doc:i}=e,{from:r,to:a}=typeof t=="number"?{from:t,to:t}:t,s=Vt.atStart(i).from,o=Vt.atEnd(i).to,l=Jd(r,s,o),c=Jd(a,s,o),d=Vt.create(i,l,c);e.setSelection(d)}return!0},AEe=t=>({state:e,dispatch:n})=>{const i=Ki(t,e.schema);return wSe(i)(e,n)};function ZB(t,e){const n=t.storedMarks||t.selection.$to.parentOffset&&t.selection.$from.marks();if(n){const i=n.filter(r=>e?.includes(r.type.name));t.tr.ensureMarks(i)}}var TEe=({keepMarks:t=!0}={})=>({tr:e,state:n,dispatch:i,editor:r})=>{const{selection:a,doc:s}=e,{$from:o,$to:l}=a,c=r.extensionManager.attributes,d=x_(c,o.node().type.name,o.node().attrs);if(a instanceof Ft&&a.node.isBlock)return!o.parentOffset||!ac(s,o.pos)?!1:(i&&(t&&ZB(n,r.extensionManager.splittableMarks),e.split(o.pos).scrollIntoView()),!0);if(!o.parent.isBlock)return!1;const f=l.parentOffset===l.parent.content.size,m=o.depth===0?void 0:iEe(o.node(-1).contentMatchAt(o.indexAfter(-1)));let g=f&&m?[{type:m,attrs:d}]:void 0,y=ac(e.doc,e.mapping.map(o.pos),1,g);if(!g&&!y&&ac(e.doc,e.mapping.map(o.pos),1,m?[{type:m}]:void 0)&&(y=!0,g=m?[{type:m,attrs:d}]:void 0),i){if(y&&(a instanceof Vt&&e.deleteSelection(),e.split(e.mapping.map(o.pos),1,g),m&&!f&&!o.parentOffset&&o.parent.type!==m)){const _=e.mapping.map(o.before()),v=e.doc.resolve(_);o.node(-1).canReplaceWith(v.index(),v.index()+1,m)&&e.setNodeMarkup(e.mapping.map(o.before()),m)}t&&ZB(n,r.extensionManager.splittableMarks),e.scrollIntoView()}return y},CEe=(t,e={})=>({tr:n,state:i,dispatch:r,editor:a})=>{var s;const o=Ki(t,i.schema),{$from:l,$to:c}=i.selection,d=i.selection.node;if(d&&d.isBlock||l.depth<2||!l.sameParent(c))return!1;const f=l.node(-1);if(f.type!==o)return!1;const m=a.extensionManager.attributes;if(l.parent.content.size===0&&l.node(-1).childCount===l.indexAfter(-1)){if(l.depth===2||l.node(-3).type!==o||l.index(-2)!==l.node(-2).childCount-1)return!1;if(r){let x=ht.empty;const M=l.index(-1)?1:l.index(-2)?2:3;for(let U=l.depth-M;U>=l.depth-3;U-=1)x=ht.from(l.node(U).copy(x));const w=l.indexAfter(-1)<l.node(-2).childCount?1:l.indexAfter(-2)<l.node(-3).childCount?2:3,T={...x_(m,l.node().type.name,l.node().attrs),...e},C=((s=o.contentMatch.defaultType)==null?void 0:s.createAndFill(T))||void 0;x=x.append(ht.from(o.createAndFill(null,C)||void 0));const P=l.before(l.depth-(M-1));n.replace(P,l.after(-w),new Mt(x,4-M,0));let A=-1;n.doc.nodesBetween(P,n.doc.content.size,(U,N)=>{if(A>-1)return!1;U.isTextblock&&U.content.size===0&&(A=N+1)}),A>-1&&n.setSelection(Vt.near(n.doc.resolve(A))),n.scrollIntoView()}return!0}const g=c.pos===l.end()?f.contentMatchAt(0).defaultType:null,y={...x_(m,f.type.name,f.attrs),...e},_={...x_(m,l.node().type.name,l.node().attrs),...e};n.delete(l.pos,c.pos);const v=g?[{type:o,attrs:y},{type:g,attrs:_}]:[{type:o,attrs:y}];if(!ac(n.doc,l.pos,2))return!1;if(r){const{selection:x,storedMarks:M}=i,{splittableMarks:w}=a.extensionManager,T=M||x.$to.parentOffset&&x.$from.marks();if(n.split(l.pos,2,v).scrollIntoView(),!T||!r)return!0;const C=T.filter(P=>w.includes(P.type.name));n.ensureMarks(C)}return!0},s2=(t,e)=>{const n=uw(s=>s.type===e)(t.selection);if(!n)return!0;const i=t.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(i===void 0)return!0;const r=t.doc.nodeAt(i);return n.node.type===r?.type&&ad(t.doc,n.pos)&&t.join(n.pos),!0},o2=(t,e)=>{const n=uw(s=>s.type===e)(t.selection);if(!n)return!0;const i=t.doc.resolve(n.start).after(n.depth);if(i===void 0)return!0;const r=t.doc.nodeAt(i);return n.node.type===r?.type&&ad(t.doc,i)&&t.join(i),!0},NEe=(t,e,n,i={})=>({editor:r,tr:a,state:s,dispatch:o,chain:l,commands:c,can:d})=>{const{extensions:f,splittableMarks:m}=r.extensionManager,g=Ki(t,s.schema),y=Ki(e,s.schema),{selection:_,storedMarks:v}=s,{$from:x,$to:M}=_,w=x.blockRange(M),T=v||_.$to.parentOffset&&_.$from.marks();if(!w)return!1;const C=uw(P=>YB(P.type.name,f))(_);if(w.depth>=1&&C&&w.depth-C.depth<=1){if(C.node.type===g)return c.liftListItem(y);if(YB(C.node.type.name,f)&&g.validContent(C.node.content)&&o)return l().command(()=>(a.setNodeMarkup(C.pos,g),!0)).command(()=>s2(a,g)).command(()=>o2(a,g)).run()}return!n||!T||!o?l().command(()=>d().wrapInList(g,i)?!0:c.clearNodes()).wrapInList(g,i).command(()=>s2(a,g)).command(()=>o2(a,g)).run():l().command(()=>{const P=d().wrapInList(g,i),A=T.filter(U=>m.includes(U.type.name));return a.ensureMarks(A),P?!0:c.clearNodes()}).wrapInList(g,i).command(()=>s2(a,g)).command(()=>o2(a,g)).run()},REe=(t,e={},n={})=>({state:i,commands:r})=>{const{extendEmptyMarkRange:a=!1}=n,s=wc(t,i.schema);return $3(i,s,e)?r.unsetMark(s,{extendEmptyMarkRange:a}):r.setMark(s,e)},PEe=(t,e,n={})=>({state:i,commands:r})=>{const a=Ki(t,i.schema),s=Ki(e,i.schema),o=Yu(i,a,n);let l;return i.selection.$anchor.sameParent(i.selection.$head)&&(l=i.selection.$anchor.parent.attrs),o?r.setNode(s,l):r.setNode(a,{...l,...n})},DEe=(t,e={})=>({state:n,commands:i})=>{const r=Ki(t,n.schema);return Yu(n,r,e)?i.lift(r):i.wrapIn(r,e)},kEe=()=>({state:t,dispatch:e})=>{const n=t.plugins;for(let i=0;i<n.length;i+=1){const r=n[i];let a;if(r.spec.isInputRules&&(a=r.getState(t))){if(e){const s=t.tr,o=a.transform;for(let l=o.steps.length-1;l>=0;l-=1)s.step(o.steps[l].invert(o.docs[l]));if(a.text){const l=s.doc.resolve(a.from).marks();s.replaceWith(a.from,a.to,t.schema.text(a.text,l))}else s.delete(a.from,a.to)}return!0}}return!1},OEe=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,{empty:i,ranges:r}=n;return i||e&&r.forEach(a=>{t.removeMark(a.$from.pos,a.$to.pos)}),!0},LEe=(t,e={})=>({tr:n,state:i,dispatch:r})=>{var a;const{extendEmptyMarkRange:s=!1}=e,{selection:o}=n,l=wc(t,i.schema),{$from:c,empty:d,ranges:f}=o;if(!r)return!0;if(d&&s){let{from:m,to:g}=o;const y=(a=c.marks().find(v=>v.type===l))==null?void 0:a.attrs,_=ED(c,l,y);_&&(m=_.from,g=_.to),n.removeMark(m,g,l)}else f.forEach(m=>{n.removeMark(m.$from.pos,m.$to.pos,l)});return n.removeStoredMark(l),!0},IEe=t=>({tr:e,state:n,dispatch:i})=>{const{selection:r}=n;let a,s;return typeof t=="number"?(a=t,s=t):t&&"from"in t&&"to"in t?(a=t.from,s=t.to):(a=r.from,s=r.to),i&&e.doc.nodesBetween(a,s,(o,l)=>{if(o.isText)return;const c={...o.attrs};delete c.dir,e.setNodeMarkup(l,void 0,c)}),!0},UEe=(t,e={})=>({tr:n,state:i,dispatch:r})=>{let a=null,s=null;const o=cw(typeof t=="string"?t:t.name,i.schema);if(!o)return!1;o==="node"&&(a=Ki(t,i.schema)),o==="mark"&&(s=wc(t,i.schema));let l=!1;return n.selection.ranges.forEach(c=>{const d=c.$from.pos,f=c.$to.pos;let m,g,y,_;n.selection.empty?i.doc.nodesBetween(d,f,(v,x)=>{a&&a===v.type&&(l=!0,y=Math.max(x,d),_=Math.min(x+v.nodeSize,f),m=x,g=v)}):i.doc.nodesBetween(d,f,(v,x)=>{x<d&&a&&a===v.type&&(l=!0,y=Math.max(x,d),_=Math.min(x+v.nodeSize,f),m=x,g=v),x>=d&&x<=f&&(a&&a===v.type&&(l=!0,r&&n.setNodeMarkup(x,void 0,{...v.attrs,...e})),s&&v.marks.length&&v.marks.forEach(M=>{if(s===M.type&&(l=!0,r)){const w=Math.max(x,d),T=Math.min(x+v.nodeSize,f);n.addMark(w,T,s.create({...M.attrs,...e}))}}))}),g&&(m!==void 0&&r&&n.setNodeMarkup(m,void 0,{...g.attrs,...e}),s&&g.marks.length&&g.marks.forEach(v=>{s===v.type&&r&&n.addMark(y,_,s.create({...v.attrs,...e}))}))}),l},jEe=(t,e={})=>({state:n,dispatch:i})=>{const r=Ki(t,n.schema);return gSe(r,e)(n,i)},FEe=(t,e={})=>({state:n,dispatch:i})=>{const r=Ki(t,n.schema);return xSe(r,e)(n,i)},zEe=class{constructor(){this.callbacks={}}on(e,n){return this.callbacks[e]||(this.callbacks[e]=[]),this.callbacks[e].push(n),this}emit(e,...n){const i=this.callbacks[e];return i&&i.forEach(r=>r.apply(this,n)),this}off(e,n){const i=this.callbacks[e];return i&&(n?this.callbacks[e]=i.filter(r=>r!==n):delete this.callbacks[e]),this}once(e,n){const i=(...r)=>{this.off(e,i),n.apply(this,r)};return this.on(e,i)}removeAllListeners(){this.callbacks={}}},fw=class{constructor(t){var e;this.find=t.find,this.handler=t.handler,this.undoable=(e=t.undoable)!=null?e:!0}},BEe=(t,e)=>{if(MD(e))return e.exec(t);const n=e(t);if(!n)return null;const i=[n.text];return i.index=n.index,i.input=t,i.data=n.data,n.replaceWith&&(n.text.includes(n.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),i.push(n.replaceWith)),i};function Pb(t){var e;const{editor:n,from:i,to:r,text:a,rules:s,plugin:o}=t,{view:l}=n;if(l.composing)return!1;const c=l.state.doc.resolve(i);if(c.parent.type.spec.code||(e=c.nodeBefore||c.nodeAfter)!=null&&e.marks.find(m=>m.type.spec.code))return!1;let d=!1;const f=mEe(c)+a;return s.forEach(m=>{if(d)return;const g=BEe(f,m.find);if(!g)return;const y=l.state.tr,_=ow({state:l.state,transaction:y}),v={from:i-(g[0].length-a.length),to:r},{commands:x,chain:M,can:w}=new lw({editor:n,state:_});m.handler({state:_,range:v,match:g,commands:x,chain:M,can:w})===null||!y.steps.length||(m.undoable&&y.setMeta(o,{transform:y,from:i,to:r,text:a}),l.dispatch(y),d=!0)}),d}function HEe(t){const{editor:e,rules:n}=t,i=new xi({state:{init(){return null},apply(r,a,s){const o=r.getMeta(i);if(o)return o;const l=r.getMeta("applyInputRules");return!!l&&setTimeout(()=>{let{text:d}=l;typeof d=="string"?d=d:d=CD(ht.from(d),s.schema);const{from:f}=l,m=f+d.length;Pb({editor:e,from:f,to:m,text:d,rules:n,plugin:i})}),r.selectionSet||r.docChanged?null:a}},props:{handleTextInput(r,a,s,o){return Pb({editor:e,from:a,to:s,text:o,rules:n,plugin:i})},handleDOMEvents:{compositionend:r=>(setTimeout(()=>{const{$cursor:a}=r.state.selection;a&&Pb({editor:e,from:a.pos,to:a.pos,text:"",rules:n,plugin:i})}),!1)},handleKeyDown(r,a){if(a.key!=="Enter")return!1;const{$cursor:s}=r.state.selection;return s?Pb({editor:e,from:s.pos,to:s.pos,text:`
  8069. `,rules:n,plugin:i}):!1}},isInputRules:!0});return i}function VEe(t){return Object.prototype.toString.call(t).slice(8,-1)}function Db(t){return VEe(t)!=="Object"?!1:t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype}function mq(t,e){const n={...t};return Db(t)&&Db(e)&&Object.keys(e).forEach(i=>{Db(e[i])&&Db(t[i])?n[i]=mq(t[i],e[i]):n[i]=e[i]}),n}var PD=class{constructor(t={}){this.type="extendable",this.parent=null,this.child=null,this.name="",this.config={name:this.name},this.config={...this.config,...t},this.name=this.config.name}get options(){return{...On(jt(this,"addOptions",{name:this.name}))||{}}}get storage(){return{...On(jt(this,"addStorage",{name:this.name,options:this.options}))||{}}}configure(t={}){const e=this.extend({...this.config,addOptions:()=>mq(this.options,t)});return e.name=this.name,e.parent=this.parent,e}extend(t={}){const e=new this.constructor({...this.config,...t});return e.parent=this,this.child=e,e.name="name"in t?t.name:e.parent.name,e}},od=class gq extends PD{constructor(){super(...arguments),this.type="mark"}static create(e={}){const n=typeof e=="function"?e():e;return new gq(n)}static handleExit({editor:e,mark:n}){const{tr:i}=e.state,r=e.state.selection.$from;if(r.pos===r.end()){const s=r.marks();if(!!!s.find(c=>c?.type.name===n.name))return!1;const l=s.find(c=>c?.type.name===n.name);return l&&i.removeStoredMark(l),i.insertText(" ",r.pos),e.view.dispatch(i),!0}return!1}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}};function $Ee(t){return typeof t=="number"}var GEe=class{constructor(t){this.find=t.find,this.handler=t.handler}},WEe=(t,e,n)=>{if(MD(e))return[...t.matchAll(e)];const i=e(t,n);return i?i.map(r=>{const a=[r.text];return a.index=r.index,a.input=t,a.data=r.data,r.replaceWith&&(r.text.includes(r.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),a.push(r.replaceWith)),a}):[]};function qEe(t){const{editor:e,state:n,from:i,to:r,rule:a,pasteEvent:s,dropEvent:o}=t,{commands:l,chain:c,can:d}=new lw({editor:e,state:n}),f=[];return n.doc.nodesBetween(i,r,(g,y)=>{var _,v,x,M,w;if((v=(_=g.type)==null?void 0:_.spec)!=null&&v.code||!(g.isText||g.isTextblock||g.isInline))return;const T=(w=(M=(x=g.content)==null?void 0:x.size)!=null?M:g.nodeSize)!=null?w:0,C=Math.max(i,y),P=Math.min(r,y+T);if(C>=P)return;const A=g.isText?g.text||"":g.textBetween(C-y,P-y,void 0,"");WEe(A,a.find,s).forEach(N=>{if(N.index===void 0)return;const D=C+N.index+1,F=D+N[0].length,I={from:n.tr.mapping.map(D),to:n.tr.mapping.map(F)},W=a.handler({state:n,range:I,match:N,commands:l,chain:c,can:d,pasteEvent:s,dropEvent:o});f.push(W)})}),f.every(g=>g!==null)}var kb=null,XEe=t=>{var e;const n=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=n.clipboardData)==null||e.setData("text/html",t),n};function KEe(t){const{editor:e,rules:n}=t;let i=null,r=!1,a=!1,s=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,o;try{o=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{o=null}const l=({state:d,from:f,to:m,rule:g,pasteEvt:y})=>{const _=d.tr,v=ow({state:d,transaction:_});if(!(!qEe({editor:e,state:v,from:Math.max(f-1,0),to:m.b-1,rule:g,pasteEvent:y,dropEvent:o})||!_.steps.length)){try{o=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{o=null}return s=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,_}};return n.map(d=>new xi({view(f){const m=y=>{var _;i=(_=f.dom.parentElement)!=null&&_.contains(y.target)?f.dom.parentElement:null,i&&(kb=e)},g=()=>{kb&&(kb=null)};return window.addEventListener("dragstart",m),window.addEventListener("dragend",g),{destroy(){window.removeEventListener("dragstart",m),window.removeEventListener("dragend",g)}}},props:{handleDOMEvents:{drop:(f,m)=>{if(a=i===f.dom.parentElement,o=m,!a){const g=kb;g?.isEditable&&setTimeout(()=>{const y=g.state.selection;y&&g.commands.deleteRange({from:y.from,to:y.to})},10)}return!1},paste:(f,m)=>{var g;const y=(g=m.clipboardData)==null?void 0:g.getData("text/html");return s=m,r=!!y?.includes("data-pm-slice"),!1}}},appendTransaction:(f,m,g)=>{const y=f[0],_=y.getMeta("uiEvent")==="paste"&&!r,v=y.getMeta("uiEvent")==="drop"&&!a,x=y.getMeta("applyPasteRules"),M=!!x;if(!_&&!v&&!M)return;if(M){let{text:C}=x;typeof C=="string"?C=C:C=CD(ht.from(C),g.schema);const{from:P}=x,A=P+C.length,U=XEe(C);return l({rule:d,state:g,from:P,to:{b:A},pasteEvt:U})}const w=m.doc.content.findDiffStart(g.doc.content),T=m.doc.content.findDiffEnd(g.doc.content);if(!(!$Ee(w)||!T||w===T.b))return l({rule:d,state:g,from:w,to:T,pasteEvt:s})}}))}var hw=class{constructor(t,e){this.splittableMarks=[],this.editor=e,this.baseExtensions=t,this.extensions=cq(t),this.schema=lEe(this.extensions,e),this.setupExtensions()}get commands(){return this.extensions.reduce((t,e)=>{const n={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:a2(e.name,this.schema)},i=jt(e,"addCommands",n);return i?{...t,...i()}:t},{})}get plugins(){const{editor:t}=this;return ND([...this.extensions].reverse()).flatMap(i=>{const r={name:i.name,options:i.options,storage:this.editor.extensionStorage[i.name],editor:t,type:a2(i.name,this.schema)},a=[],s=jt(i,"addKeyboardShortcuts",r);let o={};if(i.type==="mark"&&jt(i,"exitable",r)&&(o.ArrowRight=()=>od.handleExit({editor:t,mark:i})),s){const m=Object.fromEntries(Object.entries(s()).map(([g,y])=>[g,()=>y({editor:t})]));o={...o,...m}}const l=dMe(o);a.push(l);const c=jt(i,"addInputRules",r);if(KB(i,t.options.enableInputRules)&&c){const m=c();if(m&&m.length){const g=HEe({editor:t,rules:m}),y=Array.isArray(g)?g:[g];a.push(...y)}}const d=jt(i,"addPasteRules",r);if(KB(i,t.options.enablePasteRules)&&d){const m=d();if(m&&m.length){const g=KEe({editor:t,rules:m});a.push(...g)}}const f=jt(i,"addProseMirrorPlugins",r);if(f){const m=f();a.push(...m)}return a})}get attributes(){return lq(this.extensions)}get nodeViews(){const{editor:t}=this,{nodeExtensions:e}=Yp(this.extensions);return Object.fromEntries(e.filter(n=>!!jt(n,"addNodeView")).map(n=>{const i=this.attributes.filter(l=>l.type===n.name),r={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:Ki(n.name,this.schema)},a=jt(n,"addNodeView",r);if(!a)return[];const s=a();if(!s)return[];const o=(l,c,d,f,m)=>{const g=u1(l,i);return s({node:l,view:c,getPos:d,decorations:f,innerDecorations:m,editor:t,extension:n,HTMLAttributes:g})};return[n.name,o]}))}get markViews(){const{editor:t}=this,{markExtensions:e}=Yp(this.extensions);return Object.fromEntries(e.filter(n=>!!jt(n,"addMarkView")).map(n=>{const i=this.attributes.filter(o=>o.type===n.name),r={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:wc(n.name,this.schema)},a=jt(n,"addMarkView",r);if(!a)return[];const s=(o,l,c)=>{const d=u1(o,i);return a()({mark:o,view:l,inline:c,editor:t,extension:n,HTMLAttributes:d,updateAttributes:f=>{uAe(o,t,f)}})};return[n.name,s]}))}setupExtensions(){const t=this.extensions;this.editor.extensionStorage=Object.fromEntries(t.map(e=>[e.name,e.storage])),t.forEach(e=>{var n;const i={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:a2(e.name,this.schema)};e.type==="mark"&&((n=On(jt(e,"keepOnSplit",i)))==null||n)&&this.splittableMarks.push(e.name);const r=jt(e,"onBeforeCreate",i),a=jt(e,"onCreate",i),s=jt(e,"onUpdate",i),o=jt(e,"onSelectionUpdate",i),l=jt(e,"onTransaction",i),c=jt(e,"onFocus",i),d=jt(e,"onBlur",i),f=jt(e,"onDestroy",i);r&&this.editor.on("beforeCreate",r),a&&this.editor.on("create",a),s&&this.editor.on("update",s),o&&this.editor.on("selectionUpdate",o),l&&this.editor.on("transaction",l),c&&this.editor.on("focus",c),d&&this.editor.on("blur",d),f&&this.editor.on("destroy",f)})}};hw.resolve=cq;hw.sort=ND;hw.flatten=TD;var YEe={};wD(YEe,{ClipboardTextSerializer:()=>vq,Commands:()=>yq,Delete:()=>bq,Drop:()=>_q,Editable:()=>Sq,FocusEvents:()=>Mq,Keymap:()=>Eq,Paste:()=>Aq,Tabindex:()=>Tq,TextDirection:()=>Cq,focusEventsPluginKey:()=>wq});var Gn=class xq extends PD{constructor(){super(...arguments),this.type="extension"}static create(e={}){const n=typeof e=="function"?e():e;return new xq(n)}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}},vq=Gn.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new xi({key:new lr("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:t}=this,{state:e,schema:n}=t,{doc:i,selection:r}=e,{ranges:a}=r,s=Math.min(...a.map(d=>d.$from.pos)),o=Math.max(...a.map(d=>d.$to.pos)),l=dq(n);return uq(i,{from:s,to:o},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:l})}}})]}}),yq=Gn.create({name:"commands",addCommands(){return{...JW}}}),bq=Gn.create({name:"delete",onUpdate({transaction:t,appendedTransactions:e}){var n,i,r;const a=()=>{var s,o,l,c;if((c=(l=(o=(s=this.editor.options.coreExtensionOptions)==null?void 0:s.delete)==null?void 0:o.filterTransaction)==null?void 0:l.call(o,t))!=null?c:t.getMeta("y-sync$"))return;const d=sq(t.before,[t,...e]);hq(d).forEach(g=>{d.mapping.mapResult(g.oldRange.from).deletedAfter&&d.mapping.mapResult(g.oldRange.to).deletedBefore&&d.before.nodesBetween(g.oldRange.from,g.oldRange.to,(y,_)=>{const v=_+y.nodeSize-2,x=g.oldRange.from<=_&&v<=g.oldRange.to;this.editor.emit("delete",{type:"node",node:y,from:_,to:v,newFrom:d.mapping.map(_),newTo:d.mapping.map(v),deletedRange:g.oldRange,newRange:g.newRange,partial:!x,editor:this.editor,transaction:t,combinedTransform:d})})});const m=d.mapping;d.steps.forEach((g,y)=>{var _,v;if(g instanceof xo){const x=m.slice(y).map(g.from,-1),M=m.slice(y).map(g.to),w=m.invert().map(x,-1),T=m.invert().map(M),C=(_=d.doc.nodeAt(x-1))==null?void 0:_.marks.some(A=>A.eq(g.mark)),P=(v=d.doc.nodeAt(M))==null?void 0:v.marks.some(A=>A.eq(g.mark));this.editor.emit("delete",{type:"mark",mark:g.mark,from:g.from,to:g.to,deletedRange:{from:w,to:T},newRange:{from:x,to:M},partial:!!(P||C),editor:this.editor,transaction:t,combinedTransform:d})}})};(r=(i=(n=this.editor.options.coreExtensionOptions)==null?void 0:n.delete)==null?void 0:i.async)==null||r?setTimeout(a,0):a()}}),_q=Gn.create({name:"drop",addProseMirrorPlugins(){return[new xi({key:new lr("tiptapDrop"),props:{handleDrop:(t,e,n,i)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:n,moved:i})}}})]}}),Sq=Gn.create({name:"editable",addProseMirrorPlugins(){return[new xi({key:new lr("editable"),props:{editable:()=>this.editor.options.editable}})]}}),wq=new lr("focusEvents"),Mq=Gn.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:t}=this;return[new xi({key:wq,props:{handleDOMEvents:{focus:(e,n)=>{t.isFocused=!0;const i=t.state.tr.setMeta("focus",{event:n}).setMeta("addToHistory",!1);return e.dispatch(i),!1},blur:(e,n)=>{t.isFocused=!1;const i=t.state.tr.setMeta("blur",{event:n}).setMeta("addToHistory",!1);return e.dispatch(i),!1}}}})]}}),Eq=Gn.create({name:"keymap",addKeyboardShortcuts(){const t=()=>this.editor.commands.first(({commands:s})=>[()=>s.undoInputRule(),()=>s.command(({tr:o})=>{const{selection:l,doc:c}=o,{empty:d,$anchor:f}=l,{pos:m,parent:g}=f,y=f.parent.isTextblock&&m>0?o.doc.resolve(m-1):f,_=y.parent.type.spec.isolating,v=f.pos-f.parentOffset,x=_&&y.parent.childCount===1?v===f.pos:sn.atStart(c).from===m;return!d||!g.type.isTextblock||g.textContent.length||!x||x&&f.parent.type.name==="paragraph"?!1:s.clearNodes()}),()=>s.deleteSelection(),()=>s.joinBackward(),()=>s.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:s})=>[()=>s.deleteSelection(),()=>s.deleteCurrentNode(),()=>s.joinForward(),()=>s.selectNodeForward()]),i={Enter:()=>this.editor.commands.first(({commands:s})=>[()=>s.newlineInCode(),()=>s.createParagraphNear(),()=>s.liftEmptyBlock(),()=>s.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:t,"Mod-Backspace":t,"Shift-Backspace":t,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},r={...i},a={...i,"Ctrl-h":t,"Alt-Backspace":t,"Ctrl-d":e,"Ctrl-Alt-Backspace":e,"Alt-Delete":e,"Alt-d":e,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return AD()||rq()?a:r},addProseMirrorPlugins(){return[new xi({key:new lr("clearDocument"),appendTransaction:(t,e,n)=>{if(t.some(_=>_.getMeta("composition")))return;const i=t.some(_=>_.docChanged)&&!e.doc.eq(n.doc),r=t.some(_=>_.getMeta("preventClearDocument"));if(!i||r)return;const{empty:a,from:s,to:o}=e.selection,l=sn.atStart(e.doc).from,c=sn.atEnd(e.doc).to;if(a||!(s===l&&o===c)||!dw(n.doc))return;const m=n.tr,g=ow({state:n,transaction:m}),{commands:y}=new lw({editor:this.editor,state:g});if(y.clearNodes(),!!m.steps.length)return m}})]}}),Aq=Gn.create({name:"paste",addProseMirrorPlugins(){return[new xi({key:new lr("tiptapPaste"),props:{handlePaste:(t,e,n)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:n})}}})]}}),Tq=Gn.create({name:"tabindex",addProseMirrorPlugins(){return[new xi({key:new lr("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}}),Cq=Gn.create({name:"textDirection",addOptions(){return{direction:void 0}},addGlobalAttributes(){if(!this.options.direction)return[];const{nodeExtensions:t}=Yp(this.extensions);return[{types:t.filter(e=>e.name!=="text").map(e=>e.name),attributes:{dir:{default:this.options.direction,parseHTML:e=>{const n=e.getAttribute("dir");return n&&(n==="ltr"||n==="rtl"||n==="auto")?n:this.options.direction},renderHTML:e=>e.dir?{dir:e.dir}:{}}}}]},addProseMirrorPlugins(){return[new xi({key:new lr("textDirection"),props:{attributes:()=>{const t=this.options.direction;return t?{dir:t}:{}}}})]}}),ZEe=class hp{constructor(e,n,i=!1,r=null){this.currentNode=null,this.actualDepth=null,this.isBlock=i,this.resolvedPos=e,this.editor=n,this.currentNode=r}get name(){return this.node.type.name}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var e;return(e=this.actualDepth)!=null?e:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let n=this.from,i=this.to;if(this.isBlock){if(this.content.size===0){console.error(`You can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);return}n=this.from+1,i=this.to-1}this.editor.commands.insertContentAt({from:n,to:i},e)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+(this.node.isText?0:1)}get parent(){if(this.depth===0)return null;const e=this.resolvedPos.start(this.resolvedPos.depth-1),n=this.resolvedPos.doc.resolve(e);return new hp(n,this.editor)}get before(){let e=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.from-3)),new hp(e,this.editor)}get after(){let e=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.to+3)),new hp(e,this.editor)}get children(){const e=[];return this.node.content.forEach((n,i)=>{const r=n.isBlock&&!n.isTextblock,a=n.isAtom&&!n.isText,s=this.pos+i+(a?0:1);if(s<0||s>this.resolvedPos.doc.nodeSize-2)return;const o=this.resolvedPos.doc.resolve(s);if(!r&&o.depth<=this.depth)return;const l=new hp(o,this.editor,r,r?n:null);r&&(l.actualDepth=this.depth+1),e.push(new hp(o,this.editor,r,r?n:null))}),e}get firstChild(){return this.children[0]||null}get lastChild(){const e=this.children;return e[e.length-1]||null}closest(e,n={}){let i=null,r=this.parent;for(;r&&!i;){if(r.node.type.name===e)if(Object.keys(n).length>0){const a=r.node.attrs,s=Object.keys(n);for(let o=0;o<s.length;o+=1){const l=s[o];if(a[l]!==n[l])break}}else i=r;r=r.parent}return i}querySelector(e,n={}){return this.querySelectorAll(e,n,!0)[0]||null}querySelectorAll(e,n={},i=!1){let r=[];if(!this.children||this.children.length===0)return r;const a=Object.keys(n);return this.children.forEach(s=>{i&&r.length>0||(s.node.type.name===e&&a.every(l=>n[l]===s.node.attrs[l])&&r.push(s),!(i&&r.length>0)&&(r=r.concat(s.querySelectorAll(e,n,i))))}),r}setAttribute(e){const{tr:n}=this.editor.state;n.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(n)}},QEe=`.ProseMirror {
  8070. position: relative;
  8071. }
  8072. .ProseMirror {
  8073. word-wrap: break-word;
  8074. white-space: pre-wrap;
  8075. white-space: break-spaces;
  8076. -webkit-font-variant-ligatures: none;
  8077. font-variant-ligatures: none;
  8078. font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */
  8079. }
  8080. .ProseMirror [contenteditable="false"] {
  8081. white-space: normal;
  8082. }
  8083. .ProseMirror [contenteditable="false"] [contenteditable="true"] {
  8084. white-space: pre-wrap;
  8085. }
  8086. .ProseMirror pre {
  8087. white-space: pre-wrap;
  8088. }
  8089. img.ProseMirror-separator {
  8090. display: inline !important;
  8091. border: none !important;
  8092. margin: 0 !important;
  8093. width: 0 !important;
  8094. height: 0 !important;
  8095. }
  8096. .ProseMirror-gapcursor {
  8097. display: none;
  8098. pointer-events: none;
  8099. position: absolute;
  8100. margin: 0;
  8101. }
  8102. .ProseMirror-gapcursor:after {
  8103. content: "";
  8104. display: block;
  8105. position: absolute;
  8106. top: -2px;
  8107. width: 20px;
  8108. border-top: 1px solid black;
  8109. animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;
  8110. }
  8111. @keyframes ProseMirror-cursor-blink {
  8112. to {
  8113. visibility: hidden;
  8114. }
  8115. }
  8116. .ProseMirror-hideselection *::selection {
  8117. background: transparent;
  8118. }
  8119. .ProseMirror-hideselection *::-moz-selection {
  8120. background: transparent;
  8121. }
  8122. .ProseMirror-hideselection * {
  8123. caret-color: transparent;
  8124. }
  8125. .ProseMirror-focused .ProseMirror-gapcursor {
  8126. display: block;
  8127. }`;function JEe(t,e,n){const i=document.querySelector("style[data-tiptap-style]");if(i!==null)return i;const r=document.createElement("style");return e&&r.setAttribute("nonce",e),r.setAttribute("data-tiptap-style",""),r.innerHTML=t,document.getElementsByTagName("head")[0].appendChild(r),r}var eAe=class extends zEe{constructor(t={}){super(),this.css=null,this.className="tiptap",this.editorView=null,this.isFocused=!1,this.isInitialized=!1,this.extensionStorage={},this.instanceId=Math.random().toString(36).slice(2,9),this.options={element:typeof document<"u"?document.createElement("div"):null,content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,textDirection:void 0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,emitContentError:!1,onBeforeCreate:()=>null,onCreate:()=>null,onMount:()=>null,onUnmount:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:i})=>{throw i},onPaste:()=>null,onDrop:()=>null,onDelete:()=>null},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.setOptions(t),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.on("mount",this.options.onMount),this.on("unmount",this.options.onUnmount),this.on("contentError",this.options.onContentError),this.on("create",this.options.onCreate),this.on("update",this.options.onUpdate),this.on("selectionUpdate",this.options.onSelectionUpdate),this.on("transaction",this.options.onTransaction),this.on("focus",this.options.onFocus),this.on("blur",this.options.onBlur),this.on("destroy",this.options.onDestroy),this.on("drop",({event:i,slice:r,moved:a})=>this.options.onDrop(i,r,a)),this.on("paste",({event:i,slice:r})=>this.options.onPaste(i,r)),this.on("delete",this.options.onDelete);const e=this.createDoc(),n=nq(e,this.options.autofocus);this.editorState=yp.create({doc:e,schema:this.schema,selection:n||void 0}),this.options.element&&this.mount(this.options.element)}mount(t){if(typeof document>"u")throw new Error("[tiptap error]: The editor cannot be mounted because there is no 'document' defined in this environment.");this.createView(t),this.emit("mount",{editor:this}),this.css&&!document.head.contains(this.css)&&document.head.appendChild(this.css),window.setTimeout(()=>{this.isDestroyed||(this.options.autofocus!==!1&&this.options.autofocus!==null&&this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)},0)}unmount(){if(this.editorView){const t=this.editorView.dom;t?.editor&&delete t.editor,this.editorView.destroy()}if(this.editorView=null,this.isInitialized=!1,this.css&&!document.querySelectorAll(`.${this.className}`).length)try{typeof this.css.remove=="function"?this.css.remove():this.css.parentNode&&this.css.parentNode.removeChild(this.css)}catch(t){console.warn("Failed to remove CSS element:",t)}this.css=null,this.emit("unmount",{editor:this})}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager.chain()}can(){return this.commandManager.can()}injectCSS(){this.options.injectCSS&&typeof document<"u"&&(this.css=JEe(QEe,this.options.injectNonce))}setOptions(t={}){this.options={...this.options,...t},!(!this.editorView||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(t,e=!0){this.setOptions({editable:t}),e&&this.emit("update",{editor:this,transaction:this.state.tr,appendedTransactions:[]})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get view(){return this.editorView?this.editorView:new Proxy({state:this.editorState,updateState:t=>{this.editorState=t},dispatch:t=>{this.dispatchTransaction(t)},composing:!1,dragging:null,editable:!0,isDestroyed:!1},{get:(t,e)=>{if(this.editorView)return this.editorView[e];if(e==="state")return this.editorState;if(e in t)return Reflect.get(t,e);throw new Error(`[tiptap error]: The editor view is not available. Cannot access view['${e}']. The editor may not be mounted yet.`)}})}get state(){return this.editorView&&(this.editorState=this.view.state),this.editorState}registerPlugin(t,e){const n=oq(e)?e(t,[...this.state.plugins]):[...this.state.plugins,t],i=this.state.reconfigure({plugins:n});return this.view.updateState(i),i}unregisterPlugin(t){if(this.isDestroyed)return;const e=this.state.plugins;let n=e;if([].concat(t).forEach(r=>{const a=typeof r=="string"?`${r}$`:r.key;n=n.filter(s=>!s.key.startsWith(a))}),e.length===n.length)return;const i=this.state.reconfigure({plugins:n});return this.view.updateState(i),i}createExtensionManager(){var t,e;const i=[...this.options.enableCoreExtensions?[Sq,vq.configure({blockSeparator:(e=(t=this.options.coreExtensionOptions)==null?void 0:t.clipboardTextSerializer)==null?void 0:e.blockSeparator}),yq,Mq,Eq,Tq,_q,Aq,bq,Cq.configure({direction:this.options.textDirection})].filter(r=>typeof this.options.enableCoreExtensions=="object"?this.options.enableCoreExtensions[r.name]!==!1:!0):[],...this.options.extensions].filter(r=>["extension","node","mark"].includes(r?.type));this.extensionManager=new hw(i,this)}createCommandManager(){this.commandManager=new lw({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let t;try{t=V3(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(e){if(!(e instanceof Error)||!["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(e.message))throw e;this.emit("contentError",{editor:this,error:e,disableCollaboration:()=>{"collaboration"in this.storage&&typeof this.storage.collaboration=="object"&&this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(n=>n.name!=="collaboration"),this.createExtensionManager()}}),t=V3(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}return t}createView(t){var e;this.editorView=new ZW(t,{...this.options.editorProps,attributes:{role:"textbox",...(e=this.options.editorProps)==null?void 0:e.attributes},dispatchTransaction:this.dispatchTransaction.bind(this),state:this.editorState,markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews});const n=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(n),this.prependClass(),this.injectCSS();const i=this.view.dom;i.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`${this.className} ${this.view.dom.className}`}captureTransaction(t){this.isCapturingTransaction=!0,t(),this.isCapturingTransaction=!1;const e=this.capturedTransaction;return this.capturedTransaction=null,e}dispatchTransaction(t){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=t;return}t.steps.forEach(c=>{var d;return(d=this.capturedTransaction)==null?void 0:d.step(c)});return}const{state:e,transactions:n}=this.state.applyTransaction(t),i=!this.state.selection.eq(e.selection),r=n.includes(t),a=this.state;if(this.emit("beforeTransaction",{editor:this,transaction:t,nextState:e}),!r)return;this.view.updateState(e),this.emit("transaction",{editor:this,transaction:t,appendedTransactions:n.slice(1)}),i&&this.emit("selectionUpdate",{editor:this,transaction:t});const s=n.findLast(c=>c.getMeta("focus")||c.getMeta("blur")),o=s?.getMeta("focus"),l=s?.getMeta("blur");o&&this.emit("focus",{editor:this,event:o.event,transaction:s}),l&&this.emit("blur",{editor:this,event:l.event,transaction:s}),!(t.getMeta("preventUpdate")||!n.some(c=>c.docChanged)||a.doc.eq(e.doc))&&this.emit("update",{editor:this,transaction:t,appendedTransactions:n.slice(1)})}getAttributes(t){return fq(this.state,t)}isActive(t,e){const n=typeof t=="string"?t:null,i=typeof t=="string"?e:t;return gEe(this.state,n,i)}getJSON(){return this.state.doc.toJSON()}getHTML(){return CD(this.state.doc.content,this.schema)}getText(t){const{blockSeparator:e=`
  8128. `,textSerializers:n={}}=t||{};return uEe(this.state.doc,{blockSeparator:e,textSerializers:{...dq(this.schema),...n}})}get isEmpty(){return dw(this.state.doc)}destroy(){this.emit("destroy"),this.unmount(),this.removeAllListeners()}get isDestroyed(){var t,e;return(e=(t=this.editorView)==null?void 0:t.isDestroyed)!=null?e:!0}$node(t,e){var n;return((n=this.$doc)==null?void 0:n.querySelector(t,e))||null}$nodes(t,e){var n;return((n=this.$doc)==null?void 0:n.querySelectorAll(t,e))||null}$pos(t){const e=this.state.doc.resolve(t);return new ZEe(e,this)}get $doc(){return this.$pos(0)}};function Zp(t){return new fw({find:t.find,handler:({state:e,range:n,match:i})=>{const r=On(t.getAttributes,void 0,i);if(r===!1||r===null)return null;const{tr:a}=e,s=i[i.length-1],o=i[0];if(s){const l=o.search(/\S/),c=n.from+o.indexOf(s),d=c+s.length;if(RD(n.from,n.to,e.doc).filter(g=>g.mark.type.excluded.find(_=>_===t.type&&_!==g.mark.type)).filter(g=>g.to>c).length)return null;d<n.to&&a.delete(d,n.to),c>n.from&&a.delete(n.from+l,c);const m=n.from+l+s.length;a.addMark(n.from+l,m,t.type.create(r||{})),a.removeStoredMark(t.type)}},undoable:t.undoable})}function Nq(t){return new fw({find:t.find,handler:({state:e,range:n,match:i})=>{const r=On(t.getAttributes,void 0,i)||{},{tr:a}=e,s=n.from;let o=n.to;const l=t.type.create(r);if(i[1]){const c=i[0].lastIndexOf(i[1]);let d=s+c;d>o?d=o:o=d+i[1].length;const f=i[0][i[0].length-1];a.insertText(f,s+i[0].length-1),a.replaceWith(d,o,l)}else if(i[0]){const c=t.type.isInline?s:s-1;a.insert(c,t.type.create(r)).delete(a.mapping.map(s),a.mapping.map(o))}a.scrollIntoView()},undoable:t.undoable})}function G3(t){return new fw({find:t.find,handler:({state:e,range:n,match:i})=>{const r=e.doc.resolve(n.from),a=On(t.getAttributes,void 0,i)||{};if(!r.node(-1).canReplaceWith(r.index(-1),r.indexAfter(-1),t.type))return null;e.tr.delete(n.from,n.to).setBlockType(n.from,n.from,t.type,a)},undoable:t.undoable})}function Qp(t){return new fw({find:t.find,handler:({state:e,range:n,match:i,chain:r})=>{const a=On(t.getAttributes,void 0,i)||{},s=e.tr.delete(n.from,n.to),l=s.doc.resolve(n.from).blockRange(),c=l&&oD(l,t.type,a);if(!c)return null;if(s.wrap(l,c),t.keepMarks&&t.editor){const{selection:f,storedMarks:m}=e,{splittableMarks:g}=t.editor.extensionManager,y=m||f.$to.parentOffset&&f.$from.marks();if(y){const _=y.filter(v=>g.includes(v.type.name));s.ensureMarks(_)}}if(t.keepAttributes){const f=t.type.name==="bulletList"||t.type.name==="orderedList"?"listItem":"taskList";r().updateAttributes(f,a).run()}const d=s.doc.resolve(n.from-1).nodeBefore;d&&d.type===t.type&&ad(s.doc,n.from-1)&&(!t.joinPredicate||t.joinPredicate(i,d))&&s.join(n.from-1)},undoable:t.undoable})}var tAe=t=>"touches"in t,nAe=class{constructor(t){this.directions=["bottom-left","bottom-right","top-left","top-right"],this.minSize={height:8,width:8},this.preserveAspectRatio=!1,this.classNames={container:"",wrapper:"",handle:"",resizing:""},this.initialWidth=0,this.initialHeight=0,this.aspectRatio=1,this.isResizing=!1,this.activeHandle=null,this.startX=0,this.startY=0,this.startWidth=0,this.startHeight=0,this.isShiftKeyPressed=!1,this.handleMouseMove=s=>{if(!this.isResizing||!this.activeHandle)return;const o=s.clientX-this.startX,l=s.clientY-this.startY;this.handleResize(o,l)},this.handleTouchMove=s=>{if(!this.isResizing||!this.activeHandle)return;const o=s.touches[0];if(!o)return;const l=o.clientX-this.startX,c=o.clientY-this.startY;this.handleResize(l,c)},this.handleMouseUp=()=>{if(!this.isResizing)return;const s=this.element.offsetWidth,o=this.element.offsetHeight;this.onCommit(s,o),this.isResizing=!1,this.activeHandle=null,this.container.dataset.resizeState="false",this.classNames.resizing&&this.container.classList.remove(this.classNames.resizing),document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp),document.removeEventListener("keydown",this.handleKeyDown),document.removeEventListener("keyup",this.handleKeyUp)},this.handleKeyDown=s=>{s.key==="Shift"&&(this.isShiftKeyPressed=!0)},this.handleKeyUp=s=>{s.key==="Shift"&&(this.isShiftKeyPressed=!1)};var e,n,i,r,a;this.node=t.node,this.element=t.element,this.contentElement=t.contentElement,this.getPos=t.getPos,this.onResize=t.onResize,this.onCommit=t.onCommit,this.onUpdate=t.onUpdate,(e=t.options)!=null&&e.min&&(this.minSize={...this.minSize,...t.options.min}),(n=t.options)!=null&&n.max&&(this.maxSize=t.options.max),(i=t?.options)!=null&&i.directions&&(this.directions=t.options.directions),(r=t.options)!=null&&r.preserveAspectRatio&&(this.preserveAspectRatio=t.options.preserveAspectRatio),(a=t.options)!=null&&a.className&&(this.classNames={container:t.options.className.container||"",wrapper:t.options.className.wrapper||"",handle:t.options.className.handle||"",resizing:t.options.className.resizing||""}),this.wrapper=this.createWrapper(),this.container=this.createContainer(),this.applyInitialSize(),this.attachHandles()}get dom(){return this.container}get contentDOM(){return this.contentElement}update(t,e,n){return t.type!==this.node.type?!1:(this.node=t,this.onUpdate?this.onUpdate(t,e,n):!0)}destroy(){this.isResizing&&(this.container.dataset.resizeState="false",this.classNames.resizing&&this.container.classList.remove(this.classNames.resizing),document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp),document.removeEventListener("keydown",this.handleKeyDown),document.removeEventListener("keyup",this.handleKeyUp),this.isResizing=!1,this.activeHandle=null),this.container.remove()}createContainer(){const t=document.createElement("div");return t.dataset.resizeContainer="",t.dataset.node=this.node.type.name,t.style.display="flex",t.style.justifyContent="flex-start",t.style.alignItems="flex-start",this.classNames.container&&(t.className=this.classNames.container),t.appendChild(this.wrapper),t}createWrapper(){const t=document.createElement("div");return t.style.position="relative",t.style.display="block",t.dataset.resizeWrapper="",this.classNames.wrapper&&(t.className=this.classNames.wrapper),t.appendChild(this.element),t}createHandle(t){const e=document.createElement("div");return e.dataset.resizeHandle=t,e.style.position="absolute",this.classNames.handle&&(e.className=this.classNames.handle),e}positionHandle(t,e){const n=e.includes("top"),i=e.includes("bottom"),r=e.includes("left"),a=e.includes("right");n&&(t.style.top="0"),i&&(t.style.bottom="0"),r&&(t.style.left="0"),a&&(t.style.right="0"),(e==="top"||e==="bottom")&&(t.style.left="0",t.style.right="0"),(e==="left"||e==="right")&&(t.style.top="0",t.style.bottom="0")}attachHandles(){this.directions.forEach(t=>{const e=this.createHandle(t);this.positionHandle(e,t),e.addEventListener("mousedown",n=>this.handleResizeStart(n,t)),e.addEventListener("touchstart",n=>this.handleResizeStart(n,t)),this.wrapper.appendChild(e)})}applyInitialSize(){const t=this.node.attrs.width,e=this.node.attrs.height;t?(this.element.style.width=`${t}px`,this.initialWidth=t):this.initialWidth=this.element.offsetWidth,e?(this.element.style.height=`${e}px`,this.initialHeight=e):this.initialHeight=this.element.offsetHeight,this.initialWidth>0&&this.initialHeight>0&&(this.aspectRatio=this.initialWidth/this.initialHeight)}handleResizeStart(t,e){t.preventDefault(),t.stopPropagation(),this.isResizing=!0,this.activeHandle=e,tAe(t)?(this.startX=t.touches[0].clientX,this.startY=t.touches[0].clientY):(this.startX=t.clientX,this.startY=t.clientY),this.startWidth=this.element.offsetWidth,this.startHeight=this.element.offsetHeight,this.startWidth>0&&this.startHeight>0&&(this.aspectRatio=this.startWidth/this.startHeight),this.getPos(),this.container.dataset.resizeState="true",this.classNames.resizing&&this.container.classList.add(this.classNames.resizing),document.addEventListener("mousemove",this.handleMouseMove),document.addEventListener("touchmove",this.handleTouchMove),document.addEventListener("mouseup",this.handleMouseUp),document.addEventListener("keydown",this.handleKeyDown),document.addEventListener("keyup",this.handleKeyUp)}handleResize(t,e){if(!this.activeHandle)return;const n=this.preserveAspectRatio||this.isShiftKeyPressed,{width:i,height:r}=this.calculateNewDimensions(this.activeHandle,t,e),a=this.applyConstraints(i,r,n);this.element.style.width=`${a.width}px`,this.element.style.height=`${a.height}px`,this.onResize&&this.onResize(a.width,a.height)}calculateNewDimensions(t,e,n){let i=this.startWidth,r=this.startHeight;const a=t.includes("right"),s=t.includes("left"),o=t.includes("bottom"),l=t.includes("top");return a?i=this.startWidth+e:s&&(i=this.startWidth-e),o?r=this.startHeight+n:l&&(r=this.startHeight-n),(t==="right"||t==="left")&&(i=this.startWidth+(a?e:-e)),(t==="top"||t==="bottom")&&(r=this.startHeight+(o?n:-n)),this.preserveAspectRatio||this.isShiftKeyPressed?this.applyAspectRatio(i,r,t):{width:i,height:r}}applyConstraints(t,e,n){var i,r,a,s;if(!n){let c=Math.max(this.minSize.width,t),d=Math.max(this.minSize.height,e);return(i=this.maxSize)!=null&&i.width&&(c=Math.min(this.maxSize.width,c)),(r=this.maxSize)!=null&&r.height&&(d=Math.min(this.maxSize.height,d)),{width:c,height:d}}let o=t,l=e;return o<this.minSize.width&&(o=this.minSize.width,l=o/this.aspectRatio),l<this.minSize.height&&(l=this.minSize.height,o=l*this.aspectRatio),(a=this.maxSize)!=null&&a.width&&o>this.maxSize.width&&(o=this.maxSize.width,l=o/this.aspectRatio),(s=this.maxSize)!=null&&s.height&&l>this.maxSize.height&&(l=this.maxSize.height,o=l*this.aspectRatio),{width:o,height:l}}applyAspectRatio(t,e,n){const i=n==="left"||n==="right",r=n==="top"||n==="bottom";return i?{width:t,height:t/this.aspectRatio}:r?{width:e*this.aspectRatio,height:e}:{width:t,height:t/this.aspectRatio}}};function iAe(t,e){const{selection:n}=t,{$from:i}=n;if(n instanceof Ft){const a=i.index();return i.parent.canReplaceWith(a,a+1,e)}let r=i.depth;for(;r>=0;){const a=i.index(r);if(i.node(r).contentMatchAt(a).matchType(e))return!0;r-=1}return!1}var rAe={};wD(rAe,{createAtomBlockMarkdownSpec:()=>aAe,createBlockMarkdownSpec:()=>sAe,createInlineMarkdownSpec:()=>cAe,parseAttributes:()=>DD,parseIndentedBlocks:()=>W3,renderNestedMarkdownContent:()=>OD,serializeAttributes:()=>kD});function DD(t){if(!t?.trim())return{};const e={},n=[],i=t.replace(/["']([^"']*)["']/g,c=>(n.push(c),`__QUOTED_${n.length-1}__`)),r=i.match(/(?:^|\s)\.([a-zA-Z][\w-]*)/g);if(r){const c=r.map(d=>d.trim().slice(1));e.class=c.join(" ")}const a=i.match(/(?:^|\s)#([a-zA-Z][\w-]*)/);a&&(e.id=a[1]);const s=/([a-zA-Z][\w-]*)\s*=\s*(__QUOTED_\d+__)/g;Array.from(i.matchAll(s)).forEach(([,c,d])=>{var f;const m=parseInt(((f=d.match(/__QUOTED_(\d+)__/))==null?void 0:f[1])||"0",10),g=n[m];g&&(e[c]=g.slice(1,-1))});const l=i.replace(/(?:^|\s)\.([a-zA-Z][\w-]*)/g,"").replace(/(?:^|\s)#([a-zA-Z][\w-]*)/g,"").replace(/([a-zA-Z][\w-]*)\s*=\s*__QUOTED_\d+__/g,"").trim();return l&&l.split(/\s+/).filter(Boolean).forEach(d=>{d.match(/^[a-zA-Z][\w-]*$/)&&(e[d]=!0)}),e}function kD(t){if(!t||Object.keys(t).length===0)return"";const e=[];return t.class&&String(t.class).split(/\s+/).filter(Boolean).forEach(i=>e.push(`.${i}`)),t.id&&e.push(`#${t.id}`),Object.entries(t).forEach(([n,i])=>{n==="class"||n==="id"||(i===!0?e.push(n):i!==!1&&i!=null&&e.push(`${n}="${String(i)}"`))}),e.join(" ")}function aAe(t){const{nodeName:e,name:n,parseAttributes:i=DD,serializeAttributes:r=kD,defaultAttributes:a={},requiredAttributes:s=[],allowedAttributes:o}=t,l=n||e,c=d=>{if(!o)return d;const f={};return o.forEach(m=>{m in d&&(f[m]=d[m])}),f};return{parseMarkdown:(d,f)=>{const m={...a,...d.attributes};return f.createNode(e,m,[])},markdownTokenizer:{name:e,level:"block",start(d){var f;const m=new RegExp(`^:::${l}(?:\\s|$)`,"m"),g=(f=d.match(m))==null?void 0:f.index;return g!==void 0?g:-1},tokenize(d,f,m){const g=new RegExp(`^:::${l}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`),y=d.match(g);if(!y)return;const _=y[1]||"",v=i(_);if(!s.find(M=>!(M in v)))return{type:e,raw:y[0],attributes:v}}},renderMarkdown:d=>{const f=c(d.attrs||{}),m=r(f),g=m?` {${m}}`:"";return`:::${l}${g} :::`}}}function sAe(t){const{nodeName:e,name:n,getContent:i,parseAttributes:r=DD,serializeAttributes:a=kD,defaultAttributes:s={},content:o="block",allowedAttributes:l}=t,c=n||e,d=f=>{if(!l)return f;const m={};return l.forEach(g=>{g in f&&(m[g]=f[g])}),m};return{parseMarkdown:(f,m)=>{let g;if(i){const _=i(f);g=typeof _=="string"?[{type:"text",text:_}]:_}else o==="block"?g=m.parseChildren(f.tokens||[]):g=m.parseInline(f.tokens||[]);const y={...s,...f.attributes};return m.createNode(e,y,g)},markdownTokenizer:{name:e,level:"block",start(f){var m;const g=new RegExp(`^:::${c}`,"m"),y=(m=f.match(g))==null?void 0:m.index;return y!==void 0?y:-1},tokenize(f,m,g){var y;const _=new RegExp(`^:::${c}(?:\\s+\\{([^}]*)\\})?\\s*\\n`),v=f.match(_);if(!v)return;const[x,M=""]=v,w=r(M);let T=1;const C=x.length;let P="";const A=/^:::([\w-]*)(\s.*)?/gm,U=f.slice(C);for(A.lastIndex=0;;){const N=A.exec(U);if(N===null)break;const D=N.index,F=N[1];if(!((y=N[2])!=null&&y.endsWith(":::"))){if(F)T+=1;else if(T-=1,T===0){const I=U.slice(0,D);P=I.trim();const W=f.slice(0,C+D+N[0].length);let O=[];if(P)if(o==="block")for(O=g.blockTokens(I),O.forEach(B=>{B.text&&(!B.tokens||B.tokens.length===0)&&(B.tokens=g.inlineTokens(B.text))});O.length>0;){const B=O[O.length-1];if(B.type==="paragraph"&&(!B.text||B.text.trim()===""))O.pop();else break}else O=g.inlineTokens(P);return{type:e,raw:W,attributes:w,content:P,tokens:O}}}}}},renderMarkdown:(f,m)=>{const g=d(f.attrs||{}),y=a(g),_=y?` {${y}}`:"",v=m.renderChildren(f.content||[],`
  8129. `);return`:::${c}${_}
  8130. ${v}
  8131. :::`}}}function oAe(t){if(!t.trim())return{};const e={},n=/(\w+)=(?:"([^"]*)"|'([^']*)')/g;let i=n.exec(t);for(;i!==null;){const[,r,a,s]=i;e[r]=a||s,i=n.exec(t)}return e}function lAe(t){return Object.entries(t).filter(([,e])=>e!=null).map(([e,n])=>`${e}="${n}"`).join(" ")}function cAe(t){const{nodeName:e,name:n,getContent:i,parseAttributes:r=oAe,serializeAttributes:a=lAe,defaultAttributes:s={},selfClosing:o=!1,allowedAttributes:l}=t,c=n||e,d=m=>{if(!l)return m;const g={};return l.forEach(y=>{y in m&&(g[y]=m[y])}),g},f=c.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{parseMarkdown:(m,g)=>{const y={...s,...m.attributes};if(o)return g.createNode(e,y);const _=i?i(m):m.content||"";return _?g.createNode(e,y,[g.createTextNode(_)]):g.createNode(e,y,[])},markdownTokenizer:{name:e,level:"inline",start(m){const g=o?new RegExp(`\\[${f}\\s*[^\\]]*\\]`):new RegExp(`\\[${f}\\s*[^\\]]*\\][\\s\\S]*?\\[\\/${f}\\]`),y=m.match(g),_=y?.index;return _!==void 0?_:-1},tokenize(m,g,y){const _=o?new RegExp(`^\\[${f}\\s*([^\\]]*)\\]`):new RegExp(`^\\[${f}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${f}\\]`),v=m.match(_);if(!v)return;let x="",M="";if(o){const[,T]=v;M=T}else{const[,T,C]=v;M=T,x=C||""}const w=r(M.trim());return{type:e,raw:v[0],content:x.trim(),attributes:w}}},renderMarkdown:m=>{let g="";i?g=i(m):m.content&&m.content.length>0&&(g=m.content.filter(x=>x.type==="text").map(x=>x.text).join(""));const y=d(m.attrs||{}),_=a(y),v=_?` ${_}`:"";return o?`[${c}${v}]`:`[${c}${v}]${g}[/${c}]`}}}function W3(t,e,n){var i,r,a,s;const o=t.split(`
  8132. `),l=[];let c="",d=0;const f=e.baseIndentSize||2;for(;d<o.length;){const m=o[d],g=m.match(e.itemPattern);if(!g){if(l.length>0)break;if(m.trim()===""){d+=1,c=`${c}${m}
  8133. `;continue}else return}const y=e.extractItemData(g),{indentLevel:_,mainContent:v}=y;c=`${c}${m}
  8134. `;const x=[v];for(d+=1;d<o.length;){const C=o[d];if(C.trim()===""){const A=o.slice(d+1).findIndex(D=>D.trim()!=="");if(A===-1)break;if((((r=(i=o[d+1+A].match(/^(\s*)/))==null?void 0:i[1])==null?void 0:r.length)||0)>_){x.push(C),c=`${c}${C}
  8135. `,d+=1;continue}else break}if((((s=(a=C.match(/^(\s*)/))==null?void 0:a[1])==null?void 0:s.length)||0)>_)x.push(C),c=`${c}${C}
  8136. `,d+=1;else break}let M;const w=x.slice(1);if(w.length>0){const C=w.map(P=>P.slice(_+f)).join(`
  8137. `);C.trim()&&(e.customNestedParser?M=e.customNestedParser(C):M=n.blockTokens(C))}const T=e.createToken(y,M);l.push(T)}if(l.length!==0)return{items:l,raw:c}}function OD(t,e,n,i){if(!t||!Array.isArray(t.content))return"";const r=typeof n=="function"?n(i):n,[a,...s]=t.content,o=e.renderChildren([a]),l=[`${r}${o}`];return s&&s.length>0&&s.forEach(c=>{const d=e.renderChildren([c]);if(d){const f=d.split(`
  8138. `).map(m=>m?e.indent(m):"").join(`
  8139. `);l.push(f)}}),l.join(`
  8140. `)}function uAe(t,e,n={}){const{state:i}=e,{doc:r,tr:a}=i,s=t;r.descendants((o,l)=>{const c=a.mapping.map(l),d=a.mapping.map(l)+o.nodeSize;let f=null;if(o.marks.forEach(g=>{if(g!==s)return!1;f=g}),!f)return;let m=!1;if(Object.keys(n).forEach(g=>{n[g]!==f.attrs[g]&&(m=!0)}),m){const g=t.type.create({...t.attrs,...n});a.removeMark(c,d,t.type),a.addMark(c,d,g)}}),a.docChanged&&e.view.dispatch(a)}var Ba=class Rq extends PD{constructor(){super(...arguments),this.type="node"}static create(e={}){const n=typeof e=="function"?e():e;return new Rq(n)}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}};function Df(t){return new GEe({find:t.find,handler:({state:e,range:n,match:i,pasteEvent:r})=>{const a=On(t.getAttributes,void 0,i,r);if(a===!1||a===null)return null;const{tr:s}=e,o=i[i.length-1],l=i[0];let c=n.to;if(o){const d=l.search(/\S/),f=n.from+l.indexOf(o),m=f+o.length;if(RD(n.from,n.to,e.doc).filter(y=>y.mark.type.excluded.find(v=>v===t.type&&v!==y.mark.type)).filter(y=>y.to>f).length)return null;m<n.to&&s.delete(m,n.to),f>n.from&&s.delete(n.from+d,f),c=n.from+d+o.length,s.addMark(n.from+d,c,t.type.create(a||{})),s.removeStoredMark(t.type)}}})}var l2,QB;function dAe(){return QB||(QB=1,l2=function t(e,n){if(e===n)return!0;if(e&&n&&typeof e=="object"&&typeof n=="object"){if(e.constructor!==n.constructor)return!1;var i,r,a;if(Array.isArray(e)){if(i=e.length,i!=n.length)return!1;for(r=i;r--!==0;)if(!t(e[r],n[r]))return!1;return!0}if(e instanceof Map&&n instanceof Map){if(e.size!==n.size)return!1;for(r of e.entries())if(!n.has(r[0]))return!1;for(r of e.entries())if(!t(r[1],n.get(r[0])))return!1;return!0}if(e instanceof Set&&n instanceof Set){if(e.size!==n.size)return!1;for(r of e.entries())if(!n.has(r[0]))return!1;return!0}if(ArrayBuffer.isView(e)&&ArrayBuffer.isView(n)){if(i=e.length,i!=n.length)return!1;for(r=i;r--!==0;)if(e[r]!==n[r])return!1;return!0}if(e.constructor===RegExp)return e.source===n.source&&e.flags===n.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===n.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===n.toString();if(a=Object.keys(e),i=a.length,i!==Object.keys(n).length)return!1;for(r=i;r--!==0;)if(!Object.prototype.hasOwnProperty.call(n,a[r]))return!1;for(r=i;r--!==0;){var s=a[r];if(!(s==="_owner"&&e.$$typeof)&&!t(e[s],n[s]))return!1}return!0}return e!==e&&n!==n}),l2}var fAe=dAe();const hAe=Ks(fAe);var c2={exports:{}},u2={};var JB;function pAe(){if(JB)return u2;JB=1;var t=lm(),e=oG();function n(c,d){return c===d&&(c!==0||1/c===1/d)||c!==c&&d!==d}var i=typeof Object.is=="function"?Object.is:n,r=e.useSyncExternalStore,a=t.useRef,s=t.useEffect,o=t.useMemo,l=t.useDebugValue;return u2.useSyncExternalStoreWithSelector=function(c,d,f,m,g){var y=a(null);if(y.current===null){var _={hasValue:!1,value:null};y.current=_}else _=y.current;y=o(function(){function x(P){if(!M){if(M=!0,w=P,P=m(P),g!==void 0&&_.hasValue){var A=_.value;if(g(A,P))return T=A}return T=P}if(A=T,i(w,P))return A;var U=m(P);return g!==void 0&&g(A,U)?(w=P,A):(w=P,T=U)}var M=!1,w,T,C=f===void 0?null:f;return[function(){return x(d())},C===null?void 0:function(){return x(C())}]},[d,f,m,g]);var v=r(c,y[0],y[1]);return s(function(){_.hasValue=!0,_.value=v},[v]),l(v),v},u2}var e8;function mAe(){return e8||(e8=1,c2.exports=pAe()),c2.exports}var Pq=mAe(),gAe=(...t)=>e=>{t.forEach(n=>{typeof n=="function"?n(e):n&&(n.current=e)})},xAe=({contentComponent:t})=>{const e=pP.useSyncExternalStore(t.subscribe,t.getSnapshot,t.getServerSnapshot);return p.jsx(p.Fragment,{children:Object.values(e)})};function vAe(){const t=new Set;let e={};return{subscribe(n){return t.add(n),()=>{t.delete(n)}},getSnapshot(){return e},getServerSnapshot(){return e},setRenderer(n,i){e={...e,[n]:Tre.createPortal(i.reactElement,i.element,n)},t.forEach(r=>r())},removeRenderer(n){const i={...e};delete i[n],e=i,t.forEach(r=>r())}}}var yAe=class extends ui.Component{constructor(t){var e;super(t),this.editorContentRef=ui.createRef(),this.initialized=!1,this.state={hasContentComponentInitialized:!!((e=t.editor)!=null&&e.contentComponent)}}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){const t=this.props.editor;if(t&&!t.isDestroyed&&t.options.element){if(t.contentComponent)return;const e=this.editorContentRef.current;e.append(t.view.dom),t.setOptions({element:e}),t.contentComponent=vAe(),this.state.hasContentComponentInitialized||(this.unsubscribeToContentComponent=t.contentComponent.subscribe(()=>{this.setState(n=>n.hasContentComponentInitialized?n:{hasContentComponentInitialized:!0}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent()})),t.createNodeViews(),this.initialized=!0}}componentWillUnmount(){var t;const e=this.props.editor;if(e){this.initialized=!1,e.isDestroyed||e.view.setProps({nodeViews:{}}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent(),e.contentComponent=null;try{if(!((t=e.view.dom)!=null&&t.firstChild))return;const n=document.createElement("div");n.append(e.view.dom),e.setOptions({element:n})}catch{}}}render(){const{editor:t,innerRef:e,...n}=this.props;return p.jsxs(p.Fragment,{children:[p.jsx("div",{ref:gAe(e,this.editorContentRef),...n}),t?.contentComponent&&p.jsx(xAe,{contentComponent:t.contentComponent})]})}},bAe=E.forwardRef((t,e)=>{const n=ui.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[t.editor]);return ui.createElement(yAe,{key:n,innerRef:e,...t})}),_Ae=ui.memo(bAe),SAe=typeof window<"u"?E.useLayoutEffect:E.useEffect,wAe=class{constructor(t){this.transactionNumber=0,this.lastTransactionNumber=0,this.subscribers=new Set,this.editor=t,this.lastSnapshot={editor:t,transactionNumber:0},this.getSnapshot=this.getSnapshot.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.watch=this.watch.bind(this),this.subscribe=this.subscribe.bind(this)}getSnapshot(){return this.transactionNumber===this.lastTransactionNumber?this.lastSnapshot:(this.lastTransactionNumber=this.transactionNumber,this.lastSnapshot={editor:this.editor,transactionNumber:this.transactionNumber},this.lastSnapshot)}getServerSnapshot(){return{editor:null,transactionNumber:0}}subscribe(t){return this.subscribers.add(t),()=>{this.subscribers.delete(t)}}watch(t){if(this.editor=t,this.editor){const e=()=>{this.transactionNumber+=1,this.subscribers.forEach(i=>i())},n=this.editor;return n.on("transaction",e),()=>{n.off("transaction",e)}}}};function MAe(t){var e;const[n]=E.useState(()=>new wAe(t.editor)),i=Pq.useSyncExternalStoreWithSelector(n.subscribe,n.getSnapshot,n.getServerSnapshot,t.selector,(e=t.equalityFn)!=null?e:hAe);return SAe(()=>n.watch(t.editor),[t.editor,n]),E.useDebugValue(i),i}var EAe=!1,q3=typeof window>"u",AAe=q3||!!(typeof window<"u"&&window.next),TAe=class Dq{constructor(e){this.editor=null,this.subscriptions=new Set,this.isComponentMounted=!1,this.previousDeps=null,this.instanceId="",this.options=e,this.subscriptions=new Set,this.setEditor(this.getInitialEditor()),this.scheduleDestroy(),this.getEditor=this.getEditor.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.subscribe=this.subscribe.bind(this),this.refreshEditorInstance=this.refreshEditorInstance.bind(this),this.scheduleDestroy=this.scheduleDestroy.bind(this),this.onRender=this.onRender.bind(this),this.createEditor=this.createEditor.bind(this)}setEditor(e){this.editor=e,this.instanceId=Math.random().toString(36).slice(2,9),this.subscriptions.forEach(n=>n())}getInitialEditor(){return this.options.current.immediatelyRender===void 0?q3||AAe?null:this.createEditor():(this.options.current.immediatelyRender,this.options.current.immediatelyRender?this.createEditor():null)}createEditor(){const e={...this.options.current,onBeforeCreate:(...i)=>{var r,a;return(a=(r=this.options.current).onBeforeCreate)==null?void 0:a.call(r,...i)},onBlur:(...i)=>{var r,a;return(a=(r=this.options.current).onBlur)==null?void 0:a.call(r,...i)},onCreate:(...i)=>{var r,a;return(a=(r=this.options.current).onCreate)==null?void 0:a.call(r,...i)},onDestroy:(...i)=>{var r,a;return(a=(r=this.options.current).onDestroy)==null?void 0:a.call(r,...i)},onFocus:(...i)=>{var r,a;return(a=(r=this.options.current).onFocus)==null?void 0:a.call(r,...i)},onSelectionUpdate:(...i)=>{var r,a;return(a=(r=this.options.current).onSelectionUpdate)==null?void 0:a.call(r,...i)},onTransaction:(...i)=>{var r,a;return(a=(r=this.options.current).onTransaction)==null?void 0:a.call(r,...i)},onUpdate:(...i)=>{var r,a;return(a=(r=this.options.current).onUpdate)==null?void 0:a.call(r,...i)},onContentError:(...i)=>{var r,a;return(a=(r=this.options.current).onContentError)==null?void 0:a.call(r,...i)},onDrop:(...i)=>{var r,a;return(a=(r=this.options.current).onDrop)==null?void 0:a.call(r,...i)},onPaste:(...i)=>{var r,a;return(a=(r=this.options.current).onPaste)==null?void 0:a.call(r,...i)},onDelete:(...i)=>{var r,a;return(a=(r=this.options.current).onDelete)==null?void 0:a.call(r,...i)}};return new eAe(e)}getEditor(){return this.editor}getServerSnapshot(){return null}subscribe(e){return this.subscriptions.add(e),()=>{this.subscriptions.delete(e)}}static compareOptions(e,n){return Object.keys(e).every(i=>["onCreate","onBeforeCreate","onDestroy","onUpdate","onTransaction","onFocus","onBlur","onSelectionUpdate","onContentError","onDrop","onPaste"].includes(i)?!0:i==="extensions"&&e.extensions&&n.extensions?e.extensions.length!==n.extensions.length?!1:e.extensions.every((r,a)=>{var s;return r===((s=n.extensions)==null?void 0:s[a])}):e[i]===n[i])}onRender(e){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&e.length===0?Dq.compareOptions(this.options.current,this.editor.options)||this.editor.setOptions({...this.options.current,editable:this.editor.isEditable}):this.refreshEditorInstance(e),()=>{this.isComponentMounted=!1,this.scheduleDestroy()})}refreshEditorInstance(e){if(this.editor&&!this.editor.isDestroyed){if(this.previousDeps===null){this.previousDeps=e;return}if(this.previousDeps.length===e.length&&this.previousDeps.every((i,r)=>i===e[r]))return}this.editor&&!this.editor.isDestroyed&&this.editor.destroy(),this.setEditor(this.createEditor()),this.previousDeps=e}scheduleDestroy(){const e=this.instanceId,n=this.editor;this.scheduledDestructionTimeout=setTimeout(()=>{if(this.isComponentMounted&&this.instanceId===e){n&&n.setOptions(this.options.current);return}n&&!n.isDestroyed&&(n.destroy(),this.instanceId===e&&this.setEditor(null))},1)}};function CAe(t={},e=[]){const n=E.useRef(t);n.current=t;const[i]=E.useState(()=>new TAe(n)),r=pP.useSyncExternalStore(i.subscribe,i.getEditor,i.getServerSnapshot);return E.useDebugValue(r),E.useEffect(i.onRender(e)),MAe({editor:r,selector:({transactionNumber:a})=>t.shouldRerenderOnTransaction===!1||t.shouldRerenderOnTransaction===void 0?null:t.immediatelyRender&&a===0?0:a+1}),r}var NAe=E.createContext({editor:null});NAe.Consumer;var RAe=E.createContext({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}}),PAe=()=>E.useContext(RAe);ui.forwardRef((t,e)=>{const{onDragStart:n}=PAe(),i=t.as||"div";return p.jsx(i,{...t,ref:e,"data-node-view-wrapper":"",onDragStart:n,style:{whiteSpace:"normal",...t.style}})});ui.createContext({markViewContentRef:()=>{}});var d1=(t,e)=>{if(t==="slot")return 0;if(t instanceof Function)return t(e);const{children:n,...i}=e??{};if(t==="svg")throw new Error("SVG elements are not supported in the JSX syntax, use the array syntax instead");return[t,i,n]},DAe=/^\s*>\s$/,kAe=Ba.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:t}){return d1("blockquote",{...Ei(this.options.HTMLAttributes,t),children:d1("slot",{})})},parseMarkdown:(t,e)=>e.createNode("blockquote",void 0,e.parseChildren(t.tokens||[])),renderMarkdown:(t,e)=>{if(!t.content)return"";const n=">",i=[];return t.content.forEach(r=>{const o=e.renderChildren([r]).split(`
  8141. `).map(l=>l.trim()===""?n:`${n} ${l}`);i.push(o.join(`
  8142. `))}),i.join(`
  8143. ${n}
  8144. `)},addCommands(){return{setBlockquote:()=>({commands:t})=>t.wrapIn(this.name),toggleBlockquote:()=>({commands:t})=>t.toggleWrap(this.name),unsetBlockquote:()=>({commands:t})=>t.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[Qp({find:DAe,type:this.type})]}}),OAe=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,LAe=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,IAe=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,UAe=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,jAe=od.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:t=>t.style.fontWeight!=="normal"&&null},{style:"font-weight=400",clearMark:t=>t.type.name===this.name},{style:"font-weight",getAttrs:t=>/^(bold(er)?|[5-9]\d{2,})$/.test(t)&&null}]},renderHTML({HTMLAttributes:t}){return d1("strong",{...Ei(this.options.HTMLAttributes,t),children:d1("slot",{})})},markdownTokenName:"strong",parseMarkdown:(t,e)=>e.applyMark("bold",e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>`**${e.renderChildren(t)}**`,addCommands(){return{setBold:()=>({commands:t})=>t.setMark(this.name),toggleBold:()=>({commands:t})=>t.toggleMark(this.name),unsetBold:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[Zp({find:OAe,type:this.type}),Zp({find:IAe,type:this.type})]},addPasteRules(){return[Df({find:LAe,type:this.type}),Df({find:UAe,type:this.type})]}}),FAe=/(^|[^`])`([^`]+)`(?!`)$/,zAe=/(^|[^`])`([^`]+)`(?!`)/g,BAe=od.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:t}){return["code",Ei(this.options.HTMLAttributes,t),0]},markdownTokenName:"codespan",parseMarkdown:(t,e)=>e.applyMark("code",[{type:"text",text:t.text||""}]),renderMarkdown:(t,e)=>t.content?`\`${e.renderChildren(t.content)}\``:"",addCommands(){return{setCode:()=>({commands:t})=>t.setMark(this.name),toggleCode:()=>({commands:t})=>t.toggleMark(this.name),unsetCode:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[Zp({find:FAe,type:this.type})]},addPasteRules(){return[Df({find:zAe,type:this.type})]}}),d2=4,HAe=/^```([a-z]+)?[\s\n]$/,VAe=/^~~~([a-z]+)?[\s\n]$/,$Ae=Ba.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:d2,HTMLAttributes:{}}},content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:t=>{var e;const{languageClassPrefix:n}=this.options;if(!n)return null;const a=[...((e=t.firstElementChild)==null?void 0:e.classList)||[]].filter(s=>s.startsWith(n)).map(s=>s.replace(n,""))[0];return a||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:t,HTMLAttributes:e}){return["pre",Ei(this.options.HTMLAttributes,e),["code",{class:t.attrs.language?this.options.languageClassPrefix+t.attrs.language:null},0]]},markdownTokenName:"code",parseMarkdown:(t,e)=>{var n;return((n=t.raw)==null?void 0:n.startsWith("```"))===!1&&t.codeBlockStyle!=="indented"?[]:e.createNode("codeBlock",{language:t.lang||null},t.text?[e.createTextNode(t.text)]:[])},renderMarkdown:(t,e)=>{var n;let i="";const r=((n=t.attrs)==null?void 0:n.language)||"";return t.content?i=[`\`\`\`${r}`,e.renderChildren(t.content),"```"].join(`
  8145. `):i=`\`\`\`${r}
  8146. \`\`\``,i},addCommands(){return{setCodeBlock:t=>({commands:e})=>e.setNode(this.name,t),toggleCodeBlock:t=>({commands:e})=>e.toggleNode(this.name,"paragraph",t)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:t,$anchor:e}=this.editor.state.selection,n=e.pos===1;return!t||e.parent.type.name!==this.name?!1:n||!e.parent.textContent.length?this.editor.commands.clearNodes():!1},Tab:({editor:t})=>{var e;if(!this.options.enableTabIndentation)return!1;const n=(e=this.options.tabSize)!=null?e:d2,{state:i}=t,{selection:r}=i,{$from:a,empty:s}=r;if(a.parent.type!==this.type)return!1;const o=" ".repeat(n);return s?t.commands.insertContent(o):t.commands.command(({tr:l})=>{const{from:c,to:d}=r,g=i.doc.textBetween(c,d,`
  8147. `,`
  8148. `).split(`
  8149. `).map(y=>o+y).join(`
  8150. `);return l.replaceWith(c,d,i.schema.text(g)),!0})},"Shift-Tab":({editor:t})=>{var e;if(!this.options.enableTabIndentation)return!1;const n=(e=this.options.tabSize)!=null?e:d2,{state:i}=t,{selection:r}=i,{$from:a,empty:s}=r;return a.parent.type!==this.type?!1:s?t.commands.command(({tr:o})=>{var l;const{pos:c}=a,d=a.start(),f=a.end(),g=i.doc.textBetween(d,f,`
  8151. `,`
  8152. `).split(`
  8153. `);let y=0,_=0;const v=c-d;for(let P=0;P<g.length;P+=1){if(_+g[P].length>=v){y=P;break}_+=g[P].length+1}const M=((l=g[y].match(/^ */))==null?void 0:l[0])||"",w=Math.min(M.length,n);if(w===0)return!0;let T=d;for(let P=0;P<y;P+=1)T+=g[P].length+1;return o.delete(T,T+w),c-T<=w&&o.setSelection(Vt.create(o.doc,T)),!0}):t.commands.command(({tr:o})=>{const{from:l,to:c}=r,m=i.doc.textBetween(l,c,`
  8154. `,`
  8155. `).split(`
  8156. `).map(g=>{var y;const _=((y=g.match(/^ */))==null?void 0:y[0])||"",v=Math.min(_.length,n);return g.slice(v)}).join(`
  8157. `);return o.replaceWith(l,c,i.schema.text(m)),!0})},Enter:({editor:t})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:e}=t,{selection:n}=e,{$from:i,empty:r}=n;if(!r||i.parent.type!==this.type)return!1;const a=i.parentOffset===i.parent.nodeSize-2,s=i.parent.textContent.endsWith(`
  8158. `);return!a||!s?!1:t.chain().command(({tr:o})=>(o.delete(i.pos-2,i.pos),!0)).exitCode().run()},ArrowDown:({editor:t})=>{if(!this.options.exitOnArrowDown)return!1;const{state:e}=t,{selection:n,doc:i}=e,{$from:r,empty:a}=n;if(!a||r.parent.type!==this.type||!(r.parentOffset===r.parent.nodeSize-2))return!1;const o=r.after();return o===void 0?!1:i.nodeAt(o)?t.commands.command(({tr:c})=>(c.setSelection(sn.near(i.resolve(o))),!0)):t.commands.exitCode()}}},addInputRules(){return[G3({find:HAe,type:this.type,getAttributes:t=>({language:t[1]})}),G3({find:VAe,type:this.type,getAttributes:t=>({language:t[1]})})]},addProseMirrorPlugins(){return[new xi({key:new lr("codeBlockVSCodeHandler"),props:{handlePaste:(t,e)=>{if(!e.clipboardData||this.editor.isActive(this.type.name))return!1;const n=e.clipboardData.getData("text/plain"),i=e.clipboardData.getData("vscode-editor-data"),r=i?JSON.parse(i):void 0,a=r?.mode;if(!n||!a)return!1;const{tr:s,schema:o}=t.state,l=o.text(n.replace(/\r\n?/g,`
  8159. `));return s.replaceSelectionWith(this.type.create({language:a},l)),s.selection.$from.parent.type!==this.type&&s.setSelection(Vt.near(s.doc.resolve(Math.max(0,s.selection.from-2)))),s.setMeta("paste",!0),t.dispatch(s),!0}}})]}}),GAe=Ba.create({name:"doc",topNode:!0,content:"block+",renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
  8160. `):""}),WAe=Ba.create({name:"hardBreak",markdownTokenName:"br",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:t}){return["br",Ei(this.options.HTMLAttributes,t)]},renderText(){return`
  8161. `},renderMarkdown:()=>`
  8162. `,parseMarkdown:()=>({type:"hardBreak"}),addCommands(){return{setHardBreak:()=>({commands:t,chain:e,state:n,editor:i})=>t.first([()=>t.exitCode(),()=>t.command(()=>{const{selection:r,storedMarks:a}=n;if(r.$from.parent.type.spec.isolating)return!1;const{keepMarks:s}=this.options,{splittableMarks:o}=i.extensionManager,l=a||r.$to.parentOffset&&r.$from.marks();return e().insertContent({type:this.name}).command(({tr:c,dispatch:d})=>{if(d&&l&&s){const f=l.filter(m=>o.includes(m.type.name));c.ensureMarks(f)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),qAe=Ba.create({name:"heading",addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:"inline*",group:"block",defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(t=>({tag:`h${t}`,attrs:{level:t}}))},renderHTML({node:t,HTMLAttributes:e}){return[`h${this.options.levels.includes(t.attrs.level)?t.attrs.level:this.options.levels[0]}`,Ei(this.options.HTMLAttributes,e),0]},parseMarkdown:(t,e)=>e.createNode("heading",{level:t.depth||1},e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>{var n;const i=(n=t.attrs)!=null&&n.level?parseInt(t.attrs.level,10):1,r="#".repeat(i);return t.content?`${r} ${e.renderChildren(t.content)}`:""},addCommands(){return{setHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.setNode(this.name,t):!1,toggleHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.toggleNode(this.name,"paragraph",t):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((t,e)=>({...t,[`Mod-Alt-${e}`]:()=>this.editor.commands.toggleHeading({level:e})}),{})},addInputRules(){return this.options.levels.map(t=>G3({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${t}})\\s$`),type:this.type,getAttributes:{level:t}}))}}),XAe=Ba.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{},nextNodeType:"paragraph"}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:t}){return["hr",Ei(this.options.HTMLAttributes,t)]},markdownTokenName:"hr",parseMarkdown:(t,e)=>e.createNode("horizontalRule"),renderMarkdown:()=>"---",addCommands(){return{setHorizontalRule:()=>({chain:t,state:e})=>{if(!iAe(e,e.schema.nodes[this.name]))return!1;const{selection:n}=e,{$to:i}=n,r=t();return pq(n)?r.insertContentAt(i.pos,{type:this.name}):r.insertContent({type:this.name}),r.command(({state:a,tr:s,dispatch:o})=>{if(o){const{$to:l}=s.selection,c=l.end();if(l.nodeAfter)l.nodeAfter.isTextblock?s.setSelection(Vt.create(s.doc,l.pos+1)):l.nodeAfter.isBlock?s.setSelection(Ft.create(s.doc,l.pos)):s.setSelection(Vt.create(s.doc,l.pos));else{const d=a.schema.nodes[this.options.nextNodeType]||l.parent.type.contentMatch.defaultType,f=d?.create();f&&(s.insert(c,f),s.setSelection(Vt.create(s.doc,c+1)))}s.scrollIntoView()}return!0}).run()}}},addInputRules(){return[Nq({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),KAe=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,YAe=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,ZAe=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,QAe=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,JAe=od.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:t=>t.style.fontStyle!=="normal"&&null},{style:"font-style=normal",clearMark:t=>t.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:t}){return["em",Ei(this.options.HTMLAttributes,t),0]},addCommands(){return{setItalic:()=>({commands:t})=>t.setMark(this.name),toggleItalic:()=>({commands:t})=>t.toggleMark(this.name),unsetItalic:()=>({commands:t})=>t.unsetMark(this.name)}},markdownTokenName:"em",parseMarkdown:(t,e)=>e.applyMark("italic",e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>`*${e.renderChildren(t)}*`,addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[Zp({find:KAe,type:this.type}),Zp({find:ZAe,type:this.type})]},addPasteRules(){return[Df({find:YAe,type:this.type}),Df({find:QAe,type:this.type})]}});const eTe="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",tTe="ελ1υ2бг1ел3дети4ею2католик6ом3мкд2он1сква6онлайн5рг3рус2ф2сайт3рб3укр3қаз3հայ3ישראל5קום3ابوظبي5رامكو5لاردن4بحرين5جزائر5سعودية6عليان5مغرب5مارات5یران5بارت2زار4يتك3ھارت5تونس4سودان3رية5شبكة4عراق2ب2مان4فلسطين6قطر3كاثوليك6وم3مصر2ليسيا5وريتانيا7قع4همراه5پاکستان7ڀارت4कॉम3नेट3भारत0म्3ोत5संगठन5বাংলা5ভারত2ৰত4ਭਾਰਤ4ભારત4ଭାରତ4இந்தியா6லங்கை6சிங்கப்பூர்11భారత్5ಭಾರತ4ഭാരതം5ලංකා4คอม3ไทย3ລາວ3გე2みんな3アマゾン4クラウド4グーグル4コム2ストア3セール3ファッション6ポイント4世界2中信1国1國1文网3亚马逊3企业2佛山2信息2健康2八卦2公司1益2台湾1灣2商城1店1标2嘉里0大酒店5在线2大拿2天主教3娱乐2家電2广东2微博2慈善2我爱你3手机2招聘2政务1府2新加坡2闻2时尚2書籍2机构2淡马锡3游戏2澳門2点看2移动2组织机构4网址1店1站1络2联通2谷歌2购物2通販2集团2電訊盈科4飞利浦3食品2餐厅2香格里拉3港2닷넷1컴2삼성2한국2",X3="numeric",K3="ascii",Y3="alpha",y0="asciinumeric",i0="alphanumeric",Z3="domain",kq="emoji",nTe="scheme",iTe="slashscheme",f2="whitespace";function rTe(t,e){return t in e||(e[t]=[]),e[t]}function ef(t,e,n){e[X3]&&(e[y0]=!0,e[i0]=!0),e[K3]&&(e[y0]=!0,e[Y3]=!0),e[y0]&&(e[i0]=!0),e[Y3]&&(e[i0]=!0),e[i0]&&(e[Z3]=!0),e[kq]&&(e[Z3]=!0);for(const i in e){const r=rTe(i,n);r.indexOf(t)<0&&r.push(t)}}function aTe(t,e){const n={};for(const i in e)e[i].indexOf(t)>=0&&(n[i]=!0);return n}function Oa(t=null){this.j={},this.jr=[],this.jd=null,this.t=t}Oa.groups={};Oa.prototype={accepts(){return!!this.t},go(t){const e=this,n=e.j[t];if(n)return n;for(let i=0;i<e.jr.length;i++){const r=e.jr[i][0],a=e.jr[i][1];if(a&&r.test(t))return a}return e.jd},has(t,e=!1){return e?t in this.j:!!this.go(t)},ta(t,e,n,i){for(let r=0;r<t.length;r++)this.tt(t[r],e,n,i)},tr(t,e,n,i){i=i||Oa.groups;let r;return e&&e.j?r=e:(r=new Oa(e),n&&i&&ef(e,n,i)),this.jr.push([t,r]),r},ts(t,e,n,i){let r=this;const a=t.length;if(!a)return r;for(let s=0;s<a-1;s++)r=r.tt(t[s]);return r.tt(t[a-1],e,n,i)},tt(t,e,n,i){i=i||Oa.groups;const r=this;if(e&&e.j)return r.j[t]=e,e;const a=e;let s,o=r.go(t);if(o?(s=new Oa,Object.assign(s.j,o.j),s.jr.push.apply(s.jr,o.jr),s.jd=o.jd,s.t=o.t):s=new Oa,a){if(i)if(s.t&&typeof s.t=="string"){const l=Object.assign(aTe(s.t,i),n);ef(a,l,i)}else n&&ef(a,n,i);s.t=a}return r.j[t]=s,s}};const tn=(t,e,n,i,r)=>t.ta(e,n,i,r),Si=(t,e,n,i,r)=>t.tr(e,n,i,r),t8=(t,e,n,i,r)=>t.ts(e,n,i,r),gt=(t,e,n,i,r)=>t.tt(e,n,i,r),Hl="WORD",Q3="UWORD",Oq="ASCIINUMERICAL",Lq="ALPHANUMERICAL",rx="LOCALHOST",J3="TLD",eR="UTLD",v_="SCHEME",pp="SLASH_SCHEME",LD="NUM",tR="WS",ID="NL",b0="OPENBRACE",_0="CLOSEBRACE",f1="OPENBRACKET",h1="CLOSEBRACKET",p1="OPENPAREN",m1="CLOSEPAREN",g1="OPENANGLEBRACKET",x1="CLOSEANGLEBRACKET",v1="FULLWIDTHLEFTPAREN",y1="FULLWIDTHRIGHTPAREN",b1="LEFTCORNERBRACKET",_1="RIGHTCORNERBRACKET",S1="LEFTWHITECORNERBRACKET",w1="RIGHTWHITECORNERBRACKET",M1="FULLWIDTHLESSTHAN",E1="FULLWIDTHGREATERTHAN",A1="AMPERSAND",T1="APOSTROPHE",C1="ASTERISK",yu="AT",N1="BACKSLASH",R1="BACKTICK",P1="CARET",Au="COLON",UD="COMMA",D1="DOLLAR",Io="DOT",k1="EQUALS",jD="EXCLAMATION",Ns="HYPHEN",S0="PERCENT",O1="PIPE",L1="PLUS",I1="POUND",w0="QUERY",FD="QUOTE",Iq="FULLWIDTHMIDDLEDOT",zD="SEMI",Uo="SLASH",M0="TILDE",U1="UNDERSCORE",Uq="EMOJI",j1="SYM";var jq=Object.freeze({__proto__:null,ALPHANUMERICAL:Lq,AMPERSAND:A1,APOSTROPHE:T1,ASCIINUMERICAL:Oq,ASTERISK:C1,AT:yu,BACKSLASH:N1,BACKTICK:R1,CARET:P1,CLOSEANGLEBRACKET:x1,CLOSEBRACE:_0,CLOSEBRACKET:h1,CLOSEPAREN:m1,COLON:Au,COMMA:UD,DOLLAR:D1,DOT:Io,EMOJI:Uq,EQUALS:k1,EXCLAMATION:jD,FULLWIDTHGREATERTHAN:E1,FULLWIDTHLEFTPAREN:v1,FULLWIDTHLESSTHAN:M1,FULLWIDTHMIDDLEDOT:Iq,FULLWIDTHRIGHTPAREN:y1,HYPHEN:Ns,LEFTCORNERBRACKET:b1,LEFTWHITECORNERBRACKET:S1,LOCALHOST:rx,NL:ID,NUM:LD,OPENANGLEBRACKET:g1,OPENBRACE:b0,OPENBRACKET:f1,OPENPAREN:p1,PERCENT:S0,PIPE:O1,PLUS:L1,POUND:I1,QUERY:w0,QUOTE:FD,RIGHTCORNERBRACKET:_1,RIGHTWHITECORNERBRACKET:w1,SCHEME:v_,SEMI:zD,SLASH:Uo,SLASH_SCHEME:pp,SYM:j1,TILDE:M0,TLD:J3,UNDERSCORE:U1,UTLD:eR,UWORD:Q3,WORD:Hl,WS:tR});const jl=/[a-z]/,zg=new RegExp("\\p{L}","u"),h2=new RegExp("\\p{Emoji}","u"),Fl=/\d/,p2=/\s/,n8="\r",m2=`
  8163. `,sTe="️",oTe="‍",g2="";let Ob=null,Lb=null;function lTe(t=[]){const e={};Oa.groups=e;const n=new Oa;Ob==null&&(Ob=i8(eTe)),Lb==null&&(Lb=i8(tTe)),gt(n,"'",T1),gt(n,"{",b0),gt(n,"}",_0),gt(n,"[",f1),gt(n,"]",h1),gt(n,"(",p1),gt(n,")",m1),gt(n,"<",g1),gt(n,">",x1),gt(n,"(",v1),gt(n,")",y1),gt(n,"「",b1),gt(n,"」",_1),gt(n,"『",S1),gt(n,"』",w1),gt(n,"<",M1),gt(n,">",E1),gt(n,"&",A1),gt(n,"*",C1),gt(n,"@",yu),gt(n,"`",R1),gt(n,"^",P1),gt(n,":",Au),gt(n,",",UD),gt(n,"$",D1),gt(n,".",Io),gt(n,"=",k1),gt(n,"!",jD),gt(n,"-",Ns),gt(n,"%",S0),gt(n,"|",O1),gt(n,"+",L1),gt(n,"#",I1),gt(n,"?",w0),gt(n,'"',FD),gt(n,"/",Uo),gt(n,";",zD),gt(n,"~",M0),gt(n,"_",U1),gt(n,"\\",N1),gt(n,"・",Iq);const i=Si(n,Fl,LD,{[X3]:!0});Si(i,Fl,i);const r=Si(i,jl,Oq,{[y0]:!0}),a=Si(i,zg,Lq,{[i0]:!0}),s=Si(n,jl,Hl,{[K3]:!0});Si(s,Fl,r),Si(s,jl,s),Si(r,Fl,r),Si(r,jl,r);const o=Si(n,zg,Q3,{[Y3]:!0});Si(o,jl),Si(o,Fl,a),Si(o,zg,o),Si(a,Fl,a),Si(a,jl),Si(a,zg,a);const l=gt(n,m2,ID,{[f2]:!0}),c=gt(n,n8,tR,{[f2]:!0}),d=Si(n,p2,tR,{[f2]:!0});gt(n,g2,d),gt(c,m2,l),gt(c,g2,d),Si(c,p2,d),gt(d,n8),gt(d,m2),Si(d,p2,d),gt(d,g2,d);const f=Si(n,h2,Uq,{[kq]:!0});gt(f,"#"),Si(f,h2,f),gt(f,sTe,f);const m=gt(f,oTe);gt(m,"#"),Si(m,h2,f);const g=[[jl,s],[Fl,r]],y=[[jl,null],[zg,o],[Fl,a]];for(let _=0;_<Ob.length;_++)pu(n,Ob[_],J3,Hl,g);for(let _=0;_<Lb.length;_++)pu(n,Lb[_],eR,Q3,y);ef(J3,{tld:!0,ascii:!0},e),ef(eR,{utld:!0,alpha:!0},e),pu(n,"file",v_,Hl,g),pu(n,"mailto",v_,Hl,g),pu(n,"http",pp,Hl,g),pu(n,"https",pp,Hl,g),pu(n,"ftp",pp,Hl,g),pu(n,"ftps",pp,Hl,g),ef(v_,{scheme:!0,ascii:!0},e),ef(pp,{slashscheme:!0,ascii:!0},e),t=t.sort((_,v)=>_[0]>v[0]?1:-1);for(let _=0;_<t.length;_++){const v=t[_][0],M=t[_][1]?{[nTe]:!0}:{[iTe]:!0};v.indexOf("-")>=0?M[Z3]=!0:jl.test(v)?Fl.test(v)?M[y0]=!0:M[K3]=!0:M[X3]=!0,t8(n,v,v,M)}return t8(n,"localhost",rx,{ascii:!0}),n.jd=new Oa(j1),{start:n,tokens:Object.assign({groups:e},jq)}}function Fq(t,e){const n=cTe(e.replace(/[A-Z]/g,o=>o.toLowerCase())),i=n.length,r=[];let a=0,s=0;for(;s<i;){let o=t,l=null,c=0,d=null,f=-1,m=-1;for(;s<i&&(l=o.go(n[s]));)o=l,o.accepts()?(f=0,m=0,d=o):f>=0&&(f+=n[s].length,m++),c+=n[s].length,a+=n[s].length,s++;a-=f,s-=m,c-=f,r.push({t:d.t,v:e.slice(a-c,a),s:a-c,e:a})}return r}function cTe(t){const e=[],n=t.length;let i=0;for(;i<n;){let r=t.charCodeAt(i),a,s=r<55296||r>56319||i+1===n||(a=t.charCodeAt(i+1))<56320||a>57343?t[i]:t.slice(i,i+2);e.push(s),i+=s.length}return e}function pu(t,e,n,i,r){let a;const s=e.length;for(let o=0;o<s-1;o++){const l=e[o];t.j[l]?a=t.j[l]:(a=new Oa(i),a.jr=r.slice(),t.j[l]=a),t=a}return a=new Oa(n),a.jr=r.slice(),t.j[e[s-1]]=a,a}function i8(t){const e=[],n=[];let i=0,r="0123456789";for(;i<t.length;){let a=0;for(;r.indexOf(t[i+a])>=0;)a++;if(a>0){e.push(n.join(""));for(let s=parseInt(t.substring(i,i+a),10);s>0;s--)n.pop();i+=a}else n.push(t[i]),i++}return e}const ax={defaultProtocol:"http",events:null,format:r8,formatHref:r8,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function BD(t,e=null){let n=Object.assign({},ax);t&&(n=Object.assign(n,t instanceof BD?t.o:t));const i=n.ignoreTags,r=[];for(let a=0;a<i.length;a++)r.push(i[a].toUpperCase());this.o=n,e&&(this.defaultRender=e),this.ignoreTags=r}BD.prototype={o:ax,ignoreTags:[],defaultRender(t){return t},check(t){return this.get("validate",t.toString(),t)},get(t,e,n){const i=e!=null;let r=this.o[t];return r&&(typeof r=="object"?(r=n.t in r?r[n.t]:ax[t],typeof r=="function"&&i&&(r=r(e,n))):typeof r=="function"&&i&&(r=r(e,n.t,n)),r)},getObj(t,e,n){let i=this.o[t];return typeof i=="function"&&e!=null&&(i=i(e,n.t,n)),i},render(t){const e=t.render(this);return(this.get("render",null,t)||this.defaultRender)(e,t.t,t)}};function r8(t){return t}function zq(t,e){this.t="token",this.v=t,this.tk=e}zq.prototype={isLink:!1,toString(){return this.v},toHref(t){return this.toString()},toFormattedString(t){const e=this.toString(),n=t.get("truncate",e,this),i=t.get("format",e,this);return n&&i.length>n?i.substring(0,n)+"…":i},toFormattedHref(t){return t.get("formatHref",this.toHref(t.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(t=ax.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(t),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(t){return{type:this.t,value:this.toFormattedString(t),isLink:this.isLink,href:this.toFormattedHref(t),start:this.startIndex(),end:this.endIndex()}},validate(t){return t.get("validate",this.toString(),this)},render(t){const e=this,n=this.toHref(t.get("defaultProtocol")),i=t.get("formatHref",n,this),r=t.get("tagName",n,e),a=this.toFormattedString(t),s={},o=t.get("className",n,e),l=t.get("target",n,e),c=t.get("rel",n,e),d=t.getObj("attributes",n,e),f=t.getObj("events",n,e);return s.href=i,o&&(s.class=o),l&&(s.target=l),c&&(s.rel=c),d&&Object.assign(s,d),{tagName:r,attributes:s,content:a,eventListeners:f}}};function pw(t,e){class n extends zq{constructor(r,a){super(r,a),this.t=t}}for(const i in e)n.prototype[i]=e[i];return n.t=t,n}const a8=pw("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),s8=pw("text"),uTe=pw("nl"),Ib=pw("url",{isLink:!0,toHref(t=ax.defaultProtocol){return this.hasProtocol()?this.v:`${t}://${this.v}`},hasProtocol(){const t=this.tk;return t.length>=2&&t[0].t!==rx&&t[1].t===Au}}),Es=t=>new Oa(t);function dTe({groups:t}){const e=t.domain.concat([A1,C1,yu,N1,R1,P1,D1,k1,Ns,LD,S0,O1,L1,I1,Uo,j1,M0,U1]),n=[T1,Au,UD,Io,jD,S0,w0,FD,zD,g1,x1,b0,_0,h1,f1,p1,m1,v1,y1,b1,_1,S1,w1,M1,E1],i=[A1,T1,C1,N1,R1,P1,D1,k1,Ns,b0,_0,S0,O1,L1,I1,w0,Uo,j1,M0,U1],r=Es(),a=gt(r,M0);tn(a,i,a),tn(a,t.domain,a);const s=Es(),o=Es(),l=Es();tn(r,t.domain,s),tn(r,t.scheme,o),tn(r,t.slashscheme,l),tn(s,i,a),tn(s,t.domain,s);const c=gt(s,yu);gt(a,yu,c),gt(o,yu,c),gt(l,yu,c);const d=gt(a,Io);tn(d,i,a),tn(d,t.domain,a);const f=Es();tn(c,t.domain,f),tn(f,t.domain,f);const m=gt(f,Io);tn(m,t.domain,f);const g=Es(a8);tn(m,t.tld,g),tn(m,t.utld,g),gt(c,rx,g);const y=gt(f,Ns);gt(y,Ns,y),tn(y,t.domain,f),tn(g,t.domain,f),gt(g,Io,m),gt(g,Ns,y);const _=gt(g,Au);tn(_,t.numeric,a8);const v=gt(s,Ns),x=gt(s,Io);gt(v,Ns,v),tn(v,t.domain,s),tn(x,i,a),tn(x,t.domain,s);const M=Es(Ib);tn(x,t.tld,M),tn(x,t.utld,M),tn(M,t.domain,s),tn(M,i,a),gt(M,Io,x),gt(M,Ns,v),gt(M,yu,c);const w=gt(M,Au),T=Es(Ib);tn(w,t.numeric,T);const C=Es(Ib),P=Es();tn(C,e,C),tn(C,n,P),tn(P,e,C),tn(P,n,P),gt(M,Uo,C),gt(T,Uo,C);const A=gt(o,Au),U=gt(l,Au),N=gt(U,Uo),D=gt(N,Uo);tn(o,t.domain,s),gt(o,Io,x),gt(o,Ns,v),tn(l,t.domain,s),gt(l,Io,x),gt(l,Ns,v),tn(A,t.domain,C),gt(A,Uo,C),gt(A,w0,C),tn(D,t.domain,C),tn(D,e,C),gt(D,Uo,C);const F=[[b0,_0],[f1,h1],[p1,m1],[g1,x1],[v1,y1],[b1,_1],[S1,w1],[M1,E1]];for(let I=0;I<F.length;I++){const[W,O]=F[I],B=gt(C,W);gt(P,W,B),gt(B,O,C);const H=Es(Ib);tn(B,e,H);const $=Es();tn(B,n),tn(H,e,H),tn(H,n,$),tn($,e,H),tn($,n,$),gt(H,O,C),gt($,O,C)}return gt(r,rx,M),gt(r,ID,uTe),{start:r,tokens:jq}}function fTe(t,e,n){let i=n.length,r=0,a=[],s=[];for(;r<i;){let o=t,l=null,c=null,d=0,f=null,m=-1;for(;r<i&&!(l=o.go(n[r].t));)s.push(n[r++]);for(;r<i&&(c=l||o.go(n[r].t));)l=null,o=c,o.accepts()?(m=0,f=o):m>=0&&m++,r++,d++;if(m<0)r-=d,r<i&&(s.push(n[r]),r++);else{s.length>0&&(a.push(x2(s8,e,s)),s=[]),r-=m,d-=m;const g=f.t,y=n.slice(r-d,r);a.push(x2(g,e,y))}}return s.length>0&&a.push(x2(s8,e,s)),a}function x2(t,e,n){const i=n[0].s,r=n[n.length-1].e,a=e.slice(i,r);return new t(a,n)}const hTe=typeof console<"u"&&console&&console.warn||(()=>{}),pTe="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",ri={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function mTe(){return Oa.groups={},ri.scanner=null,ri.parser=null,ri.tokenQueue=[],ri.pluginQueue=[],ri.customSchemes=[],ri.initialized=!1,ri}function o8(t,e=!1){if(ri.initialized&&hTe(`linkifyjs: already initialized - will not register custom scheme "${t}" ${pTe}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(t))throw new Error(`linkifyjs: incorrect scheme format.
  8164. 1. Must only contain digits, lowercase ASCII letters or "-"
  8165. 2. Cannot start or end with "-"
  8166. 3. "-" cannot repeat`);ri.customSchemes.push([t,e])}function gTe(){ri.scanner=lTe(ri.customSchemes);for(let t=0;t<ri.tokenQueue.length;t++)ri.tokenQueue[t][1]({scanner:ri.scanner});ri.parser=dTe(ri.scanner.tokens);for(let t=0;t<ri.pluginQueue.length;t++)ri.pluginQueue[t][1]({scanner:ri.scanner,parser:ri.parser});return ri.initialized=!0,ri}function HD(t){return ri.initialized||gTe(),fTe(ri.parser.start,t,Fq(ri.scanner.start,t))}HD.scan=Fq;function Bq(t,e=null,n=null){if(e&&typeof e=="object"){if(n)throw Error(`linkifyjs: Invalid link type ${e}; must be a string`);n=e,e=null}const i=new BD(n),r=HD(t),a=[];for(let s=0;s<r.length;s++){const o=r[s];o.isLink&&(!e||o.t===e)&&i.check(o)&&a.push(o.toFormattedObject(i))}return a}var VD="[\0-   ᠎ -\u2029  ]",xTe=new RegExp(VD),vTe=new RegExp(`${VD}$`),yTe=new RegExp(VD,"g");function bTe(t){return t.length===1?t[0].isLink:t.length===3&&t[1].isLink?["()","[]"].includes(t[0].value+t[2].value):!1}function _Te(t){return new xi({key:new lr("autolink"),appendTransaction:(e,n,i)=>{const r=e.some(c=>c.docChanged)&&!n.doc.eq(i.doc),a=e.some(c=>c.getMeta("preventAutolink"));if(!r||a)return;const{tr:s}=i,o=sq(n.doc,[...e]);if(hq(o).forEach(({newRange:c})=>{const d=rEe(i.doc,c,g=>g.isTextblock);let f,m;if(d.length>1)f=d[0],m=i.doc.textBetween(f.pos,f.pos+f.node.nodeSize,void 0," ");else if(d.length){const g=i.doc.textBetween(c.from,c.to," "," ");if(!vTe.test(g))return;f=d[0],m=i.doc.textBetween(f.pos,c.to,void 0," ")}if(f&&m){const g=m.split(xTe).filter(Boolean);if(g.length<=0)return!1;const y=g[g.length-1],_=f.pos+m.lastIndexOf(y);if(!y)return!1;const v=HD(y).map(x=>x.toObject(t.defaultProtocol));if(!bTe(v))return!1;v.filter(x=>x.isLink).map(x=>({...x,from:_+x.start+1,to:_+x.end+1})).filter(x=>i.schema.marks.code?!i.doc.rangeHasMark(x.from,x.to,i.schema.marks.code):!0).filter(x=>t.validate(x.value)).filter(x=>t.shouldAutoLink(x.value)).forEach(x=>{RD(x.from,x.to,i.doc).some(M=>M.mark.type===t.type)||s.addMark(x.from,x.to,t.type.create({href:x.href}))})}}),!!s.steps.length)return s}})}function STe(t){return new xi({key:new lr("handleClickLink"),props:{handleClick:(e,n,i)=>{var r,a;if(i.button!==0||!e.editable)return!1;let s=null;if(i.target instanceof HTMLAnchorElement)s=i.target;else{let d=i.target;const f=[];for(;d.nodeName!=="DIV";)f.push(d),d=d.parentNode;s=f.find(m=>m.nodeName==="A")}if(!s)return!1;const o=fq(e.state,t.type.name),l=(r=s?.href)!=null?r:o.href,c=(a=s?.target)!=null?a:o.target;return t.enableClickSelection&&t.editor.commands.extendMarkRange(t.type.name),s&&l?(window.open(l,c),!0):!1}}})}function wTe(t){return new xi({key:new lr("handlePasteLink"),props:{handlePaste:(e,n,i)=>{const{shouldAutoLink:r}=t,{state:a}=e,{selection:s}=a,{empty:o}=s;if(o)return!1;let l="";i.content.forEach(d=>{l+=d.textContent});const c=Bq(l,{defaultProtocol:t.defaultProtocol}).find(d=>d.isLink&&d.value===l);return!l||!c||r!==void 0&&!r(c.href)?!1:t.editor.commands.setMark(t.type,{href:c.href})}}})}function jd(t,e){const n=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(i=>{const r=typeof i=="string"?i:i.scheme;r&&n.push(r)}),!t||t.replace(yTe,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}var Hq=od.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(t=>{if(typeof t=="string"){o8(t);return}o8(t.scheme,t.optionalSlashes)})},onDestroy(){mTe()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,enableClickSelection:!1,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(t,e)=>!!jd(t,e.protocols),validate:t=>!!t,shouldAutoLink:t=>!!t}},addAttributes(){return{href:{default:null,parseHTML(t){return t.getAttribute("href")}},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class}}},parseHTML(){return[{tag:"a[href]",getAttrs:t=>{const e=t.getAttribute("href");return!e||!this.options.isAllowedUri(e,{defaultValidate:n=>!!jd(n,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:t}){return this.options.isAllowedUri(t.href,{defaultValidate:e=>!!jd(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",Ei(this.options.HTMLAttributes,t),0]:["a",Ei(this.options.HTMLAttributes,{...t,href:""}),0]},markdownTokenName:"link",parseMarkdown:(t,e)=>e.applyMark("link",e.parseInline(t.tokens||[]),{href:t.href,title:t.title||null}),renderMarkdown:(t,e)=>{var n;const i=((n=t.attrs)==null?void 0:n.href)||"";return`[${e.renderChildren(t)}](${i})`},addCommands(){return{setLink:t=>({chain:e})=>{const{href:n}=t;return this.options.isAllowedUri(n,{defaultValidate:i=>!!jd(i,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().setMark(this.name,t).setMeta("preventAutolink",!0).run():!1},toggleLink:t=>({chain:e})=>{const{href:n}=t||{};return n&&!this.options.isAllowedUri(n,{defaultValidate:i=>!!jd(i,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:e().toggleMark(this.name,t,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()},unsetLink:()=>({chain:t})=>t().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[Df({find:t=>{const e=[];if(t){const{protocols:n,defaultProtocol:i}=this.options,r=Bq(t).filter(a=>a.isLink&&this.options.isAllowedUri(a.value,{defaultValidate:s=>!!jd(s,n),protocols:n,defaultProtocol:i}));r.length&&r.forEach(a=>{this.options.shouldAutoLink(a.value)&&e.push({text:a.value,data:{href:a.href},index:a.start})})}return e},type:this.type,getAttributes:t=>{var e;return{href:(e=t.data)==null?void 0:e.href}}})]},addProseMirrorPlugins(){const t=[],{protocols:e,defaultProtocol:n}=this.options;return this.options.autolink&&t.push(_Te({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:i=>this.options.isAllowedUri(i,{defaultValidate:r=>!!jd(r,e),protocols:e,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),this.options.openOnClick===!0&&t.push(STe({type:this.type,editor:this.editor,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&t.push(wTe({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),t}}),MTe=Hq,ETe=Object.defineProperty,ATe=(t,e)=>{for(var n in e)ETe(t,n,{get:e[n],enumerable:!0})},TTe="listItem",l8="textStyle",c8=/^\s*([-+*])\s$/,Vq=Ba.create({name:"bulletList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:"ul"}]},renderHTML({HTMLAttributes:t}){return["ul",Ei(this.options.HTMLAttributes,t),0]},markdownTokenName:"list",parseMarkdown:(t,e)=>t.type!=="list"||t.ordered?[]:{type:"bulletList",content:t.items?e.parseChildren(t.items):[]},renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
  8167. `):"",markdownOptions:{indentsContent:!0},addCommands(){return{toggleBulletList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(TTe,this.editor.getAttributes(l8)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let t=Qp({find:c8,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(t=Qp({find:c8,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(l8),editor:this.editor})),[t]}}),$q=Ba.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:t}){return["li",Ei(this.options.HTMLAttributes,t),0]},markdownTokenName:"list_item",parseMarkdown:(t,e)=>{if(t.type!=="list_item")return[];let n=[];if(t.tokens&&t.tokens.length>0)if(t.tokens.some(r=>r.type==="paragraph"))n=e.parseChildren(t.tokens);else{const r=t.tokens[0];if(r&&r.type==="text"&&r.tokens&&r.tokens.length>0){if(n=[{type:"paragraph",content:e.parseInline(r.tokens)}],t.tokens.length>1){const s=t.tokens.slice(1),o=e.parseChildren(s);n.push(...o)}}else n=e.parseChildren(t.tokens)}return n.length===0&&(n=[{type:"paragraph",content:[]}]),{type:"listItem",content:n}},renderMarkdown:(t,e,n)=>OD(t,e,i=>i.parentType==="bulletList"?"- ":i.parentType==="orderedList"?`${i.index+1}. `:"- ",n),addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),CTe={};ATe(CTe,{findListItemPos:()=>jx,getNextListDepth:()=>$D,handleBackspace:()=>nR,handleDelete:()=>iR,hasListBefore:()=>Gq,hasListItemAfter:()=>NTe,hasListItemBefore:()=>Wq,listItemHasSubList:()=>qq,nextListIsDeeper:()=>Xq,nextListIsHigher:()=>Kq});var jx=(t,e)=>{const{$from:n}=e.selection,i=Ki(t,e.schema);let r=null,a=n.depth,s=n.pos,o=null;for(;a>0&&o===null;)r=n.node(a),r.type===i?o=a:(a-=1,s-=1);return o===null?null:{$pos:e.doc.resolve(s),depth:o}},$D=(t,e)=>{const n=jx(t,e);if(!n)return!1;const[,i]=pEe(e,t,n.$pos.pos+4);return i},Gq=(t,e,n)=>{const{$anchor:i}=t.selection,r=Math.max(0,i.pos-2),a=t.doc.resolve(r).node();return!(!a||!n.includes(a.type.name))},Wq=(t,e)=>{var n;const{$anchor:i}=e.selection,r=e.doc.resolve(i.pos-2);return!(r.index()===0||((n=r.nodeBefore)==null?void 0:n.type.name)!==t)},qq=(t,e,n)=>{if(!n)return!1;const i=Ki(t,e.schema);let r=!1;return n.descendants(a=>{a.type===i&&(r=!0)}),r},nR=(t,e,n)=>{if(t.commands.undoInputRule())return!0;if(t.state.selection.from!==t.state.selection.to)return!1;if(!Yu(t.state,e)&&Gq(t.state,e,n)){const{$anchor:o}=t.state.selection,l=t.state.doc.resolve(o.before()-1),c=[];l.node().descendants((m,g)=>{m.type.name===e&&c.push({node:m,pos:g})});const d=c.at(-1);if(!d)return!1;const f=t.state.doc.resolve(l.start()+d.pos+1);return t.chain().cut({from:o.start()-1,to:o.end()+1},f.end()).joinForward().run()}if(!Yu(t.state,e)||!vEe(t.state))return!1;const i=jx(e,t.state);if(!i)return!1;const a=t.state.doc.resolve(i.$pos.pos-2).node(i.depth),s=qq(e,t.state,a);return Wq(e,t.state)&&!s?t.commands.joinItemBackward():t.chain().liftListItem(e).run()},Xq=(t,e)=>{const n=$D(t,e),i=jx(t,e);return!i||!n?!1:n>i.depth},Kq=(t,e)=>{const n=$D(t,e),i=jx(t,e);return!i||!n?!1:n<i.depth},iR=(t,e)=>{if(!Yu(t.state,e)||!xEe(t.state,e))return!1;const{selection:n}=t.state,{$from:i,$to:r}=n;return!n.empty&&i.sameParent(r)?!1:Xq(e,t.state)?t.chain().focus(t.state.selection.from+4).lift(e).joinBackward().run():Kq(e,t.state)?t.chain().joinForward().joinBackward().run():t.commands.joinItemForward()},NTe=(t,e)=>{var n;const{$anchor:i}=e.selection,r=e.doc.resolve(i.pos-i.parentOffset-2);return!(r.index()===r.parent.childCount-1||((n=r.nodeAfter)==null?void 0:n.type.name)!==t)},Yq=Gn.create({name:"listKeymap",addOptions(){return{listTypes:[{itemName:"listItem",wrapperNames:["bulletList","orderedList"]},{itemName:"taskItem",wrapperNames:["taskList"]}]}},addKeyboardShortcuts(){return{Delete:({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n})=>{t.state.schema.nodes[n]!==void 0&&iR(t,n)&&(e=!0)}),e},"Mod-Delete":({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n})=>{t.state.schema.nodes[n]!==void 0&&iR(t,n)&&(e=!0)}),e},Backspace:({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:i})=>{t.state.schema.nodes[n]!==void 0&&nR(t,n,i)&&(e=!0)}),e},"Mod-Backspace":({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:i})=>{t.state.schema.nodes[n]!==void 0&&nR(t,n,i)&&(e=!0)}),e}}}}),u8=/^(\s*)(\d+)\.\s+(.*)$/,RTe=/^\s/;function PTe(t){const e=[];let n=0,i=0;for(;n<t.length;){const r=t[n],a=r.match(u8);if(!a)break;const[,s,o,l]=a,c=s.length;let d=l,f=n+1;const m=[r];for(;f<t.length;){const g=t[f];if(g.match(u8))break;if(g.trim()==="")m.push(g),d+=`
  8168. `,f+=1;else if(g.match(RTe))m.push(g),d+=`
  8169. ${g.slice(c+2)}`,f+=1;else break}e.push({indent:c,number:parseInt(o,10),content:d.trim(),raw:m.join(`
  8170. `)}),i=f,n=f}return[e,i]}function Zq(t,e,n){var i;const r=[];let a=0;for(;a<t.length;){const s=t[a];if(s.indent===e){const o=s.content.split(`
  8171. `),l=((i=o[0])==null?void 0:i.trim())||"",c=[];l&&c.push({type:"paragraph",raw:l,tokens:n.inlineTokens(l)});const d=o.slice(1).join(`
  8172. `).trim();if(d){const g=n.blockTokens(d);c.push(...g)}let f=a+1;const m=[];for(;f<t.length&&t[f].indent>e;)m.push(t[f]),f+=1;if(m.length>0){const g=Math.min(...m.map(_=>_.indent)),y=Zq(m,g,n);c.push({type:"list",ordered:!0,start:m[0].number,items:y,raw:m.map(_=>_.raw).join(`
  8173. `)})}r.push({type:"list_item",raw:s.raw,tokens:c}),a=f}else a+=1}return r}function DTe(t,e){return t.map(n=>{if(n.type!=="list_item")return e.parseChildren([n])[0];const i=[];return n.tokens&&n.tokens.length>0&&n.tokens.forEach(r=>{if(r.type==="paragraph"||r.type==="list"||r.type==="blockquote"||r.type==="code")i.push(...e.parseChildren([r]));else if(r.type==="text"&&r.tokens){const a=e.parseChildren([r]);i.push({type:"paragraph",content:a})}else{const a=e.parseChildren([r]);a.length>0&&i.push(...a)}}),{type:"listItem",content:i}})}var kTe="listItem",d8="textStyle",f8=/^(\d+)\.\s$/,Qq=Ba.create({name:"orderedList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:t=>t.hasAttribute("start")?parseInt(t.getAttribute("start")||"",10):1},type:{default:null,parseHTML:t=>t.getAttribute("type")}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:t}){const{start:e,...n}=t;return e===1?["ol",Ei(this.options.HTMLAttributes,n),0]:["ol",Ei(this.options.HTMLAttributes,t),0]},markdownTokenName:"list",parseMarkdown:(t,e)=>{if(t.type!=="list"||!t.ordered)return[];const n=t.start||1,i=t.items?DTe(t.items,e):[];return n!==1?{type:"orderedList",attrs:{start:n},content:i}:{type:"orderedList",content:i}},renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
  8174. `):"",markdownTokenizer:{name:"orderedList",level:"block",start:t=>{const e=t.match(/^(\s*)(\d+)\.\s+/),n=e?.index;return n!==void 0?n:-1},tokenize:(t,e,n)=>{var i;const r=t.split(`
  8175. `),[a,s]=PTe(r);if(a.length===0)return;const o=Zq(a,0,n);return o.length===0?void 0:{type:"list",ordered:!0,start:((i=a[0])==null?void 0:i.number)||1,items:o,raw:r.slice(0,s).join(`
  8176. `)}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(kTe,this.editor.getAttributes(d8)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let t=Qp({find:f8,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(t=Qp({find:f8,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(d8)}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1],editor:this.editor})),[t]}}),OTe=/^\s*(\[([( |x])?\])\s$/,LTe=Ba.create({name:"taskItem",addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:"taskList",a11y:void 0}},content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:t=>{const e=t.getAttribute("data-checked");return e===""||e==="true"},renderHTML:t=>({"data-checked":t.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:t,HTMLAttributes:e}){return["li",Ei(this.options.HTMLAttributes,e,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:t.attrs.checked?"checked":null}],["span"]],["div",0]]},parseMarkdown:(t,e)=>{const n=[];if(t.tokens&&t.tokens.length>0?n.push(e.createNode("paragraph",{},e.parseInline(t.tokens))):t.text?n.push(e.createNode("paragraph",{},[e.createNode("text",{text:t.text})])):n.push(e.createNode("paragraph",{},[])),t.nestedTokens&&t.nestedTokens.length>0){const i=e.parseChildren(t.nestedTokens);n.push(...i)}return e.createNode("taskItem",{checked:t.checked||!1},n)},renderMarkdown:(t,e)=>{var n;const r=`- [${(n=t.attrs)!=null&&n.checked?"x":" "}] `;return OD(t,e,r)},addKeyboardShortcuts(){const t={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...t,Tab:()=>this.editor.commands.sinkListItem(this.name)}:t},addNodeView(){return({node:t,HTMLAttributes:e,getPos:n,editor:i})=>{const r=document.createElement("li"),a=document.createElement("label"),s=document.createElement("span"),o=document.createElement("input"),l=document.createElement("div"),c=d=>{var f,m;o.ariaLabel=((m=(f=this.options.a11y)==null?void 0:f.checkboxLabel)==null?void 0:m.call(f,d,o.checked))||`Task item checkbox for ${d.textContent||"empty task item"}`};return c(t),a.contentEditable="false",o.type="checkbox",o.addEventListener("mousedown",d=>d.preventDefault()),o.addEventListener("change",d=>{if(!i.isEditable&&!this.options.onReadOnlyChecked){o.checked=!o.checked;return}const{checked:f}=d.target;i.isEditable&&typeof n=="function"&&i.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:m})=>{const g=n();if(typeof g!="number")return!1;const y=m.doc.nodeAt(g);return m.setNodeMarkup(g,void 0,{...y?.attrs,checked:f}),!0}).run(),!i.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(t,f)||(o.checked=!o.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([d,f])=>{r.setAttribute(d,f)}),r.dataset.checked=t.attrs.checked,o.checked=t.attrs.checked,a.append(o,s),r.append(a,l),Object.entries(e).forEach(([d,f])=>{r.setAttribute(d,f)}),{dom:r,contentDOM:l,update:d=>d.type!==this.type?!1:(r.dataset.checked=d.attrs.checked,o.checked=d.attrs.checked,c(d),!0)}}},addInputRules(){return[Qp({find:OTe,type:this.type,getAttributes:t=>({checked:t[t.length-1]==="x"})})]}}),ITe=Ba.create({name:"taskList",addOptions(){return{itemTypeName:"taskItem",HTMLAttributes:{}}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:t}){return["ul",Ei(this.options.HTMLAttributes,t,{"data-type":this.name}),0]},parseMarkdown:(t,e)=>e.createNode("taskList",{},e.parseChildren(t.items||[])),renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
  8177. `):"",markdownTokenizer:{name:"taskList",level:"block",start(t){var e;const n=(e=t.match(/^\s*[-+*]\s+\[([ xX])\]\s+/))==null?void 0:e.index;return n!==void 0?n:-1},tokenize(t,e,n){const i=a=>{const s=W3(a,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:o=>({indentLevel:o[1].length,mainContent:o[4],checked:o[3].toLowerCase()==="x"}),createToken:(o,l)=>({type:"taskItem",raw:"",mainContent:o.mainContent,indentLevel:o.indentLevel,checked:o.checked,text:o.mainContent,tokens:n.inlineTokens(o.mainContent),nestedTokens:l}),customNestedParser:i},n);return s?[{type:"taskList",raw:s.raw,items:s.items}]:n.blockTokens(a)},r=W3(t,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:a=>({indentLevel:a[1].length,mainContent:a[4],checked:a[3].toLowerCase()==="x"}),createToken:(a,s)=>({type:"taskItem",raw:"",mainContent:a.mainContent,indentLevel:a.indentLevel,checked:a.checked,text:a.mainContent,tokens:n.inlineTokens(a.mainContent),nestedTokens:s}),customNestedParser:i},n);if(r)return{type:"taskList",raw:r.raw,items:r.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:t})=>t.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});Gn.create({name:"listKit",addExtensions(){const t=[];return this.options.bulletList!==!1&&t.push(Vq.configure(this.options.bulletList)),this.options.listItem!==!1&&t.push($q.configure(this.options.listItem)),this.options.listKeymap!==!1&&t.push(Yq.configure(this.options.listKeymap)),this.options.orderedList!==!1&&t.push(Qq.configure(this.options.orderedList)),this.options.taskItem!==!1&&t.push(LTe.configure(this.options.taskItem)),this.options.taskList!==!1&&t.push(ITe.configure(this.options.taskList)),t}});var UTe=Ba.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",Ei(this.options.HTMLAttributes,t),0]},parseMarkdown:(t,e)=>{const n=t.tokens||[];return n.length===1&&n[0].type==="image"?e.parseChildren([n[0]]):e.createNode("paragraph",void 0,e.parseInline(n))},renderMarkdown:(t,e)=>!t||!Array.isArray(t.content)?"":e.renderChildren(t.content),addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),jTe=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,FTe=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,zTe=od.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["s",Ei(this.options.HTMLAttributes,t),0]},markdownTokenName:"del",parseMarkdown:(t,e)=>e.applyMark("strike",e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>`~~${e.renderChildren(t)}~~`,addCommands(){return{setStrike:()=>({commands:t})=>t.setMark(this.name),toggleStrike:()=>({commands:t})=>t.toggleMark(this.name),unsetStrike:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[Zp({find:jTe,type:this.type})]},addPasteRules(){return[Df({find:FTe,type:this.type})]}}),BTe=Ba.create({name:"text",group:"inline",parseMarkdown:t=>({type:"text",text:t.text||""}),renderMarkdown:t=>t.text||""}),Jq=od.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["u",Ei(this.options.HTMLAttributes,t),0]},parseMarkdown(t,e){return e.applyMark(this.name||"underline",e.parseInline(t.tokens||[]))},renderMarkdown(t,e){return`++${e.renderChildren(t)}++`},markdownTokenizer:{name:"underline",level:"inline",start(t){return t.indexOf("++")},tokenize(t,e,n){const r=/^(\+\+)([\s\S]+?)(\+\+)/.exec(t);if(!r)return;const a=r[2].trim();return{type:"underline",raw:r[0],text:a,tokens:n.inlineTokens(a)}}},addCommands(){return{setUnderline:()=>({commands:t})=>t.setMark(this.name),toggleUnderline:()=>({commands:t})=>t.toggleMark(this.name),unsetUnderline:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}}),HTe=Jq;function VTe(t={}){return new xi({view(e){return new $Te(e,t)}})}class $Te{constructor(e,n){var i;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(i=n.width)!==null&&i!==void 0?i:1,this.color=n.color===!1?void 0:n.color||"black",this.class=n.class,this.handlers=["dragover","dragend","drop","dragleave"].map(r=>{let a=s=>{this[r](s)};return e.dom.addEventListener(r,a),{name:r,handler:a}})}destroy(){this.handlers.forEach(({name:e,handler:n})=>this.editorView.dom.removeEventListener(e,n))}update(e,n){this.cursorPos!=null&&n.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),n=!e.parent.inlineContent,i,r=this.editorView.dom,a=r.getBoundingClientRect(),s=a.width/r.offsetWidth,o=a.height/r.offsetHeight;if(n){let f=e.nodeBefore,m=e.nodeAfter;if(f||m){let g=this.editorView.nodeDOM(this.cursorPos-(f?f.nodeSize:0));if(g){let y=g.getBoundingClientRect(),_=f?y.bottom:y.top;f&&m&&(_=(_+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let v=this.width/2*o;i={left:y.left,right:y.right,top:_-v,bottom:_+v}}}}if(!i){let f=this.editorView.coordsAtPos(this.cursorPos),m=this.width/2*s;i={left:f.left-m,right:f.left+m,top:f.top,bottom:f.bottom}}let l=this.editorView.dom.offsetParent;this.element||(this.element=l.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",n),this.element.classList.toggle("prosemirror-dropcursor-inline",!n);let c,d;if(!l||l==document.body&&getComputedStyle(l).position=="static")c=-pageXOffset,d=-pageYOffset;else{let f=l.getBoundingClientRect(),m=f.width/l.offsetWidth,g=f.height/l.offsetHeight;c=f.left-l.scrollLeft*m,d=f.top-l.scrollTop*g}this.element.style.left=(i.left-c)/s+"px",this.element.style.top=(i.top-d)/o+"px",this.element.style.width=(i.right-i.left)/s+"px",this.element.style.height=(i.bottom-i.top)/o+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let n=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),i=n&&n.inside>=0&&this.editorView.state.doc.nodeAt(n.inside),r=i&&i.type.spec.disableDropCursor,a=typeof r=="function"?r(this.editorView,n,e):r;if(n&&!a){let s=n.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let o=Q7(this.editorView.state.doc,s,this.editorView.dragging.slice);o!=null&&(s=o)}this.setCursor(s),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}class Mi extends sn{constructor(e){super(e,e)}map(e,n){let i=e.resolve(n.map(this.head));return Mi.valid(i)?new Mi(i):sn.near(i)}content(){return Mt.empty}eq(e){return e instanceof Mi&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new Mi(e.resolve(n.pos))}getBookmark(){return new GD(this.anchor)}static valid(e){let n=e.parent;if(n.isTextblock||!GTe(e)||!WTe(e))return!1;let i=n.type.spec.allowGapCursor;if(i!=null)return i;let r=n.contentMatchAt(e.index()).defaultType;return r&&r.isTextblock}static findGapCursorFrom(e,n,i=!1){e:for(;;){if(!i&&Mi.valid(e))return e;let r=e.pos,a=null;for(let s=e.depth;;s--){let o=e.node(s);if(n>0?e.indexAfter(s)<o.childCount:e.index(s)>0){a=o.child(n>0?e.indexAfter(s):e.index(s)-1);break}else if(s==0)return null;r+=n;let l=e.doc.resolve(r);if(Mi.valid(l))return l}for(;;){let s=n>0?a.firstChild:a.lastChild;if(!s){if(a.isAtom&&!a.isText&&!Ft.isSelectable(a)){e=e.doc.resolve(r+a.nodeSize*n),i=!1;continue e}break}a=s,r+=n;let o=e.doc.resolve(r);if(Mi.valid(o))return o}return null}}}Mi.prototype.visible=!1;Mi.findFrom=Mi.findGapCursorFrom;sn.jsonID("gapcursor",Mi);class GD{constructor(e){this.pos=e}map(e){return new GD(e.map(this.pos))}resolve(e){let n=e.resolve(this.pos);return Mi.valid(n)?new Mi(n):sn.near(n)}}function eX(t){return t.isAtom||t.spec.isolating||t.spec.createGapCursor}function GTe(t){for(let e=t.depth;e>=0;e--){let n=t.index(e),i=t.node(e);if(n==0){if(i.type.spec.isolating)return!0;continue}for(let r=i.child(n-1);;r=r.lastChild){if(r.childCount==0&&!r.inlineContent||eX(r.type))return!0;if(r.inlineContent)return!1}}return!0}function WTe(t){for(let e=t.depth;e>=0;e--){let n=t.indexAfter(e),i=t.node(e);if(n==i.childCount){if(i.type.spec.isolating)return!0;continue}for(let r=i.child(n);;r=r.firstChild){if(r.childCount==0&&!r.inlineContent||eX(r.type))return!0;if(r.inlineContent)return!1}}return!0}function qTe(){return new xi({props:{decorations:ZTe,createSelectionBetween(t,e,n){return e.pos==n.pos&&Mi.valid(n)?new Mi(n):null},handleClick:KTe,handleKeyDown:XTe,handleDOMEvents:{beforeinput:YTe}}})}const XTe=QW({ArrowLeft:Ub("horiz",-1),ArrowRight:Ub("horiz",1),ArrowUp:Ub("vert",-1),ArrowDown:Ub("vert",1)});function Ub(t,e){const n=t=="vert"?e>0?"down":"up":e>0?"right":"left";return function(i,r,a){let s=i.selection,o=e>0?s.$to:s.$from,l=s.empty;if(s instanceof Vt){if(!a.endOfTextblock(n)||o.depth==0)return!1;l=!1,o=i.doc.resolve(e>0?o.after():o.before())}let c=Mi.findGapCursorFrom(o,e,l);return c?(r&&r(i.tr.setSelection(new Mi(c))),!0):!1}}function KTe(t,e,n){if(!t||!t.editable)return!1;let i=t.state.doc.resolve(e);if(!Mi.valid(i))return!1;let r=t.posAtCoords({left:n.clientX,top:n.clientY});return r&&r.inside>-1&&Ft.isSelectable(t.state.doc.nodeAt(r.inside))?!1:(t.dispatch(t.state.tr.setSelection(new Mi(i))),!0)}function YTe(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof Mi))return!1;let{$from:n}=t.state.selection,i=n.parent.contentMatchAt(n.index()).findWrapping(t.state.schema.nodes.text);if(!i)return!1;let r=ht.empty;for(let s=i.length-1;s>=0;s--)r=ht.from(i[s].createAndFill(null,r));let a=t.state.tr.replace(n.pos,n.pos,new Mt(r,0,0));return a.setSelection(Vt.near(a.doc.resolve(n.pos+1))),t.dispatch(a),!1}function ZTe(t){if(!(t.selection instanceof Mi))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",pi.create(t.doc,[ha.widget(t.selection.head,e,{key:"gapcursor"})])}var F1=200,Tr=function(){};Tr.prototype.append=function(e){return e.length?(e=Tr.from(e),!this.length&&e||e.length<F1&&this.leafAppend(e)||this.length<F1&&e.leafPrepend(this)||this.appendInner(e)):this};Tr.prototype.prepend=function(e){return e.length?Tr.from(e).append(this):this};Tr.prototype.appendInner=function(e){return new QTe(this,e)};Tr.prototype.slice=function(e,n){return e===void 0&&(e=0),n===void 0&&(n=this.length),e>=n?Tr.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,n))};Tr.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};Tr.prototype.forEach=function(e,n,i){n===void 0&&(n=0),i===void 0&&(i=this.length),n<=i?this.forEachInner(e,n,i,0):this.forEachInvertedInner(e,n,i,0)};Tr.prototype.map=function(e,n,i){n===void 0&&(n=0),i===void 0&&(i=this.length);var r=[];return this.forEach(function(a,s){return r.push(e(a,s))},n,i),r};Tr.from=function(e){return e instanceof Tr?e:e&&e.length?new tX(e):Tr.empty};var tX=(function(t){function e(i){t.call(this),this.values=i}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(r,a){return r==0&&a==this.length?this:new e(this.values.slice(r,a))},e.prototype.getInner=function(r){return this.values[r]},e.prototype.forEachInner=function(r,a,s,o){for(var l=a;l<s;l++)if(r(this.values[l],o+l)===!1)return!1},e.prototype.forEachInvertedInner=function(r,a,s,o){for(var l=a-1;l>=s;l--)if(r(this.values[l],o+l)===!1)return!1},e.prototype.leafAppend=function(r){if(this.length+r.length<=F1)return new e(this.values.concat(r.flatten()))},e.prototype.leafPrepend=function(r){if(this.length+r.length<=F1)return new e(r.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(e.prototype,n),e})(Tr);Tr.empty=new tX([]);var QTe=(function(t){function e(n,i){t.call(this),this.left=n,this.right=i,this.length=n.length+i.length,this.depth=Math.max(n.depth,i.depth)+1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(i){return i<this.left.length?this.left.get(i):this.right.get(i-this.left.length)},e.prototype.forEachInner=function(i,r,a,s){var o=this.left.length;if(r<o&&this.left.forEachInner(i,r,Math.min(a,o),s)===!1||a>o&&this.right.forEachInner(i,Math.max(r-o,0),Math.min(this.length,a)-o,s+o)===!1)return!1},e.prototype.forEachInvertedInner=function(i,r,a,s){var o=this.left.length;if(r>o&&this.right.forEachInvertedInner(i,r-o,Math.max(a,o)-o,s+o)===!1||a<o&&this.left.forEachInvertedInner(i,Math.min(r,o),a,s)===!1)return!1},e.prototype.sliceInner=function(i,r){if(i==0&&r==this.length)return this;var a=this.left.length;return r<=a?this.left.slice(i,r):i>=a?this.right.slice(i-a,r-a):this.left.slice(i,a).append(this.right.slice(0,r-a))},e.prototype.leafAppend=function(i){var r=this.right.leafAppend(i);if(r)return new e(this.left,r)},e.prototype.leafPrepend=function(i){var r=this.left.leafPrepend(i);if(r)return new e(r,this.right)},e.prototype.appendInner=function(i){return this.left.depth>=Math.max(this.right.depth,i.depth)+1?new e(this.left,new e(this.right,i)):new e(this,i)},e})(Tr);const JTe=500;class uo{constructor(e,n){this.items=e,this.eventCount=n}popEvent(e,n){if(this.eventCount==0)return null;let i=this.items.length;for(;;i--)if(this.items.get(i-1).selection){--i;break}let r,a;n&&(r=this.remapping(i,this.items.length),a=r.maps.length);let s=e.tr,o,l,c=[],d=[];return this.items.forEach((f,m)=>{if(!f.step){r||(r=this.remapping(i,m+1),a=r.maps.length),a--,d.push(f);return}if(r){d.push(new jo(f.map));let g=f.step.map(r.slice(a)),y;g&&s.maybeStep(g).doc&&(y=s.mapping.maps[s.mapping.maps.length-1],c.push(new jo(y,void 0,void 0,c.length+d.length))),a--,y&&r.appendMap(y,a)}else s.maybeStep(f.step);if(f.selection)return o=r?f.selection.map(r.slice(a)):f.selection,l=new uo(this.items.slice(0,i).append(d.reverse().concat(c)),this.eventCount-1),!1},this.items.length,0),{remaining:l,transform:s,selection:o}}addTransform(e,n,i,r){let a=[],s=this.eventCount,o=this.items,l=!r&&o.length?o.get(o.length-1):null;for(let d=0;d<e.steps.length;d++){let f=e.steps[d].invert(e.docs[d]),m=new jo(e.mapping.maps[d],f,n),g;(g=l&&l.merge(m))&&(m=g,d?a.pop():o=o.slice(0,o.length-1)),a.push(m),n&&(s++,n=void 0),r||(l=m)}let c=s-i.depth;return c>t2e&&(o=e2e(o,c),s-=c),new uo(o.append(a),s)}remapping(e,n){let i=new Q0;return this.items.forEach((r,a)=>{let s=r.mirrorOffset!=null&&a-r.mirrorOffset>=e?i.maps.length-r.mirrorOffset:void 0;i.appendMap(r.map,s)},e,n),i}addMaps(e){return this.eventCount==0?this:new uo(this.items.append(e.map(n=>new jo(n))),this.eventCount)}rebased(e,n){if(!this.eventCount)return this;let i=[],r=Math.max(0,this.items.length-n),a=e.mapping,s=e.steps.length,o=this.eventCount;this.items.forEach(m=>{m.selection&&o--},r);let l=n;this.items.forEach(m=>{let g=a.getMirror(--l);if(g==null)return;s=Math.min(s,g);let y=a.maps[g];if(m.step){let _=e.steps[g].invert(e.docs[g]),v=m.selection&&m.selection.map(a.slice(l+1,g));v&&o++,i.push(new jo(y,_,v))}else i.push(new jo(y))},r);let c=[];for(let m=n;m<s;m++)c.push(new jo(a.maps[m]));let d=this.items.slice(0,r).append(c).append(i),f=new uo(d,o);return f.emptyItemCount()>JTe&&(f=f.compress(this.items.length-i.length)),f}emptyItemCount(){let e=0;return this.items.forEach(n=>{n.step||e++}),e}compress(e=this.items.length){let n=this.remapping(0,e),i=n.maps.length,r=[],a=0;return this.items.forEach((s,o)=>{if(o>=e)r.push(s),s.selection&&a++;else if(s.step){let l=s.step.map(n.slice(i)),c=l&&l.getMap();if(i--,c&&n.appendMap(c,i),l){let d=s.selection&&s.selection.map(n.slice(i));d&&a++;let f=new jo(c.invert(),l,d),m,g=r.length-1;(m=r.length&&r[g].merge(f))?r[g]=m:r.push(f)}}else s.map&&i--},this.items.length,0),new uo(Tr.from(r.reverse()),a)}}uo.empty=new uo(Tr.empty,0);function e2e(t,e){let n;return t.forEach((i,r)=>{if(i.selection&&e--==0)return n=r,!1}),t.slice(n)}class jo{constructor(e,n,i,r){this.map=e,this.step=n,this.selection=i,this.mirrorOffset=r}merge(e){if(this.step&&e.step&&!e.selection){let n=e.step.merge(this.step);if(n)return new jo(n.getMap().invert(),n,this.selection)}}}class bu{constructor(e,n,i,r,a){this.done=e,this.undone=n,this.prevRanges=i,this.prevTime=r,this.prevComposition=a}}const t2e=20;function n2e(t,e,n,i){let r=n.getMeta(ff),a;if(r)return r.historyState;n.getMeta(a2e)&&(t=new bu(t.done,t.undone,null,0,-1));let s=n.getMeta("appendedTransaction");if(n.steps.length==0)return t;if(s&&s.getMeta(ff))return s.getMeta(ff).redo?new bu(t.done.addTransform(n,void 0,i,y_(e)),t.undone,h8(n.mapping.maps),t.prevTime,t.prevComposition):new bu(t.done,t.undone.addTransform(n,void 0,i,y_(e)),null,t.prevTime,t.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(s&&s.getMeta("addToHistory")===!1)){let o=n.getMeta("composition"),l=t.prevTime==0||!s&&t.prevComposition!=o&&(t.prevTime<(n.time||0)-i.newGroupDelay||!i2e(n,t.prevRanges)),c=s?v2(t.prevRanges,n.mapping):h8(n.mapping.maps);return new bu(t.done.addTransform(n,l?e.selection.getBookmark():void 0,i,y_(e)),uo.empty,c,n.time,o??t.prevComposition)}else return(a=n.getMeta("rebased"))?new bu(t.done.rebased(n,a),t.undone.rebased(n,a),v2(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new bu(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),v2(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function i2e(t,e){if(!e)return!1;if(!t.docChanged)return!0;let n=!1;return t.mapping.maps[0].forEach((i,r)=>{for(let a=0;a<e.length;a+=2)i<=e[a+1]&&r>=e[a]&&(n=!0)}),n}function h8(t){let e=[];for(let n=t.length-1;n>=0&&e.length==0;n--)t[n].forEach((i,r,a,s)=>e.push(a,s));return e}function v2(t,e){if(!t)return null;let n=[];for(let i=0;i<t.length;i+=2){let r=e.map(t[i],1),a=e.map(t[i+1],-1);r<=a&&n.push(r,a)}return n}function r2e(t,e,n){let i=y_(e),r=ff.get(e).spec.config,a=(n?t.undone:t.done).popEvent(e,i);if(!a)return null;let s=a.selection.resolve(a.transform.doc),o=(n?t.done:t.undone).addTransform(a.transform,e.selection.getBookmark(),r,i),l=new bu(n?o:a.remaining,n?a.remaining:o,null,0,-1);return a.transform.setSelection(s).setMeta(ff,{redo:n,historyState:l})}let y2=!1,p8=null;function y_(t){let e=t.plugins;if(p8!=e){y2=!1,p8=e;for(let n=0;n<e.length;n++)if(e[n].spec.historyPreserveItems){y2=!0;break}}return y2}const ff=new lr("history"),a2e=new lr("closeHistory");function s2e(t={}){return t={depth:t.depth||100,newGroupDelay:t.newGroupDelay||500},new xi({key:ff,state:{init(){return new bu(uo.empty,uo.empty,null,0,-1)},apply(e,n,i){return n2e(n,i,e,t)}},config:t,props:{handleDOMEvents:{beforeinput(e,n){let i=n.inputType,r=i=="historyUndo"?iX:i=="historyRedo"?rX:null;return!r||!e.editable?!1:(n.preventDefault(),r(e.state,e.dispatch))}}}})}function nX(t,e){return(n,i)=>{let r=ff.getState(n);if(!r||(t?r.undone:r.done).eventCount==0)return!1;if(i){let a=r2e(r,n,t);a&&i(e?a.scrollIntoView():a)}return!0}}const iX=nX(!1,!0),rX=nX(!0,!0);Gn.create({name:"characterCount",addOptions(){return{limit:null,mode:"textSize",textCounter:t=>t.length,wordCounter:t=>t.split(" ").filter(e=>e!=="").length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=t=>{const e=t?.node||this.editor.state.doc;if((t?.mode||this.options.mode)==="textSize"){const i=e.textBetween(0,e.content.size,void 0," ");return this.options.textCounter(i)}return e.nodeSize},this.storage.words=t=>{const e=t?.node||this.editor.state.doc,n=e.textBetween(0,e.content.size," "," ");return this.options.wordCounter(n)}},addProseMirrorPlugins(){let t=!1;return[new xi({key:new lr("characterCount"),appendTransaction:(e,n,i)=>{if(t)return;const r=this.options.limit;if(r==null||r===0){t=!0;return}const a=this.storage.characters({node:i.doc});if(a>r){const s=a-r,o=0,l=s;console.warn(`[CharacterCount] Initial content exceeded limit of ${r} characters. Content was automatically trimmed.`);const c=i.tr.deleteRange(o,l);return t=!0,c}t=!0},filterTransaction:(e,n)=>{const i=this.options.limit;if(!e.docChanged||i===0||i===null||i===void 0)return!0;const r=this.storage.characters({node:n.doc}),a=this.storage.characters({node:e.doc});if(a<=i||r>i&&a>i&&a<=r)return!0;if(r>i&&a>i&&a>r||!e.getMeta("paste"))return!1;const o=e.selection.$head.pos,l=a-i,c=o-l,d=o;return e.deleteRange(c,d),!(this.storage.characters({node:e.doc})>i)}})]}});var o2e=Gn.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[VTe(this.options)]}});Gn.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new xi({key:new lr("focus"),props:{decorations:({doc:t,selection:e})=>{const{isEditable:n,isFocused:i}=this.editor,{anchor:r}=e,a=[];if(!n||!i)return pi.create(t,[]);let s=0;this.options.mode==="deepest"&&t.descendants((l,c)=>{if(l.isText)return;if(!(r>=c&&r<=c+l.nodeSize-1))return!1;s+=1});let o=0;return t.descendants((l,c)=>{if(l.isText||!(r>=c&&r<=c+l.nodeSize-1))return!1;if(o+=1,this.options.mode==="deepest"&&s-o>0||this.options.mode==="shallowest"&&o>1)return this.options.mode==="deepest";a.push(ha.node(c,c+l.nodeSize,{class:this.options.className}))}),pi.create(t,a)}}})]}});var l2e=Gn.create({name:"gapCursor",addProseMirrorPlugins(){return[qTe()]},extendNodeSchema(t){var e;const n={name:t.name,options:t.options,storage:t.storage};return{allowGapCursor:(e=On(jt(t,"allowGapCursor",n)))!=null?e:null}}});Gn.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[new xi({key:new lr("placeholder"),props:{decorations:({doc:t,selection:e})=>{const n=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:i}=e,r=[];if(!n)return null;const a=this.editor.isEmpty;return t.descendants((s,o)=>{const l=i>=o&&i<=o+s.nodeSize,c=!s.isLeaf&&dw(s);if((l||!this.options.showOnlyCurrent)&&c){const d=[this.options.emptyNodeClass];a&&d.push(this.options.emptyEditorClass);const f=ha.node(o,o+s.nodeSize,{class:d.join(" "),"data-placeholder":typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:s,pos:o,hasAnchor:l}):this.options.placeholder});r.push(f)}return this.options.includeChildren}),pi.create(t,r)}}})]}});Gn.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:t,options:e}=this;return[new xi({key:new lr("selection"),props:{decorations(n){return n.selection.empty||t.isFocused||!t.isEditable||pq(n.selection)||t.view.dragging?null:pi.create(n.doc,[ha.inline(n.selection.from,n.selection.to,{class:e.className})])}}})]}});function m8({types:t,node:e}){return e&&Array.isArray(t)&&t.includes(e.type)||e?.type===t}var c2e=Gn.create({name:"trailingNode",addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){var t;const e=new lr(this.name),n=this.options.node||((t=this.editor.schema.topNodeType.contentMatch.defaultType)==null?void 0:t.name)||"paragraph",i=Object.entries(this.editor.schema.nodes).map(([,r])=>r).filter(r=>(this.options.notAfter||[]).concat(n).includes(r.name));return[new xi({key:e,appendTransaction:(r,a,s)=>{const{doc:o,tr:l,schema:c}=s,d=e.getState(s),f=o.content.size,m=c.nodes[n];if(d)return l.insert(f,m.create())},state:{init:(r,a)=>{const s=a.tr.doc.lastChild;return!m8({node:s,types:i})},apply:(r,a)=>{if(!r.docChanged||r.getMeta("__uniqueIDTransaction"))return a;const s=r.doc.lastChild;return!m8({node:s,types:i})}}})]}}),u2e=Gn.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:t,dispatch:e})=>iX(t,e),redo:()=>({state:t,dispatch:e})=>rX(t,e)}},addProseMirrorPlugins(){return[s2e(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),d2e=Gn.create({name:"starterKit",addExtensions(){var t,e,n,i;const r=[];return this.options.bold!==!1&&r.push(jAe.configure(this.options.bold)),this.options.blockquote!==!1&&r.push(kAe.configure(this.options.blockquote)),this.options.bulletList!==!1&&r.push(Vq.configure(this.options.bulletList)),this.options.code!==!1&&r.push(BAe.configure(this.options.code)),this.options.codeBlock!==!1&&r.push($Ae.configure(this.options.codeBlock)),this.options.document!==!1&&r.push(GAe.configure(this.options.document)),this.options.dropcursor!==!1&&r.push(o2e.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&r.push(l2e.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&r.push(WAe.configure(this.options.hardBreak)),this.options.heading!==!1&&r.push(qAe.configure(this.options.heading)),this.options.undoRedo!==!1&&r.push(u2e.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&r.push(XAe.configure(this.options.horizontalRule)),this.options.italic!==!1&&r.push(JAe.configure(this.options.italic)),this.options.listItem!==!1&&r.push($q.configure(this.options.listItem)),this.options.listKeymap!==!1&&r.push(Yq.configure((t=this.options)==null?void 0:t.listKeymap)),this.options.link!==!1&&r.push(Hq.configure((e=this.options)==null?void 0:e.link)),this.options.orderedList!==!1&&r.push(Qq.configure(this.options.orderedList)),this.options.paragraph!==!1&&r.push(UTe.configure(this.options.paragraph)),this.options.strike!==!1&&r.push(zTe.configure(this.options.strike)),this.options.text!==!1&&r.push(BTe.configure(this.options.text)),this.options.underline!==!1&&r.push(Jq.configure((n=this.options)==null?void 0:n.underline)),this.options.trailingNode!==!1&&r.push(c2e.configure((i=this.options)==null?void 0:i.trailingNode)),r}}),f2e=d2e,h2e=Gn.create({name:"textAlign",addOptions(){return{types:[],alignments:["left","center","right","justify"],defaultAlignment:null}},addGlobalAttributes(){return[{types:this.options.types,attributes:{textAlign:{default:this.options.defaultAlignment,parseHTML:t=>{const e=t.style.textAlign;return this.options.alignments.includes(e)?e:this.options.defaultAlignment},renderHTML:t=>t.textAlign?{style:`text-align: ${t.textAlign}`}:{}}}}]},addCommands(){return{setTextAlign:t=>({commands:e})=>this.options.alignments.includes(t)?this.options.types.map(n=>e.updateAttributes(n,{textAlign:t})).some(n=>n):!1,unsetTextAlign:()=>({commands:t})=>this.options.types.map(e=>t.resetAttributes(e,"textAlign")).some(e=>e),toggleTextAlign:t=>({editor:e,commands:n})=>this.options.alignments.includes(t)?e.isActive({textAlign:t})?n.unsetTextAlign():n.setTextAlign(t):!1}},addKeyboardShortcuts(){return{"Mod-Shift-l":()=>this.editor.commands.setTextAlign("left"),"Mod-Shift-e":()=>this.editor.commands.setTextAlign("center"),"Mod-Shift-r":()=>this.editor.commands.setTextAlign("right"),"Mod-Shift-j":()=>this.editor.commands.setTextAlign("justify")}}}),p2e=h2e,m2e=20,aX=(t,e=0)=>{const n=[];return!t.children.length||e>m2e||Array.from(t.children).forEach(i=>{i.tagName==="SPAN"?n.push(i):i.children.length&&n.push(...aX(i,e+1))}),n},g2e=t=>{if(!t.children.length)return;const e=aX(t);e&&e.forEach(n=>{var i,r;const a=n.getAttribute("style"),s=(r=(i=n.parentElement)==null?void 0:i.closest("span"))==null?void 0:r.getAttribute("style");n.setAttribute("style",`${s};${a}`)})},sX=od.create({name:"textStyle",priority:101,addOptions(){return{HTMLAttributes:{},mergeNestedSpanStyles:!0}},parseHTML(){return[{tag:"span",consuming:!1,getAttrs:t=>t.hasAttribute("style")?(this.options.mergeNestedSpanStyles&&g2e(t),{}):!1}]},renderHTML({HTMLAttributes:t}){return["span",Ei(this.options.HTMLAttributes,t),0]},addCommands(){return{toggleTextStyle:t=>({commands:e})=>e.toggleMark(this.name,t),removeEmptyTextStyle:()=>({tr:t})=>{const{selection:e}=t;return t.doc.nodesBetween(e.from,e.to,(n,i)=>{if(n.isTextblock)return!0;n.marks.filter(r=>r.type===this.type).some(r=>Object.values(r.attrs).some(a=>!!a))||t.removeMark(i,i+n.nodeSize,this.type)}),!0}}}}),x2e=Gn.create({name:"backgroundColor",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{backgroundColor:{default:null,parseHTML:t=>{var e;const n=t.getAttribute("style");if(n){const i=n.split(";").map(r=>r.trim()).filter(Boolean);for(let r=i.length-1;r>=0;r-=1){const a=i[r].split(":");if(a.length>=2){const s=a[0].trim().toLowerCase(),o=a.slice(1).join(":").trim();if(s==="background-color")return o.replace(/['"]+/g,"")}}}return(e=t.style.backgroundColor)==null?void 0:e.replace(/['"]+/g,"")},renderHTML:t=>t.backgroundColor?{style:`background-color: ${t.backgroundColor}`}:{}}}}]},addCommands(){return{setBackgroundColor:t=>({chain:e})=>e().setMark("textStyle",{backgroundColor:t}).run(),unsetBackgroundColor:()=>({chain:t})=>t().setMark("textStyle",{backgroundColor:null}).removeEmptyTextStyle().run()}}}),oX=Gn.create({name:"color",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{color:{default:null,parseHTML:t=>{var e;const n=t.getAttribute("style");if(n){const i=n.split(";").map(r=>r.trim()).filter(Boolean);for(let r=i.length-1;r>=0;r-=1){const a=i[r].split(":");if(a.length>=2){const s=a[0].trim().toLowerCase(),o=a.slice(1).join(":").trim();if(s==="color")return o.replace(/['"]+/g,"")}}}return(e=t.style.color)==null?void 0:e.replace(/['"]+/g,"")},renderHTML:t=>t.color?{style:`color: ${t.color}`}:{}}}}]},addCommands(){return{setColor:t=>({chain:e})=>e().setMark("textStyle",{color:t}).run(),unsetColor:()=>({chain:t})=>t().setMark("textStyle",{color:null}).removeEmptyTextStyle().run()}}}),v2e=Gn.create({name:"fontFamily",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontFamily:{default:null,parseHTML:t=>t.style.fontFamily,renderHTML:t=>t.fontFamily?{style:`font-family: ${t.fontFamily}`}:{}}}}]},addCommands(){return{setFontFamily:t=>({chain:e})=>e().setMark("textStyle",{fontFamily:t}).run(),unsetFontFamily:()=>({chain:t})=>t().setMark("textStyle",{fontFamily:null}).removeEmptyTextStyle().run()}}}),y2e=Gn.create({name:"fontSize",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontSize:{default:null,parseHTML:t=>t.style.fontSize,renderHTML:t=>t.fontSize?{style:`font-size: ${t.fontSize}`}:{}}}}]},addCommands(){return{setFontSize:t=>({chain:e})=>e().setMark("textStyle",{fontSize:t}).run(),unsetFontSize:()=>({chain:t})=>t().setMark("textStyle",{fontSize:null}).removeEmptyTextStyle().run()}}}),b2e=Gn.create({name:"lineHeight",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{lineHeight:{default:null,parseHTML:t=>t.style.lineHeight,renderHTML:t=>t.lineHeight?{style:`line-height: ${t.lineHeight}`}:{}}}}]},addCommands(){return{setLineHeight:t=>({chain:e})=>e().setMark("textStyle",{lineHeight:t}).run(),unsetLineHeight:()=>({chain:t})=>t().setMark("textStyle",{lineHeight:null}).removeEmptyTextStyle().run()}}});Gn.create({name:"textStyleKit",addExtensions(){const t=[];return this.options.backgroundColor!==!1&&t.push(x2e.configure(this.options.backgroundColor)),this.options.color!==!1&&t.push(oX.configure(this.options.color)),this.options.fontFamily!==!1&&t.push(v2e.configure(this.options.fontFamily)),this.options.fontSize!==!1&&t.push(y2e.configure(this.options.fontSize)),this.options.lineHeight!==!1&&t.push(b2e.configure(this.options.lineHeight)),this.options.textStyle!==!1&&t.push(sX.configure(this.options.textStyle)),t}});var _2e=oX,S2e=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,w2e=Ba.create({name:"image",addOptions(){return{inline:!1,allowBase64:!1,HTMLAttributes:{},resize:!1}},inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},draggable:!0,addAttributes(){return{src:{default:null},alt:{default:null},title:{default:null},width:{default:null},height:{default:null}}},parseHTML(){return[{tag:this.options.allowBase64?"img[src]":'img[src]:not([src^="data:"])'}]},renderHTML({HTMLAttributes:t}){return["img",Ei(this.options.HTMLAttributes,t)]},parseMarkdown:(t,e)=>e.createNode("image",{src:t.href,title:t.title,alt:t.text}),renderMarkdown:t=>{var e,n,i,r,a,s;const o=(n=(e=t.attrs)==null?void 0:e.src)!=null?n:"",l=(r=(i=t.attrs)==null?void 0:i.alt)!=null?r:"",c=(s=(a=t.attrs)==null?void 0:a.title)!=null?s:"";return c?`![${l}](${o} "${c}")`:`![${l}](${o})`},addNodeView(){if(!this.options.resize||!this.options.resize.enabled||typeof document>"u"||!this.editor.isEditable)return null;const{directions:t,minWidth:e,minHeight:n,alwaysPreserveAspectRatio:i}=this.options.resize;return({node:r,getPos:a,HTMLAttributes:s})=>{const o=document.createElement("img");Object.entries(s).forEach(([d,f])=>{if(f!=null)switch(d){case"width":case"height":break;default:o.setAttribute(d,f);break}}),o.src=s.src;const l=new nAe({element:o,node:r,getPos:a,onResize:(d,f)=>{o.style.width=`${d}px`,o.style.height=`${f}px`},onCommit:(d,f)=>{const m=a();m!==void 0&&this.editor.chain().setNodeSelection(m).updateAttributes(this.name,{width:d,height:f}).run()},onUpdate:(d,f,m)=>d.type===r.type,options:{directions:t,min:{width:e,height:n},preserveAspectRatio:i===!0}}),c=l.dom;return c.style.visibility="hidden",c.style.pointerEvents="none",o.onload=()=>{c.style.visibility="",c.style.pointerEvents=""},l}},addCommands(){return{setImage:t=>({commands:e})=>e.insertContent({type:this.name,attrs:t})}},addInputRules(){return[Nq({find:S2e,type:this.type,getAttributes:t=>{const[,,e,n,i]=t;return{src:n,alt:e,title:i}}})]}}),M2e=w2e;function g8({content:t,onChange:e,placeholder:n}){const i=CAe({extensions:[f2e.configure({heading:!1,codeBlock:!1,code:!1}),HTe,MTe.configure({openOnClick:!1,HTMLAttributes:{target:"_blank",rel:"noopener noreferrer"}}),p2e.configure({types:["paragraph"]}),sX,_2e,M2e.configure({HTMLAttributes:{style:"max-width: 100%; height: auto;"}})],content:t,onUpdate:({editor:s})=>{e(s.getHTML())},editorProps:{attributes:{class:"prose prose-invert prose-sm max-w-none focus:outline-none min-h-[120px] px-3 py-2",placeholder:n||""}}});if(!i)return null;const r=({onClick:s,isActive:o=!1,children:l,title:c})=>p.jsx("button",{type:"button",onClick:s,title:c,className:`p-1.5 rounded hover:bg-bambu-dark-tertiary transition-colors ${o?"bg-bambu-dark-tertiary text-bambu-green":"text-bambu-gray"}`,children:l}),a=()=>{const s=window.prompt("Enter URL:");s&&i.chain().focus().setLink({href:s}).run()};return p.jsxs("div",{className:"border border-bambu-dark-tertiary rounded-lg overflow-hidden bg-bambu-dark",children:[p.jsxs("div",{className:"flex items-center gap-0.5 p-1.5 border-b border-bambu-dark-tertiary bg-bambu-dark-secondary",children:[p.jsx(r,{onClick:()=>i.chain().focus().toggleBold().run(),isActive:i.isActive("bold"),title:"Bold",children:p.jsx(Sae,{className:"w-4 h-4"})}),p.jsx(r,{onClick:()=>i.chain().focus().toggleItalic().run(),isActive:i.isActive("italic"),title:"Italic",children:p.jsx(Rse,{className:"w-4 h-4"})}),p.jsx(r,{onClick:()=>i.chain().focus().toggleUnderline().run(),isActive:i.isActive("underline"),title:"Underline",children:p.jsx(ale,{className:"w-4 h-4"})}),p.jsx("div",{className:"w-px h-5 bg-bambu-dark-tertiary mx-1"}),p.jsx(r,{onClick:()=>i.chain().focus().toggleBulletList().run(),isActive:i.isActive("bulletList"),title:"Bullet List",children:p.jsx(qG,{className:"w-4 h-4"})}),p.jsx(r,{onClick:()=>i.chain().focus().toggleOrderedList().run(),isActive:i.isActive("orderedList"),title:"Numbered List",children:p.jsx($se,{className:"w-4 h-4"})}),p.jsx("div",{className:"w-px h-5 bg-bambu-dark-tertiary mx-1"}),p.jsx(r,{onClick:()=>i.chain().focus().setTextAlign("left").run(),isActive:i.isActive({textAlign:"left"}),title:"Align Left",children:p.jsx(ele,{className:"w-4 h-4"})}),p.jsx(r,{onClick:()=>i.chain().focus().setTextAlign("center").run(),isActive:i.isActive({textAlign:"center"}),title:"Align Center",children:p.jsx(Yoe,{className:"w-4 h-4"})}),p.jsx(r,{onClick:()=>i.chain().focus().setTextAlign("right").run(),isActive:i.isActive({textAlign:"right"}),title:"Align Right",children:p.jsx(Qoe,{className:"w-4 h-4"})}),p.jsx("div",{className:"w-px h-5 bg-bambu-dark-tertiary mx-1"}),p.jsx(r,{onClick:a,isActive:i.isActive("link"),title:"Add Link",children:p.jsx(WG,{className:"w-4 h-4"})}),i.isActive("link")&&p.jsx(r,{onClick:()=>i.chain().focus().unsetLink().run(),title:"Remove Link",children:p.jsx(QG,{className:"w-4 h-4"})})]}),p.jsx(_Ae,{editor:i})]})}function E2e({archiveId:t,archiveName:e,onClose:n}){const i=Jn(),[r,a]=E.useState(!1),[s,o]=E.useState(null),[l,c]=E.useState({}),{data:d,isLoading:f,error:m}=It({queryKey:["archive-project-page",t],queryFn:()=>Ye.getArchiveProjectPage(t)}),g=Ot({mutationFn:C=>Ye.updateArchiveProjectPage(t,C),onSuccess:()=>{i.invalidateQueries({queryKey:["archive-project-page",t]}),a(!1),c({})}});E.useEffect(()=>{const C=P=>{P.key==="Escape"&&(s!==null?o(null):r?x():n())};return document.addEventListener("keydown",C),()=>document.removeEventListener("keydown",C)},[s,r,n]);const y=[...d?.model_pictures||[],...d?.profile_pictures||[]],_=()=>{c({title:d?.title||"",description:d?.description||"",designer:d?.designer||"",license:d?.license||"",profile_title:d?.profile_title||"",profile_description:d?.profile_description||""}),a(!0)},v=()=>{g.mutate(l)},x=()=>{a(!1),c({})},M=C=>{const P=["p","br","b","strong","i","em","u","a","ul","ol","li","figure","img"],A=new DOMParser().parseFromString(C,"text/html"),U=N=>{if(N.nodeType===Node.TEXT_NODE)return N.textContent||"";if(N.nodeType===Node.ELEMENT_NODE){const D=N,F=D.tagName.toLowerCase();if(!P.includes(F))return Array.from(D.childNodes).map(U).join("");let I="";if(F==="a"&&D.getAttribute("href")){const O=D.getAttribute("href");O?.toLowerCase().startsWith("http")&&(I=` href="${O}" target="_blank" rel="noopener noreferrer"`)}if(F==="img"){const O=D.getAttribute("src");if(!O?.toLowerCase().startsWith("http"))return"";I=` src="${O}" style="max-width: 100%; height: auto;"`}const W=Array.from(D.childNodes).map(U).join("");return["br","img"].includes(F)?`<${F}${I} />`:`<${F}${I}>${W}</${F}>`}return""};return Array.from(A.body.childNodes).map(U).join("")},w=d&&(d.title||d.description||d.designer||d.profile_title||y.length>0),T=C=>{C.target===C.currentTarget&&n()};return p.jsxs("div",{className:"fixed inset-0 bg-black/70 flex items-center justify-center z-50 p-4",onClick:T,children:[p.jsxs("div",{className:"bg-bambu-dark-secondary rounded-xl max-w-4xl w-full max-h-[90vh] overflow-hidden flex flex-col",children:[p.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-bambu-dark-tertiary",children:[p.jsxs("div",{className:"flex items-center gap-3",children:[p.jsx(gp,{className:"w-5 h-5 text-bambu-green"}),p.jsxs("h2",{className:"text-lg font-semibold text-white",children:["Project Page",e&&p.jsxs("span",{className:"text-bambu-gray ml-2",children:["- ",e]})]})]}),p.jsxs("div",{className:"flex items-center gap-2",children:[!r&&w&&p.jsxs(st,{variant:"ghost",size:"sm",onClick:_,children:[p.jsx(NP,{className:"w-4 h-4 mr-1"}),"Edit"]}),r&&p.jsxs(p.Fragment,{children:[p.jsx(st,{variant:"ghost",size:"sm",onClick:x,children:"Cancel"}),p.jsxs(st,{variant:"primary",size:"sm",onClick:v,disabled:g.isPending,children:[p.jsx(Rx,{className:"w-4 h-4 mr-1"}),"Save"]})]}),p.jsx("button",{onClick:n,className:"p-2 hover:bg-bambu-dark-tertiary rounded-lg transition-colors",children:p.jsx(Cn,{className:"w-5 h-5 text-bambu-gray"})})]})]}),p.jsxs("div",{className:"flex-1 overflow-y-auto p-6",children:[f&&p.jsx("div",{className:"flex items-center justify-center py-12",children:p.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-2 border-bambu-green border-t-transparent"})}),m&&p.jsx("div",{className:"text-red-400 text-center py-12",children:"Failed to load project page data"}),d&&!w&&p.jsxs("div",{className:"text-bambu-gray text-center py-12",children:[p.jsx(gp,{className:"w-12 h-12 mx-auto mb-4 opacity-50"}),p.jsx("p",{children:"No project page data found in this 3MF file."}),p.jsx("p",{className:"text-sm mt-2",children:"Project pages are typically included in files downloaded from MakerWorld."})]}),d&&w&&p.jsxs("div",{className:"space-y-6",children:[p.jsxs("div",{className:"space-y-4",children:[r?p.jsx("input",{type:"text",value:l.title||"",onChange:C=>c({...l,title:C.target.value}),placeholder:"Title",className:"w-full bg-bambu-dark border border-bambu-dark-tertiary rounded-lg px-4 py-2 text-white text-xl font-semibold"}):d.title&&p.jsx("h3",{className:"text-xl font-semibold text-white",children:d.title}),p.jsxs("div",{className:"flex flex-wrap gap-4 text-sm",children:[r?p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx(zj,{className:"w-4 h-4 text-bambu-gray"}),p.jsx("input",{type:"text",value:l.designer||"",onChange:C=>c({...l,designer:C.target.value}),placeholder:"Designer",className:"bg-bambu-dark border border-bambu-dark-tertiary rounded px-2 py-1 text-white"})]}):d.designer&&p.jsxs("div",{className:"flex items-center gap-2 text-bambu-gray",children:[p.jsx(zj,{className:"w-4 h-4"}),p.jsx("span",{children:d.designer}),d.designer_user_id&&p.jsx("a",{href:`https://makerworld.com/en/@${d.designer_user_id}`,target:"_blank",rel:"noopener noreferrer",className:"text-bambu-green hover:underline",children:p.jsx(uc,{className:"w-3 h-3"})})]}),d.creation_date&&p.jsxs("div",{className:"flex items-center gap-2 text-bambu-gray",children:[p.jsx(Yo,{className:"w-4 h-4"}),p.jsx("span",{children:d.creation_date})]}),r?p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx(gp,{className:"w-4 h-4 text-bambu-gray"}),p.jsx("input",{type:"text",value:l.license||"",onChange:C=>c({...l,license:C.target.value}),placeholder:"License",className:"bg-bambu-dark border border-bambu-dark-tertiary rounded px-2 py-1 text-white"})]}):d.license&&p.jsxs("div",{className:"flex items-center gap-2 text-bambu-gray",children:[p.jsx(gp,{className:"w-4 h-4"}),p.jsx("span",{children:d.license})]}),d.origin&&p.jsx("span",{className:"px-2 py-0.5 bg-bambu-dark rounded text-bambu-gray",children:d.origin})]})]}),(d.description||r)&&p.jsxs("div",{className:"space-y-2",children:[p.jsx("h4",{className:"text-sm font-medium text-bambu-gray uppercase tracking-wide",children:"Description"}),r?p.jsx(g8,{content:l.description||"",onChange:C=>c({...l,description:C}),placeholder:"Enter description..."}):p.jsx("div",{className:"prose prose-invert prose-sm max-w-none text-bambu-gray-light",dangerouslySetInnerHTML:{__html:M(d.description||"")}})]}),(d.profile_title||d.profile_description||r)&&p.jsxs("div",{className:"space-y-2 p-4 bg-bambu-dark rounded-lg",children:[p.jsx("h4",{className:"text-sm font-medium text-bambu-gray uppercase tracking-wide",children:"Print Profile"}),r?p.jsxs("div",{className:"space-y-2",children:[p.jsx("input",{type:"text",value:l.profile_title||"",onChange:C=>c({...l,profile_title:C.target.value}),placeholder:"Profile Title",className:"w-full bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded px-3 py-2 text-white"}),p.jsx(g8,{content:l.profile_description||"",onChange:C=>c({...l,profile_description:C}),placeholder:"Profile description..."})]}):p.jsxs(p.Fragment,{children:[d.profile_title&&p.jsx("p",{className:"text-white font-medium",children:d.profile_title}),d.profile_description&&p.jsx("div",{className:"prose prose-invert prose-sm max-w-none text-bambu-gray-light",dangerouslySetInnerHTML:{__html:M(d.profile_description)}}),d.profile_user_name&&p.jsxs("p",{className:"text-sm text-bambu-gray",children:["by ",d.profile_user_name]})]})]}),y.length>0&&p.jsxs("div",{className:"space-y-2",children:[p.jsxs("h4",{className:"text-sm font-medium text-bambu-gray uppercase tracking-wide flex items-center gap-2",children:[p.jsx(BS,{className:"w-4 h-4"}),"Images (",y.length,")"]}),p.jsx("div",{className:"grid grid-cols-3 sm:grid-cols-4 md:grid-cols-5 gap-2",children:y.map((C,P)=>p.jsx("button",{onClick:()=>o(P),className:"aspect-square rounded-lg overflow-hidden border border-bambu-dark-tertiary hover:border-bambu-green transition-colors",children:p.jsx("img",{src:C.url,alt:C.name,className:"w-full h-full object-cover"})},C.path))})]}),d.design_model_id&&p.jsx("div",{className:"pt-4 border-t border-bambu-dark-tertiary",children:p.jsxs("a",{href:`https://makerworld.com/en/models/${d.design_model_id}`,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-2 text-bambu-green hover:underline",children:[p.jsx(uc,{className:"w-4 h-4"}),"View on MakerWorld"]})})]})]})]}),s!==null&&y[s]&&p.jsxs("div",{className:"fixed inset-0 bg-black/90 flex items-center justify-center z-60",onClick:()=>o(null),children:[p.jsx("button",{onClick:C=>{C.stopPropagation(),o(Math.max(0,s-1))},disabled:s===0,className:"absolute left-4 p-2 bg-bambu-dark-secondary rounded-full hover:bg-bambu-dark-tertiary disabled:opacity-30",children:p.jsx(_f,{className:"w-6 h-6 text-white"})}),p.jsx("img",{src:y[s].url,alt:y[s].name,className:"max-w-[90vw] max-h-[90vh] object-contain",onClick:C=>C.stopPropagation()}),p.jsx("button",{onClick:C=>{C.stopPropagation(),o(Math.min(y.length-1,s+1))},disabled:s===y.length-1,className:"absolute right-4 p-2 bg-bambu-dark-secondary rounded-full hover:bg-bambu-dark-tertiary disabled:opacity-30",children:p.jsx(zf,{className:"w-6 h-6 text-white"})}),p.jsx("button",{onClick:()=>o(null),className:"absolute top-4 right-4 p-2 bg-bambu-dark-secondary rounded-full hover:bg-bambu-dark-tertiary",children:p.jsx(Cn,{className:"w-6 h-6 text-white"})}),p.jsxs("div",{className:"absolute bottom-4 text-white text-sm",children:[s+1," / ",y.length]})]})]})}const A2e=[.25,.5,.75,1,1.5,2,3,4];function T2e({src:t,title:e,downloadFilename:n,onClose:i}){const r=E.useRef(null),[a,s]=E.useState(!0),[o,l]=E.useState(.5),[c,d]=E.useState(0),[f,m]=E.useState(0);E.useEffect(()=>{const w=r.current;w&&(w.playbackRate=o)},[o]),E.useEffect(()=>{const w=T=>{T.key==="Escape"&&i()};return window.addEventListener("keydown",w),()=>window.removeEventListener("keydown",w)},[i]),E.useEffect(()=>{const w=r.current;if(!w)return;const T=()=>d(w.currentTime),C=()=>m(w.duration),P=()=>s(!0),A=()=>s(!1);return w.addEventListener("timeupdate",T),w.addEventListener("durationchange",C),w.addEventListener("play",P),w.addEventListener("pause",A),()=>{w.removeEventListener("timeupdate",T),w.removeEventListener("durationchange",C),w.removeEventListener("play",P),w.removeEventListener("pause",A)}},[]);const g=()=>{const w=r.current;w&&(a?w.pause():w.play())},y=w=>{const T=r.current;T&&(T.currentTime=parseFloat(w.target.value))},_=()=>{const w=r.current;w&&(w.currentTime=Math.max(0,w.currentTime-5))},v=()=>{const w=r.current;w&&(w.currentTime=Math.min(f,w.currentTime+5))},x=w=>{const T=Math.floor(w/60),C=Math.floor(w%60);return`${T}:${C.toString().padStart(2,"0")}`},M=()=>{const w=document.createElement("a");w.href=t,w.download=n,w.click()};return p.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/80",children:p.jsxs("div",{className:"relative bg-bambu-dark-secondary rounded-xl max-w-4xl w-full mx-4 overflow-hidden",children:[p.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-bambu-dark-tertiary",children:[p.jsxs("h3",{className:"text-lg font-semibold text-white flex items-center gap-2",children:[p.jsx(wp,{className:"w-5 h-5 text-bambu-green"}),e]}),p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsxs(st,{variant:"secondary",size:"sm",onClick:M,children:[p.jsx($u,{className:"w-4 h-4"}),"Download"]}),p.jsx("button",{onClick:i,className:"p-1 hover:bg-bambu-dark-tertiary rounded transition-colors",children:p.jsx(Cn,{className:"w-5 h-5 text-bambu-gray"})})]})]}),p.jsxs("div",{className:"p-4",children:[p.jsx("video",{ref:r,src:t,autoPlay:!0,className:"w-full rounded-lg",onClick:g}),p.jsxs("div",{className:"mt-4 space-y-3",children:[p.jsxs("div",{className:"flex items-center gap-3",children:[p.jsx("span",{className:"text-xs text-bambu-gray w-12 text-right",children:x(c)}),p.jsx("input",{type:"range",min:0,max:f||100,value:c,onChange:y,className:`flex-1 h-1 bg-bambu-dark-tertiary rounded-lg appearance-none cursor-pointer
  8178. [&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:w-3 [&::-webkit-slider-thumb]:h-3
  8179. [&::-webkit-slider-thumb]:bg-bambu-green [&::-webkit-slider-thumb]:rounded-full
  8180. [&::-webkit-slider-thumb]:cursor-pointer`}),p.jsx("span",{className:"text-xs text-bambu-gray w-12",children:x(f)})]}),p.jsxs("div",{className:"flex items-center justify-between",children:[p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("button",{onClick:_,className:"p-2 hover:bg-bambu-dark-tertiary rounded-lg transition-colors",title:"Skip back 5s",children:p.jsx(Ooe,{className:"w-5 h-5 text-bambu-gray"})}),p.jsx("button",{onClick:g,className:"p-2 bg-bambu-green hover:bg-bambu-green-dark rounded-lg transition-colors",children:a?p.jsx(ooe,{className:"w-5 h-5 text-white"}):p.jsx(HS,{className:"w-5 h-5 text-white"})}),p.jsx("button",{onClick:v,className:"p-2 hover:bg-bambu-dark-tertiary rounded-lg transition-colors",title:"Skip forward 5s",children:p.jsx(ZG,{className:"w-5 h-5 text-bambu-gray"})})]}),p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("span",{className:"text-sm text-bambu-gray",children:"Speed:"}),p.jsx("div",{className:"flex gap-1",children:A2e.map(w=>p.jsxs("button",{onClick:()=>l(w),className:`px-2 py-1 text-xs rounded transition-colors ${o===w?"bg-bambu-green text-white":"bg-bambu-dark-tertiary text-bambu-gray hover:bg-bambu-dark-tertiary/80"}`,children:[w,"x"]},w))})]})]})]})]})]})})}function C2e({archiveId:t,archiveName:e,onClose:n}){const i=Jn(),{showToast:r}=Mo(),[a,s]=E.useState(null),[o,l]=E.useState("asap"),[c,d]=E.useState(""),[f,m]=E.useState(!1),[g,y]=E.useState(!1),{data:_}=It({queryKey:["printers"],queryFn:()=>Ye.getPrinters()});E.useEffect(()=>{_?.length===1&&!a&&s(_[0].id)},[_,a]),E.useEffect(()=>{const w=T=>{T.key==="Escape"&&n()};return window.addEventListener("keydown",w),()=>window.removeEventListener("keydown",w)},[n]);const v=Ot({mutationFn:w=>Ye.addToQueue(w),onSuccess:()=>{i.invalidateQueries({queryKey:["queue"]}),r("Added to print queue"),n()},onError:w=>{r(w.message||"Failed to add to queue","error")}}),x=w=>{if(w.preventDefault(),!a){r("Please select a printer","error");return}const T={printer_id:a,archive_id:t,require_previous_success:f,auto_off_after:g};o==="scheduled"&&c&&(T.scheduled_time=new Date(c).toISOString()),v.mutate(T)},M=()=>{const w=new Date;return w.setMinutes(w.getMinutes()+1),w.toISOString().slice(0,16)};return p.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4",onClick:n,children:p.jsx(Zt,{className:"w-full max-w-md",onClick:w=>w.stopPropagation(),children:p.jsxs(cn,{className:"p-0",children:[p.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-bambu-dark-tertiary",children:[p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx(Yo,{className:"w-5 h-5 text-bambu-green"}),p.jsx("h2",{className:"text-xl font-semibold text-white",children:"Schedule Print"})]}),p.jsx("button",{onClick:n,className:"text-bambu-gray hover:text-white transition-colors",children:p.jsx(Cn,{className:"w-5 h-5"})})]}),p.jsxs("form",{onSubmit:x,className:"p-4 space-y-4",children:[p.jsxs("div",{children:[p.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:"Print Job"}),p.jsx("p",{className:"text-white font-medium truncate",children:e})]}),p.jsxs("div",{children:[p.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:"Printer"}),_?.length===0?p.jsxs("div",{className:"flex items-center gap-2 text-red-400 text-sm",children:[p.jsx(id,{className:"w-4 h-4"}),"No printers configured"]}):p.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:a||"",onChange:w=>s(w.target.value?Number(w.target.value):null),required:!0,children:[p.jsx("option",{value:"",children:"Select printer..."}),_?.map(w=>p.jsx("option",{value:w.id,children:w.name},w.id))]})]}),p.jsxs("div",{children:[p.jsx("label",{className:"block text-sm text-bambu-gray mb-2",children:"When to print"}),p.jsxs("div",{className:"flex gap-2",children:[p.jsxs("button",{type:"button",className:`flex-1 px-3 py-2 rounded-lg border text-sm flex items-center justify-center gap-2 transition-colors ${o==="asap"?"bg-bambu-green border-bambu-green text-white":"bg-bambu-dark border-bambu-dark-tertiary text-bambu-gray hover:text-white"}`,onClick:()=>l("asap"),children:[p.jsx(xa,{className:"w-4 h-4"}),"ASAP (when idle)"]}),p.jsxs("button",{type:"button",className:`flex-1 px-3 py-2 rounded-lg border text-sm flex items-center justify-center gap-2 transition-colors ${o==="scheduled"?"bg-bambu-green border-bambu-green text-white":"bg-bambu-dark border-bambu-dark-tertiary text-bambu-gray hover:text-white"}`,onClick:()=>l("scheduled"),children:[p.jsx(Yo,{className:"w-4 h-4"}),"Scheduled"]})]})]}),o==="scheduled"&&p.jsxs("div",{children:[p.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:"Date & Time"}),p.jsx("input",{type:"datetime-local",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:c,onChange:w=>d(w.target.value),min:M(),required:!0})]}),p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("input",{type:"checkbox",id:"requirePrevious",checked:f,onChange:w=>m(w.target.checked),className:"rounded border-bambu-dark-tertiary bg-bambu-dark text-bambu-green focus:ring-bambu-green"}),p.jsx("label",{htmlFor:"requirePrevious",className:"text-sm text-bambu-gray",children:"Only start if previous print succeeded"})]}),p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("input",{type:"checkbox",id:"autoOffAfter",checked:g,onChange:w=>y(w.target.checked),className:"rounded border-bambu-dark-tertiary bg-bambu-dark text-bambu-green focus:ring-bambu-green"}),p.jsxs("label",{htmlFor:"autoOffAfter",className:"text-sm text-bambu-gray flex items-center gap-1",children:[p.jsx(fm,{className:"w-3.5 h-3.5"}),"Power off printer when done"]})]}),p.jsx("p",{className:"text-xs text-bambu-gray",children:o==="asap"?"Print will start as soon as the printer is idle.":"Print will start at the scheduled time if the printer is idle. If busy, it will wait until the printer becomes available."}),p.jsxs("div",{className:"flex gap-3 pt-2",children:[p.jsx(st,{type:"button",variant:"secondary",onClick:n,className:"flex-1",children:"Cancel"}),p.jsx(st,{type:"submit",className:"flex-1",disabled:v.isPending||!a||_?.length===0,children:v.isPending?"Adding...":"Add to Queue"})]})]})]})})})}function rR(t){return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/(1024*1024)).toFixed(1)} MB`}function Bg(t){const e=Math.floor(t/3600),n=Math.floor(t%3600/60);return e>0?`${e}h ${n}m`:`${n}m`}function x8(t){return new Date(t).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}function N2e({archive:t,printerName:e,isSelected:n,onSelect:i,selectionMode:r}){const a=Jn(),{showToast:s}=Mo(),[o,l]=E.useState(!1),[c,d]=E.useState(!1),[f,m]=E.useState(!1),[g,y]=E.useState(!1),[_,v]=E.useState(!1),[x,M]=E.useState(!1),[w,T]=E.useState([]),[C,P]=E.useState(!1),[A,U]=E.useState(!1),[N,D]=E.useState(!1),[F,I]=E.useState(!1),[W,O]=E.useState(!1),[B,H]=E.useState(null),$=E.useRef(null),K=Ot({mutationFn:ne=>Ye.uploadSource3mf(t.id,ne),onSuccess:ne=>{a.invalidateQueries({queryKey:["archives"]}),s(`Source 3MF attached: ${ne.filename}`)},onError:ne=>{s(ne.message||"Failed to upload source 3MF","error")}}),Z=Ot({mutationFn:()=>Ye.deleteSource3mf(t.id),onSuccess:()=>{a.invalidateQueries({queryKey:["archives"]}),s("Source 3MF removed")},onError:ne=>{s(ne.message||"Failed to remove source 3MF","error")}}),se=Ot({mutationFn:()=>Ye.scanArchiveTimelapse(t.id),onSuccess:ne=>{ne.status==="attached"?(a.invalidateQueries({queryKey:["archives"]}),s(`Timelapse attached: ${ne.filename}`)):ne.status==="exists"?s("Timelapse already attached"):ne.status==="not_found"&&ne.available_files&&ne.available_files.length>0?(T(ne.available_files),M(!0)):s(ne.message||"No matching timelapse found","warning")},onError:ne=>{s(ne.message||"Failed to scan for timelapse","error")}}),V=Ot({mutationFn:ne=>Ye.selectArchiveTimelapse(t.id,ne),onSuccess:ne=>{a.invalidateQueries({queryKey:["archives"]}),s(`Timelapse attached: ${ne.filename}`),M(!1),T([])},onError:ne=>{s(ne.message||"Failed to attach timelapse","error")}}),X=Ot({mutationFn:()=>Ye.deleteArchive(t.id),onSuccess:()=>{a.invalidateQueries({queryKey:["archives"]}),s("Archive deleted")},onError:()=>{s("Failed to delete archive","error")}}),ae=Ot({mutationFn:()=>Ye.toggleFavorite(t.id),onSuccess:ne=>{a.invalidateQueries({queryKey:["archives"]}),s(ne.is_favorite?"Added to favorites":"Removed from favorites")}}),ce=ne=>{ne.preventDefault(),H({x:ne.clientX,y:ne.clientY})},ge=[{label:"Print",icon:p.jsx(fc,{className:"w-4 h-4"}),onClick:()=>d(!0)},{label:"Schedule",icon:p.jsx(Yo,{className:"w-4 h-4"}),onClick:()=>I(!0)},{label:"Open in Bambu Studio",icon:p.jsx(uc,{className:"w-4 h-4"}),onClick:()=>{const ne=t.print_name||t.filename||"model",ve=`${window.location.origin}${Ye.getArchiveForSlicer(t.id,ne)}`;window.location.href=`bambustudioopen://${encodeURIComponent(ve)}`}},{label:"View on MakerWorld",icon:p.jsx(O_,{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:p.jsx(k0,{className:"w-4 h-4"}),onClick:()=>l(!0)},{label:"View Timelapse",icon:p.jsx(wp,{className:"w-4 h-4"}),onClick:()=>v(!0),disabled:!t.timelapse_path},{label:"Scan for Timelapse",icon:p.jsx(Eoe,{className:"w-4 h-4"}),onClick:()=>se.mutate(),disabled:!t.printer_id||!!t.timelapse_path||se.isPending},{label:"",divider:!0,onClick:()=>{}},{label:t.source_3mf_path?"Download Source 3MF":"Upload Source 3MF",icon:p.jsx(Ij,{className:"w-4 h-4"}),onClick:()=>{if(t.source_3mf_path){const ne=document.createElement("a");ne.href=Ye.getSource3mfDownloadUrl(t.id),ne.download=`${t.print_name||t.filename}_source.3mf`,ne.click()}else $.current?.click()}},...t.source_3mf_path?[{label:"Replace Source 3MF",icon:p.jsx(F0,{className:"w-4 h-4"}),onClick:()=>$.current?.click()},{label:"Remove Source 3MF",icon:p.jsx(na,{className:"w-4 h-4"}),onClick:()=>O(!0),danger:!0}]:[],{label:"",divider:!0,onClick:()=>{}},{label:"Download",icon:p.jsx($u,{className:"w-4 h-4"}),onClick:()=>{const ne=document.createElement("a");ne.href=Ye.getArchiveDownload(t.id),ne.download=`${t.print_name||t.filename}.3mf`,ne.click()}},{label:"Copy Download Link",icon:p.jsx(yN,{className:"w-4 h-4"}),onClick:()=>{const ne=`${window.location.origin}${Ye.getArchiveDownload(t.id)}`;navigator.clipboard.writeText(ne).then(()=>{s("Link copied to clipboard")}).catch(()=>{s("Failed to copy link","error")})}},{label:"QR Code",icon:p.jsx(voe,{className:"w-4 h-4"}),onClick:()=>P(!0)},{label:`View Photos${t.photos?.length?` (${t.photos.length})`:""}`,icon:p.jsx(k_,{className:"w-4 h-4"}),onClick:()=>U(!0),disabled:!t.photos?.length},{label:"Project Page",icon:p.jsx(gp,{className:"w-4 h-4"}),onClick:()=>D(!0)},{label:"",divider:!0,onClick:()=>{}},{label:t.is_favorite?"Remove from Favorites":"Add to Favorites",icon:p.jsx(U0,{className:`w-4 h-4 ${t.is_favorite?"fill-yellow-400 text-yellow-400":""}`}),onClick:()=>ae.mutate()},{label:"Edit",icon:p.jsx(_N,{className:"w-4 h-4"}),onClick:()=>y(!0)},{label:n?"Deselect":"Select",icon:n?p.jsx(j_,{className:"w-4 h-4"}):p.jsx(I0,{className:"w-4 h-4"}),onClick:()=>i(t.id)},{label:"",divider:!0,onClick:()=>{}},{label:"Delete",icon:p.jsx(na,{className:"w-4 h-4"}),onClick:()=>m(!0),danger:!0}];return p.jsxs(Zt,{className:`relative flex flex-col ${n?"ring-2 ring-bambu-green":""} ${r?"cursor-pointer":""}`,onContextMenu:ce,onClick:r?()=>i(t.id):void 0,children:[r&&p.jsx("button",{className:"absolute top-2 left-2 z-10 p-1 rounded bg-black/50 hover:bg-black/70 transition-colors",onClick:ne=>{ne.stopPropagation(),i(t.id)},children:n?p.jsx(j_,{className:"w-5 h-5 text-bambu-green"}):p.jsx(I0,{className:"w-5 h-5 text-white"})}),p.jsxs("div",{className:"aspect-video bg-bambu-dark relative flex-shrink-0 overflow-hidden rounded-t-xl",children:[t.thumbnail_path?p.jsx("img",{src:Ye.getArchiveThumbnail(t.id),alt:t.print_name||t.filename,className:"w-full h-full object-cover"}):p.jsx("div",{className:"w-full h-full flex items-center justify-center",children:p.jsx(BS,{className:"w-12 h-12 text-bambu-dark-tertiary"})}),p.jsx("button",{className:"absolute top-2 right-2 p-1 rounded bg-black/50 hover:bg-black/70 transition-colors",onClick:ne=>{ne.stopPropagation(),ae.mutate()},title:t.is_favorite?"Remove from favorites":"Add to favorites",children:p.jsx(U0,{className:`w-5 h-5 ${t.is_favorite?"text-yellow-400 fill-yellow-400":"text-white"}`})}),t.status==="failed"&&p.jsx("div",{className:"absolute top-2 left-12 px-2 py-1 rounded text-xs bg-red-500/80 text-white",children:"failed"}),t.duplicate_count>0&&p.jsxs("div",{className:"absolute top-2 right-2 px-2 py-1 rounded text-xs bg-purple-500/80 text-white flex items-center gap-1",title:"This model has been printed before",children:[p.jsx(yN,{className:"w-3 h-3"}),"duplicate"]}),t.source_3mf_path&&p.jsx("button",{className:"absolute bottom-2 left-2 p-1.5 rounded bg-black/60 hover:bg-black/80 transition-colors",onClick:ne=>{ne.stopPropagation();const ve=(t.print_name||t.filename||"source").replace(/\.gcode\.3mf$/i,"")+"_source",Pe=`${window.location.origin}${Ye.getSource3mfForSlicer(t.id,ve)}`;window.location.href=`bambustudioopen://${encodeURIComponent(Pe)}`},title:"Open source 3MF in Bambu Studio (right-click for more options)",children:p.jsx(Ij,{className:"w-4 h-4 text-orange-400"})}),t.timelapse_path&&p.jsx("button",{className:"absolute bottom-2 right-2 p-1.5 rounded bg-black/60 hover:bg-black/80 transition-colors",onClick:ne=>{ne.stopPropagation(),v(!0)},title:"View timelapse",children:p.jsx(wp,{className:"w-4 h-4 text-bambu-green"})}),t.photos&&t.photos.length>0&&p.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:ne=>{ne.stopPropagation(),U(!0)},title:`View ${t.photos.length} photo${t.photos.length>1?"s":""}`,children:[p.jsx(k_,{className:"w-4 h-4 text-blue-400"}),t.photos.length>1&&p.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})]})]}),p.jsxs(cn,{className:"p-4 flex-1 flex flex-col",children:[p.jsx("h3",{className:"font-medium text-white mb-1 truncate",children:t.print_name||t.filename}),p.jsx("p",{className:"text-xs text-bambu-gray mb-3",children:e}),p.jsxs("div",{className:"grid grid-cols-2 gap-2 text-xs mb-4 min-h-[48px]",children:[(t.print_time_seconds||t.actual_time_seconds)&&p.jsxs("div",{className:"flex items-center gap-1.5 text-bambu-gray",title:t.time_accuracy?`Estimated: ${Bg(t.print_time_seconds||0)}
  8181. Actual: ${Bg(t.actual_time_seconds||0)}
  8182. Accuracy: ${t.time_accuracy.toFixed(0)}%`:t.actual_time_seconds?`Actual: ${Bg(t.actual_time_seconds)}`:`Estimated: ${Bg(t.print_time_seconds||0)}`,children:[p.jsx(xa,{className:"w-3 h-3"}),Bg(t.actual_time_seconds||t.print_time_seconds||0),t.time_accuracy&&p.jsxs("span",{className:`text-[10px] px-1 rounded ${t.time_accuracy>=95&&t.time_accuracy<=105?"bg-bambu-green/20 text-bambu-green":t.time_accuracy>105?"bg-blue-500/20 text-blue-400":"bg-orange-500/20 text-orange-400"}`,children:[t.time_accuracy>100?"+":"",(t.time_accuracy-100).toFixed(0),"%"]})]}),t.filament_used_grams&&p.jsxs("div",{className:"flex items-center gap-1.5 text-bambu-gray",children:[p.jsx(U_,{className:"w-3 h-3"}),t.filament_used_grams.toFixed(1),"g"]}),(t.layer_height||t.total_layers)&&p.jsxs("div",{className:"flex items-center gap-1.5 text-bambu-gray",children:[p.jsx(L_,{className:"w-3 h-3"}),t.total_layers&&p.jsxs("span",{children:[t.total_layers," layers"]}),t.total_layers&&t.layer_height&&p.jsx("span",{className:"text-bambu-gray/50",children:"·"}),t.layer_height&&p.jsxs("span",{children:[t.layer_height,"mm"]})]}),t.filament_type&&p.jsxs("div",{className:"flex items-center gap-1.5 col-span-2",children:[p.jsx("span",{className:"text-bambu-gray text-xs",children:t.filament_type}),t.filament_color&&p.jsx("div",{className:"flex items-center gap-0.5 flex-wrap",children:t.filament_color.split(",").map((ne,ve)=>p.jsx("div",{className:"w-3 h-3 rounded-full border border-white/20",style:{backgroundColor:ne},title:ne},ve))})]})]}),(t.tags||t.notes)&&p.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 mb-3",children:[t.notes&&p.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:p.jsx(Hoe,{className:"w-3 h-3"})}),t.tags?.split(",").map((ne,ve)=>p.jsx("span",{className:"px-1.5 py-0.5 bg-bambu-dark-tertiary text-bambu-gray-light rounded text-xs",children:ne.trim()},ve))]}),p.jsx("div",{className:"flex-1"}),p.jsxs("div",{className:"flex items-center justify-between text-xs text-bambu-gray border-t border-bambu-dark-tertiary pt-3",children:[p.jsx("span",{children:x8(t.created_at)}),p.jsx("span",{children:rR(t.file_size)})]}),p.jsxs("div",{className:"flex gap-1 mt-3",children:[p.jsxs(st,{variant:"primary",size:"sm",className:"flex-1 min-w-0",onClick:()=>d(!0),children:[p.jsx(fc,{className:"w-3 h-3 flex-shrink-0"}),p.jsx("span",{className:"hidden sm:inline",children:"Print"})]}),p.jsx(st,{variant:"secondary",size:"sm",className:"min-w-0 p-1 sm:p-1.5",onClick:()=>{const ne=t.print_name||t.filename||"model",ve=`${window.location.origin}${Ye.getArchiveForSlicer(t.id,ne)}`;window.location.href=`bambustudioopen://${encodeURIComponent(ve)}`},title:"Open in Bambu Studio",children:p.jsx(uc,{className:"w-3 h-3 sm:w-4 sm:h-4"})}),p.jsx(st,{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:p.jsx(O_,{className:`w-3 h-3 sm:w-4 sm:h-4 ${t.makerworld_url?"":"opacity-20"}`})}),p.jsx(st,{variant:"secondary",size:"sm",className:"min-w-0 p-1 sm:p-1.5",onClick:()=>l(!0),title:"3D Preview",children:p.jsx(k0,{className:"w-3 h-3 sm:w-4 sm:h-4"})}),p.jsx(st,{variant:"secondary",size:"sm",className:"min-w-0 p-1 sm:p-1.5",onClick:()=>{const ne=document.createElement("a");ne.href=Ye.getArchiveDownload(t.id),ne.download=`${t.print_name||t.filename}.3mf`,ne.click()},title:"Download",children:p.jsx($u,{className:"w-3 h-3 sm:w-4 sm:h-4"})}),p.jsx(st,{variant:"ghost",size:"sm",className:"min-w-0 p-1 sm:p-1.5",onClick:()=>y(!0),title:"Edit",children:p.jsx(_N,{className:"w-3 h-3 sm:w-4 sm:h-4"})}),p.jsx(st,{variant:"ghost",size:"sm",className:"min-w-0 p-1 sm:p-1.5",onClick:()=>m(!0),title:"Delete",children:p.jsx(na,{className:"w-3 h-3 sm:w-4 sm:h-4 text-red-400"})})]})]}),g&&p.jsx(J_e,{archive:t,onClose:()=>y(!1)}),o&&p.jsx(K_e,{archiveId:t.id,title:t.print_name||t.filename,onClose:()=>l(!1)}),c&&p.jsx(Y_e,{archiveId:t.id,archiveName:t.print_name||t.filename,onClose:()=>d(!1),onSuccess:()=>{}}),f&&p.jsx(ma,{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:()=>{X.mutate(),m(!1)},onCancel:()=>m(!1)}),W&&p.jsx(ma,{title:"Remove Source 3MF",message:`Are you sure you want to remove the source 3MF file from "${t.print_name||t.filename}"? This will delete the original slicer project file.`,confirmText:"Remove",variant:"danger",onConfirm:()=>{Z.mutate(),O(!1)},onCancel:()=>O(!1)}),B&&p.jsx(e1e,{x:B.x,y:B.y,items:ge,onClose:()=>H(null)}),_&&t.timelapse_path&&p.jsx(T2e,{src:Ye.getArchiveTimelapse(t.id),title:`${t.print_name||t.filename} - Timelapse`,downloadFilename:`${t.print_name||t.filename}_timelapse.mp4`,onClose:()=>v(!1)}),x&&w.length>0&&p.jsx("div",{className:"fixed inset-0 bg-black/80 flex items-center justify-center z-50 p-4",children:p.jsxs("div",{className:"bg-card-dark rounded-lg max-w-lg w-full max-h-[80vh] flex flex-col",children:[p.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-gray-700",children:[p.jsxs("div",{children:[p.jsx("h3",{className:"text-lg font-semibold text-white",children:"Select Timelapse"}),p.jsx("p",{className:"text-sm text-gray-400 mt-1",children:"No auto-match found. Select the timelapse for this print:"})]}),p.jsx("button",{onClick:()=>{M(!1),T([])},className:"text-gray-400 hover:text-white p-1",children:p.jsx(Cn,{className:"w-5 h-5"})})]}),p.jsx("div",{className:"overflow-y-auto flex-1 p-2",children:w.map(ne=>p.jsxs("button",{onClick:()=>V.mutate(ne.name),disabled:V.isPending,className:"w-full text-left p-3 rounded-lg hover:bg-gray-700 transition-colors flex items-center gap-3 disabled:opacity-50",children:[p.jsx(wp,{className:"w-8 h-8 text-bambu-green flex-shrink-0"}),p.jsxs("div",{className:"flex-1 min-w-0",children:[p.jsx("p",{className:"text-white font-medium truncate",children:ne.name}),p.jsxs("p",{className:"text-sm text-gray-400",children:[rR(ne.size),ne.mtime&&` • ${x8(ne.mtime)}`]})]})]},ne.name))}),p.jsx("div",{className:"p-4 border-t border-gray-700",children:p.jsx(st,{variant:"secondary",onClick:()=>{M(!1),T([])},className:"w-full",children:"Cancel"})})]})}),C&&p.jsx(o1e,{archiveId:t.id,archiveName:t.print_name||t.filename,onClose:()=>P(!1)}),A&&t.photos&&t.photos.length>0&&p.jsx(l1e,{archiveId:t.id,archiveName:t.print_name||t.filename,photos:t.photos,onClose:()=>U(!1),onDelete:async ne=>{try{await Ye.deleteArchivePhoto(t.id,ne),a.invalidateQueries({queryKey:["archives"]}),s("Photo deleted")}catch{s("Failed to delete photo","error")}}}),N&&p.jsx(E2e,{archiveId:t.id,archiveName:t.print_name||t.filename,onClose:()=>D(!1)}),F&&p.jsx(C2e,{archiveId:t.id,archiveName:t.print_name||t.filename,onClose:()=>I(!1)}),p.jsx("input",{ref:$,type:"file",accept:".3mf",className:"hidden",onChange:ne=>{const ve=ne.target.files?.[0];ve&&K.mutate(ve),ne.target.value=""}})]})}const R2e=[{id:"all",label:"All Archives",icon:p.jsx(xse,{className:"w-4 h-4"})},{id:"recent",label:"Last 24 Hours",icon:p.jsx(xa,{className:"w-4 h-4"})},{id:"this-week",label:"This Week",icon:p.jsx(Yo,{className:"w-4 h-4"})},{id:"this-month",label:"This Month",icon:p.jsx(Yo,{className:"w-4 h-4"})},{id:"favorites",label:"Favorites",icon:p.jsx(U0,{className:"w-4 h-4"})},{id:"failed",label:"Failed Prints",icon:p.jsx(id,{className:"w-4 h-4"})},{id:"duplicates",label:"Duplicates",icon:p.jsx(yN,{className:"w-4 h-4"})}];function P2e(){const t=Jn(),{showToast:e}=Mo(),n=E.useRef(null),[i,r]=E.useState(""),[a,s]=E.useState(null),[o,l]=E.useState(null),[c,d]=E.useState(new Set),[f,m]=E.useState("or"),[g,y]=E.useState(!1),[_,v]=E.useState(null),[x,M]=E.useState(!1),[w,T]=E.useState([]),[C,P]=E.useState(!1),[A,U]=E.useState(new Set),[N,D]=E.useState(!1),[F,I]=E.useState(!1),[W,O]=E.useState(!1),[B,H]=E.useState("grid"),[$,K]=E.useState("date-desc"),[Z,se]=E.useState("all"),{data:V,isLoading:X}=It({queryKey:["archives",a],queryFn:()=>Ye.getArchives(a||void 0)}),{data:ae}=It({queryKey:["printers"],queryFn:Ye.getPrinters}),ce=Ot({mutationFn:async te=>(await Promise.all(te.map(j=>Ye.deleteArchive(j))),te.length),onSuccess:te=>{t.invalidateQueries({queryKey:["archives"]}),U(new Set),e(`${te} archive${te!==1?"s":""} deleted`)},onError:()=>{e("Failed to delete archives","error")}}),ge=new Map(ae?.map(te=>[te.id,te.name])||[]),ne=[...new Set(V?.flatMap(te=>te.filament_type?.split(", ")||[]).filter(Boolean)||[])].sort(),ve=[...new Set(V?.flatMap(te=>te.filament_color?.split(",")||[]).filter(Boolean)||[])],Pe=[...new Set(V?.flatMap(te=>te.tags?.split(",").map(j=>j.trim())||[]).filter(Boolean)||[])].sort(),he=V?.filter(te=>{const j=new Date,L=new Date(te.created_at);let Y=!0;switch(Z){case"recent":Y=j.getTime()-L.getTime()<1440*60*1e3;break;case"this-week":Y=j.getTime()-L.getTime()<10080*60*1e3;break;case"this-month":Y=L.getMonth()===j.getMonth()&&L.getFullYear()===j.getFullYear();break;case"favorites":Y=te.is_favorite===!0;break;case"failed":Y=te.status==="failed";break;case"duplicates":Y=te.duplicate_count>0;break}const me=(te.print_name||te.filename).toLowerCase().includes(i.toLowerCase()),ye=!o||te.filament_type?.split(", ").includes(o),pe=te.filament_color?.split(",")||[],Ze=c.size===0||(f==="or"?pe.some(Ie=>c.has(Ie)):[...c].every(Ie=>pe.includes(Ie))),Le=Z==="favorites"||!g||te.is_favorite,qe=te.tags?.split(",").map(Ie=>Ie.trim())||[],at=!_||qe.includes(_);return Y&&me&&ye&&Ze&&Le&&at}).sort((te,j)=>{switch($){case"date-desc":return new Date(j.created_at).getTime()-new Date(te.created_at).getTime();case"date-asc":return new Date(te.created_at).getTime()-new Date(j.created_at).getTime();case"name-asc":return(te.print_name||te.filename).localeCompare(j.print_name||j.filename);case"name-desc":return(j.print_name||j.filename).localeCompare(te.print_name||te.filename);case"size-desc":return j.file_size-te.file_size;case"size-asc":return te.file_size-j.file_size;default:return 0}}),we=N||A.size>0,je=te=>{U(j=>{const L=new Set(j);return L.has(te)?L.delete(te):L.add(te),L})},ue=()=>{he&&U(new Set(he.map(te=>te.id)))},lt=()=>{U(new Set),D(!1)},z=te=>{d(j=>{const L=new Set(j);return L.has(te)?L.delete(te):L.add(te),L})},q=()=>{d(new Set)},re=()=>{r(""),s(null),l(null),y(!1),v(null)},J=i||a||o||g||_,ee=E.useCallback(te=>{te.preventDefault(),te.dataTransfer.types.includes("Files")&&P(!0)},[]),oe=E.useCallback(te=>{te.preventDefault(),te.currentTarget===te.target&&P(!1)},[]),De=E.useCallback(te=>{te.preventDefault(),P(!1);const j=Array.from(te.dataTransfer.files).filter(L=>L.name.endsWith(".3mf"));j.length>0?(T(j),M(!0)):te.dataTransfer.files.length>0&&e("Only .3mf files are supported","warning")},[e]),Ne=E.useCallback(te=>{const j=te.target;if(j.tagName==="INPUT"||j.tagName==="TEXTAREA"||j.isContentEditable){te.key==="Escape"&&j.blur();return}switch(te.key){case"/":te.preventDefault(),n.current?.focus();break;case"u":case"U":!te.metaKey&&!te.ctrlKey&&(te.preventDefault(),M(!0));break;case"Escape":we&&lt();break}},[we]);return E.useEffect(()=>(document.addEventListener("keydown",Ne),()=>document.removeEventListener("keydown",Ne)),[Ne]),p.jsxs("div",{className:"p-8 relative min-h-full",onDragOver:ee,onDragLeave:oe,onDrop:De,children:[C&&p.jsx("div",{className:"fixed inset-0 z-50 bg-bambu-dark/90 flex items-center justify-center pointer-events-none",children:p.jsxs("div",{className:"border-4 border-dashed border-bambu-green rounded-xl p-12 text-center",children:[p.jsx(F0,{className:"w-16 h-16 mx-auto mb-4 text-bambu-green"}),p.jsx("p",{className:"text-2xl font-semibold text-white mb-2",children:"Drop .3mf files here"}),p.jsx("p",{className:"text-bambu-gray",children:"Release to upload"})]})}),we&&p.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:[p.jsxs("span",{className:"text-white font-medium",children:[A.size," selected"]}),p.jsx("div",{className:"w-px h-6 bg-bambu-dark-tertiary"}),p.jsx(st,{variant:"secondary",size:"sm",onClick:ue,children:"Select All"}),p.jsxs(st,{variant:"secondary",size:"sm",onClick:lt,children:[p.jsx(Cn,{className:"w-4 h-4"}),"Clear"]}),p.jsx("div",{className:"w-px h-6 bg-bambu-dark-tertiary"}),p.jsxs(st,{variant:"secondary",size:"sm",onClick:()=>O(!0),children:[p.jsx(j0,{className:"w-4 h-4"}),"Tags"]}),p.jsxs(st,{variant:"secondary",size:"sm",onClick:()=>{const te=Array.from(A);Promise.all(te.map(j=>Ye.toggleFavorite(j))).then(()=>{t.invalidateQueries({queryKey:["archives"]}),e(`Toggled favorites for ${te.length} archive${te.length!==1?"s":""}`)}).catch(()=>{e("Failed to update favorites","error")})},children:[p.jsx(U0,{className:"w-4 h-4"}),"Favorite"]}),p.jsxs(st,{size:"sm",className:"bg-red-500 hover:bg-red-600",onClick:()=>I(!0),children:[p.jsx(na,{className:"w-4 h-4"}),"Delete"]})]}),p.jsxs("div",{className:"flex items-center justify-between mb-8",children:[p.jsxs("div",{children:[p.jsxs("div",{className:"flex items-center gap-3",children:[p.jsx("h1",{className:"text-2xl font-bold text-white",children:"Archives"}),p.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:Z,onChange:te=>se(te.target.value),children:R2e.map(te=>p.jsx("option",{value:te.id,children:te.label},te.id))})]}),p.jsxs("p",{className:"text-bambu-gray",children:[he?.length||0," of ",V?.length||0," prints"]})]}),p.jsxs("div",{className:"flex items-center gap-3",children:[!we&&p.jsxs(st,{variant:"secondary",onClick:()=>D(!0),children:[p.jsx(j_,{className:"w-4 h-4"}),"Select"]}),p.jsxs(st,{onClick:()=>M(!0),children:[p.jsx(F0,{className:"w-4 h-4"}),"Upload 3MF"]})]})]}),p.jsx(Zt,{className:"mb-6",children:p.jsxs(cn,{className:"py-4",children:[p.jsxs("div",{className:"flex gap-4 items-center flex-wrap",children:[p.jsxs("div",{className:"flex-1 relative min-w-[200px]",children:[p.jsx(L0,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray"}),p.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:te=>r(te.target.value)})]}),p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx(_se,{className:"w-4 h-4 text-bambu-gray"}),p.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:te=>s(te.target.value?Number(te.target.value):null),children:[p.jsx("option",{value:"",children:"All Printers"}),ae?.map(te=>p.jsx("option",{value:te.id,children:te.name},te.id))]})]}),p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx(U_,{className:"w-4 h-4 text-bambu-gray"}),p.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:o||"",onChange:te=>l(te.target.value||null),children:[p.jsx("option",{value:"",children:"All Materials"}),ne.map(te=>p.jsx("option",{value:te,children:te},te))]})]}),p.jsxs("button",{onClick:()=>y(!g),className:`flex items-center gap-2 px-3 py-2 rounded-lg border transition-colors ${g?"bg-yellow-500/20 border-yellow-500 text-yellow-400":"bg-bambu-dark border-bambu-dark-tertiary text-bambu-gray hover:text-white"}`,title:g?"Show all":"Show favorites only",children:[p.jsx(U0,{className:`w-4 h-4 ${g?"fill-yellow-400":""}`}),p.jsx("span",{className:"text-sm",children:"Favorites"})]}),Pe.length>0&&p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx(j0,{className:"w-4 h-4 text-bambu-gray"}),p.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:_||"",onChange:te=>v(te.target.value||null),children:[p.jsx("option",{value:"",children:"All Tags"}),Pe.map(te=>p.jsx("option",{value:te,children:te},te))]})]}),p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx(vae,{className:"w-4 h-4 text-bambu-gray"}),p.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:$,onChange:te=>K(te.target.value),children:[p.jsx("option",{value:"date-desc",children:"Newest first"}),p.jsx("option",{value:"date-asc",children:"Oldest first"}),p.jsx("option",{value:"name-asc",children:"Name A-Z"}),p.jsx("option",{value:"name-desc",children:"Name Z-A"}),p.jsx("option",{value:"size-desc",children:"Largest first"}),p.jsx("option",{value:"size-asc",children:"Smallest first"})]})]}),p.jsxs("div",{className:"flex items-center border border-bambu-dark-tertiary rounded-lg overflow-hidden",children:[p.jsx("button",{className:`p-2 ${B==="grid"?"bg-bambu-green text-white":"bg-bambu-dark text-bambu-gray hover:text-white"}`,onClick:()=>H("grid"),title:"Grid view",children:p.jsx(GG,{className:"w-4 h-4"})}),p.jsx("button",{className:`p-2 ${B==="list"?"bg-bambu-green text-white":"bg-bambu-dark text-bambu-gray hover:text-white"}`,onClick:()=>H("list"),title:"List view",children:p.jsx(qG,{className:"w-4 h-4"})}),p.jsx("button",{className:`p-2 ${B==="calendar"?"bg-bambu-green text-white":"bg-bambu-dark text-bambu-gray hover:text-white"}`,onClick:()=>H("calendar"),title:"Calendar view",children:p.jsx(Tae,{className:"w-4 h-4"})})]}),J&&p.jsxs(st,{variant:"ghost",size:"sm",onClick:re,className:"text-bambu-gray hover:text-white",children:[p.jsx(Cn,{className:"w-4 h-4"}),"Reset"]})]}),ve.length>0&&p.jsxs("div",{className:"flex items-center gap-3 mt-4 pt-4 border-t border-bambu-dark-tertiary",children:[p.jsx("span",{className:"text-xs text-bambu-gray",children:"Colors:"}),c.size>1&&p.jsx("button",{onClick:()=>m(te=>te==="or"?"and":"or"),className:`px-2 py-0.5 text-xs rounded transition-colors ${f==="and"?"bg-bambu-green text-white":"bg-bambu-dark-tertiary text-bambu-gray hover:text-white"}`,title:f==="or"?"Match ANY selected color":"Match ALL selected colors",children:f.toUpperCase()}),p.jsx("div",{className:"flex items-center gap-1.5 flex-wrap",children:ve.map(te=>p.jsx("button",{onClick:()=>z(te),className:`w-6 h-6 rounded-full border-2 transition-all ${c.has(te)?"border-bambu-green scale-110":"border-white/20 hover:border-white/40"}`,style:{backgroundColor:te},title:te},te))}),c.size>0&&p.jsxs("button",{onClick:q,className:"text-xs text-bambu-gray hover:text-white flex items-center gap-1",children:[p.jsx(Cn,{className:"w-3 h-3"}),"Clear"]})]})]})}),X?p.jsx("div",{className:"text-center py-12 text-bambu-gray",children:"Loading archives..."}):he?.length===0?p.jsx(Zt,{children:p.jsxs(cn,{className:"text-center py-12",children:[p.jsx("p",{className:"text-bambu-gray",children:i?"No archives match your search":"No archives yet"}),p.jsx("p",{className:"text-sm text-bambu-gray mt-2",children:"Archives are created automatically when prints complete"})]})}):B==="calendar"?p.jsx(Zt,{className:"p-6",children:p.jsx(s1e,{archives:he||[],onArchiveClick:te=>{r(te.print_name||te.filename),H("grid")}})}):B==="grid"?p.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6",children:he?.map(te=>p.jsx(N2e,{archive:te,printerName:te.printer_id?ge.get(te.printer_id)||"Unknown":"No Printer",isSelected:A.has(te.id),onSelect:je,selectionMode:we},te.id))}):B==="list"?p.jsx(Zt,{children:p.jsxs("div",{className:"divide-y divide-bambu-dark-tertiary",children:[p.jsxs("div",{className:"grid grid-cols-12 gap-4 px-4 py-3 text-xs text-bambu-gray font-medium",children:[p.jsx("div",{className:"col-span-1"}),p.jsx("div",{className:"col-span-4",children:"Name"}),p.jsx("div",{className:"col-span-2",children:"Printer"}),p.jsx("div",{className:"col-span-2",children:"Date"}),p.jsx("div",{className:"col-span-1",children:"Size"}),p.jsx("div",{className:"col-span-2 text-right",children:"Actions"})]}),he?.map(te=>p.jsxs("div",{className:`grid grid-cols-12 gap-4 px-4 py-3 items-center hover:bg-bambu-dark-tertiary/30 ${A.has(te.id)?"bg-bambu-green/10":""}`,children:[p.jsxs("div",{className:"col-span-1 flex items-center gap-2",children:[we&&p.jsx("button",{onClick:()=>je(te.id),children:A.has(te.id)?p.jsx(j_,{className:"w-4 h-4 text-bambu-green"}):p.jsx(I0,{className:"w-4 h-4 text-bambu-gray"})}),te.thumbnail_path?p.jsx("img",{src:Ye.getArchiveThumbnail(te.id),alt:"",className:"w-10 h-10 object-cover rounded"}):p.jsx("div",{className:"w-10 h-10 bg-bambu-dark rounded flex items-center justify-center",children:p.jsx(BS,{className:"w-5 h-5 text-bambu-dark-tertiary"})})]}),p.jsxs("div",{className:"col-span-4",children:[p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("p",{className:"text-white text-sm truncate",children:te.print_name||te.filename}),te.timelapse_path&&p.jsx("span",{title:"Has timelapse",children:p.jsx(wp,{className:"w-3.5 h-3.5 text-bambu-green flex-shrink-0"})})]}),te.filament_type&&p.jsxs("div",{className:"flex items-center gap-1.5 mt-0.5",children:[p.jsx("span",{className:"text-xs text-bambu-gray",children:te.filament_type}),te.filament_color&&p.jsx("div",{className:"flex items-center gap-0.5 flex-wrap",children:te.filament_color.split(",").map((j,L)=>p.jsx("div",{className:"w-2.5 h-2.5 rounded-full border border-white/20",style:{backgroundColor:j},title:j},L))})]})]}),p.jsx("div",{className:"col-span-2 text-sm text-bambu-gray truncate",children:te.printer_id?ge.get(te.printer_id)||"Unknown":"No Printer"}),p.jsx("div",{className:"col-span-2 text-sm text-bambu-gray",children:new Date(te.created_at).toLocaleDateString()}),p.jsx("div",{className:"col-span-1 text-sm text-bambu-gray",children:rR(te.file_size)}),p.jsxs("div",{className:"col-span-2 flex justify-end gap-1",children:[p.jsx(st,{variant:"ghost",size:"sm",onClick:()=>{const j=te.print_name||te.filename||"model",L=`${window.location.origin}${Ye.getArchiveForSlicer(te.id,j)}`;window.location.href=`bambustudioopen://${encodeURIComponent(L)}`},title:"Open in Slicer",children:p.jsx(uc,{className:"w-4 h-4"})}),te.makerworld_url&&p.jsx(st,{variant:"ghost",size:"sm",onClick:()=>window.open(te.makerworld_url,"_blank"),title:"MakerWorld",children:p.jsx(O_,{className:"w-4 h-4"})}),p.jsx(st,{variant:"ghost",size:"sm",onClick:()=>{const j=document.createElement("a");j.href=Ye.getArchiveDownload(te.id),j.download=`${te.print_name||te.filename}.3mf`,j.click()},title:"Download",children:p.jsx($u,{className:"w-4 h-4"})})]})]},te.id))]})}):null,x&&p.jsx(Z_e,{onClose:()=>{M(!1),T([])},initialFiles:w}),F&&p.jsx(ma,{title:"Delete Archives",message:`Are you sure you want to delete ${A.size} archive${A.size>1?"s":""}? This action cannot be undone.`,confirmText:`Delete ${A.size}`,variant:"danger",onConfirm:()=>{ce.mutate(Array.from(A)),I(!1)},onCancel:()=>I(!1)}),W&&p.jsx(t1e,{selectedIds:Array.from(A),existingTags:Pe,onClose:()=>O(!1)})]})}function D2e(t){if(!t)return"ASAP";const e=new Date(t),n=new Date,i=e.getTime()-n.getTime();return i<-6e4?"Overdue":i<0?"Now":i<6e4?"In less than a minute":i<36e5?`In ${Math.round(i/6e4)} min`:i<864e5?`In ${Math.round(i/36e5)} hours`:e.toLocaleString()}function k2e({status:t}){const e={pending:{icon:xa,color:"text-yellow-400 bg-yellow-400/10",label:"Pending"},printing:{icon:HS,color:"text-blue-400 bg-blue-400/10",label:"Printing"},completed:{icon:rd,color:"text-green-400 bg-green-400/10",label:"Completed"},failed:{icon:Nx,color:"text-red-400 bg-red-400/10",label:"Failed"},skipped:{icon:ZG,color:"text-orange-400 bg-orange-400/10",label:"Skipped"},cancelled:{icon:Cn,color:"text-gray-400 bg-gray-400/10",label:"Cancelled"}},{icon:n,color:i,label:r}=e[t];return p.jsxs("span",{className:`inline-flex items-center gap-1.5 px-2 py-1 rounded-full text-xs font-medium ${i}`,children:[p.jsx(n,{className:"w-3.5 h-3.5"}),r]})}function b2({item:t,onCancel:e,onRemove:n,onStop:i}){const[r,a]=E.useState(!1),[s,o]=E.useState(!1),[l,c]=E.useState(!1);return p.jsxs(p.Fragment,{children:[p.jsxs("div",{className:"flex items-center gap-4 p-4 bg-bambu-dark-secondary rounded-lg",children:[t.status==="pending"&&p.jsx(CP,{className:"w-5 h-5 text-bambu-gray cursor-grab"}),p.jsx("div",{className:"w-16 h-16 flex-shrink-0 bg-bambu-dark rounded-lg overflow-hidden",children:t.archive_thumbnail?p.jsx("img",{src:Ye.getArchiveThumbnail(t.archive_id),alt:"",className:"w-full h-full object-cover"}):p.jsx("div",{className:"w-full h-full flex items-center justify-center text-bambu-gray",children:p.jsx(Yo,{className:"w-6 h-6"})})}),p.jsxs("div",{className:"flex-1 min-w-0",children:[p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("p",{className:"text-white font-medium truncate",children:t.archive_name||`Archive #${t.archive_id}`}),p.jsx(zS,{to:`/archives?highlight=${t.archive_id}`,className:"text-bambu-gray hover:text-bambu-green transition-colors flex-shrink-0",title:"View archive",children:p.jsx(uc,{className:"w-3.5 h-3.5"})})]}),p.jsxs("div",{className:"flex items-center gap-3 mt-1 text-sm text-bambu-gray",children:[p.jsxs("span",{className:"flex items-center gap-1",children:[p.jsx(fc,{className:"w-3.5 h-3.5"}),t.printer_name||`Printer #${t.printer_id}`]}),p.jsxs("span",{className:"flex items-center gap-1",children:[p.jsx(xa,{className:"w-3.5 h-3.5"}),D2e(t.scheduled_time)]})]}),t.require_previous_success&&p.jsx("p",{className:"text-xs text-orange-400 mt-1",children:"Requires previous print to succeed"}),t.auto_off_after&&p.jsxs("p",{className:"text-xs text-blue-400 mt-1 flex items-center gap-1",children:[p.jsx(fm,{className:"w-3 h-3"}),"Will power off when done"]}),t.error_message&&p.jsxs("p",{className:"text-xs text-red-400 mt-1 flex items-center gap-1",children:[p.jsx(id,{className:"w-3 h-3"}),t.error_message]})]}),p.jsx(k2e,{status:t.status}),p.jsxs("div",{className:"flex items-center gap-2",children:[t.status==="printing"&&p.jsx(st,{variant:"ghost",size:"sm",onClick:()=>c(!0),title:"Stop Print",className:"text-red-400 hover:text-red-300",children:p.jsx(Bae,{className:"w-4 h-4"})}),t.status==="pending"&&p.jsx(st,{variant:"ghost",size:"sm",onClick:()=>a(!0),title:"Cancel",children:p.jsx(Cn,{className:"w-4 h-4"})}),["completed","failed","skipped","cancelled"].includes(t.status)&&p.jsx(st,{variant:"ghost",size:"sm",onClick:()=>o(!0),title:"Remove",children:p.jsx(na,{className:"w-4 h-4"})})]})]}),r&&p.jsx(ma,{title:"Cancel Scheduled Print",message:`Are you sure you want to cancel "${t.archive_name||"this print"}"? It will be removed from the queue.`,confirmText:"Cancel Print",variant:"danger",onConfirm:()=>{e(t.id),a(!1)},onCancel:()=>a(!1)}),s&&p.jsx(ma,{title:"Remove from History",message:`Are you sure you want to remove "${t.archive_name||"this item"}" from the queue history?`,confirmText:"Remove",variant:"danger",onConfirm:()=>{n(t.id),o(!1)},onCancel:()=>o(!1)}),l&&p.jsx(ma,{title:"Stop Print",message:`Are you sure you want to stop the current print "${t.archive_name||"this print"}"? This will cancel the print job on the printer.`,confirmText:"Stop Print",variant:"danger",onConfirm:()=>{i(t.id),c(!1)},onCancel:()=>c(!1)})]})}function O2e(){const t=Jn(),{showToast:e}=Mo(),[n,i]=E.useState(null),[r,a]=E.useState(""),{data:s,isLoading:o}=It({queryKey:["queue",n,r],queryFn:()=>Ye.getQueue(n||void 0,r||void 0),refetchInterval:1e4}),{data:l}=It({queryKey:["printers"],queryFn:()=>Ye.getPrinters()}),c=Ot({mutationFn:_=>Ye.cancelQueueItem(_),onSuccess:()=>{t.invalidateQueries({queryKey:["queue"]}),e("Queue item cancelled")},onError:()=>e("Failed to cancel item","error")}),d=Ot({mutationFn:_=>Ye.removeFromQueue(_),onSuccess:()=>{t.invalidateQueries({queryKey:["queue"]}),e("Queue item removed")},onError:()=>e("Failed to remove item","error")}),f=Ot({mutationFn:_=>Ye.stopQueueItem(_),onSuccess:()=>{t.invalidateQueries({queryKey:["queue"]}),e("Print stopped")},onError:()=>e("Failed to stop print","error")}),m=s?.filter(_=>_.status==="pending")||[],g=s?.filter(_=>_.status==="printing")||[],y=s?.filter(_=>["completed","failed","skipped","cancelled"].includes(_.status))||[];return p.jsxs("div",{className:"p-8",children:[p.jsx("div",{className:"flex items-center justify-between mb-6",children:p.jsxs("div",{children:[p.jsx("h1",{className:"text-2xl font-bold text-white",children:"Print Queue"}),p.jsx("p",{className:"text-bambu-gray mt-1",children:"Schedule and manage print jobs"})]})}),p.jsxs("div",{className:"flex items-center gap-4 mb-6",children:[p.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:n||"",onChange:_=>i(_.target.value?Number(_.target.value):null),children:[p.jsx("option",{value:"",children:"All Printers"}),l?.map(_=>p.jsx("option",{value:_.id,children:_.name},_.id))]}),p.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:r,onChange:_=>a(_.target.value),children:[p.jsx("option",{value:"",children:"All Status"}),p.jsx("option",{value:"pending",children:"Pending"}),p.jsx("option",{value:"printing",children:"Printing"}),p.jsx("option",{value:"completed",children:"Completed"}),p.jsx("option",{value:"failed",children:"Failed"}),p.jsx("option",{value:"skipped",children:"Skipped"}),p.jsx("option",{value:"cancelled",children:"Cancelled"})]})]}),o?p.jsx("div",{className:"text-center py-12 text-bambu-gray",children:"Loading..."}):s?.length===0?p.jsxs(Zt,{className:"p-12 text-center",children:[p.jsx(Yo,{className:"w-12 h-12 text-bambu-gray mx-auto mb-4"}),p.jsx("h3",{className:"text-lg font-medium text-white mb-2",children:"No prints scheduled"}),p.jsx("p",{className:"text-bambu-gray",children:'Schedule a print from the Archives page using the "Schedule" option in the context menu.'})]}):p.jsxs("div",{className:"space-y-6",children:[g.length>0&&p.jsxs("div",{children:[p.jsxs("h2",{className:"text-lg font-semibold text-white mb-3 flex items-center gap-2",children:[p.jsx(HS,{className:"w-5 h-5 text-blue-400"}),"Currently Printing"]}),p.jsx("div",{className:"space-y-2",children:g.map(_=>p.jsx(b2,{item:_,onCancel:v=>c.mutate(v),onRemove:v=>d.mutate(v),onStop:v=>f.mutate(v)},_.id))})]}),m.length>0&&p.jsxs("div",{children:[p.jsxs("h2",{className:"text-lg font-semibold text-white mb-3 flex items-center gap-2",children:[p.jsx(xa,{className:"w-5 h-5 text-yellow-400"}),"Queued (",m.length,")"]}),p.jsx("div",{className:"space-y-2",children:m.map(_=>p.jsx(b2,{item:_,onCancel:v=>c.mutate(v),onRemove:v=>d.mutate(v),onStop:v=>f.mutate(v)},_.id))})]}),y.length>0&&p.jsxs("div",{children:[p.jsxs("h2",{className:"text-lg font-semibold text-white mb-3 flex items-center gap-2",children:[p.jsx(rd,{className:"w-5 h-5 text-bambu-gray"}),"History (",y.length,")"]}),p.jsx("div",{className:"space-y-2",children:y.slice(0,10).map(_=>p.jsx(b2,{item:_,onCancel:v=>c.mutate(v),onRemove:v=>d.mutate(v),onStop:v=>f.mutate(v)},_.id))})]})]})]})}function L2e({printDates:t,months:e=3}){const{weeks:n,monthLabels:i,printCounts:r}=E.useMemo(()=>{const l={};t.forEach(x=>{const M=x.split("T")[0];l[M]=(l[M]||0)+1});const c=new Date,d=new Date(c);d.setMonth(d.getMonth()-e),d.setDate(d.getDate()-d.getDay());const f=[],m=[];let g=[],y=-1;const _=new Date(d);let v=0;for(;_<=c;)_.getDay()===0&&g.length>0&&(f.push(g),g=[],v++),_.getMonth()!==y&&(m.push({month:_.toLocaleDateString("en-US",{month:"short"}),weekIndex:v}),y=_.getMonth()),g.push(new Date(_)),_.setDate(_.getDate()+1);return g.length>0&&f.push(g),{weeks:f,monthLabels:m,printCounts:l}},[t,e]),a=Math.max(1,...Object.values(r)),s=l=>{if(l===0)return"bg-bambu-dark";const c=l/a;return c<=.25?"bg-bambu-green/30":c<=.5?"bg-bambu-green/50":c<=.75?"bg-bambu-green/75":"bg-bambu-green"},o=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];return p.jsxs("div",{className:"overflow-x-auto",children:[p.jsx("div",{className:"flex mb-1 ml-8",children:i.map(({month:l,weekIndex:c},d)=>p.jsx("div",{className:"text-xs text-bambu-gray",style:{marginLeft:d===0?0:`${(c-(i[d-1]?.weekIndex||0))*14-24}px`},children:l},d))}),p.jsxs("div",{className:"flex gap-0.5",children:[p.jsx("div",{className:"flex flex-col gap-0.5 mr-1",children:o.map((l,c)=>p.jsx("div",{className:"h-3 text-xs text-bambu-gray flex items-center",style:{visibility:c%2===1?"visible":"hidden"},children:l},l))}),n.map((l,c)=>p.jsx("div",{className:"flex flex-col gap-0.5",children:[0,1,2,3,4,5,6].map(d=>{const f=l.find(_=>_.getDay()===d);if(!f)return p.jsx("div",{className:"w-3 h-3"},d);const m=f.toISOString().split("T")[0],g=r[m]||0,y=m===new Date().toISOString().split("T")[0];return p.jsx("div",{className:`w-3 h-3 rounded-sm ${s(g)} ${y?"ring-1 ring-white":""}`,title:`${f.toLocaleDateString()}: ${g} print${g!==1?"s":""}`},d)})},c))]}),p.jsxs("div",{className:"flex items-center gap-2 mt-3 text-xs text-bambu-gray",children:[p.jsx("span",{children:"Less"}),p.jsxs("div",{className:"flex gap-0.5",children:[p.jsx("div",{className:"w-3 h-3 rounded-sm bg-bambu-dark"}),p.jsx("div",{className:"w-3 h-3 rounded-sm bg-bambu-green/30"}),p.jsx("div",{className:"w-3 h-3 rounded-sm bg-bambu-green/50"}),p.jsx("div",{className:"w-3 h-3 rounded-sm bg-bambu-green/75"}),p.jsx("div",{className:"w-3 h-3 rounded-sm bg-bambu-green"})]}),p.jsx("span",{children:"More"})]})]})}function lX(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=lX(t[e]))&&(i&&(i+=" "),i+=n)}else for(n in t)t[n]&&(i&&(i+=" "),i+=n);return i}function En(){for(var t,e,n=0,i="",r=arguments.length;n<r;n++)(t=arguments[n])&&(e=lX(t))&&(i&&(i+=" "),i+=e);return i}var I2e=["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 WD(t){if(typeof t!="string")return!1;var e=I2e;return e.includes(t)}var U2e=["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"],j2e=new Set(U2e);function cX(t){return typeof t!="string"?!1:j2e.has(t)}function uX(t){return typeof t=="string"&&t.startsWith("data-")}function za(t){if(typeof t!="object"||t===null)return{};var e={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(cX(n)||uX(n))&&(e[n]=t[n]);return e}function kf(t){if(t==null)return null;if(E.isValidElement(t)&&typeof t.props=="object"&&t.props!==null){var e=t.props;return za(e)}return typeof t=="object"&&!Array.isArray(t)?za(t):null}function _a(t){var e={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(cX(n)||uX(n)||WD(n))&&(e[n]=t[n]);return e}function F2e(t){return t==null?null:E.isValidElement(t)?_a(t.props):typeof t=="object"&&!Array.isArray(t)?_a(t):null}var z2e=["children","width","height","viewBox","className","style","title","desc"];function aR(){return aR=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},aR.apply(null,arguments)}function B2e(t,e){if(t==null)return{};var n,i,r=H2e(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 H2e(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 qD=E.forwardRef((t,e)=>{var{children:n,width:i,height:r,viewBox:a,className:s,style:o,title:l,desc:c}=t,d=B2e(t,z2e),f=a||{width:i,height:r,x:0,y:0},m=En("recharts-surface",s);return E.createElement("svg",aR({},_a(d),{className:m,width:i,height:r,style:o,viewBox:"".concat(f.x," ").concat(f.y," ").concat(f.width," ").concat(f.height),ref:e}),E.createElement("title",null,l),E.createElement("desc",null,c),n)}),V2e=["children","className"];function sR(){return sR=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},sR.apply(null,arguments)}function $2e(t,e){if(t==null)return{};var n,i,r=G2e(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 G2e(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=E.forwardRef((t,e)=>{var{children:n,className:i}=t,r=$2e(t,V2e),a=En("recharts-layer",i);return E.createElement("g",sR({className:a},_a(r),{ref:e}),n)}),dX=E.createContext(null),W2e=()=>E.useContext(dX);function Zn(t){return function(){return t}}const fX=Math.cos,z1=Math.sin,Ao=Math.sqrt,B1=Math.PI,mw=2*B1,oR=Math.PI,lR=2*oR,zd=1e-6,q2e=lR-zd;function hX(t){this._+=t[0];for(let e=1,n=t.length;e<n;++e)this._+=arguments[e]+t[e]}function X2e(t){let e=Math.floor(t);if(!(e>=0))throw new Error(`invalid digits: ${t}`);if(e>15)return hX;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 K2e{constructor(e){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=e==null?hX:X2e(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,o=this._y1,l=i-e,c=r-n,d=s-e,f=o-n,m=d*d+f*f;if(this._x1===null)this._append`M${this._x1=e},${this._y1=n}`;else if(m>zd)if(!(Math.abs(f*l-c*d)>zd)||!a)this._append`L${this._x1=e},${this._y1=n}`;else{let g=i-s,y=r-o,_=l*l+c*c,v=g*g+y*y,x=Math.sqrt(_),M=Math.sqrt(m),w=a*Math.tan((oR-Math.acos((_+m-v)/(2*x*M)))/2),T=w/M,C=w/x;Math.abs(T-1)>zd&&this._append`L${e+T*d},${n+T*f}`,this._append`A${a},${a},0,0,${+(f*g>d*y)},${this._x1=e+C*l},${this._y1=n+C*c}`}}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 o=i*Math.cos(r),l=i*Math.sin(r),c=e+o,d=n+l,f=1^s,m=s?r-a:a-r;this._x1===null?this._append`M${c},${d}`:(Math.abs(this._x1-c)>zd||Math.abs(this._y1-d)>zd)&&this._append`L${c},${d}`,i&&(m<0&&(m=m%lR+lR),m>q2e?this._append`A${i},${i},0,1,${f},${e-o},${n-l}A${i},${i},0,1,${f},${this._x1=c},${this._y1=d}`:m>zd&&this._append`A${i},${i},0,${+(m>=oR)},${f},${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 XD(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 K2e(e)}function KD(t){return typeof t=="object"&&"length"in t?t:Array.from(t)}function pX(t){this._context=t}pX.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 gw(t){return new pX(t)}function mX(t){return t[0]}function gX(t){return t[1]}function xX(t,e){var n=Zn(!0),i=null,r=gw,a=null,s=XD(o);t=typeof t=="function"?t:t===void 0?mX:Zn(t),e=typeof e=="function"?e:e===void 0?gX:Zn(e);function o(l){var c,d=(l=KD(l)).length,f,m=!1,g;for(i==null&&(a=r(g=s())),c=0;c<=d;++c)!(c<d&&n(f=l[c],c,l))===m&&((m=!m)?a.lineStart():a.lineEnd()),m&&a.point(+t(f,c,l),+e(f,c,l));if(g)return a=null,g+""||null}return o.x=function(l){return arguments.length?(t=typeof l=="function"?l:Zn(+l),o):t},o.y=function(l){return arguments.length?(e=typeof l=="function"?l:Zn(+l),o):e},o.defined=function(l){return arguments.length?(n=typeof l=="function"?l:Zn(!!l),o):n},o.curve=function(l){return arguments.length?(r=l,i!=null&&(a=r(i)),o):r},o.context=function(l){return arguments.length?(l==null?i=a=null:a=r(i=l),o):i},o}function jb(t,e,n){var i=null,r=Zn(!0),a=null,s=gw,o=null,l=XD(c);t=typeof t=="function"?t:t===void 0?mX:Zn(+t),e=typeof e=="function"?e:Zn(e===void 0?0:+e),n=typeof n=="function"?n:n===void 0?gX:Zn(+n);function c(f){var m,g,y,_=(f=KD(f)).length,v,x=!1,M,w=new Array(_),T=new Array(_);for(a==null&&(o=s(M=l())),m=0;m<=_;++m){if(!(m<_&&r(v=f[m],m,f))===x)if(x=!x)g=m,o.areaStart(),o.lineStart();else{for(o.lineEnd(),o.lineStart(),y=m-1;y>=g;--y)o.point(w[y],T[y]);o.lineEnd(),o.areaEnd()}x&&(w[m]=+t(v,m,f),T[m]=+e(v,m,f),o.point(i?+i(v,m,f):w[m],n?+n(v,m,f):T[m]))}if(M)return o=null,M+""||null}function d(){return xX().defined(r).curve(s).context(a)}return c.x=function(f){return arguments.length?(t=typeof f=="function"?f:Zn(+f),i=null,c):t},c.x0=function(f){return arguments.length?(t=typeof f=="function"?f:Zn(+f),c):t},c.x1=function(f){return arguments.length?(i=f==null?null:typeof f=="function"?f:Zn(+f),c):i},c.y=function(f){return arguments.length?(e=typeof f=="function"?f:Zn(+f),n=null,c):e},c.y0=function(f){return arguments.length?(e=typeof f=="function"?f:Zn(+f),c):e},c.y1=function(f){return arguments.length?(n=f==null?null:typeof f=="function"?f:Zn(+f),c):n},c.lineX0=c.lineY0=function(){return d().x(t).y(e)},c.lineY1=function(){return d().x(t).y(n)},c.lineX1=function(){return d().x(i).y(e)},c.defined=function(f){return arguments.length?(r=typeof f=="function"?f:Zn(!!f),c):r},c.curve=function(f){return arguments.length?(s=f,a!=null&&(o=s(a)),c):s},c.context=function(f){return arguments.length?(f==null?a=o=null:o=s(a=f),c):a},c}class vX{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 Y2e(t){return new vX(t,!0)}function Z2e(t){return new vX(t,!1)}const YD={draw(t,e){const n=Ao(e/B1);t.moveTo(n,0),t.arc(0,0,n,0,mw)}},Q2e={draw(t,e){const n=Ao(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()}},yX=Ao(1/3),J2e=yX*2,eCe={draw(t,e){const n=Ao(e/J2e),i=n*yX;t.moveTo(0,-n),t.lineTo(i,0),t.lineTo(0,n),t.lineTo(-i,0),t.closePath()}},tCe={draw(t,e){const n=Ao(e),i=-n/2;t.rect(i,i,n,n)}},nCe=.8908130915292852,bX=z1(B1/10)/z1(7*B1/10),iCe=z1(mw/10)*bX,rCe=-fX(mw/10)*bX,aCe={draw(t,e){const n=Ao(e*nCe),i=iCe*n,r=rCe*n;t.moveTo(0,-n),t.lineTo(i,r);for(let a=1;a<5;++a){const s=mw*a/5,o=fX(s),l=z1(s);t.lineTo(l*n,-o*n),t.lineTo(o*i-l*r,l*i+o*r)}t.closePath()}},_2=Ao(3),sCe={draw(t,e){const n=-Ao(e/(_2*3));t.moveTo(0,n*2),t.lineTo(-_2*n,-n),t.lineTo(_2*n,-n),t.closePath()}},As=-.5,Ts=Ao(3)/2,cR=1/Ao(12),oCe=(cR/2+1)*3,lCe={draw(t,e){const n=Ao(e/oCe),i=n/2,r=n*cR,a=i,s=n*cR+n,o=-a,l=s;t.moveTo(i,r),t.lineTo(a,s),t.lineTo(o,l),t.lineTo(As*i-Ts*r,Ts*i+As*r),t.lineTo(As*a-Ts*s,Ts*a+As*s),t.lineTo(As*o-Ts*l,Ts*o+As*l),t.lineTo(As*i+Ts*r,As*r-Ts*i),t.lineTo(As*a+Ts*s,As*s-Ts*a),t.lineTo(As*o+Ts*l,As*l-Ts*o),t.closePath()}};function cCe(t,e){let n=null,i=XD(r);t=typeof t=="function"?t:Zn(t||YD),e=typeof e=="function"?e:Zn(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:Zn(a),r):t},r.size=function(a){return arguments.length?(e=typeof a=="function"?a:Zn(+a),r):e},r.context=function(a){return arguments.length?(n=a??null,r):n},r}function H1(){}function V1(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 _X(t){this._context=t}_X.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:V1(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:V1(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function uCe(t){return new _X(t)}function SX(t){this._context=t}SX.prototype={areaStart:H1,areaEnd:H1,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:V1(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function dCe(t){return new SX(t)}function wX(t){this._context=t}wX.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:V1(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function fCe(t){return new wX(t)}function MX(t){this._context=t}MX.prototype={areaStart:H1,areaEnd:H1,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 hCe(t){return new MX(t)}function v8(t){return t<0?-1:1}function y8(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),o=(a*r+s*i)/(i+r);return(v8(a)+v8(s))*Math.min(Math.abs(a),Math.abs(s),.5*Math.abs(o))||0}function b8(t,e){var n=t._x1-t._x0;return n?(3*(t._y1-t._y0)/n-e)/2:e}function S2(t,e,n){var i=t._x0,r=t._y0,a=t._x1,s=t._y1,o=(a-i)/3;t._context.bezierCurveTo(i+o,r+o*e,a-o,s-o*n,a,s)}function $1(t){this._context=t}$1.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:S2(this,this._t0,b8(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,S2(this,b8(this,n=y8(this,t,e)),n);break;default:S2(this,this._t0,n=y8(this,t,e));break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e,this._t0=n}}};function EX(t){this._context=new AX(t)}(EX.prototype=Object.create($1.prototype)).point=function(t,e){$1.prototype.point.call(this,e,t)};function AX(t){this._context=t}AX.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 pCe(t){return new $1(t)}function mCe(t){return new EX(t)}function TX(t){this._context=t}TX.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=_8(t),r=_8(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 _8(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 gCe(t){return new TX(t)}function xw(t,e){this._context=t,this._t=e}xw.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 xCe(t){return new xw(t,.5)}function vCe(t){return new xw(t,0)}function yCe(t){return new xw(t,1)}function Jp(t,e){if((s=t.length)>1)for(var n=1,i,r,a=t[e[0]],s,o=a.length;n<s;++n)for(r=a,a=t[e[n]],i=0;i<o;++i)a[i][1]+=a[i][0]=isNaN(r[i][1])?r[i][0]:r[i][1]}function uR(t){for(var e=t.length,n=new Array(e);--e>=0;)n[e]=e;return n}function bCe(t,e){return t[e]}function _Ce(t){const e=[];return e.key=t,e}function SCe(){var t=Zn([]),e=uR,n=Jp,i=bCe;function r(a){var s=Array.from(t.apply(this,arguments),_Ce),o,l=s.length,c=-1,d;for(const f of a)for(o=0,++c;o<l;++o)(s[o][c]=[0,+i(f,s[o].key,c,a)]).data=f;for(o=0,d=KD(e(s));o<l;++o)s[d[o]].index=o;return n(s,d),s}return r.keys=function(a){return arguments.length?(t=typeof a=="function"?a:Zn(Array.from(a)),r):t},r.value=function(a){return arguments.length?(i=typeof a=="function"?a:Zn(+a),r):i},r.order=function(a){return arguments.length?(e=a==null?uR:typeof a=="function"?a:Zn(Array.from(a)),r):e},r.offset=function(a){return arguments.length?(n=a??Jp,r):n},r}function wCe(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}Jp(t,e)}}function MCe(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,o=0;s<r;++s)o+=t[s][n][1]||0;i[n][1]+=i[n][0]=-o/2}Jp(t,e)}}function ECe(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 o=0,l=0,c=0;o<s;++o){for(var d=t[e[o]],f=d[i][1]||0,m=d[i-1][1]||0,g=(f-m)/2,y=0;y<o;++y){var _=t[e[y]],v=_[i][1]||0,x=_[i-1][1]||0;g+=v-x}l+=f,c+=g*f}r[i-1][1]+=r[i-1][0]=n,l&&(n-=c/l)}r[i-1][1]+=r[i-1][0]=n,Jp(t,e)}}var w2={},M2={},S8;function ACe(){return S8||(S8=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});function e(n){return n==="__proto__"}t.isUnsafeProperty=e})(M2)),M2}var E2={},w8;function CX(){return w8||(w8=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})(E2)),E2}var A2={},M8;function ZD(){return M8||(M8=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})(A2)),A2}var T2={},C2={},E8;function TCe(){return E8||(E8=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})(C2)),C2}var A8;function QD(){return A8||(A8=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=TCe(),n=ZD();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 o=0,l="",c="",d=!1;for(r.charCodeAt(0)===46&&(a.push(""),o++);o<s;){const f=r[o];c?f==="\\"&&o+1<s?(o++,l+=r[o]):f===c?c="":l+=f:d?f==='"'||f==="'"?c=f:f==="]"?(d=!1,a.push(l),l=""):l+=f:f==="["?(d=!0,l&&(a.push(l),l="")):f==="."?l&&(a.push(l),l=""):l+=f,o++}return l&&a.push(l),a}t.toPath=i})(T2)),T2}var T8;function JD(){return T8||(T8=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=ACe(),n=CX(),i=ZD(),r=QD();function a(o,l,c){if(o==null)return c;switch(typeof l){case"string":{if(e.isUnsafeProperty(l))return c;const d=o[l];return d===void 0?n.isDeepKey(l)?a(o,r.toPath(l),c):c:d}case"number":case"symbol":{typeof l=="number"&&(l=i.toKey(l));const d=o[l];return d===void 0?c:d}default:{if(Array.isArray(l))return s(o,l,c);if(Object.is(l?.valueOf(),-0)?l="-0":l=String(l),e.isUnsafeProperty(l))return c;const d=o[l];return d===void 0?c:d}}}function s(o,l,c){if(l.length===0)return c;let d=o;for(let f=0;f<l.length;f++){if(d==null||e.isUnsafeProperty(l[f]))return c;d=d[l[f]]}return d===void 0?c:d}t.get=a})(w2)),w2}var N2,C8;function CCe(){return C8||(C8=1,N2=JD().get),N2}var NCe=CCe();const Of=Ks(NCe);var Er=t=>t===0?0:t>0?1:-1,Ws=t=>typeof t=="number"&&t!=+t,gc=t=>typeof t=="string"&&t.indexOf("%")===t.length-1,Et=t=>(typeof t=="number"||t instanceof Number)&&!Ws(t),nl=t=>Et(t)||typeof t=="string",RCe=0,sx=t=>{var e=++RCe;return"".concat(t||"").concat(e)},ia=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(!Et(e)&&typeof e!="string")return i;var a;if(gc(e)){if(n==null)return i;var s=e.indexOf("%");a=n*parseFloat(e.slice(0,s))/100}else a=+e;return Ws(a)&&(a=i),r&&n!=null&&a>n&&(a=n),a},NX=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 si(t,e,n){return Et(t)&&Et(e)?t+n*(e-t):e}function RX(t,e,n){if(!(!t||!t.length))return t.find(i=>i&&(typeof e=="function"?e(i):Of(i,e))===n)}var gi=t=>t===null||typeof t>"u",Fx=t=>gi(t)?t:"".concat(t.charAt(0).toUpperCase()).concat(t.slice(1));function PCe(t){return t!=null}function zx(){}var DCe=["type","size","sizeType"];function dR(){return dR=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},dR.apply(null,arguments)}function N8(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 R8(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?N8(Object(n),!0).forEach(function(i){kCe(t,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):N8(Object(n)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(n,i))})}return t}function kCe(t,e,n){return(e=OCe(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function OCe(t){var e=LCe(t,"string");return typeof e=="symbol"?e:e+""}function LCe(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 ICe(t,e){if(t==null)return{};var n,i,r=UCe(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 UCe(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 PX={symbolCircle:YD,symbolCross:Q2e,symbolDiamond:eCe,symbolSquare:tCe,symbolStar:aCe,symbolTriangle:sCe,symbolWye:lCe},jCe=Math.PI/180,FCe=t=>{var e="symbol".concat(Fx(t));return PX[e]||YD},zCe=(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*jCe;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}},BCe=(t,e)=>{PX["symbol".concat(Fx(t))]=e},ek=t=>{var{type:e="circle",size:n=64,sizeType:i="area"}=t,r=ICe(t,DCe),a=R8(R8({},r),{},{type:e,size:n,sizeType:i}),s="circle";typeof e=="string"&&(s=e);var o=()=>{var m=FCe(s),g=cCe().type(m).size(zCe(n,i,s)),y=g();if(y!==null)return y},{className:l,cx:c,cy:d}=a,f=_a(a);return Et(c)&&Et(d)&&Et(n)?E.createElement("path",dR({},f,{className:En("recharts-symbols",l),transform:"translate(".concat(c,", ").concat(d,")"),d:o()})):null};ek.registerSymbol=BCe;var DX=t=>"radius"in t&&"startAngle"in t&&"endAngle"in t,tk=(t,e)=>{if(!t||typeof t=="function"||typeof t=="boolean")return null;var n=t;if(E.isValidElement(t)&&(n=t.props),typeof n!="object"&&typeof n!="function")return null;var i={};return Object.keys(n).forEach(r=>{WD(r)&&(i[r]=(a=>n[r](n,a)))}),i},HCe=(t,e,n)=>i=>(t(e,n,i),null),Bx=(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];WD(r)&&typeof a=="function"&&(i||(i={}),i[r]=HCe(a,e,n))}),i};function P8(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 VCe(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?P8(Object(n),!0).forEach(function(i){$Ce(t,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):P8(Object(n)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(n,i))})}return t}function $Ce(t,e,n){return(e=GCe(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function GCe(t){var e=WCe(t,"string");return typeof e=="symbol"?e:e+""}function WCe(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 Yi(t,e){var n=VCe({},t),i=e,r=Object.keys(e),a=r.reduce((s,o)=>(s[o]===void 0&&i[o]!==void 0&&(s[o]=i[o]),s),n);return a}function G1(){return G1=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},G1.apply(null,arguments)}function D8(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?D8(Object(n),!0).forEach(function(i){XCe(t,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):D8(Object(n)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(n,i))})}return t}function XCe(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=YCe(t,"string");return typeof e=="symbol"?e:e+""}function YCe(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 Rs=32,ZCe={align:"center",iconSize:14,inactiveColor:"#ccc",layout:"horizontal",verticalAlign:"middle"};function QCe(t){var{data:e,iconType:n,inactiveColor:i}=t,r=Rs/2,a=Rs/6,s=Rs/3,o=e.inactive?i:e.color,l=n??e.type;if(l==="none")return null;if(l==="plainline"){var c;return E.createElement("line",{strokeWidth:4,fill:"none",stroke:o,strokeDasharray:(c=e.payload)===null||c===void 0?void 0:c.strokeDasharray,x1:0,y1:r,x2:Rs,y2:r,className:"recharts-legend-icon"})}if(l==="line")return E.createElement("path",{strokeWidth:4,fill:"none",stroke:o,d:"M0,".concat(r,"h").concat(s,`
  8183. A`).concat(a,",").concat(a,",0,1,1,").concat(2*s,",").concat(r,`
  8184. H`).concat(Rs,"M").concat(2*s,",").concat(r,`
  8185. A`).concat(a,",").concat(a,",0,1,1,").concat(s,",").concat(r),className:"recharts-legend-icon"});if(l==="rect")return E.createElement("path",{stroke:"none",fill:o,d:"M0,".concat(Rs/8,"h").concat(Rs,"v").concat(Rs*3/4,"h").concat(-Rs,"z"),className:"recharts-legend-icon"});if(E.isValidElement(e.legendIcon)){var d=qCe({},e);return delete d.legendIcon,E.cloneElement(e.legendIcon,d)}return E.createElement(ek,{fill:o,cx:r,cy:r,size:Rs,sizeType:"diameter",type:l})}function JCe(t){var{payload:e,iconSize:n,layout:i,formatter:r,inactiveColor:a,iconType:s}=t,o={x:0,y:0,width:Rs,height:Rs},l={display:i==="horizontal"?"inline-block":"block",marginRight:10},c={display:"inline-block",verticalAlign:"middle",marginRight:4};return e.map((d,f)=>{var m=d.formatter||r,g=En({"recharts-legend-item":!0,["legend-item-".concat(f)]:!0,inactive:d.inactive});if(d.type==="none")return null;var y=d.inactive?a:d.color,_=m?m(d.value,d,f):d.value;return E.createElement("li",G1({className:g,style:l,key:"legend-item-".concat(f)},Bx(t,d,f)),E.createElement(qD,{width:n,height:n,viewBox:o,style:c,"aria-label":"".concat(_," legend icon")},E.createElement(QCe,{data:d,iconType:s,inactiveColor:a})),E.createElement("span",{className:"recharts-legend-item-text",style:{color:y}},_))})}var eNe=t=>{var e=Yi(t,ZCe),{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 E.createElement("ul",{className:"recharts-default-legend",style:a},E.createElement(JCe,G1({},e,{payload:n})))},R2={},P2={},k8;function tNe(){return k8||(k8=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],o=i(s);r.has(o)||r.set(o,s)}return Array.from(r.values())}t.uniqBy=e})(P2)),P2}var D2={},O8;function kX(){return O8||(O8=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});function e(n){return n}t.identity=e})(D2)),D2}var k2={},O2={},L2={},L8;function nNe(){return L8||(L8=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});function e(n){return Number.isSafeInteger(n)&&n>=0}t.isLength=e})(L2)),L2}var I8;function nk(){return I8||(I8=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=nNe();function n(i){return i!=null&&typeof i!="function"&&e.isLength(i.length)}t.isArrayLike=n})(O2)),O2}var I2={},U8;function iNe(){return U8||(U8=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});function e(n){return typeof n=="object"&&n!==null}t.isObjectLike=e})(I2)),I2}var j8;function rNe(){return j8||(j8=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=nk(),n=iNe();function i(r){return n.isObjectLike(r)&&e.isArrayLike(r)}t.isArrayLikeObject=i})(k2)),k2}var U2={},j2={},F8;function aNe(){return F8||(F8=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=JD();function n(i){return function(r){return e.get(r,i)}}t.property=n})(j2)),j2}var F2={},z2={},B2={},H2={},z8;function OX(){return z8||(z8=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})(H2)),H2}var V2={},B8;function LX(){return B8||(B8=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})(V2)),V2}var $2={},H8;function IX(){return H8||(H8=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})($2)),$2}var V8;function sNe(){return V8||(V8=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=OX(),n=LX(),i=IX();function r(d,f,m){return typeof m!="function"?r(d,f,()=>{}):a(d,f,function g(y,_,v,x,M,w){const T=m(y,_,v,x,M,w);return T!==void 0?!!T:a(y,_,g,w)},new Map)}function a(d,f,m,g){if(f===d)return!0;switch(typeof f){case"object":return s(d,f,m,g);case"function":return Object.keys(f).length>0?a(d,{...f},m,g):i.eq(d,f);default:return e.isObject(d)?typeof f=="string"?f==="":!0:i.eq(d,f)}}function s(d,f,m,g){if(f==null)return!0;if(Array.isArray(f))return l(d,f,m,g);if(f instanceof Map)return o(d,f,m,g);if(f instanceof Set)return c(d,f,m,g);const y=Object.keys(f);if(d==null)return y.length===0;if(y.length===0)return!0;if(g?.has(f))return g.get(f)===d;g?.set(f,d);try{for(let _=0;_<y.length;_++){const v=y[_];if(!n.isPrimitive(d)&&!(v in d)||f[v]===void 0&&d[v]!==void 0||f[v]===null&&d[v]!==null||!m(d[v],f[v],v,d,f,g))return!1}return!0}finally{g?.delete(f)}}function o(d,f,m,g){if(f.size===0)return!0;if(!(d instanceof Map))return!1;for(const[y,_]of f.entries()){const v=d.get(y);if(m(v,_,y,d,f,g)===!1)return!1}return!0}function l(d,f,m,g){if(f.length===0)return!0;if(!Array.isArray(d))return!1;const y=new Set;for(let _=0;_<f.length;_++){const v=f[_];let x=!1;for(let M=0;M<d.length;M++){if(y.has(M))continue;const w=d[M];let T=!1;if(m(w,v,_,d,f,g)&&(T=!0),T){y.add(M),x=!0;break}}if(!x)return!1}return!0}function c(d,f,m,g){return f.size===0?!0:d instanceof Set?l([...d],[...f],m,g):!1}t.isMatchWith=r,t.isSetMatch=c})(B2)),B2}var $8;function UX(){return $8||($8=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=sNe();function n(i,r){return e.isMatchWith(i,r,()=>{})}t.isMatch=n})(z2)),z2}var G2={},W2={},q2={},G8;function oNe(){return G8||(G8=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})(q2)),q2}var X2={},W8;function jX(){return W8||(W8=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})(X2)),X2}var K2={},q8;function FX(){return q8||(q8=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]",o="[object Date]",l="[object Map]",c="[object Set]",d="[object Array]",f="[object Function]",m="[object ArrayBuffer]",g="[object Object]",y="[object Error]",_="[object DataView]",v="[object Uint8Array]",x="[object Uint8ClampedArray]",M="[object Uint16Array]",w="[object Uint32Array]",T="[object BigUint64Array]",C="[object Int8Array]",P="[object Int16Array]",A="[object Int32Array]",U="[object BigInt64Array]",N="[object Float32Array]",D="[object Float64Array]";t.argumentsTag=a,t.arrayBufferTag=m,t.arrayTag=d,t.bigInt64ArrayTag=U,t.bigUint64ArrayTag=T,t.booleanTag=r,t.dataViewTag=_,t.dateTag=o,t.errorTag=y,t.float32ArrayTag=N,t.float64ArrayTag=D,t.functionTag=f,t.int16ArrayTag=P,t.int32ArrayTag=A,t.int8ArrayTag=C,t.mapTag=l,t.numberTag=i,t.objectTag=g,t.regexpTag=e,t.setTag=c,t.stringTag=n,t.symbolTag=s,t.uint16ArrayTag=M,t.uint32ArrayTag=w,t.uint8ArrayTag=v,t.uint8ClampedArrayTag=x})(K2)),K2}var Y2={},X8;function lNe(){return X8||(X8=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});function e(n){return ArrayBuffer.isView(n)&&!(n instanceof DataView)}t.isTypedArray=e})(Y2)),Y2}var K8;function zX(){return K8||(K8=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=oNe(),n=jX(),i=FX(),r=LX(),a=lNe();function s(d,f){return o(d,void 0,d,new Map,f)}function o(d,f,m,g=new Map,y=void 0){const _=y?.(d,f,m,g);if(_!==void 0)return _;if(r.isPrimitive(d))return d;if(g.has(d))return g.get(d);if(Array.isArray(d)){const v=new Array(d.length);g.set(d,v);for(let x=0;x<d.length;x++)v[x]=o(d[x],x,m,g,y);return Object.hasOwn(d,"index")&&(v.index=d.index),Object.hasOwn(d,"input")&&(v.input=d.input),v}if(d instanceof Date)return new Date(d.getTime());if(d instanceof RegExp){const v=new RegExp(d.source,d.flags);return v.lastIndex=d.lastIndex,v}if(d instanceof Map){const v=new Map;g.set(d,v);for(const[x,M]of d)v.set(x,o(M,x,m,g,y));return v}if(d instanceof Set){const v=new Set;g.set(d,v);for(const x of d)v.add(o(x,void 0,m,g,y));return v}if(typeof Buffer<"u"&&Buffer.isBuffer(d))return d.subarray();if(a.isTypedArray(d)){const v=new(Object.getPrototypeOf(d)).constructor(d.length);g.set(d,v);for(let x=0;x<d.length;x++)v[x]=o(d[x],x,m,g,y);return v}if(d instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&d instanceof SharedArrayBuffer)return d.slice(0);if(d instanceof DataView){const v=new DataView(d.buffer.slice(0),d.byteOffset,d.byteLength);return g.set(d,v),l(v,d,m,g,y),v}if(typeof File<"u"&&d instanceof File){const v=new File([d],d.name,{type:d.type});return g.set(d,v),l(v,d,m,g,y),v}if(typeof Blob<"u"&&d instanceof Blob){const v=new Blob([d],{type:d.type});return g.set(d,v),l(v,d,m,g,y),v}if(d instanceof Error){const v=new d.constructor;return g.set(d,v),v.message=d.message,v.name=d.name,v.stack=d.stack,v.cause=d.cause,l(v,d,m,g,y),v}if(d instanceof Boolean){const v=new Boolean(d.valueOf());return g.set(d,v),l(v,d,m,g,y),v}if(d instanceof Number){const v=new Number(d.valueOf());return g.set(d,v),l(v,d,m,g,y),v}if(d instanceof String){const v=new String(d.valueOf());return g.set(d,v),l(v,d,m,g,y),v}if(typeof d=="object"&&c(d)){const v=Object.create(Object.getPrototypeOf(d));return g.set(d,v),l(v,d,m,g,y),v}return d}function l(d,f,m=d,g,y){const _=[...Object.keys(f),...e.getSymbols(f)];for(let v=0;v<_.length;v++){const x=_[v],M=Object.getOwnPropertyDescriptor(d,x);(M==null||M.writable)&&(d[x]=o(f[x],x,m,g,y))}}function c(d){switch(n.getTag(d)){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=o,t.copyProperties=l})(W2)),W2}var Y8;function cNe(){return Y8||(Y8=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=zX();function n(i){return e.cloneDeepWithImpl(i,void 0,i,new Map,void 0)}t.cloneDeep=n})(G2)),G2}var Z8;function uNe(){return Z8||(Z8=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=UX(),n=cNe();function i(r){return r=n.cloneDeep(r),a=>e.isMatch(a,r)}t.matches=i})(F2)),F2}var Z2={},Q2={},J2={},Q8;function dNe(){return Q8||(Q8=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=zX(),n=FX();function i(r,a){return e.cloneDeepWith(r,(s,o,l,c)=>{const d=a?.(s,o,l,c);if(d!==void 0)return d;if(typeof r=="object")switch(Object.prototype.toString.call(r)){case n.numberTag:case n.stringTag:case n.booleanTag:{const f=new r.constructor(r?.valueOf());return e.copyProperties(f,r),f}case n.argumentsTag:{const f={};return e.copyProperties(f,r),f.length=r.length,f[Symbol.iterator]=r[Symbol.iterator],f}default:return}})}t.cloneDeepWith=i})(J2)),J2}var J8;function fNe(){return J8||(J8=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=dNe();function n(i){return e.cloneDeepWith(i)}t.cloneDeep=n})(Q2)),Q2}var eC={},tC={},e6;function BX(){return e6||(e6=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})(tC)),tC}var nC={},t6;function hNe(){return t6||(t6=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=jX();function n(i){return i!==null&&typeof i=="object"&&e.getTag(i)==="[object Arguments]"}t.isArguments=n})(nC)),nC}var n6;function pNe(){return n6||(n6=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=CX(),n=BX(),i=hNe(),r=QD();function a(s,o){let l;if(Array.isArray(o)?l=o:typeof o=="string"&&e.isDeepKey(o)&&s?.[o]==null?l=r.toPath(o):l=[o],l.length===0)return!1;let c=s;for(let d=0;d<l.length;d++){const f=l[d];if((c==null||!Object.hasOwn(c,f))&&!((Array.isArray(c)||i.isArguments(c))&&n.isIndex(f)&&f<c.length))return!1;c=c[f]}return!0}t.has=a})(eC)),eC}var i6;function mNe(){return i6||(i6=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=UX(),n=ZD(),i=fNe(),r=JD(),a=pNe();function s(o,l){switch(typeof o){case"object":{Object.is(o?.valueOf(),-0)&&(o="-0");break}case"number":{o=n.toKey(o);break}}return l=i.cloneDeep(l),function(c){const d=r.get(c,o);return d===void 0?a.has(c,o):l===void 0?d===void 0:e.isMatch(d,l)}}t.matchesProperty=s})(Z2)),Z2}var r6;function gNe(){return r6||(r6=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=kX(),n=aNe(),i=uNe(),r=mNe();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})(U2)),U2}var a6;function xNe(){return a6||(a6=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=tNe(),n=kX(),i=rNe(),r=gNe();function a(s,o=n.identity){return i.isArrayLikeObject(s)?e.uniqBy(Array.from(s),r.iteratee(o)):[]}t.uniqBy=a})(R2)),R2}var iC,s6;function vNe(){return s6||(s6=1,iC=xNe().uniqBy),iC}var yNe=vNe();const o6=Ks(yNe);function HX(t,e,n){return e===!0?o6(t,n):typeof e=="function"?o6(t,e):t}var ik=E.createContext(null),bNe=t=>t,ei=()=>{var t=E.useContext(ik);return t?t.store.dispatch:bNe},b_=()=>{},_Ne=()=>b_,SNe=(t,e)=>t===e;function At(t){var e=E.useContext(ik);return Pq.useSyncExternalStoreWithSelector(e?e.subscription.addNestedSub:_Ne,e?e.store.getState:b_,e?e.store.getState:b_,e?t:b_,SNe)}function wNe(t,e=`expected a function, instead received ${typeof t}`){if(typeof t!="function")throw new TypeError(e)}function MNe(t,e=`expected an object, instead received ${typeof t}`){if(typeof t!="object")throw new TypeError(e)}function ENe(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 l6=t=>Array.isArray(t)?t:[t];function ANe(t){const e=Array.isArray(t[0])?t[0]:t;return ENe(e,"createSelector expects all input-selectors to be functions, but received the following types: "),e}function TNe(t,e){const n=[],{length:i}=t;for(let r=0;r<i;r++)n.push(t[r].apply(null,e));return n}var CNe=class{constructor(t){this.value=t}deref(){return this.value}},NNe=typeof WeakRef<"u"?WeakRef:CNe,RNe=0,c6=1;function Fb(){return{s:RNe,v:void 0,o:null,p:null}}function VX(t,e={}){let n=Fb();const{resultEqualityCheck:i}=e;let r,a=0;function s(){let o=n;const{length:l}=arguments;for(let f=0,m=l;f<m;f++){const g=arguments[f];if(typeof g=="function"||typeof g=="object"&&g!==null){let y=o.o;y===null&&(o.o=y=new WeakMap);const _=y.get(g);_===void 0?(o=Fb(),y.set(g,o)):o=_}else{let y=o.p;y===null&&(o.p=y=new Map);const _=y.get(g);_===void 0?(o=Fb(),y.set(g,o)):o=_}}const c=o;let d;if(o.s===c6)d=o.v;else if(d=t.apply(null,arguments),a++,i){const f=r?.deref?.()??r;f!=null&&i(f,d)&&(d=f,a!==0&&a--),r=typeof d=="object"&&d!==null||typeof d=="function"?new NNe(d):d}return c.s=c6,c.v=d,d}return s.clearCache=()=>{n=Fb(),s.resetResultsCount()},s.resultsCount=()=>a,s.resetResultsCount=()=>{a=0},s}function PNe(t,...e){const n=typeof t=="function"?{memoize:t,memoizeOptions:e}:t,i=(...r)=>{let a=0,s=0,o,l={},c=r.pop();typeof c=="object"&&(l=c,c=r.pop()),wNe(c,`createSelector expects an output function after the inputs, but received: [${typeof c}]`);const d={...n,...l},{memoize:f,memoizeOptions:m=[],argsMemoize:g=VX,argsMemoizeOptions:y=[]}=d,_=l6(m),v=l6(y),x=ANe(r),M=f(function(){return a++,c.apply(null,arguments)},..._),w=g(function(){s++;const C=TNe(x,arguments);return o=M.apply(null,C),o},...v);return Object.assign(w,{resultFunc:c,memoizedResultFunc:M,dependencies:x,dependencyRecomputations:()=>s,resetDependencyRecomputations:()=>{s=0},lastResult:()=>o,recomputations:()=>a,resetRecomputations:()=>{a=0},memoize:f,argsMemoize:g})};return Object.assign(i,{withTypes:()=>i}),i}var He=PNe(VX),DNe=Object.assign((t,e=He)=>{MNe(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,o,l)=>(s[n[l]]=o,s),{}))},{withTypes:()=>DNe}),rC={},aC={},sC={},u6;function kNe(){return u6||(u6=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),o=e(r);if(s===o&&s===0){if(i<r)return a==="desc"?1:-1;if(i>r)return a==="desc"?-1:1}return a==="desc"?o-s:s-o}return 0};t.compareValues=n})(sC)),sC}var oC={},lC={},d6;function $X(){return d6||(d6=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});function e(n){return typeof n=="symbol"||n instanceof Symbol}t.isSymbol=e})(lC)),lC}var f6;function ONe(){return f6||(f6=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=$X(),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})(oC)),oC}var h6;function LNe(){return h6||(h6=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=kNe(),n=ONe(),i=QD();function r(a,s,o,l){if(a==null)return[];o=l?void 0:o,Array.isArray(a)||(a=Object.values(a)),Array.isArray(s)||(s=s==null?[null]:[s]),s.length===0&&(s=[null]),Array.isArray(o)||(o=o==null?[]:[o]),o=o.map(g=>String(g));const c=(g,y)=>{let _=g;for(let v=0;v<y.length&&_!=null;++v)_=_[y[v]];return _},d=(g,y)=>y==null||g==null?y:typeof g=="object"&&"key"in g?Object.hasOwn(y,g.key)?y[g.key]:c(y,g.path):typeof g=="function"?g(y):Array.isArray(g)?c(y,g):typeof y=="object"?y[g]:y,f=s.map(g=>(Array.isArray(g)&&g.length===1&&(g=g[0]),g==null||typeof g=="function"||Array.isArray(g)||n.isKey(g)?g:{key:g,path:i.toPath(g)}));return a.map(g=>({original:g,criteria:f.map(y=>d(y,g))})).slice().sort((g,y)=>{for(let _=0;_<f.length;_++){const v=e.compareValues(g.criteria[_],y.criteria[_],o[_]);if(v!==0)return v}return 0}).map(g=>g.original)}t.orderBy=r})(aC)),aC}var cC={},p6;function INe(){return p6||(p6=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});function e(n,i=1){const r=[],a=Math.floor(i),s=(o,l)=>{for(let c=0;c<o.length;c++){const d=o[c];Array.isArray(d)&&l<a?s(d,l+1):r.push(d)}};return s(n,0),r}t.flatten=e})(cC)),cC}var uC={},m6;function GX(){return m6||(m6=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=BX(),n=nk(),i=OX(),r=IX();function a(s,o,l){return i.isObject(l)&&(typeof o=="number"&&n.isArrayLike(l)&&e.isIndex(o)&&o<l.length||typeof o=="string"&&o in l)?r.eq(l[o],s):!1}t.isIterateeCall=a})(uC)),uC}var g6;function UNe(){return g6||(g6=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=LNe(),n=INe(),i=GX();function r(a,...s){const o=s.length;return o>1&&i.isIterateeCall(a,s[0],s[1])?s=[]:o>2&&i.isIterateeCall(s[0],s[1],s[2])&&(s=[s[0]]),e.orderBy(a,n.flatten(s),["asc"])}t.sortBy=r})(rC)),rC}var dC,x6;function jNe(){return x6||(x6=1,dC=UNe().sortBy),dC}var FNe=jNe();const vw=Ks(FNe);var WX=t=>t.legend.settings,zNe=t=>t.legend.size,BNe=t=>t.legend.payload,HNe=He([BNe,WX],(t,e)=>{var{itemSorter:n}=e,i=t.flat(1);return n?vw(i,n):i});function VNe(){return At(HNe)}var zb=1;function qX(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],[e,n]=E.useState({height:0,left:0,top:0,width:0}),i=E.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)>zb||Math.abs(s.left-e.left)>zb||Math.abs(s.top-e.top)>zb||Math.abs(s.width-e.width)>zb)&&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 jr(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 $Ne=typeof Symbol=="function"&&Symbol.observable||"@@observable",v6=$Ne,fC=()=>Math.random().toString(36).substring(7).split("").join("."),GNe={INIT:`@@redux/INIT${fC()}`,REPLACE:`@@redux/REPLACE${fC()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${fC()}`},W1=GNe;function rk(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 XX(t,e,n){if(typeof t!="function")throw new Error(jr(2));if(typeof e=="function"&&typeof n=="function"||typeof n=="function"&&typeof arguments[3]=="function")throw new Error(jr(0));if(typeof e=="function"&&typeof n>"u"&&(n=e,e=void 0),typeof n<"u"){if(typeof n!="function")throw new Error(jr(1));return n(XX)(t,e)}let i=t,r=e,a=new Map,s=a,o=0,l=!1;function c(){s===a&&(s=new Map,a.forEach((v,x)=>{s.set(x,v)}))}function d(){if(l)throw new Error(jr(3));return r}function f(v){if(typeof v!="function")throw new Error(jr(4));if(l)throw new Error(jr(5));let x=!0;c();const M=o++;return s.set(M,v),function(){if(x){if(l)throw new Error(jr(6));x=!1,c(),s.delete(M),a=null}}}function m(v){if(!rk(v))throw new Error(jr(7));if(typeof v.type>"u")throw new Error(jr(8));if(typeof v.type!="string")throw new Error(jr(17));if(l)throw new Error(jr(9));try{l=!0,r=i(r,v)}finally{l=!1}return(a=s).forEach(M=>{M()}),v}function g(v){if(typeof v!="function")throw new Error(jr(10));i=v,m({type:W1.REPLACE})}function y(){const v=f;return{subscribe(x){if(typeof x!="object"||x===null)throw new Error(jr(11));function M(){const T=x;T.next&&T.next(d())}return M(),{unsubscribe:v(M)}},[v6](){return this}}}return m({type:W1.INIT}),{dispatch:m,subscribe:f,getState:d,replaceReducer:g,[v6]:y}}function WNe(t){Object.keys(t).forEach(e=>{const n=t[e];if(typeof n(void 0,{type:W1.INIT})>"u")throw new Error(jr(12));if(typeof n(void 0,{type:W1.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(jr(13))})}function KX(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{WNe(n)}catch(a){r=a}return function(s={},o){if(r)throw r;let l=!1;const c={};for(let d=0;d<i.length;d++){const f=i[d],m=n[f],g=s[f],y=m(g,o);if(typeof y>"u")throw o&&o.type,new Error(jr(14));c[f]=y,l=l||y!==g}return l=l||i.length!==Object.keys(s).length,l?c:s}}function q1(...t){return t.length===0?e=>e:t.length===1?t[0]:t.reduce((e,n)=>(...i)=>e(n(...i)))}function qNe(...t){return e=>(n,i)=>{const r=e(n,i);let a=()=>{throw new Error(jr(15))};const s={getState:r.getState,dispatch:(l,...c)=>a(l,...c)},o=t.map(l=>l(s));return a=q1(...o)(r.dispatch),{...r,dispatch:a}}}function YX(t){return rk(t)&&"type"in t&&typeof t.type=="string"}var ZX=Symbol.for("immer-nothing"),y6=Symbol.for("immer-draftable"),Sa=Symbol.for("immer-state");function fo(t,...e){throw new Error(`[Immer] minified error nr: ${t}. Full error at: https://bit.ly/3cXEKWf`)}var ls=Object,em=ls.getPrototypeOf,X1="constructor",yw="prototype",fR="configurable",K1="enumerable",__="writable",ox="value",xc=t=>!!t&&!!t[Sa];function _o(t){return t?QX(t)||bw(t)||!!t[y6]||!!t[X1]?.[y6]||_w(t)||Sw(t):!1}var XNe=ls[yw][X1].toString(),b6=new WeakMap;function QX(t){if(!t||!ak(t))return!1;const e=em(t);if(e===null||e===ls[yw])return!0;const n=ls.hasOwnProperty.call(e,X1)&&e[X1];if(n===Object)return!0;if(!mp(n))return!1;let i=b6.get(n);return i===void 0&&(i=Function.toString.call(n),b6.set(n,i)),i===XNe}function Hx(t,e,n=!0){Vx(t)===0?(n?Reflect.ownKeys(t):ls.keys(t)).forEach(r=>{e(r,t[r],t)}):t.forEach((i,r)=>e(r,i,t))}function Vx(t){const e=t[Sa];return e?e.type_:bw(t)?1:_w(t)?2:Sw(t)?3:0}var _6=(t,e,n=Vx(t))=>n===2?t.has(e):ls[yw].hasOwnProperty.call(t,e),hR=(t,e,n=Vx(t))=>n===2?t.get(e):t[e],Y1=(t,e,n,i=Vx(t))=>{i===2?t.set(e,n):i===3?t.add(n):t[e]=n};function KNe(t,e){return t===e?t!==0||1/t===1/e:t!==t&&e!==e}var bw=Array.isArray,_w=t=>t instanceof Map,Sw=t=>t instanceof Set,ak=t=>typeof t=="object",mp=t=>typeof t=="function",hC=t=>typeof t=="boolean",$l=t=>t.copy_||t.base_,sk=t=>t.modified_?t.copy_:t.base_;function pR(t,e){if(_w(t))return new Map(t);if(Sw(t))return new Set(t);if(bw(t))return Array[yw].slice.call(t);const n=QX(t);if(e===!0||e==="class_only"&&!n){const i=ls.getOwnPropertyDescriptors(t);delete i[Sa];let r=Reflect.ownKeys(i);for(let a=0;a<r.length;a++){const s=r[a],o=i[s];o[__]===!1&&(o[__]=!0,o[fR]=!0),(o.get||o.set)&&(i[s]={[fR]:!0,[__]:!0,[K1]:o[K1],[ox]:t[s]})}return ls.create(em(t),i)}else{const i=em(t);if(i!==null&&n)return{...t};const r=ls.create(i);return ls.assign(r,t)}}function ok(t,e=!1){return ww(t)||xc(t)||!_o(t)||(Vx(t)>1&&ls.defineProperties(t,{set:Bb,add:Bb,clear:Bb,delete:Bb}),ls.freeze(t),e&&Hx(t,(n,i)=>{ok(i,!0)},!1)),t}function YNe(){fo(2)}var Bb={[ox]:YNe};function ww(t){return t===null||!ak(t)?!0:ls.isFrozen(t)}var Z1="MapSet",mR="Patches",JX={};function tm(t){const e=JX[t];return e||fo(0,t),e}var ZNe=t=>!!JX[t],lx,eK=()=>lx,QNe=(t,e)=>({drafts_:[],parent_:t,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:ZNe(Z1)?tm(Z1):void 0});function S6(t,e){e&&(t.patchPlugin_=tm(mR),t.patches_=[],t.inversePatches_=[],t.patchListener_=e)}function gR(t){xR(t),t.drafts_.forEach(JNe),t.drafts_=null}function xR(t){t===lx&&(lx=t.parent_)}var w6=t=>lx=QNe(lx,t);function JNe(t){const e=t[Sa];e.type_===0||e.type_===1?e.revoke_():e.revoked_=!0}function M6(t,e){e.unfinalizedDrafts_=e.drafts_.length;const n=e.drafts_[0];if(t!==void 0&&t!==n){n[Sa].modified_&&(gR(e),fo(4)),_o(t)&&(t=E6(e,t));const{patchPlugin_:r}=e;r&&r.generateReplacementPatches_(n[Sa].base_,t,e)}else t=E6(e,n);return e3e(e,t,!0),gR(e),e.patches_&&e.patchListener_(e.patches_,e.inversePatches_),t!==ZX?t:void 0}function E6(t,e){if(ww(e))return e;const n=e[Sa];if(!n)return lk(e,t.handledSet_,t);if(!Mw(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);iK(n,t)}return n.copy_}function e3e(t,e,n=!1){!t.parent_&&t.immer_.autoFreeze_&&t.canAutoFreeze_&&ok(e,n)}function tK(t){t.finalized_=!0,t.scope_.unfinalizedDrafts_--}var Mw=(t,e)=>t.scope_===e,t3e=[];function nK(t,e,n,i){const r=$l(t),a=t.type_;if(i!==void 0&&hR(r,i,a)===e){Y1(r,i,n,a);return}if(!t.draftLocations_){const o=t.draftLocations_=new Map;Hx(r,(l,c)=>{if(xc(c)){const d=o.get(c)||[];d.push(l),o.set(c,d)}})}const s=t.draftLocations_.get(e)??t3e;for(const o of s)Y1(r,o,n,a)}function n3e(t,e,n){t.callbacks_.push(function(r){const a=e;if(!a||!Mw(a,r))return;r.mapSetPlugin_?.fixSetContents(a);const s=sk(a);nK(t,a.draft_??a,s,n),iK(a,r)})}function iK(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)}tK(t)}}function i3e(t,e,n){const{scope_:i}=t;if(xc(n)){const r=n[Sa];Mw(r,i)&&r.callbacks_.push(function(){S_(t);const s=sk(r);nK(t,n,s,e)})}else _o(n)&&t.callbacks_.push(function(){const a=$l(t);hR(a,e,t.type_)===n&&i.drafts_.length>1&&(t.assigned_.get(e)??!1)===!0&&t.copy_&&lk(hR(t.copy_,e,t.type_),i.handledSet_,i)})}function lk(t,e,n){return!n.immer_.autoFreeze_&&n.unfinalizedDrafts_<1||xc(t)||e.has(t)||!_o(t)||ww(t)||(e.add(t),Hx(t,(i,r)=>{if(xc(r)){const a=r[Sa];if(Mw(a,n)){const s=sk(a);Y1(t,i,s,t.type_),tK(a)}}else _o(r)&&lk(r,e,n)})),t}function r3e(t,e){const n=bw(t),i={type_:n?1:0,scope_:e?e.scope_:eK(),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=ck;n&&(r=[i],a=cx);const{revoke:s,proxy:o}=Proxy.revocable(r,a);return i.draft_=o,i.revoke_=s,[o,i]}var ck={get(t,e){if(e===Sa)return t;const n=$l(t);if(!_6(n,e,t.type_))return a3e(t,n,e);const i=n[e];if(t.finalized_||!_o(i))return i;if(i===pC(t.base_,e)){S_(t);const r=t.type_===1?+e:e,a=yR(t.scope_,i,t,r);return t.copy_[r]=a}return i},has(t,e){return e in $l(t)},ownKeys(t){return Reflect.ownKeys($l(t))},set(t,e,n){const i=rK($l(t),e);if(i?.set)return i.set.call(t.draft_,n),!0;if(!t.modified_){const r=pC($l(t),e),a=r?.[Sa];if(a&&a.base_===n)return t.copy_[e]=n,t.assigned_.set(e,!1),!0;if(KNe(n,r)&&(n!==void 0||_6(t.base_,e,t.type_)))return!0;S_(t),vR(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),i3e(t,e,n)),!0},deleteProperty(t,e){return S_(t),pC(t.base_,e)!==void 0||e in t.base_?(t.assigned_.set(e,!1),vR(t)):t.assigned_.delete(e),t.copy_&&delete t.copy_[e],!0},getOwnPropertyDescriptor(t,e){const n=$l(t),i=Reflect.getOwnPropertyDescriptor(n,e);return i&&{[__]:!0,[fR]:t.type_!==1||e!=="length",[K1]:i[K1],[ox]:n[e]}},defineProperty(){fo(11)},getPrototypeOf(t){return em(t.base_)},setPrototypeOf(){fo(12)}},cx={};Hx(ck,(t,e)=>{cx[t]=function(){const n=arguments;return n[0]=n[0][0],e.apply(this,n)}});cx.deleteProperty=function(t,e){return cx.set.call(this,t,e,void 0)};cx.set=function(t,e,n){return ck.set.call(this,t[0],e,n,t[0])};function pC(t,e){const n=t[Sa];return(n?$l(n):t)[e]}function a3e(t,e,n){const i=rK(e,n);return i?ox in i?i[ox]:i.get?.call(t.draft_):void 0}function rK(t,e){if(!(e in t))return;let n=em(t);for(;n;){const i=Object.getOwnPropertyDescriptor(n,e);if(i)return i;n=em(n)}}function vR(t){t.modified_||(t.modified_=!0,t.parent_&&vR(t.parent_))}function S_(t){t.copy_||(t.assigned_=new Map,t.copy_=pR(t.base_,t.scope_.immer_.useStrictShallowCopy_))}var s3e=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(n,i,r)=>{if(mp(n)&&!mp(i)){const s=i;i=n;const o=this;return function(c=s,...d){return o.produce(c,f=>i.call(this,f,...d))}}mp(i)||fo(6),r!==void 0&&!mp(r)&&fo(7);let a;if(_o(n)){const s=w6(this),o=yR(s,n,void 0);let l=!0;try{a=i(o),l=!1}finally{l?gR(s):xR(s)}return S6(s,r),M6(a,s)}else if(!n||!ak(n)){if(a=i(n),a===void 0&&(a=n),a===ZX&&(a=void 0),this.autoFreeze_&&ok(a,!0),r){const s=[],o=[];tm(mR).generateReplacementPatches_(n,a,{patches_:s,inversePatches_:o}),r(s,o)}return a}else fo(1,n)},this.produceWithPatches=(n,i)=>{if(mp(n))return(o,...l)=>this.produceWithPatches(o,c=>n(c,...l));let r,a;return[this.produce(n,i,(o,l)=>{r=o,a=l}),r,a]},hC(e?.autoFreeze)&&this.setAutoFreeze(e.autoFreeze),hC(e?.useStrictShallowCopy)&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),hC(e?.useStrictIteration)&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){_o(e)||fo(8),xc(e)&&(e=yo(e));const n=w6(this),i=yR(n,e,void 0);return i[Sa].isManual_=!0,xR(n),i}finishDraft(e,n){const i=e&&e[Sa];(!i||!i.isManual_)&&fo(9);const{scope_:r}=i;return S6(r,n),M6(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=tm(mR).applyPatches_;return xc(e)?r(e,n):this.produce(e,a=>r(a,n))}};function yR(t,e,n,i){const[r,a]=_w(e)?tm(Z1).proxyMap_(e,n):Sw(e)?tm(Z1).proxySet_(e,n):r3e(e,n);return(n?.scope_??eK()).drafts_.push(r),a.callbacks_=n?.callbacks_??[],a.key_=i,n&&i!==void 0?n3e(n,a,i):a.callbacks_.push(function(l){l.mapSetPlugin_?.fixSetContents(a);const{patchPlugin_:c}=l;a.modified_&&c&&c.generatePatches_(a,[],l)}),r}function yo(t){return xc(t)||fo(10,t),aK(t)}function aK(t){if(!_o(t)||ww(t))return t;const e=t[Sa];let n,i=!0;if(e){if(!e.modified_)return e.base_;e.finalized_=!0,n=pR(t,e.scope_.immer_.useStrictShallowCopy_),i=e.scope_.immer_.shouldUseStrictIteration()}else n=pR(t,!0);return Hx(n,(r,a)=>{Y1(n,r,aK(a))},i),e&&(e.finalized_=!1),n}var o3e=new s3e,sK=o3e.produce;function oK(t){return({dispatch:n,getState:i})=>r=>a=>typeof a=="function"?a(n,i,t):r(a)}var l3e=oK(),c3e=oK,u3e=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]=="object"?q1:q1.apply(null,arguments)};function qs(t,e){function n(...i){if(e){let r=e(...i);if(!r)throw new Error(fs(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=>YX(i)&&i.type===t,n}var lK=class r0 extends Array{constructor(...e){super(...e),Object.setPrototypeOf(this,r0.prototype)}static get[Symbol.species](){return r0}concat(...e){return super.concat.apply(this,e)}prepend(...e){return e.length===1&&Array.isArray(e[0])?new r0(...e[0].concat(this)):new r0(...e.concat(this))}};function A6(t){return _o(t)?sK(t,()=>{}):t}function Hb(t,e,n){return t.has(e)?t.get(e):t.set(e,n(e)).get(e)}function d3e(t){return typeof t=="boolean"}var f3e=()=>function(e){const{thunk:n=!0,immutableCheck:i=!0,serializableCheck:r=!0,actionCreatorCheck:a=!0}=e??{};let s=new lK;return n&&(d3e(n)?s.push(l3e):s.push(c3e(n.extraArgument))),s},cK="RTK_autoBatch",ci=()=>t=>({payload:t,meta:{[cK]:!0}}),T6=t=>e=>{setTimeout(e,t)},uK=(t={type:"raf"})=>e=>(...n)=>{const i=e(...n);let r=!0,a=!1,s=!1;const o=new Set,l=t.type==="tick"?queueMicrotask:t.type==="raf"?typeof window<"u"&&window.requestAnimationFrame?window.requestAnimationFrame:T6(10):t.type==="callback"?t.queueNotification:T6(t.timeout),c=()=>{s=!1,a&&(a=!1,o.forEach(d=>d()))};return Object.assign({},i,{subscribe(d){const f=()=>r&&d(),m=i.subscribe(f);return o.add(d),()=>{m(),o.delete(d)}},dispatch(d){try{return r=!d?.meta?.[cK],a=!r,a&&(s||(s=!0,l(c))),i.dispatch(d)}finally{r=!0}}})},h3e=t=>function(n){const{autoBatch:i=!0}=n??{};let r=new lK(t);return i&&r.push(uK(typeof i=="object"?i:void 0)),r};function p3e(t){const e=f3e(),{reducer:n=void 0,middleware:i,devTools:r=!0,preloadedState:a=void 0,enhancers:s=void 0}=t||{};let o;if(typeof n=="function")o=n;else if(rk(n))o=KX(n);else throw new Error(fs(1));let l;typeof i=="function"?l=i(e):l=e();let c=q1;r&&(c=u3e({trace:!1,...typeof r=="object"&&r}));const d=qNe(...l),f=h3e(d);let m=typeof s=="function"?s(f):f();const g=c(...m);return XX(o,a,g)}function dK(t){const e={},n=[];let i;const r={addCase(a,s){const o=typeof a=="string"?a:a.type;if(!o)throw new Error(fs(28));if(o in e)throw new Error(fs(29));return e[o]=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 m3e(t){return typeof t=="function"}function g3e(t,e){let[n,i,r]=dK(e),a;if(m3e(t))a=()=>A6(t());else{const o=A6(t);a=()=>o}function s(o=a(),l){let c=[n[l.type],...i.filter(({matcher:d})=>d(l)).map(({reducer:d})=>d)];return c.filter(d=>!!d).length===0&&(c=[r]),c.reduce((d,f)=>{if(f)if(xc(d)){const g=f(d,l);return g===void 0?d:g}else{if(_o(d))return sK(d,m=>f(m,l));{const m=f(d,l);if(m===void 0){if(d===null)return d;throw Error("A case reducer on a non-draftable value must not return undefined")}return m}}return d},o)}return s.getInitialState=a,s}var x3e="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW",v3e=(t=21)=>{let e="",n=t;for(;n--;)e+=x3e[Math.random()*64|0];return e},y3e=Symbol.for("rtk-slice-createasyncthunk");function b3e(t,e){return`${t}/${e}`}function _3e({creators:t}={}){const e=t?.asyncThunk?.[y3e];return function(i){const{name:r,reducerPath:a=r}=i;if(!r)throw new Error(fs(11));const s=(typeof i.reducers=="function"?i.reducers(w3e()):i.reducers)||{},o=Object.keys(s),l={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},c={addCase(w,T){const C=typeof w=="string"?w:w.type;if(!C)throw new Error(fs(12));if(C in l.sliceCaseReducersByType)throw new Error(fs(13));return l.sliceCaseReducersByType[C]=T,c},addMatcher(w,T){return l.sliceMatchers.push({matcher:w,reducer:T}),c},exposeAction(w,T){return l.actionCreators[w]=T,c},exposeCaseReducer(w,T){return l.sliceCaseReducersByName[w]=T,c}};o.forEach(w=>{const T=s[w],C={reducerName:w,type:b3e(r,w),createNotation:typeof i.reducers=="function"};E3e(T)?T3e(C,T,c,e):M3e(C,T,c)});function d(){const[w={},T=[],C=void 0]=typeof i.extraReducers=="function"?dK(i.extraReducers):[i.extraReducers],P={...w,...l.sliceCaseReducersByType};return g3e(i.initialState,A=>{for(let U in P)A.addCase(U,P[U]);for(let U of l.sliceMatchers)A.addMatcher(U.matcher,U.reducer);for(let U of T)A.addMatcher(U.matcher,U.reducer);C&&A.addDefaultCase(C)})}const f=w=>w,m=new Map,g=new WeakMap;let y;function _(w,T){return y||(y=d()),y(w,T)}function v(){return y||(y=d()),y.getInitialState()}function x(w,T=!1){function C(A){let U=A[w];return typeof U>"u"&&T&&(U=Hb(g,C,v)),U}function P(A=f){const U=Hb(m,T,()=>new WeakMap);return Hb(U,A,()=>{const N={};for(const[D,F]of Object.entries(i.selectors??{}))N[D]=S3e(F,A,()=>Hb(g,A,v),T);return N})}return{reducerPath:w,getSelectors:P,get selectors(){return P(C)},selectSlice:C}}const M={name:r,reducer:_,actions:l.actionCreators,caseReducers:l.sliceCaseReducersByName,getInitialState:v,...x(a),injectInto(w,{reducerPath:T,...C}={}){const P=T??a;return w.inject({reducerPath:P,reducer:_},C),{...M,...x(P,!0)}}};return M}}function S3e(t,e,n,i){function r(a,...s){let o=e(a);return typeof o>"u"&&i&&(o=n()),t(o,...s)}return r.unwrapped=t,r}var Ha=_3e();function w3e(){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 M3e({type:t,reducerName:e,createNotation:n},i,r){let a,s;if("reducer"in i){if(n&&!A3e(i))throw new Error(fs(17));a=i.reducer,s=i.prepare}else a=i;r.addCase(t,a).exposeCaseReducer(e,a).exposeAction(e,s?qs(t,s):qs(t))}function E3e(t){return t._reducerDefinitionType==="asyncThunk"}function A3e(t){return t._reducerDefinitionType==="reducerWithPrepare"}function T3e({type:t,reducerName:e},n,i,r){if(!r)throw new Error(fs(18));const{payloadCreator:a,fulfilled:s,pending:o,rejected:l,settled:c,options:d}=n,f=r(t,a,d);i.exposeAction(e,f),s&&i.addCase(f.fulfilled,s),o&&i.addCase(f.pending,o),l&&i.addCase(f.rejected,l),c&&i.addMatcher(f.settled,c),i.exposeCaseReducer(e,{fulfilled:s||Vb,pending:o||Vb,rejected:l||Vb,settled:c||Vb})}function Vb(){}var C3e="task",fK="listener",hK="completed",uk="cancelled",N3e=`task-${uk}`,R3e=`task-${hK}`,bR=`${fK}-${uk}`,P3e=`${fK}-${hK}`,Ew=class{constructor(t){this.code=t,this.message=`${C3e} ${uk} (reason: ${t})`}name="TaskAbortError";message},dk=(t,e)=>{if(typeof t!="function")throw new TypeError(fs(32))},Q1=()=>{},pK=(t,e=Q1)=>(t.catch(e),t),mK=(t,e)=>(t.addEventListener("abort",e,{once:!0}),()=>t.removeEventListener("abort",e)),hf=(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))},pf=t=>{if(t.aborted){const{reason:e}=t;throw new Ew(e)}};function gK(t,e){let n=Q1;return new Promise((i,r)=>{const a=()=>r(new Ew(t.reason));if(t.aborted){a();return}n=mK(t,a),e.finally(()=>n()).then(i,r)}).finally(()=>{n=Q1})}var D3e=async(t,e)=>{try{return await Promise.resolve(),{status:"ok",value:await t()}}catch(n){return{status:n instanceof Ew?"cancelled":"rejected",error:n}}finally{e?.()}},J1=t=>e=>pK(gK(t,e).then(n=>(pf(t),n))),xK=t=>{const e=J1(t);return n=>e(new Promise(i=>setTimeout(i,n)))},{assign:Dp}=Object,C6={},Aw="listenerMiddleware",k3e=(t,e)=>{const n=i=>mK(t,()=>hf(i,t.reason));return(i,r)=>{dk(i);const a=new AbortController;n(a);const s=D3e(async()=>{pf(t),pf(a.signal);const o=await i({pause:J1(a.signal),delay:xK(a.signal),signal:a.signal});return pf(a.signal),o},()=>hf(a,R3e));return r?.autoJoin&&e.push(s.catch(Q1)),{result:J1(t)(s),cancel(){hf(a,N3e)}}}},O3e=(t,e)=>{const n=async(i,r)=>{pf(e);let a=()=>{};const o=[new Promise((l,c)=>{let d=t({predicate:i,effect:(f,m)=>{m.unsubscribe(),l([f,m.getState(),m.getOriginalState()])}});a=()=>{d(),c()}})];r!=null&&o.push(new Promise(l=>setTimeout(l,r,null)));try{const l=await gK(e,Promise.race(o));return pf(e),l}finally{a()}};return(i,r)=>pK(n(i,r))},vK=t=>{let{type:e,actionCreator:n,matcher:i,predicate:r,effect:a}=t;if(e)r=qs(e).match;else if(n)e=n.type,r=n.match;else if(i)r=i;else if(!r)throw new Error(fs(21));return dk(a),{predicate:r,type:e,effect:a}},yK=Dp(t=>{const{type:e,predicate:n,effect:i}=vK(t);return{id:v3e(),effect:i,type:e,predicate:n,pending:new Set,unsubscribe:()=>{throw new Error(fs(22))}}},{withTypes:()=>yK}),N6=(t,e)=>{const{type:n,effect:i,predicate:r}=vK(e);return Array.from(t.values()).find(a=>(typeof n=="string"?a.type===n:a.predicate===r)&&a.effect===i)},_R=t=>{t.pending.forEach(e=>{hf(e,bR)})},L3e=(t,e)=>()=>{for(const n of e.keys())_R(n);t.clear()},R6=(t,e,n)=>{try{t(e,n)}catch(i){setTimeout(()=>{throw i},0)}},bK=Dp(qs(`${Aw}/add`),{withTypes:()=>bK}),I3e=qs(`${Aw}/removeAll`),_K=Dp(qs(`${Aw}/remove`),{withTypes:()=>_K}),U3e=(...t)=>{console.error(`${Aw}/error`,...t)},$x=(t={})=>{const e=new Map,n=new Map,i=g=>{const y=n.get(g)??0;n.set(g,y+1)},r=g=>{const y=n.get(g)??1;y===1?n.delete(g):n.set(g,y-1)},{extra:a,onError:s=U3e}=t;dk(s);const o=g=>(g.unsubscribe=()=>e.delete(g.id),e.set(g.id,g),y=>{g.unsubscribe(),y?.cancelActive&&_R(g)}),l=g=>{const y=N6(e,g)??yK(g);return o(y)};Dp(l,{withTypes:()=>l});const c=g=>{const y=N6(e,g);return y&&(y.unsubscribe(),g.cancelActive&&_R(y)),!!y};Dp(c,{withTypes:()=>c});const d=async(g,y,_,v)=>{const x=new AbortController,M=O3e(l,x.signal),w=[];try{g.pending.add(x),i(g),await Promise.resolve(g.effect(y,Dp({},_,{getOriginalState:v,condition:(T,C)=>M(T,C).then(Boolean),take:M,delay:xK(x.signal),pause:J1(x.signal),extra:a,signal:x.signal,fork:k3e(x.signal,w),unsubscribe:g.unsubscribe,subscribe:()=>{e.set(g.id,g)},cancelActiveListeners:()=>{g.pending.forEach((T,C,P)=>{T!==x&&(hf(T,bR),P.delete(T))})},cancel:()=>{hf(x,bR),g.pending.delete(x)},throwIfCancelled:()=>{pf(x.signal)}})))}catch(T){T instanceof Ew||R6(s,T,{raisedBy:"effect"})}finally{await Promise.all(w),hf(x,P3e),r(g),g.pending.delete(x)}},f=L3e(e,n);return{middleware:g=>y=>_=>{if(!YX(_))return y(_);if(bK.match(_))return l(_.payload);if(I3e.match(_)){f();return}if(_K.match(_))return c(_.payload);let v=g.getState();const x=()=>{if(v===C6)throw new Error(fs(23));return v};let M;try{if(M=y(_),e.size>0){const w=g.getState(),T=Array.from(e.values());for(const C of T){let P=!1;try{P=C.predicate(_,w,v)}catch(A){P=!1,R6(s,A,{raisedBy:"predicate"})}P&&d(C,_,g,x)}}}finally{v=C6}return M},startListening:l,stopListening:c,clearListeners:f}};function fs(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 j3e={layoutType:"horizontal",width:0,height:0,margin:{top:5,right:5,bottom:5,left:5},scale:1},SK=Ha({name:"chartLayout",initialState:j3e,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:F3e,setLayout:z3e,setChartSize:B3e,setScale:H3e}=SK.actions,V3e=SK.reducer;function wK(t,e,n){return Array.isArray(t)&&t&&e+n!==0?t.slice(e,n+1):t}function P6(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 bp(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?P6(Object(n),!0).forEach(function(i){$3e(t,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):P6(Object(n)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(n,i))})}return t}function $3e(t,e,n){return(e=G3e(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function G3e(t){var e=W3e(t,"string");return typeof e=="symbol"?e:e+""}function W3e(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 Kn(t,e,n){return gi(t)||gi(e)?n:nl(e)?Of(t,e,n):typeof e=="function"?e(t):n}var q3e=(t,e,n)=>{if(e&&n){var{width:i,height:r}=n,{align:a,verticalAlign:s,layout:o}=e;if((o==="vertical"||o==="horizontal"&&s==="middle")&&a!=="center"&&Et(t[a]))return bp(bp({},t),{},{[a]:t[a]+(i||0)});if((o==="horizontal"||o==="vertical"&&a==="center")&&s!=="middle"&&Et(t[s]))return bp(bp({},t),{},{[s]:t[s]+(r||0)})}return t},Mc=(t,e)=>t==="horizontal"&&e==="xAxis"||t==="vertical"&&e==="yAxis"||t==="centric"&&e==="angleAxis"||t==="radial"&&e==="radiusAxis",MK=(t,e,n,i)=>{if(i)return t.map(o=>o.coordinate);var r,a,s=t.map(o=>(o.coordinate===e&&(r=!0),o.coordinate===n&&(a=!0),o.coordinate));return r||s.push(e),a||s.push(n),s},EK=(t,e,n)=>{if(!t)return null;var{duplicateDomain:i,type:r,range:a,scale:s,realScaleType:o,isCategorical:l,categoricalDomain:c,tickCount:d,ticks:f,niceTicks:m,axisType:g}=t;if(!s)return null;var y=o==="scaleBand"&&s.bandwidth?s.bandwidth()/2:2,_=r==="category"&&s.bandwidth?s.bandwidth()/y:0;if(_=g==="angleAxis"&&a&&a.length>=2?Er(a[0]-a[1])*2*_:_,f||m){var v=(f||m||[]).map((x,M)=>{var w=i?i.indexOf(x):x;return{coordinate:s(w)+_,value:x,offset:_,index:M}});return v.filter(x=>!Ws(x.coordinate))}return l&&c?c.map((x,M)=>({coordinate:s(x)+_,value:x,index:M,offset:_})):s.ticks&&d!=null?s.ticks(d).map((x,M)=>({coordinate:s(x)+_,value:x,offset:_,index:M})):s.domain().map((x,M)=>({coordinate:s(x)+_,value:i?i[x]:x,index:M,offset:_}))},D6=1e-4,X3e=t=>{var e=t.domain();if(!(!e||e.length<=2)){var n=e.length,i=t.range(),r=Math.min(i[0],i[1])-D6,a=Math.max(i[0],i[1])+D6,s=t(e[0]),o=t(e[n-1]);(s<r||s>a||o<r||o>a)&&t.domain([e[0],e[n-1]])}},K3e=(t,e)=>{if(!e||e.length!==2||!Et(e[0])||!Et(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(!Et(t[0])||t[0]<n)&&(r[0]=n),(!Et(t[1])||t[1]>i)&&(r[1]=i),r[0]>i&&(r[0]=i),r[1]<n&&(r[1]=n),r},Y3e=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 o=Ws(t[s][n][1])?t[s][n][0]:t[s][n][1];o>=0?(t[s][n][0]=r,t[s][n][1]=r+o,r=t[s][n][1]):(t[s][n][0]=a,t[s][n][1]=a+o,a=t[s][n][1])}},Z3e=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=Ws(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)}},Q3e={sign:Y3e,expand:wCe,none:Jp,silhouette:MCe,wiggle:ECe,positive:Z3e},J3e=(t,e,n)=>{var i=Q3e[n],r=SCe().keys(e).value((a,s)=>Number(Kn(a,s,0))).order(uR).offset(i);return r(t)};function AK(t){return t==null?void 0:String(t)}function k6(t){var{axis:e,ticks:n,bandSize:i,entry:r,index:a,dataKey:s}=t;if(e.type==="category"){if(!e.allowDuplicatedCategory&&e.dataKey&&!gi(r[e.dataKey])){var o=RX(n,"value",r[e.dataKey]);if(o)return o.coordinate+i/2}return n[a]?n[a].coordinate+i/2:null}var l=Kn(r,gi(s)?e.dataKey:s);return gi(l)?null:e.scale(l)}var O6=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 o=Kn(a,e.dataKey,e.scale.domain()[s]);return gi(o)?null:e.scale(o)-r/2+i},eRe=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]},tRe=t=>{var e=t.flat(2).filter(Et);return[Math.min(...e),Math.max(...e)]},nRe=t=>[t[0]===1/0?0:t[0],t[1]===-1/0?0:t[1]],iRe=(t,e,n)=>{if(t!=null)return nRe(Object.keys(t).reduce((i,r)=>{var a=t[r],{stackedData:s}=a,o=s.reduce((l,c)=>{var d=wK(c,e,n),f=tRe(d);return[Math.min(l[0],f[0]),Math.max(l[1],f[1])]},[1/0,-1/0]);return[Math.min(o[0],i[0]),Math.max(o[1],i[1])]},[1/0,-1/0]))},L6=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,I6=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,nm=(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=vw(e,d=>d.coordinate),a=1/0,s=1,o=r.length;s<o;s++){var l=r[s],c=r[s-1];a=Math.min((l.coordinate||0)-(c.coordinate||0),a)}return a===1/0?0:a}return n?void 0:0};function U6(t){var{tooltipEntrySettings:e,dataKey:n,payload:i,value:r,name:a}=t;return bp(bp({},e),{},{dataKey:n,payload:i,value:r,name:a})}function ym(t,e){if(t)return String(t);if(typeof e=="string")return e}var rRe=(t,e)=>{if(e==="horizontal")return t.chartX;if(e==="vertical")return t.chartY},aRe=(t,e)=>e==="centric"?t.angle:t.radius,Ec=t=>t.layout.width,Ac=t=>t.layout.height,sRe=t=>t.layout.scale,TK=t=>t.layout.margin,Tw=He(t=>t.cartesianAxis.xAxis,t=>Object.values(t)),Cw=He(t=>t.cartesianAxis.yAxis,t=>Object.values(t)),CK="data-recharts-item-index",NK="data-recharts-item-data-key",Gx=60;function j6(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 $b(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?j6(Object(n),!0).forEach(function(i){oRe(t,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):j6(Object(n)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(n,i))})}return t}function oRe(t,e,n){return(e=lRe(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function lRe(t){var e=cRe(t,"string");return typeof e=="symbol"?e:e+""}function cRe(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 uRe=t=>t.brush.height;function dRe(t){var e=Cw(t);return e.reduce((n,i)=>{if(i.orientation==="left"&&!i.mirror&&!i.hide){var r=typeof i.width=="number"?i.width:Gx;return n+r}return n},0)}function fRe(t){var e=Cw(t);return e.reduce((n,i)=>{if(i.orientation==="right"&&!i.mirror&&!i.hide){var r=typeof i.width=="number"?i.width:Gx;return n+r}return n},0)}function hRe(t){var e=Tw(t);return e.reduce((n,i)=>i.orientation==="top"&&!i.mirror&&!i.hide?n+i.height:n,0)}function pRe(t){var e=Tw(t);return e.reduce((n,i)=>i.orientation==="bottom"&&!i.mirror&&!i.hide?n+i.height:n,0)}var cr=He([Ec,Ac,TK,uRe,dRe,fRe,hRe,pRe,WX,zNe],(t,e,n,i,r,a,s,o,l,c)=>{var d={left:(n.left||0)+r,right:(n.right||0)+a},f={top:(n.top||0)+s,bottom:(n.bottom||0)+o},m=$b($b({},f),d),g=m.bottom;m.bottom+=i,m=q3e(m,l,c);var y=t-m.left-m.right,_=e-m.top-m.bottom;return $b($b({brushBottom:g},m),{},{width:Math.max(y,0),height:Math.max(_,0)})}),mRe=He(cr,t=>({x:t.left,y:t.top,width:t.width,height:t.height})),fk=He(Ec,Ac,(t,e)=>({x:0,y:0,width:t,height:e})),gRe=E.createContext(null),sa=()=>E.useContext(gRe)!=null,Nw=t=>t.brush,Rw=He([Nw,cr,TK],(t,e,n)=>({height:t.height,x:Et(t.x)?t.x:e.left,y:Et(t.y)?t.y:e.top+e.height+e.brushBottom-(n?.bottom||0),width:Et(t.width)?t.width:e.width})),mC={},gC={},xC={},F6;function xRe(){return F6||(F6=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});function e(n,i,{signal:r,edges:a}={}){let s,o=null;const l=a!=null&&a.includes("leading"),c=a==null||a.includes("trailing"),d=()=>{o!==null&&(n.apply(s,o),s=void 0,o=null)},f=()=>{c&&d(),_()};let m=null;const g=()=>{m!=null&&clearTimeout(m),m=setTimeout(()=>{m=null,f()},i)},y=()=>{m!==null&&(clearTimeout(m),m=null)},_=()=>{y(),s=void 0,o=null},v=()=>{d()},x=function(...M){if(r?.aborted)return;s=this,o=M;const w=m==null;g(),l&&w&&d()};return x.schedule=g,x.cancel=_,x.flush=v,r?.addEventListener("abort",_,{once:!0}),x}t.debounce=e})(xC)),xC}var z6;function vRe(){return z6||(z6=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=xRe();function n(i,r=0,a={}){typeof a!="object"&&(a={});const{leading:s=!1,trailing:o=!0,maxWait:l}=a,c=Array(2);s&&(c[0]="leading"),o&&(c[1]="trailing");let d,f=null;const m=e.debounce(function(..._){d=i.apply(this,_),f=null},r,{edges:c}),g=function(..._){return l!=null&&(f===null&&(f=Date.now()),Date.now()-f>=l)?(d=i.apply(this,_),f=Date.now(),m.cancel(),m.schedule(),d):(m.apply(this,_),d)},y=()=>(m.flush(),d);return g.cancel=m.cancel,g.flush=y,g}t.debounce=n})(gC)),gC}var B6;function yRe(){return B6||(B6=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=vRe();function n(i,r=0,a={}){const{leading:s=!0,trailing:o=!0}=a;return e.debounce(i,r,{leading:s,maxWait:r,trailing:o})}t.throttle=n})(mC)),mC}var vC,H6;function bRe(){return H6||(H6=1,vC=yRe().throttle),vC}var _Re=bRe();const SRe=Ks(_Re);var eS=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++]))}},RK=(t,e,n)=>{var{width:i="100%",height:r="100%",aspect:a,maxHeight:s}=n,o=gc(i)?t:Number(i),l=gc(r)?e:Number(r);return a&&a>0&&(o?l=o/a:l&&(o=l*a),s&&l!=null&&l>s&&(l=s)),{calculatedWidth:o,calculatedHeight:l}},wRe={width:0,height:0,overflow:"visible"},MRe={width:0,overflowX:"visible"},ERe={height:0,overflowY:"visible"},ARe={},TRe=t=>{var{width:e,height:n}=t,i=gc(e),r=gc(n);return i&&r?wRe:i?MRe:r?ERe:ARe};function CRe(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 oi(t){return Number.isFinite(t)}function il(t){return typeof t=="number"&&t>0&&Number.isFinite(t)}function SR(){return SR=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},SR.apply(null,arguments)}function V6(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 $6(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?V6(Object(n),!0).forEach(function(i){NRe(t,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):V6(Object(n)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(n,i))})}return t}function NRe(t,e,n){return(e=RRe(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function RRe(t){var e=PRe(t,"string");return typeof e=="symbol"?e:e+""}function PRe(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 PK=E.createContext({width:-1,height:-1});function DRe(t){return il(t.width)&&il(t.height)}function DK(t){var{children:e,width:n,height:i}=t,r=E.useMemo(()=>({width:n,height:i}),[n,i]);return DRe(r)?E.createElement(PK.Provider,{value:r},e):null}var hk=()=>E.useContext(PK),kRe=E.forwardRef((t,e)=>{var{aspect:n,initialDimension:i={width:-1,height:-1},width:r,height:a,minWidth:s=0,minHeight:o,maxHeight:l,children:c,debounce:d=0,id:f,className:m,onResize:g,style:y={}}=t,_=E.useRef(null),v=E.useRef();v.current=g,E.useImperativeHandle(e,()=>_.current);var[x,M]=E.useState({containerWidth:i.width,containerHeight:i.height}),w=E.useCallback((U,N)=>{M(D=>{var F=Math.round(U),I=Math.round(N);return D.containerWidth===F&&D.containerHeight===I?D:{containerWidth:F,containerHeight:I}})},[]);E.useEffect(()=>{if(_.current==null||typeof ResizeObserver>"u")return zx;var U=I=>{var W,{width:O,height:B}=I[0].contentRect;w(O,B),(W=v.current)===null||W===void 0||W.call(v,O,B)};d>0&&(U=SRe(U,d,{trailing:!0,leading:!1}));var N=new ResizeObserver(U),{width:D,height:F}=_.current.getBoundingClientRect();return w(D,F),N.observe(_.current),()=>{N.disconnect()}},[w,d]);var{containerWidth:T,containerHeight:C}=x;eS(!n||n>0,"The aspect(%s) must be greater than zero.",n);var{calculatedWidth:P,calculatedHeight:A}=RK(T,C,{width:r,height:a,aspect:n,maxHeight:l});return eS(P!=null&&P>0||A!=null&&A>0,`The width(%s) and height(%s) of chart should be greater than 0,
  8186. please check the style of container, or the props width(%s) and height(%s),
  8187. or add a minWidth(%s) or minHeight(%s) or use aspect(%s) to control the
  8188. height and width.`,P,A,r,a,s,o,n),E.createElement("div",{id:f?"".concat(f):void 0,className:En("recharts-responsive-container",m),style:$6($6({},y),{},{width:r,height:a,minWidth:s,minHeight:o,maxHeight:l}),ref:_},E.createElement("div",{style:TRe({width:r,height:a})},E.createElement(DK,{width:P,height:A},c)))}),yC=E.forwardRef((t,e)=>{var n=hk();if(il(n.width)&&il(n.height))return t.children;var{width:i,height:r}=CRe({width:t.width,height:t.height,aspect:t.aspect}),{calculatedWidth:a,calculatedHeight:s}=RK(void 0,void 0,{width:i,height:r,aspect:t.aspect,maxHeight:t.maxHeight});return Et(a)&&Et(s)?E.createElement(DK,{width:a,height:s},t.children):E.createElement(kRe,SR({},t,{width:i,height:r,ref:e}))});function kK(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 Pw=()=>{var t,e=sa(),n=At(mRe),i=At(Rw),r=(t=At(Nw))===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}},ORe={top:0,bottom:0,left:0,right:0,width:0,height:0,brushBottom:0},OK=()=>{var t;return(t=At(cr))!==null&&t!==void 0?t:ORe},pk=()=>At(Ec),mk=()=>At(Ac),LRe=()=>At(t=>t.layout.margin),_n=t=>t.layout.layoutType,bm=()=>At(_n),IRe=()=>{var t=bm();if(t==="horizontal"||t==="vertical")return t},URe=()=>{var t=bm();return t!==void 0},Dw=t=>{var e=ei(),n=sa(),{width:i,height:r}=t,a=hk(),s=i,o=r;return a&&(s=a.width>0?a.width:i,o=a.height>0?a.height:r),E.useEffect(()=>{!n&&il(s)&&il(o)&&e(B3e({width:s,height:o}))},[e,n,s,o]),null},LK=Symbol.for("immer-nothing"),G6=Symbol.for("immer-draftable"),ps=Symbol.for("immer-state");function ho(t,...e){throw new Error(`[Immer] minified error nr: ${t}. Full error at: https://bit.ly/3cXEKWf`)}var ux=Object.getPrototypeOf;function im(t){return!!t&&!!t[ps]}function Lf(t){return t?IK(t)||Array.isArray(t)||!!t[G6]||!!t.constructor?.[G6]||Wx(t)||Ow(t):!1}var jRe=Object.prototype.constructor.toString(),W6=new WeakMap;function IK(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=W6.get(n);return i===void 0&&(i=Function.toString.call(n),W6.set(n,i)),i===jRe}function tS(t,e,n=!0){kw(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 kw(t){const e=t[ps];return e?e.type_:Array.isArray(t)?1:Wx(t)?2:Ow(t)?3:0}function wR(t,e){return kw(t)===2?t.has(e):Object.prototype.hasOwnProperty.call(t,e)}function UK(t,e,n){const i=kw(t);i===2?t.set(e,n):i===3?t.add(n):t[e]=n}function FRe(t,e){return t===e?t!==0||1/t===1/e:t!==t&&e!==e}function Wx(t){return t instanceof Map}function Ow(t){return t instanceof Set}function Bd(t){return t.copy_||t.base_}function MR(t,e){if(Wx(t))return new Map(t);if(Ow(t))return new Set(t);if(Array.isArray(t))return Array.prototype.slice.call(t);const n=IK(t);if(e===!0||e==="class_only"&&!n){const i=Object.getOwnPropertyDescriptors(t);delete i[ps];let r=Reflect.ownKeys(i);for(let a=0;a<r.length;a++){const s=r[a],o=i[s];o.writable===!1&&(o.writable=!0,o.configurable=!0),(o.get||o.set)&&(i[s]={configurable:!0,writable:!0,enumerable:o.enumerable,value:t[s]})}return Object.create(ux(t),i)}else{const i=ux(t);if(i!==null&&n)return{...t};const r=Object.create(i);return Object.assign(r,t)}}function gk(t,e=!1){return Lw(t)||im(t)||!Lf(t)||(kw(t)>1&&Object.defineProperties(t,{set:Gb,add:Gb,clear:Gb,delete:Gb}),Object.freeze(t),e&&Object.values(t).forEach(n=>gk(n,!0))),t}function zRe(){ho(2)}var Gb={value:zRe};function Lw(t){return t===null||typeof t!="object"?!0:Object.isFrozen(t)}var BRe={};function If(t){const e=BRe[t];return e||ho(0,t),e}var dx;function jK(){return dx}function HRe(t,e){return{drafts_:[],parent_:t,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function q6(t,e){e&&(If("Patches"),t.patches_=[],t.inversePatches_=[],t.patchListener_=e)}function ER(t){AR(t),t.drafts_.forEach(VRe),t.drafts_=null}function AR(t){t===dx&&(dx=t.parent_)}function X6(t){return dx=HRe(dx,t)}function VRe(t){const e=t[ps];e.type_===0||e.type_===1?e.revoke_():e.revoked_=!0}function K6(t,e){e.unfinalizedDrafts_=e.drafts_.length;const n=e.drafts_[0];return t!==void 0&&t!==n?(n[ps].modified_&&(ER(e),ho(4)),Lf(t)&&(t=nS(e,t),e.parent_||iS(e,t)),e.patches_&&If("Patches").generateReplacementPatches_(n[ps].base_,t,e.patches_,e.inversePatches_)):t=nS(e,n,[]),ER(e),e.patches_&&e.patchListener_(e.patches_,e.inversePatches_),t!==LK?t:void 0}function nS(t,e,n){if(Lw(e))return e;const i=t.immer_.shouldUseStrictIteration(),r=e[ps];if(!r)return tS(e,(a,s)=>Y6(t,r,e,a,s,n),i),e;if(r.scope_!==t)return e;if(!r.modified_)return iS(t,r.base_,!0),r.base_;if(!r.finalized_){r.finalized_=!0,r.scope_.unfinalizedDrafts_--;const a=r.copy_;let s=a,o=!1;r.type_===3&&(s=new Set(a),a.clear(),o=!0),tS(s,(l,c)=>Y6(t,r,a,l,c,n,o),i),iS(t,a,!1),n&&t.patches_&&If("Patches").generatePatches_(r,n,t.patches_,t.inversePatches_)}return r.copy_}function Y6(t,e,n,i,r,a,s){if(r==null||typeof r!="object"&&!s)return;const o=Lw(r);if(!(o&&!s)){if(im(r)){const l=a&&e&&e.type_!==3&&!wR(e.assigned_,i)?a.concat(i):void 0,c=nS(t,r,l);if(UK(n,i,c),im(c))t.canAutoFreeze_=!1;else return}else s&&n.add(r);if(Lf(r)&&!o){if(!t.immer_.autoFreeze_&&t.unfinalizedDrafts_<1||e&&e.base_&&e.base_[i]===r&&o)return;nS(t,r),(!e||!e.scope_.parent_)&&typeof i!="symbol"&&(Wx(n)?n.has(i):Object.prototype.propertyIsEnumerable.call(n,i))&&iS(t,r)}}}function iS(t,e,n=!1){!t.parent_&&t.immer_.autoFreeze_&&t.canAutoFreeze_&&gk(e,n)}function $Re(t,e){const n=Array.isArray(t),i={type_:n?1:0,scope_:e?e.scope_:jK(),modified_:!1,finalized_:!1,assigned_:{},parent_:e,base_:t,draft_:null,copy_:null,revoke_:null,isManual_:!1};let r=i,a=xk;n&&(r=[i],a=fx);const{revoke:s,proxy:o}=Proxy.revocable(r,a);return i.draft_=o,i.revoke_=s,o}var xk={get(t,e){if(e===ps)return t;const n=Bd(t);if(!wR(n,e))return GRe(t,n,e);const i=n[e];return t.finalized_||!Lf(i)?i:i===bC(t.base_,e)?(_C(t),t.copy_[e]=CR(i,t)):i},has(t,e){return e in Bd(t)},ownKeys(t){return Reflect.ownKeys(Bd(t))},set(t,e,n){const i=FK(Bd(t),e);if(i?.set)return i.set.call(t.draft_,n),!0;if(!t.modified_){const r=bC(Bd(t),e),a=r?.[ps];if(a&&a.base_===n)return t.copy_[e]=n,t.assigned_[e]=!1,!0;if(FRe(n,r)&&(n!==void 0||wR(t.base_,e)))return!0;_C(t),TR(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 bC(t.base_,e)!==void 0||e in t.base_?(t.assigned_[e]=!1,_C(t),TR(t)):delete t.assigned_[e],t.copy_&&delete t.copy_[e],!0},getOwnPropertyDescriptor(t,e){const n=Bd(t),i=Reflect.getOwnPropertyDescriptor(n,e);return i&&{writable:!0,configurable:t.type_!==1||e!=="length",enumerable:i.enumerable,value:n[e]}},defineProperty(){ho(11)},getPrototypeOf(t){return ux(t.base_)},setPrototypeOf(){ho(12)}},fx={};tS(xk,(t,e)=>{fx[t]=function(){return arguments[0]=arguments[0][0],e.apply(this,arguments)}});fx.deleteProperty=function(t,e){return fx.set.call(this,t,e,void 0)};fx.set=function(t,e,n){return xk.set.call(this,t[0],e,n,t[0])};function bC(t,e){const n=t[ps];return(n?Bd(n):t)[e]}function GRe(t,e,n){const i=FK(e,n);return i?"value"in i?i.value:i.get?.call(t.draft_):void 0}function FK(t,e){if(!(e in t))return;let n=ux(t);for(;n;){const i=Object.getOwnPropertyDescriptor(n,e);if(i)return i;n=ux(n)}}function TR(t){t.modified_||(t.modified_=!0,t.parent_&&TR(t.parent_))}function _C(t){t.copy_||(t.copy_=MR(t.base_,t.scope_.immer_.useStrictShallowCopy_))}var WRe=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(l=a,...c){return s.produce(l,d=>n.call(this,d,...c))}}typeof n!="function"&&ho(6),i!==void 0&&typeof i!="function"&&ho(7);let r;if(Lf(e)){const a=X6(this),s=CR(e,void 0);let o=!0;try{r=n(s),o=!1}finally{o?ER(a):AR(a)}return q6(a,i),K6(r,a)}else if(!e||typeof e!="object"){if(r=n(e),r===void 0&&(r=e),r===LK&&(r=void 0),this.autoFreeze_&&gk(r,!0),i){const a=[],s=[];If("Patches").generateReplacementPatches_(e,r,a,s),i(a,s)}return r}else ho(1,e)},this.produceWithPatches=(e,n)=>{if(typeof e=="function")return(s,...o)=>this.produceWithPatches(s,l=>e(l,...o));let i,r;return[this.produce(e,n,(s,o)=>{i=s,r=o}),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){Lf(t)||ho(8),im(t)&&(t=qRe(t));const e=X6(this),n=CR(t,void 0);return n[ps].isManual_=!0,AR(e),n}finishDraft(t,e){const n=t&&t[ps];(!n||!n.isManual_)&&ho(9);const{scope_:i}=n;return q6(i,e),K6(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=If("Patches").applyPatches_;return im(t)?i(t,e):this.produce(t,r=>i(r,e))}};function CR(t,e){const n=Wx(t)?If("MapSet").proxyMap_(t,e):Ow(t)?If("MapSet").proxySet_(t,e):$Re(t,e);return(e?e.scope_:jK()).drafts_.push(n),n}function qRe(t){return im(t)||ho(10,t),zK(t)}function zK(t){if(!Lf(t)||Lw(t))return t;const e=t[ps];let n,i=!0;if(e){if(!e.modified_)return e.base_;e.finalized_=!0,n=MR(t,e.scope_.immer_.useStrictShallowCopy_),i=e.scope_.immer_.shouldUseStrictIteration()}else n=MR(t,!0);return tS(n,(r,a)=>{UK(n,r,zK(a))},i),e&&(e.finalized_=!1),n}var XRe=new WRe;XRe.produce;var KRe={settings:{layout:"horizontal",align:"center",verticalAlign:"middle",itemSorter:"value"},size:{width:0,height:0},payload:[]},BK=Ha({name:"legend",initialState:KRe,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:ci()},replaceLegendPayload:{reducer(t,e){var{prev:n,next:i}=e.payload,r=yo(t).payload.indexOf(n);r>-1&&(t.payload[r]=i)},prepare:ci()},removeLegendPayload:{reducer(t,e){var n=yo(t).payload.indexOf(e.payload);n>-1&&t.payload.splice(n,1)},prepare:ci()}}}),{setLegendSize:Z6,setLegendSettings:YRe,addLegendPayload:HK,replaceLegendPayload:VK,removeLegendPayload:$K}=BK.actions,ZRe=BK.reducer,QRe=["contextPayload"];function NR(){return NR=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},NR.apply(null,arguments)}function Q6(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 rm(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Q6(Object(n),!0).forEach(function(i){JRe(t,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Q6(Object(n)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(n,i))})}return t}function JRe(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)}function nPe(t,e){if(t==null)return{};var n,i,r=iPe(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 iPe(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 rPe(t){return t.value}function aPe(t){var{contextPayload:e}=t,n=nPe(t,QRe),i=HX(e,t.payloadUniqBy,rPe),r=rm(rm({},n),{},{payload:i});return E.isValidElement(t.content)?E.cloneElement(t.content,r):typeof t.content=="function"?E.createElement(t.content,r):E.createElement(eNe,r)}function sPe(t,e,n,i,r,a){var{layout:s,align:o,verticalAlign:l}=e,c,d;return(!t||(t.left===void 0||t.left===null)&&(t.right===void 0||t.right===null))&&(o==="center"&&s==="vertical"?c={left:((i||0)-a.width)/2}:c=o==="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))&&(l==="middle"?d={top:((r||0)-a.height)/2}:d=l==="bottom"?{bottom:n&&n.bottom||0}:{top:n&&n.top||0}),rm(rm({},c),d)}function oPe(t){var e=ei();return E.useEffect(()=>{e(YRe(t))},[e,t]),null}function lPe(t){var e=ei();return E.useEffect(()=>(e(Z6(t)),()=>{e(Z6({width:0,height:0}))}),[e,t]),null}function cPe(t,e,n,i){return t==="vertical"&&Et(e)?{height:e}:t==="horizontal"?{width:n||i}:null}var uPe={align:"center",iconSize:14,itemSorter:"value",layout:"horizontal",verticalAlign:"bottom"};function GK(t){var e=Yi(t,uPe),n=VNe(),i=W2e(),r=LRe(),{width:a,height:s,wrapperStyle:o,portal:l}=e,[c,d]=qX([n]),f=pk(),m=mk();if(f==null||m==null)return null;var g=f-(r?.left||0)-(r?.right||0),y=cPe(e.layout,s,a,g),_=l?o:rm(rm({position:"absolute",width:y?.width||a||"auto",height:y?.height||s||"auto"},sPe(o,e,r,f,m,c)),o),v=l??i;if(v==null||n==null)return null;var x=E.createElement("div",{className:"recharts-legend-wrapper",style:_,ref:d},E.createElement(oPe,{layout:e.layout,align:e.align,verticalAlign:e.verticalAlign,itemSorter:e.itemSorter}),!l&&E.createElement(lPe,{width:c.width,height:c.height}),E.createElement(aPe,NR({},e,y,{margin:r,chartWidth:f,chartHeight:m,contextPayload:n})));return Xl.createPortal(x,v)}GK.displayName="Legend";function RR(){return RR=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},RR.apply(null,arguments)}function J6(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 SC(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?J6(Object(n),!0).forEach(function(i){dPe(t,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):J6(Object(n)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(n,i))})}return t}function dPe(t,e,n){return(e=fPe(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function fPe(t){var e=hPe(t,"string");return typeof e=="symbol"?e:e+""}function hPe(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 pPe(t){return Array.isArray(t)&&nl(t[0])&&nl(t[1])?t.join(" ~ "):t}var mPe=t=>{var{separator:e=" : ",contentStyle:n={},itemStyle:i={},labelStyle:r={},payload:a,formatter:s,itemSorter:o,wrapperClassName:l,labelClassName:c,label:d,labelFormatter:f,accessibilityLayer:m=!1}=t,g=()=>{if(a&&a.length){var C={padding:0,margin:0},P=(o?vw(a,o):a).map((A,U)=>{if(A.type==="none")return null;var N=A.formatter||s||pPe,{value:D,name:F}=A,I=D,W=F;if(N){var O=N(D,F,A,U,a);if(Array.isArray(O))[I,W]=O;else if(O!=null)I=O;else return null}var B=SC({display:"block",paddingTop:4,paddingBottom:4,color:A.color||"#000"},i);return E.createElement("li",{className:"recharts-tooltip-item",key:"tooltip-item-".concat(U),style:B},nl(W)?E.createElement("span",{className:"recharts-tooltip-item-name"},W):null,nl(W)?E.createElement("span",{className:"recharts-tooltip-item-separator"},e):null,E.createElement("span",{className:"recharts-tooltip-item-value"},I),E.createElement("span",{className:"recharts-tooltip-item-unit"},A.unit||""))});return E.createElement("ul",{className:"recharts-tooltip-item-list",style:C},P)}return null},y=SC({margin:0,padding:10,backgroundColor:"#fff",border:"1px solid #ccc",whiteSpace:"nowrap"},n),_=SC({margin:0},r),v=!gi(d),x=v?d:"",M=En("recharts-default-tooltip",l),w=En("recharts-tooltip-label",c);v&&f&&a!==void 0&&a!==null&&(x=f(d,a));var T=m?{role:"status","aria-live":"assertive"}:{};return E.createElement("div",RR({className:M,style:y},T),E.createElement("p",{className:w,style:_},E.isValidElement(x)?x:"".concat(x)),g())},Hg="recharts-tooltip-wrapper",gPe={visibility:"hidden"};function xPe(t){var{coordinate:e,translateX:n,translateY:i}=t;return En(Hg,{["".concat(Hg,"-right")]:Et(n)&&e&&Et(e.x)&&n>=e.x,["".concat(Hg,"-left")]:Et(n)&&e&&Et(e.x)&&n<e.x,["".concat(Hg,"-bottom")]:Et(i)&&e&&Et(e.y)&&i>=e.y,["".concat(Hg,"-top")]:Et(i)&&e&&Et(e.y)&&i<e.y})}function eH(t){var{allowEscapeViewBox:e,coordinate:n,key:i,offsetTopLeft:r,position:a,reverseDirection:s,tooltipDimension:o,viewBox:l,viewBoxDimension:c}=t;if(a&&Et(a[i]))return a[i];var d=n[i]-o-(r>0?r:0),f=n[i]+r;if(e[i])return s[i]?d:f;var m=l[i];if(m==null)return 0;if(s[i]){var g=d,y=m;return g<y?Math.max(f,m):Math.max(d,m)}if(c==null)return 0;var _=f+o,v=m+c;return _>v?Math.max(d,m):Math.max(f,m)}function vPe(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 yPe(t){var{allowEscapeViewBox:e,coordinate:n,offsetTopLeft:i,position:r,reverseDirection:a,tooltipBox:s,useTranslate3d:o,viewBox:l}=t,c,d,f;return s.height>0&&s.width>0&&n?(d=eH({allowEscapeViewBox:e,coordinate:n,key:"x",offsetTopLeft:i,position:r,reverseDirection:a,tooltipDimension:s.width,viewBox:l,viewBoxDimension:l.width}),f=eH({allowEscapeViewBox:e,coordinate:n,key:"y",offsetTopLeft:i,position:r,reverseDirection:a,tooltipDimension:s.height,viewBox:l,viewBoxDimension:l.height}),c=vPe({translateX:d,translateY:f,useTranslate3d:o})):c=gPe,{cssProperties:c,cssClasses:xPe({translateX:d,translateY:f,coordinate:n})}}function tH(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 Wb(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?tH(Object(n),!0).forEach(function(i){PR(t,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):tH(Object(n)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(n,i))})}return t}function PR(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)}class SPe extends E.PureComponent{constructor(){super(...arguments),PR(this,"state",{dismissed:!1,dismissedAtCoordinate:{x:0,y:0}}),PR(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:o,isAnimationActive:l,offset:c,position:d,reverseDirection:f,useTranslate3d:m,viewBox:g,wrapperStyle:y,lastBoundingBox:_,innerRef:v,hasPortalFromProps:x}=this.props,{cssClasses:M,cssProperties:w}=yPe({allowEscapeViewBox:n,coordinate:s,offsetTopLeft:c,position:d,reverseDirection:f,tooltipBox:{height:_.height,width:_.width},useTranslate3d:m,viewBox:g}),T=x?{}:Wb(Wb({transition:l&&e?"transform ".concat(i,"ms ").concat(r):void 0},w),{},{pointerEvents:"none",visibility:!this.state.dismissed&&e&&o?"visible":"hidden",position:"absolute",top:0,left:0}),C=Wb(Wb({},T),{},{visibility:!this.state.dismissed&&e&&o?"visible":"hidden"},y);return E.createElement("div",{xmlns:"http://www.w3.org/1999/xhtml",tabIndex:-1,className:M,style:C,ref:v},a)}}var WK=()=>{var t;return(t=At(e=>e.rootProps.accessibilityLayer))!==null&&t!==void 0?t:!0};function DR(){return DR=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},DR.apply(null,arguments)}function nH(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 iH(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?nH(Object(n),!0).forEach(function(i){wPe(t,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):nH(Object(n)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(n,i))})}return t}function wPe(t,e,n){return(e=MPe(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function MPe(t){var e=EPe(t,"string");return typeof e=="symbol"?e:e+""}function EPe(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 rH={curveBasisClosed:dCe,curveBasisOpen:fCe,curveBasis:uCe,curveBumpX:Y2e,curveBumpY:Z2e,curveLinearClosed:hCe,curveLinear:gw,curveMonotoneX:pCe,curveMonotoneY:mCe,curveNatural:gCe,curveStep:xCe,curveStepAfter:yCe,curveStepBefore:vCe},rS=t=>oi(t.x)&&oi(t.y),aH=t=>t.base!=null&&rS(t.base)&&rS(t),Vg=t=>t.x,$g=t=>t.y,APe=(t,e)=>{if(typeof t=="function")return t;var n="curve".concat(Fx(t));return(n==="curveMonotone"||n==="curveBump")&&e?rH["".concat(n).concat(e==="vertical"?"Y":"X")]:rH[n]||gw},TPe=t=>{var{type:e="linear",points:n=[],baseLine:i,layout:r,connectNulls:a=!1}=t,s=APe(e,r),o=a?n.filter(rS):n,l;if(Array.isArray(i)){var c=n.map((g,y)=>iH(iH({},g),{},{base:i[y]}));r==="vertical"?l=jb().y($g).x1(Vg).x0(g=>g.base.x):l=jb().x(Vg).y1($g).y0(g=>g.base.y);var d=l.defined(aH).curve(s),f=a?c.filter(aH):c;return d(f)}r==="vertical"&&Et(i)?l=jb().y($g).x1(Vg).x0(i):Et(i)?l=jb().x(Vg).y1($g).y0(i):l=xX().x(Vg).y($g);var m=l.defined(rS).curve(s);return m(o)},kp=t=>{var{className:e,points:n,path:i,pathRef:r}=t;if((!n||!n.length)&&!i)return null;var a=n&&n.length?TPe(t):i;return E.createElement("path",DR({},za(t),tk(t),{className:En("recharts-curve",e),d:a===null?void 0:a,ref:r}))},CPe=["x","y","top","left","width","height","className"];function kR(){return kR=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},kR.apply(null,arguments)}function sH(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 NPe(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?sH(Object(n),!0).forEach(function(i){RPe(t,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):sH(Object(n)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(n,i))})}return t}function RPe(t,e,n){return(e=PPe(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function PPe(t){var e=DPe(t,"string");return typeof e=="symbol"?e:e+""}function DPe(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 kPe(t,e){if(t==null)return{};var n,i,r=OPe(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 OPe(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 LPe=(t,e,n,i,r,a)=>"M".concat(t,",").concat(r,"v").concat(i,"M").concat(a,",").concat(e,"h").concat(n),IPe=t=>{var{x:e=0,y:n=0,top:i=0,left:r=0,width:a=0,height:s=0,className:o}=t,l=kPe(t,CPe),c=NPe({x:e,y:n,top:i,left:r,width:a,height:s},l);return!Et(e)||!Et(n)||!Et(a)||!Et(s)||!Et(i)||!Et(r)?null:E.createElement("path",kR({},_a(c),{className:En("recharts-cross",o),d:LPe(e,n,a,s,i,r)}))};function UPe(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 oH(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 lH(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?oH(Object(n),!0).forEach(function(i){jPe(t,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):oH(Object(n)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(n,i))})}return t}function jPe(t,e,n){return(e=FPe(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function FPe(t){var e=zPe(t,"string");return typeof e=="symbol"?e:e+""}function zPe(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 BPe=t=>t.replace(/([A-Z])/g,e=>"-".concat(e.toLowerCase())),qK=(t,e,n)=>t.map(i=>"".concat(BPe(i)," ").concat(e,"ms ").concat(n)).join(","),HPe=(t,e)=>[Object.keys(t),Object.keys(e)].reduce((n,i)=>n.filter(r=>i.includes(r))),hx=(t,e)=>Object.keys(e).reduce((n,i)=>lH(lH({},n),{},{[i]:t(i,e[i])}),{});function cH(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 tr(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?cH(Object(n),!0).forEach(function(i){VPe(t,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):cH(Object(n)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(n,i))})}return t}function VPe(t,e,n){return(e=$Pe(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function $Pe(t){var e=GPe(t,"string");return typeof e=="symbol"?e:e+""}function GPe(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 aS=(t,e,n)=>t+(e-t)*n,OR=t=>{var{from:e,to:n}=t;return e!==n},XK=(t,e,n)=>{var i=hx((r,a)=>{if(OR(a)){var[s,o]=t(a.from,a.to,a.velocity);return tr(tr({},a),{},{from:s,velocity:o})}return a},e);return n<1?hx((r,a)=>OR(a)?tr(tr({},a),{},{velocity:aS(a.velocity,i[r].velocity,n),from:aS(a.from,i[r].from,n)}):a,e):XK(t,i,n-1)};function WPe(t,e,n,i,r,a){var s,o=i.reduce((m,g)=>tr(tr({},m),{},{[g]:{from:t[g],velocity:0,to:e[g]}}),{}),l=()=>hx((m,g)=>g.from,o),c=()=>!Object.values(o).filter(OR).length,d=null,f=m=>{s||(s=m);var g=m-s,y=g/n.dt;o=XK(n,o,y),r(tr(tr(tr({},t),e),l())),s=m,c()||(d=a.setTimeout(f))};return()=>(d=a.setTimeout(f),()=>{var m;(m=d)===null||m===void 0||m()})}function qPe(t,e,n,i,r,a,s){var o=null,l=r.reduce((f,m)=>tr(tr({},f),{},{[m]:[t[m],e[m]]}),{}),c,d=f=>{c||(c=f);var m=(f-c)/i,g=hx((_,v)=>aS(...v,n(m)),l);if(a(tr(tr(tr({},t),e),g)),m<1)o=s.setTimeout(d);else{var y=hx((_,v)=>aS(...v,n(1)),l);a(tr(tr(tr({},t),e),y))}};return()=>(o=s.setTimeout(d),()=>{var f;(f=o)===null||f===void 0||f()})}const XPe=(t,e,n,i,r,a)=>{var s=HPe(t,e);return n==null?()=>(r(tr(tr({},t),e)),()=>{}):n.isStepper===!0?WPe(t,e,n,s,r,a):qPe(t,e,n,i,s,r,a)};var sS=1e-4,KK=(t,e)=>[0,3*t,3*e-6*t,3*t-3*e+1],YK=(t,e)=>t.map((n,i)=>n*e**i).reduce((n,i)=>n+i),uH=(t,e)=>n=>{var i=KK(t,e);return YK(i,n)},KPe=(t,e)=>n=>{var i=KK(t,e),r=[...i.map((a,s)=>a*s).slice(1),0];return YK(r,n)},YPe=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(o=>parseFloat(o));return[s[0],s[1],s[2],s[3]]}}}return n.length===4?n:[0,0,1,1]},ZPe=(t,e,n,i)=>{var r=uH(t,n),a=uH(e,i),s=KPe(t,n),o=c=>c>1?1:c<0?0:c,l=c=>{for(var d=c>1?1:c,f=d,m=0;m<8;++m){var g=r(f)-d,y=s(f);if(Math.abs(g-d)<sS||y<sS)return a(f);f=o(f-g/y)}return a(f)};return l.isStepper=!1,l},dH=function(){return ZPe(...YPe(...arguments))},QPe=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},{stiff:n=100,damping:i=8,dt:r=17}=e,a=(s,o,l)=>{var c=-(s-o)*n,d=l*i,f=l+(c-d)*r/1e3,m=l*r/1e3+s;return Math.abs(m-o)<sS&&Math.abs(f)<sS?[o,0]:[m,f]};return a.isStepper=!0,a.dt=r,a},JPe=t=>{if(typeof t=="string")switch(t){case"ease":case"ease-in-out":case"ease-out":case"ease-in":case"linear":return dH(t);case"spring":return QPe();default:if(t.split("(")[0]==="cubic-bezier")return dH(t)}return typeof t=="function"?t:null};function eDe(t){var e,n=()=>null,i=!1,r=null,a=s=>{if(!i){if(Array.isArray(s)){if(!s.length)return;var o=s,[l,...c]=o;if(typeof l=="number"){r=t.setTimeout(a.bind(null,c),l);return}a(l),r=t.setTimeout(a.bind(null,c));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 tDe{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 nDe(){return eDe(new tDe)}var iDe=E.createContext(nDe);function rDe(t,e){var n=E.useContext(iDe);return E.useMemo(()=>e??n(t),[t,e,n])}var aDe=()=>!(typeof window<"u"&&window.document&&window.document.createElement&&window.setTimeout),_m={devToolsEnabled:!1,isSsr:aDe()},sDe={begin:0,duration:1e3,easing:"ease",isActive:!0,canBegin:!0,onAnimationEnd:()=>{},onAnimationStart:()=>{}},fH={t:0},wC={t:1};function qx(t){var e=Yi(t,sDe),{isActive:n,canBegin:i,duration:r,easing:a,begin:s,onAnimationEnd:o,onAnimationStart:l,children:c}=e,d=n==="auto"?!_m.isSsr:n,f=rDe(e.animationId,e.animationManager),[m,g]=E.useState(d?fH:wC),y=E.useRef(null);return E.useEffect(()=>{d||g(wC)},[d]),E.useEffect(()=>{if(!d||!i)return zx;var _=XPe(fH,wC,JPe(a),r,g,f.getTimeoutController()),v=()=>{y.current=_()};return f.start([l,s,v,r,o]),()=>{f.stop(),y.current&&y.current(),o()}},[d,i,r,a,s,l,o,f]),c(m.t)}function Xx(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"animation-",n=E.useRef(sx(e)),i=E.useRef(t);return i.current!==t&&(n.current=sx(e),i.current=t),n.current}var oDe=["radius"],lDe=["radius"];function hH(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 pH(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?hH(Object(n),!0).forEach(function(i){cDe(t,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):hH(Object(n)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(n,i))})}return t}function cDe(t,e,n){return(e=uDe(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function uDe(t){var e=dDe(t,"string");return typeof e=="symbol"?e:e+""}function dDe(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 oS(){return oS=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},oS.apply(null,arguments)}function mH(t,e){if(t==null)return{};var n,i,r=fDe(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 fDe(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 gH=(t,e,n,i,r)=>{var a=Math.min(Math.abs(n)/2,Math.abs(i)/2),s=i>=0?1:-1,o=n>=0?1:-1,l=i>=0&&n>=0||i<0&&n<0?1:0,c;if(a>0&&r instanceof Array){for(var d=[0,0,0,0],f=0,m=4;f<m;f++)d[f]=r[f]>a?a:r[f];c="M".concat(t,",").concat(e+s*d[0]),d[0]>0&&(c+="A ".concat(d[0],",").concat(d[0],",0,0,").concat(l,",").concat(t+o*d[0],",").concat(e)),c+="L ".concat(t+n-o*d[1],",").concat(e),d[1]>0&&(c+="A ".concat(d[1],",").concat(d[1],",0,0,").concat(l,`,
  8189. `).concat(t+n,",").concat(e+s*d[1])),c+="L ".concat(t+n,",").concat(e+i-s*d[2]),d[2]>0&&(c+="A ".concat(d[2],",").concat(d[2],",0,0,").concat(l,`,
  8190. `).concat(t+n-o*d[2],",").concat(e+i)),c+="L ".concat(t+o*d[3],",").concat(e+i),d[3]>0&&(c+="A ".concat(d[3],",").concat(d[3],",0,0,").concat(l,`,
  8191. `).concat(t,",").concat(e+i-s*d[3])),c+="Z"}else if(a>0&&r===+r&&r>0){var g=Math.min(a,r);c="M ".concat(t,",").concat(e+s*g,`
  8192. A `).concat(g,",").concat(g,",0,0,").concat(l,",").concat(t+o*g,",").concat(e,`
  8193. L `).concat(t+n-o*g,",").concat(e,`
  8194. A `).concat(g,",").concat(g,",0,0,").concat(l,",").concat(t+n,",").concat(e+s*g,`
  8195. L `).concat(t+n,",").concat(e+i-s*g,`
  8196. A `).concat(g,",").concat(g,",0,0,").concat(l,",").concat(t+n-o*g,",").concat(e+i,`
  8197. L `).concat(t+o*g,",").concat(e+i,`
  8198. A `).concat(g,",").concat(g,",0,0,").concat(l,",").concat(t,",").concat(e+i-s*g," Z")}else c="M ".concat(t,",").concat(e," h ").concat(n," v ").concat(i," h ").concat(-n," Z");return c},xH={x:0,y:0,width:0,height:0,radius:0,isAnimationActive:!1,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},ZK=t=>{var e=Yi(t,xH),n=E.useRef(null),[i,r]=E.useState(-1);E.useEffect(()=>{if(n.current&&n.current.getTotalLength)try{var $=n.current.getTotalLength();$&&r($)}catch{}},[]);var{x:a,y:s,width:o,height:l,radius:c,className:d}=e,{animationEasing:f,animationDuration:m,animationBegin:g,isAnimationActive:y,isUpdateAnimationActive:_}=e,v=E.useRef(o),x=E.useRef(l),M=E.useRef(a),w=E.useRef(s),T=E.useMemo(()=>({x:a,y:s,width:o,height:l,radius:c}),[a,s,o,l,c]),C=Xx(T,"rectangle-");if(a!==+a||s!==+s||o!==+o||l!==+l||o===0||l===0)return null;var P=En("recharts-rectangle",d);if(!_){var A=_a(e),{radius:U}=A,N=mH(A,oDe);return E.createElement("path",oS({},N,{radius:typeof c=="number"?c:void 0,className:P,d:gH(a,s,o,l,c)}))}var D=v.current,F=x.current,I=M.current,W=w.current,O="0px ".concat(i===-1?1:i,"px"),B="".concat(i,"px 0px"),H=qK(["strokeDasharray"],m,typeof f=="string"?f:xH.animationEasing);return E.createElement(qx,{animationId:C,key:C,canBegin:i>0,duration:m,easing:f,isActive:_,begin:g},$=>{var K=si(D,o,$),Z=si(F,l,$),se=si(I,a,$),V=si(W,s,$);n.current&&(v.current=K,x.current=Z,M.current=se,w.current=V);var X;y?$>0?X={transition:H,strokeDasharray:B}:X={strokeDasharray:O}:X={strokeDasharray:B};var ae=_a(e),{radius:ce}=ae,ge=mH(ae,lDe);return E.createElement("path",oS({},ge,{radius:typeof c=="number"?c:void 0,className:P,d:gH(se,V,K,Z,c),ref:n,style:pH(pH({},X),e.style)}))})};function vH(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 yH(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?vH(Object(n),!0).forEach(function(i){hDe(t,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):vH(Object(n)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(n,i))})}return t}function hDe(t,e,n){return(e=pDe(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function pDe(t){var e=mDe(t,"string");return typeof e=="symbol"?e:e+""}function mDe(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 lS=Math.PI/180,gDe=t=>t*180/Math.PI,Gi=(t,e,n,i)=>({x:t+Math.cos(-lS*i)*n,y:e+Math.sin(-lS*i)*n}),QK=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},xDe=(t,e)=>{var{x:n,y:i}=t,{x:r,y:a}=e;return Math.sqrt((n-r)**2+(i-a)**2)},vDe=(t,e)=>{var{x:n,y:i}=t,{cx:r,cy:a}=e,s=xDe({x:n,y:i},{x:r,y:a});if(s<=0)return{radius:s,angle:0};var o=(n-r)/s,l=Math.acos(o);return i>a&&(l=2*Math.PI-l),{radius:s,angle:gDe(l),angleInRadian:l}},yDe=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}},bDe=(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},_De=(t,e)=>{var{chartX:n,chartY:i}=t,{radius:r,angle:a}=vDe({x:n,y:i},e),{innerRadius:s,outerRadius:o}=e;if(r<s||r>o||r===0)return null;var{startAngle:l,endAngle:c}=yDe(e),d=a,f;if(l<=c){for(;d>c;)d-=360;for(;d<l;)d+=360;f=d>=l&&d<=c}else{for(;d>l;)d-=360;for(;d<c;)d+=360;f=d>=c&&d<=l}return f?yH(yH({},e),{},{radius:r,angle:bDe(d,e)}):null};function JK(t){var{cx:e,cy:n,radius:i,startAngle:r,endAngle:a}=t,s=Gi(e,n,i,r),o=Gi(e,n,i,a);return{points:[s,o],cx:e,cy:n,radius:i,startAngle:r,endAngle:a}}function LR(){return LR=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},LR.apply(null,arguments)}var SDe=(t,e)=>{var n=Er(e-t),i=Math.min(Math.abs(e-t),359.999);return n*i},qb=t=>{var{cx:e,cy:n,radius:i,angle:r,sign:a,isExternal:s,cornerRadius:o,cornerIsExternal:l}=t,c=o*(s?1:-1)+i,d=Math.asin(o/c)/lS,f=l?r:r+a*d,m=Gi(e,n,c,f),g=Gi(e,n,i,f),y=l?r-a*d:r,_=Gi(e,n,c*Math.cos(d*lS),y);return{center:m,circleTangency:g,lineTangency:_,theta:d}},eY=t=>{var{cx:e,cy:n,innerRadius:i,outerRadius:r,startAngle:a,endAngle:s}=t,o=SDe(a,s),l=a+o,c=Gi(e,n,r,a),d=Gi(e,n,r,l),f="M ".concat(c.x,",").concat(c.y,`
  8199. A `).concat(r,",").concat(r,`,0,
  8200. `).concat(+(Math.abs(o)>180),",").concat(+(a>l),`,
  8201. `).concat(d.x,",").concat(d.y,`
  8202. `);if(i>0){var m=Gi(e,n,i,a),g=Gi(e,n,i,l);f+="L ".concat(g.x,",").concat(g.y,`
  8203. A `).concat(i,",").concat(i,`,0,
  8204. `).concat(+(Math.abs(o)>180),",").concat(+(a<=l),`,
  8205. `).concat(m.x,",").concat(m.y," Z")}else f+="L ".concat(e,",").concat(n," Z");return f},wDe=t=>{var{cx:e,cy:n,innerRadius:i,outerRadius:r,cornerRadius:a,forceCornerRadius:s,cornerIsExternal:o,startAngle:l,endAngle:c}=t,d=Er(c-l),{circleTangency:f,lineTangency:m,theta:g}=qb({cx:e,cy:n,radius:r,angle:l,sign:d,cornerRadius:a,cornerIsExternal:o}),{circleTangency:y,lineTangency:_,theta:v}=qb({cx:e,cy:n,radius:r,angle:c,sign:-d,cornerRadius:a,cornerIsExternal:o}),x=o?Math.abs(l-c):Math.abs(l-c)-g-v;if(x<0)return s?"M ".concat(m.x,",").concat(m.y,`
  8206. a`).concat(a,",").concat(a,",0,0,1,").concat(a*2,`,0
  8207. a`).concat(a,",").concat(a,",0,0,1,").concat(-a*2,`,0
  8208. `):eY({cx:e,cy:n,innerRadius:i,outerRadius:r,startAngle:l,endAngle:c});var M="M ".concat(m.x,",").concat(m.y,`
  8209. A`).concat(a,",").concat(a,",0,0,").concat(+(d<0),",").concat(f.x,",").concat(f.y,`
  8210. A`).concat(r,",").concat(r,",0,").concat(+(x>180),",").concat(+(d<0),",").concat(y.x,",").concat(y.y,`
  8211. A`).concat(a,",").concat(a,",0,0,").concat(+(d<0),",").concat(_.x,",").concat(_.y,`
  8212. `);if(i>0){var{circleTangency:w,lineTangency:T,theta:C}=qb({cx:e,cy:n,radius:i,angle:l,sign:d,isExternal:!0,cornerRadius:a,cornerIsExternal:o}),{circleTangency:P,lineTangency:A,theta:U}=qb({cx:e,cy:n,radius:i,angle:c,sign:-d,isExternal:!0,cornerRadius:a,cornerIsExternal:o}),N=o?Math.abs(l-c):Math.abs(l-c)-C-U;if(N<0&&a===0)return"".concat(M,"L").concat(e,",").concat(n,"Z");M+="L".concat(A.x,",").concat(A.y,`
  8213. A`).concat(a,",").concat(a,",0,0,").concat(+(d<0),",").concat(P.x,",").concat(P.y,`
  8214. A`).concat(i,",").concat(i,",0,").concat(+(N>180),",").concat(+(d>0),",").concat(w.x,",").concat(w.y,`
  8215. A`).concat(a,",").concat(a,",0,0,").concat(+(d<0),",").concat(T.x,",").concat(T.y,"Z")}else M+="L".concat(e,",").concat(n,"Z");return M},MDe={cx:0,cy:0,innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,cornerRadius:0,forceCornerRadius:!1,cornerIsExternal:!1},tY=t=>{var e=Yi(t,MDe),{cx:n,cy:i,innerRadius:r,outerRadius:a,cornerRadius:s,forceCornerRadius:o,cornerIsExternal:l,startAngle:c,endAngle:d,className:f}=e;if(a<r||c===d)return null;var m=En("recharts-sector",f),g=a-r,y=ia(s,g,0,!0),_;return y>0&&Math.abs(c-d)<360?_=wDe({cx:n,cy:i,innerRadius:r,outerRadius:a,cornerRadius:Math.min(y,g/2),forceCornerRadius:o,cornerIsExternal:l,startAngle:c,endAngle:d}):_=eY({cx:n,cy:i,innerRadius:r,outerRadius:a,startAngle:c,endAngle:d}),E.createElement("path",LR({},_a(e),{className:m,d:_}))};function EDe(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(DX(e)){if(t==="centric"){var{cx:i,cy:r,innerRadius:a,outerRadius:s,angle:o}=e,l=Gi(i,r,a,o),c=Gi(i,r,s,o);return[{x:l.x,y:l.y},{x:c.x,y:c.y}]}return JK(e)}}var MC={},EC={},AC={},bH;function ADe(){return bH||(bH=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=$X();function n(i){return e.isSymbol(i)?NaN:Number(i)}t.toNumber=n})(AC)),AC}var _H;function TDe(){return _H||(_H=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=ADe();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})(EC)),EC}var SH;function CDe(){return SH||(SH=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=GX(),n=TDe();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 o=Math.max(Math.ceil((a-r)/(s||1)),0),l=new Array(o);for(let c=0;c<o;c++)l[c]=r,r+=s;return l}t.range=i})(MC)),MC}var TC,wH;function NDe(){return wH||(wH=1,TC=CDe().range),TC}var RDe=NDe();const nY=Ks(RDe);function Vu(t,e){return t==null||e==null?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function PDe(t,e){return t==null||e==null?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function vk(t){let e,n,i;t.length!==2?(e=Vu,n=(o,l)=>Vu(t(o),l),i=(o,l)=>t(o)-l):(e=t===Vu||t===PDe?t:DDe,n=t,i=t);function r(o,l,c=0,d=o.length){if(c<d){if(e(l,l)!==0)return d;do{const f=c+d>>>1;n(o[f],l)<0?c=f+1:d=f}while(c<d)}return c}function a(o,l,c=0,d=o.length){if(c<d){if(e(l,l)!==0)return d;do{const f=c+d>>>1;n(o[f],l)<=0?c=f+1:d=f}while(c<d)}return c}function s(o,l,c=0,d=o.length){const f=r(o,l,c,d-1);return f>c&&i(o[f-1],l)>-i(o[f],l)?f-1:f}return{left:r,center:s,right:a}}function DDe(){return 0}function iY(t){return t===null?NaN:+t}function*kDe(t,e){for(let n of t)n!=null&&(n=+n)>=n&&(yield n)}const ODe=vk(Vu),Kx=ODe.right;vk(iY).center;class MH extends Map{constructor(e,n=UDe){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(EH(this,e))}has(e){return super.has(EH(this,e))}set(e,n){return super.set(LDe(this,e),n)}delete(e){return super.delete(IDe(this,e))}}function EH({_intern:t,_key:e},n){const i=e(n);return t.has(i)?t.get(i):n}function LDe({_intern:t,_key:e},n){const i=e(n);return t.has(i)?t.get(i):(t.set(i,n),n)}function IDe({_intern:t,_key:e},n){const i=e(n);return t.has(i)&&(n=t.get(i),t.delete(i)),n}function UDe(t){return t!==null&&typeof t=="object"?t.valueOf():t}function jDe(t=Vu){if(t===Vu)return rY;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 rY(t,e){return(t==null||!(t>=t))-(e==null||!(e>=e))||(t<e?-1:t>e?1:0)}const FDe=Math.sqrt(50),zDe=Math.sqrt(10),BDe=Math.sqrt(2);function cS(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>=FDe?10:a>=zDe?5:a>=BDe?2:1;let o,l,c;return r<0?(c=Math.pow(10,-r)/s,o=Math.round(t*c),l=Math.round(e*c),o/c<t&&++o,l/c>e&&--l,c=-c):(c=Math.pow(10,r)*s,o=Math.round(t/c),l=Math.round(e/c),o*c<t&&++o,l*c>e&&--l),l<o&&.5<=n&&n<2?cS(t,e,n*2):[o,l,c]}function IR(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?cS(e,t,n):cS(t,e,n);if(!(a>=r))return[];const o=a-r+1,l=new Array(o);if(i)if(s<0)for(let c=0;c<o;++c)l[c]=(a-c)/-s;else for(let c=0;c<o;++c)l[c]=(a-c)*s;else if(s<0)for(let c=0;c<o;++c)l[c]=(r+c)/-s;else for(let c=0;c<o;++c)l[c]=(r+c)*s;return l}function UR(t,e,n){return e=+e,t=+t,n=+n,cS(t,e,n)[2]}function jR(t,e,n){e=+e,t=+t,n=+n;const i=e<t,r=i?UR(e,t,n):UR(t,e,n);return(i?-1:1)*(r<0?1/-r:r)}function AH(t,e){let n;for(const i of t)i!=null&&(n<i||n===void 0&&i>=i)&&(n=i);return n}function TH(t,e){let n;for(const i of t)i!=null&&(n>i||n===void 0&&i>=i)&&(n=i);return n}function aY(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?rY:jDe(r);i>n;){if(i-n>600){const l=i-n+1,c=e-n+1,d=Math.log(l),f=.5*Math.exp(2*d/3),m=.5*Math.sqrt(d*f*(l-f)/l)*(c-l/2<0?-1:1),g=Math.max(n,Math.floor(e-c*f/l+m)),y=Math.min(i,Math.floor(e+(l-c)*f/l+m));aY(t,e,g,y,r)}const a=t[e];let s=n,o=i;for(Gg(t,n,e),r(t[i],a)>0&&Gg(t,n,i);s<o;){for(Gg(t,s,o),++s,--o;r(t[s],a)<0;)++s;for(;r(t[o],a)>0;)--o}r(t[n],a)===0?Gg(t,n,o):(++o,Gg(t,o,i)),o<=e&&(n=o+1),e<=o&&(i=o-1)}return t}function Gg(t,e,n){const i=t[e];t[e]=t[n],t[n]=i}function HDe(t,e,n){if(t=Float64Array.from(kDe(t)),!(!(i=t.length)||isNaN(e=+e))){if(e<=0||i<2)return TH(t);if(e>=1)return AH(t);var i,r=(i-1)*e,a=Math.floor(r),s=AH(aY(t,a).subarray(0,a+1)),o=TH(t.subarray(a+1));return s+(o-s)*(r-a)}}function VDe(t,e,n=iY){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),o=+n(t[a+1],a+1,t);return s+(o-s)*(r-a)}}function $De(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 Ys(t,e){switch(arguments.length){case 0:break;case 1:this.range(t);break;default:this.range(e).domain(t);break}return this}function Tc(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 FR=Symbol("implicit");function yk(){var t=new MH,e=[],n=[],i=FR;function r(a){let s=t.get(a);if(s===void 0){if(i!==FR)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 MH;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 yk(e,n).unknown(i)},Ys.apply(r,arguments),r}function bk(){var t=yk().unknown(void 0),e=t.domain,n=t.range,i=0,r=1,a,s,o=!1,l=0,c=0,d=.5;delete t.unknown;function f(){var m=e().length,g=r<i,y=g?r:i,_=g?i:r;a=(_-y)/Math.max(1,m-l+c*2),o&&(a=Math.floor(a)),y+=(_-y-a*(m-l))*d,s=a*(1-l),o&&(y=Math.round(y),s=Math.round(s));var v=$De(m).map(function(x){return y+a*x});return n(g?v.reverse():v)}return t.domain=function(m){return arguments.length?(e(m),f()):e()},t.range=function(m){return arguments.length?([i,r]=m,i=+i,r=+r,f()):[i,r]},t.rangeRound=function(m){return[i,r]=m,i=+i,r=+r,o=!0,f()},t.bandwidth=function(){return s},t.step=function(){return a},t.round=function(m){return arguments.length?(o=!!m,f()):o},t.padding=function(m){return arguments.length?(l=Math.min(1,c=+m),f()):l},t.paddingInner=function(m){return arguments.length?(l=Math.min(1,m),f()):l},t.paddingOuter=function(m){return arguments.length?(c=+m,f()):c},t.align=function(m){return arguments.length?(d=Math.max(0,Math.min(1,m)),f()):d},t.copy=function(){return bk(e(),[i,r]).round(o).paddingInner(l).paddingOuter(c).align(d)},Ys.apply(f(),arguments)}function sY(t){var e=t.copy;return t.padding=t.paddingOuter,delete t.paddingInner,delete t.paddingOuter,t.copy=function(){return sY(e())},t}function GDe(){return sY(bk.apply(null,arguments).paddingInner(1))}function _k(t,e,n){t.prototype=e.prototype=n,n.constructor=t}function oY(t,e){var n=Object.create(t.prototype);for(var i in e)n[i]=e[i];return n}function Yx(){}var px=.7,uS=1/px,Op="\\s*([+-]?\\d+)\\s*",mx="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Ko="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",WDe=/^#([0-9a-f]{3,8})$/,qDe=new RegExp(`^rgb\\(${Op},${Op},${Op}\\)$`),XDe=new RegExp(`^rgb\\(${Ko},${Ko},${Ko}\\)$`),KDe=new RegExp(`^rgba\\(${Op},${Op},${Op},${mx}\\)$`),YDe=new RegExp(`^rgba\\(${Ko},${Ko},${Ko},${mx}\\)$`),ZDe=new RegExp(`^hsl\\(${mx},${Ko},${Ko}\\)$`),QDe=new RegExp(`^hsla\\(${mx},${Ko},${Ko},${mx}\\)$`),CH={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};_k(Yx,gx,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:NH,formatHex:NH,formatHex8:JDe,formatHsl:eke,formatRgb:RH,toString:RH});function NH(){return this.rgb().formatHex()}function JDe(){return this.rgb().formatHex8()}function eke(){return lY(this).formatHsl()}function RH(){return this.rgb().formatRgb()}function gx(t){var e,n;return t=(t+"").trim().toLowerCase(),(e=WDe.exec(t))?(n=e[1].length,e=parseInt(e[1],16),n===6?PH(e):n===3?new La(e>>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):n===8?Xb(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):n===4?Xb(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=qDe.exec(t))?new La(e[1],e[2],e[3],1):(e=XDe.exec(t))?new La(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=KDe.exec(t))?Xb(e[1],e[2],e[3],e[4]):(e=YDe.exec(t))?Xb(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=ZDe.exec(t))?OH(e[1],e[2]/100,e[3]/100,1):(e=QDe.exec(t))?OH(e[1],e[2]/100,e[3]/100,e[4]):CH.hasOwnProperty(t)?PH(CH[t]):t==="transparent"?new La(NaN,NaN,NaN,0):null}function PH(t){return new La(t>>16&255,t>>8&255,t&255,1)}function Xb(t,e,n,i){return i<=0&&(t=e=n=NaN),new La(t,e,n,i)}function tke(t){return t instanceof Yx||(t=gx(t)),t?(t=t.rgb(),new La(t.r,t.g,t.b,t.opacity)):new La}function zR(t,e,n,i){return arguments.length===1?tke(t):new La(t,e,n,i??1)}function La(t,e,n,i){this.r=+t,this.g=+e,this.b=+n,this.opacity=+i}_k(La,zR,oY(Yx,{brighter(t){return t=t==null?uS:Math.pow(uS,t),new La(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=t==null?px:Math.pow(px,t),new La(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new La(mf(this.r),mf(this.g),mf(this.b),dS(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:DH,formatHex:DH,formatHex8:nke,formatRgb:kH,toString:kH}));function DH(){return`#${tf(this.r)}${tf(this.g)}${tf(this.b)}`}function nke(){return`#${tf(this.r)}${tf(this.g)}${tf(this.b)}${tf((isNaN(this.opacity)?1:this.opacity)*255)}`}function kH(){const t=dS(this.opacity);return`${t===1?"rgb(":"rgba("}${mf(this.r)}, ${mf(this.g)}, ${mf(this.b)}${t===1?")":`, ${t})`}`}function dS(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function mf(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function tf(t){return t=mf(t),(t<16?"0":"")+t.toString(16)}function OH(t,e,n,i){return i<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new po(t,e,n,i)}function lY(t){if(t instanceof po)return new po(t.h,t.s,t.l,t.opacity);if(t instanceof Yx||(t=gx(t)),!t)return new po;if(t instanceof po)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,o=a-r,l=(a+r)/2;return o?(e===a?s=(n-i)/o+(n<i)*6:n===a?s=(i-e)/o+2:s=(e-n)/o+4,o/=l<.5?a+r:2-a-r,s*=60):o=l>0&&l<1?0:s,new po(s,o,l,t.opacity)}function ike(t,e,n,i){return arguments.length===1?lY(t):new po(t,e,n,i??1)}function po(t,e,n,i){this.h=+t,this.s=+e,this.l=+n,this.opacity=+i}_k(po,ike,oY(Yx,{brighter(t){return t=t==null?uS:Math.pow(uS,t),new po(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=t==null?px:Math.pow(px,t),new po(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 La(CC(t>=240?t-240:t+120,r,i),CC(t,r,i),CC(t<120?t+240:t-120,r,i),this.opacity)},clamp(){return new po(LH(this.h),Kb(this.s),Kb(this.l),dS(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=dS(this.opacity);return`${t===1?"hsl(":"hsla("}${LH(this.h)}, ${Kb(this.s)*100}%, ${Kb(this.l)*100}%${t===1?")":`, ${t})`}`}}));function LH(t){return t=(t||0)%360,t<0?t+360:t}function Kb(t){return Math.max(0,Math.min(1,t||0))}function CC(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 Sk=t=>()=>t;function rke(t,e){return function(n){return t+n*e}}function ake(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 ske(t){return(t=+t)==1?cY:function(e,n){return n-e?ake(e,n,t):Sk(isNaN(e)?n:e)}}function cY(t,e){var n=e-t;return n?rke(t,n):Sk(isNaN(t)?e:t)}const IH=(function t(e){var n=ske(e);function i(r,a){var s=n((r=zR(r)).r,(a=zR(a)).r),o=n(r.g,a.g),l=n(r.b,a.b),c=cY(r.opacity,a.opacity);return function(d){return r.r=s(d),r.g=o(d),r.b=l(d),r.opacity=c(d),r+""}}return i.gamma=t,i})(1);function oke(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 lke(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function cke(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]=Sm(t[s],e[s]);for(;s<n;++s)a[s]=e[s];return function(o){for(s=0;s<i;++s)a[s]=r[s](o);return a}}function uke(t,e){var n=new Date;return t=+t,e=+e,function(i){return n.setTime(t*(1-i)+e*i),n}}function fS(t,e){return t=+t,e=+e,function(n){return t*(1-n)+e*n}}function dke(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]=Sm(t[r],e[r]):i[r]=e[r];return function(a){for(r in n)i[r]=n[r](a);return i}}var BR=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,NC=new RegExp(BR.source,"g");function fke(t){return function(){return t}}function hke(t){return function(e){return t(e)+""}}function pke(t,e){var n=BR.lastIndex=NC.lastIndex=0,i,r,a,s=-1,o=[],l=[];for(t=t+"",e=e+"";(i=BR.exec(t))&&(r=NC.exec(e));)(a=r.index)>n&&(a=e.slice(n,a),o[s]?o[s]+=a:o[++s]=a),(i=i[0])===(r=r[0])?o[s]?o[s]+=r:o[++s]=r:(o[++s]=null,l.push({i:s,x:fS(i,r)})),n=NC.lastIndex;return n<e.length&&(a=e.slice(n),o[s]?o[s]+=a:o[++s]=a),o.length<2?l[0]?hke(l[0].x):fke(e):(e=l.length,function(c){for(var d=0,f;d<e;++d)o[(f=l[d]).i]=f.x(c);return o.join("")})}function Sm(t,e){var n=typeof e,i;return e==null||n==="boolean"?Sk(e):(n==="number"?fS:n==="string"?(i=gx(e))?(e=i,IH):pke:e instanceof gx?IH:e instanceof Date?uke:lke(e)?oke:Array.isArray(e)?cke:typeof e.valueOf!="function"&&typeof e.toString!="function"||isNaN(e)?dke:fS)(t,e)}function wk(t,e){return t=+t,e=+e,function(n){return Math.round(t*(1-n)+e*n)}}function mke(t,e){e===void 0&&(e=t,t=Sm);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 o=Math.max(0,Math.min(i-1,Math.floor(s*=i)));return a[o](s-o)}}function gke(t){return function(){return t}}function hS(t){return+t}var UH=[0,1];function pa(t){return t}function HR(t,e){return(e-=t=+t)?function(n){return(n-t)/e}:gke(isNaN(e)?NaN:.5)}function xke(t,e){var n;return t>e&&(n=t,t=e,e=n),function(i){return Math.max(t,Math.min(e,i))}}function vke(t,e,n){var i=t[0],r=t[1],a=e[0],s=e[1];return r<i?(i=HR(r,i),a=n(s,a)):(i=HR(i,r),a=n(a,s)),function(o){return a(i(o))}}function yke(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]=HR(t[s],t[s+1]),a[s]=n(e[s],e[s+1]);return function(o){var l=Kx(t,o,1,i)-1;return a[l](r[l](o))}}function Zx(t,e){return e.domain(t.domain()).range(t.range()).interpolate(t.interpolate()).clamp(t.clamp()).unknown(t.unknown())}function Iw(){var t=UH,e=UH,n=Sm,i,r,a,s=pa,o,l,c;function d(){var m=Math.min(t.length,e.length);return s!==pa&&(s=xke(t[0],t[m-1])),o=m>2?yke:vke,l=c=null,f}function f(m){return m==null||isNaN(m=+m)?a:(l||(l=o(t.map(i),e,n)))(i(s(m)))}return f.invert=function(m){return s(r((c||(c=o(e,t.map(i),fS)))(m)))},f.domain=function(m){return arguments.length?(t=Array.from(m,hS),d()):t.slice()},f.range=function(m){return arguments.length?(e=Array.from(m),d()):e.slice()},f.rangeRound=function(m){return e=Array.from(m),n=wk,d()},f.clamp=function(m){return arguments.length?(s=m?!0:pa,d()):s!==pa},f.interpolate=function(m){return arguments.length?(n=m,d()):n},f.unknown=function(m){return arguments.length?(a=m,f):a},function(m,g){return i=m,r=g,d()}}function Mk(){return Iw()(pa,pa)}function bke(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)}function pS(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 am(t){return t=pS(Math.abs(t)),t?t[1]:NaN}function _ke(t,e){return function(n,i){for(var r=n.length,a=[],s=0,o=t[0],l=0;r>0&&o>0&&(l+o+1>i&&(o=Math.max(1,i-l)),a.push(n.substring(r-=o,r+o)),!((l+=o+1)>i));)o=t[s=(s+1)%t.length];return a.reverse().join(e)}}function Ske(t){return function(e){return e.replace(/[0-9]/g,function(n){return t[+n]})}}var wke=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function xx(t){if(!(e=wke.exec(t)))throw new Error("invalid format: "+t);var e;return new Ek({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]})}xx.prototype=Ek.prototype;function Ek(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+""}Ek.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 Mke(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 uY;function Eke(t,e){var n=pS(t,e);if(!n)return t+"";var i=n[0],r=n[1],a=r-(uY=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")+pS(t,Math.max(0,e+a-1))[0]}function jH(t,e){var n=pS(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 FH={"%":(t,e)=>(t*100).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:bke,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)=>jH(t*100,e),r:jH,s:Eke,X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function zH(t){return t}var BH=Array.prototype.map,HH=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function Ake(t){var e=t.grouping===void 0||t.thousands===void 0?zH:_ke(BH.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?zH:Ske(BH.call(t.numerals,String)),s=t.percent===void 0?"%":t.percent+"",o=t.minus===void 0?"−":t.minus+"",l=t.nan===void 0?"NaN":t.nan+"";function c(f){f=xx(f);var m=f.fill,g=f.align,y=f.sign,_=f.symbol,v=f.zero,x=f.width,M=f.comma,w=f.precision,T=f.trim,C=f.type;C==="n"?(M=!0,C="g"):FH[C]||(w===void 0&&(w=12),T=!0,C="g"),(v||m==="0"&&g==="=")&&(v=!0,m="0",g="=");var P=_==="$"?n:_==="#"&&/[boxX]/.test(C)?"0"+C.toLowerCase():"",A=_==="$"?i:/[%p]/.test(C)?s:"",U=FH[C],N=/[defgprs%]/.test(C);w=w===void 0?6:/[gprs]/.test(C)?Math.max(1,Math.min(21,w)):Math.max(0,Math.min(20,w));function D(F){var I=P,W=A,O,B,H;if(C==="c")W=U(F)+W,F="";else{F=+F;var $=F<0||1/F<0;if(F=isNaN(F)?l:U(Math.abs(F),w),T&&(F=Mke(F)),$&&+F==0&&y!=="+"&&($=!1),I=($?y==="("?y:o:y==="-"||y==="("?"":y)+I,W=(C==="s"?HH[8+uY/3]:"")+W+($&&y==="("?")":""),N){for(O=-1,B=F.length;++O<B;)if(H=F.charCodeAt(O),48>H||H>57){W=(H===46?r+F.slice(O+1):F.slice(O))+W,F=F.slice(0,O);break}}}M&&!v&&(F=e(F,1/0));var K=I.length+F.length+W.length,Z=K<x?new Array(x-K+1).join(m):"";switch(M&&v&&(F=e(Z+F,Z.length?x-W.length:1/0),Z=""),g){case"<":F=I+F+W+Z;break;case"=":F=I+Z+F+W;break;case"^":F=Z.slice(0,K=Z.length>>1)+I+F+W+Z.slice(K);break;default:F=Z+I+F+W;break}return a(F)}return D.toString=function(){return f+""},D}function d(f,m){var g=c((f=xx(f),f.type="f",f)),y=Math.max(-8,Math.min(8,Math.floor(am(m)/3)))*3,_=Math.pow(10,-y),v=HH[8+y/3];return function(x){return g(_*x)+v}}return{format:c,formatPrefix:d}}var Yb,Ak,dY;Tke({thousands:",",grouping:[3],currency:["$",""]});function Tke(t){return Yb=Ake(t),Ak=Yb.format,dY=Yb.formatPrefix,Yb}function Cke(t){return Math.max(0,-am(Math.abs(t)))}function Nke(t,e){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(am(e)/3)))*3-am(Math.abs(t)))}function Rke(t,e){return t=Math.abs(t),e=Math.abs(e)-t,Math.max(0,am(e)-am(t))+1}function fY(t,e,n,i){var r=jR(t,e,n),a;switch(i=xx(i??",f"),i.type){case"s":{var s=Math.max(Math.abs(t),Math.abs(e));return i.precision==null&&!isNaN(a=Nke(r,s))&&(i.precision=a),dY(i,s)}case"":case"e":case"g":case"p":case"r":{i.precision==null&&!isNaN(a=Rke(r,Math.max(Math.abs(t),Math.abs(e))))&&(i.precision=a-(i.type==="e"));break}case"f":case"%":{i.precision==null&&!isNaN(a=Cke(r))&&(i.precision=a-(i.type==="%")*2);break}}return Ak(i)}function ld(t){var e=t.domain;return t.ticks=function(n){var i=e();return IR(i[0],i[i.length-1],n??10)},t.tickFormat=function(n,i){var r=e();return fY(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],o=i[a],l,c,d=10;for(o<s&&(c=s,s=o,o=c,c=r,r=a,a=c);d-- >0;){if(c=UR(s,o,n),c===l)return i[r]=s,i[a]=o,e(i);if(c>0)s=Math.floor(s/c)*c,o=Math.ceil(o/c)*c;else if(c<0)s=Math.ceil(s*c)/c,o=Math.floor(o*c)/c;else break;l=c}return t},t}function hY(){var t=Mk();return t.copy=function(){return Zx(t,hY())},Ys.apply(t,arguments),ld(t)}function pY(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,hS),n):t.slice()},n.unknown=function(i){return arguments.length?(e=i,n):e},n.copy=function(){return pY(t).unknown(e)},t=arguments.length?Array.from(t,hS):[0,1],ld(n)}function mY(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 VH(t){return Math.log(t)}function $H(t){return Math.exp(t)}function Pke(t){return-Math.log(-t)}function Dke(t){return-Math.exp(-t)}function kke(t){return isFinite(t)?+("1e"+t):t<0?0:t}function Oke(t){return t===10?kke:t===Math.E?Math.exp:e=>Math.pow(t,e)}function Lke(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 GH(t){return(e,n)=>-t(-e,n)}function Tk(t){const e=t(VH,$H),n=e.domain;let i=10,r,a;function s(){return r=Lke(i),a=Oke(i),n()[0]<0?(r=GH(r),a=GH(a),t(Pke,Dke)):t(VH,$H),e}return e.base=function(o){return arguments.length?(i=+o,s()):i},e.domain=function(o){return arguments.length?(n(o),s()):n()},e.ticks=o=>{const l=n();let c=l[0],d=l[l.length-1];const f=d<c;f&&([c,d]=[d,c]);let m=r(c),g=r(d),y,_;const v=o==null?10:+o;let x=[];if(!(i%1)&&g-m<v){if(m=Math.floor(m),g=Math.ceil(g),c>0){for(;m<=g;++m)for(y=1;y<i;++y)if(_=m<0?y/a(-m):y*a(m),!(_<c)){if(_>d)break;x.push(_)}}else for(;m<=g;++m)for(y=i-1;y>=1;--y)if(_=m>0?y/a(-m):y*a(m),!(_<c)){if(_>d)break;x.push(_)}x.length*2<v&&(x=IR(c,d,v))}else x=IR(m,g,Math.min(g-m,v)).map(a);return f?x.reverse():x},e.tickFormat=(o,l)=>{if(o==null&&(o=10),l==null&&(l=i===10?"s":","),typeof l!="function"&&(!(i%1)&&(l=xx(l)).precision==null&&(l.trim=!0),l=Ak(l)),o===1/0)return l;const c=Math.max(1,i*o/e.ticks().length);return d=>{let f=d/a(Math.round(r(d)));return f*i<i-.5&&(f*=i),f<=c?l(d):""}},e.nice=()=>n(mY(n(),{floor:o=>a(Math.floor(r(o))),ceil:o=>a(Math.ceil(r(o)))})),e}function gY(){const t=Tk(Iw()).domain([1,10]);return t.copy=()=>Zx(t,gY()).base(t.base()),Ys.apply(t,arguments),t}function WH(t){return function(e){return Math.sign(e)*Math.log1p(Math.abs(e/t))}}function qH(t){return function(e){return Math.sign(e)*Math.expm1(Math.abs(e))*t}}function Ck(t){var e=1,n=t(WH(e),qH(e));return n.constant=function(i){return arguments.length?t(WH(e=+i),qH(e)):e},ld(n)}function xY(){var t=Ck(Iw());return t.copy=function(){return Zx(t,xY()).constant(t.constant())},Ys.apply(t,arguments)}function XH(t){return function(e){return e<0?-Math.pow(-e,t):Math.pow(e,t)}}function Ike(t){return t<0?-Math.sqrt(-t):Math.sqrt(t)}function Uke(t){return t<0?-t*t:t*t}function Nk(t){var e=t(pa,pa),n=1;function i(){return n===1?t(pa,pa):n===.5?t(Ike,Uke):t(XH(n),XH(1/n))}return e.exponent=function(r){return arguments.length?(n=+r,i()):n},ld(e)}function Rk(){var t=Nk(Iw());return t.copy=function(){return Zx(t,Rk()).exponent(t.exponent())},Ys.apply(t,arguments),t}function jke(){return Rk.apply(null,arguments).exponent(.5)}function KH(t){return Math.sign(t)*t*t}function Fke(t){return Math.sign(t)*Math.sqrt(Math.abs(t))}function vY(){var t=Mk(),e=[0,1],n=!1,i;function r(a){var s=Fke(t(a));return isNaN(s)?i:n?Math.round(s):s}return r.invert=function(a){return t.invert(KH(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,hS)).map(KH)),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 vY(t.domain(),e).round(n).clamp(t.clamp()).unknown(i)},Ys.apply(r,arguments),ld(r)}function yY(){var t=[],e=[],n=[],i;function r(){var s=0,o=Math.max(1,e.length);for(n=new Array(o-1);++s<o;)n[s-1]=VDe(t,s/o);return a}function a(s){return s==null||isNaN(s=+s)?i:e[Kx(n,s)]}return a.invertExtent=function(s){var o=e.indexOf(s);return o<0?[NaN,NaN]:[o>0?n[o-1]:t[0],o<n.length?n[o]:t[t.length-1]]},a.domain=function(s){if(!arguments.length)return t.slice();t=[];for(let o of s)o!=null&&!isNaN(o=+o)&&t.push(o);return t.sort(Vu),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 yY().domain(t).range(e).unknown(i)},Ys.apply(a,arguments)}function bY(){var t=0,e=1,n=1,i=[.5],r=[0,1],a;function s(l){return l!=null&&l<=l?r[Kx(i,l,0,n)]:a}function o(){var l=-1;for(i=new Array(n);++l<n;)i[l]=((l+1)*e-(l-n)*t)/(n+1);return s}return s.domain=function(l){return arguments.length?([t,e]=l,t=+t,e=+e,o()):[t,e]},s.range=function(l){return arguments.length?(n=(r=Array.from(l)).length-1,o()):r.slice()},s.invertExtent=function(l){var c=r.indexOf(l);return c<0?[NaN,NaN]:c<1?[t,i[0]]:c>=n?[i[n-1],e]:[i[c-1],i[c]]},s.unknown=function(l){return arguments.length&&(a=l),s},s.thresholds=function(){return i.slice()},s.copy=function(){return bY().domain([t,e]).range(r).unknown(a)},Ys.apply(ld(s),arguments)}function _Y(){var t=[.5],e=[0,1],n,i=1;function r(a){return a!=null&&a<=a?e[Kx(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 _Y().domain(t).range(e).unknown(n)},Ys.apply(r,arguments)}const RC=new Date,PC=new Date;function ur(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),o=r.ceil(a);return a-s<o-a?s:o},r.offset=(a,s)=>(e(a=new Date(+a),s==null?1:Math.floor(s)),a),r.range=(a,s,o)=>{const l=[];if(a=r.ceil(a),o=o==null?1:Math.floor(o),!(a<s)||!(o>0))return l;let c;do l.push(c=new Date(+a)),e(a,o),t(a);while(c<a&&a<s);return l},r.filter=a=>ur(s=>{if(s>=s)for(;t(s),!a(s);)s.setTime(s-1)},(s,o)=>{if(s>=s)if(o<0)for(;++o<=0;)for(;e(s,-1),!a(s););else for(;--o>=0;)for(;e(s,1),!a(s););}),n&&(r.count=(a,s)=>(RC.setTime(+a),PC.setTime(+s),t(RC),t(PC),Math.floor(n(RC,PC))),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 mS=ur(()=>{},(t,e)=>{t.setTime(+t+e)},(t,e)=>e-t);mS.every=t=>(t=Math.floor(t),!isFinite(t)||!(t>0)?null:t>1?ur(e=>{e.setTime(Math.floor(e/t)*t)},(e,n)=>{e.setTime(+e+n*t)},(e,n)=>(n-e)/t):mS);mS.range;const Jl=1e3,Bs=Jl*60,ec=Bs*60,vc=ec*24,Pk=vc*7,YH=vc*30,DC=vc*365,nf=ur(t=>{t.setTime(t-t.getMilliseconds())},(t,e)=>{t.setTime(+t+e*Jl)},(t,e)=>(e-t)/Jl,t=>t.getUTCSeconds());nf.range;const Dk=ur(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*Jl)},(t,e)=>{t.setTime(+t+e*Bs)},(t,e)=>(e-t)/Bs,t=>t.getMinutes());Dk.range;const kk=ur(t=>{t.setUTCSeconds(0,0)},(t,e)=>{t.setTime(+t+e*Bs)},(t,e)=>(e-t)/Bs,t=>t.getUTCMinutes());kk.range;const Ok=ur(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*Jl-t.getMinutes()*Bs)},(t,e)=>{t.setTime(+t+e*ec)},(t,e)=>(e-t)/ec,t=>t.getHours());Ok.range;const Lk=ur(t=>{t.setUTCMinutes(0,0,0)},(t,e)=>{t.setTime(+t+e*ec)},(t,e)=>(e-t)/ec,t=>t.getUTCHours());Lk.range;const Qx=ur(t=>t.setHours(0,0,0,0),(t,e)=>t.setDate(t.getDate()+e),(t,e)=>(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*Bs)/vc,t=>t.getDate()-1);Qx.range;const Uw=ur(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/vc,t=>t.getUTCDate()-1);Uw.range;const SY=ur(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/vc,t=>Math.floor(t/vc));SY.range;function $f(t){return ur(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())*Bs)/Pk)}const jw=$f(0),gS=$f(1),zke=$f(2),Bke=$f(3),sm=$f(4),Hke=$f(5),Vke=$f(6);jw.range;gS.range;zke.range;Bke.range;sm.range;Hke.range;Vke.range;function Gf(t){return ur(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)/Pk)}const Fw=Gf(0),xS=Gf(1),$ke=Gf(2),Gke=Gf(3),om=Gf(4),Wke=Gf(5),qke=Gf(6);Fw.range;xS.range;$ke.range;Gke.range;om.range;Wke.range;qke.range;const Ik=ur(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());Ik.range;const Uk=ur(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());Uk.range;const yc=ur(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());yc.every=t=>!isFinite(t=Math.floor(t))||!(t>0)?null:ur(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)});yc.range;const bc=ur(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());bc.every=t=>!isFinite(t=Math.floor(t))||!(t>0)?null:ur(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)});bc.range;function wY(t,e,n,i,r,a){const s=[[nf,1,Jl],[nf,5,5*Jl],[nf,15,15*Jl],[nf,30,30*Jl],[a,1,Bs],[a,5,5*Bs],[a,15,15*Bs],[a,30,30*Bs],[r,1,ec],[r,3,3*ec],[r,6,6*ec],[r,12,12*ec],[i,1,vc],[i,2,2*vc],[n,1,Pk],[e,1,YH],[e,3,3*YH],[t,1,DC]];function o(c,d,f){const m=d<c;m&&([c,d]=[d,c]);const g=f&&typeof f.range=="function"?f:l(c,d,f),y=g?g.range(c,+d+1):[];return m?y.reverse():y}function l(c,d,f){const m=Math.abs(d-c)/f,g=vk(([,,v])=>v).right(s,m);if(g===s.length)return t.every(jR(c/DC,d/DC,f));if(g===0)return mS.every(Math.max(jR(c,d,f),1));const[y,_]=s[m/s[g-1][2]<s[g][2]/m?g-1:g];return y.every(_)}return[o,l]}const[Xke,Kke]=wY(bc,Uk,Fw,SY,Lk,kk),[Yke,Zke]=wY(yc,Ik,jw,Qx,Ok,Dk);function kC(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 OC(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 Wg(t,e,n){return{y:t,m:e,d:n,H:0,M:0,S:0,L:0}}function Qke(t){var e=t.dateTime,n=t.date,i=t.time,r=t.periods,a=t.days,s=t.shortDays,o=t.months,l=t.shortMonths,c=qg(r),d=Xg(r),f=qg(a),m=Xg(a),g=qg(s),y=Xg(s),_=qg(o),v=Xg(o),x=qg(l),M=Xg(l),w={a:$,A:K,b:Z,B:se,c:null,d:nV,e:nV,f:_Oe,g:POe,G:kOe,H:vOe,I:yOe,j:bOe,L:MY,m:SOe,M:wOe,p:V,q:X,Q:aV,s:sV,S:MOe,u:EOe,U:AOe,V:TOe,w:COe,W:NOe,x:null,X:null,y:ROe,Y:DOe,Z:OOe,"%":rV},T={a:ae,A:ce,b:ge,B:ne,c:null,d:iV,e:iV,f:jOe,g:XOe,G:YOe,H:LOe,I:IOe,j:UOe,L:AY,m:FOe,M:zOe,p:ve,q:Pe,Q:aV,s:sV,S:BOe,u:HOe,U:VOe,V:$Oe,w:GOe,W:WOe,x:null,X:null,y:qOe,Y:KOe,Z:ZOe,"%":rV},C={a:D,A:F,b:I,B:W,c:O,d:eV,e:eV,f:pOe,g:JH,G:QH,H:tV,I:tV,j:uOe,L:hOe,m:cOe,M:dOe,p:N,q:lOe,Q:gOe,s:xOe,S:fOe,u:iOe,U:rOe,V:aOe,w:nOe,W:sOe,x:B,X:H,y:JH,Y:QH,Z:oOe,"%":mOe};w.x=P(n,w),w.X=P(i,w),w.c=P(e,w),T.x=P(n,T),T.X=P(i,T),T.c=P(e,T);function P(he,we){return function(je){var ue=[],lt=-1,z=0,q=he.length,re,J,ee;for(je instanceof Date||(je=new Date(+je));++lt<q;)he.charCodeAt(lt)===37&&(ue.push(he.slice(z,lt)),(J=ZH[re=he.charAt(++lt)])!=null?re=he.charAt(++lt):J=re==="e"?" ":"0",(ee=we[re])&&(re=ee(je,J)),ue.push(re),z=lt+1);return ue.push(he.slice(z,lt)),ue.join("")}}function A(he,we){return function(je){var ue=Wg(1900,void 0,1),lt=U(ue,he,je+="",0),z,q;if(lt!=je.length)return null;if("Q"in ue)return new Date(ue.Q);if("s"in ue)return new Date(ue.s*1e3+("L"in ue?ue.L:0));if(we&&!("Z"in ue)&&(ue.Z=0),"p"in ue&&(ue.H=ue.H%12+ue.p*12),ue.m===void 0&&(ue.m="q"in ue?ue.q:0),"V"in ue){if(ue.V<1||ue.V>53)return null;"w"in ue||(ue.w=1),"Z"in ue?(z=OC(Wg(ue.y,0,1)),q=z.getUTCDay(),z=q>4||q===0?xS.ceil(z):xS(z),z=Uw.offset(z,(ue.V-1)*7),ue.y=z.getUTCFullYear(),ue.m=z.getUTCMonth(),ue.d=z.getUTCDate()+(ue.w+6)%7):(z=kC(Wg(ue.y,0,1)),q=z.getDay(),z=q>4||q===0?gS.ceil(z):gS(z),z=Qx.offset(z,(ue.V-1)*7),ue.y=z.getFullYear(),ue.m=z.getMonth(),ue.d=z.getDate()+(ue.w+6)%7)}else("W"in ue||"U"in ue)&&("w"in ue||(ue.w="u"in ue?ue.u%7:"W"in ue?1:0),q="Z"in ue?OC(Wg(ue.y,0,1)).getUTCDay():kC(Wg(ue.y,0,1)).getDay(),ue.m=0,ue.d="W"in ue?(ue.w+6)%7+ue.W*7-(q+5)%7:ue.w+ue.U*7-(q+6)%7);return"Z"in ue?(ue.H+=ue.Z/100|0,ue.M+=ue.Z%100,OC(ue)):kC(ue)}}function U(he,we,je,ue){for(var lt=0,z=we.length,q=je.length,re,J;lt<z;){if(ue>=q)return-1;if(re=we.charCodeAt(lt++),re===37){if(re=we.charAt(lt++),J=C[re in ZH?we.charAt(lt++):re],!J||(ue=J(he,je,ue))<0)return-1}else if(re!=je.charCodeAt(ue++))return-1}return ue}function N(he,we,je){var ue=c.exec(we.slice(je));return ue?(he.p=d.get(ue[0].toLowerCase()),je+ue[0].length):-1}function D(he,we,je){var ue=g.exec(we.slice(je));return ue?(he.w=y.get(ue[0].toLowerCase()),je+ue[0].length):-1}function F(he,we,je){var ue=f.exec(we.slice(je));return ue?(he.w=m.get(ue[0].toLowerCase()),je+ue[0].length):-1}function I(he,we,je){var ue=x.exec(we.slice(je));return ue?(he.m=M.get(ue[0].toLowerCase()),je+ue[0].length):-1}function W(he,we,je){var ue=_.exec(we.slice(je));return ue?(he.m=v.get(ue[0].toLowerCase()),je+ue[0].length):-1}function O(he,we,je){return U(he,e,we,je)}function B(he,we,je){return U(he,n,we,je)}function H(he,we,je){return U(he,i,we,je)}function $(he){return s[he.getDay()]}function K(he){return a[he.getDay()]}function Z(he){return l[he.getMonth()]}function se(he){return o[he.getMonth()]}function V(he){return r[+(he.getHours()>=12)]}function X(he){return 1+~~(he.getMonth()/3)}function ae(he){return s[he.getUTCDay()]}function ce(he){return a[he.getUTCDay()]}function ge(he){return l[he.getUTCMonth()]}function ne(he){return o[he.getUTCMonth()]}function ve(he){return r[+(he.getUTCHours()>=12)]}function Pe(he){return 1+~~(he.getUTCMonth()/3)}return{format:function(he){var we=P(he+="",w);return we.toString=function(){return he},we},parse:function(he){var we=A(he+="",!1);return we.toString=function(){return he},we},utcFormat:function(he){var we=P(he+="",T);return we.toString=function(){return he},we},utcParse:function(he){var we=A(he+="",!0);return we.toString=function(){return he},we}}}var ZH={"-":"",_:" ",0:"0"},Cr=/^\s*\d+/,Jke=/^%/,eOe=/[\\^$*+?|[\]().{}]/g;function An(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 tOe(t){return t.replace(eOe,"\\$&")}function qg(t){return new RegExp("^(?:"+t.map(tOe).join("|")+")","i")}function Xg(t){return new Map(t.map((e,n)=>[e.toLowerCase(),n]))}function nOe(t,e,n){var i=Cr.exec(e.slice(n,n+1));return i?(t.w=+i[0],n+i[0].length):-1}function iOe(t,e,n){var i=Cr.exec(e.slice(n,n+1));return i?(t.u=+i[0],n+i[0].length):-1}function rOe(t,e,n){var i=Cr.exec(e.slice(n,n+2));return i?(t.U=+i[0],n+i[0].length):-1}function aOe(t,e,n){var i=Cr.exec(e.slice(n,n+2));return i?(t.V=+i[0],n+i[0].length):-1}function sOe(t,e,n){var i=Cr.exec(e.slice(n,n+2));return i?(t.W=+i[0],n+i[0].length):-1}function QH(t,e,n){var i=Cr.exec(e.slice(n,n+4));return i?(t.y=+i[0],n+i[0].length):-1}function JH(t,e,n){var i=Cr.exec(e.slice(n,n+2));return i?(t.y=+i[0]+(+i[0]>68?1900:2e3),n+i[0].length):-1}function oOe(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 lOe(t,e,n){var i=Cr.exec(e.slice(n,n+1));return i?(t.q=i[0]*3-3,n+i[0].length):-1}function cOe(t,e,n){var i=Cr.exec(e.slice(n,n+2));return i?(t.m=i[0]-1,n+i[0].length):-1}function eV(t,e,n){var i=Cr.exec(e.slice(n,n+2));return i?(t.d=+i[0],n+i[0].length):-1}function uOe(t,e,n){var i=Cr.exec(e.slice(n,n+3));return i?(t.m=0,t.d=+i[0],n+i[0].length):-1}function tV(t,e,n){var i=Cr.exec(e.slice(n,n+2));return i?(t.H=+i[0],n+i[0].length):-1}function dOe(t,e,n){var i=Cr.exec(e.slice(n,n+2));return i?(t.M=+i[0],n+i[0].length):-1}function fOe(t,e,n){var i=Cr.exec(e.slice(n,n+2));return i?(t.S=+i[0],n+i[0].length):-1}function hOe(t,e,n){var i=Cr.exec(e.slice(n,n+3));return i?(t.L=+i[0],n+i[0].length):-1}function pOe(t,e,n){var i=Cr.exec(e.slice(n,n+6));return i?(t.L=Math.floor(i[0]/1e3),n+i[0].length):-1}function mOe(t,e,n){var i=Jke.exec(e.slice(n,n+1));return i?n+i[0].length:-1}function gOe(t,e,n){var i=Cr.exec(e.slice(n));return i?(t.Q=+i[0],n+i[0].length):-1}function xOe(t,e,n){var i=Cr.exec(e.slice(n));return i?(t.s=+i[0],n+i[0].length):-1}function nV(t,e){return An(t.getDate(),e,2)}function vOe(t,e){return An(t.getHours(),e,2)}function yOe(t,e){return An(t.getHours()%12||12,e,2)}function bOe(t,e){return An(1+Qx.count(yc(t),t),e,3)}function MY(t,e){return An(t.getMilliseconds(),e,3)}function _Oe(t,e){return MY(t,e)+"000"}function SOe(t,e){return An(t.getMonth()+1,e,2)}function wOe(t,e){return An(t.getMinutes(),e,2)}function MOe(t,e){return An(t.getSeconds(),e,2)}function EOe(t){var e=t.getDay();return e===0?7:e}function AOe(t,e){return An(jw.count(yc(t)-1,t),e,2)}function EY(t){var e=t.getDay();return e>=4||e===0?sm(t):sm.ceil(t)}function TOe(t,e){return t=EY(t),An(sm.count(yc(t),t)+(yc(t).getDay()===4),e,2)}function COe(t){return t.getDay()}function NOe(t,e){return An(gS.count(yc(t)-1,t),e,2)}function ROe(t,e){return An(t.getFullYear()%100,e,2)}function POe(t,e){return t=EY(t),An(t.getFullYear()%100,e,2)}function DOe(t,e){return An(t.getFullYear()%1e4,e,4)}function kOe(t,e){var n=t.getDay();return t=n>=4||n===0?sm(t):sm.ceil(t),An(t.getFullYear()%1e4,e,4)}function OOe(t){var e=t.getTimezoneOffset();return(e>0?"-":(e*=-1,"+"))+An(e/60|0,"0",2)+An(e%60,"0",2)}function iV(t,e){return An(t.getUTCDate(),e,2)}function LOe(t,e){return An(t.getUTCHours(),e,2)}function IOe(t,e){return An(t.getUTCHours()%12||12,e,2)}function UOe(t,e){return An(1+Uw.count(bc(t),t),e,3)}function AY(t,e){return An(t.getUTCMilliseconds(),e,3)}function jOe(t,e){return AY(t,e)+"000"}function FOe(t,e){return An(t.getUTCMonth()+1,e,2)}function zOe(t,e){return An(t.getUTCMinutes(),e,2)}function BOe(t,e){return An(t.getUTCSeconds(),e,2)}function HOe(t){var e=t.getUTCDay();return e===0?7:e}function VOe(t,e){return An(Fw.count(bc(t)-1,t),e,2)}function TY(t){var e=t.getUTCDay();return e>=4||e===0?om(t):om.ceil(t)}function $Oe(t,e){return t=TY(t),An(om.count(bc(t),t)+(bc(t).getUTCDay()===4),e,2)}function GOe(t){return t.getUTCDay()}function WOe(t,e){return An(xS.count(bc(t)-1,t),e,2)}function qOe(t,e){return An(t.getUTCFullYear()%100,e,2)}function XOe(t,e){return t=TY(t),An(t.getUTCFullYear()%100,e,2)}function KOe(t,e){return An(t.getUTCFullYear()%1e4,e,4)}function YOe(t,e){var n=t.getUTCDay();return t=n>=4||n===0?om(t):om.ceil(t),An(t.getUTCFullYear()%1e4,e,4)}function ZOe(){return"+0000"}function rV(){return"%"}function aV(t){return+t}function sV(t){return Math.floor(+t/1e3)}var op,CY,NY;QOe({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 QOe(t){return op=Qke(t),CY=op.format,op.parse,NY=op.utcFormat,op.utcParse,op}function JOe(t){return new Date(t)}function eLe(t){return t instanceof Date?+t:+new Date(+t)}function jk(t,e,n,i,r,a,s,o,l,c){var d=Mk(),f=d.invert,m=d.domain,g=c(".%L"),y=c(":%S"),_=c("%I:%M"),v=c("%I %p"),x=c("%a %d"),M=c("%b %d"),w=c("%B"),T=c("%Y");function C(P){return(l(P)<P?g:o(P)<P?y:s(P)<P?_:a(P)<P?v:i(P)<P?r(P)<P?x:M:n(P)<P?w:T)(P)}return d.invert=function(P){return new Date(f(P))},d.domain=function(P){return arguments.length?m(Array.from(P,eLe)):m().map(JOe)},d.ticks=function(P){var A=m();return t(A[0],A[A.length-1],P??10)},d.tickFormat=function(P,A){return A==null?C:c(A)},d.nice=function(P){var A=m();return(!P||typeof P.range!="function")&&(P=e(A[0],A[A.length-1],P??10)),P?m(mY(A,P)):d},d.copy=function(){return Zx(d,jk(t,e,n,i,r,a,s,o,l,c))},d}function tLe(){return Ys.apply(jk(Yke,Zke,yc,Ik,jw,Qx,Ok,Dk,nf,CY).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}function nLe(){return Ys.apply(jk(Xke,Kke,bc,Uk,Fw,Uw,Lk,kk,nf,NY).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)}function zw(){var t=0,e=1,n,i,r,a,s=pa,o=!1,l;function c(f){return f==null||isNaN(f=+f)?l:s(r===0?.5:(f=(a(f)-n)*r,o?Math.max(0,Math.min(1,f)):f))}c.domain=function(f){return arguments.length?([t,e]=f,n=a(t=+t),i=a(e=+e),r=n===i?0:1/(i-n),c):[t,e]},c.clamp=function(f){return arguments.length?(o=!!f,c):o},c.interpolator=function(f){return arguments.length?(s=f,c):s};function d(f){return function(m){var g,y;return arguments.length?([g,y]=m,s=f(g,y),c):[s(0),s(1)]}}return c.range=d(Sm),c.rangeRound=d(wk),c.unknown=function(f){return arguments.length?(l=f,c):l},function(f){return a=f,n=f(t),i=f(e),r=n===i?0:1/(i-n),c}}function cd(t,e){return e.domain(t.domain()).interpolator(t.interpolator()).clamp(t.clamp()).unknown(t.unknown())}function RY(){var t=ld(zw()(pa));return t.copy=function(){return cd(t,RY())},Tc.apply(t,arguments)}function PY(){var t=Tk(zw()).domain([1,10]);return t.copy=function(){return cd(t,PY()).base(t.base())},Tc.apply(t,arguments)}function DY(){var t=Ck(zw());return t.copy=function(){return cd(t,DY()).constant(t.constant())},Tc.apply(t,arguments)}function Fk(){var t=Nk(zw());return t.copy=function(){return cd(t,Fk()).exponent(t.exponent())},Tc.apply(t,arguments)}function iLe(){return Fk.apply(null,arguments).exponent(.5)}function kY(){var t=[],e=pa;function n(i){if(i!=null&&!isNaN(i=+i))return e((Kx(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(Vu),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)=>HDe(t,a/i))},n.copy=function(){return kY(e).domain(t)},Tc.apply(n,arguments)}function Bw(){var t=0,e=.5,n=1,i=1,r,a,s,o,l,c=pa,d,f=!1,m;function g(_){return isNaN(_=+_)?m:(_=.5+((_=+d(_))-a)*(i*_<i*a?o:l),c(f?Math.max(0,Math.min(1,_)):_))}g.domain=function(_){return arguments.length?([t,e,n]=_,r=d(t=+t),a=d(e=+e),s=d(n=+n),o=r===a?0:.5/(a-r),l=a===s?0:.5/(s-a),i=a<r?-1:1,g):[t,e,n]},g.clamp=function(_){return arguments.length?(f=!!_,g):f},g.interpolator=function(_){return arguments.length?(c=_,g):c};function y(_){return function(v){var x,M,w;return arguments.length?([x,M,w]=v,c=mke(_,[x,M,w]),g):[c(0),c(.5),c(1)]}}return g.range=y(Sm),g.rangeRound=y(wk),g.unknown=function(_){return arguments.length?(m=_,g):m},function(_){return d=_,r=_(t),a=_(e),s=_(n),o=r===a?0:.5/(a-r),l=a===s?0:.5/(s-a),i=a<r?-1:1,g}}function OY(){var t=ld(Bw()(pa));return t.copy=function(){return cd(t,OY())},Tc.apply(t,arguments)}function LY(){var t=Tk(Bw()).domain([.1,1,10]);return t.copy=function(){return cd(t,LY()).base(t.base())},Tc.apply(t,arguments)}function IY(){var t=Ck(Bw());return t.copy=function(){return cd(t,IY()).constant(t.constant())},Tc.apply(t,arguments)}function zk(){var t=Nk(Bw());return t.copy=function(){return cd(t,zk()).exponent(t.exponent())},Tc.apply(t,arguments)}function rLe(){return zk.apply(null,arguments).exponent(.5)}const a0=Object.freeze(Object.defineProperty({__proto__:null,scaleBand:bk,scaleDiverging:OY,scaleDivergingLog:LY,scaleDivergingPow:zk,scaleDivergingSqrt:rLe,scaleDivergingSymlog:IY,scaleIdentity:pY,scaleImplicit:FR,scaleLinear:hY,scaleLog:gY,scaleOrdinal:yk,scalePoint:GDe,scalePow:Rk,scaleQuantile:yY,scaleQuantize:bY,scaleRadial:vY,scaleSequential:RY,scaleSequentialLog:PY,scaleSequentialPow:Fk,scaleSequentialQuantile:kY,scaleSequentialSqrt:iLe,scaleSequentialSymlog:DY,scaleSqrt:jke,scaleSymlog:xY,scaleThreshold:_Y,scaleTime:tLe,scaleUtc:nLe,tickFormat:fY},Symbol.toStringTag,{value:"Module"}));var ud=t=>t.chartData,Bk=He([ud],t=>{var e=t.chartData!=null?t.chartData.length-1:0;return{chartData:t.chartData,computedData:t.computedData,dataEndIndex:e,dataStartIndex:0}}),Hw=(t,e,n,i)=>i?Bk(t):ud(t);function Zu(t){if(Array.isArray(t)&&t.length===2){var[e,n]=t;if(oi(e)&&oi(n))return!0}return!1}function oV(t,e,n){return n?t:[Math.min(t[0],e[0]),Math.max(t[1],e[1])]}function UY(t,e){if(e&&typeof t!="function"&&Array.isArray(t)&&t.length===2){var[n,i]=t,r,a;if(oi(n))r=n;else if(typeof n=="function")return;if(oi(i))a=i;else if(typeof i=="function")return;var s=[r,a];if(Zu(s))return s}}function aLe(t,e,n){if(!(!n&&e==null)){if(typeof t=="function"&&e!=null)try{var i=t(e,n);if(Zu(i))return oV(i,e,n)}catch{}if(Array.isArray(t)&&t.length===2){var[r,a]=t,s,o;if(r==="auto")e!=null&&(s=Math.min(...e));else if(Et(r))s=r;else if(typeof r=="function")try{e!=null&&(s=r(e?.[0]))}catch{}else if(typeof r=="string"&&L6.test(r)){var l=L6.exec(r);if(l==null||e==null)s=void 0;else{var c=+l[1];s=e[0]-c}}else s=e?.[0];if(a==="auto")e!=null&&(o=Math.max(...e));else if(Et(a))o=a;else if(typeof a=="function")try{e!=null&&(o=a(e?.[1]))}catch{}else if(typeof a=="string"&&I6.test(a)){var d=I6.exec(a);if(d==null||e==null)o=void 0;else{var f=+d[1];o=e[1]+f}}else o=e?.[1];var m=[s,o];if(Zu(m))return e==null?m:oV(m,e,n)}}}var wm=1e9,sLe={precision:20,rounding:4,toExpNeg:-7,toExpPos:21,LN10:"2.302585092994045684017991454684364207601101488628772976033327900967572609677352480235997205089598298341967784042286"},Vk,di=!0,Xs="[DecimalError] ",gf=Xs+"Invalid argument: ",Hk=Xs+"Exponent out of range: ",Mm=Math.floor,Hd=Math.pow,oLe=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,ss,Sr=1e7,ai=7,jY=9007199254740991,vS=Mm(jY/ai),Tt={};Tt.absoluteValue=Tt.abs=function(){var t=new this.constructor(this);return t.s&&(t.s=1),t};Tt.comparedTo=Tt.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};Tt.decimalPlaces=Tt.dp=function(){var t=this,e=t.d.length-1,n=(e-t.e)*ai;if(e=t.d[e],e)for(;e%10==0;e/=10)n--;return n<0?0:n};Tt.dividedBy=Tt.div=function(t){return oc(this,new this.constructor(t))};Tt.dividedToIntegerBy=Tt.idiv=function(t){var e=this,n=e.constructor;return Yn(oc(e,new n(t),0,1),n.precision)};Tt.equals=Tt.eq=function(t){return!this.cmp(t)};Tt.exponent=function(){return Xi(this)};Tt.greaterThan=Tt.gt=function(t){return this.cmp(t)>0};Tt.greaterThanOrEqualTo=Tt.gte=function(t){return this.cmp(t)>=0};Tt.isInteger=Tt.isint=function(){return this.e>this.d.length-2};Tt.isNegative=Tt.isneg=function(){return this.s<0};Tt.isPositive=Tt.ispos=function(){return this.s>0};Tt.isZero=function(){return this.s===0};Tt.lessThan=Tt.lt=function(t){return this.cmp(t)<0};Tt.lessThanOrEqualTo=Tt.lte=function(t){return this.cmp(t)<1};Tt.logarithm=Tt.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(ss))throw Error(Xs+"NaN");if(n.s<1)throw Error(Xs+(n.s?"NaN":"-Infinity"));return n.eq(ss)?new i(0):(di=!1,e=oc(vx(n,a),vx(t,a),a),di=!0,Yn(e,r))};Tt.minus=Tt.sub=function(t){var e=this;return t=new e.constructor(t),e.s==t.s?BY(e,t):FY(e,(t.s=-t.s,t))};Tt.modulo=Tt.mod=function(t){var e,n=this,i=n.constructor,r=i.precision;if(t=new i(t),!t.s)throw Error(Xs+"NaN");return n.s?(di=!1,e=oc(n,t,0,1).times(t),di=!0,n.minus(e)):Yn(new i(n),r)};Tt.naturalExponential=Tt.exp=function(){return zY(this)};Tt.naturalLogarithm=Tt.ln=function(){return vx(this)};Tt.negated=Tt.neg=function(){var t=new this.constructor(this);return t.s=-t.s||0,t};Tt.plus=Tt.add=function(t){var e=this;return t=new e.constructor(t),e.s==t.s?FY(e,t):BY(e,(t.s=-t.s,t))};Tt.precision=Tt.sd=function(t){var e,n,i,r=this;if(t!==void 0&&t!==!!t&&t!==1&&t!==0)throw Error(gf+t);if(e=Xi(r)+1,i=r.d.length-1,n=i*ai+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};Tt.squareRoot=Tt.sqrt=function(){var t,e,n,i,r,a,s,o=this,l=o.constructor;if(o.s<1){if(!o.s)return new l(0);throw Error(Xs+"NaN")}for(t=Xi(o),di=!1,r=Math.sqrt(+o),r==0||r==1/0?(e=Wo(o.d),(e.length+t)%2==0&&(e+="0"),r=Math.sqrt(e),t=Mm((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 l(e)):i=new l(r.toString()),n=l.precision,r=s=n+3;;)if(a=i,i=a.plus(oc(o,a,s+2)).times(.5),Wo(a.d).slice(0,s)===(e=Wo(i.d)).slice(0,s)){if(e=e.slice(s-3,s+1),r==s&&e=="4999"){if(Yn(a,n+1,0),a.times(a).eq(o)){i=a;break}}else if(e!="9999")break;s+=4}return di=!0,Yn(i,n)};Tt.times=Tt.mul=function(t){var e,n,i,r,a,s,o,l,c,d=this,f=d.constructor,m=d.d,g=(t=new f(t)).d;if(!d.s||!t.s)return new f(0);for(t.s*=d.s,n=d.e+t.e,l=m.length,c=g.length,l<c&&(a=m,m=g,g=a,s=l,l=c,c=s),a=[],s=l+c,i=s;i--;)a.push(0);for(i=c;--i>=0;){for(e=0,r=l+i;r>i;)o=a[r]+g[i]*m[r-i-1]+e,a[r--]=o%Sr|0,e=o/Sr|0;a[r]=(a[r]+e)%Sr|0}for(;!a[--s];)a.pop();return e?++n:a.shift(),t.d=a,t.e=n,di?Yn(t,f.precision):t};Tt.toDecimalPlaces=Tt.todp=function(t,e){var n=this,i=n.constructor;return n=new i(n),t===void 0?n:(rl(t,0,wm),e===void 0?e=i.rounding:rl(e,0,8),Yn(n,t+Xi(n)+1,e))};Tt.toExponential=function(t,e){var n,i=this,r=i.constructor;return t===void 0?n=Uf(i,!0):(rl(t,0,wm),e===void 0?e=r.rounding:rl(e,0,8),i=Yn(new r(i),t+1,e),n=Uf(i,!0,t+1)),n};Tt.toFixed=function(t,e){var n,i,r=this,a=r.constructor;return t===void 0?Uf(r):(rl(t,0,wm),e===void 0?e=a.rounding:rl(e,0,8),i=Yn(new a(r),t+Xi(r)+1,e),n=Uf(i.abs(),!1,t+Xi(i)+1),r.isneg()&&!r.isZero()?"-"+n:n)};Tt.toInteger=Tt.toint=function(){var t=this,e=t.constructor;return Yn(new e(t),Xi(t)+1,e.rounding)};Tt.toNumber=function(){return+this};Tt.toPower=Tt.pow=function(t){var e,n,i,r,a,s,o=this,l=o.constructor,c=12,d=+(t=new l(t));if(!t.s)return new l(ss);if(o=new l(o),!o.s){if(t.s<1)throw Error(Xs+"Infinity");return o}if(o.eq(ss))return o;if(i=l.precision,t.eq(ss))return Yn(o,i);if(e=t.e,n=t.d.length-1,s=e>=n,a=o.s,s){if((n=d<0?-d:d)<=jY){for(r=new l(ss),e=Math.ceil(i/ai+4),di=!1;n%2&&(r=r.times(o),cV(r.d,e)),n=Mm(n/2),n!==0;)o=o.times(o),cV(o.d,e);return di=!0,t.s<0?new l(ss).div(r):Yn(r,i)}}else if(a<0)throw Error(Xs+"NaN");return a=a<0&&t.d[Math.max(e,n)]&1?-1:1,o.s=1,di=!1,r=t.times(vx(o,i+c)),di=!0,r=zY(r),r.s=a,r};Tt.toPrecision=function(t,e){var n,i,r=this,a=r.constructor;return t===void 0?(n=Xi(r),i=Uf(r,n<=a.toExpNeg||n>=a.toExpPos)):(rl(t,1,wm),e===void 0?e=a.rounding:rl(e,0,8),r=Yn(new a(r),t,e),n=Xi(r),i=Uf(r,t<=n||n<=a.toExpNeg,t)),i};Tt.toSignificantDigits=Tt.tosd=function(t,e){var n=this,i=n.constructor;return t===void 0?(t=i.precision,e=i.rounding):(rl(t,1,wm),e===void 0?e=i.rounding:rl(e,0,8)),Yn(new i(n),t,e)};Tt.toString=Tt.valueOf=Tt.val=Tt.toJSON=Tt[Symbol.for("nodejs.util.inspect.custom")]=function(){var t=this,e=Xi(t),n=t.constructor;return Uf(t,e<=n.toExpNeg||e>=n.toExpPos)};function FY(t,e){var n,i,r,a,s,o,l,c,d=t.constructor,f=d.precision;if(!t.s||!e.s)return e.s||(e=new d(t)),di?Yn(e,f):e;if(l=t.d,c=e.d,s=t.e,r=e.e,l=l.slice(),a=s-r,a){for(a<0?(i=l,a=-a,o=c.length):(i=c,r=s,o=l.length),s=Math.ceil(f/ai),o=s>o?s+1:o+1,a>o&&(a=o,i.length=1),i.reverse();a--;)i.push(0);i.reverse()}for(o=l.length,a=c.length,o-a<0&&(a=o,i=c,c=l,l=i),n=0;a;)n=(l[--a]=l[a]+c[a]+n)/Sr|0,l[a]%=Sr;for(n&&(l.unshift(n),++r),o=l.length;l[--o]==0;)l.pop();return e.d=l,e.e=r,di?Yn(e,f):e}function rl(t,e,n){if(t!==~~t||t<e||t>n)throw Error(gf+t)}function Wo(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=ai-i.length,n&&(a+=_u(n)),a+=i;s=t[e],i=s+"",n=ai-i.length,n&&(a+=_u(n))}else if(s===0)return"0";for(;s%10===0;)s/=10;return a+s}var oc=(function(){function t(i,r){var a,s=0,o=i.length;for(i=i.slice();o--;)a=i[o]*r+s,i[o]=a%Sr|0,s=a/Sr|0;return s&&i.unshift(s),i}function e(i,r,a,s){var o,l;if(a!=s)l=a>s?1:-1;else for(o=l=0;o<a;o++)if(i[o]!=r[o]){l=i[o]>r[o]?1:-1;break}return l}function n(i,r,a){for(var s=0;a--;)i[a]-=s,s=i[a]<r[a]?1:0,i[a]=s*Sr+i[a]-r[a];for(;!i[0]&&i.length>1;)i.shift()}return function(i,r,a,s){var o,l,c,d,f,m,g,y,_,v,x,M,w,T,C,P,A,U,N=i.constructor,D=i.s==r.s?1:-1,F=i.d,I=r.d;if(!i.s)return new N(i);if(!r.s)throw Error(Xs+"Division by zero");for(l=i.e-r.e,A=I.length,C=F.length,g=new N(D),y=g.d=[],c=0;I[c]==(F[c]||0);)++c;if(I[c]>(F[c]||0)&&--l,a==null?M=a=N.precision:s?M=a+(Xi(i)-Xi(r))+1:M=a,M<0)return new N(0);if(M=M/ai+2|0,c=0,A==1)for(d=0,I=I[0],M++;(c<C||d)&&M--;c++)w=d*Sr+(F[c]||0),y[c]=w/I|0,d=w%I|0;else{for(d=Sr/(I[0]+1)|0,d>1&&(I=t(I,d),F=t(F,d),A=I.length,C=F.length),T=A,_=F.slice(0,A),v=_.length;v<A;)_[v++]=0;U=I.slice(),U.unshift(0),P=I[0],I[1]>=Sr/2&&++P;do d=0,o=e(I,_,A,v),o<0?(x=_[0],A!=v&&(x=x*Sr+(_[1]||0)),d=x/P|0,d>1?(d>=Sr&&(d=Sr-1),f=t(I,d),m=f.length,v=_.length,o=e(f,_,m,v),o==1&&(d--,n(f,A<m?U:I,m))):(d==0&&(o=d=1),f=I.slice()),m=f.length,m<v&&f.unshift(0),n(_,f,v),o==-1&&(v=_.length,o=e(I,_,A,v),o<1&&(d++,n(_,A<v?U:I,v))),v=_.length):o===0&&(d++,_=[0]),y[c++]=d,o&&_[0]?_[v++]=F[T]||0:(_=[F[T]],v=1);while((T++<C||_[0]!==void 0)&&M--)}return y[0]||y.shift(),g.e=l,Yn(g,s?a+Xi(g)+1:a)}})();function zY(t,e){var n,i,r,a,s,o,l=0,c=0,d=t.constructor,f=d.precision;if(Xi(t)>16)throw Error(Hk+Xi(t));if(!t.s)return new d(ss);for(di=!1,o=f,s=new d(.03125);t.abs().gte(.1);)t=t.times(s),c+=5;for(i=Math.log(Hd(2,c))/Math.LN10*2+5|0,o+=i,n=r=a=new d(ss),d.precision=o;;){if(r=Yn(r.times(t),o),n=n.times(++l),s=a.plus(oc(r,n,o)),Wo(s.d).slice(0,o)===Wo(a.d).slice(0,o)){for(;c--;)a=Yn(a.times(a),o);return d.precision=f,e==null?(di=!0,Yn(a,f)):a}a=s}}function Xi(t){for(var e=t.e*ai,n=t.d[0];n>=10;n/=10)e++;return e}function LC(t,e,n){if(e>t.LN10.sd())throw di=!0,n&&(t.precision=n),Error(Xs+"LN10 precision limit exceeded");return Yn(new t(t.LN10),e)}function _u(t){for(var e="";t--;)e+="0";return e}function vx(t,e){var n,i,r,a,s,o,l,c,d,f=1,m=10,g=t,y=g.d,_=g.constructor,v=_.precision;if(g.s<1)throw Error(Xs+(g.s?"NaN":"-Infinity"));if(g.eq(ss))return new _(0);if(e==null?(di=!1,c=v):c=e,g.eq(10))return e==null&&(di=!0),LC(_,c);if(c+=m,_.precision=c,n=Wo(y),i=n.charAt(0),a=Xi(g),Math.abs(a)<15e14){for(;i<7&&i!=1||i==1&&n.charAt(1)>3;)g=g.times(t),n=Wo(g.d),i=n.charAt(0),f++;a=Xi(g),i>1?(g=new _("0."+n),a++):g=new _(i+"."+n.slice(1))}else return l=LC(_,c+2,v).times(a+""),g=vx(new _(i+"."+n.slice(1)),c-m).plus(l),_.precision=v,e==null?(di=!0,Yn(g,v)):g;for(o=s=g=oc(g.minus(ss),g.plus(ss),c),d=Yn(g.times(g),c),r=3;;){if(s=Yn(s.times(d),c),l=o.plus(oc(s,new _(r),c)),Wo(l.d).slice(0,c)===Wo(o.d).slice(0,c))return o=o.times(2),a!==0&&(o=o.plus(LC(_,c+2,v).times(a+""))),o=oc(o,new _(f),c),_.precision=v,e==null?(di=!0,Yn(o,v)):o;o=l,r+=2}}function lV(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=Mm(n/ai),t.d=[],i=(n+1)%ai,n<0&&(i+=ai),i<r){for(i&&t.d.push(+e.slice(0,i)),r-=ai;i<r;)t.d.push(+e.slice(i,i+=ai));e=e.slice(i),i=ai-e.length}else i-=r;for(;i--;)e+="0";if(t.d.push(+e),di&&(t.e>vS||t.e<-vS))throw Error(Hk+n)}else t.s=0,t.e=0,t.d=[0];return t}function Yn(t,e,n){var i,r,a,s,o,l,c,d,f=t.d;for(s=1,a=f[0];a>=10;a/=10)s++;if(i=e-s,i<0)i+=ai,r=e,c=f[d=0];else{if(d=Math.ceil((i+1)/ai),a=f.length,d>=a)return t;for(c=a=f[d],s=1;a>=10;a/=10)s++;i%=ai,r=i-ai+s}if(n!==void 0&&(a=Hd(10,s-r-1),o=c/a%10|0,l=e<0||f[d+1]!==void 0||c%a,l=n<4?(o||l)&&(n==0||n==(t.s<0?3:2)):o>5||o==5&&(n==4||l||n==6&&(i>0?r>0?c/Hd(10,s-r):0:f[d-1])%10&1||n==(t.s<0?8:7))),e<1||!f[0])return l?(a=Xi(t),f.length=1,e=e-a-1,f[0]=Hd(10,(ai-e%ai)%ai),t.e=Mm(-e/ai)||0):(f.length=1,f[0]=t.e=t.s=0),t;if(i==0?(f.length=d,a=1,d--):(f.length=d+1,a=Hd(10,ai-i),f[d]=r>0?(c/Hd(10,s-r)%Hd(10,r)|0)*a:0),l)for(;;)if(d==0){(f[0]+=a)==Sr&&(f[0]=1,++t.e);break}else{if(f[d]+=a,f[d]!=Sr)break;f[d--]=0,a=1}for(i=f.length;f[--i]===0;)f.pop();if(di&&(t.e>vS||t.e<-vS))throw Error(Hk+Xi(t));return t}function BY(t,e){var n,i,r,a,s,o,l,c,d,f,m=t.constructor,g=m.precision;if(!t.s||!e.s)return e.s?e.s=-e.s:e=new m(t),di?Yn(e,g):e;if(l=t.d,f=e.d,i=e.e,c=t.e,l=l.slice(),s=c-i,s){for(d=s<0,d?(n=l,s=-s,o=f.length):(n=f,i=c,o=l.length),r=Math.max(Math.ceil(g/ai),o)+2,s>r&&(s=r,n.length=1),n.reverse(),r=s;r--;)n.push(0);n.reverse()}else{for(r=l.length,o=f.length,d=r<o,d&&(o=r),r=0;r<o;r++)if(l[r]!=f[r]){d=l[r]<f[r];break}s=0}for(d&&(n=l,l=f,f=n,e.s=-e.s),o=l.length,r=f.length-o;r>0;--r)l[o++]=0;for(r=f.length;r>s;){if(l[--r]<f[r]){for(a=r;a&&l[--a]===0;)l[a]=Sr-1;--l[a],l[r]+=Sr}l[r]-=f[r]}for(;l[--o]===0;)l.pop();for(;l[0]===0;l.shift())--i;return l[0]?(e.d=l,e.e=i,di?Yn(e,g):e):new m(0)}function Uf(t,e,n){var i,r=Xi(t),a=Wo(t.d),s=a.length;return e?(n&&(i=n-s)>0?a=a.charAt(0)+"."+a.slice(1)+_u(i):s>1&&(a=a.charAt(0)+"."+a.slice(1)),a=a+(r<0?"e":"e+")+r):r<0?(a="0."+_u(-r-1)+a,n&&(i=n-s)>0&&(a+=_u(i))):r>=s?(a+=_u(r+1-s),n&&(i=n-r-1)>0&&(a=a+"."+_u(i))):((i=r+1)<s&&(a=a.slice(0,i)+"."+a.slice(i)),n&&(i=n-s)>0&&(r+1===s&&(a+="."),a+=_u(i))),t.s<0?"-"+a:a}function cV(t,e){if(t.length>e)return t.length=e,!0}function HY(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(gf+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 lV(s,a.toString())}else if(typeof a!="string")throw Error(gf+a);if(a.charCodeAt(0)===45?(a=a.slice(1),s.s=-1):s.s=1,oLe.test(a))lV(s,a);else throw Error(gf+a)}if(r.prototype=Tt,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=HY,r.config=r.set=lLe,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 lLe(t){if(!t||typeof t!="object")throw Error(Xs+"Object expected");var e,n,i,r=["precision",1,wm,"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(Mm(i)===i&&i>=r[e+1]&&i<=r[e+2])this[n]=i;else throw Error(gf+n+": "+i);if((i=t[n="LN10"])!==void 0)if(i==Math.LN10)this[n]=new this(i);else throw Error(gf+n+": "+i);return this}var Vk=HY(sLe);ss=new Vk(1);const Ln=Vk;var cLe=t=>t,VY={},$Y=t=>t===VY,uV=t=>function e(){return arguments.length===0||arguments.length===1&&$Y(arguments.length<=0?void 0:arguments[0])?e:t(...arguments)},GY=(t,e)=>t===1?e:uV(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!==VY).length;return a>=t?e(...i):GY(t-a,uV(function(){for(var s=arguments.length,o=new Array(s),l=0;l<s;l++)o[l]=arguments[l];var c=i.map(d=>$Y(d)?o.shift():d);return e(...c,...o)}))}),uLe=t=>GY(t.length,t),VR=(t,e)=>{for(var n=[],i=t;i<e;++i)n[i-t]=i;return n},dLe=uLe((t,e)=>Array.isArray(e)?e.map(t):Object.keys(e).map(n=>e[n]).map(t)),fLe=function(){for(var e=arguments.length,n=new Array(e),i=0;i<e;i++)n[i]=arguments[i];if(!n.length)return cLe;var r=n.reverse(),a=r[0],s=r.slice(1);return function(){return s.reduce((o,l)=>l(o),a(...arguments))}},$R=t=>Array.isArray(t)?t.reverse():t.split("").reverse().join("");function WY(t){var e;return t===0?e=1:e=Math.floor(new Ln(t).abs().log(10).toNumber())+1,e}function qY(t,e,n){for(var i=new Ln(t),r=0,a=[];i.lt(e)&&r<1e5;)a.push(i.toNumber()),i=i.add(n),r++;return a}var XY=t=>{var[e,n]=t,[i,r]=[e,n];return e>n&&([i,r]=[n,e]),[i,r]},KY=(t,e,n)=>{if(t.lte(0))return new Ln(0);var i=WY(t.toNumber()),r=new Ln(10).pow(i),a=t.div(r),s=i!==1?.05:.1,o=new Ln(Math.ceil(a.div(s).toNumber())).add(n).mul(s),l=o.mul(r);return e?new Ln(l.toNumber()):new Ln(Math.ceil(l.toNumber()))},hLe=(t,e,n)=>{var i=new Ln(1),r=new Ln(t);if(!r.isint()&&n){var a=Math.abs(t);a<1?(i=new Ln(10).pow(WY(t)-1),r=new Ln(Math.floor(r.div(i).toNumber())).mul(i)):a>1&&(r=new Ln(Math.floor(t)))}else t===0?r=new Ln(Math.floor((e-1)/2)):n||(r=new Ln(Math.floor(t)));var s=Math.floor((e-1)/2),o=fLe(dLe(l=>r.add(new Ln(l-s).mul(i)).toNumber()),VR);return o(0,e)},YY=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 Ln(0),tickMin:new Ln(0),tickMax:new Ln(0)};var s=KY(new Ln(n).sub(e).div(i-1),r,a),o;e<=0&&n>=0?o=new Ln(0):(o=new Ln(e).add(n).div(2),o=o.sub(new Ln(o).mod(s)));var l=Math.ceil(o.sub(e).div(s).toNumber()),c=Math.ceil(new Ln(n).sub(o).div(s).toNumber()),d=l+c+1;return d>i?YY(e,n,i,r,a+1):(d<i&&(c=n>0?c+(i-d):c,l=n>0?l:l+(i-d)),{step:s,tickMin:o.sub(new Ln(l).mul(s)),tickMax:o.add(new Ln(c).mul(s))})},pLe=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),[o,l]=XY([n,i]);if(o===-1/0||l===1/0){var c=l===1/0?[o,...VR(0,r-1).map(()=>1/0)]:[...VR(0,r-1).map(()=>-1/0),l];return n>i?$R(c):c}if(o===l)return hLe(o,r,a);var{step:d,tickMin:f,tickMax:m}=YY(o,l,s,a,0),g=qY(f,m.add(new Ln(.1).mul(d)),d);return n>i?$R(g):g},mLe=function(e,n){var[i,r]=e,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,[s,o]=XY([i,r]);if(s===-1/0||o===1/0)return[i,r];if(s===o)return[s];var l=Math.max(n,2),c=KY(new Ln(o).sub(s).div(l-1),a,0),d=[...qY(new Ln(s),new Ln(o),c),o];return a===!1&&(d=d.map(f=>Math.round(f))),i>r?$R(d):d},ZY=t=>t.rootProps.maxBarSize,gLe=t=>t.rootProps.barGap,QY=t=>t.rootProps.barCategoryGap,xLe=t=>t.rootProps.barSize,Jx=t=>t.rootProps.stackOffset,JY=t=>t.rootProps.reverseStackOrder,$k=t=>t.options.chartName,Gk=t=>t.rootProps.syncId,eZ=t=>t.rootProps.syncMethod,Wk=t=>t.options.eventEmitter,vLe=t=>t.rootProps.baseValue,Wi={grid:-100,barBackground:-50,area:100,cursorRectangle:200,bar:300,line:400,axis:500,scatter:600,activeBar:1e3,cursorLine:1100,activeDot:1200,label:2e3},Wl={allowDuplicatedCategory:!0,angleAxisId:0,reversed:!1,scale:"auto",tick:!0,type:"category"},is={allowDataOverflow:!1,allowDuplicatedCategory:!0,radiusAxisId:0,scale:"auto",tick:!0,tickCount:5,type:"number"},Vw=(t,e)=>{if(!(!t||!e))return t!=null&&t.reversed?[e[1],e[0]]:e},yLe={allowDataOverflow:!1,allowDecimals:!1,allowDuplicatedCategory:!1,dataKey:void 0,domain:void 0,id:Wl.angleAxisId,includeHidden:!1,name:void 0,reversed:Wl.reversed,scale:Wl.scale,tick:Wl.tick,tickCount:void 0,ticks:void 0,type:Wl.type,unit:void 0},bLe={allowDataOverflow:is.allowDataOverflow,allowDecimals:!1,allowDuplicatedCategory:is.allowDuplicatedCategory,dataKey:void 0,domain:void 0,id:is.radiusAxisId,includeHidden:!1,name:void 0,reversed:!1,scale:is.scale,tick:is.tick,tickCount:is.tickCount,ticks:void 0,type:is.type,unit:void 0},_Le={allowDataOverflow:!1,allowDecimals:!1,allowDuplicatedCategory:Wl.allowDuplicatedCategory,dataKey:void 0,domain:void 0,id:Wl.angleAxisId,includeHidden:!1,name:void 0,reversed:!1,scale:Wl.scale,tick:Wl.tick,tickCount:void 0,ticks:void 0,type:"number",unit:void 0},SLe={allowDataOverflow:is.allowDataOverflow,allowDecimals:!1,allowDuplicatedCategory:is.allowDuplicatedCategory,dataKey:void 0,domain:void 0,id:is.radiusAxisId,includeHidden:!1,name:void 0,reversed:!1,scale:is.scale,tick:is.tick,tickCount:is.tickCount,ticks:void 0,type:"category",unit:void 0},qk=(t,e)=>t.polarAxis.angleAxis[e]!=null?t.polarAxis.angleAxis[e]:t.layout.layoutType==="radial"?_Le:yLe,Xk=(t,e)=>t.polarAxis.radiusAxis[e]!=null?t.polarAxis.radiusAxis[e]:t.layout.layoutType==="radial"?SLe:bLe,$w=t=>t.polarOptions,Kk=He([Ec,Ac,cr],QK),tZ=He([$w,Kk],(t,e)=>{if(t!=null)return ia(t.innerRadius,e,0)}),nZ=He([$w,Kk],(t,e)=>{if(t!=null)return ia(t.outerRadius,e,e*.8)}),wLe=t=>{if(t==null)return[0,0];var{startAngle:e,endAngle:n}=t;return[e,n]},iZ=He([$w],wLe);He([qk,iZ],Vw);var rZ=He([Kk,tZ,nZ],(t,e,n)=>{if(!(t==null||e==null||n==null))return[e,n]});He([Xk,rZ],Vw);var aZ=He([_n,$w,tZ,nZ,Ec,Ac],(t,e,n,i,r,a)=>{if(!(t!=="centric"&&t!=="radial"||e==null||n==null||i==null)){var{cx:s,cy:o,startAngle:l,endAngle:c}=e;return{cx:ia(s,r,r/2),cy:ia(o,a,a/2),innerRadius:n,outerRadius:i,startAngle:l,endAngle:c,clockWise:!1}}}),fi=(t,e)=>e,ev=(t,e,n)=>n;function Gw(t){return t?.id}function sZ(t,e,n){var{chartData:i=[]}=e,{allowDuplicatedCategory:r,dataKey:a}=n,s=new Map;return t.forEach(o=>{var l,c=(l=o.data)!==null&&l!==void 0?l:i;if(!(c==null||c.length===0)){var d=Gw(o);c.forEach((f,m)=>{var g=a==null||r?m:String(Kn(f,a,null)),y=Kn(f,o.dataKey,0),_;s.has(g)?_=s.get(g):_={},Object.assign(_,{[d]:y}),s.set(g,_)})}}),Array.from(s.values())}function Ww(t){return t.stackId!=null&&t.dataKey!=null}var qw=(t,e)=>t===e?!0:t==null||e==null?!1:t[0]===e[0]&&t[1]===e[1];function Xw(t,e){return Array.isArray(t)&&Array.isArray(e)&&t.length===0&&e.length===0?!0:t===e}function MLe(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 dr=t=>{var e=_n(t);return e==="horizontal"?"xAxis":e==="vertical"?"yAxis":e==="centric"?"angleAxis":"radiusAxis"},Em=t=>t.tooltip.settings.axisId;function dV(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 yS(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?dV(Object(n),!0).forEach(function(i){ELe(t,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):dV(Object(n)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(n,i))})}return t}function ELe(t,e,n){return(e=ALe(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function ALe(t){var e=TLe(t,"string");return typeof e=="symbol"?e:e+""}function TLe(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 GR=[0,"auto"],br={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},oZ=(t,e)=>t.cartesianAxis.xAxis[e],Cc=(t,e)=>{var n=oZ(t,e);return n??br},_r={allowDataOverflow:!1,allowDecimals:!0,allowDuplicatedCategory:!0,angle:0,dataKey:void 0,domain:GR,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:Gx},lZ=(t,e)=>t.cartesianAxis.yAxis[e],Nc=(t,e)=>{var n=lZ(t,e);return n??_r},CLe={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:""},Yk=(t,e)=>{var n=t.cartesianAxis.zAxis[e];return n??CLe},vi=(t,e,n)=>{switch(e){case"xAxis":return Cc(t,n);case"yAxis":return Nc(t,n);case"zAxis":return Yk(t,n);case"angleAxis":return qk(t,n);case"radiusAxis":return Xk(t,n);default:throw new Error("Unexpected axis type: ".concat(e))}},NLe=(t,e,n)=>{switch(e){case"xAxis":return Cc(t,n);case"yAxis":return Nc(t,n);default:throw new Error("Unexpected axis type: ".concat(e))}},tv=(t,e,n)=>{switch(e){case"xAxis":return Cc(t,n);case"yAxis":return Nc(t,n);case"angleAxis":return qk(t,n);case"radiusAxis":return Xk(t,n);default:throw new Error("Unexpected axis type: ".concat(e))}},cZ=t=>t.graphicalItems.cartesianItems.some(e=>e.type==="bar")||t.graphicalItems.polarItems.some(e=>e.type==="radialBar");function Zk(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 Kw=t=>t.graphicalItems.cartesianItems,RLe=He([fi,ev],Zk),Qk=(t,e,n)=>t.filter(n).filter(i=>e?.includeHidden===!0?!0:!i.hide),nv=He([Kw,vi,RLe],Qk,{memoizeOptions:{resultEqualityCheck:Xw}}),uZ=He([nv],t=>t.filter(e=>e.type==="area"||e.type==="bar").filter(Ww)),dZ=t=>t.filter(e=>!("stackId"in e)||e.stackId===void 0),PLe=He([nv],dZ),Jk=t=>t.map(e=>e.data).filter(Boolean).flat(1),DLe=He([nv],Jk,{memoizeOptions:{resultEqualityCheck:Xw}}),eO=(t,e)=>{var{chartData:n=[],dataStartIndex:i,dataEndIndex:r}=e;return t.length>0?t:n.slice(i,r+1)},tO=He([DLe,Hw],eO),nO=(t,e,n)=>e?.dataKey!=null?t.map(i=>({value:Kn(i,e.dataKey)})):n.length>0?n.map(i=>i.dataKey).flatMap(i=>t.map(r=>({value:Kn(r,i)}))):t.map(i=>({value:i})),Yw=He([tO,vi,nv],nO);function fZ(t,e){switch(t){case"xAxis":return e.direction==="x";case"yAxis":return e.direction==="y";default:return!1}}function w_(t){if(nl(t)||t instanceof Date){var e=Number(t);if(oi(e))return e}}function fV(t){if(Array.isArray(t)){var e=[w_(t[0]),w_(t[1])];return Zu(e)?e:void 0}var n=w_(t);if(n!=null)return[n,n]}function _c(t){return t.map(w_).filter(PCe)}function kLe(t,e,n){return!n||typeof e!="number"||Ws(e)?[]:n.length?_c(n.flatMap(i=>{var r=Kn(t,i.dataKey),a,s;if(Array.isArray(r)?[a,s]=r:a=s=r,!(!oi(a)||!oi(s)))return[e-a,e+s]})):[]}var fr=t=>{var e=dr(t),n=Em(t);return tv(t,e,n)},iv=He([fr],t=>t?.dataKey),OLe=He([uZ,Hw,fr],sZ),hZ=(t,e,n,i)=>{var r={},a=e.reduce((s,o)=>(o.stackId==null||(s[o.stackId]==null&&(s[o.stackId]=[]),s[o.stackId].push(o)),s),r);return Object.fromEntries(Object.entries(a).map(s=>{var[o,l]=s,c=i?[...l].reverse():l,d=c.map(Gw);return[o,{stackedData:J3e(t,d,n),graphicalItems:c}]}))},yx=He([OLe,uZ,Jx,JY],hZ),pZ=(t,e,n,i)=>{var{dataStartIndex:r,dataEndIndex:a}=e;if(i==null&&n!=="zAxis"){var s=iRe(t,r,a);if(!(s!=null&&s[0]===0&&s[1]===0))return s}},LLe=He([vi],t=>t.allowDataOverflow),iO=t=>{var e;if(t==null||!("domain"in t))return GR;if(t.domain!=null)return t.domain;if(t.ticks!=null){if(t.type==="number"){var n=_c(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:GR},rO=He([vi],iO),aO=He([rO,LLe],UY),ILe=He([yx,ud,fi,aO],pZ,{memoizeOptions:{resultEqualityCheck:qw}}),Zw=t=>t.errorBars,ULe=(t,e,n)=>t.flatMap(i=>e[i.id]).filter(Boolean).filter(i=>fZ(n,i)),bS=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),o=Math.max(...a);return[s,o]}},sO=(t,e,n,i,r)=>{var a,s;if(n.length>0&&t.forEach(o=>{n.forEach(l=>{var c,d,f=(c=i[l.id])===null||c===void 0?void 0:c.filter(x=>fZ(r,x)),m=Kn(o,(d=e.dataKey)!==null&&d!==void 0?d:l.dataKey),g=kLe(o,m,f);if(g.length>=2){var y=Math.min(...g),_=Math.max(...g);(a==null||y<a)&&(a=y),(s==null||_>s)&&(s=_)}var v=fV(m);v!=null&&(a=a==null?v[0]:Math.min(a,v[0]),s=s==null?v[1]:Math.max(s,v[1]))})}),e?.dataKey!=null&&t.forEach(o=>{var l=fV(Kn(o,e.dataKey));l!=null&&(a=a==null?l[0]:Math.min(a,l[0]),s=s==null?l[1]:Math.max(s,l[1]))}),oi(a)&&oi(s))return[a,s]},jLe=He([tO,vi,PLe,Zw,fi],sO,{memoizeOptions:{resultEqualityCheck:qw}});function FLe(t){var{value:e}=t;if(nl(e)||e instanceof Date)return e}var zLe=(t,e,n)=>{var i=t.map(FLe).filter(r=>r!=null);return n&&(e.dataKey==null||e.allowDuplicatedCategory&&NX(i))?nY(0,t.length):e.allowDuplicatedCategory?i:Array.from(new Set(i))},mZ=t=>t.referenceElements.dots,Am=(t,e,n)=>t.filter(i=>i.ifOverflow==="extendDomain").filter(i=>e==="xAxis"?i.xAxisId===n:i.yAxisId===n),BLe=He([mZ,fi,ev],Am),gZ=t=>t.referenceElements.areas,HLe=He([gZ,fi,ev],Am),xZ=t=>t.referenceElements.lines,VLe=He([xZ,fi,ev],Am),vZ=(t,e)=>{var n=_c(t.map(i=>e==="xAxis"?i.x:i.y));if(n.length!==0)return[Math.min(...n),Math.max(...n)]},$Le=He(BLe,fi,vZ),yZ=(t,e)=>{var n=_c(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)]},GLe=He([HLe,fi],yZ);function WLe(t){var e;if(t.x!=null)return _c([t.x]);var n=(e=t.segment)===null||e===void 0?void 0:e.map(i=>i.x);return n==null||n.length===0?[]:_c(n)}function qLe(t){var e;if(t.y!=null)return _c([t.y]);var n=(e=t.segment)===null||e===void 0?void 0:e.map(i=>i.y);return n==null||n.length===0?[]:_c(n)}var bZ=(t,e)=>{var n=t.flatMap(i=>e==="xAxis"?WLe(i):qLe(i));if(n.length!==0)return[Math.min(...n),Math.max(...n)]},XLe=He([VLe,fi],bZ),KLe=He($Le,XLe,GLe,(t,e,n)=>bS(t,n,e)),oO=(t,e,n,i,r,a,s,o)=>{if(n!=null)return n;var l=s==="vertical"&&o==="xAxis"||s==="horizontal"&&o==="yAxis",c=l?bS(i,a,r):bS(a,r);return aLe(e,c,t.allowDataOverflow)},YLe=He([vi,rO,aO,ILe,jLe,KLe,_n,fi],oO,{memoizeOptions:{resultEqualityCheck:qw}}),ZLe=[0,1],lO=(t,e,n,i,r,a,s)=>{if(!((t==null||n==null||n.length===0)&&s===void 0)){var{dataKey:o,type:l}=t,c=Mc(e,a);if(c&&o==null){var d;return nY(0,(d=n?.length)!==null&&d!==void 0?d:0)}return l==="category"?zLe(i,t,c):r==="expand"?ZLe:s}},cO=He([vi,_n,tO,Yw,Jx,fi,YLe],lO),_Z=(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 o="scale".concat(Fx(a));return o in a0?o:"point"}}},Tm=He([vi,_n,cZ,$k,fi],_Z);function QLe(t){if(t!=null){if(t in a0)return a0[t]();var e="scale".concat(Fx(t));if(e in a0)return a0[e]()}}function uO(t,e,n,i){if(!(n==null||i==null)){if(typeof t.scale=="function")return t.scale.copy().domain(n).range(i);var r=QLe(e);if(r!=null){var a=r.domain(n).range(i);return X3e(a),a}}}var dO=(t,e,n)=>{var i=iO(e);if(!(n!=="auto"&&n!=="linear")){if(e!=null&&e.tickCount&&Array.isArray(i)&&(i[0]==="auto"||i[1]==="auto")&&Zu(t))return pLe(t,e.tickCount,e.allowDecimals);if(e!=null&&e.tickCount&&e.type==="number"&&Zu(t))return mLe(t,e.tickCount,e.allowDecimals)}},fO=He([cO,tv,Tm],dO),hO=(t,e,n,i)=>{if(i!=="angleAxis"&&t?.type==="number"&&Zu(e)&&Array.isArray(n)&&n.length>0){var r=e[0],a=n[0],s=e[1],o=n[n.length-1];return[Math.min(r,a),Math.max(s,o)]}return e},JLe=He([vi,cO,fO,fi],hO),eIe=He(Yw,vi,(t,e)=>{if(!(!e||e.type!=="number")){var n=1/0,i=Array.from(_c(t.map(o=>o.value))).sort((o,l)=>o-l);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}}),SZ=He(eIe,_n,QY,cr,(t,e,n,i)=>i,(t,e,n,i,r)=>{if(!oi(t))return 0;var a=e==="vertical"?i.height:i.width;if(r==="gap")return t*a/2;if(r==="no-gap"){var s=ia(n,t*a),o=t*a/2;return o-s-(o-s)/a*s}return 0}),tIe=(t,e)=>{var n=Cc(t,e);return n==null||typeof n.padding!="string"?0:SZ(t,"xAxis",e,n.padding)},nIe=(t,e)=>{var n=Nc(t,e);return n==null||typeof n.padding!="string"?0:SZ(t,"yAxis",e,n.padding)},iIe=He(Cc,tIe,(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}}),rIe=He(Nc,nIe,(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}}),aIe=He([cr,iIe,Rw,Nw,(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]}),sIe=He([cr,_n,rIe,Rw,Nw,(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]}),rv=(t,e,n,i)=>{var r;switch(e){case"xAxis":return aIe(t,n,i);case"yAxis":return sIe(t,n,i);case"zAxis":return(r=Yk(t,n))===null||r===void 0?void 0:r.range;case"angleAxis":return iZ(t);case"radiusAxis":return rZ(t,n);default:return}},wZ=He([vi,rv],Vw),Cm=He([vi,Tm,JLe,wZ],uO);He([nv,Zw,fi],ULe);function MZ(t,e){return t.id<e.id?-1:t.id>e.id?1:0}var Qw=(t,e)=>e,Jw=(t,e,n)=>n,oIe=He(Tw,Qw,Jw,(t,e,n)=>t.filter(i=>i.orientation===e).filter(i=>i.mirror===n).sort(MZ)),lIe=He(Cw,Qw,Jw,(t,e,n)=>t.filter(i=>i.orientation===e).filter(i=>i.mirror===n).sort(MZ)),EZ=(t,e)=>({width:t.width,height:e.height}),cIe=(t,e)=>{var n=typeof e.width=="number"?e.width:Gx;return{width:n,height:t.height}},AZ=He(cr,Cc,EZ),uIe=(t,e,n)=>{switch(e){case"top":return t.top;case"bottom":return n-t.bottom;default:return 0}},dIe=(t,e,n)=>{switch(e){case"left":return t.left;case"right":return n-t.right;default:return 0}},fIe=He(Ac,cr,oIe,Qw,Jw,(t,e,n,i,r)=>{var a={},s;return n.forEach(o=>{var l=EZ(e,o);s==null&&(s=uIe(e,i,t));var c=i==="top"&&!r||i==="bottom"&&r;a[o.id]=s-Number(c)*l.height,s+=(c?-1:1)*l.height}),a}),hIe=He(Ec,cr,lIe,Qw,Jw,(t,e,n,i,r)=>{var a={},s;return n.forEach(o=>{var l=cIe(e,o);s==null&&(s=dIe(e,i,t));var c=i==="left"&&!r||i==="right"&&r;a[o.id]=s-Number(c)*l.width,s+=(c?-1:1)*l.width}),a}),pIe=(t,e)=>{var n=Cc(t,e);if(n!=null)return fIe(t,n.orientation,n.mirror)},mIe=He([cr,Cc,pIe,(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}}}),gIe=(t,e)=>{var n=Nc(t,e);if(n!=null)return hIe(t,n.orientation,n.mirror)},xIe=He([cr,Nc,gIe,(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}}}),TZ=He(cr,Nc,(t,e)=>{var n=typeof e.width=="number"?e.width:Gx;return{width:n,height:t.height}}),hV=(t,e,n)=>{switch(e){case"xAxis":return AZ(t,n).width;case"yAxis":return TZ(t,n).height;default:return}},CZ=(t,e,n,i)=>{if(n!=null){var{allowDuplicatedCategory:r,type:a,dataKey:s}=n,o=Mc(t,i),l=e.map(c=>c.value);if(s&&o&&a==="category"&&r&&NX(l))return l}},pO=He([_n,Yw,vi,fi],CZ),NZ=(t,e,n,i)=>{if(!(n==null||n.dataKey==null)){var{type:r,scale:a}=n,s=Mc(t,i);if(s&&(r==="number"||a!=="auto"))return e.map(o=>o.value)}},mO=He([_n,Yw,tv,fi],NZ),pV=He([_n,NLe,Tm,Cm,pO,mO,rv,fO,fi],(t,e,n,i,r,a,s,o,l)=>{if(e!=null){var c=Mc(t,l);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:l,categoricalDomain:a,duplicateDomain:r,isCategorical:c,niceTicks:o,range:s,realScaleType:n,scale:i}}}),vIe=(t,e,n,i,r,a,s,o,l)=>{if(!(e==null||i==null)){var c=Mc(t,l),{type:d,ticks:f,tickCount:m}=e,g=n==="scaleBand"&&typeof i.bandwidth=="function"?i.bandwidth()/2:2,y=d==="category"&&i.bandwidth?i.bandwidth()/g:0;y=l==="angleAxis"&&a!=null&&a.length>=2?Er(a[0]-a[1])*2*y:y;var _=f||r;if(_){var v=_.map((x,M)=>{var w=s?s.indexOf(x):x;return{index:M,coordinate:i(w)+y,value:x,offset:y}});return v.filter(x=>oi(x.coordinate))}return c&&o?o.map((x,M)=>({coordinate:i(x)+y,value:x,index:M,offset:y})).filter(x=>oi(x.coordinate)):i.ticks?i.ticks(m).map(x=>({coordinate:i(x)+y,value:x,offset:y})):i.domain().map((x,M)=>({coordinate:i(x)+y,value:s?s[x]:x,index:M,offset:y}))}},RZ=He([_n,tv,Tm,Cm,fO,rv,pO,mO,fi],vIe),yIe=(t,e,n,i,r,a,s)=>{if(!(e==null||n==null||i==null||i[0]===i[1])){var o=Mc(t,s),{tickCount:l}=e,c=0;return c=s==="angleAxis"&&i?.length>=2?Er(i[0]-i[1])*2*c:c,o&&a?a.map((d,f)=>({coordinate:n(d)+c,value:d,index:f,offset:c})):n.ticks?n.ticks(l).map(d=>({coordinate:n(d)+c,value:d,offset:c})):n.domain().map((d,f)=>({coordinate:n(d)+c,value:r?r[d]:d,index:f,offset:c}))}},Qu=He([_n,tv,Cm,rv,pO,mO,fi],yIe),Ju=He(vi,Cm,(t,e)=>{if(!(t==null||e==null))return yS(yS({},t),{},{scale:e})}),bIe=He([vi,Tm,cO,wZ],uO);He((t,e,n)=>Yk(t,n),bIe,(t,e)=>{if(!(t==null||e==null))return yS(yS({},t),{},{scale:e})});var _Ie=He([_n,Tw,Cw],(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}}),PZ=t=>t.options.defaultTooltipEventType,DZ=t=>t.options.validateTooltipEventTypes;function kZ(t,e,n){if(t==null)return e;var i=t?"axis":"item";return n==null?e:n.includes(i)?i:e}function gO(t,e){var n=PZ(t),i=DZ(t);return kZ(e,n,i)}function SIe(t){return At(e=>gO(e,t))}var OZ=(t,e)=>{var n,i=Number(e);if(!(Ws(i)||e==null))return i>=0?t==null||(n=t[i])===null||n===void 0?void 0:n.value:void 0},wIe=t=>t.tooltip.settings,Tu={active:!1,index:null,dataKey:void 0,graphicalItemId:void 0,coordinate:void 0},MIe={itemInteraction:{click:Tu,hover:Tu},axisInteraction:{click:Tu,hover:Tu},keyboardInteraction:Tu,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}},LZ=Ha({name:"tooltip",initialState:MIe,reducers:{addTooltipEntrySettings:{reducer(t,e){t.tooltipItemPayloads.push(e.payload)},prepare:ci()},replaceTooltipEntrySettings:{reducer(t,e){var{prev:n,next:i}=e.payload,r=yo(t).tooltipItemPayloads.indexOf(n);r>-1&&(t.tooltipItemPayloads[r]=i)},prepare:ci()},removeTooltipEntrySettings:{reducer(t,e){var n=yo(t).tooltipItemPayloads.indexOf(e.payload);n>-1&&t.tooltipItemPayloads.splice(n,1)},prepare:ci()},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:EIe,replaceTooltipEntrySettings:AIe,removeTooltipEntrySettings:TIe,setTooltipSettingsState:CIe,setActiveMouseOverItemIndex:IZ,mouseLeaveItem:NIe,mouseLeaveChart:UZ,setActiveClickItemIndex:RIe,setMouseOverAxisIndex:jZ,setMouseClickAxisIndex:PIe,setSyncInteraction:WR,setKeyboardInteraction:qR}=LZ.actions,DIe=LZ.reducer;function mV(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 Zb(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?mV(Object(n),!0).forEach(function(i){kIe(t,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):mV(Object(n)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(n,i))})}return t}function kIe(t,e,n){return(e=OIe(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function OIe(t){var e=LIe(t,"string");return typeof e=="symbol"?e:e+""}function LIe(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 IIe(t,e,n){return e==="axis"?n==="click"?t.axisInteraction.click:t.axisInteraction.hover:n==="click"?t.itemInteraction.click:t.itemInteraction.hover}function UIe(t){return t.index!=null}var FZ=(t,e,n,i)=>{if(e==null)return Tu;var r=IIe(t,e,n);if(r==null)return Tu;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(UIe(r)){if(a)return Zb(Zb({},r),{},{active:!0})}else if(i!=null)return{active:!0,coordinate:void 0,dataKey:void 0,index:i,graphicalItemId:void 0};return Zb(Zb({},Tu),{},{coordinate:r.coordinate})};function jIe(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 FIe(t,e){var n=jIe(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 zIe(t,e,n){if(n==null||e==null)return!0;var i=Kn(t,e);return i==null||!Zu(n)?!0:FIe(i,n)}var xO=(t,e,n,i)=>{var r=t?.index;if(r==null)return null;var a=Number(r);if(!oi(a))return r;var s=0,o=1/0;e.length>0&&(o=e.length-1);var l=Math.max(s,Math.min(a,o)),c=e[l];return c==null||zIe(c,n,i)?String(l):null},zZ=(t,e,n,i,r,a,s,o)=>{if(!(a==null||o==null)){var l=s[0],c=l==null?void 0:o(l.positions,a);if(c!=null)return c;var d=r?.[Number(a)];if(d)switch(n){case"horizontal":return{x:d.coordinate,y:(i.top+e)/2};default:return{x:(i.left+t)/2,y:d.coordinate}}}},BZ=(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})},av=t=>t.options.tooltipPayloadSearcher,Nm=t=>t.tooltip;function gV(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 xV(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?gV(Object(n),!0).forEach(function(i){BIe(t,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):gV(Object(n)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(n,i))})}return t}function BIe(t,e,n){return(e=HIe(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function HIe(t){var e=VIe(t,"string");return typeof e=="symbol"?e:e+""}function VIe(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 $Ie(t,e){return t??e}var HZ=(t,e,n,i,r,a,s)=>{if(!(e==null||a==null)){var{chartData:o,computedData:l,dataStartIndex:c,dataEndIndex:d}=n,f=[];return t.reduce((m,g)=>{var y,{dataDefinedOnItem:_,settings:v}=g,x=$Ie(_,o),M=Array.isArray(x)?wK(x,c,d):x,w=(y=v?.dataKey)!==null&&y!==void 0?y:i,T=v?.nameKey,C;if(i&&Array.isArray(M)&&!Array.isArray(M[0])&&s==="axis"?C=RX(M,i,r):C=a(M,e,l,T),Array.isArray(C))C.forEach(A=>{var U=xV(xV({},v),{},{name:A.name,unit:A.unit,color:void 0,fill:void 0});m.push(U6({tooltipEntrySettings:U,dataKey:A.dataKey,payload:A.payload,value:Kn(A.payload,A.dataKey),name:A.name}))});else{var P;m.push(U6({tooltipEntrySettings:v,dataKey:w,payload:C,value:Kn(C,w),name:(P=Kn(C,T))!==null&&P!==void 0?P:v?.name}))}return m},f)}},vO=He([fr,_n,cZ,$k,dr],_Z),GIe=He([t=>t.graphicalItems.cartesianItems,t=>t.graphicalItems.polarItems],(t,e)=>[...t,...e]),WIe=He([dr,Em],Zk),sv=He([GIe,fr,WIe],Qk,{memoizeOptions:{resultEqualityCheck:Xw}}),qIe=He([sv],t=>t.filter(Ww)),XIe=He([sv],Jk,{memoizeOptions:{resultEqualityCheck:Xw}}),Rm=He([XIe,ud],eO),KIe=He([qIe,ud,fr],sZ),yO=He([Rm,fr,sv],nO),VZ=He([fr],iO),YIe=He([fr],t=>t.allowDataOverflow),$Z=He([VZ,YIe],UY),ZIe=He([sv],t=>t.filter(Ww)),QIe=He([KIe,ZIe,Jx,JY],hZ),JIe=He([QIe,ud,dr,$Z],pZ),e4e=He([sv],dZ),t4e=He([Rm,fr,e4e,Zw,dr],sO,{memoizeOptions:{resultEqualityCheck:qw}}),n4e=He([mZ,dr,Em],Am),i4e=He([n4e,dr],vZ),r4e=He([gZ,dr,Em],Am),a4e=He([r4e,dr],yZ),s4e=He([xZ,dr,Em],Am),o4e=He([s4e,dr],bZ),l4e=He([i4e,o4e,a4e],bS),c4e=He([fr,VZ,$Z,JIe,t4e,l4e,_n,dr],oO),ov=He([fr,_n,Rm,yO,Jx,dr,c4e],lO),u4e=He([ov,fr,vO],dO),d4e=He([fr,ov,u4e,dr],hO),GZ=t=>{var e=dr(t),n=Em(t),i=!1;return rv(t,e,n,i)},WZ=He([fr,GZ],Vw),qZ=He([fr,vO,d4e,WZ],uO),f4e=He([_n,yO,fr,dr],CZ),h4e=He([_n,yO,fr,dr],NZ),p4e=(t,e,n,i,r,a,s,o)=>{if(e){var{type:l}=e,c=Mc(t,o);if(i){var d=n==="scaleBand"&&i.bandwidth?i.bandwidth()/2:2,f=l==="category"&&i.bandwidth?i.bandwidth()/d:0;return f=o==="angleAxis"&&r!=null&&r?.length>=2?Er(r[0]-r[1])*2*f:f,c&&s?s.map((m,g)=>({coordinate:i(m)+f,value:m,index:g,offset:f})):i.domain().map((m,g)=>({coordinate:i(m)+f,value:a?a[m]:m,index:g,offset:f}))}}},Rc=He([_n,fr,vO,qZ,GZ,f4e,h4e,dr],p4e),bO=He([PZ,DZ,wIe],(t,e,n)=>kZ(n.shared,t,e)),XZ=t=>t.tooltip.settings.trigger,_O=t=>t.tooltip.settings.defaultIndex,lv=He([Nm,bO,XZ,_O],FZ),ed=He([lv,Rm,iv,ov],xO),KZ=He([Rc,ed],OZ),SO=He([lv],t=>{if(t)return t.dataKey}),m4e=He([lv],t=>{if(t)return t.graphicalItemId}),YZ=He([Nm,bO,XZ,_O],BZ),g4e=He([Ec,Ac,_n,cr,Rc,_O,YZ,av],zZ),x4e=He([lv,g4e],(t,e)=>t!=null&&t.coordinate?t.coordinate:e),v4e=He([lv],t=>t.active),y4e=He([YZ,ed,ud,iv,KZ,av,bO],HZ),b4e=He([y4e],t=>{if(t!=null){var e=t.map(n=>n.payload).filter(n=>n!=null);return Array.from(new Set(e))}});function vV(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 yV(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?vV(Object(n),!0).forEach(function(i){_4e(t,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):vV(Object(n)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(n,i))})}return t}function _4e(t,e,n){return(e=S4e(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function S4e(t){var e=w4e(t,"string");return typeof e=="symbol"?e:e+""}function w4e(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 M4e=()=>At(fr),E4e=()=>{var t=M4e(),e=At(Rc),n=At(qZ);return nm(!t||!n?void 0:yV(yV({},t),{},{scale:n}),e)};function bV(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 lp(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?bV(Object(n),!0).forEach(function(i){A4e(t,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):bV(Object(n)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(n,i))})}return t}function A4e(t,e,n){return(e=T4e(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function T4e(t){var e=C4e(t,"string");return typeof e=="symbol"?e:e+""}function C4e(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 N4e=(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}},R4e=(t,e,n,i)=>{var r=e.find(c=>c&&c.index===n);if(r){if(t==="centric"){var a=r.coordinate,{radius:s}=i;return lp(lp(lp({},i),Gi(i.cx,i.cy,s,a)),{},{angle:a,radius:s})}var o=r.coordinate,{angle:l}=i;return lp(lp(lp({},i),Gi(i.cx,i.cy,o,l)),{},{angle:l,radius:o})}return{angle:0,clockWise:!1,cx:0,cy:0,endAngle:0,innerRadius:0,outerRadius:0,radius:0,startAngle:0,x:0,y:0}};function P4e(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 ZZ=(t,e,n,i,r)=>{var a,s=-1,o=(a=e?.length)!==null&&a!==void 0?a:0;if(o<=1||t==null)return 0;if(i==="angleAxis"&&r!=null&&Math.abs(Math.abs(r[1]-r[0])-360)<=1e-6)for(var l=0;l<o;l++){var c=l>0?n[l-1].coordinate:n[o-1].coordinate,d=n[l].coordinate,f=l>=o-1?n[0].coordinate:n[l+1].coordinate,m=void 0;if(Er(d-c)!==Er(f-d)){var g=[];if(Er(f-d)===Er(r[1]-r[0])){m=f;var y=d+r[1]-r[0];g[0]=Math.min(y,(y+c)/2),g[1]=Math.max(y,(y+c)/2)}else{m=c;var _=f+r[1]-r[0];g[0]=Math.min(d,(_+d)/2),g[1]=Math.max(d,(_+d)/2)}var v=[Math.min(d,(m+d)/2),Math.max(d,(m+d)/2)];if(t>v[0]&&t<=v[1]||t>=g[0]&&t<=g[1]){({index:s}=n[l]);break}}else{var x=Math.min(c,f),M=Math.max(c,f);if(t>(x+d)/2&&t<=(M+d)/2){({index:s}=n[l]);break}}}else if(e){for(var w=0;w<o;w++)if(w===0&&t<=(e[w].coordinate+e[w+1].coordinate)/2||w>0&&w<o-1&&t>(e[w].coordinate+e[w-1].coordinate)/2&&t<=(e[w].coordinate+e[w+1].coordinate)/2||w===o-1&&t>(e[w].coordinate+e[w-1].coordinate)/2){({index:s}=e[w]);break}}return s},QZ=()=>At($k),wO=(t,e)=>e,JZ=(t,e,n)=>n,MO=(t,e,n,i)=>i,D4e=He(Rc,t=>vw(t,e=>e.coordinate)),EO=He([Nm,wO,JZ,MO],FZ),AO=He([EO,Rm,iv,ov],xO),k4e=(t,e,n)=>{if(e!=null){var i=Nm(t);return e==="axis"?n==="hover"?i.axisInteraction.hover.dataKey:i.axisInteraction.click.dataKey:n==="hover"?i.itemInteraction.hover.dataKey:i.itemInteraction.click.dataKey}},eQ=He([Nm,wO,JZ,MO],BZ),_S=He([Ec,Ac,_n,cr,Rc,MO,eQ,av],zZ),O4e=He([EO,_S],(t,e)=>{var n;return(n=t.coordinate)!==null&&n!==void 0?n:e}),tQ=He([Rc,AO],OZ),L4e=He([eQ,AO,ud,iv,tQ,av,wO],HZ),I4e=He([EO,AO],(t,e)=>({isActive:t.active&&e!=null,activeIndex:e})),U4e=(t,e,n,i,r,a,s)=>{if(!(!t||!n||!i||!r)&&P4e(t,s)){var o=rRe(t,e),l=ZZ(o,a,r,n,i),c=N4e(e,r,l,t);return{activeIndex:String(l),activeCoordinate:c}}},j4e=(t,e,n,i,r,a,s)=>{if(!(!t||!i||!r||!a||!n)){var o=_De(t,n);if(o){var l=aRe(o,e),c=ZZ(l,s,a,i,r),d=R4e(e,a,c,o);return{activeIndex:String(c),activeCoordinate:d}}}},F4e=(t,e,n,i,r,a,s,o)=>{if(!(!t||!e||!i||!r||!a))return e==="horizontal"||e==="vertical"?U4e(t,e,i,r,a,s,o):j4e(t,e,n,i,r,a,s)},z4e=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}}),B4e=He(t=>t.zIndex.zIndexMap,t=>{var e=Object.keys(t).map(i=>parseInt(i,10)).concat(Object.values(Wi)),n=Array.from(new Set(e));return n.sort((i,r)=>i-r)},{memoizeOptions:{resultEqualityCheck:MLe}});function _V(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?_V(Object(n),!0).forEach(function(i){H4e(t,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):_V(Object(n)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(n,i))})}return t}function H4e(t,e,n){return(e=V4e(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function V4e(t){var e=$4e(t,"string");return typeof e=="symbol"?e:e+""}function $4e(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 G4e={},W4e={zIndexMap:Object.values(Wi).reduce((t,e)=>SV(SV({},t),{},{[e]:{elementId:void 0,panoramaElementId:void 0,consumers:0}}),G4e)},q4e=new Set(Object.values(Wi));function X4e(t){return q4e.has(t)}var nQ=Ha({name:"zIndex",initialState:W4e,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:ci()},unregisterZIndexPortal:{reducer:(t,e)=>{var{zIndex:n}=e.payload;t.zIndexMap[n]&&(t.zIndexMap[n].consumers-=1,t.zIndexMap[n].consumers<=0&&!X4e(n)&&delete t.zIndexMap[n])},prepare:ci()},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:ci()},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:ci()}}}),{registerZIndexPortal:K4e,unregisterZIndexPortal:Y4e,registerZIndexPortalId:Z4e,unregisterZIndexPortalId:Q4e}=nQ.actions,J4e=nQ.reducer;function Va(t){var{zIndex:e,children:n}=t,i=URe(),r=i&&e!==void 0&&e!==0,a=sa(),s=ei();E.useLayoutEffect(()=>r?(s(K4e({zIndex:e})),()=>{s(Y4e({zIndex:e}))}):zx,[s,e,r]);var o=At(c=>z4e(c,e,a));if(!r)return n;if(!o)return null;var l=document.getElementById(o);return l?Xl.createPortal(n,l):null}function XR(){return XR=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},XR.apply(null,arguments)}function wV(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 Qb(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?wV(Object(n),!0).forEach(function(i){eUe(t,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):wV(Object(n)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(n,i))})}return t}function eUe(t,e,n){return(e=tUe(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function tUe(t){var e=nUe(t,"string");return typeof e=="symbol"?e:e+""}function nUe(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 iUe(t){var{cursor:e,cursorComp:n,cursorProps:i}=t;return E.isValidElement(e)?E.cloneElement(e,i):E.createElement(n,i)}function rUe(t){var e,{coordinate:n,payload:i,index:r,offset:a,tooltipAxisBandSize:s,layout:o,cursor:l,tooltipEventType:c,chartName:d}=t,f=n,m=i,g=r;if(!l||!f||d!=="ScatterChart"&&c!=="axis")return null;var y,_,v;if(d==="ScatterChart")y=f,_=IPe,v=Wi.cursorLine;else if(d==="BarChart")y=UPe(o,f,a,s),_=ZK,v=Wi.cursorRectangle;else if(o==="radial"&&DX(f)){var{cx:x,cy:M,radius:w,startAngle:T,endAngle:C}=JK(f);y={cx:x,cy:M,startAngle:T,endAngle:C,innerRadius:w,outerRadius:w},_=tY,v=Wi.cursorLine}else y={points:EDe(o,f,a)},_=kp,v=Wi.cursorLine;var P=typeof l=="object"&&"className"in l?l.className:void 0,A=Qb(Qb(Qb(Qb({stroke:"#ccc",pointerEvents:"none"},a),y),kf(l)),{},{payload:m,payloadIndex:g,className:En("recharts-tooltip-cursor",P)});return E.createElement(Va,{zIndex:(e=t.zIndex)!==null&&e!==void 0?e:v},E.createElement(iUe,{cursor:l,cursorComp:_,cursorProps:A}))}function aUe(t){var e=E4e(),n=OK(),i=bm(),r=QZ();return e==null||n==null||i==null||r==null?null:E.createElement(rUe,XR({},t,{offset:n,layout:i,tooltipAxisBandSize:e,chartName:r}))}var iQ=E.createContext(null),sUe=()=>E.useContext(iQ),IC={exports:{}},MV;function oUe(){return MV||(MV=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(l,c,d){this.fn=l,this.context=c,this.once=d||!1}function a(l,c,d,f,m){if(typeof d!="function")throw new TypeError("The listener must be a function");var g=new r(d,f||l,m),y=n?n+c:c;return l._events[y]?l._events[y].fn?l._events[y]=[l._events[y],g]:l._events[y].push(g):(l._events[y]=g,l._eventsCount++),l}function s(l,c){--l._eventsCount===0?l._events=new i:delete l._events[c]}function o(){this._events=new i,this._eventsCount=0}o.prototype.eventNames=function(){var c=[],d,f;if(this._eventsCount===0)return c;for(f in d=this._events)e.call(d,f)&&c.push(n?f.slice(1):f);return Object.getOwnPropertySymbols?c.concat(Object.getOwnPropertySymbols(d)):c},o.prototype.listeners=function(c){var d=n?n+c:c,f=this._events[d];if(!f)return[];if(f.fn)return[f.fn];for(var m=0,g=f.length,y=new Array(g);m<g;m++)y[m]=f[m].fn;return y},o.prototype.listenerCount=function(c){var d=n?n+c:c,f=this._events[d];return f?f.fn?1:f.length:0},o.prototype.emit=function(c,d,f,m,g,y){var _=n?n+c:c;if(!this._events[_])return!1;var v=this._events[_],x=arguments.length,M,w;if(v.fn){switch(v.once&&this.removeListener(c,v.fn,void 0,!0),x){case 1:return v.fn.call(v.context),!0;case 2:return v.fn.call(v.context,d),!0;case 3:return v.fn.call(v.context,d,f),!0;case 4:return v.fn.call(v.context,d,f,m),!0;case 5:return v.fn.call(v.context,d,f,m,g),!0;case 6:return v.fn.call(v.context,d,f,m,g,y),!0}for(w=1,M=new Array(x-1);w<x;w++)M[w-1]=arguments[w];v.fn.apply(v.context,M)}else{var T=v.length,C;for(w=0;w<T;w++)switch(v[w].once&&this.removeListener(c,v[w].fn,void 0,!0),x){case 1:v[w].fn.call(v[w].context);break;case 2:v[w].fn.call(v[w].context,d);break;case 3:v[w].fn.call(v[w].context,d,f);break;case 4:v[w].fn.call(v[w].context,d,f,m);break;default:if(!M)for(C=1,M=new Array(x-1);C<x;C++)M[C-1]=arguments[C];v[w].fn.apply(v[w].context,M)}}return!0},o.prototype.on=function(c,d,f){return a(this,c,d,f,!1)},o.prototype.once=function(c,d,f){return a(this,c,d,f,!0)},o.prototype.removeListener=function(c,d,f,m){var g=n?n+c:c;if(!this._events[g])return this;if(!d)return s(this,g),this;var y=this._events[g];if(y.fn)y.fn===d&&(!m||y.once)&&(!f||y.context===f)&&s(this,g);else{for(var _=0,v=[],x=y.length;_<x;_++)(y[_].fn!==d||m&&!y[_].once||f&&y[_].context!==f)&&v.push(y[_]);v.length?this._events[g]=v.length===1?v[0]:v:s(this,g)}return this},o.prototype.removeAllListeners=function(c){var d;return c?(d=n?n+c:c,this._events[d]&&s(this,d)):(this._events=new i,this._eventsCount=0),this},o.prototype.off=o.prototype.removeListener,o.prototype.addListener=o.prototype.on,o.prefixed=n,o.EventEmitter=o,t.exports=o})(IC)),IC.exports}var lUe=oUe();const cUe=Ks(lUe);var bx=new cUe,KR="recharts.syncEvent.tooltip",EV="recharts.syncEvent.brush";function TO(t,e){if(e){var n=Number.parseInt(e,10);if(!Ws(n))return t?.[n]}}var uUe={chartName:"",tooltipPayloadSearcher:void 0,eventEmitter:void 0,defaultTooltipEventType:"axis"},rQ=Ha({name:"options",initialState:uUe,reducers:{createEventEmitter:t=>{t.eventEmitter==null&&(t.eventEmitter=Symbol("rechartsEventEmitter"))}}}),dUe=rQ.reducer,{createEventEmitter:fUe}=rQ.actions;function hUe(t){return t.tooltip.syncInteraction}var pUe={chartData:void 0,computedData:void 0,dataStartIndex:0,dataEndIndex:0},aQ=Ha({name:"chartData",initialState:pUe,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:AV,setDataStartEndIndexes:mUe,setComputedData:gGe}=aQ.actions,gUe=aQ.reducer,xUe=["x","y"];function TV(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 cp(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?TV(Object(n),!0).forEach(function(i){vUe(t,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):TV(Object(n)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(n,i))})}return t}function vUe(t,e,n){return(e=yUe(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function yUe(t){var e=bUe(t,"string");return typeof e=="symbol"?e:e+""}function bUe(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 _Ue(t,e){if(t==null)return{};var n,i,r=SUe(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 SUe(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 wUe(){var t=At(Gk),e=At(Wk),n=ei(),i=At(eZ),r=At(Rc),a=bm(),s=Pw(),o=At(l=>l.rootProps.className);E.useEffect(()=>{if(t==null)return zx;var l=(c,d,f)=>{if(e!==f&&t===c){if(i==="index"){var m;if(s&&d!==null&&d!==void 0&&(m=d.payload)!==null&&m!==void 0&&m.coordinate&&d.payload.sourceViewBox){var g=d.payload.coordinate,{x:y,y:_}=g,v=_Ue(g,xUe),{x,y:M,width:w,height:T}=d.payload.sourceViewBox,C=cp(cp({},v),{},{x:s.x+(w?(y-x)/w:0)*s.width,y:s.y+(T?(_-M)/T:0)*s.height});n(cp(cp({},d),{},{payload:cp(cp({},d.payload),{},{coordinate:C})}))}else n(d);return}if(r!=null){var P;if(typeof i=="function"){var A={activeTooltipIndex:d.payload.index==null?void 0:Number(d.payload.index),isTooltipActive:d.payload.active,activeIndex:d.payload.index==null?void 0:Number(d.payload.index),activeLabel:d.payload.label,activeDataKey:d.payload.dataKey,activeCoordinate:d.payload.coordinate},U=i(r,A);P=r[U]}else i==="value"&&(P=r.find(H=>String(H.value)===d.payload.label));var{coordinate:N}=d.payload;if(P==null||d.payload.active===!1||N==null||s==null){n(WR({active:!1,coordinate:void 0,dataKey:void 0,index:null,label:void 0,sourceViewBox:void 0,graphicalItemId:void 0}));return}var{x:D,y:F}=N,I=Math.min(D,s.x+s.width),W=Math.min(F,s.y+s.height),O={x:a==="horizontal"?P.coordinate:I,y:a==="horizontal"?W:P.coordinate},B=WR({active:d.payload.active,coordinate:O,dataKey:d.payload.dataKey,index:String(P.index),label:d.payload.label,sourceViewBox:d.payload.sourceViewBox,graphicalItemId:d.payload.graphicalItemId});n(B)}}};return bx.on(KR,l),()=>{bx.off(KR,l)}},[o,n,e,t,i,r,a,s])}function MUe(){var t=At(Gk),e=At(Wk),n=ei();E.useEffect(()=>{if(t==null)return zx;var i=(r,a,s)=>{e!==s&&t===r&&n(mUe(a))};return bx.on(EV,i),()=>{bx.off(EV,i)}},[n,e,t])}function EUe(){var t=ei();E.useEffect(()=>{t(fUe())},[t]),wUe(),MUe()}function AUe(t,e,n,i,r,a){var s=At(g=>k4e(g,t,e)),o=At(Wk),l=At(Gk),c=At(eZ),d=At(hUe),f=d?.active,m=Pw();E.useEffect(()=>{if(!f&&l!=null&&o!=null){var g=WR({active:a,coordinate:n,dataKey:s,index:r,label:typeof i=="number"?String(i):i,sourceViewBox:m,graphicalItemId:void 0});bx.emit(KR,l,g,o)}},[f,n,s,r,i,o,l,c,a,m])}function CV(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 NV(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?CV(Object(n),!0).forEach(function(i){TUe(t,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):CV(Object(n)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(n,i))})}return t}function TUe(t,e,n){return(e=CUe(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function CUe(t){var e=NUe(t,"string");return typeof e=="symbol"?e:e+""}function NUe(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 RUe(t){return t.dataKey}function PUe(t,e){return E.isValidElement(t)?E.cloneElement(t,e):typeof t=="function"?E.createElement(t,e):E.createElement(mPe,e)}var RV=[],DUe={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 UC(t){var e,n,i=Yi(t,DUe),{active:r,allowEscapeViewBox:a,animationDuration:s,animationEasing:o,content:l,filterNull:c,isAnimationActive:d,offset:f,payloadUniqBy:m,position:g,reverseDirection:y,useTranslate3d:_,wrapperStyle:v,cursor:x,shared:M,trigger:w,defaultIndex:T,portal:C,axisId:P}=i,A=ei(),U=typeof T=="number"?String(T):T;E.useEffect(()=>{A(CIe({shared:M,trigger:w,axisId:P,active:r,defaultIndex:U}))},[A,M,w,P,r,U]);var N=Pw(),D=WK(),F=SIe(M),{activeIndex:I,isActive:W}=(e=At(ve=>I4e(ve,F,w,U)))!==null&&e!==void 0?e:{},O=At(ve=>L4e(ve,F,w,U)),B=At(ve=>tQ(ve,F,w,U)),H=At(ve=>O4e(ve,F,w,U)),$=O,K=sUe(),Z=(n=r??W)!==null&&n!==void 0?n:!1,[se,V]=qX([$,Z]),X=F==="axis"?B:void 0;AUe(F,w,H,X,I,Z);var ae=C??K;if(ae==null||N==null||F==null)return null;var ce=$??RV;Z||(ce=RV),c&&ce.length&&(ce=HX(ce.filter(ve=>ve.value!=null&&(ve.hide!==!0||i.includeHidden)),m,RUe));var ge=ce.length>0,ne=E.createElement(SPe,{allowEscapeViewBox:a,animationDuration:s,animationEasing:o,isAnimationActive:d,active:Z,coordinate:H,hasPayload:ge,offset:f,position:g,reverseDirection:y,useTranslate3d:_,viewBox:N,wrapperStyle:v,lastBoundingBox:se,innerRef:V,hasPortalFromProps:!!C},PUe(l,NV(NV({},i),{},{payload:ce,label:X,active:Z,activeIndex:I,coordinate:H,accessibilityLayer:D})));return E.createElement(E.Fragment,null,Xl.createPortal(ne,ae),Z&&E.createElement(aUe,{cursor:x,tooltipEventType:F,coordinate:H,payload:ce,index:I}))}var cv=t=>null;cv.displayName="Cell";function kUe(t,e,n){return(e=OUe(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function OUe(t){var e=LUe(t,"string");return typeof e=="symbol"?e:e+""}function LUe(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 IUe{constructor(e){kUe(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 PV(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 UUe(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?PV(Object(n),!0).forEach(function(i){jUe(t,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):PV(Object(n)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(n,i))})}return t}function jUe(t,e,n){return(e=FUe(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function FUe(t){var e=zUe(t,"string");return typeof e=="symbol"?e:e+""}function zUe(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 BUe={cacheSize:2e3,enableCache:!0},sQ=UUe({},BUe),DV=new IUe(sQ.cacheSize),HUe={position:"absolute",top:"-20000px",left:0,padding:0,margin:0,border:"none",whiteSpace:"pre"},kV="recharts_measurement_span";function VUe(t,e){var n=e.fontSize||"",i=e.fontFamily||"",r=e.fontWeight||"",a=e.fontStyle||"",s=e.letterSpacing||"",o=e.textTransform||"";return"".concat(t,"|").concat(n,"|").concat(i,"|").concat(r,"|").concat(a,"|").concat(s,"|").concat(o)}var OV=(t,e)=>{try{var n=document.getElementById(kV);n||(n=document.createElement("span"),n.setAttribute("id",kV),n.setAttribute("aria-hidden","true"),document.body.appendChild(n)),Object.assign(n.style,HUe,e),n.textContent="".concat(t);var i=n.getBoundingClientRect();return{width:i.width,height:i.height}}catch{return{width:0,height:0}}},E0=function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(e==null||_m.isSsr)return{width:0,height:0};if(!sQ.enableCache)return OV(e,n);var i=VUe(e,n),r=DV.get(i);if(r)return r;var a=OV(e,n);return DV.set(i,a),a},LV=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([*/])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,IV=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([+-])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,$Ue=/^px|cm|vh|vw|em|rem|%|mm|in|pt|pc|ex|ch|vmin|vmax|Q$/,GUe=/(-?\d+(?:\.\d+)?)([a-zA-Z%]+)?/,oQ={cm:96/2.54,mm:96/25.4,pt:96/72,pc:96/6,in:96,Q:96/(2.54*40),px:1},WUe=Object.keys(oQ),_p="NaN";function qUe(t,e){return t*oQ[e]}class Da{static parse(e){var n,[,i,r]=(n=GUe.exec(e))!==null&&n!==void 0?n:[];return new Da(parseFloat(i),r??"")}constructor(e,n){this.num=e,this.unit=n,this.num=e,this.unit=n,Ws(e)&&(this.unit=""),n!==""&&!$Ue.test(n)&&(this.num=NaN,this.unit=""),WUe.includes(n)&&(this.num=qUe(e,n),this.unit="px")}add(e){return this.unit!==e.unit?new Da(NaN,""):new Da(this.num+e.num,this.unit)}subtract(e){return this.unit!==e.unit?new Da(NaN,""):new Da(this.num-e.num,this.unit)}multiply(e){return this.unit!==""&&e.unit!==""&&this.unit!==e.unit?new Da(NaN,""):new Da(this.num*e.num,this.unit||e.unit)}divide(e){return this.unit!==""&&e.unit!==""&&this.unit!==e.unit?new Da(NaN,""):new Da(this.num/e.num,this.unit||e.unit)}toString(){return"".concat(this.num).concat(this.unit)}isNaN(){return Ws(this.num)}}function lQ(t){if(t.includes(_p))return _p;for(var e=t;e.includes("*")||e.includes("/");){var n,[,i,r,a]=(n=LV.exec(e))!==null&&n!==void 0?n:[],s=Da.parse(i??""),o=Da.parse(a??""),l=r==="*"?s.multiply(o):s.divide(o);if(l.isNaN())return _p;e=e.replace(LV,l.toString())}for(;e.includes("+")||/.-\d+(?:\.\d+)?/.test(e);){var c,[,d,f,m]=(c=IV.exec(e))!==null&&c!==void 0?c:[],g=Da.parse(d??""),y=Da.parse(m??""),_=f==="+"?g.add(y):g.subtract(y);if(_.isNaN())return _p;e=e.replace(IV,_.toString())}return e}var UV=/\(([^()]*)\)/;function XUe(t){for(var e=t,n;(n=UV.exec(e))!=null;){var[,i]=n;e=e.replace(UV,lQ(i))}return e}function KUe(t){var e=t.replace(/\s+/g,"");return e=XUe(e),e=lQ(e),e}function YUe(t){try{return KUe(t)}catch{return _p}}function jC(t){var e=YUe(t.slice(5,-1));return e===_p?"":e}var ZUe=["x","y","lineHeight","capHeight","fill","scaleToFit","textAnchor","verticalAnchor"],QUe=["dx","dy","angle","className","breakAll"];function YR(){return YR=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},YR.apply(null,arguments)}function jV(t,e){if(t==null)return{};var n,i,r=JUe(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 JUe(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 cQ=/[ \f\n\r\t\v\u2028\u2029]+/,uQ=t=>{var{children:e,breakAll:n,style:i}=t;try{var r=[];gi(e)||(n?r=e.toString().split(""):r=e.toString().split(cQ));var a=r.map(o=>({word:o,width:E0(o,i).width})),s=n?0:E0(" ",i).width;return{wordsWithComputedWidth:a,spaceWidth:s}}catch{return null}};function eje(t){return t==="start"||t==="middle"||t==="end"||t==="inherit"}var dQ=(t,e,n,i)=>t.reduce((r,a)=>{var{word:s,width:o}=a,l=r[r.length-1];if(l&&o!=null&&(e==null||i||l.width+o+n<Number(e)))l.words.push(s),l.width+=o+n;else{var c={words:[s],width:o};r.push(c)}return r},[]),fQ=t=>t.reduce((e,n)=>e.width>n.width?e:n),tje="…",FV=(t,e,n,i,r,a,s,o)=>{var l=t.slice(0,e),c=uQ({breakAll:n,style:i,children:l+tje});if(!c)return[!1,[]];var d=dQ(c.wordsWithComputedWidth,a,s,o),f=d.length>r||fQ(d).width>Number(a);return[f,d]},nje=(t,e,n,i,r)=>{var{maxLines:a,children:s,style:o,breakAll:l}=t,c=Et(a),d=String(s),f=dQ(e,i,n,r);if(!c||r)return f;var m=f.length>a||fQ(f).width>Number(i);if(!m)return f;for(var g=0,y=d.length-1,_=0,v;g<=y&&_<=d.length-1;){var x=Math.floor((g+y)/2),M=x-1,[w,T]=FV(d,M,l,o,a,i,n,r),[C]=FV(d,x,l,o,a,i,n,r);if(!w&&!C&&(g=x+1),w&&C&&(y=x-1),!w&&C){v=T;break}_++}return v||f},zV=t=>{var e=gi(t)?[]:t.toString().split(cQ);return[{words:e,width:void 0}]},ije=t=>{var{width:e,scaleToFit:n,children:i,style:r,breakAll:a,maxLines:s}=t;if((e||n)&&!_m.isSsr){var o,l,c=uQ({breakAll:a,children:i,style:r});if(c){var{wordsWithComputedWidth:d,spaceWidth:f}=c;o=d,l=f}else return zV(i);return nje({breakAll:a,children:i,maxLines:s,style:r},o,l,e,!!n)}return zV(i)},hQ="#808080",rje={angle:0,breakAll:!1,capHeight:"0.71em",fill:hQ,lineHeight:"1em",scaleToFit:!1,textAnchor:"start",verticalAnchor:"end",x:0,y:0},eM=E.forwardRef((t,e)=>{var n=Yi(t,rje),{x:i,y:r,lineHeight:a,capHeight:s,fill:o,scaleToFit:l,textAnchor:c,verticalAnchor:d}=n,f=jV(n,ZUe),m=E.useMemo(()=>ije({breakAll:f.breakAll,children:f.children,maxLines:f.maxLines,scaleToFit:l,style:f.style,width:f.width}),[f.breakAll,f.children,f.maxLines,l,f.style,f.width]),{dx:g,dy:y,angle:_,className:v,breakAll:x}=f,M=jV(f,QUe);if(!nl(i)||!nl(r)||m.length===0)return null;var w=Number(i)+(Et(g)?g:0),T=Number(r)+(Et(y)?y:0);if(!oi(w)||!oi(T))return null;var C;switch(d){case"start":C=jC("calc(".concat(s,")"));break;case"middle":C=jC("calc(".concat((m.length-1)/2," * -").concat(a," + (").concat(s," / 2))"));break;default:C=jC("calc(".concat(m.length-1," * -").concat(a,")"));break}var P=[];if(l){var A=m[0].width,{width:U}=f;P.push("scale(".concat(Et(U)&&Et(A)?U/A:1,")"))}return _&&P.push("rotate(".concat(_,", ").concat(w,", ").concat(T,")")),P.length&&(M.transform=P.join(" ")),E.createElement("text",YR({},_a(M),{ref:e,x:w,y:T,className:En("recharts-text",v),textAnchor:c,fill:o.includes("url")?hQ:o}),m.map((N,D)=>{var F=N.words.join(x?"":" ");return E.createElement("tspan",{x:w,dy:D===0?C:a,key:"".concat(F,"-").concat(D)},F)}))});eM.displayName="Text";var aje=["labelRef"];function sje(t,e){if(t==null)return{};var n,i,r=oje(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 oje(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 BV(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 Pi(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?BV(Object(n),!0).forEach(function(i){lje(t,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):BV(Object(n)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(n,i))})}return t}function lje(t,e,n){return(e=cje(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function cje(t){var e=uje(t,"string");return typeof e=="symbol"?e:e+""}function uje(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 ql(){return ql=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},ql.apply(null,arguments)}var pQ=E.createContext(null),dje=t=>{var{x:e,y:n,upperWidth:i,lowerWidth:r,width:a,height:s,children:o}=t,l=E.useMemo(()=>({x:e,y:n,upperWidth:i,lowerWidth:r,width:a,height:s}),[e,n,i,r,a,s]);return E.createElement(pQ.Provider,{value:l},o)},mQ=()=>{var t=E.useContext(pQ),e=Pw();return t||kK(e)},fje=E.createContext(null),hje=()=>{var t=E.useContext(fje),e=At(aZ);return t||e},pje=t=>{var{value:e,formatter:n}=t,i=gi(t.children)?e:t.children;return typeof n=="function"?n(i):i},CO=t=>t!=null&&typeof t=="function",mje=(t,e)=>{var n=Er(e-t),i=Math.min(Math.abs(e-t),360);return n*i},gje=(t,e,n,i,r)=>{var{offset:a,className:s}=t,{cx:o,cy:l,innerRadius:c,outerRadius:d,startAngle:f,endAngle:m,clockWise:g}=r,y=(c+d)/2,_=mje(f,m),v=_>=0?1:-1,x,M;switch(e){case"insideStart":x=f+v*a,M=g;break;case"insideEnd":x=m-v*a,M=!g;break;case"end":x=m+v*a,M=g;break;default:throw new Error("Unsupported position ".concat(e))}M=_<=0?M:!M;var w=Gi(o,l,y,x),T=Gi(o,l,y,x+(M?1:-1)*359),C="M".concat(w.x,",").concat(w.y,`
  8216. A`).concat(y,",").concat(y,",0,1,").concat(M?0:1,`,
  8217. `).concat(T.x,",").concat(T.y),P=gi(t.id)?sx("recharts-radial-line-"):t.id;return E.createElement("text",ql({},i,{dominantBaseline:"central",className:En("recharts-radial-bar-label",s)}),E.createElement("defs",null,E.createElement("path",{id:P,d:C})),E.createElement("textPath",{xlinkHref:"#".concat(P)},n))},xje=(t,e,n)=>{var{cx:i,cy:r,innerRadius:a,outerRadius:s,startAngle:o,endAngle:l}=t,c=(o+l)/2;if(n==="outside"){var{x:d,y:f}=Gi(i,r,s+e,c);return{x:d,y:f,textAnchor:d>=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 m=(a+s)/2,{x:g,y}=Gi(i,r,m,c);return{x:g,y,textAnchor:"middle",verticalAnchor:"middle"}},ZR=t=>"cx"in t&&Et(t.cx),vje=(t,e)=>{var{parentViewBox:n,offset:i,position:r}=t,a;n!=null&&!ZR(n)&&(a=n);var{x:s,y:o,upperWidth:l,lowerWidth:c,height:d}=e,f=s,m=s+(l-c)/2,g=(f+m)/2,y=(l+c)/2,_=f+l/2,v=d>=0?1:-1,x=v*i,M=v>0?"end":"start",w=v>0?"start":"end",T=l>=0?1:-1,C=T*i,P=T>0?"end":"start",A=T>0?"start":"end";if(r==="top"){var U={x:f+l/2,y:o-x,textAnchor:"middle",verticalAnchor:M};return Pi(Pi({},U),a?{height:Math.max(o-a.y,0),width:l}:{})}if(r==="bottom"){var N={x:m+c/2,y:o+d+x,textAnchor:"middle",verticalAnchor:w};return Pi(Pi({},N),a?{height:Math.max(a.y+a.height-(o+d),0),width:c}:{})}if(r==="left"){var D={x:g-C,y:o+d/2,textAnchor:P,verticalAnchor:"middle"};return Pi(Pi({},D),a?{width:Math.max(D.x-a.x,0),height:d}:{})}if(r==="right"){var F={x:g+y+C,y:o+d/2,textAnchor:A,verticalAnchor:"middle"};return Pi(Pi({},F),a?{width:Math.max(a.x+a.width-F.x,0),height:d}:{})}var I=a?{width:y,height:d}:{};return r==="insideLeft"?Pi({x:g+C,y:o+d/2,textAnchor:A,verticalAnchor:"middle"},I):r==="insideRight"?Pi({x:g+y-C,y:o+d/2,textAnchor:P,verticalAnchor:"middle"},I):r==="insideTop"?Pi({x:f+l/2,y:o+x,textAnchor:"middle",verticalAnchor:w},I):r==="insideBottom"?Pi({x:m+c/2,y:o+d-x,textAnchor:"middle",verticalAnchor:M},I):r==="insideTopLeft"?Pi({x:f+C,y:o+x,textAnchor:A,verticalAnchor:w},I):r==="insideTopRight"?Pi({x:f+l-C,y:o+x,textAnchor:P,verticalAnchor:w},I):r==="insideBottomLeft"?Pi({x:m+C,y:o+d-x,textAnchor:A,verticalAnchor:M},I):r==="insideBottomRight"?Pi({x:m+c-C,y:o+d-x,textAnchor:P,verticalAnchor:M},I):r&&typeof r=="object"&&(Et(r.x)||gc(r.x))&&(Et(r.y)||gc(r.y))?Pi({x:s+ia(r.x,y),y:o+ia(r.y,d),textAnchor:"end",verticalAnchor:"end"},I):Pi({x:_,y:o+d/2,textAnchor:"middle",verticalAnchor:"middle"},I)},yje={angle:0,offset:5,zIndex:Wi.label,position:"middle",textBreakAll:!1};function Su(t){var e=Yi(t,yje),{viewBox:n,position:i,value:r,children:a,content:s,className:o="",textBreakAll:l,labelRef:c}=e,d=hje(),f=mQ(),m=i==="center"?f:d??f,g,y,_;if(n==null?g=m:ZR(n)?g=n:g=kK(n),!g||gi(r)&&gi(a)&&!E.isValidElement(s)&&typeof s!="function")return null;var v=Pi(Pi({},e),{},{viewBox:g});if(E.isValidElement(s)){var{labelRef:x}=v,M=sje(v,aje);return E.cloneElement(s,M)}if(typeof s=="function"){if(y=E.createElement(s,v),E.isValidElement(y))return y}else y=pje(e);var w=_a(e);if(ZR(g)){if(i==="insideStart"||i==="insideEnd"||i==="end")return gje(e,i,y,w,g);_=xje(g,e.offset,e.position)}else _=vje(e,g);return E.createElement(Va,{zIndex:e.zIndex},E.createElement(eM,ql({ref:c,className:En("recharts-label",o)},w,_,{textAnchor:eje(w.textAnchor)?w.textAnchor:_.textAnchor,breakAll:l}),y))}Su.displayName="Label";var bje=(t,e,n)=>{if(!t)return null;var i={viewBox:e,labelRef:n};return t===!0?E.createElement(Su,ql({key:"label-implicit"},i)):nl(t)?E.createElement(Su,ql({key:"label-implicit",value:t},i)):E.isValidElement(t)?t.type===Su?E.cloneElement(t,Pi({key:"label-implicit"},i)):E.createElement(Su,ql({key:"label-implicit",content:t},i)):CO(t)?E.createElement(Su,ql({key:"label-implicit",content:t},i)):t&&typeof t=="object"?E.createElement(Su,ql({},t,{key:"label-implicit"},i)):null};function _je(t){var{label:e,labelRef:n}=t,i=mQ();return bje(e,i,n)||null}var FC={},zC={},HV;function Sje(){return HV||(HV=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});function e(n){return n[n.length-1]}t.last=e})(zC)),zC}var BC={},VV;function wje(){return VV||(VV=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});function e(n){return Array.isArray(n)?n:Array.from(n)}t.toArray=e})(BC)),BC}var $V;function Mje(){return $V||($V=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=Sje(),n=wje(),i=nk();function r(a){if(i.isArrayLike(a))return e.last(n.toArray(a))}t.last=r})(FC)),FC}var HC,GV;function Eje(){return GV||(GV=1,HC=Mje().last),HC}var Aje=Eje();const Tje=Ks(Aje);var Cje=["valueAccessor"],Nje=["dataKey","clockWise","id","textBreakAll","zIndex"];function SS(){return SS=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},SS.apply(null,arguments)}function WV(t,e){if(t==null)return{};var n,i,r=Rje(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 Rje(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 Pje=t=>Array.isArray(t.value)?Tje(t.value):t.value,gQ=E.createContext(void 0),xQ=gQ.Provider,vQ=E.createContext(void 0),Dje=vQ.Provider;function kje(){return E.useContext(gQ)}function Oje(){return E.useContext(vQ)}function M_(t){var{valueAccessor:e=Pje}=t,n=WV(t,Cje),{dataKey:i,clockWise:r,id:a,textBreakAll:s,zIndex:o}=n,l=WV(n,Nje),c=kje(),d=Oje(),f=c||d;return!f||!f.length?null:E.createElement(Va,{zIndex:o??Wi.label},E.createElement(Oi,{className:"recharts-label-list"},f.map((m,g)=>{var y,_=gi(i)?e(m,g):Kn(m&&m.payload,i),v=gi(a)?{}:{id:"".concat(a,"-").concat(g)};return E.createElement(Su,SS({key:"label-".concat(g)},_a(m),l,v,{fill:(y=n.fill)!==null&&y!==void 0?y:m.fill,parentViewBox:m.parentViewBox,value:_,textBreakAll:s,viewBox:m.viewBox,index:g,zIndex:0}))})))}M_.displayName="LabelList";function NO(t){var{label:e}=t;return e?e===!0?E.createElement(M_,{key:"labelList-implicit"}):E.isValidElement(e)||CO(e)?E.createElement(M_,{key:"labelList-implicit",content:e}):typeof e=="object"?E.createElement(M_,SS({key:"labelList-implicit"},e,{type:String(e.type)})):null:null}function QR(){return QR=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},QR.apply(null,arguments)}var yQ=t=>{var{cx:e,cy:n,r:i,className:r}=t,a=En("recharts-dot",r);return Et(e)&&Et(n)&&Et(i)?E.createElement("circle",QR({},za(t),tk(t),{className:a,cx:e,cy:n,r:i})):null},bQ=t=>t.graphicalItems.polarItems,Lje=He([fi,ev],Zk),tM=He([bQ,vi,Lje],Qk),Ije=He([tM],Jk),nM=He([Ije,Bk],eO),Uje=He([nM,vi,tM],nO);He([nM,vi,tM],(t,e,n)=>n.length>0?t.flatMap(i=>n.flatMap(r=>{var a,s=Kn(i,(a=e.dataKey)!==null&&a!==void 0?a:r.dataKey);return{value:s,errorDomain:[]}})).filter(Boolean):e?.dataKey!=null?t.map(i=>({value:Kn(i,e.dataKey),errorDomain:[]})):t.map(i=>({value:i,errorDomain:[]})));var qV=()=>{},jje=He([nM,vi,tM,Zw,fi],sO),Fje=He([vi,rO,aO,qV,jje,qV,_n,fi],oO),_Q=He([vi,_n,nM,Uje,Jx,fi,Fje],lO),zje=He([_Q,vi,Tm],dO);He([vi,_Q,zje,fi],hO);var Bje={radiusAxis:{},angleAxis:{}},SQ=Ha({name:"polarAxis",initialState:Bje,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:xGe,removeRadiusAxis:vGe,addAngleAxis:yGe,removeAngleAxis:bGe}=SQ.actions,Hje=SQ.reducer;function XV(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 KV(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?XV(Object(n),!0).forEach(function(i){Vje(t,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):XV(Object(n)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(n,i))})}return t}function Vje(t,e,n){return(e=$je(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function $je(t){var e=Gje(t,"string");return typeof e=="symbol"?e:e+""}function Gje(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 Wje=(t,e)=>e,RO=He([bQ,Wje],(t,e)=>t.filter(n=>n.type==="pie").find(n=>n.id===e)),qje=[],PO=(t,e,n)=>n?.length===0?qje:n,wQ=He([Bk,RO,PO],(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=>KV(KV({},e.presentationProps),a.props))),r!=null)return r}}),Xje=He([wQ,RO,PO],(t,e,n)=>{if(!(t==null||e==null))return t.map((i,r)=>{var a,s=Kn(i,e.nameKey,e.name),o;return n!=null&&(a=n[r])!==null&&a!==void 0&&(a=a.props)!==null&&a!==void 0&&a.fill?o=n[r].props.fill:typeof i=="object"&&i!=null&&"fill"in i?o=i.fill:o=e.fill,{value:ym(s,e.dataKey),color:o,payload:i,type:e.legendType}})}),Kje=He([wQ,RO,PO,cr],(t,e,n,i)=>{if(!(e==null||t==null))return YFe({offset:i,pieSettings:e,displayedData:t,cells:n})}),VC={exports:{}},Fn={};var YV;function Yje(){if(YV)return Fn;YV=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"),o=Symbol.for("react.forward_ref"),l=Symbol.for("react.suspense"),c=Symbol.for("react.suspense_list"),d=Symbol.for("react.memo"),f=Symbol.for("react.lazy"),m=Symbol.for("react.view_transition"),g=Symbol.for("react.client.reference");function y(_){if(typeof _=="object"&&_!==null){var v=_.$$typeof;switch(v){case t:switch(_=_.type,_){case n:case r:case i:case l:case c:case m:return _;default:switch(_=_&&_.$$typeof,_){case s:case o:case f:case d:return _;case a:return _;default:return v}}case e:return v}}}return Fn.ContextConsumer=a,Fn.ContextProvider=s,Fn.Element=t,Fn.ForwardRef=o,Fn.Fragment=n,Fn.Lazy=f,Fn.Memo=d,Fn.Portal=e,Fn.Profiler=r,Fn.StrictMode=i,Fn.Suspense=l,Fn.SuspenseList=c,Fn.isContextConsumer=function(_){return y(_)===a},Fn.isContextProvider=function(_){return y(_)===s},Fn.isElement=function(_){return typeof _=="object"&&_!==null&&_.$$typeof===t},Fn.isForwardRef=function(_){return y(_)===o},Fn.isFragment=function(_){return y(_)===n},Fn.isLazy=function(_){return y(_)===f},Fn.isMemo=function(_){return y(_)===d},Fn.isPortal=function(_){return y(_)===e},Fn.isProfiler=function(_){return y(_)===r},Fn.isStrictMode=function(_){return y(_)===i},Fn.isSuspense=function(_){return y(_)===l},Fn.isSuspenseList=function(_){return y(_)===c},Fn.isValidElementType=function(_){return typeof _=="string"||typeof _=="function"||_===n||_===r||_===i||_===l||_===c||typeof _=="object"&&_!==null&&(_.$$typeof===f||_.$$typeof===d||_.$$typeof===s||_.$$typeof===a||_.$$typeof===o||_.$$typeof===g||_.getModuleId!==void 0)},Fn.typeOf=y,Fn}var ZV;function Zje(){return ZV||(ZV=1,VC.exports=Yje()),VC.exports}var Qje=Zje(),QV=t=>typeof t=="string"?t:t?t.displayName||t.name||"Component":"",JV=null,$C=null,MQ=t=>{if(t===JV&&Array.isArray($C))return $C;var e=[];return E.Children.forEach(t,n=>{gi(n)||(Qje.isFragment(n)?e=e.concat(MQ(n.props.children)):e.push(n))}),$C=e,JV=t,e};function DO(t,e){var n=[],i=[];return Array.isArray(e)?i=e.map(r=>QV(r)):i=[QV(e)],MQ(t).forEach(r=>{var a=Of(r,"type.displayName")||Of(r,"type.name");a&&i.indexOf(a)!==-1&&n.push(r)}),n}var EQ=t=>t&&typeof t=="object"&&"clipDot"in t?!!t.clipDot:!0,GC={},e$;function Jje(){return e$||(e$=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})(GC)),GC}var WC,t$;function eFe(){return t$||(t$=1,WC=Jje().isPlainObject),WC}var tFe=eFe();const nFe=Ks(tFe);function n$(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 i$(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?n$(Object(n),!0).forEach(function(i){iFe(t,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):n$(Object(n)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(n,i))})}return t}function iFe(t,e,n){return(e=rFe(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function rFe(t){var e=aFe(t,"string");return typeof e=="symbol"?e:e+""}function aFe(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 wS(){return wS=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},wS.apply(null,arguments)}var r$=(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},sFe={x:0,y:0,upperWidth:0,lowerWidth:0,height:0,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},oFe=t=>{var e=Yi(t,sFe),{x:n,y:i,upperWidth:r,lowerWidth:a,height:s,className:o}=e,{animationEasing:l,animationDuration:c,animationBegin:d,isUpdateAnimationActive:f}=e,m=E.useRef(null),[g,y]=E.useState(-1),_=E.useRef(r),v=E.useRef(a),x=E.useRef(s),M=E.useRef(n),w=E.useRef(i),T=Xx(t,"trapezoid-");if(E.useEffect(()=>{if(m.current&&m.current.getTotalLength)try{var O=m.current.getTotalLength();O&&y(O)}catch{}},[]),n!==+n||i!==+i||r!==+r||a!==+a||s!==+s||r===0&&a===0||s===0)return null;var C=En("recharts-trapezoid",o);if(!f)return E.createElement("g",null,E.createElement("path",wS({},_a(e),{className:C,d:r$(n,i,r,a,s)})));var P=_.current,A=v.current,U=x.current,N=M.current,D=w.current,F="0px ".concat(g===-1?1:g,"px"),I="".concat(g,"px 0px"),W=qK(["strokeDasharray"],c,l);return E.createElement(qx,{animationId:T,key:T,canBegin:g>0,duration:c,easing:l,isActive:f,begin:d},O=>{var B=si(P,r,O),H=si(A,a,O),$=si(U,s,O),K=si(N,n,O),Z=si(D,i,O);m.current&&(_.current=B,v.current=H,x.current=$,M.current=K,w.current=Z);var se=O>0?{transition:W,strokeDasharray:I}:{strokeDasharray:F};return E.createElement("path",wS({},_a(e),{className:C,d:r$(K,Z,B,H,$),ref:m,style:i$(i$({},se),e.style)}))})},lFe=["option","shapeType","propTransformer","activeClassName"];function cFe(t,e){if(t==null)return{};var n,i,r=uFe(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 uFe(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 a$(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 MS(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?a$(Object(n),!0).forEach(function(i){dFe(t,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):a$(Object(n)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(n,i))})}return t}function dFe(t,e,n){return(e=fFe(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function fFe(t){var e=hFe(t,"string");return typeof e=="symbol"?e:e+""}function hFe(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 pFe(t,e){return MS(MS({},e),t)}function mFe(t,e){return t==="symbols"}function s$(t){var{shapeType:e,elementProps:n}=t;switch(e){case"rectangle":return E.createElement(ZK,n);case"trapezoid":return E.createElement(oFe,n);case"sector":return E.createElement(tY,n);case"symbols":if(mFe(e))return E.createElement(ek,n);break;case"curve":return E.createElement(kp,n);default:return null}}function gFe(t){return E.isValidElement(t)?t.props:t}function AQ(t){var{option:e,shapeType:n,propTransformer:i=pFe,activeClassName:r="recharts-active-shape"}=t,a=cFe(t,lFe),s;if(E.isValidElement(e))s=E.cloneElement(e,MS(MS({},a),gFe(e)));else if(typeof e=="function")s=e(a,a.index);else if(nFe(e)&&typeof e!="boolean"){var o=i(e,a);s=E.createElement(s$,{shapeType:n,elementProps:o})}else{var l=a;s=E.createElement(s$,{shapeType:n,elementProps:l})}return a.isActive?E.createElement(Oi,{className:r},s):s}var kO=(t,e,n)=>{var i=ei();return(r,a)=>s=>{t?.(r,a,s),i(IZ({activeIndex:String(a),activeDataKey:e,activeCoordinate:r.tooltipPosition,activeGraphicalItemId:n}))}},OO=t=>{var e=ei();return(n,i)=>r=>{t?.(n,i,r),e(NIe())}},LO=(t,e,n)=>{var i=ei();return(r,a)=>s=>{t?.(r,a,s),i(RIe({activeIndex:String(a),activeDataKey:e,activeCoordinate:r.tooltipPosition,activeGraphicalItemId:n}))}};function IO(t){var{tooltipEntrySettings:e}=t,n=ei(),i=sa(),r=E.useRef(null);return E.useLayoutEffect(()=>{i||(r.current===null?n(EIe(e)):r.current!==e&&n(AIe({prev:r.current,next:e})),r.current=e)},[e,n,i]),E.useLayoutEffect(()=>()=>{r.current&&(n(TIe(r.current)),r.current=null)},[n]),null}function TQ(t){var{legendPayload:e}=t,n=ei(),i=sa(),r=E.useRef(null);return E.useLayoutEffect(()=>{i||(r.current===null?n(HK(e)):r.current!==e&&n(VK({prev:r.current,next:e})),r.current=e)},[n,i,e]),E.useLayoutEffect(()=>()=>{r.current&&(n($K(r.current)),r.current=null)},[n]),null}function xFe(t){var{legendPayload:e}=t,n=ei(),i=At(_n),r=E.useRef(null);return E.useLayoutEffect(()=>{i!=="centric"&&i!=="radial"||(r.current===null?n(HK(e)):r.current!==e&&n(VK({prev:r.current,next:e})),r.current=e)},[n,i,e]),E.useLayoutEffect(()=>()=>{r.current&&(n($K(r.current)),r.current=null)},[n]),null}var qC,vFe=()=>{var[t]=E.useState(()=>sx("uid-"));return t},yFe=(qC=Wte.useId)!==null&&qC!==void 0?qC:vFe;function CQ(t,e){var n=yFe();return e||(t?"".concat(t,"-").concat(n):n)}var bFe=E.createContext(void 0),UO=t=>{var{id:e,type:n,children:i}=t,r=CQ("recharts-".concat(n),e);return E.createElement(bFe.Provider,{value:r},i(r))},_Fe={cartesianItems:[],polarItems:[]},NQ=Ha({name:"graphicalItems",initialState:_Fe,reducers:{addCartesianGraphicalItem:{reducer(t,e){t.cartesianItems.push(e.payload)},prepare:ci()},replaceCartesianGraphicalItem:{reducer(t,e){var{prev:n,next:i}=e.payload,r=yo(t).cartesianItems.indexOf(n);r>-1&&(t.cartesianItems[r]=i)},prepare:ci()},removeCartesianGraphicalItem:{reducer(t,e){var n=yo(t).cartesianItems.indexOf(e.payload);n>-1&&t.cartesianItems.splice(n,1)},prepare:ci()},addPolarGraphicalItem:{reducer(t,e){t.polarItems.push(e.payload)},prepare:ci()},removePolarGraphicalItem:{reducer(t,e){var n=yo(t).polarItems.indexOf(e.payload);n>-1&&t.polarItems.splice(n,1)},prepare:ci()}}}),{addCartesianGraphicalItem:SFe,replaceCartesianGraphicalItem:wFe,removeCartesianGraphicalItem:MFe,addPolarGraphicalItem:EFe,removePolarGraphicalItem:AFe}=NQ.actions,TFe=NQ.reducer,CFe=t=>{var e=ei(),n=E.useRef(null);return E.useLayoutEffect(()=>{n.current===null?e(SFe(t)):n.current!==t&&e(wFe({prev:n.current,next:t})),n.current=t},[e,t]),E.useLayoutEffect(()=>()=>{n.current&&(e(MFe(n.current)),n.current=null)},[e]),null},RQ=E.memo(CFe);function NFe(t){var e=ei();return E.useLayoutEffect(()=>(e(EFe(t)),()=>{e(AFe(t))}),[e,t]),null}var RFe=["key"],PFe=["onMouseEnter","onClick","onMouseLeave"],DFe=["id"],kFe=["id"];function o$(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 wi(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?o$(Object(n),!0).forEach(function(i){OFe(t,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):o$(Object(n)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(n,i))})}return t}function OFe(t,e,n){return(e=LFe(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function LFe(t){var e=IFe(t,"string");return typeof e=="symbol"?e:e+""}function IFe(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 td(){return td=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},td.apply(null,arguments)}function iM(t,e){if(t==null)return{};var n,i,r=UFe(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 UFe(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 jFe(t){var e=E.useMemo(()=>DO(t.children,cv),[t.children]),n=At(i=>Xje(i,t.id,e));return n==null?null:E.createElement(xFe,{legendPayload:n})}var FFe=E.memo(t=>{var{dataKey:e,nameKey:n,sectors:i,stroke:r,strokeWidth:a,fill:s,name:o,hide:l,tooltipType:c}=t,d={dataDefinedOnItem:i.map(f=>f.tooltipPayload),positions:i.map(f=>f.tooltipPosition),settings:{stroke:r,strokeWidth:a,fill:s,dataKey:e,nameKey:n,name:ym(o,e),hide:l,type:c,color:s,unit:""}};return E.createElement(IO,{tooltipEntrySettings:d})}),zFe=(t,e)=>t>e?"start":t<e?"end":"middle",BFe=(t,e,n)=>ia(typeof e=="function"?e(t):e,n,n*.8),HFe=(t,e,n)=>{var{top:i,left:r,width:a,height:s}=e,o=QK(a,s),l=r+ia(t.cx,a,a/2),c=i+ia(t.cy,s,s/2),d=ia(t.innerRadius,o,0),f=BFe(n,t.outerRadius,o),m=t.maxRadius||Math.sqrt(a*a+s*s)/2;return{cx:l,cy:c,innerRadius:d,outerRadius:f,maxRadius:m}},VFe=(t,e)=>{var n=Er(e-t),i=Math.min(Math.abs(e-t),360);return n*i};function $Fe(t){return t&&typeof t=="object"&&"className"in t&&typeof t.className=="string"?t.className:""}var GFe=(t,e)=>{if(E.isValidElement(t))return E.cloneElement(t,e);if(typeof t=="function")return t(e);var n=En("recharts-pie-label-line",typeof t!="boolean"?t.className:""),{key:i}=e,r=iM(e,RFe);return E.createElement(kp,td({},r,{type:"linear",className:n}))},WFe=(t,e,n)=>{if(E.isValidElement(t))return E.cloneElement(t,e);var i=n;if(typeof t=="function"&&(i=t(e),E.isValidElement(i)))return i;var r=En("recharts-pie-label-text",$Fe(t));return E.createElement(eM,td({},e,{alignmentBaseline:"middle",className:r}),i)};function qFe(t){var{sectors:e,props:n,showLabels:i}=t,{label:r,labelLine:a,dataKey:s}=n;if(!i||!r||!e)return null;var o=za(n),l=kf(r),c=kf(a),d=typeof r=="object"&&"offsetRadius"in r&&typeof r.offsetRadius=="number"&&r.offsetRadius||20,f=e.map((m,g)=>{var y=(m.startAngle+m.endAngle)/2,_=Gi(m.cx,m.cy,m.outerRadius+d,y),v=wi(wi(wi(wi({},o),m),{},{stroke:"none"},l),{},{index:g,textAnchor:zFe(_.x,m.cx)},_),x=wi(wi(wi(wi({},o),m),{},{fill:"none",stroke:m.fill},c),{},{index:g,points:[Gi(m.cx,m.cy,m.outerRadius,y),_],key:"line"});return E.createElement(Va,{zIndex:Wi.label,key:"label-".concat(m.startAngle,"-").concat(m.endAngle,"-").concat(m.midAngle,"-").concat(g)},E.createElement(Oi,null,a&&GFe(a,x),WFe(r,v,Kn(m,s))))});return E.createElement(Oi,{className:"recharts-pie-labels"},f)}function XFe(t){var{sectors:e,props:n,showLabels:i}=t,{label:r}=n;return typeof r=="object"&&r!=null&&"position"in r?E.createElement(NO,{label:r}):E.createElement(qFe,{sectors:e,props:n,showLabels:i})}function KFe(t){var{sectors:e,activeShape:n,inactiveShape:i,allOtherPieProps:r,shape:a,id:s}=t,o=At(ed),l=At(SO),c=At(m4e),{onMouseEnter:d,onClick:f,onMouseLeave:m}=r,g=iM(r,PFe),y=kO(d,r.dataKey,s),_=OO(m),v=LO(f,r.dataKey,s);return e==null||e.length===0?null:E.createElement(E.Fragment,null,e.map((x,M)=>{if(x?.startAngle===0&&x?.endAngle===0&&e.length!==1)return null;var w=c==null||c===s,T=String(M)===o&&(l==null||r.dataKey===l)&&w,C=o?i:null,P=n&&T?n:C,A=wi(wi({},x),{},{stroke:x.stroke,tabIndex:-1,[CK]:M,[NK]:r.dataKey});return E.createElement(Oi,td({key:"sector-".concat(x?.startAngle,"-").concat(x?.endAngle,"-").concat(x.midAngle,"-").concat(M),tabIndex:-1,className:"recharts-pie-sector"},Bx(g,x,M),{onMouseEnter:y(x,M),onMouseLeave:_(x,M),onClick:v(x,M)}),E.createElement(AQ,td({option:a??P,index:M,shapeType:"sector",isActive:T},A)))}))}function YFe(t){var e,{pieSettings:n,displayedData:i,cells:r,offset:a}=t,{cornerRadius:s,startAngle:o,endAngle:l,dataKey:c,nameKey:d,tooltipType:f}=n,m=Math.abs(n.minAngle),g=VFe(o,l),y=Math.abs(g),_=i.length<=1?0:(e=n.paddingAngle)!==null&&e!==void 0?e:0,v=i.filter(P=>Kn(P,c,0)!==0).length,x=(y>=360?v:v-1)*_,M=y-v*m-x,w=i.reduce((P,A)=>{var U=Kn(A,c,0);return P+(Et(U)?U:0)},0),T;if(w>0){var C;T=i.map((P,A)=>{var U=Kn(P,c,0),N=Kn(P,d,A),D=HFe(n,a,P),F=(Et(U)?U:0)/w,I,W=wi(wi({},P),r&&r[A]&&r[A].props);A?I=C.endAngle+Er(g)*_*(U!==0?1:0):I=o;var O=I+Er(g)*((U!==0?m:0)+F*M),B=(I+O)/2,H=(D.innerRadius+D.outerRadius)/2,$=[{name:N,value:U,payload:W,dataKey:c,type:f}],K=Gi(D.cx,D.cy,H,B);return C=wi(wi(wi(wi({},n.presentationProps),{},{percent:F,cornerRadius:typeof s=="string"?parseFloat(s):s,name:N,tooltipPayload:$,midAngle:B,middleRadius:H,tooltipPosition:K},W),D),{},{value:U,dataKey:c,startAngle:I,endAngle:O,payload:W,paddingAngle:Er(g)*_}),C})}return T}function ZFe(t){var{showLabels:e,sectors:n,children:i}=t,r=E.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 E.createElement(Dje,{value:e?r:void 0},i)}function QFe(t){var{props:e,previousSectorsRef:n,id:i}=t,{sectors:r,isAnimationActive:a,animationBegin:s,animationDuration:o,animationEasing:l,activeShape:c,inactiveShape:d,onAnimationStart:f,onAnimationEnd:m}=e,g=Xx(e,"recharts-pie-"),y=n.current,[_,v]=E.useState(!1),x=E.useCallback(()=>{typeof m=="function"&&m(),v(!1)},[m]),M=E.useCallback(()=>{typeof f=="function"&&f(),v(!0)},[f]);return E.createElement(ZFe,{showLabels:!_,sectors:r},E.createElement(qx,{animationId:g,begin:s,duration:o,isActive:a,easing:l,onAnimationStart:M,onAnimationEnd:x,key:g},w=>{var T=[],C=r&&r[0],P=C?.startAngle;return r?.forEach((A,U)=>{var N=y&&y[U],D=U>0?Of(A,"paddingAngle",0):0;if(N){var F=si(N.endAngle-N.startAngle,A.endAngle-A.startAngle,w),I=wi(wi({},A),{},{startAngle:P+D,endAngle:P+F+D});T.push(I),P=I.endAngle}else{var{endAngle:W,startAngle:O}=A,B=si(0,W-O,w),H=wi(wi({},A),{},{startAngle:P+D,endAngle:P+B+D});T.push(H),P=H.endAngle}}),n.current=T,E.createElement(Oi,null,E.createElement(KFe,{sectors:T,activeShape:c,inactiveShape:d,allOtherPieProps:e,shape:e.shape,id:i}))}),E.createElement(XFe,{showLabels:!_,sectors:r,props:e}),e.children)}var JFe={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:Wi.area};function eze(t){var{id:e}=t,n=iM(t,DFe),{hide:i,className:r,rootTabIndex:a}=t,s=E.useMemo(()=>DO(t.children,cv),[t.children]),o=At(d=>Kje(d,e,s)),l=E.useRef(null),c=En("recharts-pie",r);return i||o==null?(l.current=null,E.createElement(Oi,{tabIndex:a,className:c})):E.createElement(Va,{zIndex:t.zIndex},E.createElement(FFe,{dataKey:t.dataKey,nameKey:t.nameKey,sectors:o,stroke:t.stroke,strokeWidth:t.strokeWidth,fill:t.fill,name:t.name,hide:t.hide,tooltipType:t.tooltipType}),E.createElement(Oi,{tabIndex:a,className:c},E.createElement(QFe,{props:wi(wi({},n),{},{sectors:o}),previousSectorsRef:l,id:e})))}function PQ(t){var e=Yi(t,JFe),{id:n}=e,i=iM(e,kFe),r=za(i);return E.createElement(UO,{id:n,type:"pie"},a=>E.createElement(E.Fragment,null,E.createElement(NFe,{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}),E.createElement(jFe,td({},i,{id:a})),E.createElement(eze,td({},i,{id:a}))))}PQ.displayName="Pie";var tze=["points"];function l$(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 XC(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?l$(Object(n),!0).forEach(function(i){nze(t,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):l$(Object(n)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(n,i))})}return t}function nze(t,e,n){return(e=ize(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function ize(t){var e=rze(t,"string");return typeof e=="symbol"?e:e+""}function rze(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 ES(){return ES=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},ES.apply(null,arguments)}function aze(t,e){if(t==null)return{};var n,i,r=sze(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 sze(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 oze(t){var{option:e,dotProps:n,className:i}=t;if(E.isValidElement(e))return E.cloneElement(e,n);if(typeof e=="function")return e(n);var r=En(i,typeof e!="boolean"?e.className:""),a=n??{},{points:s}=a,o=aze(a,tze);return E.createElement(yQ,ES({},o,{className:r}))}function lze(t,e){return t==null?!1:e?!0:t.length===1}function cze(t){var{points:e,dot:n,className:i,dotClassName:r,dataKey:a,baseProps:s,needClip:o,clipPathId:l,zIndex:c=Wi.scatter}=t;if(!lze(e,n))return null;var d=EQ(n),f=F2e(n),m=e.map((y,_)=>{var v,x,M=XC(XC(XC({r:3},s),f),{},{index:_,cx:(v=y.x)!==null&&v!==void 0?v:void 0,cy:(x=y.y)!==null&&x!==void 0?x:void 0,dataKey:a,value:y.value,payload:y.payload,points:e});return E.createElement(oze,{key:"dot-".concat(_),option:n,dotProps:M,className:r})}),g={};return o&&l!=null&&(g.clipPath="url(#clipPath-".concat(d?"":"dots-").concat(l,")")),E.createElement(Va,{zIndex:c},E.createElement(Oi,ES({className:i},g),m))}function c$(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 u$(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?c$(Object(n),!0).forEach(function(i){uze(t,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):c$(Object(n)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(n,i))})}return t}function uze(t,e,n){return(e=dze(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function dze(t){var e=fze(t,"string");return typeof e=="symbol"?e:e+""}function fze(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 hze={xAxis:{},yAxis:{},zAxis:{}},DQ=Ha({name:"cartesianAxis",initialState:hze,reducers:{addXAxis:{reducer(t,e){t.xAxis[e.payload.id]=e.payload},prepare:ci()},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:ci()},removeXAxis:{reducer(t,e){delete t.xAxis[e.payload.id]},prepare:ci()},addYAxis:{reducer(t,e){t.yAxis[e.payload.id]=e.payload},prepare:ci()},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:ci()},removeYAxis:{reducer(t,e){delete t.yAxis[e.payload.id]},prepare:ci()},addZAxis:{reducer(t,e){t.zAxis[e.payload.id]=e.payload},prepare:ci()},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:ci()},removeZAxis:{reducer(t,e){delete t.zAxis[e.payload.id]},prepare:ci()},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]=u$(u$({},t.yAxis[n]),{},{width:i,widthHistory:s})}}}}),{addXAxis:pze,replaceXAxis:mze,removeXAxis:gze,addYAxis:xze,replaceYAxis:vze,removeYAxis:yze,addZAxis:_Ge,replaceZAxis:SGe,removeZAxis:wGe,updateYAxisWidth:bze}=DQ.actions,_ze=DQ.reducer,Sze=He([cr],t=>({top:t.top,bottom:t.bottom,left:t.left,right:t.right})),wze=He([Sze,Ec,Ac],(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)}}),jO=()=>At(wze),Mze=()=>At(b4e);function d$(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 KC(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?d$(Object(n),!0).forEach(function(i){Eze(t,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):d$(Object(n)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(n,i))})}return t}function Eze(t,e,n){return(e=Aze(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Aze(t){var e=Tze(t,"string");return typeof e=="symbol"?e:e+""}function Tze(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 Cze=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 o={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},l=KC(KC(KC({},o),kf(r)),tk(r)),c;return E.isValidElement(r)?c=E.cloneElement(r,l):typeof r=="function"?c=r(l):c=E.createElement(yQ,l),E.createElement(Oi,{className:"recharts-active-dot",clipPath:s},c)};function f$(t){var{points:e,mainColor:n,activeDot:i,itemDataKey:r,clipPath:a,zIndex:s=Wi.activeDot}=t,o=At(ed),l=Mze();if(e==null||l==null)return null;var c=e.find(d=>l.includes(d.payload));return gi(c)?null:E.createElement(Va,{zIndex:s},E.createElement(Cze,{point:c,childIndex:Number(o),mainColor:n,dataKey:r,activeDot:i,clipPath:a}))}var Nze="Invariant failed";function Rze(t,e){throw new Error(Nze)}var Pze=["x","y"];function JR(){return JR=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},JR.apply(null,arguments)}function h$(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 Kg(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?h$(Object(n),!0).forEach(function(i){Dze(t,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):h$(Object(n)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(n,i))})}return t}function Dze(t,e,n){return(e=kze(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function kze(t){var e=Oze(t,"string");return typeof e=="symbol"?e:e+""}function Oze(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 Lze(t,e){if(t==null)return{};var n,i,r=Ize(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 Ize(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 Uze(t,e){var{x:n,y:i}=t,r=Lze(t,Pze),a="".concat(n),s=parseInt(a,10),o="".concat(i),l=parseInt(o,10),c="".concat(e.height||r.height),d=parseInt(c,10),f="".concat(e.width||r.width),m=parseInt(f,10);return Kg(Kg(Kg(Kg(Kg({},e),r),s?{x:s}:{}),l?{y:l}:{}),{},{height:d,width:m,name:e.name,radius:e.radius})}function AS(t){return E.createElement(AQ,JR({shapeType:"rectangle",propTransformer:Uze,activeClassName:"recharts-active-bar"},t))}var jze=function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return(i,r)=>{if(Et(e))return e;var a=Et(i)||gi(i);return a?e(i,r):(a||Rze(),n)}},Fze={},kQ=Ha({name:"errorBars",initialState:Fze,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:MGe,replaceErrorBar:EGe,removeErrorBar:AGe}=kQ.actions,zze=kQ.reducer,Bze=["children"];function Hze(t,e){if(t==null)return{};var n,i,r=Vze(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 Vze(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 $ze={data:[],xAxisId:"xAxis-0",yAxisId:"yAxis-0",dataPointFormatter:()=>({x:0,y:0,value:0}),errorBarOffset:0},Gze=E.createContext($ze);function Wze(t){var{children:e}=t,n=Hze(t,Bze);return E.createElement(Gze.Provider,{value:n},e)}function FO(t,e){var n,i,r=At(c=>Cc(c,t)),a=At(c=>Nc(c,e)),s=(n=r?.allowDataOverflow)!==null&&n!==void 0?n:br.allowDataOverflow,o=(i=a?.allowDataOverflow)!==null&&i!==void 0?i:_r.allowDataOverflow,l=s||o;return{needClip:l,needClipX:s,needClipY:o}}function OQ(t){var{xAxisId:e,yAxisId:n,clipPathId:i}=t,r=jO(),{needClipX:a,needClipY:s,needClip:o}=FO(e,n);if(!o||!r)return null;var{x:l,y:c,width:d,height:f}=r;return E.createElement("clipPath",{id:"clipPath-".concat(i)},E.createElement("rect",{x:a?l:l-d/2,y:s?c:c-f/2,width:a?d:d*2,height:s?f:f*2}))}function qze(t,e){return t&&typeof t=="object"&&"zIndex"in t&&typeof t.zIndex=="number"&&oi(t.zIndex)?t.zIndex:e}var YC={exports:{}},ZC={};var p$;function Xze(){if(p$)return ZC;p$=1;var t=lm();function e(l,c){return l===c&&(l!==0||1/l===1/c)||l!==l&&c!==c}var n=typeof Object.is=="function"?Object.is:e,i=t.useSyncExternalStore,r=t.useRef,a=t.useEffect,s=t.useMemo,o=t.useDebugValue;return ZC.useSyncExternalStoreWithSelector=function(l,c,d,f,m){var g=r(null);if(g.current===null){var y={hasValue:!1,value:null};g.current=y}else y=g.current;g=s(function(){function v(C){if(!x){if(x=!0,M=C,C=f(C),m!==void 0&&y.hasValue){var P=y.value;if(m(P,C))return w=P}return w=C}if(P=w,n(M,C))return P;var A=f(C);return m!==void 0&&m(P,A)?(M=C,P):(M=C,w=A)}var x=!1,M,w,T=d===void 0?null:d;return[function(){return v(c())},T===null?void 0:function(){return v(T())}]},[c,d,f,m]);var _=i(l,g[0],g[1]);return a(function(){y.hasValue=!0,y.value=_},[_]),o(_),_},ZC}var m$;function Kze(){return m$||(m$=1,YC.exports=Xze()),YC.exports}Kze();function Yze(t){t()}function Zze(){let t=null,e=null;return{clear(){t=null,e=null},notify(){Yze(()=>{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 g$={notify(){},get:()=>[]};function Qze(t,e){let n,i=g$,r=0,a=!1;function s(_){d();const v=i.subscribe(_);let x=!1;return()=>{x||(x=!0,v(),f())}}function o(){i.notify()}function l(){y.onStateChange&&y.onStateChange()}function c(){return a}function d(){r++,n||(n=t.subscribe(l),i=Zze())}function f(){r--,n&&r===0&&(n(),n=void 0,i.clear(),i=g$)}function m(){a||(a=!0,d())}function g(){a&&(a=!1,f())}const y={addNestedSub:s,notifyNestedSubs:o,handleChangeWrapper:l,isSubscribed:c,trySubscribe:m,tryUnsubscribe:g,getListeners:()=>i};return y}var Jze=()=>typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",e5e=Jze(),t5e=()=>typeof navigator<"u"&&navigator.product==="ReactNative",n5e=t5e(),i5e=()=>e5e||n5e?E.useLayoutEffect:E.useEffect,r5e=i5e();function x$(t,e){return t===e?t!==0||e!==0||1/t===1/e:t!==t&&e!==e}function a5e(t,e){if(x$(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])||!x$(t[n[r]],e[n[r]]))return!1;return!0}var s5e=Symbol.for("react-redux-context"),o5e=typeof globalThis<"u"?globalThis:{};function l5e(){if(!E.createContext)return{};const t=o5e[s5e]??=new Map;let e=t.get(E.createContext);return e||(e=E.createContext(null),t.set(E.createContext,e)),e}var c5e=l5e();function u5e(t){const{children:e,context:n,serverState:i,store:r}=t,a=E.useMemo(()=>{const l=Qze(r);return{store:r,subscription:l,getServerState:i?()=>i:void 0}},[r,i]),s=E.useMemo(()=>r.getState(),[r]);r5e(()=>{const{subscription:l}=a;return l.onStateChange=l.notifyNestedSubs,l.trySubscribe(),s!==r.getState()&&l.notifyNestedSubs(),()=>{l.tryUnsubscribe(),l.onStateChange=void 0}},[a,s]);const o=n||c5e;return E.createElement(o.Provider,{value:a},e)}var d5e=u5e,f5e=new Set(["axisLine","tickLine","activeBar","activeDot","activeLabel","activeShape","allowEscapeViewBox","background","cursor","dot","label","line","margin","padding","position","shape","style","tick","wrapperStyle"]);function h5e(t,e){return t==null&&e==null?!0:typeof t=="number"&&typeof e=="number"?t===e||t!==t&&e!==e:t===e}function rM(t,e){var n=new Set([...Object.keys(t),...Object.keys(e)]);for(var i of n)if(f5e.has(i)){if(t[i]==null&&e[i]==null)continue;if(!a5e(t[i],e[i]))return!1}else if(!h5e(t[i],e[i]))return!1;return!0}var p5e=["onMouseEnter","onMouseLeave","onClick"],m5e=["value","background","tooltipPosition"],g5e=["id"],x5e=["onMouseEnter","onClick","onMouseLeave"];function Sc(){return Sc=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},Sc.apply(null,arguments)}function v$(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 fa(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?v$(Object(n),!0).forEach(function(i){v5e(t,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):v$(Object(n)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(n,i))})}return t}function v5e(t,e,n){return(e=y5e(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function y5e(t){var e=b5e(t,"string");return typeof e=="symbol"?e:e+""}function b5e(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 TS(t,e){if(t==null)return{};var n,i,r=_5e(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 _5e(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 S5e=t=>{var{dataKey:e,name:n,fill:i,legendType:r,hide:a}=t;return[{inactive:a,dataKey:e,type:r,color:i,value:ym(n,e),payload:t}]},w5e=E.memo(t=>{var{dataKey:e,stroke:n,strokeWidth:i,fill:r,name:a,hide:s,unit:o,tooltipType:l}=t,c={dataDefinedOnItem:void 0,positions:void 0,settings:{stroke:n,strokeWidth:i,fill:r,dataKey:e,nameKey:void 0,name:ym(a,e),hide:s,type:l,color:r,unit:o}};return E.createElement(IO,{tooltipEntrySettings:c})});function M5e(t){var e=At(ed),{data:n,dataKey:i,background:r,allOtherBarProps:a}=t,{onMouseEnter:s,onMouseLeave:o,onClick:l}=a,c=TS(a,p5e),d=kO(s,i),f=OO(o),m=LO(l,i);if(!r||n==null)return null;var g=kf(r);return E.createElement(Va,{zIndex:qze(r,Wi.barBackground)},n.map((y,_)=>{var{value:v,background:x,tooltipPosition:M}=y,w=TS(y,m5e);if(!x)return null;var T=d(y,_),C=f(y,_),P=m(y,_),A=fa(fa(fa(fa(fa({option:r,isActive:String(_)===e},w),{},{fill:"#eee"},x),g),Bx(c,y,_)),{},{onMouseEnter:T,onMouseLeave:C,onClick:P,dataKey:i,index:_,className:"recharts-bar-background-rectangle"});return E.createElement(AS,Sc({key:"background-bar-".concat(_)},A))}))}function E5e(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 fa(fa({},s),{},{value:a.value,payload:a.payload,parentViewBox:a.parentViewBox,viewBox:s,fill:a.fill})});return E.createElement(xQ,{value:e?r:void 0},n)}function A5e(t){var{shape:e,activeBar:n,baseProps:i,entry:r,index:a,dataKey:s}=t,o=At(ed),l=At(SO),c=n&&String(a)===o&&(l==null||s===l),d=c?n:e;return c?E.createElement(Va,{zIndex:Wi.activeBar},E.createElement(AS,Sc({},i,{name:String(i.name)},r,{isActive:c,option:d,index:a,dataKey:s}))):E.createElement(AS,Sc({},i,{name:String(i.name)},r,{isActive:c,option:d,index:a,dataKey:s}))}function T5e(t){var{shape:e,baseProps:n,entry:i,index:r,dataKey:a}=t;return E.createElement(AS,Sc({},n,{name:String(n.name)},i,{isActive:!1,option:e,index:r,dataKey:a}))}function C5e(t){var e,{data:n,props:i}=t,r=(e=za(i))!==null&&e!==void 0?e:{},{id:a}=r,s=TS(r,g5e),{shape:o,dataKey:l,activeBar:c}=i,{onMouseEnter:d,onClick:f,onMouseLeave:m}=i,g=TS(i,x5e),y=kO(d,l),_=OO(m),v=LO(f,l);return n?E.createElement(E.Fragment,null,n.map((x,M)=>E.createElement(Oi,Sc({key:"rectangle-".concat(x?.x,"-").concat(x?.y,"-").concat(x?.value,"-").concat(M),className:"recharts-bar-rectangle"},Bx(g,x,M),{onMouseEnter:y(x,M),onMouseLeave:_(x,M),onClick:v(x,M)}),c?E.createElement(A5e,{shape:o,activeBar:c,baseProps:s,entry:x,index:M,dataKey:l}):E.createElement(T5e,{shape:o,baseProps:s,entry:x,index:M,dataKey:l})))):null}function N5e(t){var{props:e,previousRectanglesRef:n}=t,{data:i,layout:r,isAnimationActive:a,animationBegin:s,animationDuration:o,animationEasing:l,onAnimationEnd:c,onAnimationStart:d}=e,f=n.current,m=Xx(e,"recharts-bar-"),[g,y]=E.useState(!1),_=!g,v=E.useCallback(()=>{typeof c=="function"&&c(),y(!1)},[c]),x=E.useCallback(()=>{typeof d=="function"&&d(),y(!0)},[d]);return E.createElement(E5e,{showLabels:_,rects:i},E.createElement(qx,{animationId:m,begin:s,duration:o,isActive:a,easing:l,onAnimationEnd:v,onAnimationStart:x,key:m},M=>{var w=M===1?i:i?.map((T,C)=>{var P=f&&f[C];if(P)return fa(fa({},T),{},{x:si(P.x,T.x,M),y:si(P.y,T.y,M),width:si(P.width,T.width,M),height:si(P.height,T.height,M)});if(r==="horizontal"){var A=si(0,T.height,M),U=si(T.stackedBarStart,T.y,M);return fa(fa({},T),{},{y:U,height:A})}var N=si(0,T.width,M),D=si(T.stackedBarStart,T.x,M);return fa(fa({},T),{},{width:N,x:D})});return M>0&&(n.current=w??null),w==null?null:E.createElement(Oi,null,E.createElement(C5e,{props:e,data:w}))}),E.createElement(NO,{label:e.label}),e.children)}function R5e(t){var e=E.useRef(null);return E.createElement(N5e,{previousRectanglesRef:e,props:t})}var LQ=0,P5e=(t,e)=>{var n=Array.isArray(t.value)?t.value[1]:t.value;return{x:t.x,y:t.y,value:n,errorVal:Kn(t,e)}};class D5e extends E.PureComponent{render(){var{hide:e,data:n,dataKey:i,className:r,xAxisId:a,yAxisId:s,needClip:o,background:l,id:c}=this.props;if(e||n==null)return null;var d=En("recharts-bar",r),f=c;return E.createElement(Oi,{className:d,id:c},o&&E.createElement("defs",null,E.createElement(OQ,{clipPathId:f,xAxisId:a,yAxisId:s})),E.createElement(Oi,{className:"recharts-bar-rectangles",clipPath:o?"url(#clipPath-".concat(f,")"):void 0},E.createElement(M5e,{data:n,dataKey:i,background:l,allOtherBarProps:this.props}),E.createElement(R5e,this.props)))}}var k5e={activeBar:!1,animationBegin:0,animationDuration:400,animationEasing:"ease",background:!1,hide:!1,isAnimationActive:"auto",label:!1,legendType:"rect",minPointSize:LQ,xAxisId:0,yAxisId:0,zIndex:Wi.bar};function O5e(t){var{xAxisId:e,yAxisId:n,hide:i,legendType:r,minPointSize:a,activeBar:s,animationBegin:o,animationDuration:l,animationEasing:c,isAnimationActive:d}=t,{needClip:f}=FO(e,n),m=bm(),g=sa(),y=DO(t.children,cv),_=At(M=>lBe(M,e,n,g,t.id,y));if(m!=="vertical"&&m!=="horizontal")return null;var v,x=_?.[0];return x==null||x.height==null||x.width==null?v=0:v=m==="vertical"?x.height/2:x.width/2,E.createElement(Wze,{xAxisId:e,yAxisId:n,data:_,dataPointFormatter:P5e,errorBarOffset:v},E.createElement(D5e,Sc({},t,{layout:m,needClip:f,data:_,xAxisId:e,yAxisId:n,hide:i,legendType:r,minPointSize:a,activeBar:s,animationBegin:o,animationDuration:l,animationEasing:c,isAnimationActive:d})))}function L5e(t){var{layout:e,barSettings:{dataKey:n,minPointSize:i},pos:r,bandSize:a,xAxis:s,yAxis:o,xAxisTicks:l,yAxisTicks:c,stackedData:d,displayedData:f,offset:m,cells:g,parentViewBox:y,dataStartIndex:_}=t,v=e==="horizontal"?o:s,x=d?v.scale.domain():null,M=eRe({numericAxis:v}),w=v.scale(M);return f.map((T,C)=>{var P,A,U,N,D,F;d?P=K3e(d[C+_],x):(P=Kn(T,n),Array.isArray(P)||(P=[M,P]));var I=jze(i,LQ)(P[1],C);if(e==="horizontal"){var W,[O,B]=[o.scale(P[0]),o.scale(P[1])];A=O6({axis:s,ticks:l,bandSize:a,offset:r.offset,entry:T,index:C}),U=(W=B??O)!==null&&W!==void 0?W:void 0,N=r.size;var H=O-B;if(D=Ws(H)?0:H,F={x:A,y:m.top,width:N,height:m.height},Math.abs(I)>0&&Math.abs(D)<Math.abs(I)){var $=Er(D||I)*(Math.abs(I)-Math.abs(D));U-=$,D+=$}}else{var[K,Z]=[s.scale(P[0]),s.scale(P[1])];if(A=K,U=O6({axis:o,ticks:c,bandSize:a,offset:r.offset,entry:T,index:C}),N=Z-K,D=r.size,F={x:m.left,y:U,width:m.width,height:D},Math.abs(I)>0&&Math.abs(N)<Math.abs(I)){var se=Er(N||I)*(Math.abs(I)-Math.abs(N));N+=se}}if(A==null||U==null||N==null||D==null)return null;var V=fa(fa({},T),{},{stackedBarStart:w,x:A,y:U,width:N,height:D,value:d?P:P[1],payload:T,background:F,tooltipPosition:{x:A+N/2,y:U+D/2},parentViewBox:y},g&&g[C]&&g[C].props);return V}).filter(Boolean)}function I5e(t){var e=Yi(t,k5e),n=sa();return E.createElement(UO,{id:e.id,type:"bar"},i=>E.createElement(E.Fragment,null,E.createElement(TQ,{legendPayload:S5e(e)}),E.createElement(w5e,{dataKey:e.dataKey,stroke:e.stroke,strokeWidth:e.strokeWidth,fill:e.fill,name:e.name,hide:e.hide,unit:e.unit,tooltipType:e.tooltipType}),E.createElement(RQ,{type:"bar",id:i,data:void 0,xAxisId:e.xAxisId,yAxisId:e.yAxisId,zAxisId:0,dataKey:e.dataKey,stackId:AK(e.stackId),hide:e.hide,barSize:e.barSize,minPointSize:e.minPointSize,maxBarSize:e.maxBarSize,isPanorama:n}),E.createElement(Va,{zIndex:e.zIndex},E.createElement(O5e,Sc({},e,{id:i})))))}var IQ=E.memo(I5e,rM);IQ.displayName="Bar";function y$(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 Jb(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?y$(Object(n),!0).forEach(function(i){U5e(t,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):y$(Object(n)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(n,i))})}return t}function U5e(t,e,n){return(e=j5e(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function j5e(t){var e=F5e(t,"string");return typeof e=="symbol"?e:e+""}function F5e(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 z5e=(t,e)=>e,B5e=(t,e,n)=>n,H5e=(t,e,n,i)=>i,V5e=(t,e,n,i,r)=>r,uv=He([Kw,V5e],(t,e)=>t.filter(n=>n.type==="bar").find(n=>n.id===e)),$5e=He([uv],t=>t?.maxBarSize),G5e=(t,e,n,i,r,a)=>a,b$=(t,e,n)=>{var i=n??t;if(!gi(i))return ia(i,e,0)},W5e=He([_n,Kw,z5e,B5e,H5e],(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")),q5e=(t,e,n,i)=>{var r=_n(t);return r==="horizontal"?yx(t,"yAxis",n,i):yx(t,"xAxis",e,i)},X5e=(t,e,n)=>{var i=_n(t);return i==="horizontal"?hV(t,"xAxis",e):hV(t,"yAxis",n)},K5e=(t,e,n)=>{var i={},r=t.filter(Ww),a=t.filter(c=>c.stackId==null),s=r.reduce((c,d)=>(c[d.stackId]||(c[d.stackId]=[]),c[d.stackId].push(d),c),i),o=Object.entries(s).map(c=>{var[d,f]=c,m=f.map(y=>y.dataKey),g=b$(e,n,f[0].barSize);return{stackId:d,dataKeys:m,barSize:g}}),l=a.map(c=>{var d=[c.dataKey].filter(m=>m!=null),f=b$(e,n,c.barSize);return{stackId:void 0,dataKeys:d,barSize:f}});return[...o,...l]},Y5e=He([W5e,xLe,X5e],K5e),Z5e=(t,e,n,i,r)=>{var a,s,o=uv(t,e,n,i,r);if(o!=null){var l=_n(t),c=ZY(t),{maxBarSize:d}=o,f=gi(d)?c:d,m,g;return l==="horizontal"?(m=Ju(t,"xAxis",e,i),g=Qu(t,"xAxis",e,i)):(m=Ju(t,"yAxis",n,i),g=Qu(t,"yAxis",n,i)),(a=(s=nm(m,g,!0))!==null&&s!==void 0?s:f)!==null&&a!==void 0?a:0}},UQ=(t,e,n,i)=>{var r=_n(t),a,s;return r==="horizontal"?(a=Ju(t,"xAxis",e,i),s=Qu(t,"xAxis",e,i)):(a=Ju(t,"yAxis",n,i),s=Qu(t,"yAxis",n,i)),nm(a,s)};function Q5e(t,e,n,i,r){var a=i.length;if(!(a<1)){var s=ia(t,n,0,!0),o,l=[];if(oi(i[0].barSize)){var c=!1,d=n/a,f=i.reduce((x,M)=>x+(M.barSize||0),0);f+=(a-1)*s,f>=n&&(f-=(a-1)*s,s=0),f>=n&&d>0&&(c=!0,d*=.9,f=a*d);var m=(n-f)/2>>0,g={offset:m-s,size:0};o=i.reduce((x,M)=>{var w,T={stackId:M.stackId,dataKeys:M.dataKeys,position:{offset:g.offset+g.size+s,size:c?d:(w=M.barSize)!==null&&w!==void 0?w:0}},C=[...x,T];return g=C[C.length-1].position,C},l)}else{var y=ia(e,n,0,!0);n-2*y-(a-1)*s<=0&&(s=0);var _=(n-2*y-(a-1)*s)/a;_>1&&(_>>=0);var v=oi(r)?Math.min(_,r):_;o=i.reduce((x,M,w)=>[...x,{stackId:M.stackId,dataKeys:M.dataKeys,position:{offset:y+(_+s)*w+(_-v)/2,size:v}}],l)}return o}}var J5e=(t,e,n,i,r,a,s)=>{var o=gi(s)?e:s,l=Q5e(n,i,r!==a?r:a,t,o);return r!==a&&l!=null&&(l=l.map(c=>Jb(Jb({},c),{},{position:Jb(Jb({},c.position),{},{offset:c.position.offset-r/2})}))),l},eBe=He([Y5e,ZY,gLe,QY,Z5e,UQ,$5e],J5e),tBe=(t,e,n,i)=>Ju(t,"xAxis",e,i),nBe=(t,e,n,i)=>Ju(t,"yAxis",n,i),iBe=(t,e,n,i)=>Qu(t,"xAxis",e,i),rBe=(t,e,n,i)=>Qu(t,"yAxis",n,i),aBe=He([eBe,uv],(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}}),sBe=(t,e)=>{var n=Gw(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)}}}},oBe=He([q5e,uv],sBe),lBe=He([cr,fk,tBe,nBe,iBe,rBe,aBe,_n,Hw,UQ,oBe,uv,G5e],(t,e,n,i,r,a,s,o,l,c,d,f,m)=>{var{chartData:g,dataStartIndex:y,dataEndIndex:_}=l;if(!(f==null||s==null||e==null||o!=="horizontal"&&o!=="vertical"||n==null||i==null||r==null||a==null||c==null)){var{data:v}=f,x;if(v!=null&&v.length>0?x=v:x=g?.slice(y,_+1),x!=null)return L5e({layout:o,barSettings:f,pos:s,parentViewBox:e,bandSize:c,xAxis:n,yAxis:i,xAxisTicks:r,yAxisTicks:a,stackedData:d,displayedData:x,offset:t,cells:m,dataStartIndex:y})}}),jQ=t=>{var{chartData:e}=t,n=ei(),i=sa();return E.useEffect(()=>i?()=>{}:(n(AV(e)),()=>{n(AV(void 0))}),[e,n,i]),null},_$={x:0,y:0,width:0,height:0,padding:{top:0,right:0,bottom:0,left:0}},FQ=Ha({name:"brush",initialState:_$,reducers:{setBrushSettings(t,e){return e.payload==null?_$:e.payload}}}),{setBrushSettings:TGe}=FQ.actions,cBe=FQ.reducer;function uBe(t,e,n){return(e=dBe(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function dBe(t){var e=fBe(t,"string");return typeof e=="symbol"?e:e+""}function fBe(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 zO{static create(e){return new zO(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}}uBe(zO,"EPS",1e-4);function hBe(t){return(t%180+180)%180}var pBe=function(e){var{width:n,height:i}=e,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a=hBe(r),s=a*Math.PI/180,o=Math.atan(i/n),l=s>o&&s<Math.PI-o?i/Math.sin(s):n/Math.cos(s);return Math.abs(l)},mBe={dots:[],areas:[],lines:[]},zQ=Ha({name:"referenceElements",initialState:mBe,reducers:{addDot:(t,e)=>{t.dots.push(e.payload)},removeDot:(t,e)=>{var n=yo(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=yo(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=yo(t).lines.findIndex(i=>i===e.payload);n!==-1&&t.lines.splice(n,1)}}}),{addDot:CGe,removeDot:NGe,addArea:RGe,removeArea:PGe,addLine:DGe,removeLine:kGe}=zQ.actions,gBe=zQ.reducer,xBe=E.createContext(void 0),vBe=t=>{var{children:e}=t,[n]=E.useState("".concat(sx("recharts"),"-clip")),i=jO();if(i==null)return null;var{x:r,y:a,width:s,height:o}=i;return E.createElement(xBe.Provider,{value:n},E.createElement("defs",null,E.createElement("clipPath",{id:n},E.createElement("rect",{x:r,y:a,height:o,width:s}))),e)};function BQ(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 yBe(t,e,n){var i={width:t.width+e.width,height:t.height+e.height};return pBe(i,n)}function bBe(t,e,n){var i=n==="width",{x:r,y:a,width:s,height:o}=t;return e===1?{start:i?r:a,end:i?r+s:a+o}:{start:i?r+s:a+o,end:i?r:a}}function CS(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 _Be(t,e){return BQ(t,e+1)}function SBe(t,e,n,i,r){for(var a=(i||[]).slice(),{start:s,end:o}=e,l=0,c=1,d=s,f=function(){var y=i?.[l];if(y===void 0)return{v:BQ(i,c)};var _=l,v,x=()=>(v===void 0&&(v=n(y,_)),v),M=y.coordinate,w=l===0||CS(t,M,x,d,o);w||(l=0,d=s,c+=1),w&&(d=M+t*(x()/2+r),l+=c)},m;c<=a.length;)if(m=f(),m)return m.v;return[]}function S$(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 Jr(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?S$(Object(n),!0).forEach(function(i){wBe(t,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):S$(Object(n)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(n,i))})}return t}function wBe(t,e,n){return(e=MBe(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function MBe(t){var e=EBe(t,"string");return typeof e=="symbol"?e:e+""}function EBe(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 ABe(t,e,n,i,r){for(var a=(i||[]).slice(),s=a.length,{start:o}=e,{end:l}=e,c=function(m){var g=a[m],y,_=()=>(y===void 0&&(y=n(g,m)),y);if(m===s-1){var v=t*(g.coordinate+t*_()/2-l);a[m]=g=Jr(Jr({},g),{},{tickCoord:v>0?g.coordinate-v*t:g.coordinate})}else a[m]=g=Jr(Jr({},g),{},{tickCoord:g.coordinate});if(g.tickCoord!=null){var x=CS(t,g.tickCoord,_,o,l);x&&(l=g.tickCoord-t*(_()/2+r),a[m]=Jr(Jr({},g),{},{isShow:!0}))}},d=s-1;d>=0;d--)c(d);return a}function TBe(t,e,n,i,r,a){var s=(i||[]).slice(),o=s.length,{start:l,end:c}=e;if(a){var d=i[o-1],f=n(d,o-1),m=t*(d.coordinate+t*f/2-c);if(s[o-1]=d=Jr(Jr({},d),{},{tickCoord:m>0?d.coordinate-m*t:d.coordinate}),d.tickCoord!=null){var g=CS(t,d.tickCoord,()=>f,l,c);g&&(c=d.tickCoord-t*(f/2+r),s[o-1]=Jr(Jr({},d),{},{isShow:!0}))}}for(var y=a?o-1:o,_=function(M){var w=s[M],T,C=()=>(T===void 0&&(T=n(w,M)),T);if(M===0){var P=t*(w.coordinate-t*C()/2-l);s[M]=w=Jr(Jr({},w),{},{tickCoord:P<0?w.coordinate-P*t:w.coordinate})}else s[M]=w=Jr(Jr({},w),{},{tickCoord:w.coordinate});if(w.tickCoord!=null){var A=CS(t,w.tickCoord,C,l,c);A&&(l=w.tickCoord+t*(C()/2+r),s[M]=Jr(Jr({},w),{},{isShow:!0}))}},v=0;v<y;v++)_(v);return s}function BO(t,e,n){var{tick:i,ticks:r,viewBox:a,minTickGap:s,orientation:o,interval:l,tickFormatter:c,unit:d,angle:f}=t;if(!r||!r.length||!i)return[];if(Et(l)||_m.isSsr){var m;return(m=_Be(r,Et(l)?l:0))!==null&&m!==void 0?m:[]}var g=[],y=o==="top"||o==="bottom"?"width":"height",_=d&&y==="width"?E0(d,{fontSize:e,letterSpacing:n}):{width:0,height:0},v=(w,T)=>{var C=typeof c=="function"?c(w.value,T):w.value;return y==="width"?yBe(E0(C,{fontSize:e,letterSpacing:n}),_,f):E0(C,{fontSize:e,letterSpacing:n})[y]},x=r.length>=2?Er(r[1].coordinate-r[0].coordinate):1,M=bBe(a,x,y);return l==="equidistantPreserveStart"?SBe(x,M,v,r,s):(l==="preserveStart"||l==="preserveStartEnd"?g=TBe(x,M,v,r,s,l==="preserveStartEnd"):g=ABe(x,M,v,r,s),g.filter(w=>w.isShow))}var CBe=t=>{var{ticks:e,label:n,labelGapWithTick:i=5,tickSize:r=0,tickMargin:a=0}=t,s=0;if(e){Array.from(e).forEach(d=>{if(d){var f=d.getBoundingClientRect();f.width>s&&(s=f.width)}});var o=n?n.getBoundingClientRect().width:0,l=r+a,c=s+l+o+(n?i:0);return Math.round(c)}return 0},NBe=["axisLine","width","height","className","hide","ticks","axisType"];function RBe(t,e){if(t==null)return{};var n,i,r=PBe(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 PBe(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 jf(){return jf=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},jf.apply(null,arguments)}function w$(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 Hi(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?w$(Object(n),!0).forEach(function(i){DBe(t,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):w$(Object(n)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(n,i))})}return t}function DBe(t,e,n){return(e=kBe(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function kBe(t){var e=OBe(t,"string");return typeof e=="symbol"?e:e+""}function OBe(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 lc={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:Wi.axis};function LBe(t){var{x:e,y:n,width:i,height:r,orientation:a,mirror:s,axisLine:o,otherSvgProps:l}=t;if(!o)return null;var c=Hi(Hi(Hi({},l),za(o)),{},{fill:"none"});if(a==="top"||a==="bottom"){var d=+(a==="top"&&!s||a==="bottom"&&s);c=Hi(Hi({},c),{},{x1:e,y1:n+d*r,x2:e+i,y2:n+d*r})}else{var f=+(a==="left"&&!s||a==="right"&&s);c=Hi(Hi({},c),{},{x1:e+f*i,y1:n,x2:e+f*i,y2:n+r})}return E.createElement("line",jf({},c,{className:En("recharts-cartesian-axis-line",Of(o,"className"))}))}function IBe(t,e,n,i,r,a,s,o,l){var c,d,f,m,g,y,_=o?-1:1,v=t.tickSize||s,x=Et(t.tickCoord)?t.tickCoord:t.coordinate;switch(a){case"top":c=d=t.coordinate,m=n+ +!o*r,f=m-_*v,y=f-_*l,g=x;break;case"left":f=m=t.coordinate,d=e+ +!o*i,c=d-_*v,g=c-_*l,y=x;break;case"right":f=m=t.coordinate,d=e+ +o*i,c=d+_*v,g=c+_*l,y=x;break;default:c=d=t.coordinate,m=n+ +o*r,f=m+_*v,y=f+_*l,g=x;break}return{line:{x1:c,y1:f,x2:d,y2:m},tick:{x:g,y}}}function UBe(t,e){switch(t){case"left":return e?"start":"end";case"right":return e?"end":"start";default:return"middle"}}function jBe(t,e){switch(t){case"left":case"right":return"middle";case"top":return e?"start":"end";default:return e?"end":"start"}}function FBe(t){var{option:e,tickProps:n,value:i}=t,r,a=En(n.className,"recharts-cartesian-axis-tick-value");if(E.isValidElement(e))r=E.cloneElement(e,Hi(Hi({},n),{},{className:a}));else if(typeof e=="function")r=e(Hi(Hi({},n),{},{className:a}));else{var s="recharts-cartesian-axis-tick-value";typeof e!="boolean"&&(s=En(s,e?.className)),r=E.createElement(eM,jf({},n,{className:s}),i)}return r}var zBe=E.forwardRef((t,e)=>{var{ticks:n=[],tick:i,tickLine:r,stroke:a,tickFormatter:s,unit:o,padding:l,tickTextProps:c,orientation:d,mirror:f,x:m,y:g,width:y,height:_,tickSize:v,tickMargin:x,fontSize:M,letterSpacing:w,getTicksConfig:T,events:C,axisType:P}=t,A=BO(Hi(Hi({},T),{},{ticks:n}),M,w),U=UBe(d,f),N=jBe(d,f),D=za(T),F=kf(i),I={};typeof r=="object"&&(I=r);var W=Hi(Hi({},D),{},{fill:"none"},I),O=A.map($=>Hi({entry:$},IBe($,m,g,y,_,d,v,f,x))),B=O.map($=>{var{entry:K,line:Z}=$;return E.createElement(Oi,{className:"recharts-cartesian-axis-tick",key:"tick-".concat(K.value,"-").concat(K.coordinate,"-").concat(K.tickCoord)},r&&E.createElement("line",jf({},W,Z,{className:En("recharts-cartesian-axis-tick-line",Of(r,"className"))})))}),H=O.map(($,K)=>{var{entry:Z,tick:se}=$,V=Hi(Hi(Hi(Hi({textAnchor:U,verticalAnchor:N},D),{},{stroke:"none",fill:a},F),se),{},{index:K,payload:Z,visibleTicksCount:A.length,tickFormatter:s,padding:l},c);return E.createElement(Oi,jf({className:"recharts-cartesian-axis-tick-label",key:"tick-label-".concat(Z.value,"-").concat(Z.coordinate,"-").concat(Z.tickCoord)},Bx(C,Z,K)),i&&E.createElement(FBe,{option:i,tickProps:V,value:"".concat(typeof s=="function"?s(Z.value,K):Z.value).concat(o||"")}))});return E.createElement("g",{className:"recharts-cartesian-axis-ticks recharts-".concat(P,"-ticks")},H.length>0&&E.createElement(Va,{zIndex:Wi.label},E.createElement("g",{className:"recharts-cartesian-axis-tick-labels recharts-".concat(P,"-tick-labels"),ref:e},H)),B.length>0&&E.createElement("g",{className:"recharts-cartesian-axis-tick-lines recharts-".concat(P,"-tick-lines")},B))}),BBe=E.forwardRef((t,e)=>{var{axisLine:n,width:i,height:r,className:a,hide:s,ticks:o,axisType:l}=t,c=RBe(t,NBe),[d,f]=E.useState(""),[m,g]=E.useState(""),y=E.useRef(null);E.useImperativeHandle(e,()=>({getCalculatedWidth:()=>{var v;return CBe({ticks:y.current,label:(v=t.labelRef)===null||v===void 0?void 0:v.current,labelGapWithTick:5,tickSize:t.tickSize,tickMargin:t.tickMargin})}}));var _=E.useCallback(v=>{if(v){var x=v.getElementsByClassName("recharts-cartesian-axis-tick-value");y.current=x;var M=x[0];if(M){var w=window.getComputedStyle(M),T=w.fontSize,C=w.letterSpacing;(T!==d||C!==m)&&(f(T),g(C))}}},[d,m]);return s||i!=null&&i<=0||r!=null&&r<=0?null:E.createElement(Va,{zIndex:t.zIndex},E.createElement(Oi,{className:En("recharts-cartesian-axis",a)},E.createElement(LBe,{x:t.x,y:t.y,width:i,height:r,orientation:t.orientation,mirror:t.mirror,axisLine:n,otherSvgProps:za(t)}),E.createElement(zBe,{ref:_,axisType:l,events:c,fontSize:d,getTicksConfig:t,height:t.height,letterSpacing:m,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:o,unit:t.unit,width:t.width,x:t.x,y:t.y}),E.createElement(dje,{x:t.x,y:t.y,width:t.width,height:t.height,lowerWidth:t.width,upperWidth:t.width},E.createElement(_je,{label:t.label,labelRef:t.labelRef}),t.children)))}),HO=E.forwardRef((t,e)=>{var n=Yi(t,lc);return E.createElement(BBe,jf({},n,{ref:e}))});HO.displayName="CartesianAxis";var HBe=["x1","y1","x2","y2","key"],VBe=["offset"],$Be=["xAxisId","yAxisId"],GBe=["xAxisId","yAxisId"];function M$(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 ea(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?M$(Object(n),!0).forEach(function(i){WBe(t,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):M$(Object(n)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(n,i))})}return t}function WBe(t,e,n){return(e=qBe(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function qBe(t){var e=XBe(t,"string");return typeof e=="symbol"?e:e+""}function XBe(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 rf(){return rf=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},rf.apply(null,arguments)}function NS(t,e){if(t==null)return{};var n,i,r=KBe(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 KBe(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 YBe=t=>{var{fill:e}=t;if(!e||e==="none")return null;var{fillOpacity:n,x:i,y:r,width:a,height:s,ry:o}=t;return E.createElement("rect",{x:i,y:r,ry:o,width:a,height:s,stroke:"none",fill:e,fillOpacity:n,className:"recharts-cartesian-grid-bg"})};function HQ(t){var{option:e,lineItemProps:n}=t,i;if(E.isValidElement(e))i=E.cloneElement(e,n);else if(typeof e=="function")i=e(n);else{var r,{x1:a,y1:s,x2:o,y2:l,key:c}=n,d=NS(n,HBe),f=(r=za(d))!==null&&r!==void 0?r:{},{offset:m}=f,g=NS(f,VBe);i=E.createElement("line",rf({},g,{x1:a,y1:s,x2:o,y2:l,fill:"none",key:c}))}return i}function ZBe(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,o=NS(t,$Be),l=r.map((c,d)=>{var f=ea(ea({},o),{},{x1:e,y1:c,x2:e+n,y2:c,key:"line-".concat(d),index:d});return E.createElement(HQ,{key:"line-".concat(d),option:i,lineItemProps:f})});return E.createElement("g",{className:"recharts-cartesian-grid-horizontal"},l)}function QBe(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,o=NS(t,GBe),l=r.map((c,d)=>{var f=ea(ea({},o),{},{x1:c,y1:e,x2:c,y2:e+n,key:"line-".concat(d),index:d});return E.createElement(HQ,{option:i,lineItemProps:f,key:"line-".concat(d)})});return E.createElement("g",{className:"recharts-cartesian-grid-vertical"},l)}function JBe(t){var{horizontalFill:e,fillOpacity:n,x:i,y:r,width:a,height:s,horizontalPoints:o,horizontal:l=!0}=t;if(!l||!e||!e.length||o==null)return null;var c=o.map(f=>Math.round(f+r-r)).sort((f,m)=>f-m);r!==c[0]&&c.unshift(0);var d=c.map((f,m)=>{var g=!c[m+1],y=g?r+s-f:c[m+1]-f;if(y<=0)return null;var _=m%e.length;return E.createElement("rect",{key:"react-".concat(m),y:f,x:i,height:y,width:a,stroke:"none",fill:e[_],fillOpacity:n,className:"recharts-cartesian-grid-bg"})});return E.createElement("g",{className:"recharts-cartesian-gridstripes-horizontal"},d)}function e8e(t){var{vertical:e=!0,verticalFill:n,fillOpacity:i,x:r,y:a,width:s,height:o,verticalPoints:l}=t;if(!e||!n||!n.length)return null;var c=l.map(f=>Math.round(f+r-r)).sort((f,m)=>f-m);r!==c[0]&&c.unshift(0);var d=c.map((f,m)=>{var g=!c[m+1],y=g?r+s-f:c[m+1]-f;if(y<=0)return null;var _=m%n.length;return E.createElement("rect",{key:"react-".concat(m),x:f,y:a,width:y,height:o,stroke:"none",fill:n[_],fillOpacity:i,className:"recharts-cartesian-grid-bg"})});return E.createElement("g",{className:"recharts-cartesian-gridstripes-vertical"},d)}var t8e=(t,e)=>{var{xAxis:n,width:i,height:r,offset:a}=t;return MK(BO(ea(ea(ea({},lc),n),{},{ticks:EK(n),viewBox:{x:0,y:0,width:i,height:r}})),a.left,a.left+a.width,e)},n8e=(t,e)=>{var{yAxis:n,width:i,height:r,offset:a}=t;return MK(BO(ea(ea(ea({},lc),n),{},{ticks:EK(n),viewBox:{x:0,y:0,width:i,height:r}})),a.top,a.top+a.height,e)},i8e={horizontal:!0,vertical:!0,horizontalPoints:[],verticalPoints:[],stroke:"#ccc",fill:"none",verticalFill:[],horizontalFill:[],xAxisId:0,yAxisId:0,syncWithTicks:!1,zIndex:Wi.grid};function eP(t){var e=pk(),n=mk(),i=OK(),r=ea(ea({},Yi(t,i8e)),{},{x:Et(t.x)?t.x:i.left,y:Et(t.y)?t.y:i.top,width:Et(t.width)?t.width:i.width,height:Et(t.height)?t.height:i.height}),{xAxisId:a,yAxisId:s,x:o,y:l,width:c,height:d,syncWithTicks:f,horizontalValues:m,verticalValues:g}=r,y=sa(),_=At(N=>pV(N,"xAxis",a,y)),v=At(N=>pV(N,"yAxis",s,y));if(!il(c)||!il(d)||!Et(o)||!Et(l))return null;var x=r.verticalCoordinatesGenerator||t8e,M=r.horizontalCoordinatesGenerator||n8e,{horizontalPoints:w,verticalPoints:T}=r;if((!w||!w.length)&&typeof M=="function"){var C=m&&m.length,P=M({yAxis:v?ea(ea({},v),{},{ticks:C?m:v.ticks}):void 0,width:e??c,height:n??d,offset:i},C?!0:f);eS(Array.isArray(P),"horizontalCoordinatesGenerator should return Array but instead it returned [".concat(typeof P,"]")),Array.isArray(P)&&(w=P)}if((!T||!T.length)&&typeof x=="function"){var A=g&&g.length,U=x({xAxis:_?ea(ea({},_),{},{ticks:A?g:_.ticks}):void 0,width:e??c,height:n??d,offset:i},A?!0:f);eS(Array.isArray(U),"verticalCoordinatesGenerator should return Array but instead it returned [".concat(typeof U,"]")),Array.isArray(U)&&(T=U)}return E.createElement(Va,{zIndex:r.zIndex},E.createElement("g",{className:"recharts-cartesian-grid"},E.createElement(YBe,{fill:r.fill,fillOpacity:r.fillOpacity,x:r.x,y:r.y,width:r.width,height:r.height,ry:r.ry}),E.createElement(JBe,rf({},r,{horizontalPoints:w})),E.createElement(e8e,rf({},r,{verticalPoints:T})),E.createElement(ZBe,rf({},r,{offset:i,horizontalPoints:w,xAxis:_,yAxis:v})),E.createElement(QBe,rf({},r,{offset:i,verticalPoints:T,xAxis:_,yAxis:v}))))}eP.displayName="CartesianGrid";function r8e(t){var e=kf(t),n=3,i=2;if(e!=null){var{r,strokeWidth:a}=e,s=Number(r),o=Number(a);return(Number.isNaN(s)||s<0)&&(s=n),(Number.isNaN(o)||o<0)&&(o=i),{r:s,strokeWidth:o}}return{r:n,strokeWidth:i}}var VQ=(t,e,n,i)=>Ju(t,"xAxis",e,i),$Q=(t,e,n,i)=>Qu(t,"xAxis",e,i),GQ=(t,e,n,i)=>Ju(t,"yAxis",n,i),WQ=(t,e,n,i)=>Qu(t,"yAxis",n,i),a8e=He([_n,VQ,GQ,$Q,WQ],(t,e,n,i,r)=>Mc(t,"xAxis")?nm(e,i,!1):nm(n,r,!1)),s8e=(t,e,n,i,r)=>r,qQ=He([Kw,s8e],(t,e)=>t.filter(n=>n.type==="area").find(n=>n.id===e)),o8e=(t,e,n,i,r)=>{var a,s=qQ(t,e,n,i,r);if(s!=null){var o=_n(t),l=Mc(o,"xAxis"),c;if(l?c=yx(t,"yAxis",n,i):c=yx(t,"xAxis",e,i),c!=null){var{stackId:d}=s,f=Gw(s);if(!(d==null||f==null)){var m=(a=c[d])===null||a===void 0?void 0:a.stackedData;return m?.find(g=>g.key===f)}}}},l8e=He([_n,VQ,GQ,$Q,WQ,o8e,Hw,a8e,qQ,vLe],(t,e,n,i,r,a,s,o,l,c)=>{var{chartData:d,dataStartIndex:f,dataEndIndex:m}=s;if(!(l==null||t!=="horizontal"&&t!=="vertical"||e==null||n==null||i==null||r==null||i.length===0||r.length===0||o==null)){var{data:g}=l,y;if(g&&g.length>0?y=g:y=d?.slice(f,m+1),y!=null)return T8e({layout:t,xAxis:e,yAxis:n,xAxisTicks:i,yAxisTicks:r,dataStartIndex:f,areaSettings:l,stackedData:a,displayedData:y,chartBaseValue:c,bandSize:o})}}),c8e=["id"],u8e=["activeDot","animationBegin","animationDuration","animationEasing","connectNulls","dot","fill","fillOpacity","hide","isAnimationActive","legendType","stroke","xAxisId","yAxisId"];function xf(){return xf=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},xf.apply(null,arguments)}function XQ(t,e){if(t==null)return{};var n,i,r=d8e(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 d8e(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 E$(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 Sp(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?E$(Object(n),!0).forEach(function(i){f8e(t,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):E$(Object(n)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(n,i))})}return t}function f8e(t,e,n){return(e=h8e(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function h8e(t){var e=p8e(t,"string");return typeof e=="symbol"?e:e+""}function p8e(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 RS(t,e){return t&&t!=="none"?t:e}var m8e=t=>{var{dataKey:e,name:n,stroke:i,fill:r,legendType:a,hide:s}=t;return[{inactive:s,dataKey:e,type:a,color:RS(i,r),value:ym(n,e),payload:t}]},g8e=E.memo(t=>{var{dataKey:e,data:n,stroke:i,strokeWidth:r,fill:a,name:s,hide:o,unit:l,tooltipType:c}=t,d={dataDefinedOnItem:n,positions:void 0,settings:{stroke:i,strokeWidth:r,fill:a,dataKey:e,nameKey:void 0,name:ym(s,e),hide:o,type:c,color:RS(i,a),unit:l}};return E.createElement(IO,{tooltipEntrySettings:d})});function x8e(t){var{clipPathId:e,points:n,props:i}=t,{needClip:r,dot:a,dataKey:s}=i,o=za(i);return E.createElement(cze,{points:n,dot:a,className:"recharts-area-dots",dotClassName:"recharts-area-dot",dataKey:s,baseProps:o,needClip:r,clipPathId:e})}function v8e(t){var{showLabels:e,children:n,points:i}=t,r=i.map(a=>{var s,o,l={x:(s=a.x)!==null&&s!==void 0?s:0,y:(o=a.y)!==null&&o!==void 0?o:0,width:0,lowerWidth:0,upperWidth:0,height:0};return Sp(Sp({},l),{},{value:a.value,payload:a.payload,parentViewBox:void 0,viewBox:l,fill:void 0})});return E.createElement(xQ,{value:e?r:void 0},n)}function A$(t){var{points:e,baseLine:n,needClip:i,clipPathId:r,props:a}=t,{layout:s,type:o,stroke:l,connectNulls:c,isRange:d}=a,{id:f}=a,m=XQ(a,c8e),g=za(m),y=_a(m);return E.createElement(E.Fragment,null,e?.length>1&&E.createElement(Oi,{clipPath:i?"url(#clipPath-".concat(r,")"):void 0},E.createElement(kp,xf({},y,{id:f,points:e,connectNulls:c,type:o,baseLine:n,layout:s,stroke:"none",className:"recharts-area-area"})),l!=="none"&&E.createElement(kp,xf({},g,{className:"recharts-area-curve",layout:s,type:o,connectNulls:c,fill:"none",points:e})),l!=="none"&&d&&E.createElement(kp,xf({},g,{className:"recharts-area-curve",layout:s,type:o,connectNulls:c,fill:"none",points:n}))),E.createElement(x8e,{points:e,props:m,clipPathId:r}))}function y8e(t){var{alpha:e,baseLine:n,points:i,strokeWidth:r}=t,a=i[0].y,s=i[i.length-1].y;if(!oi(a)||!oi(s))return null;var o=e*Math.abs(a-s),l=Math.max(...i.map(c=>c.x||0));return Et(n)?l=Math.max(n,l):n&&Array.isArray(n)&&n.length&&(l=Math.max(...n.map(c=>c.x||0),l)),Et(l)?E.createElement("rect",{x:0,y:a<s?a:a-o,width:l+(r?parseInt("".concat(r),10):1),height:Math.floor(o)}):null}function b8e(t){var{alpha:e,baseLine:n,points:i,strokeWidth:r}=t,a=i[0].x,s=i[i.length-1].x;if(!oi(a)||!oi(s))return null;var o=e*Math.abs(a-s),l=Math.max(...i.map(c=>c.y||0));return Et(n)?l=Math.max(n,l):n&&Array.isArray(n)&&n.length&&(l=Math.max(...n.map(c=>c.y||0),l)),Et(l)?E.createElement("rect",{x:a<s?a:a-o,y:0,width:o,height:Math.floor(l+(r?parseInt("".concat(r),10):1))}):null}function _8e(t){var{alpha:e,layout:n,points:i,baseLine:r,strokeWidth:a}=t;return n==="vertical"?E.createElement(y8e,{alpha:e,points:i,baseLine:r,strokeWidth:a}):E.createElement(b8e,{alpha:e,points:i,baseLine:r,strokeWidth:a})}function S8e(t){var{needClip:e,clipPathId:n,props:i,previousPointsRef:r,previousBaselineRef:a}=t,{points:s,baseLine:o,isAnimationActive:l,animationBegin:c,animationDuration:d,animationEasing:f,onAnimationStart:m,onAnimationEnd:g}=i,y=E.useMemo(()=>({points:s,baseLine:o}),[s,o]),_=Xx(y,"recharts-area-"),v=IRe(),[x,M]=E.useState(!1),w=!x,T=E.useCallback(()=>{typeof g=="function"&&g(),M(!1)},[g]),C=E.useCallback(()=>{typeof m=="function"&&m(),M(!0)},[m]);if(v==null)return null;var P=r.current,A=a.current;return E.createElement(v8e,{showLabels:w,points:s},i.children,E.createElement(qx,{animationId:_,begin:c,duration:d,isActive:l,easing:f,onAnimationEnd:T,onAnimationStart:C,key:_},U=>{if(P){var N=P.length/s.length,D=U===1?s:s.map((I,W)=>{var O=Math.floor(W*N);if(P[O]){var B=P[O];return Sp(Sp({},I),{},{x:si(B.x,I.x,U),y:si(B.y,I.y,U)})}return I}),F;return Et(o)?F=si(A,o,U):gi(o)||Ws(o)?F=si(A,0,U):F=o.map((I,W)=>{var O=Math.floor(W*N);if(Array.isArray(A)&&A[O]){var B=A[O];return Sp(Sp({},I),{},{x:si(B.x,I.x,U),y:si(B.y,I.y,U)})}return I}),U>0&&(r.current=D,a.current=F),E.createElement(A$,{points:D,baseLine:F,needClip:e,clipPathId:n,props:i})}return U>0&&(r.current=s,a.current=o),E.createElement(Oi,null,l&&E.createElement("defs",null,E.createElement("clipPath",{id:"animationClipPath-".concat(n)},E.createElement(_8e,{alpha:U,points:s,baseLine:o,layout:v,strokeWidth:i.strokeWidth}))),E.createElement(Oi,{clipPath:"url(#animationClipPath-".concat(n,")")},E.createElement(A$,{points:s,baseLine:o,needClip:e,clipPathId:n,props:i})))}),E.createElement(NO,{label:i.label}))}function w8e(t){var{needClip:e,clipPathId:n,props:i}=t,r=E.useRef(null),a=E.useRef();return E.createElement(S8e,{needClip:e,clipPathId:n,props:i,previousPointsRef:r,previousBaselineRef:a})}class M8e extends E.PureComponent{render(){var{hide:e,dot:n,points:i,className:r,top:a,left:s,needClip:o,xAxisId:l,yAxisId:c,width:d,height:f,id:m,baseLine:g,zIndex:y}=this.props;if(e)return null;var _=En("recharts-area",r),v=m,{r:x,strokeWidth:M}=r8e(n),w=EQ(n),T=x*2+M,C=o?"url(#clipPath-".concat(w?"":"dots-").concat(v,")"):void 0;return E.createElement(Va,{zIndex:y},E.createElement(Oi,{className:_},o&&E.createElement("defs",null,E.createElement(OQ,{clipPathId:v,xAxisId:l,yAxisId:c}),!w&&E.createElement("clipPath",{id:"clipPath-dots-".concat(v)},E.createElement("rect",{x:s-T/2,y:a-T/2,width:d+T,height:f+T}))),E.createElement(w8e,{needClip:o,clipPathId:v,props:this.props})),E.createElement(f$,{points:i,mainColor:RS(this.props.stroke,this.props.fill),itemDataKey:this.props.dataKey,activeDot:this.props.activeDot,clipPath:C}),this.props.isRange&&Array.isArray(g)&&E.createElement(f$,{points:g,mainColor:RS(this.props.stroke,this.props.fill),itemDataKey:this.props.dataKey,activeDot:this.props.activeDot,clipPath:C}))}}var KQ={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:Wi.area};function E8e(t){var e,n=Yi(t,KQ),{activeDot:i,animationBegin:r,animationDuration:a,animationEasing:s,connectNulls:o,dot:l,fill:c,fillOpacity:d,hide:f,isAnimationActive:m,legendType:g,stroke:y,xAxisId:_,yAxisId:v}=n,x=XQ(n,u8e),M=bm(),w=QZ(),{needClip:T}=FO(_,v),C=sa(),{points:P,isRange:A,baseLine:U}=(e=At(O=>l8e(O,_,v,C,t.id)))!==null&&e!==void 0?e:{},N=jO();if(M!=="horizontal"&&M!=="vertical"||N==null||w!=="AreaChart"&&w!=="ComposedChart")return null;var{height:D,width:F,x:I,y:W}=N;return!P||!P.length?null:E.createElement(M8e,xf({},x,{activeDot:i,animationBegin:r,animationDuration:a,animationEasing:s,baseLine:U,connectNulls:o,dot:l,fill:c,fillOpacity:d,height:D,hide:f,layout:M,isAnimationActive:m==="auto"?!_m.isSsr:m,isRange:A,legendType:g,needClip:T,points:P,stroke:y,width:F,left:I,top:W,xAxisId:_,yAxisId:v}))}var A8e=(t,e,n,i,r)=>{var a=n??e;if(Et(a))return a;var s=t==="horizontal"?r:i,o=s.scale.domain();if(s.type==="number"){var l=Math.max(o[0],o[1]),c=Math.min(o[0],o[1]);return a==="dataMin"?c:a==="dataMax"||l<0?l:Math.max(Math.min(o[0],o[1]),0)}return a==="dataMin"?o[0]:a==="dataMax"?o[1]:o[0]};function T8e(t){var{areaSettings:{connectNulls:e,baseValue:n,dataKey:i},stackedData:r,layout:a,chartBaseValue:s,xAxis:o,yAxis:l,displayedData:c,dataStartIndex:d,xAxisTicks:f,yAxisTicks:m,bandSize:g}=t,y=r&&r.length,_=A8e(a,s,n,o,l),v=a==="horizontal",x=!1,M=c.map((T,C)=>{var P;y?P=r[d+C]:(P=Kn(T,i),Array.isArray(P)?x=!0:P=[_,P]);var A=P[1]==null||y&&!e&&Kn(T,i)==null;return v?{x:k6({axis:o,ticks:f,bandSize:g,entry:T,index:C}),y:A?null:l.scale(P[1]),value:P,payload:T}:{x:A?null:o.scale(P[1]),y:k6({axis:l,ticks:m,bandSize:g,entry:T,index:C}),value:P,payload:T}}),w;return y||x?w=M.map(T=>{var C=Array.isArray(T.value)?T.value[0]:null;return v?{x:T.x,y:C!=null&&T.y!=null?l.scale(C):null,payload:T.payload}:{x:C!=null?o.scale(C):null,y:T.y,payload:T.payload}}):w=v?l.scale(_):o.scale(_),{points:M,baseLine:w,isRange:x}}function C8e(t){var e=Yi(t,KQ),n=sa();return E.createElement(UO,{id:e.id,type:"area"},i=>E.createElement(E.Fragment,null,E.createElement(TQ,{legendPayload:m8e(e)}),E.createElement(g8e,{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}),E.createElement(RQ,{type:"area",id:i,data:e.data,dataKey:e.dataKey,xAxisId:e.xAxisId,yAxisId:e.yAxisId,zAxisId:0,stackId:AK(e.stackId),hide:e.hide,barSize:void 0,baseValue:e.baseValue,isPanorama:n,connectNulls:e.connectNulls}),E.createElement(E8e,xf({},e,{id:i}))))}var YQ=E.memo(C8e,rM);YQ.displayName="Area";var N8e=["domain","range"],R8e=["domain","range"];function T$(t,e){if(t==null)return{};var n,i,r=P8e(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 P8e(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 C$(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 ZQ(t,e){if(t===e)return!0;var{domain:n,range:i}=t,r=T$(t,N8e),{domain:a,range:s}=e,o=T$(e,R8e);return!C$(n,a)||!C$(i,s)?!1:rM(r,o)}var D8e=["dangerouslySetInnerHTML","ticks"],k8e=["id"];function tP(){return tP=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},tP.apply(null,arguments)}function N$(t,e){if(t==null)return{};var n,i,r=O8e(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 O8e(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 L8e(t){var e=ei(),n=E.useRef(null);return E.useLayoutEffect(()=>{n.current===null?e(pze(t)):n.current!==t&&e(mze({prev:n.current,next:t})),n.current=t},[t,e]),E.useLayoutEffect(()=>()=>{n.current&&(e(gze(n.current)),n.current=null)},[e]),null}var I8e=t=>{var{xAxisId:e,className:n}=t,i=At(fk),r=sa(),a="xAxis",s=At(v=>Cm(v,a,e,r)),o=At(v=>RZ(v,a,e,r)),l=At(v=>AZ(v,e)),c=At(v=>mIe(v,e)),d=At(v=>oZ(v,e));if(l==null||c==null||d==null)return null;var{dangerouslySetInnerHTML:f,ticks:m}=t,g=N$(t,D8e),{id:y}=d,_=N$(d,k8e);return E.createElement(HO,tP({},g,_,{scale:s,x:c.x,y:c.y,width:l.width,height:l.height,className:En("recharts-".concat(a," ").concat(a),n),viewBox:i,ticks:o,axisType:a}))},U8e={allowDataOverflow:br.allowDataOverflow,allowDecimals:br.allowDecimals,allowDuplicatedCategory:br.allowDuplicatedCategory,angle:br.angle,axisLine:lc.axisLine,height:br.height,hide:!1,includeHidden:br.includeHidden,interval:br.interval,minTickGap:br.minTickGap,mirror:br.mirror,orientation:br.orientation,padding:br.padding,reversed:br.reversed,scale:br.scale,tick:br.tick,tickCount:br.tickCount,tickLine:lc.tickLine,tickSize:lc.tickSize,type:br.type,xAxisId:0},j8e=t=>{var e=Yi(t,U8e);return E.createElement(E.Fragment,null,E.createElement(L8e,{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}),E.createElement(I8e,e))},nP=E.memo(j8e,ZQ);nP.displayName="XAxis";var F8e=["dangerouslySetInnerHTML","ticks"],z8e=["id"];function iP(){return iP=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},iP.apply(null,arguments)}function R$(t,e){if(t==null)return{};var n,i,r=B8e(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 B8e(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 H8e(t){var e=ei(),n=E.useRef(null);return E.useLayoutEffect(()=>{n.current===null?e(xze(t)):n.current!==t&&e(vze({prev:n.current,next:t})),n.current=t},[t,e]),E.useLayoutEffect(()=>()=>{n.current&&(e(yze(n.current)),n.current=null)},[e]),null}var V8e=t=>{var{yAxisId:e,className:n,width:i,label:r}=t,a=E.useRef(null),s=E.useRef(null),o=At(fk),l=sa(),c=ei(),d="yAxis",f=At(C=>Cm(C,d,e,l)),m=At(C=>TZ(C,e)),g=At(C=>xIe(C,e)),y=At(C=>RZ(C,d,e,l)),_=At(C=>lZ(C,e));if(E.useLayoutEffect(()=>{if(!(i!=="auto"||!m||CO(r)||E.isValidElement(r)||_==null)){var C=a.current;if(C){var P=C.getCalculatedWidth();Math.round(m.width)!==Math.round(P)&&c(bze({id:e,width:P}))}}},[y,m,c,r,e,i,_]),m==null||g==null||_==null)return null;var{dangerouslySetInnerHTML:v,ticks:x}=t,M=R$(t,F8e),{id:w}=_,T=R$(_,z8e);return E.createElement(HO,iP({},M,T,{ref:a,labelRef:s,scale:f,x:g.x,y:g.y,tickTextProps:i==="auto"?{width:void 0}:{width:i},width:m.width,height:m.height,className:En("recharts-".concat(d," ").concat(d),n),viewBox:o,ticks:y,axisType:d}))},$8e={allowDataOverflow:_r.allowDataOverflow,allowDecimals:_r.allowDecimals,allowDuplicatedCategory:_r.allowDuplicatedCategory,angle:_r.angle,axisLine:lc.axisLine,hide:!1,includeHidden:_r.includeHidden,interval:_r.interval,minTickGap:_r.minTickGap,mirror:_r.mirror,orientation:_r.orientation,padding:_r.padding,reversed:_r.reversed,scale:_r.scale,tick:_r.tick,tickCount:_r.tickCount,tickLine:lc.tickLine,tickSize:lc.tickSize,type:_r.type,width:_r.width,yAxisId:0},G8e=t=>{var e=Yi(t,$8e);return E.createElement(E.Fragment,null,E.createElement(H8e,{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}),E.createElement(V8e,e))},rP=E.memo(G8e,ZQ);rP.displayName="YAxis";var W8e=(t,e)=>e,VO=He([W8e,_n,aZ,dr,WZ,Rc,D4e,cr],F4e),$O=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)}},QQ=qs("mouseClick"),JQ=$x();JQ.startListening({actionCreator:QQ,effect:(t,e)=>{var n=t.payload,i=VO(e.getState(),$O(n));i?.activeIndex!=null&&e.dispatch(PIe({activeIndex:i.activeIndex,activeDataKey:void 0,activeCoordinate:i.activeCoordinate}))}});var aP=qs("mouseMove"),eJ=$x(),e_=null;eJ.startListening({actionCreator:aP,effect:(t,e)=>{var n=t.payload;e_!==null&&cancelAnimationFrame(e_);var i=$O(n);e_=requestAnimationFrame(()=>{var r=e.getState(),a=gO(r,r.tooltip.settings.shared);if(a==="axis"){var s=VO(r,i);s?.activeIndex!=null?e.dispatch(jZ({activeIndex:s.activeIndex,activeDataKey:void 0,activeCoordinate:s.activeCoordinate})):e.dispatch(UZ())}e_=null})}});var P$={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},tJ=Ha({name:"rootProps",initialState:P$,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:P$.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}}}),q8e=tJ.reducer,{updateOptions:X8e}=tJ.actions,nJ=Ha({name:"polarOptions",initialState:null,reducers:{updatePolarOptions:(t,e)=>e.payload}}),{updatePolarOptions:K8e}=nJ.actions,Y8e=nJ.reducer,iJ=qs("keyDown"),rJ=qs("focus"),GO=$x();GO.startListening({actionCreator:iJ,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=xO(r,Rm(n),iv(n),ov(n)),o=s==null?-1:Number(s);if(!(!Number.isFinite(o)||o<0)){var l=Rc(n);if(a==="Enter"){var c=_S(n,"axis","hover",String(r.index));e.dispatch(qR({active:!r.active,activeIndex:r.index,activeDataKey:r.dataKey,activeCoordinate:c}));return}var d=_Ie(n),f=d==="left-to-right"?1:-1,m=a==="ArrowRight"?1:-1,g=o+m*f;if(!(l==null||g>=l.length||g<0)){var y=_S(n,"axis","hover",String(g));e.dispatch(qR({active:!0,activeIndex:g.toString(),activeDataKey:void 0,activeCoordinate:y}))}}}}}});GO.startListening({actionCreator:rJ,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=_S(n,"axis","hover",String(a));e.dispatch(qR({activeDataKey:void 0,active:!0,activeIndex:a,activeCoordinate:s}))}}}});var Cs=qs("externalEvent"),aJ=$x(),QC=new Map;aJ.startListening({actionCreator:Cs,effect:(t,e)=>{var{handler:n,reactEvent:i}=t.payload;if(n!=null){i.persist();var r=i.type,a=QC.get(r);a!==void 0&&cancelAnimationFrame(a);var s=requestAnimationFrame(()=>{try{var o=e.getState(),l={activeCoordinate:x4e(o),activeDataKey:SO(o),activeIndex:ed(o),activeLabel:KZ(o),activeTooltipIndex:ed(o),isTooltipActive:v4e(o)};n(l,i)}finally{QC.delete(r)}});QC.set(r,s)}}});var Z8e=He([Nm],t=>t.tooltipItemPayloads),Q8e=He([Z8e,av,(t,e,n)=>e,(t,e,n)=>n],(t,e,n,i)=>{var r=t.find(o=>o.settings.dataKey===i);if(r!=null){var{positions:a}=r;if(a!=null){var s=e(a,n);return s}}}),sJ=qs("touchMove"),oJ=$x();oJ.startListening({actionCreator:sJ,effect:(t,e)=>{var n=t.payload;if(!(n.touches==null||n.touches.length===0)){var i=e.getState(),r=gO(i,i.tooltip.settings.shared);if(r==="axis"){var a=VO(i,$O({clientX:n.touches[0].clientX,clientY:n.touches[0].clientY,currentTarget:n.currentTarget}));a?.activeIndex!=null&&e.dispatch(jZ({activeIndex:a.activeIndex,activeDataKey:void 0,activeCoordinate:a.activeCoordinate}))}else if(r==="item"){var s,o=n.touches[0];if(document.elementFromPoint==null)return;var l=document.elementFromPoint(o.clientX,o.clientY);if(!l||!l.getAttribute)return;var c=l.getAttribute(CK),d=(s=l.getAttribute(NK))!==null&&s!==void 0?s:void 0,f=Q8e(e.getState(),c,d);e.dispatch(IZ({activeDataKey:d,activeIndex:c,activeCoordinate:f}))}}}});var J8e=KX({brush:cBe,cartesianAxis:_ze,chartData:gUe,errorBars:zze,graphicalItems:TFe,layout:V3e,legend:ZRe,options:dUe,polarAxis:Hje,polarOptions:Y8e,referenceElements:gBe,rootProps:q8e,tooltip:DIe,zIndex:J4e}),e6e=function(e){return p3e({reducer:J8e,preloadedState:e,middleware:n=>{var i;return n({serializableCheck:!1,immutableCheck:!["commonjs","es6","production"].includes((i="es6")!==null&&i!==void 0?i:"")}).concat([JQ.middleware,eJ.middleware,GO.middleware,aJ.middleware,oJ.middleware])},enhancers:n=>{var i=n;return typeof n=="function"&&(i=n()),i.concat(uK({type:"raf"}))},devTools:_m.devToolsEnabled})};function lJ(t){var{preloadedState:e,children:n,reduxStoreName:i}=t,r=sa(),a=E.useRef(null);if(r)return n;a.current==null&&(a.current=e6e(e));var s=ik;return E.createElement(d5e,{context:s,store:a.current},n)}function t6e(t){var{layout:e,margin:n}=t,i=ei(),r=sa();return E.useEffect(()=>{r||(i(z3e(e)),i(F3e(n)))},[i,r,e,n]),null}var cJ=E.memo(t6e,rM);function uJ(t){var e=ei();return E.useEffect(()=>{e(X8e(t))},[e,t]),null}function D$(t){var{zIndex:e,isPanorama:n}=t,i=n?"recharts-zindex-panorama-":"recharts-zindex-",r=CQ("".concat(i).concat(e)),a=ei();return E.useLayoutEffect(()=>(a(Z4e({zIndex:e,elementId:r,isPanorama:n})),()=>{a(Q4e({zIndex:e,isPanorama:n}))}),[a,e,r,n]),E.createElement("g",{tabIndex:-1,id:r})}function k$(t){var{children:e,isPanorama:n}=t,i=At(B4e);if(!i||i.length===0)return e;var r=i.filter(s=>s<0),a=i.filter(s=>s>0);return E.createElement(E.Fragment,null,r.map(s=>E.createElement(D$,{key:s,zIndex:s,isPanorama:n})),e,a.map(s=>E.createElement(D$,{key:s,zIndex:s,isPanorama:n})))}var n6e=["children"];function i6e(t,e){if(t==null)return{};var n,i,r=r6e(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 r6e(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 PS(){return PS=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},PS.apply(null,arguments)}var a6e={width:"100%",height:"100%",display:"block"},s6e=E.forwardRef((t,e)=>{var n=pk(),i=mk(),r=WK();if(!il(n)||!il(i))return null;var{children:a,otherAttributes:s,title:o,desc:l}=t,c,d;return s!=null&&(typeof s.tabIndex=="number"?c=s.tabIndex:c=r?0:void 0,typeof s.role=="string"?d=s.role:d=r?"application":void 0),E.createElement(qD,PS({},s,{title:o,desc:l,role:d,tabIndex:c,width:n,height:i,style:a6e,ref:e}),a)}),o6e=t=>{var{children:e}=t,n=At(Rw);if(!n)return null;var{width:i,height:r,y:a,x:s}=n;return E.createElement(qD,{width:i,height:r,x:s,y:a},e)},O$=E.forwardRef((t,e)=>{var{children:n}=t,i=i6e(t,n6e),r=sa();return r?E.createElement(o6e,null,E.createElement(k$,{isPanorama:!0},n)):E.createElement(s6e,PS({ref:e},i),E.createElement(k$,{isPanorama:!1},n))});function l6e(){var t=ei(),[e,n]=E.useState(null),i=At(sRe);return E.useEffect(()=>{if(e!=null){var r=e.getBoundingClientRect(),a=r.width/e.offsetWidth;oi(a)&&a!==i&&t(H3e(a))}},[e,t,i]),n}function L$(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 c6e(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?L$(Object(n),!0).forEach(function(i){u6e(t,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):L$(Object(n)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(n,i))})}return t}function u6e(t,e,n){return(e=d6e(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function d6e(t){var e=f6e(t,"string");return typeof e=="symbol"?e:e+""}function f6e(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 Ff(){return Ff=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},Ff.apply(null,arguments)}var h6e=()=>(EUe(),null);function DS(t){if(typeof t=="number")return t;if(typeof t=="string"){var e=parseFloat(t);if(!Number.isNaN(e))return e}return 0}var p6e=E.forwardRef((t,e)=>{var n,i,r=E.useRef(null),[a,s]=E.useState({containerWidth:DS((n=t.style)===null||n===void 0?void 0:n.width),containerHeight:DS((i=t.style)===null||i===void 0?void 0:i.height)}),o=E.useCallback((c,d)=>{s(f=>{var m=Math.round(c),g=Math.round(d);return f.containerWidth===m&&f.containerHeight===g?f:{containerWidth:m,containerHeight:g}})},[]),l=E.useCallback(c=>{if(typeof e=="function"&&e(c),c!=null&&typeof ResizeObserver<"u"){var{width:d,height:f}=c.getBoundingClientRect();o(d,f);var m=y=>{var{width:_,height:v}=y[0].contentRect;o(_,v)},g=new ResizeObserver(m);g.observe(c),r.current=g}},[e,o]);return E.useEffect(()=>()=>{var c=r.current;c?.disconnect()},[o]),E.createElement(E.Fragment,null,E.createElement(Dw,{width:a.containerWidth,height:a.containerHeight}),E.createElement("div",Ff({ref:l},t)))}),m6e=E.forwardRef((t,e)=>{var{width:n,height:i}=t,[r,a]=E.useState({containerWidth:DS(n),containerHeight:DS(i)}),s=E.useCallback((l,c)=>{a(d=>{var f=Math.round(l),m=Math.round(c);return d.containerWidth===f&&d.containerHeight===m?d:{containerWidth:f,containerHeight:m}})},[]),o=E.useCallback(l=>{if(typeof e=="function"&&e(l),l!=null){var{width:c,height:d}=l.getBoundingClientRect();s(c,d)}},[e,s]);return E.createElement(E.Fragment,null,E.createElement(Dw,{width:r.containerWidth,height:r.containerHeight}),E.createElement("div",Ff({ref:o},t)))}),g6e=E.forwardRef((t,e)=>{var{width:n,height:i}=t;return E.createElement(E.Fragment,null,E.createElement(Dw,{width:n,height:i}),E.createElement("div",Ff({ref:e},t)))}),x6e=E.forwardRef((t,e)=>{var{width:n,height:i}=t;return gc(n)||gc(i)?E.createElement(m6e,Ff({},t,{ref:e})):E.createElement(g6e,Ff({},t,{ref:e}))});function v6e(t){return t===!0?p6e:x6e}var y6e=E.forwardRef((t,e)=>{var{children:n,className:i,height:r,onClick:a,onContextMenu:s,onDoubleClick:o,onMouseDown:l,onMouseEnter:c,onMouseLeave:d,onMouseMove:f,onMouseUp:m,onTouchEnd:g,onTouchMove:y,onTouchStart:_,style:v,width:x,responsive:M,dispatchTouchEvents:w=!0}=t,T=E.useRef(null),C=ei(),[P,A]=E.useState(null),[U,N]=E.useState(null),D=l6e(),F=hk(),I=F?.width>0?F.width:x,W=F?.height>0?F.height:r,O=E.useCallback(he=>{D(he),typeof e=="function"&&e(he),A(he),N(he),he!=null&&(T.current=he)},[D,e,A,N]),B=E.useCallback(he=>{C(QQ(he)),C(Cs({handler:a,reactEvent:he}))},[C,a]),H=E.useCallback(he=>{C(aP(he)),C(Cs({handler:c,reactEvent:he}))},[C,c]),$=E.useCallback(he=>{C(UZ()),C(Cs({handler:d,reactEvent:he}))},[C,d]),K=E.useCallback(he=>{C(aP(he)),C(Cs({handler:f,reactEvent:he}))},[C,f]),Z=E.useCallback(()=>{C(rJ())},[C]),se=E.useCallback(he=>{C(iJ(he.key))},[C]),V=E.useCallback(he=>{C(Cs({handler:s,reactEvent:he}))},[C,s]),X=E.useCallback(he=>{C(Cs({handler:o,reactEvent:he}))},[C,o]),ae=E.useCallback(he=>{C(Cs({handler:l,reactEvent:he}))},[C,l]),ce=E.useCallback(he=>{C(Cs({handler:m,reactEvent:he}))},[C,m]),ge=E.useCallback(he=>{C(Cs({handler:_,reactEvent:he}))},[C,_]),ne=E.useCallback(he=>{w&&C(sJ(he)),C(Cs({handler:y,reactEvent:he}))},[C,w,y]),ve=E.useCallback(he=>{C(Cs({handler:g,reactEvent:he}))},[C,g]),Pe=v6e(M);return E.createElement(iQ.Provider,{value:P},E.createElement(dX.Provider,{value:U},E.createElement(Pe,{width:I??v?.width,height:W??v?.height,className:En("recharts-wrapper",i),style:c6e({position:"relative",cursor:"default",width:I,height:W},v),onClick:B,onContextMenu:V,onDoubleClick:X,onFocus:Z,onKeyDown:se,onMouseDown:ae,onMouseEnter:H,onMouseLeave:$,onMouseMove:K,onMouseUp:ce,onTouchEnd:ve,onTouchMove:ne,onTouchStart:ge,ref:O},E.createElement(h6e,null),n)))}),b6e=["width","height","responsive","children","className","style","compact","title","desc"];function _6e(t,e){if(t==null)return{};var n,i,r=S6e(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 S6e(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 dJ=E.forwardRef((t,e)=>{var{width:n,height:i,responsive:r,children:a,className:s,style:o,compact:l,title:c,desc:d}=t,f=_6e(t,b6e),m=za(f);return l?E.createElement(E.Fragment,null,E.createElement(Dw,{width:n,height:i}),E.createElement(O$,{otherAttributes:m,title:c,desc:d},a)):E.createElement(y6e,{className:s,style:o,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},E.createElement(O$,{otherAttributes:m,title:c,desc:d,ref:e},E.createElement(vBe,null,a)))});function sP(){return sP=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},sP.apply(null,arguments)}var w6e={top:5,right:5,bottom:5,left:5},M6e={accessibilityLayer:!0,barCategoryGap:"10%",barGap:4,layout:"horizontal",margin:w6e,responsive:!1,reverseStackOrder:!1,stackOffset:"none",syncMethod:"index"},fJ=E.forwardRef(function(e,n){var i,r=Yi(e.categoricalChartProps,M6e),{chartName:a,defaultTooltipEventType:s,validateTooltipEventTypes:o,tooltipPayloadSearcher:l,categoricalChartProps:c}=e,d={chartName:a,defaultTooltipEventType:s,validateTooltipEventTypes:o,tooltipPayloadSearcher:l,eventEmitter:void 0};return E.createElement(lJ,{preloadedState:{options:d},reduxStoreName:(i=c.id)!==null&&i!==void 0?i:a},E.createElement(jQ,{chartData:c.data}),E.createElement(cJ,{layout:r.layout,margin:r.margin}),E.createElement(uJ,{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}),E.createElement(dJ,sP({},r,{ref:n})))}),E6e=["axis","item"],A6e=E.forwardRef((t,e)=>E.createElement(fJ,{chartName:"BarChart",defaultTooltipEventType:"axis",validateTooltipEventTypes:E6e,tooltipPayloadSearcher:TO,categoricalChartProps:t,ref:e}));function T6e(t){var e=ei();return E.useEffect(()=>{e(K8e(t))},[e,t]),null}var C6e=["layout"];function oP(){return oP=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},oP.apply(null,arguments)}function N6e(t,e){if(t==null)return{};var n,i,r=R6e(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 R6e(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 P6e={top:5,right:5,bottom:5,left:5},hJ={accessibilityLayer:!0,stackOffset:"none",barCategoryGap:"10%",barGap:4,margin:P6e,reverseStackOrder:!1,syncMethod:"index",layout:"radial",responsive:!1,cx:"50%",cy:"50%",innerRadius:0,outerRadius:"80%"},D6e=E.forwardRef(function(e,n){var i,r=Yi(e.categoricalChartProps,hJ),{layout:a}=r,s=N6e(r,C6e),{chartName:o,defaultTooltipEventType:l,validateTooltipEventTypes:c,tooltipPayloadSearcher:d}=e,f={chartName:o,defaultTooltipEventType:l,validateTooltipEventTypes:c,tooltipPayloadSearcher:d,eventEmitter:void 0};return E.createElement(lJ,{preloadedState:{options:f},reduxStoreName:(i=r.id)!==null&&i!==void 0?i:o},E.createElement(jQ,{chartData:r.data}),E.createElement(cJ,{layout:a,margin:r.margin}),E.createElement(uJ,{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}),E.createElement(T6e,{cx:r.cx,cy:r.cy,startAngle:r.startAngle,endAngle:r.endAngle,innerRadius:r.innerRadius,outerRadius:r.outerRadius}),E.createElement(dJ,oP({},s,{ref:n})))});function I$(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 U$(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?I$(Object(n),!0).forEach(function(i){k6e(t,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):I$(Object(n)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(n,i))})}return t}function k6e(t,e,n){return(e=O6e(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function O6e(t){var e=L6e(t,"string");return typeof e=="symbol"?e:e+""}function L6e(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 I6e=["item"],U6e=U$(U$({},hJ),{},{layout:"centric",startAngle:0,endAngle:360}),j6e=E.forwardRef((t,e)=>{var n=Yi(t,U6e);return E.createElement(D6e,{chartName:"PieChart",defaultTooltipEventType:"item",validateTooltipEventTypes:I6e,tooltipPayloadSearcher:TO,categoricalChartProps:n,ref:e})}),F6e=["axis"],z6e=E.forwardRef((t,e)=>E.createElement(fJ,{chartName:"AreaChart",defaultTooltipEventType:"axis",validateTooltipEventTypes:F6e,tooltipPayloadSearcher:TO,categoricalChartProps:t,ref:e}));const t_=["#00ae42","#3b82f6","#f59e0b","#ef4444","#8b5cf6","#ec4899","#14b8a6","#f97316"];function B6e(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 H6e({archives:t,currency:e="$"}){const[n,i]=E.useState("30d"),r=E.useMemo(()=>{const m=B6e(n);return t.filter(g=>new Date(g.completed_at||g.created_at)>=m)},[t,n]),a=E.useMemo(()=>{const m=new Map;return r.forEach(g=>{const _=new Date(g.completed_at||g.created_at).toISOString().split("T")[0],v=m.get(_)||{date:_,filament:0,cost:0,prints:0};v.filament+=g.filament_used_grams||0,v.cost+=g.cost||0,v.prints+=1,m.set(_,v)}),Array.from(m.values()).sort((g,y)=>g.date.localeCompare(y.date)).map(g=>({...g,dateLabel:new Date(g.date).toLocaleDateString("en-US",{month:"short",day:"numeric"})}))},[r]),s=E.useMemo(()=>{if(n==="7d"||n==="30d")return a;const m=new Map;return r.forEach(g=>{const y=new Date(g.completed_at||g.created_at),_=new Date(y);_.setDate(y.getDate()-y.getDay());const v=_.toISOString().split("T")[0],x=m.get(v)||{week:v,filament:0,cost:0,prints:0};x.filament+=g.filament_used_grams||0,x.cost+=g.cost||0,x.prints+=1,m.set(v,x)}),Array.from(m.values()).sort((g,y)=>g.week.localeCompare(y.week)).map(g=>({date:g.week,dateLabel:`Week of ${new Date(g.week).toLocaleDateString("en-US",{month:"short",day:"numeric"})}`,...g}))},[r,a,n]),o=E.useMemo(()=>{const m=new Map;return r.forEach(g=>{const _=(g.filament_type||"Unknown").split(", ");_.forEach(v=>{const x=(g.filament_used_grams||0)/_.length;m.set(v,(m.get(v)||0)+x)})}),Array.from(m.entries()).map(([g,y])=>({name:g,value:Math.round(y)})).sort((g,y)=>y.value-g.value)},[r]),l=E.useMemo(()=>{const m=new Date,g=[];for(let y=5;y>=0;y--){const _=new Date(m.getFullYear(),m.getMonth()-y,1),v=new Date(m.getFullYear(),m.getMonth()-y+1,0),x=_.toLocaleDateString("en-US",{month:"short",year:"2-digit"}),M=t.filter(w=>{const T=new Date(w.completed_at||w.created_at);return T>=_&&T<=v});g.push({month:x,filament:Math.round(M.reduce((w,T)=>w+(T.filament_used_grams||0),0)),cost:M.reduce((w,T)=>w+(T.cost||0),0),prints:M.length})}return g},[t]),c=n==="7d"||n==="30d"?a:s,d=r.reduce((m,g)=>m+(g.filament_used_grams||0),0),f=r.reduce((m,g)=>m+(g.cost||0),0);return p.jsxs("div",{className:"space-y-6",children:[p.jsxs("div",{className:"flex items-center justify-between",children:[p.jsx("h3",{className:"text-lg font-semibold text-white",children:"Filament Usage Trends"}),p.jsx("div",{className:"flex gap-1 bg-bambu-dark rounded-lg p-1",children:["7d","30d","90d","365d","all"].map(m=>p.jsx("button",{onClick:()=>i(m),className:`px-3 py-1 text-sm rounded-md transition-colors ${n===m?"bg-bambu-green text-white":"text-bambu-gray hover:text-white"}`,children:m==="all"?"All":m.replace("d","D")},m))})]}),p.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[p.jsxs("div",{className:"bg-bambu-dark rounded-lg p-4",children:[p.jsx("p",{className:"text-sm text-bambu-gray",children:"Period Filament"}),p.jsxs("p",{className:"text-2xl font-bold text-white",children:[(d/1e3).toFixed(2),"kg"]}),p.jsxs("p",{className:"text-xs text-bambu-gray",children:[d.toFixed(0),"g total"]})]}),p.jsxs("div",{className:"bg-bambu-dark rounded-lg p-4",children:[p.jsx("p",{className:"text-sm text-bambu-gray",children:"Period Cost"}),p.jsxs("p",{className:"text-2xl font-bold text-white",children:[e,f.toFixed(2)]}),p.jsxs("p",{className:"text-xs text-bambu-gray",children:[r.length," prints"]})]}),p.jsxs("div",{className:"bg-bambu-dark rounded-lg p-4",children:[p.jsx("p",{className:"text-sm text-bambu-gray",children:"Avg per Print"}),p.jsxs("p",{className:"text-2xl font-bold text-white",children:[r.length>0?(d/r.length).toFixed(0):0,"g"]}),p.jsxs("p",{className:"text-xs text-bambu-gray",children:[e,r.length>0?(f/r.length).toFixed(2):"0.00"," avg"]})]})]}),c.length>0?p.jsxs("div",{className:"bg-bambu-dark rounded-lg p-4",children:[p.jsx("h4",{className:"text-sm font-medium text-bambu-gray mb-4",children:"Usage Over Time"}),p.jsx(yC,{width:"100%",height:250,children:p.jsxs(z6e,{data:c,children:[p.jsx("defs",{children:p.jsxs("linearGradient",{id:"colorFilament",x1:"0",y1:"0",x2:"0",y2:"1",children:[p.jsx("stop",{offset:"5%",stopColor:"#00ae42",stopOpacity:.3}),p.jsx("stop",{offset:"95%",stopColor:"#00ae42",stopOpacity:0})]})}),p.jsx(eP,{strokeDasharray:"3 3",stroke:"#3d3d3d"}),p.jsx(nP,{dataKey:"dateLabel",stroke:"#9ca3af",tick:{fontSize:12},interval:"preserveStartEnd"}),p.jsx(rP,{stroke:"#9ca3af",tick:{fontSize:12},tickFormatter:m=>`${m}g`}),p.jsx(UC,{contentStyle:{backgroundColor:"#2d2d2d",border:"1px solid #3d3d3d",borderRadius:"8px"},labelStyle:{color:"#fff"},formatter:m=>[`${m.toFixed(0)}g`,"Filament"]}),p.jsx(YQ,{type:"monotone",dataKey:"filament",stroke:"#00ae42",strokeWidth:2,fillOpacity:1,fill:"url(#colorFilament)"})]})})]}):p.jsx("div",{className:"bg-bambu-dark rounded-lg p-8 text-center text-bambu-gray",children:"No data for selected time range"}),p.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[p.jsxs("div",{className:"bg-bambu-dark rounded-lg p-4",children:[p.jsx("h4",{className:"text-sm font-medium text-bambu-gray mb-4",children:"By Filament Type"}),o.length>0?p.jsxs("div",{className:"flex items-center gap-4",children:[p.jsx(yC,{width:160,height:160,children:p.jsxs(j6e,{children:[p.jsx(PQ,{data:o,cx:"50%",cy:"50%",innerRadius:40,outerRadius:70,paddingAngle:2,dataKey:"value",children:o.map((m,g)=>p.jsx(cv,{fill:t_[g%t_.length]},`cell-${g}`))}),p.jsx(UC,{contentStyle:{backgroundColor:"#2d2d2d",border:"1px solid #3d3d3d",borderRadius:"8px"},formatter:m=>[`${m}g`,"Usage"]})]})}),p.jsx("div",{className:"flex-1 space-y-2 overflow-hidden",children:o.map((m,g)=>{const y=o.reduce((v,x)=>v+x.value,0),_=y>0?(m.value/y*100).toFixed(0):0;return p.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[p.jsx("div",{className:"w-3 h-3 rounded-sm flex-shrink-0",style:{backgroundColor:t_[g%t_.length]}}),p.jsx("span",{className:"text-white truncate flex-1",children:m.name}),p.jsxs("span",{className:"text-bambu-gray flex-shrink-0",children:[_,"%"]})]},m.name)})})]}):p.jsx("div",{className:"h-[160px] flex items-center justify-center text-bambu-gray",children:"No filament data"})]}),p.jsxs("div",{className:"bg-bambu-dark rounded-lg p-4",children:[p.jsx("h4",{className:"text-sm font-medium text-bambu-gray mb-4",children:"Monthly Comparison"}),p.jsx(yC,{width:"100%",height:200,children:p.jsxs(A6e,{data:l,children:[p.jsx(eP,{strokeDasharray:"3 3",stroke:"#3d3d3d"}),p.jsx(nP,{dataKey:"month",stroke:"#9ca3af",tick:{fontSize:12}}),p.jsx(rP,{stroke:"#9ca3af",tick:{fontSize:12},tickFormatter:m=>`${m}g`}),p.jsx(UC,{contentStyle:{backgroundColor:"#2d2d2d",border:"1px solid #3d3d3d",borderRadius:"8px"},formatter:(m,g)=>[g==="filament"?`${m}g`:g==="cost"?`${e}${m.toFixed(2)}`:m,g==="filament"?"Filament":g==="cost"?"Cost":"Prints"]}),p.jsx(GK,{}),p.jsx(IQ,{dataKey:"filament",name:"Filament (g)",fill:"#00ae42",radius:[4,4,0,0]})]})})]})]})]})}function V6e(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return E.useMemo(()=>i=>{e.forEach(r=>r(i))},e)}const aM=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Pm(t){const e=Object.prototype.toString.call(t);return e==="[object Window]"||e==="[object global]"}function WO(t){return"nodeType"in t}function $a(t){var e,n;return t?Pm(t)?t:WO(t)&&(e=(n=t.ownerDocument)==null?void 0:n.defaultView)!=null?e:window:window}function qO(t){const{Document:e}=$a(t);return t instanceof e}function dv(t){return Pm(t)?!1:t instanceof $a(t).HTMLElement}function pJ(t){return t instanceof $a(t).SVGElement}function Dm(t){return t?Pm(t)?t.document:WO(t)?qO(t)?t:dv(t)||pJ(t)?t.ownerDocument:document:document:document}const al=aM?E.useLayoutEffect:E.useEffect;function XO(t){const e=E.useRef(t);return al(()=>{e.current=t}),E.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 $6e(){const t=E.useRef(null),e=E.useCallback((i,r)=>{t.current=setInterval(i,r)},[]),n=E.useCallback(()=>{t.current!==null&&(clearInterval(t.current),t.current=null)},[]);return[e,n]}function _x(t,e){e===void 0&&(e=[t]);const n=E.useRef(t);return al(()=>{n.current!==t&&(n.current=t)},e),n}function fv(t,e){const n=E.useRef();return E.useMemo(()=>{const i=t(n.current);return n.current=i,i},[...e])}function kS(t){const e=XO(t),n=E.useRef(null),i=E.useCallback(r=>{r!==n.current&&e?.(r,n.current),n.current=r},[]);return[n,i]}function lP(t){const e=E.useRef();return E.useEffect(()=>{e.current=t},[t]),e.current}let JC={};function hv(t,e){return E.useMemo(()=>{if(e)return e;const n=JC[t]==null?0:JC[t]+1;return JC[t]=n,t+"-"+n},[t,e])}function mJ(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 o=Object.entries(s);for(const[l,c]of o){const d=a[l];d!=null&&(a[l]=d+t*c)}return a},{...e})}}const Lp=mJ(1),Sx=mJ(-1);function G6e(t){return"clientX"in t&&"clientY"in t}function KO(t){if(!t)return!1;const{KeyboardEvent:e}=$a(t.target);return e&&t instanceof e}function W6e(t){if(!t)return!1;const{TouchEvent:e}=$a(t.target);return e&&t instanceof e}function cP(t){if(W6e(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 G6e(t)?{x:t.clientX,y:t.clientY}:null}const wx=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[wx.Translate.toString(t),wx.Scale.toString(t)].join(" ")}},Transition:{toString(t){let{property:e,duration:n,easing:i}=t;return e+" "+n+"ms "+i}}}),j$="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function q6e(t){return t.matches(j$)?t:t.querySelector(j$)}const X6e={display:"none"};function K6e(t){let{id:e,value:n}=t;return ui.createElement("div",{id:e,style:X6e},n)}function Y6e(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 ui.createElement("div",{id:e,style:r,role:"status","aria-live":i,"aria-atomic":!0},n)}function Z6e(){const[t,e]=E.useState("");return{announce:E.useCallback(i=>{i!=null&&e(i)},[]),announcement:t}}const gJ=E.createContext(null);function Q6e(t){const e=E.useContext(gJ);E.useEffect(()=>{if(!e)throw new Error("useDndMonitor must be used within a children of <DndContext>");return e(t)},[t,e])}function J6e(){const[t]=E.useState(()=>new Set),e=E.useCallback(i=>(t.add(i),()=>t.delete(i)),[t]);return[E.useCallback(i=>{let{type:r,event:a}=i;t.forEach(s=>{var o;return(o=s[r])==null?void 0:o.call(s,a)})},[t]),e]}const eHe={draggable:`
  8218. To pick up a draggable item, press the space bar.
  8219. While dragging, use the arrow keys to move the item.
  8220. Press space again to drop the item in its new position, or press escape to cancel.
  8221. `},tHe={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 nHe(t){let{announcements:e=tHe,container:n,hiddenTextDescribedById:i,screenReaderInstructions:r=eHe}=t;const{announce:a,announcement:s}=Z6e(),o=hv("DndLiveRegion"),[l,c]=E.useState(!1);if(E.useEffect(()=>{c(!0)},[]),Q6e(E.useMemo(()=>({onDragStart(f){let{active:m}=f;a(e.onDragStart({active:m}))},onDragMove(f){let{active:m,over:g}=f;e.onDragMove&&a(e.onDragMove({active:m,over:g}))},onDragOver(f){let{active:m,over:g}=f;a(e.onDragOver({active:m,over:g}))},onDragEnd(f){let{active:m,over:g}=f;a(e.onDragEnd({active:m,over:g}))},onDragCancel(f){let{active:m,over:g}=f;a(e.onDragCancel({active:m,over:g}))}}),[a,e])),!l)return null;const d=ui.createElement(ui.Fragment,null,ui.createElement(K6e,{id:i,value:r.draggable}),ui.createElement(Y6e,{id:o,announcement:s}));return n?Xl.createPortal(d,n):d}var nr;(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"})(nr||(nr={}));function OS(){}function F$(t,e){return E.useMemo(()=>({sensor:t,options:e??{}}),[t,e])}function iHe(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return E.useMemo(()=>[...e].filter(i=>i!=null),[...e])}const So=Object.freeze({x:0,y:0});function xJ(t,e){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))}function vJ(t,e){let{data:{value:n}}=t,{data:{value:i}}=e;return n-i}function rHe(t,e){let{data:{value:n}}=t,{data:{value:i}}=e;return i-n}function z$(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 yJ(t,e){if(!t||t.length===0)return null;const[n]=t;return n[e]}function B$(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 aHe=t=>{let{collisionRect:e,droppableRects:n,droppableContainers:i}=t;const r=B$(e,e.left,e.top),a=[];for(const s of i){const{id:o}=s,l=n.get(o);if(l){const c=xJ(B$(l),r);a.push({id:o,data:{droppableContainer:s,value:c}})}}return a.sort(vJ)},sHe=t=>{let{collisionRect:e,droppableRects:n,droppableContainers:i}=t;const r=z$(e),a=[];for(const s of i){const{id:o}=s,l=n.get(o);if(l){const c=z$(l),d=r.reduce((m,g,y)=>m+xJ(c[y],g),0),f=Number((d/4).toFixed(4));a.push({id:o,data:{droppableContainer:s,value:f}})}}return a.sort(vJ)};function oHe(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,o=a-n;if(i<r&&n<a){const l=e.width*e.height,c=t.width*t.height,d=s*o,f=d/(l+c-d);return Number(f.toFixed(4))}return 0}const lHe=t=>{let{collisionRect:e,droppableRects:n,droppableContainers:i}=t;const r=[];for(const a of i){const{id:s}=a,o=n.get(s);if(o){const l=oHe(o,e);l>0&&r.push({id:s,data:{droppableContainer:a,value:l}})}}return r.sort(rHe)};function cHe(t,e,n){return{...t,scaleX:e&&n?e.width/n.width:1,scaleY:e&&n?e.height/n.height:1}}function bJ(t,e){return t&&e?{x:t.left-e.left,y:t.top-e.top}:So}function uHe(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,o)=>({...s,top:s.top+t*o.y,bottom:s.bottom+t*o.y,left:s.left+t*o.x,right:s.right+t*o.x}),{...n})}}const dHe=uHe(1);function fHe(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 hHe(t,e,n){const i=fHe(e);if(!i)return t;const{scaleX:r,scaleY:a,x:s,y:o}=i,l=t.left-s-(1-r)*parseFloat(n),c=t.top-o-(1-a)*parseFloat(n.slice(n.indexOf(" ")+1)),d=r?t.width/r:t.width,f=a?t.height/a:t.height;return{width:d,height:f,top:c,right:l+d,bottom:c+f,left:l}}const pHe={ignoreTransform:!1};function km(t,e){e===void 0&&(e=pHe);let n=t.getBoundingClientRect();if(e.ignoreTransform){const{transform:c,transformOrigin:d}=$a(t).getComputedStyle(t);c&&(n=hHe(n,c,d))}const{top:i,left:r,width:a,height:s,bottom:o,right:l}=n;return{top:i,left:r,width:a,height:s,bottom:o,right:l}}function H$(t){return km(t,{ignoreTransform:!0})}function mHe(t){const e=t.innerWidth,n=t.innerHeight;return{top:0,left:0,right:e,bottom:n,width:e,height:n}}function gHe(t,e){return e===void 0&&(e=$a(t).getComputedStyle(t)),e.position==="fixed"}function xHe(t,e){e===void 0&&(e=$a(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 sM(t,e){const n=[];function i(r){if(e!=null&&n.length>=e||!r)return n;if(qO(r)&&r.scrollingElement!=null&&!n.includes(r.scrollingElement))return n.push(r.scrollingElement),n;if(!dv(r)||pJ(r)||n.includes(r))return n;const a=$a(t).getComputedStyle(r);return r!==t&&xHe(r,a)&&n.push(r),gHe(r,a)?n:i(r.parentNode)}return t?i(t):n}function _J(t){const[e]=sM(t,1);return e??null}function eN(t){return!aM||!t?null:Pm(t)?t:WO(t)?qO(t)||t===Dm(t).scrollingElement?window:dv(t)?t:null:null}function SJ(t){return Pm(t)?t.scrollX:t.scrollLeft}function wJ(t){return Pm(t)?t.scrollY:t.scrollTop}function uP(t){return{x:SJ(t),y:wJ(t)}}var wr;(function(t){t[t.Forward=1]="Forward",t[t.Backward=-1]="Backward"})(wr||(wr={}));function MJ(t){return!aM||!t?!1:t===document.scrollingElement}function EJ(t){const e={x:0,y:0},n=MJ(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,o=t.scrollLeft>=i.x;return{isTop:r,isLeft:a,isBottom:s,isRight:o,maxScroll:i,minScroll:e}}const vHe={x:.2,y:.2};function yHe(t,e,n,i,r){let{top:a,left:s,right:o,bottom:l}=n;i===void 0&&(i=10),r===void 0&&(r=vHe);const{isTop:c,isBottom:d,isLeft:f,isRight:m}=EJ(t),g={x:0,y:0},y={x:0,y:0},_={height:e.height*r.y,width:e.width*r.x};return!c&&a<=e.top+_.height?(g.y=wr.Backward,y.y=i*Math.abs((e.top+_.height-a)/_.height)):!d&&l>=e.bottom-_.height&&(g.y=wr.Forward,y.y=i*Math.abs((e.bottom-_.height-l)/_.height)),!m&&o>=e.right-_.width?(g.x=wr.Forward,y.x=i*Math.abs((e.right-_.width-o)/_.width)):!f&&s<=e.left+_.width&&(g.x=wr.Backward,y.x=i*Math.abs((e.left+_.width-s)/_.width)),{direction:g,speed:y}}function bHe(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 AJ(t){return t.reduce((e,n)=>Lp(e,uP(n)),So)}function _He(t){return t.reduce((e,n)=>e+SJ(n),0)}function SHe(t){return t.reduce((e,n)=>e+wJ(n),0)}function wHe(t,e){if(e===void 0&&(e=km),!t)return;const{top:n,left:i,bottom:r,right:a}=e(t);_J(t)&&(r<=0||a<=0||n>=window.innerHeight||i>=window.innerWidth)&&t.scrollIntoView({block:"center",inline:"center"})}const MHe=[["x",["left","right"],_He],["y",["top","bottom"],SHe]];class YO{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=sM(n),r=AJ(i);this.rect={...e},this.width=e.width,this.height=e.height;for(const[a,s,o]of MHe)for(const l of s)Object.defineProperty(this,l,{get:()=>{const c=o(i),d=r[a]-c;return this.rect[l]+d},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class A0{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 EHe(t){const{EventTarget:e}=$a(t);return t instanceof e?t:Dm(t)}function tN(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 Os;(function(t){t.Click="click",t.DragStart="dragstart",t.Keydown="keydown",t.ContextMenu="contextmenu",t.Resize="resize",t.SelectionChange="selectionchange",t.VisibilityChange="visibilitychange"})(Os||(Os={}));function V$(t){t.preventDefault()}function AHe(t){t.stopPropagation()}var bn;(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"})(bn||(bn={}));const TJ={start:[bn.Space,bn.Enter],cancel:[bn.Esc],end:[bn.Space,bn.Enter,bn.Tab]},THe=(t,e)=>{let{currentCoordinates:n}=e;switch(t.code){case bn.Right:return{...n,x:n.x+25};case bn.Left:return{...n,x:n.x-25};case bn.Down:return{...n,y:n.y+25};case bn.Up:return{...n,y:n.y-25}}};class ZO{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 A0(Dm(n)),this.windowListeners=new A0($a(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Os.Resize,this.handleCancel),this.windowListeners.add(Os.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Os.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:e,onStart:n}=this.props,i=e.node.current;i&&wHe(i),n(So)}handleKeyDown(e){if(KO(e)){const{active:n,context:i,options:r}=this.props,{keyboardCodes:a=TJ,coordinateGetter:s=THe,scrollBehavior:o="smooth"}=r,{code:l}=e;if(a.end.includes(l)){this.handleEnd(e);return}if(a.cancel.includes(l)){this.handleCancel(e);return}const{collisionRect:c}=i.current,d=c?{x:c.left,y:c.top}:So;this.referenceCoordinates||(this.referenceCoordinates=d);const f=s(e,{active:n,context:i.current,currentCoordinates:d});if(f){const m=Sx(f,d),g={x:0,y:0},{scrollableAncestors:y}=i.current;for(const _ of y){const v=e.code,{isTop:x,isRight:M,isLeft:w,isBottom:T,maxScroll:C,minScroll:P}=EJ(_),A=bHe(_),U={x:Math.min(v===bn.Right?A.right-A.width/2:A.right,Math.max(v===bn.Right?A.left:A.left+A.width/2,f.x)),y:Math.min(v===bn.Down?A.bottom-A.height/2:A.bottom,Math.max(v===bn.Down?A.top:A.top+A.height/2,f.y))},N=v===bn.Right&&!M||v===bn.Left&&!w,D=v===bn.Down&&!T||v===bn.Up&&!x;if(N&&U.x!==f.x){const F=_.scrollLeft+m.x,I=v===bn.Right&&F<=C.x||v===bn.Left&&F>=P.x;if(I&&!m.y){_.scrollTo({left:F,behavior:o});return}I?g.x=_.scrollLeft-F:g.x=v===bn.Right?_.scrollLeft-C.x:_.scrollLeft-P.x,g.x&&_.scrollBy({left:-g.x,behavior:o});break}else if(D&&U.y!==f.y){const F=_.scrollTop+m.y,I=v===bn.Down&&F<=C.y||v===bn.Up&&F>=P.y;if(I&&!m.x){_.scrollTo({top:F,behavior:o});return}I?g.y=_.scrollTop-F:g.y=v===bn.Down?_.scrollTop-C.y:_.scrollTop-P.y,g.y&&_.scrollBy({top:-g.y,behavior:o});break}}this.handleMove(e,Lp(Sx(f,this.referenceCoordinates),g))}}}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()}}ZO.activators=[{eventName:"onKeyDown",handler:(t,e,n)=>{let{keyboardCodes:i=TJ,onActivation:r}=e,{active:a}=n;const{code:s}=t.nativeEvent;if(i.start.includes(s)){const o=a.activatorNode.current;return o&&t.target!==o?!1:(t.preventDefault(),r?.({event:t.nativeEvent}),!0)}return!1}}];function $$(t){return!!(t&&"distance"in t)}function G$(t){return!!(t&&"delay"in t)}class QO{constructor(e,n,i){var r;i===void 0&&(i=EHe(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=Dm(s),this.documentListeners=new A0(this.document),this.listeners=new A0(i),this.windowListeners=new A0($a(s)),this.initialCoordinates=(r=cP(a))!=null?r:So,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(Os.Resize,this.handleCancel),this.windowListeners.add(Os.DragStart,V$),this.windowListeners.add(Os.VisibilityChange,this.handleCancel),this.windowListeners.add(Os.ContextMenu,V$),this.documentListeners.add(Os.Keydown,this.handleKeydown),n){if(i!=null&&i({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(G$(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if($$(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(Os.Click,AHe,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Os.SelectionChange,this.removeTextSelection),n(e))}handleMove(e){var n;const{activated:i,initialCoordinates:r,props:a}=this,{onMove:s,options:{activationConstraint:o}}=a;if(!r)return;const l=(n=cP(e))!=null?n:So,c=Sx(r,l);if(!i&&o){if($$(o)){if(o.tolerance!=null&&tN(c,o.tolerance))return this.handleCancel();if(tN(c,o.distance))return this.handleStart()}if(G$(o)&&tN(c,o.tolerance))return this.handleCancel();this.handlePending(o,c);return}e.cancelable&&e.preventDefault(),s(l)}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===bn.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}}const CHe={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class JO extends QO{constructor(e){const{event:n}=e,i=Dm(n.target);super(e,CHe,i)}}JO.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 NHe={move:{name:"mousemove"},end:{name:"mouseup"}};var dP;(function(t){t[t.RightClick=2]="RightClick"})(dP||(dP={}));class RHe extends QO{constructor(e){super(e,NHe,Dm(e.event.target))}}RHe.activators=[{eventName:"onMouseDown",handler:(t,e)=>{let{nativeEvent:n}=t,{onActivation:i}=e;return n.button===dP.RightClick?!1:(i?.({event:n}),!0)}}];const nN={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class PHe extends QO{constructor(e){super(e,nN)}static setup(){return window.addEventListener(nN.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(nN.move.name,e)};function e(){}}}PHe.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 T0;(function(t){t[t.Pointer=0]="Pointer",t[t.DraggableRect=1]="DraggableRect"})(T0||(T0={}));var LS;(function(t){t[t.TreeOrder=0]="TreeOrder",t[t.ReversedTreeOrder=1]="ReversedTreeOrder"})(LS||(LS={}));function DHe(t){let{acceleration:e,activator:n=T0.Pointer,canScroll:i,draggingRect:r,enabled:a,interval:s=5,order:o=LS.TreeOrder,pointerCoordinates:l,scrollableAncestors:c,scrollableAncestorRects:d,delta:f,threshold:m}=t;const g=OHe({delta:f,disabled:!a}),[y,_]=$6e(),v=E.useRef({x:0,y:0}),x=E.useRef({x:0,y:0}),M=E.useMemo(()=>{switch(n){case T0.Pointer:return l?{top:l.y,bottom:l.y,left:l.x,right:l.x}:null;case T0.DraggableRect:return r}},[n,r,l]),w=E.useRef(null),T=E.useCallback(()=>{const P=w.current;if(!P)return;const A=v.current.x*x.current.x,U=v.current.y*x.current.y;P.scrollBy(A,U)},[]),C=E.useMemo(()=>o===LS.TreeOrder?[...c].reverse():c,[o,c]);E.useEffect(()=>{if(!a||!c.length||!M){_();return}for(const P of C){if(i?.(P)===!1)continue;const A=c.indexOf(P),U=d[A];if(!U)continue;const{direction:N,speed:D}=yHe(P,U,M,e,m);for(const F of["x","y"])g[F][N[F]]||(D[F]=0,N[F]=0);if(D.x>0||D.y>0){_(),w.current=P,y(T,s),v.current=D,x.current=N;return}}v.current={x:0,y:0},x.current={x:0,y:0},_()},[e,T,i,_,a,s,JSON.stringify(M),JSON.stringify(g),y,c,C,d,JSON.stringify(m)])}const kHe={x:{[wr.Backward]:!1,[wr.Forward]:!1},y:{[wr.Backward]:!1,[wr.Forward]:!1}};function OHe(t){let{delta:e,disabled:n}=t;const i=lP(e);return fv(r=>{if(n||!i||!r)return kHe;const a={x:Math.sign(e.x-i.x),y:Math.sign(e.y-i.y)};return{x:{[wr.Backward]:r.x[wr.Backward]||a.x===-1,[wr.Forward]:r.x[wr.Forward]||a.x===1},y:{[wr.Backward]:r.y[wr.Backward]||a.y===-1,[wr.Forward]:r.y[wr.Forward]||a.y===1}}},[n,e,i])}function LHe(t,e){const n=e!=null?t.get(e):void 0,i=n?n.node.current:null;return fv(r=>{var a;return e==null?null:(a=i??r)!=null?a:null},[i,e])}function IHe(t,e){return E.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 Mx;(function(t){t[t.Always=0]="Always",t[t.BeforeDragging=1]="BeforeDragging",t[t.WhileDragging=2]="WhileDragging"})(Mx||(Mx={}));var fP;(function(t){t.Optimized="optimized"})(fP||(fP={}));const W$=new Map;function UHe(t,e){let{dragging:n,dependencies:i,config:r}=e;const[a,s]=E.useState(null),{frequency:o,measure:l,strategy:c}=r,d=E.useRef(t),f=v(),m=_x(f),g=E.useCallback(function(x){x===void 0&&(x=[]),!m.current&&s(M=>M===null?x:M.concat(x.filter(w=>!M.includes(w))))},[m]),y=E.useRef(null),_=fv(x=>{if(f&&!n)return W$;if(!x||x===W$||d.current!==t||a!=null){const M=new Map;for(let w of t){if(!w)continue;if(a&&a.length>0&&!a.includes(w.id)&&w.rect.current){M.set(w.id,w.rect.current);continue}const T=w.node.current,C=T?new YO(l(T),T):null;w.rect.current=C,C&&M.set(w.id,C)}return M}return x},[t,a,n,f,l]);return E.useEffect(()=>{d.current=t},[t]),E.useEffect(()=>{f||g()},[n,f]),E.useEffect(()=>{a&&a.length>0&&s(null)},[JSON.stringify(a)]),E.useEffect(()=>{f||typeof o!="number"||y.current!==null||(y.current=setTimeout(()=>{g(),y.current=null},o))},[o,f,g,...i]),{droppableRects:_,measureDroppableContainers:g,measuringScheduled:a!=null};function v(){switch(c){case Mx.Always:return!1;case Mx.BeforeDragging:return n;default:return!n}}}function CJ(t,e){return fv(n=>t?n||(typeof e=="function"?e(t):t):null,[e,t])}function jHe(t,e){return CJ(t,e)}function FHe(t){let{callback:e,disabled:n}=t;const i=XO(e),r=E.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:a}=window;return new a(i)},[i,n]);return E.useEffect(()=>()=>r?.disconnect(),[r]),r}function oM(t){let{callback:e,disabled:n}=t;const i=XO(e),r=E.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:a}=window;return new a(i)},[n]);return E.useEffect(()=>()=>r?.disconnect(),[r]),r}function zHe(t){return new YO(km(t),t)}function q$(t,e,n){e===void 0&&(e=zHe);const[i,r]=E.useState(null);function a(){r(l=>{if(!t)return null;if(t.isConnected===!1){var c;return(c=l??n)!=null?c:null}const d=e(t);return JSON.stringify(l)===JSON.stringify(d)?l:d})}const s=FHe({callback(l){if(t)for(const c of l){const{type:d,target:f}=c;if(d==="childList"&&f instanceof HTMLElement&&f.contains(t)){a();break}}}}),o=oM({callback:a});return al(()=>{a(),t?(o?.observe(t),s?.observe(document.body,{childList:!0,subtree:!0})):(o?.disconnect(),s?.disconnect())},[t]),i}function BHe(t){const e=CJ(t);return bJ(t,e)}const X$=[];function HHe(t){const e=E.useRef(t),n=fv(i=>t?i&&i!==X$&&t&&e.current&&t.parentNode===e.current.parentNode?i:sM(t):X$,[t]);return E.useEffect(()=>{e.current=t},[t]),n}function VHe(t){const[e,n]=E.useState(null),i=E.useRef(t),r=E.useCallback(a=>{const s=eN(a.target);s&&n(o=>o?(o.set(s,uP(s)),new Map(o)):null)},[]);return E.useEffect(()=>{const a=i.current;if(t!==a){s(a);const o=t.map(l=>{const c=eN(l);return c?(c.addEventListener("scroll",r,{passive:!0}),[c,uP(c)]):null}).filter(l=>l!=null);n(o.length?new Map(o):null),i.current=t}return()=>{s(t),s(a)};function s(o){o.forEach(l=>{const c=eN(l);c?.removeEventListener("scroll",r)})}},[r,t]),E.useMemo(()=>t.length?e?Array.from(e.values()).reduce((a,s)=>Lp(a,s),So):AJ(t):So,[t,e])}function K$(t,e){e===void 0&&(e=[]);const n=E.useRef(null);return E.useEffect(()=>{n.current=null},e),E.useEffect(()=>{const i=t!==So;i&&!n.current&&(n.current=t),!i&&n.current&&(n.current=null)},[t]),n.current?Sx(t,n.current):So}function $He(t){E.useEffect(()=>{if(!aM)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 GHe(t,e){return E.useMemo(()=>t.reduce((n,i)=>{let{eventName:r,handler:a}=i;return n[r]=s=>{a(s,e)},n},{}),[t,e])}function NJ(t){return E.useMemo(()=>t?mHe(t):null,[t])}const Y$=[];function WHe(t,e){e===void 0&&(e=km);const[n]=t,i=NJ(n?$a(n):null),[r,a]=E.useState(Y$);function s(){a(()=>t.length?t.map(l=>MJ(l)?i:new YO(e(l),l)):Y$)}const o=oM({callback:s});return al(()=>{o?.disconnect(),s(),t.forEach(l=>o?.observe(l))},[t]),r}function qHe(t){if(!t)return null;if(t.children.length>1)return t;const e=t.children[0];return dv(e)?e:t}function XHe(t){let{measure:e}=t;const[n,i]=E.useState(null),r=E.useCallback(c=>{for(const{target:d}of c)if(dv(d)){i(f=>{const m=e(d);return f?{...f,width:m.width,height:m.height}:m});break}},[e]),a=oM({callback:r}),s=E.useCallback(c=>{const d=qHe(c);a?.disconnect(),d&&a?.observe(d),i(d?e(d):null)},[e,a]),[o,l]=kS(s);return E.useMemo(()=>({nodeRef:o,rect:n,setRef:l}),[n,o,l])}const KHe=[{sensor:JO,options:{}},{sensor:ZO,options:{}}],YHe={current:{}},E_={draggable:{measure:H$},droppable:{measure:H$,strategy:Mx.WhileDragging,frequency:fP.Optimized},dragOverlay:{measure:km}};class C0 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 ZHe={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new C0,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:OS},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:E_,measureDroppableContainers:OS,windowRect:null,measuringScheduled:!1},QHe={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:OS,draggableNodes:new Map,over:null,measureDroppableContainers:OS},lM=E.createContext(QHe),RJ=E.createContext(ZHe);function JHe(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new C0}}}function eVe(t,e){switch(e.type){case nr.DragStart:return{...t,draggable:{...t.draggable,initialCoordinates:e.initialCoordinates,active:e.active}};case nr.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 nr.DragEnd:case nr.DragCancel:return{...t,draggable:{...t.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case nr.RegisterDroppable:{const{element:n}=e,{id:i}=n,r=new C0(t.droppable.containers);return r.set(i,n),{...t,droppable:{...t.droppable,containers:r}}}case nr.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 C0(t.droppable.containers);return s.set(n,{...a,disabled:r}),{...t,droppable:{...t.droppable,containers:s}}}case nr.UnregisterDroppable:{const{id:n,key:i}=e,r=t.droppable.containers.get(n);if(!r||i!==r.key)return t;const a=new C0(t.droppable.containers);return a.delete(n),{...t,droppable:{...t.droppable,containers:a}}}default:return t}}function tVe(t){let{disabled:e}=t;const{active:n,activatorEvent:i,draggableNodes:r}=E.useContext(lM),a=lP(i),s=lP(n?.id);return E.useEffect(()=>{if(!e&&!i&&a&&s!=null){if(!KO(a)||document.activeElement===a.target)return;const o=r.get(s);if(!o)return;const{activatorNode:l,node:c}=o;if(!l.current&&!c.current)return;requestAnimationFrame(()=>{for(const d of[l.current,c.current]){if(!d)continue;const f=q6e(d);if(f){f.focus();break}}})}},[i,e,r,s,a]),null}function nVe(t,e){let{transform:n,...i}=e;return t!=null&&t.length?t.reduce((r,a)=>a({transform:r,...i}),n):n}function iVe(t){return E.useMemo(()=>({draggable:{...E_.draggable,...t?.draggable},droppable:{...E_.droppable,...t?.droppable},dragOverlay:{...E_.dragOverlay,...t?.dragOverlay}}),[t?.draggable,t?.droppable,t?.dragOverlay])}function rVe(t){let{activeNode:e,measure:n,initialRect:i,config:r=!0}=t;const a=E.useRef(!1),{x:s,y:o}=typeof r=="boolean"?{x:r,y:r}:r;al(()=>{if(!s&&!o||!e){a.current=!1;return}if(a.current||!i)return;const c=e?.node.current;if(!c||c.isConnected===!1)return;const d=n(c),f=bJ(d,i);if(s||(f.x=0),o||(f.y=0),a.current=!0,Math.abs(f.x)>0||Math.abs(f.y)>0){const m=_J(c);m&&m.scrollBy({top:f.y,left:f.x})}},[e,s,o,i,n])}const PJ=E.createContext({...So,scaleX:1,scaleY:1});var wu;(function(t){t[t.Uninitialized=0]="Uninitialized",t[t.Initializing=1]="Initializing",t[t.Initialized=2]="Initialized"})(wu||(wu={}));const aVe=E.memo(function(e){var n,i,r,a;let{id:s,accessibility:o,autoScroll:l=!0,children:c,sensors:d=KHe,collisionDetection:f=lHe,measuring:m,modifiers:g,...y}=e;const _=E.useReducer(eVe,void 0,JHe),[v,x]=_,[M,w]=J6e(),[T,C]=E.useState(wu.Uninitialized),P=T===wu.Initialized,{draggable:{active:A,nodes:U,translate:N},droppable:{containers:D}}=v,F=A!=null?U.get(A):null,I=E.useRef({initial:null,translated:null}),W=E.useMemo(()=>{var Oe;return A!=null?{id:A,data:(Oe=F?.data)!=null?Oe:YHe,rect:I}:null},[A,F]),O=E.useRef(null),[B,H]=E.useState(null),[$,K]=E.useState(null),Z=_x(y,Object.values(y)),se=hv("DndDescribedBy",s),V=E.useMemo(()=>D.getEnabled(),[D]),X=iVe(m),{droppableRects:ae,measureDroppableContainers:ce,measuringScheduled:ge}=UHe(V,{dragging:P,dependencies:[N.x,N.y],config:X.droppable}),ne=LHe(U,A),ve=E.useMemo(()=>$?cP($):null,[$]),Pe=fe(),he=jHe(ne,X.draggable.measure);rVe({activeNode:A!=null?U.get(A):null,config:Pe.layoutShiftCompensation,initialRect:he,measure:X.draggable.measure});const we=q$(ne,X.draggable.measure,he),je=q$(ne?ne.parentElement:null),ue=E.useRef({activatorEvent:null,active:null,activeNode:ne,collisionRect:null,collisions:null,droppableRects:ae,draggableNodes:U,draggingNode:null,draggingNodeRect:null,droppableContainers:D,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),lt=D.getNodeFor((n=ue.current.over)==null?void 0:n.id),z=XHe({measure:X.dragOverlay.measure}),q=(i=z.nodeRef.current)!=null?i:ne,re=P?(r=z.rect)!=null?r:we:null,J=!!(z.nodeRef.current&&z.rect),ee=BHe(J?null:we),oe=NJ(q?$a(q):null),De=HHe(P?lt??ne:null),Ne=WHe(De),te=nVe(g,{transform:{x:N.x-ee.x,y:N.y-ee.y,scaleX:1,scaleY:1},activatorEvent:$,active:W,activeNodeRect:we,containerNodeRect:je,draggingNodeRect:re,over:ue.current.over,overlayNodeRect:z.rect,scrollableAncestors:De,scrollableAncestorRects:Ne,windowRect:oe}),j=ve?Lp(ve,N):null,L=VHe(De),Y=K$(L),me=K$(L,[we]),ye=Lp(te,Y),pe=re?dHe(re,te):null,Ze=W&&pe?f({active:W,collisionRect:pe,droppableRects:ae,droppableContainers:V,pointerCoordinates:j}):null,Le=yJ(Ze,"id"),[qe,at]=E.useState(null),Ie=J?te:Lp(te,me),Re=cHe(Ie,(a=qe?.rect)!=null?a:null,we),pt=E.useRef(null),nt=E.useCallback((Oe,Me)=>{let{sensor:xe,options:Be}=Me;if(O.current==null)return;const ct=U.get(O.current);if(!ct)return;const bt=Oe.nativeEvent,Nt=new xe({active:O.current,activeNode:ct,event:bt,options:Be,context:ue,onAbort(Dt){if(!U.get(Dt))return;const{onDragAbort:Wn}=Z.current,hr={id:Dt};Wn?.(hr),M({type:"onDragAbort",event:hr})},onPending(Dt,Rn,Wn,hr){if(!U.get(Dt))return;const{onDragPending:pr}=Z.current,Nr={id:Dt,constraint:Rn,initialCoordinates:Wn,offset:hr};pr?.(Nr),M({type:"onDragPending",event:Nr})},onStart(Dt){const Rn=O.current;if(Rn==null)return;const Wn=U.get(Rn);if(!Wn)return;const{onDragStart:hr}=Z.current,Zi={activatorEvent:bt,active:{id:Rn,data:Wn.data,rect:I}};Xl.unstable_batchedUpdates(()=>{hr?.(Zi),C(wu.Initializing),x({type:nr.DragStart,initialCoordinates:Dt,active:Rn}),M({type:"onDragStart",event:Zi}),H(pt.current),K(bt)})},onMove(Dt){x({type:nr.DragMove,coordinates:Dt})},onEnd:on(nr.DragEnd),onCancel:on(nr.DragCancel)});pt.current=Nt;function on(Dt){return async function(){const{active:Wn,collisions:hr,over:Zi,scrollAdjustedTranslate:pr}=ue.current;let Nr=null;if(Wn&&pr){const{cancelDrop:Gr}=Z.current;Nr={activatorEvent:bt,active:Wn,collisions:hr,delta:pr,over:Zi},Dt===nr.DragEnd&&typeof Gr=="function"&&await Promise.resolve(Gr(Nr))&&(Dt=nr.DragCancel)}O.current=null,Xl.unstable_batchedUpdates(()=>{x({type:Dt}),C(wu.Uninitialized),at(null),H(null),K(null),pt.current=null;const Gr=Dt===nr.DragEnd?"onDragEnd":"onDragCancel";if(Nr){const Li=Z.current[Gr];Li?.(Nr),M({type:Gr,event:Nr})}})}}},[U]),tt=E.useCallback((Oe,Me)=>(xe,Be)=>{const ct=xe.nativeEvent,bt=U.get(Be);if(O.current!==null||!bt||ct.dndKit||ct.defaultPrevented)return;const Nt={active:bt};Oe(xe,Me.options,Nt)===!0&&(ct.dndKit={capturedBy:Me.sensor},O.current=Be,nt(xe,Me))},[U,nt]),ut=IHe(d,tt);$He(d),al(()=>{we&&T===wu.Initializing&&C(wu.Initialized)},[we,T]),E.useEffect(()=>{const{onDragMove:Oe}=Z.current,{active:Me,activatorEvent:xe,collisions:Be,over:ct}=ue.current;if(!Me||!xe)return;const bt={active:Me,activatorEvent:xe,collisions:Be,delta:{x:ye.x,y:ye.y},over:ct};Xl.unstable_batchedUpdates(()=>{Oe?.(bt),M({type:"onDragMove",event:bt})})},[ye.x,ye.y]),E.useEffect(()=>{const{active:Oe,activatorEvent:Me,collisions:xe,droppableContainers:Be,scrollAdjustedTranslate:ct}=ue.current;if(!Oe||O.current==null||!Me||!ct)return;const{onDragOver:bt}=Z.current,Nt=Be.get(Le),on=Nt&&Nt.rect.current?{id:Nt.id,rect:Nt.rect.current,data:Nt.data,disabled:Nt.disabled}:null,Dt={active:Oe,activatorEvent:Me,collisions:xe,delta:{x:ct.x,y:ct.y},over:on};Xl.unstable_batchedUpdates(()=>{at(on),bt?.(Dt),M({type:"onDragOver",event:Dt})})},[Le]),al(()=>{ue.current={activatorEvent:$,active:W,activeNode:ne,collisionRect:pe,collisions:Ze,droppableRects:ae,draggableNodes:U,draggingNode:q,draggingNodeRect:re,droppableContainers:D,over:qe,scrollableAncestors:De,scrollAdjustedTranslate:ye},I.current={initial:re,translated:pe}},[W,ne,Ze,pe,U,q,re,ae,D,qe,De,ye]),DHe({...Pe,delta:N,draggingRect:pe,pointerCoordinates:j,scrollableAncestors:De,scrollableAncestorRects:Ne});const de=E.useMemo(()=>({active:W,activeNode:ne,activeNodeRect:we,activatorEvent:$,collisions:Ze,containerNodeRect:je,dragOverlay:z,draggableNodes:U,droppableContainers:D,droppableRects:ae,over:qe,measureDroppableContainers:ce,scrollableAncestors:De,scrollableAncestorRects:Ne,measuringConfiguration:X,measuringScheduled:ge,windowRect:oe}),[W,ne,we,$,Ze,je,z,U,D,ae,qe,ce,De,Ne,X,ge,oe]),it=E.useMemo(()=>({activatorEvent:$,activators:ut,active:W,activeNodeRect:we,ariaDescribedById:{draggable:se},dispatch:x,draggableNodes:U,over:qe,measureDroppableContainers:ce}),[$,ut,W,we,x,se,U,qe,ce]);return ui.createElement(gJ.Provider,{value:w},ui.createElement(lM.Provider,{value:it},ui.createElement(RJ.Provider,{value:de},ui.createElement(PJ.Provider,{value:Re},c)),ui.createElement(tVe,{disabled:o?.restoreFocus===!1})),ui.createElement(nHe,{...o,hiddenTextDescribedById:se}));function fe(){const Oe=B?.autoScrollEnabled===!1,Me=typeof l=="object"?l.enabled===!1:l===!1,xe=P&&!Oe&&!Me;return typeof l=="object"?{...l,enabled:xe}:{enabled:xe}}}),sVe=E.createContext(null),Z$="button",oVe="Draggable";function lVe(t){let{id:e,data:n,disabled:i=!1,attributes:r}=t;const a=hv(oVe),{activators:s,activatorEvent:o,active:l,activeNodeRect:c,ariaDescribedById:d,draggableNodes:f,over:m}=E.useContext(lM),{role:g=Z$,roleDescription:y="draggable",tabIndex:_=0}=r??{},v=l?.id===e,x=E.useContext(v?PJ:sVe),[M,w]=kS(),[T,C]=kS(),P=GHe(s,e),A=_x(n);al(()=>(f.set(e,{id:e,key:a,node:M,activatorNode:T,data:A}),()=>{const N=f.get(e);N&&N.key===a&&f.delete(e)}),[f,e]);const U=E.useMemo(()=>({role:g,tabIndex:_,"aria-disabled":i,"aria-pressed":v&&g===Z$?!0:void 0,"aria-roledescription":y,"aria-describedby":d.draggable}),[i,g,_,v,y,d.draggable]);return{active:l,activatorEvent:o,activeNodeRect:c,attributes:U,isDragging:v,listeners:i?void 0:P,node:M,over:m,setNodeRef:w,setActivatorNodeRef:C,transform:x}}function cVe(){return E.useContext(RJ)}const uVe="Droppable",dVe={timeout:25};function fVe(t){let{data:e,disabled:n=!1,id:i,resizeObserverConfig:r}=t;const a=hv(uVe),{active:s,dispatch:o,over:l,measureDroppableContainers:c}=E.useContext(lM),d=E.useRef({disabled:n}),f=E.useRef(!1),m=E.useRef(null),g=E.useRef(null),{disabled:y,updateMeasurementsFor:_,timeout:v}={...dVe,...r},x=_x(_??i),M=E.useCallback(()=>{if(!f.current){f.current=!0;return}g.current!=null&&clearTimeout(g.current),g.current=setTimeout(()=>{c(Array.isArray(x.current)?x.current:[x.current]),g.current=null},v)},[v]),w=oM({callback:M,disabled:y||!s}),T=E.useCallback((U,N)=>{w&&(N&&(w.unobserve(N),f.current=!1),U&&w.observe(U))},[w]),[C,P]=kS(T),A=_x(e);return E.useEffect(()=>{!w||!C.current||(w.disconnect(),f.current=!1,w.observe(C.current))},[C,w]),E.useEffect(()=>(o({type:nr.RegisterDroppable,element:{id:i,key:a,disabled:n,node:C,rect:m,data:A}}),()=>o({type:nr.UnregisterDroppable,key:a,id:i})),[i]),E.useEffect(()=>{n!==d.current.disabled&&(o({type:nr.SetDroppableDisabled,id:i,key:a,disabled:n}),d.current.disabled=n)},[i,a,n,o]),{active:s,rect:m,isOver:l?.id===i,node:C,over:l,setNodeRef:P}}function eL(t,e,n){const i=t.slice();return i.splice(n<0?i.length+n:n,0,i.splice(e,1)[0]),i}function hVe(t,e){return t.reduce((n,i,r)=>{const a=e.get(i);return a&&(n[r]=a),n},Array(t.length))}function n_(t){return t!==null&&t>=0}function pVe(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 mVe(t){return typeof t=="boolean"?{draggable:t,droppable:t}:t}const tL=t=>{let{rects:e,activeIndex:n,overIndex:i,index:r}=t;const a=eL(e,i,n),s=e[r],o=a[r];return!o||!s?null:{x:o.left-s.left,y:o.top-s.top,scaleX:o.width/s.width,scaleY:o.height/s.height}},DJ="Sortable",kJ=ui.createContext({activeIndex:-1,containerId:DJ,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:tL,disabled:{draggable:!1,droppable:!1}});function gVe(t){let{children:e,id:n,items:i,strategy:r=tL,disabled:a=!1}=t;const{active:s,dragOverlay:o,droppableRects:l,over:c,measureDroppableContainers:d}=cVe(),f=hv(DJ,n),m=o.rect!==null,g=E.useMemo(()=>i.map(P=>typeof P=="object"&&"id"in P?P.id:P),[i]),y=s!=null,_=s?g.indexOf(s.id):-1,v=c?g.indexOf(c.id):-1,x=E.useRef(g),M=!pVe(g,x.current),w=v!==-1&&_===-1||M,T=mVe(a);al(()=>{M&&y&&d(g)},[M,g,y,d]),E.useEffect(()=>{x.current=g},[g]);const C=E.useMemo(()=>({activeIndex:_,containerId:f,disabled:T,disableTransforms:w,items:g,overIndex:v,useDragOverlay:m,sortedRects:hVe(g,l),strategy:r}),[_,f,T.draggable,T.droppable,w,g,v,l,m,r]);return ui.createElement(kJ.Provider,{value:C},e)}const xVe=t=>{let{id:e,items:n,activeIndex:i,overIndex:r}=t;return eL(n,i,r).indexOf(e)},vVe=t=>{let{containerId:e,isSorting:n,wasDragging:i,index:r,items:a,newIndex:s,previousItems:o,previousContainerId:l,transition:c}=t;return!c||!i||o!==a&&r===s?!1:n?!0:s!==r&&e===l},yVe={duration:200,easing:"ease"},OJ="transform",bVe=wx.Transition.toString({property:OJ,duration:0,easing:"linear"}),_Ve={roleDescription:"sortable"};function SVe(t){let{disabled:e,index:n,node:i,rect:r}=t;const[a,s]=E.useState(null),o=E.useRef(n);return al(()=>{if(!e&&n!==o.current&&i.current){const l=r.current;if(l){const c=km(i.current,{ignoreTransform:!0}),d={x:l.left-c.left,y:l.top-c.top,scaleX:l.width/c.width,scaleY:l.height/c.height};(d.x||d.y)&&s(d)}}n!==o.current&&(o.current=n)},[e,n,i,r]),E.useEffect(()=>{a&&s(null)},[a]),a}function wVe(t){let{animateLayoutChanges:e=vVe,attributes:n,disabled:i,data:r,getNewIndex:a=xVe,id:s,strategy:o,resizeObserverConfig:l,transition:c=yVe}=t;const{items:d,containerId:f,activeIndex:m,disabled:g,disableTransforms:y,sortedRects:_,overIndex:v,useDragOverlay:x,strategy:M}=E.useContext(kJ),w=MVe(i,g),T=d.indexOf(s),C=E.useMemo(()=>({sortable:{containerId:f,index:T,items:d},...r}),[f,r,T,d]),P=E.useMemo(()=>d.slice(d.indexOf(s)),[d,s]),{rect:A,node:U,isOver:N,setNodeRef:D}=fVe({id:s,data:C,disabled:w.droppable,resizeObserverConfig:{updateMeasurementsFor:P,...l}}),{active:F,activatorEvent:I,activeNodeRect:W,attributes:O,setNodeRef:B,listeners:H,isDragging:$,over:K,setActivatorNodeRef:Z,transform:se}=lVe({id:s,data:C,attributes:{..._Ve,...n},disabled:w.draggable}),V=V6e(D,B),X=!!F,ae=X&&!y&&n_(m)&&n_(v),ce=!x&&$,ge=ce&&ae?se:null,ve=ae?ge??(o??M)({rects:_,activeNodeRect:W,activeIndex:m,overIndex:v,index:T}):null,Pe=n_(m)&&n_(v)?a({id:s,items:d,activeIndex:m,overIndex:v}):T,he=F?.id,we=E.useRef({activeId:he,items:d,newIndex:Pe,containerId:f}),je=d!==we.current.items,ue=e({active:F,containerId:f,isDragging:$,isSorting:X,id:s,index:T,items:d,newIndex:we.current.newIndex,previousItems:we.current.items,previousContainerId:we.current.containerId,transition:c,wasDragging:we.current.activeId!=null}),lt=SVe({disabled:!ue,index:T,node:U,rect:A});return E.useEffect(()=>{X&&we.current.newIndex!==Pe&&(we.current.newIndex=Pe),f!==we.current.containerId&&(we.current.containerId=f),d!==we.current.items&&(we.current.items=d)},[X,Pe,f,d]),E.useEffect(()=>{if(he===we.current.activeId)return;if(he!=null&&we.current.activeId==null){we.current.activeId=he;return}const q=setTimeout(()=>{we.current.activeId=he},50);return()=>clearTimeout(q)},[he]),{active:F,activeIndex:m,attributes:O,data:C,rect:A,index:T,newIndex:Pe,items:d,isOver:N,isSorting:X,isDragging:$,listeners:H,node:U,overIndex:v,over:K,setNodeRef:V,setActivatorNodeRef:Z,setDroppableNodeRef:D,setDraggableNodeRef:B,transform:lt??ve,transition:z()};function z(){if(lt||je&&we.current.newIndex===T)return bVe;if(!(ce&&!KO(I)||!c)&&(X||ue))return wx.Transition.toString({...c,property:OJ})}}function MVe(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 IS(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 EVe=[bn.Down,bn.Right,bn.Up,bn.Left],AVe=(t,e)=>{let{context:{active:n,collisionRect:i,droppableRects:r,droppableContainers:a,over:s,scrollableAncestors:o}}=e;if(EVe.includes(t.code)){if(t.preventDefault(),!n||!i)return;const l=[];a.getEnabled().forEach(f=>{if(!f||f!=null&&f.disabled)return;const m=r.get(f.id);if(m)switch(t.code){case bn.Down:i.top<m.top&&l.push(f);break;case bn.Up:i.top>m.top&&l.push(f);break;case bn.Left:i.left>m.left&&l.push(f);break;case bn.Right:i.left<m.left&&l.push(f);break}});const c=sHe({collisionRect:i,droppableRects:r,droppableContainers:l});let d=yJ(c,"id");if(d===s?.id&&c.length>1&&(d=c[1].id),d!=null){const f=a.get(n.id),m=a.get(d),g=m?r.get(m.id):null,y=m?.node.current;if(y&&g&&f&&m){const v=sM(y).some((P,A)=>o[A]!==P),x=LJ(f,m),M=TVe(f,m),w=v||!x?{x:0,y:0}:{x:M?i.width-g.width:0,y:M?i.height-g.height:0},T={x:g.left,y:g.top};return w.x&&w.y?T:Sx(T,w)}}}};function LJ(t,e){return!IS(t)||!IS(e)?!1:t.data.current.sortable.containerId===e.data.current.sortable.containerId}function TVe(t,e){return!IS(t)||!IS(e)||!LJ(t,e)?!1:t.data.current.sortable.index<e.data.current.sortable.index}function CVe({id:t,title:e,children:n,isHidden:i,size:r,onToggleVisibility:a,onToggleSize:s}){const{attributes:o,listeners:l,setNodeRef:c,transform:d,transition:f,isDragging:m}=wVe({id:t}),g={transform:wx.Transform.toString(d),transition:f,opacity:m?.5:1};return i?null:p.jsxs("div",{ref:c,style:{...g,gridColumn:`span ${r}`},className:`bg-bambu-dark-secondary rounded-xl border border-bambu-dark-tertiary overflow-hidden ${m?"ring-2 ring-bambu-green shadow-lg":""}`,children:[p.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-bambu-dark-tertiary bg-bambu-dark/30",children:[p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("button",{...o,...l,className:"cursor-grab active:cursor-grabbing p-1 hover:bg-bambu-dark-tertiary rounded transition-colors",title:"Drag to reorder",children:p.jsx(CP,{className:"w-4 h-4 text-bambu-gray"})}),p.jsx("h3",{className:"text-sm font-medium text-white",children:e})]}),p.jsxs("div",{className:"flex items-center gap-1",children:[p.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?p.jsx(toe,{className:"w-4 h-4 text-bambu-gray hover:text-white"}):p.jsx(Zse,{className:"w-4 h-4 text-bambu-gray hover:text-white"})}),p.jsx("button",{onClick:a,className:"p-1 hover:bg-bambu-dark-tertiary rounded transition-colors",title:"Hide widget",children:p.jsx(rse,{className:"w-4 h-4 text-bambu-gray hover:text-white"})})]})]}),p.jsx("div",{className:"p-4",children:n})]})}function NVe({widgets:t,storageKey:e,columns:n=4}){const i=()=>{const v={};return t.forEach(x=>{v[x.id]=x.defaultSize||4}),v},[r,a]=E.useState(()=>{const v=localStorage.getItem(e);if(v)try{const x=JSON.parse(v);return x.sizes||(x.sizes=i()),x}catch{}return{order:t.map(x=>x.id),hidden:t.filter(x=>x.defaultVisible===!1).map(x=>x.id),sizes:i()}}),[s,o]=E.useState(!1);E.useEffect(()=>{localStorage.setItem(e,JSON.stringify(r))},[r,e]),E.useEffect(()=>{const x=t.map(M=>M.id).filter(M=>!r.order.includes(M));x.length>0&&a(M=>({...M,order:[...M.order,...x]}))},[t,r.order]);const l=iHe(F$(JO,{activationConstraint:{distance:8}}),F$(ZO,{coordinateGetter:AVe})),c=v=>{const{active:x,over:M}=v;M&&x.id!==M.id&&a(w=>{const T=w.order.indexOf(x.id),C=w.order.indexOf(M.id);return{...w,order:eL(w.order,T,C)}})},d=v=>{a(x=>({...x,hidden:x.hidden.includes(v)?x.hidden.filter(M=>M!==v):[...x.hidden,v]}))},f=v=>{a(x=>{const M=x.sizes[v]||4,w=M===1?2:M===2?4:1;return{...x,sizes:{...x.sizes,[v]:w}}})},m=()=>{const v={order:t.map(x=>x.id),hidden:t.filter(x=>x.defaultVisible===!1).map(x=>x.id),sizes:i()};a(v)},g=r.order.map(v=>t.find(x=>x.id===v)).filter(Boolean),y=g.filter(v=>!r.hidden.includes(v.id)),_=g.filter(v=>r.hidden.includes(v.id));return p.jsxs("div",{className:"space-y-4",children:[p.jsxs("div",{className:"flex items-center justify-end gap-2",children:[_.length>0&&p.jsxs(st,{variant:"secondary",size:"sm",onClick:()=>o(!s),children:[p.jsx(Lj,{className:"w-4 h-4"}),_.length," Hidden"]}),p.jsxs(st,{variant:"secondary",size:"sm",onClick:m,children:[p.jsx(VS,{className:"w-4 h-4"}),"Reset Layout"]})]}),s&&_.length>0&&p.jsxs("div",{className:"p-4 bg-bambu-dark rounded-xl border border-bambu-dark-tertiary",children:[p.jsx("p",{className:"text-sm text-bambu-gray mb-3",children:"Hidden widgets (click to show):"}),p.jsx("div",{className:"flex flex-wrap gap-2",children:_.map(v=>p.jsxs("button",{onClick:()=>d(v.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:[p.jsx(Lj,{className:"w-3 h-3"}),v.title]},v.id))})]}),p.jsx(aVe,{sensors:l,collisionDetection:aHe,onDragEnd:c,children:p.jsx(gVe,{items:y.map(v=>v.id),strategy:tL,children:p.jsx("div",{className:"grid gap-6",style:{gridTemplateColumns:`repeat(${n}, minmax(0, 1fr))`},children:y.map(v=>p.jsx(CVe,{id:v.id,title:v.title,isHidden:r.hidden.includes(v.id),size:r.sizes[v.id]||2,onToggleVisibility:()=>d(v.id),onToggleSize:()=>f(v.id),children:v.component},v.id))})})}),y.length===0&&p.jsxs("div",{className:"text-center py-12 text-bambu-gray",children:[p.jsx("p",{children:"All widgets are hidden."}),p.jsx(st,{className:"mt-4",onClick:m,children:"Reset Layout"})]})]})}function RVe({stats:t,currency:e}){return p.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-4",children:[p.jsxs("div",{className:"flex items-start gap-3",children:[p.jsx("div",{className:"p-2 rounded-lg bg-bambu-dark text-bambu-green",children:p.jsx(U_,{className:"w-5 h-5"})}),p.jsxs("div",{children:[p.jsx("p",{className:"text-xs text-bambu-gray",children:"Total Prints"}),p.jsx("p",{className:"text-xl font-bold text-white",children:t?.total_prints||0})]})]}),p.jsxs("div",{className:"flex items-start gap-3",children:[p.jsx("div",{className:"p-2 rounded-lg bg-bambu-dark text-blue-400",children:p.jsx(xa,{className:"w-5 h-5"})}),p.jsxs("div",{children:[p.jsx("p",{className:"text-xs text-bambu-gray",children:"Print Time"}),p.jsxs("p",{className:"text-xl font-bold text-white",children:[t?.total_print_time_hours.toFixed(1)||0,"h"]})]})]}),p.jsxs("div",{className:"flex items-start gap-3",children:[p.jsx("div",{className:"p-2 rounded-lg bg-bambu-dark text-orange-400",children:p.jsx(U_,{className:"w-5 h-5"})}),p.jsxs("div",{children:[p.jsx("p",{className:"text-xs text-bambu-gray",children:"Filament Used"}),p.jsxs("p",{className:"text-xl font-bold text-white",children:[((t?.total_filament_grams||0)/1e3).toFixed(2),"kg"]})]})]}),p.jsxs("div",{className:"flex items-start gap-3",children:[p.jsx("div",{className:"p-2 rounded-lg bg-bambu-dark text-green-400",children:p.jsx(Oj,{className:"w-5 h-5"})}),p.jsxs("div",{children:[p.jsx("p",{className:"text-xs text-bambu-gray",children:"Filament Cost"}),p.jsxs("p",{className:"text-xl font-bold text-white",children:[e," ",t?.total_cost.toFixed(2)||"0.00"]})]})]}),p.jsxs("div",{className:"flex items-start gap-3",children:[p.jsx("div",{className:"p-2 rounded-lg bg-bambu-dark text-yellow-400",children:p.jsx(e9,{className:"w-5 h-5"})}),p.jsxs("div",{children:[p.jsx("p",{className:"text-xs text-bambu-gray",children:"Energy Used"}),p.jsxs("p",{className:"text-xl font-bold text-white",children:[t?.total_energy_kwh.toFixed(2)||"0.00"," kWh"]})]})]}),p.jsxs("div",{className:"flex items-start gap-3",children:[p.jsx("div",{className:"p-2 rounded-lg bg-bambu-dark text-yellow-500",children:p.jsx(Oj,{className:"w-5 h-5"})}),p.jsxs("div",{children:[p.jsx("p",{className:"text-xs text-bambu-gray",children:"Energy Cost"}),p.jsxs("p",{className:"text-xl font-bold text-white",children:[e," ",t?.total_energy_cost.toFixed(2)||"0.00"]})]})]})]})}function PVe({stats:t}){const e=t?.total_prints?Math.round(t.successful_prints/t.total_prints*100):0;return p.jsxs("div",{className:"flex items-center gap-6",children:[p.jsxs("div",{className:"relative w-28 h-28",children:[p.jsxs("svg",{className:"w-full h-full -rotate-90",children:[p.jsx("circle",{cx:"56",cy:"56",r:"48",fill:"none",stroke:"#3d3d3d",strokeWidth:"10"}),p.jsx("circle",{cx:"56",cy:"56",r:"48",fill:"none",stroke:"#00ae42",strokeWidth:"10",strokeLinecap:"round",strokeDasharray:`${e*3.02} 302`})]}),p.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:p.jsxs("span",{className:"text-xl font-bold text-white",children:[e,"%"]})})]}),p.jsxs("div",{className:"space-y-2",children:[p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx(rd,{className:"w-4 h-4 text-bambu-green"}),p.jsx("span",{className:"text-sm text-bambu-gray",children:"Successful:"}),p.jsx("span",{className:"text-sm text-white font-medium",children:t?.successful_prints||0})]}),p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx(Nx,{className:"w-4 h-4 text-red-400"}),p.jsx("span",{className:"text-sm text-bambu-gray",children:"Failed:"}),p.jsx("span",{className:"text-sm text-white font-medium",children:t?.failed_prints||0})]})]})]})}function DVe({stats:t,printerMap:e}){const n=t?.average_time_accuracy;if(n==null)return p.jsx("div",{className:"flex items-center justify-center h-full",children:p.jsx("p",{className:"text-bambu-gray text-center py-4",children:"No time accuracy data yet"})});const r=(Math.min(150,Math.max(50,n))-50)/100*100,s=(l=>l>=95&&l<=105?"#00ae42":l>105?"#3b82f6":"#f97316")(n),o=n-100;return p.jsxs("div",{className:"flex items-center gap-6",children:[p.jsxs("div",{className:"relative w-28 h-28",children:[p.jsxs("svg",{className:"w-full h-full -rotate-90",children:[p.jsx("circle",{cx:"56",cy:"56",r:"48",fill:"none",stroke:"#3d3d3d",strokeWidth:"10"}),p.jsx("circle",{cx:"56",cy:"56",r:"48",fill:"none",stroke:s,strokeWidth:"10",strokeLinecap:"round",strokeDasharray:`${r*3.02} 302`})]}),p.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center",children:[p.jsxs("span",{className:"text-xl font-bold text-white",children:[n.toFixed(0),"%"]}),p.jsxs("span",{className:`text-xs ${o>=0?"text-blue-400":"text-orange-400"}`,children:[o>=0?"+":"",o.toFixed(0),"%"]})]})]}),p.jsxs("div",{className:"space-y-2 flex-1",children:[p.jsxs("div",{className:"flex items-center gap-2 text-xs text-bambu-gray",children:[p.jsx(Woe,{className:"w-3 h-3"}),p.jsx("span",{children:"100% = perfect estimate"})]}),t?.time_accuracy_by_printer&&Object.keys(t.time_accuracy_by_printer).length>0&&p.jsx("div",{className:"space-y-1 mt-2",children:Object.entries(t.time_accuracy_by_printer).slice(0,3).map(([l,c])=>p.jsxs("div",{className:"flex items-center justify-between text-xs",children:[p.jsx("span",{className:"text-bambu-gray truncate max-w-[100px]",children:e.get(l)||`Printer ${l}`}),p.jsxs("span",{className:`font-medium ${c>=95&&c<=105?"text-bambu-green":c>105?"text-blue-400":"text-orange-400"}`,children:[c.toFixed(0),"%"]})]},l))})]})]})}function kVe({stats:t}){if(!t?.prints_by_filament_type||Object.keys(t.prints_by_filament_type).length===0)return p.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 p.jsx("div",{className:"space-y-3",children:e.map(([n,i])=>{const r=Math.round(i/(t.total_prints||1)*100);return p.jsxs("div",{children:[p.jsxs("div",{className:"flex justify-between text-sm mb-1",children:[p.jsx("span",{className:"text-white",children:n}),p.jsxs("span",{className:"text-bambu-gray",children:[i," prints"]})]}),p.jsx("div",{className:"h-2 bg-bambu-dark rounded-full",children:p.jsx("div",{className:"h-full bg-bambu-green rounded-full transition-all",style:{width:`${r}%`}})})]},n)})})}function OVe({printDates:t}){return p.jsx(L2e,{printDates:t,months:4})}function LVe({stats:t,printerMap:e}){return!t?.prints_by_printer||Object.keys(t.prints_by_printer).length===0?p.jsx("p",{className:"text-bambu-gray text-center py-4",children:"No printer data available"}):p.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:Object.entries(t.prints_by_printer).map(([n,i])=>p.jsxs("div",{className:"flex items-center gap-3 p-3 bg-bambu-dark rounded-lg",children:[p.jsx("div",{className:"p-2 bg-bambu-dark-tertiary rounded-lg",children:p.jsx(fc,{className:"w-4 h-4 text-bambu-green"})}),p.jsxs("div",{children:[p.jsx("p",{className:"text-white font-medium text-sm",children:e.get(n)||`Printer ${n}`}),p.jsxs("p",{className:"text-xs text-bambu-gray",children:[i," prints"]})]})]},n))})}function IVe({archives:t,currency:e}){return!t||t.length===0?p.jsx("p",{className:"text-bambu-gray text-center py-4",children:"No print data available"}):p.jsx(H6e,{archives:t,currency:e})}function UVe(){const{data:t,isLoading:e}=It({queryKey:["archiveStats"],queryFn:Ye.getArchiveStats}),{data:n}=It({queryKey:["printers"],queryFn:Ye.getPrinters}),{data:i}=It({queryKey:["archives"],queryFn:()=>Ye.getArchives(void 0,1e3,0)}),{data:r}=It({queryKey:["settings"],queryFn:Ye.getSettings}),a=r?.currency||"$",s=new Map(n?.map(c=>[String(c.id),c.name])||[]),o=i?.map(c=>c.created_at)||[];if(e)return p.jsx("div",{className:"p-8",children:p.jsx("div",{className:"text-center py-12 text-bambu-gray",children:"Loading statistics..."})});const l=[{id:"quick-stats",title:"Quick Stats",component:p.jsx(RVe,{stats:t,currency:a}),defaultSize:2},{id:"success-rate",title:"Success Rate",component:p.jsx(PVe,{stats:t}),defaultSize:1},{id:"time-accuracy",title:"Time Accuracy",component:p.jsx(DVe,{stats:t,printerMap:s}),defaultSize:1},{id:"filament-types",title:"Filament Types",component:p.jsx(kVe,{stats:t}),defaultSize:1},{id:"print-activity",title:"Print Activity",component:p.jsx(OVe,{printDates:o}),defaultSize:2},{id:"prints-by-printer",title:"Prints by Printer",component:p.jsx(LVe,{stats:t,printerMap:s}),defaultSize:2},{id:"filament-trends",title:"Filament Usage Trends",component:p.jsx(IVe,{archives:i||[],currency:a}),defaultSize:4}];return p.jsxs("div",{className:"p-8",children:[p.jsxs("div",{className:"mb-6",children:[p.jsx("h1",{className:"text-2xl font-bold text-white",children:"Dashboard"}),p.jsx("p",{className:"text-bambu-gray",children:"Drag widgets to rearrange. Click the eye icon to hide."})]}),p.jsx(NVe,{widgets:l,storageKey:"bambusy-dashboard-layout"})]})}function jVe({plug:t,onEdit:e}){const n=Jn(),[i,r]=E.useState(!1),[a,s]=E.useState(!1),[o,l]=E.useState(!1),[c,d]=E.useState(!1),{data:f,isLoading:m,refetch:g}=It({queryKey:["smart-plug-status",t.id],queryFn:()=>Ye.getSmartPlugStatus(t.id),refetchInterval:3e4}),{data:y}=It({queryKey:["printers"],queryFn:Ye.getPrinters}),_=y?.find(P=>P.id===t.printer_id),v=Ot({mutationFn:P=>Ye.controlSmartPlug(t.id,P),onSuccess:()=>{g()}}),x=Ot({mutationFn:P=>Ye.updateSmartPlug(t.id,P),onSuccess:()=>{n.invalidateQueries({queryKey:["smart-plugs"]}),t.printer_id&&n.invalidateQueries({queryKey:["smartPlugByPrinter",t.printer_id]})}}),M=Ot({mutationFn:()=>Ye.deleteSmartPlug(t.id),onSuccess:()=>{n.invalidateQueries({queryKey:["smart-plugs"]})}}),w=f?.state==="ON",T=f?.reachable??!1,C=v.isPending;return p.jsxs(p.Fragment,{children:[p.jsx(Zt,{className:"relative",children:p.jsxs(cn,{className:"p-4",children:[p.jsxs("div",{className:"flex items-start justify-between mb-3",children:[p.jsxs("div",{className:"flex items-center gap-3",children:[p.jsx("div",{className:`p-2 rounded-lg ${T?w?"bg-bambu-green/20":"bg-bambu-dark":"bg-red-500/20"}`,children:p.jsx(SN,{className:`w-5 h-5 ${T?w?"text-bambu-green":"text-bambu-gray":"text-red-400"}`})}),p.jsxs("div",{children:[p.jsx("h3",{className:"font-medium text-white",children:t.name}),p.jsx("p",{className:"text-sm text-bambu-gray",children:t.ip_address})]})]}),p.jsx("div",{className:"flex items-center gap-2",children:m?p.jsx(Yt,{className:"w-4 h-4 text-bambu-gray animate-spin"}):T?p.jsxs("div",{className:"flex items-center gap-1 text-sm",children:[p.jsx(JG,{className:"w-4 h-4 text-bambu-green"}),p.jsx("span",{className:w?"text-bambu-green":"text-bambu-gray",children:f?.state||"Unknown"})]}):p.jsxs("div",{className:"flex items-center gap-1 text-sm text-red-400",children:[p.jsx(PP,{className:"w-4 h-4"}),p.jsx("span",{children:"Offline"})]})})]}),_&&p.jsxs("div",{className:"mb-3 px-2 py-1.5 bg-bambu-dark rounded-lg",children:[p.jsx("span",{className:"text-xs text-bambu-gray",children:"Linked to: "}),p.jsx("span",{className:"text-sm text-white",children:_.name})]}),p.jsxs("div",{className:"flex gap-2 mb-3",children:[p.jsxs(st,{size:"sm",variant:w?"primary":"secondary",disabled:!T||C,onClick:()=>s(!0),className:"flex-1",children:[C?p.jsx(Yt,{className:"w-4 h-4 animate-spin"}):p.jsx(fm,{className:"w-4 h-4"}),"On"]}),p.jsxs(st,{size:"sm",variant:w?"secondary":"primary",disabled:!T||C,onClick:()=>l(!0),className:"flex-1",children:[C?p.jsx(Yt,{className:"w-4 h-4 animate-spin"}):p.jsx(KG,{className:"w-4 h-4"}),"Off"]})]}),p.jsxs("button",{onClick:()=>d(!c),className:"w-full flex items-center justify-between py-2 text-sm text-bambu-gray hover:text-white transition-colors",children:[p.jsxs("span",{className:"flex items-center gap-2",children:[p.jsx(RP,{className:"w-4 h-4"}),"Automation Settings"]}),p.jsx("span",{children:c?"-":"+"})]}),c&&p.jsxs("div",{className:"pt-3 border-t border-bambu-dark-tertiary space-y-4",children:[p.jsxs("div",{className:"flex items-center justify-between",children:[p.jsxs("div",{children:[p.jsx("p",{className:"text-sm text-white",children:"Enabled"}),p.jsx("p",{className:"text-xs text-bambu-gray",children:"Enable automation for this plug"})]}),p.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[p.jsx("input",{type:"checkbox",checked:t.enabled,onChange:P=>x.mutate({enabled:P.target.checked}),className:"sr-only peer"}),p.jsx("div",{className:"w-9 h-5 bg-bambu-dark-tertiary peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:rounded-full after:h-4 after:w-4 after:transition-all peer-checked:bg-bambu-green"})]})]}),p.jsxs("div",{className:"flex items-center justify-between",children:[p.jsxs("div",{children:[p.jsx("p",{className:"text-sm text-white",children:"Auto On"}),p.jsx("p",{className:"text-xs text-bambu-gray",children:"Turn on when print starts"})]}),p.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[p.jsx("input",{type:"checkbox",checked:t.auto_on,onChange:P=>x.mutate({auto_on:P.target.checked}),className:"sr-only peer"}),p.jsx("div",{className:"w-9 h-5 bg-bambu-dark-tertiary peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:rounded-full after:h-4 after:w-4 after:transition-all peer-checked:bg-bambu-green"})]})]}),p.jsxs("div",{className:"flex items-center justify-between",children:[p.jsxs("div",{children:[p.jsx("p",{className:"text-sm text-white",children:"Auto Off"}),p.jsx("p",{className:"text-xs text-bambu-gray",children:"Turn off when print completes (one-shot)"})]}),p.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[p.jsx("input",{type:"checkbox",checked:t.auto_off,onChange:P=>x.mutate({auto_off:P.target.checked}),className:"sr-only peer"}),p.jsx("div",{className:"w-9 h-5 bg-bambu-dark-tertiary peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:rounded-full after:h-4 after:w-4 after:transition-all peer-checked:bg-bambu-green"})]})]}),t.auto_off&&p.jsxs("div",{className:"space-y-3 pl-4 border-l-2 border-bambu-dark-tertiary",children:[p.jsxs("div",{children:[p.jsx("p",{className:"text-sm text-white mb-2",children:"Turn Off Delay Mode"}),p.jsxs("div",{className:"flex gap-2",children:[p.jsxs("button",{onClick:()=>x.mutate({off_delay_mode:"time"}),className:`flex-1 flex items-center justify-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors ${t.off_delay_mode==="time"?"bg-bambu-green text-white":"bg-bambu-dark text-bambu-gray hover:text-white"}`,children:[p.jsx(xa,{className:"w-4 h-4"}),"Time"]}),p.jsxs("button",{onClick:()=>x.mutate({off_delay_mode:"temperature"}),className:`flex-1 flex items-center justify-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors ${t.off_delay_mode==="temperature"?"bg-bambu-green text-white":"bg-bambu-dark text-bambu-gray hover:text-white"}`,children:[p.jsx(l0,{className:"w-4 h-4"}),"Temp"]})]})]}),t.off_delay_mode==="time"?p.jsxs("div",{children:[p.jsx("label",{className:"block text-xs text-bambu-gray mb-1",children:"Delay (minutes)"}),p.jsx("input",{type:"number",min:"1",max:"60",value:t.off_delay_minutes,onChange:P=>x.mutate({off_delay_minutes:parseInt(P.target.value)||5}),className:"w-full 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"})]}):p.jsxs("div",{children:[p.jsx("label",{className:"block text-xs text-bambu-gray mb-1",children:"Temperature threshold (C)"}),p.jsx("input",{type:"number",min:"30",max:"100",value:t.off_temp_threshold,onChange:P=>x.mutate({off_temp_threshold:parseInt(P.target.value)||70}),className:"w-full 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"}),p.jsx("p",{className:"text-xs text-bambu-gray mt-1",children:"Turns off when nozzle cools below this temperature"})]})]}),p.jsxs("div",{className:"flex gap-2 pt-2",children:[p.jsxs(st,{size:"sm",variant:"secondary",onClick:()=>e(t),className:"flex-1",children:[p.jsx(XG,{className:"w-4 h-4"}),"Edit"]}),p.jsx(st,{size:"sm",variant:"secondary",onClick:()=>r(!0),className:"text-red-400 hover:text-red-300",children:p.jsx(na,{className:"w-4 h-4"})})]})]})]})}),i&&p.jsx(ma,{title:"Delete Smart Plug",message:`Are you sure you want to delete "${t.name}"? This cannot be undone.`,confirmText:"Delete",variant:"danger",onConfirm:()=>{M.mutate(),r(!1)},onCancel:()=>r(!1)}),a&&p.jsx(ma,{title:"Turn On Smart Plug",message:`Are you sure you want to turn on "${t.name}"?`,confirmText:"Turn On",variant:"default",onConfirm:()=>{v.mutate("on"),s(!1)},onCancel:()=>s(!1)}),o&&p.jsx(ma,{title:"Turn Off Smart Plug",message:`Are you sure you want to turn off "${t.name}"? This will cut power to the connected device.`,confirmText:"Turn Off",variant:"danger",onConfirm:()=>{v.mutate("off"),l(!1)},onCancel:()=>l(!1)})]})}function FVe({plug:t,onClose:e}){const n=Jn(),i=!!t,[r,a]=E.useState(t?.name||""),[s,o]=E.useState(t?.ip_address||""),[l,c]=E.useState(t?.username||""),[d,f]=E.useState(t?.password||""),[m,g]=E.useState(t?.printer_id||null),[y,_]=E.useState(null),[v,x]=E.useState(null),{data:M}=It({queryKey:["printers"],queryFn:Ye.getPrinters}),{data:w}=It({queryKey:["smart-plugs"],queryFn:Ye.getSmartPlugs});E.useEffect(()=>{const D=F=>{F.key==="Escape"&&e()};return window.addEventListener("keydown",D),()=>window.removeEventListener("keydown",D)},[e]);const T=Ot({mutationFn:()=>Ye.testSmartPlugConnection(s,l||null,d||null),onSuccess:D=>{_(D),x(null),!r&&D.device_name&&a(D.device_name)},onError:D=>{_(null),x(D.message)}}),C=Ot({mutationFn:D=>Ye.createSmartPlug(D),onSuccess:()=>{n.invalidateQueries({queryKey:["smart-plugs"]}),e()},onError:D=>{x(D.message)}}),P=Ot({mutationFn:D=>Ye.updateSmartPlug(t.id,D),onSuccess:()=>{n.invalidateQueries({queryKey:["smart-plugs"]}),e()},onError:D=>{x(D.message)}}),A=M?.filter(D=>!w?.some(I=>I.printer_id===D.id&&I.id!==t?.id)),U=D=>{if(D.preventDefault(),x(null),!r.trim()){x("Name is required");return}if(!s.trim()){x("IP address is required");return}const F={name:r.trim(),ip_address:s.trim(),username:l.trim()||null,password:d.trim()||null,printer_id:m};i?P.mutate(F):C.mutate(F)},N=C.isPending||P.isPending;return p.jsx("div",{className:"fixed inset-0 bg-black/70 flex items-center justify-center z-50 p-4",onClick:e,children:p.jsxs("div",{className:"bg-bambu-dark-secondary rounded-xl border border-bambu-dark-tertiary w-full max-w-md",onClick:D=>D.stopPropagation(),children:[p.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-bambu-dark-tertiary",children:[p.jsx("h2",{className:"text-lg font-semibold text-white",children:i?"Edit Smart Plug":"Add Smart Plug"}),p.jsx("button",{onClick:e,className:"text-bambu-gray hover:text-white transition-colors",children:p.jsx(Cn,{className:"w-5 h-5"})})]}),p.jsxs("form",{onSubmit:U,className:"p-6 space-y-4",children:[v&&p.jsx("div",{className:"p-3 bg-red-500/20 border border-red-500/50 rounded-lg text-sm text-red-400",children:v}),p.jsxs("div",{children:[p.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:"IP Address *"}),p.jsxs("div",{className:"flex gap-2",children:[p.jsx("input",{type:"text",value:s,onChange:D=>{o(D.target.value),_(null)},placeholder:"192.168.1.100",className:"flex-1 px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none"}),p.jsxs(st,{type:"button",variant:"secondary",onClick:()=>T.mutate(),disabled:!s.trim()||T.isPending,children:[T.isPending?p.jsx(Yt,{className:"w-4 h-4 animate-spin"}):p.jsx(JG,{className:"w-4 h-4"}),"Test"]})]})]}),y&&p.jsx("div",{className:`p-3 rounded-lg flex items-center gap-2 ${y.success?"bg-bambu-green/20 border border-bambu-green/50 text-bambu-green":"bg-red-500/20 border border-red-500/50 text-red-400"}`,children:y.success?p.jsxs(p.Fragment,{children:[p.jsx(rd,{className:"w-5 h-5"}),p.jsxs("div",{children:[p.jsx("p",{className:"font-medium",children:"Connected!"}),p.jsxs("p",{className:"text-sm opacity-80",children:[y.device_name&&`Device: ${y.device_name} - `,"State: ",y.state]})]})]}):p.jsxs(p.Fragment,{children:[p.jsx(PP,{className:"w-5 h-5"}),p.jsx("span",{children:"Connection failed"})]})}),p.jsxs("div",{children:[p.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:"Name *"}),p.jsx("input",{type:"text",value:r,onChange:D=>a(D.target.value),placeholder:"Living Room Plug",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"})]}),p.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[p.jsxs("div",{children:[p.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:"Username"}),p.jsx("input",{type:"text",value:l,onChange:D=>c(D.target.value),placeholder:"admin",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"})]}),p.jsxs("div",{children:[p.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:"Password"}),p.jsx("input",{type:"password",value:d,onChange:D=>f(D.target.value),placeholder:"********",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"})]})]}),p.jsx("p",{className:"text-xs text-bambu-gray -mt-2",children:"Leave empty if your Tasmota device doesn't require authentication"}),p.jsxs("div",{children:[p.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:"Link to Printer"}),p.jsxs("select",{value:m??"",onChange:D=>g(D.target.value?Number(D.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:[p.jsx("option",{value:"",children:"No printer (manual control only)"}),A?.map(D=>p.jsx("option",{value:D.id,children:D.name},D.id))]}),p.jsx("p",{className:"text-xs text-bambu-gray mt-1",children:"Linking enables automatic on/off when prints start/complete"})]}),p.jsxs("div",{className:"flex gap-3 pt-2",children:[p.jsx(st,{type:"button",variant:"secondary",onClick:e,className:"flex-1",children:"Cancel"}),p.jsxs(st,{type:"submit",disabled:N,className:"flex-1",children:[N?p.jsx(Yt,{className:"w-4 h-4 animate-spin"}):p.jsx(Rx,{className:"w-4 h-4"}),i?"Save":"Add"]})]})]})]})})}function ns({checked:t,onChange:e,disabled:n}){const i=r=>{r.preventDefault(),r.stopPropagation(),n||e(!t)};return p.jsx("button",{type:"button",role:"switch","aria-checked":t,disabled:n,onClick:i,className:`relative inline-flex w-9 h-5 rounded-full transition-colors flex-shrink-0 focus:outline-none focus:ring-2 focus:ring-bambu-green focus:ring-offset-2 focus:ring-offset-bambu-dark ${n?"bg-bambu-dark-tertiary/50 cursor-not-allowed opacity-50":t?"bg-bambu-green cursor-pointer":"bg-bambu-dark-tertiary cursor-pointer hover:bg-bambu-dark-tertiary/80"}`,children:p.jsx("span",{className:`pointer-events-none absolute top-[2px] left-[2px] w-4 h-4 bg-white rounded-full shadow transition-transform duration-200 ease-in-out ${t?"translate-x-4":"translate-x-0"}`})})}const zVe={callmebot:"CallMeBot/WhatsApp",ntfy:"ntfy",pushover:"Pushover",telegram:"Telegram",email:"Email"};function BVe({provider:t,onEdit:e}){const n=Jn(),[i,r]=E.useState(!1),[a,s]=E.useState(!1),[o,l]=E.useState(null),{data:c}=It({queryKey:["printers"],queryFn:Ye.getPrinters}),d=c?.find(_=>_.id===t.printer_id),f=Ot({mutationFn:_=>Ye.updateNotificationProvider(t.id,_),onSuccess:()=>{n.invalidateQueries({queryKey:["notification-providers"]})}}),m=Ot({mutationFn:()=>Ye.deleteNotificationProvider(t.id),onSuccess:()=>{n.invalidateQueries({queryKey:["notification-providers"]})}}),g=Ot({mutationFn:()=>Ye.testNotificationProvider(t.id),onSuccess:_=>{l(_),n.invalidateQueries({queryKey:["notification-providers"]})},onError:_=>{l({success:!1,message:_.message})}}),y=_=>_||"";return p.jsxs(p.Fragment,{children:[p.jsx(Zt,{className:"relative",children:p.jsxs(cn,{className:"p-4",children:[p.jsxs("div",{className:"flex items-start justify-between mb-3",children:[p.jsxs("div",{className:"flex items-center gap-3",children:[p.jsx("div",{className:`p-2 rounded-lg ${t.enabled?"bg-bambu-green/20":"bg-bambu-dark"}`,children:p.jsx(vN,{className:`w-5 h-5 ${t.enabled?"text-bambu-green":"text-bambu-gray"}`})}),p.jsxs("div",{children:[p.jsx("h3",{className:"font-medium text-white",children:t.name}),p.jsx("p",{className:"text-sm text-bambu-gray",children:zVe[t.provider_type]||t.provider_type})]})]}),p.jsxs("div",{className:"flex items-center gap-2",children:[t.last_success&&p.jsxs("span",{className:"text-xs text-bambu-green",children:["Last sent: ",new Date(t.last_success).toLocaleDateString()]}),t.last_error&&p.jsx("span",{className:"text-xs text-red-400",title:t.last_error,children:"Error"})]})]}),d&&p.jsxs("div",{className:"mb-3 px-2 py-1.5 bg-bambu-dark rounded-lg",children:[p.jsx("span",{className:"text-xs text-bambu-gray",children:"Printer: "}),p.jsx("span",{className:"text-sm text-white",children:d.name})]}),!d&&!t.printer_id&&p.jsx("div",{className:"mb-3 px-2 py-1.5 bg-bambu-dark rounded-lg",children:p.jsx("span",{className:"text-xs text-bambu-gray",children:"All printers"})}),p.jsxs("div",{className:"mb-3 flex flex-wrap gap-1",children:[t.on_print_start&&p.jsx("span",{className:"px-2 py-0.5 bg-blue-500/20 text-blue-400 text-xs rounded",children:"Start"}),t.on_print_complete&&p.jsx("span",{className:"px-2 py-0.5 bg-bambu-green/20 text-bambu-green text-xs rounded",children:"Complete"}),t.on_print_failed&&p.jsx("span",{className:"px-2 py-0.5 bg-red-500/20 text-red-400 text-xs rounded",children:"Failed"}),t.on_print_stopped&&p.jsx("span",{className:"px-2 py-0.5 bg-orange-500/20 text-orange-400 text-xs rounded",children:"Stopped"}),t.on_print_progress&&p.jsx("span",{className:"px-2 py-0.5 bg-yellow-500/20 text-yellow-400 text-xs rounded",children:"Progress"}),t.on_printer_offline&&p.jsx("span",{className:"px-2 py-0.5 bg-gray-500/20 text-gray-400 text-xs rounded",children:"Offline"}),t.on_printer_error&&p.jsx("span",{className:"px-2 py-0.5 bg-orange-500/20 text-orange-400 text-xs rounded",children:"Error"}),t.on_filament_low&&p.jsx("span",{className:"px-2 py-0.5 bg-amber-500/20 text-amber-400 text-xs rounded",children:"Low Filament"}),t.on_maintenance_due&&p.jsx("span",{className:"px-2 py-0.5 bg-purple-500/20 text-purple-400 text-xs rounded",children:"Maintenance"}),t.quiet_hours_enabled&&p.jsxs("span",{className:"px-2 py-0.5 bg-purple-500/20 text-purple-400 text-xs rounded flex items-center gap-1",children:[p.jsx(I_,{className:"w-3 h-3"}),"Quiet"]})]}),p.jsx("div",{className:"mb-3",children:p.jsxs(st,{size:"sm",variant:"secondary",disabled:g.isPending,onClick:()=>{l(null),g.mutate()},className:"w-full",children:[g.isPending?p.jsx(Yt,{className:"w-4 h-4 animate-spin"}):p.jsx(YG,{className:"w-4 h-4"}),"Send Test Notification"]})}),o&&p.jsxs("div",{className:`mb-3 p-2 rounded-lg flex items-center gap-2 text-sm ${o.success?"bg-bambu-green/20 text-bambu-green":"bg-red-500/20 text-red-400"}`,children:[o.success?p.jsx(rd,{className:"w-4 h-4"}):p.jsx(Nx,{className:"w-4 h-4"}),p.jsx("span",{children:o.message})]}),p.jsxs("button",{onClick:()=>s(!a),className:"w-full flex items-center justify-between py-2 text-sm text-bambu-gray hover:text-white transition-colors border-t border-bambu-dark-tertiary",children:[p.jsxs("span",{className:"flex items-center gap-2",children:[p.jsx(RP,{className:"w-4 h-4"}),"Event Settings"]}),a?p.jsx(zG,{className:"w-4 h-4"}):p.jsx(Cx,{className:"w-4 h-4"})]}),a&&p.jsxs("div",{className:"pt-3 border-t border-bambu-dark-tertiary space-y-4",children:[p.jsxs("div",{className:"flex items-center justify-between",children:[p.jsxs("div",{children:[p.jsx("p",{className:"text-sm text-white",children:"Enabled"}),p.jsx("p",{className:"text-xs text-bambu-gray",children:"Send notifications from this provider"})]}),p.jsx(ns,{checked:t.enabled,onChange:_=>f.mutate({enabled:_})})]}),p.jsxs("div",{className:"space-y-2",children:[p.jsx("p",{className:"text-xs text-bambu-gray uppercase tracking-wide",children:"Print Events"}),p.jsxs("div",{className:"flex items-center justify-between",children:[p.jsx("p",{className:"text-sm text-white",children:"Print Started"}),p.jsx(ns,{checked:t.on_print_start,onChange:_=>f.mutate({on_print_start:_})})]}),p.jsxs("div",{className:"flex items-center justify-between",children:[p.jsx("p",{className:"text-sm text-white",children:"Print Completed"}),p.jsx(ns,{checked:t.on_print_complete,onChange:_=>f.mutate({on_print_complete:_})})]}),p.jsxs("div",{className:"flex items-center justify-between",children:[p.jsx("p",{className:"text-sm text-white",children:"Print Failed"}),p.jsx(ns,{checked:t.on_print_failed,onChange:_=>f.mutate({on_print_failed:_})})]}),p.jsxs("div",{className:"flex items-center justify-between",children:[p.jsx("p",{className:"text-sm text-white",children:"Print Stopped"}),p.jsx(ns,{checked:t.on_print_stopped,onChange:_=>f.mutate({on_print_stopped:_})})]}),p.jsxs("div",{className:"flex items-center justify-between",children:[p.jsxs("div",{children:[p.jsx("p",{className:"text-sm text-white",children:"Progress Milestones"}),p.jsx("p",{className:"text-xs text-bambu-gray",children:"Notify at 25%, 50%, 75%"})]}),p.jsx(ns,{checked:t.on_print_progress,onChange:_=>f.mutate({on_print_progress:_})})]})]}),p.jsxs("div",{className:"space-y-2",children:[p.jsx("p",{className:"text-xs text-bambu-gray uppercase tracking-wide",children:"Printer Status"}),p.jsxs("div",{className:"flex items-center justify-between",children:[p.jsx("p",{className:"text-sm text-white",children:"Printer Offline"}),p.jsx(ns,{checked:t.on_printer_offline,onChange:_=>f.mutate({on_printer_offline:_})})]}),p.jsxs("div",{className:"flex items-center justify-between",children:[p.jsx("p",{className:"text-sm text-white",children:"Printer Error"}),p.jsx(ns,{checked:t.on_printer_error,onChange:_=>f.mutate({on_printer_error:_})})]}),p.jsxs("div",{className:"flex items-center justify-between",children:[p.jsx("p",{className:"text-sm text-white",children:"Low Filament"}),p.jsx(ns,{checked:t.on_filament_low,onChange:_=>f.mutate({on_filament_low:_})})]}),p.jsxs("div",{className:"flex items-center justify-between",children:[p.jsxs("div",{children:[p.jsx("p",{className:"text-sm text-white",children:"Maintenance Due"}),p.jsx("p",{className:"text-xs text-bambu-gray",children:"Notify when maintenance is needed"})]}),p.jsx(ns,{checked:t.on_maintenance_due??!1,onChange:_=>f.mutate({on_maintenance_due:_})})]})]}),p.jsxs("div",{className:"space-y-2",children:[p.jsxs("div",{className:"flex items-center justify-between",children:[p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx(I_,{className:"w-4 h-4 text-purple-400"}),p.jsx("p",{className:"text-sm text-white",children:"Quiet Hours"})]}),p.jsx(ns,{checked:t.quiet_hours_enabled,onChange:_=>f.mutate({quiet_hours_enabled:_})})]}),t.quiet_hours_enabled&&p.jsxs("div",{className:"pl-4 border-l-2 border-bambu-dark-tertiary space-y-2",children:[p.jsx("p",{className:"text-xs text-bambu-gray",children:"No notifications during these hours"}),p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx(xa,{className:"w-4 h-4 text-bambu-gray"}),p.jsxs("span",{className:"text-sm text-white",children:[y(t.quiet_hours_start)||"22:00"," - ",y(t.quiet_hours_end)||"07:00"]})]}),p.jsx("p",{className:"text-xs text-bambu-gray",children:"Edit provider to change quiet hours"})]})]}),p.jsxs("div",{className:"flex gap-2 pt-2",children:[p.jsxs(st,{size:"sm",variant:"secondary",onClick:()=>e(t),className:"flex-1",children:[p.jsx(XG,{className:"w-4 h-4"}),"Edit"]}),p.jsx(st,{size:"sm",variant:"secondary",onClick:()=>r(!0),className:"text-red-400 hover:text-red-300",children:p.jsx(na,{className:"w-4 h-4"})})]})]})]})}),i&&p.jsx(ma,{title:"Delete Notification Provider",message:`Are you sure you want to delete "${t.name}"? This cannot be undone.`,confirmText:"Delete",variant:"danger",onConfirm:()=>{m.mutate(),r(!1)},onCancel:()=>r(!1)})]})}const Q$=[{value:"callmebot",label:"CallMeBot/WhatsApp",description:"Free WhatsApp notifications via CallMeBot"},{value:"ntfy",label:"ntfy",description:"Free, self-hostable push notifications"},{value:"pushover",label:"Pushover",description:"Simple, reliable push notifications"},{value:"telegram",label:"Telegram",description:"Notifications via Telegram bot"},{value:"email",label:"Email",description:"SMTP email notifications"}];function HVe({provider:t,onClose:e}){const n=Jn(),i=!!t,[r,a]=E.useState(t?.name||""),[s,o]=E.useState(t?.provider_type||"ntfy"),[l,c]=E.useState(t?.printer_id||null),[d,f]=E.useState(t?.quiet_hours_enabled||!1),[m,g]=E.useState(t?.quiet_hours_start||"22:00"),[y,_]=E.useState(t?.quiet_hours_end||"07:00"),[v,x]=E.useState(t?.config?Object.fromEntries(Object.entries(t.config).map(([B,H])=>[B,String(H)])):{}),[M,w]=E.useState(null),[T,C]=E.useState(null),{data:P}=It({queryKey:["printers"],queryFn:Ye.getPrinters});E.useEffect(()=>{const B=H=>{H.key==="Escape"&&e()};return window.addEventListener("keydown",B),()=>window.removeEventListener("keydown",B)},[e]);const A=Ot({mutationFn:()=>Ye.testNotificationConfig({provider_type:s,config:v}),onSuccess:B=>{w(B),C(null)},onError:B=>{w({success:!1,message:B.message})}}),U=Ot({mutationFn:B=>Ye.createNotificationProvider(B),onSuccess:()=>{n.invalidateQueries({queryKey:["notification-providers"]}),e()},onError:B=>{C(B.message)}}),N=Ot({mutationFn:B=>Ye.updateNotificationProvider(t.id,B),onSuccess:()=>{n.invalidateQueries({queryKey:["notification-providers"]}),e()},onError:B=>{C(B.message)}}),D=B=>{if(B.preventDefault(),C(null),!r.trim()){C("Name is required");return}const H=W(s);for(const K of H)if(!v[K.key]?.trim()){C(`${K.label} is required`);return}const $={name:r.trim(),provider_type:s,config:v,printer_id:l,quiet_hours_enabled:d,quiet_hours_start:d?m:null,quiet_hours_end:d?y:null};i?N.mutate($):U.mutate($)},F=U.isPending||N.isPending,I=B=>{switch(B){case"callmebot":return[{key:"phone",label:"Phone Number",placeholder:"+1234567890",type:"text",required:!0},{key:"apikey",label:"API Key",placeholder:"Your CallMeBot API key",type:"text",required:!0}];case"ntfy":return[{key:"server",label:"Server URL",placeholder:"https://ntfy.sh",type:"text",required:!1},{key:"topic",label:"Topic",placeholder:"my-bambutrack",type:"text",required:!0},{key:"auth_token",label:"Auth Token",placeholder:"Optional authentication",type:"password",required:!1}];case"pushover":return[{key:"user_key",label:"User Key",placeholder:"Your Pushover user key",type:"text",required:!0},{key:"app_token",label:"App Token",placeholder:"Your Pushover app token",type:"text",required:!0},{key:"priority",label:"Priority",placeholder:"0 (normal)",type:"number",required:!1}];case"telegram":return[{key:"bot_token",label:"Bot Token",placeholder:"Bot token from @BotFather",type:"password",required:!0},{key:"chat_id",label:"Chat ID",placeholder:"Your chat or group ID",type:"text",required:!0}];case"email":return[{key:"smtp_server",label:"SMTP Server",placeholder:"smtp.gmail.com",type:"text",required:!0},{key:"smtp_port",label:"SMTP Port",placeholder:"587",type:"number",required:!1},{key:"security",label:"Security",type:"select",required:!1,options:[{value:"starttls",label:"STARTTLS (Port 587)"},{value:"ssl",label:"SSL/TLS (Port 465)"},{value:"none",label:"None (Port 25)"}]},{key:"auth_enabled",label:"Authentication",type:"select",required:!1,options:[{value:"true",label:"Enabled"},{value:"false",label:"Disabled"}]},{key:"username",label:"Username",placeholder:"your@email.com",type:"text",required:!1},{key:"password",label:"Password",placeholder:"App password",type:"password",required:!1},{key:"from_email",label:"From Email",placeholder:"your@email.com",type:"text",required:!0},{key:"to_email",label:"To Email",placeholder:"recipient@email.com",type:"text",required:!0}];default:return[]}},W=B=>I(B).filter(H=>H.required),O=I(s);return p.jsx("div",{className:"fixed inset-0 bg-black/70 flex items-center justify-center z-50 p-4 overflow-y-auto",onClick:e,children:p.jsxs("div",{className:"bg-bambu-dark-secondary rounded-xl border border-bambu-dark-tertiary w-full max-w-lg my-8",onClick:B=>B.stopPropagation(),children:[p.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-bambu-dark-tertiary",children:[p.jsx("h2",{className:"text-lg font-semibold text-white",children:i?"Edit Notification Provider":"Add Notification Provider"}),p.jsx("button",{onClick:e,className:"text-bambu-gray hover:text-white transition-colors",children:p.jsx(Cn,{className:"w-5 h-5"})})]}),p.jsxs("form",{onSubmit:D,className:"p-6 space-y-4",children:[T&&p.jsx("div",{className:"p-3 bg-red-500/20 border border-red-500/50 rounded-lg text-sm text-red-400",children:T}),p.jsxs("div",{children:[p.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:"Name *"}),p.jsx("input",{type:"text",value:r,onChange:B=>a(B.target.value),placeholder:"My Notifications",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"})]}),p.jsxs("div",{children:[p.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:"Provider Type *"}),p.jsx("select",{value:s,onChange:B=>{o(B.target.value),x({}),w(null)},disabled:i,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 disabled:opacity-50",children:Q$.map(B=>p.jsx("option",{value:B.value,children:B.label},B.value))}),p.jsx("p",{className:"text-xs text-bambu-gray mt-1",children:Q$.find(B=>B.value===s)?.description})]}),p.jsxs("div",{className:"space-y-3",children:[p.jsx("p",{className:"text-sm text-bambu-gray",children:"Configuration"}),O.map(B=>p.jsxs("div",{children:[p.jsxs("label",{className:"block text-sm text-bambu-gray mb-1",children:[B.label," ",B.required&&"*"]}),B.type==="select"&&B.options?p.jsx("select",{value:v[B.key]||B.options[0]?.value||"",onChange:H=>{x({...v,[B.key]:H.target.value}),w(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:B.options.map(H=>p.jsx("option",{value:H.value,children:H.label},H.value))}):p.jsx("input",{type:B.type,value:v[B.key]||"",onChange:H=>{x({...v,[B.key]:H.target.value}),w(null)},placeholder:B.placeholder,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"})]},B.key))]}),p.jsx("div",{className:"flex gap-2",children:p.jsxs(st,{type:"button",variant:"secondary",onClick:()=>{w(null),A.mutate()},disabled:A.isPending||!v[W(s)[0]?.key],className:"flex-1",children:[A.isPending?p.jsx(Yt,{className:"w-4 h-4 animate-spin"}):p.jsx(YG,{className:"w-4 h-4"}),"Test Configuration"]})}),M&&p.jsx("div",{className:`p-3 rounded-lg flex items-center gap-2 ${M.success?"bg-bambu-green/20 border border-bambu-green/50 text-bambu-green":"bg-red-500/20 border border-red-500/50 text-red-400"}`,children:M.success?p.jsxs(p.Fragment,{children:[p.jsx(rd,{className:"w-5 h-5"}),p.jsx("span",{children:M.message})]}):p.jsxs(p.Fragment,{children:[p.jsx(Nx,{className:"w-5 h-5"}),p.jsx("span",{children:M.message})]})}),p.jsxs("div",{children:[p.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:"Printer Filter"}),p.jsxs("select",{value:l??"",onChange:B=>c(B.target.value?Number(B.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:[p.jsx("option",{value:"",children:"All printers"}),P?.map(B=>p.jsx("option",{value:B.id,children:B.name},B.id))]}),p.jsx("p",{className:"text-xs text-bambu-gray mt-1",children:"Only send notifications for events from this printer"})]}),p.jsxs("div",{className:"space-y-2",children:[p.jsxs("div",{className:"flex items-center justify-between",children:[p.jsx("label",{className:"text-sm text-white",children:"Quiet Hours (Do Not Disturb)"}),p.jsx(ns,{checked:d,onChange:f})]}),d&&p.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[p.jsxs("div",{children:[p.jsx("label",{className:"block text-xs text-bambu-gray mb-1",children:"Start"}),p.jsx("input",{type:"time",value:m,onChange:B=>g(B.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"})]}),p.jsxs("div",{children:[p.jsx("label",{className:"block text-xs text-bambu-gray mb-1",children:"End"}),p.jsx("input",{type:"time",value:y,onChange:B=>_(B.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"})]})]})]}),p.jsxs("div",{className:"flex gap-3 pt-2",children:[p.jsx(st,{type:"button",variant:"secondary",onClick:e,className:"flex-1",children:"Cancel"}),p.jsxs(st,{type:"submit",disabled:F,className:"flex-1",children:[F?p.jsx(Yt,{className:"w-4 h-4 animate-spin"}):p.jsx(Rx,{className:"w-4 h-4"}),i?"Save":"Add"]})]})]})]})})}async function VVe(){const t=await fetch("/api/v1/settings/spoolman");if(!t.ok)throw new Error("Failed to load Spoolman settings");return t.json()}async function $Ve(t){const e=await fetch("/api/v1/settings/spoolman",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!e.ok)throw new Error("Failed to save Spoolman settings");return e.json()}function GVe(){const t=Jn(),[e,n]=E.useState(!1),[i,r]=E.useState(""),[a,s]=E.useState("auto"),[o,l]=E.useState(!1),[c,d]=E.useState(!1),[f,m]=E.useState("all"),{data:g,isLoading:y}=It({queryKey:["spoolman-settings"],queryFn:VVe}),{data:_,isLoading:v,refetch:x}=It({queryKey:["spoolman-status"],queryFn:Ye.getSpoolmanStatus,refetchInterval:3e4}),{data:M}=It({queryKey:["printers"],queryFn:Ye.getPrinters});E.useEffect(()=>{g&&(n(g.spoolman_enabled==="true"),r(g.spoolman_url||""),s(g.spoolman_sync_mode||"auto"))},[g]),E.useEffect(()=>{if(g){const I=g.spoolman_enabled==="true"!==e||(g.spoolman_url||"")!==i||(g.spoolman_sync_mode||"auto")!==a;l(I)}},[g,e,i,a]);const w=Ot({mutationFn:()=>$Ve({spoolman_enabled:e?"true":"false",spoolman_url:i,spoolman_sync_mode:a}),onSuccess:()=>{t.invalidateQueries({queryKey:["spoolman-settings"]}),t.invalidateQueries({queryKey:["spoolman-status"]}),l(!1),d(!0),setTimeout(()=>d(!1),2e3)}}),T=Ot({mutationFn:Ye.connectSpoolman,onSuccess:()=>{x()}}),C=Ot({mutationFn:Ye.disconnectSpoolman,onSuccess:()=>{x()}}),P=Ot({mutationFn:Ye.syncAllPrintersAms,onSuccess:I=>{I.success}}),A=Ot({mutationFn:I=>Ye.syncPrinterAms(I),onSuccess:I=>{I.success}}),U=()=>{f==="all"?P.mutate():A.mutate(f)},N=P.isPending||A.isPending,D=f==="all"?P.data:A.data,F=f==="all"?P.isSuccess:A.isSuccess;return y?p.jsxs(Zt,{children:[p.jsx(Fo,{children:p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx(kj,{className:"w-5 h-5 text-bambu-green"}),p.jsx("h2",{className:"text-lg font-semibold text-white",children:"Spoolman Integration"})]})}),p.jsx(cn,{children:p.jsx("div",{className:"flex justify-center py-8",children:p.jsx(Yt,{className:"w-6 h-6 text-bambu-green animate-spin"})})})]}):p.jsxs(Zt,{children:[p.jsx(Fo,{children:p.jsxs("div",{className:"flex items-center justify-between",children:[p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx(kj,{className:"w-5 h-5 text-bambu-green"}),p.jsx("h2",{className:"text-lg font-semibold text-white",children:"Spoolman Integration"})]}),o&&p.jsx(st,{size:"sm",onClick:()=>w.mutate(),disabled:w.isPending,children:w.isPending?p.jsx(Yt,{className:"w-4 h-4 animate-spin"}):c?p.jsx(O0,{className:"w-4 h-4"}):"Save"})]})}),p.jsxs(cn,{className:"space-y-4",children:[p.jsx("p",{className:"text-sm text-bambu-gray",children:"Connect to Spoolman for filament inventory tracking. AMS data will sync automatically."}),p.jsxs("div",{className:"flex items-center justify-between",children:[p.jsxs("div",{children:[p.jsx("p",{className:"text-white",children:"Enable Spoolman"}),p.jsx("p",{className:"text-sm text-bambu-gray",children:"Sync filament data with Spoolman server"})]}),p.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[p.jsx("input",{type:"checkbox",checked:e,onChange:I=>n(I.target.checked),className:"sr-only peer"}),p.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"})]})]}),p.jsxs("div",{children:[p.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:"Spoolman URL"}),p.jsx("input",{type:"text",placeholder:"http://192.168.1.100:7912",value:i,onChange:I=>r(I.target.value),disabled:!e,className:"w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray/50 focus:border-bambu-green focus:outline-none disabled:opacity-50"}),p.jsx("p",{className:"text-xs text-bambu-gray mt-1",children:"URL of your Spoolman server (e.g., http://localhost:7912)"})]}),p.jsxs("div",{children:[p.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:"Sync Mode"}),p.jsxs("select",{value:a,onChange:I=>s(I.target.value),disabled:!e,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 disabled:opacity-50",children:[p.jsx("option",{value:"auto",children:"Automatic"}),p.jsx("option",{value:"manual",children:"Manual Only"})]}),p.jsx("p",{className:"text-xs text-bambu-gray mt-1",children:a==="auto"?"AMS data syncs automatically when changes are detected":"Only sync when manually triggered"})]}),e&&p.jsxs("div",{className:"pt-2 border-t border-bambu-dark-tertiary",children:[p.jsxs("div",{className:"flex items-center justify-between mb-3",children:[p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("span",{className:"text-sm text-bambu-gray",children:"Status:"}),v?p.jsx(Yt,{className:"w-4 h-4 text-bambu-gray animate-spin"}):_?.connected?p.jsxs("span",{className:"flex items-center gap-1 text-sm text-green-500",children:[p.jsx(O0,{className:"w-4 h-4"}),"Connected"]}):p.jsxs("span",{className:"flex items-center gap-1 text-sm text-red-500",children:[p.jsx(Cn,{className:"w-4 h-4"}),"Disconnected"]})]}),p.jsx("div",{className:"flex gap-2",children:_?.connected?p.jsxs(st,{variant:"secondary",size:"sm",onClick:()=>C.mutate(),disabled:C.isPending,children:[C.isPending?p.jsx(Yt,{className:"w-4 h-4 animate-spin"}):p.jsx(Fse,{className:"w-4 h-4"}),"Disconnect"]}):p.jsxs(st,{size:"sm",onClick:()=>T.mutate(),disabled:T.isPending||!i,children:[T.isPending?p.jsx(Yt,{className:"w-4 h-4 animate-spin"}):p.jsx(Bse,{className:"w-4 h-4"}),"Connect"]})})]}),T.isError&&p.jsx("div",{className:"mb-3 p-2 bg-red-500/20 border border-red-500/50 rounded text-sm text-red-400",children:T.error.message}),_?.connected&&p.jsxs("div",{className:"space-y-3",children:[p.jsxs("div",{children:[p.jsx("p",{className:"text-sm text-white",children:"Sync AMS Data"}),p.jsx("p",{className:"text-xs text-bambu-gray",children:"Manually sync printer AMS data to Spoolman"})]}),p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsxs("div",{className:"relative flex-1",children:[p.jsxs("select",{value:f,onChange:I=>m(I.target.value==="all"?"all":Number(I.target.value)),className:"w-full px-3 py-2 pr-8 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white text-sm focus:border-bambu-green focus:outline-none appearance-none cursor-pointer",children:[p.jsx("option",{value:"all",children:"All Printers"}),M?.map(I=>p.jsx("option",{value:I.id,children:I.name},I.id))]}),p.jsx(Cx,{className:"absolute right-2 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray pointer-events-none"})]}),p.jsxs(st,{variant:"secondary",size:"sm",onClick:U,disabled:N,children:[N?p.jsx(Yt,{className:"w-4 h-4 animate-spin"}):p.jsx(Zo,{className:"w-4 h-4"}),"Sync"]})]})]}),F&&D&&p.jsx("div",{className:`mt-2 p-2 rounded text-sm ${D.success?"bg-green-500/20 border border-green-500/50 text-green-400":"bg-yellow-500/20 border border-yellow-500/50 text-yellow-400"}`,children:D.success?`Synced ${D.synced_count} trays successfully`:`Synced ${D.synced_count} trays with ${D.errors.length} errors`})]})]})]})}function WVe(){const t=Jn(),{t:e,i18n:n}=mP(),[i,r]=E.useState(null),[a,s]=E.useState(!1),[o,l]=E.useState(!1),[c,d]=E.useState(!1),[f,m]=E.useState(null),[g,y]=E.useState(!1),[_,v]=E.useState(null),[x,M]=E.useState(i9()),w=X=>{M(X),Ele(X)},T=()=>{localStorage.removeItem("sidebarOrder"),window.location.reload()},{data:C,isLoading:P}=It({queryKey:["settings"],queryFn:Ye.getSettings}),{data:A,isLoading:U}=It({queryKey:["smart-plugs"],queryFn:Ye.getSmartPlugs}),{data:N,isLoading:D}=It({queryKey:["notification-providers"],queryFn:Ye.getNotificationProviders}),{data:F}=It({queryKey:["ffmpeg-status"],queryFn:Ye.checkFfmpeg}),{data:I}=It({queryKey:["version"],queryFn:Ye.getVersion}),{data:W,refetch:O,isRefetching:B}=It({queryKey:["updateCheck"],queryFn:Ye.checkForUpdates,staleTime:300*1e3}),{data:H,refetch:$}=It({queryKey:["updateStatus"],queryFn:Ye.getUpdateStatus,refetchInterval:X=>{const ae=X.state.data;return ae?.status==="downloading"||ae?.status==="installing"?1e3:!1}}),K=Ot({mutationFn:Ye.applyUpdate,onSuccess:()=>{$()}});E.useEffect(()=>{C&&!i&&r(C)},[C,i]),E.useEffect(()=>{if(C&&i){const X=C.auto_archive!==i.auto_archive||C.save_thumbnails!==i.save_thumbnails||C.capture_finish_photo!==i.capture_finish_photo||C.default_filament_cost!==i.default_filament_cost||C.currency!==i.currency||C.energy_cost_per_kwh!==i.energy_cost_per_kwh||C.energy_tracking_mode!==i.energy_tracking_mode||C.check_updates!==i.check_updates||C.notification_language!==i.notification_language||C.ams_humidity_good!==i.ams_humidity_good||C.ams_humidity_fair!==i.ams_humidity_fair||C.ams_temp_good!==i.ams_temp_good||C.ams_temp_fair!==i.ams_temp_fair;s(X)}},[C,i]);const Z=Ot({mutationFn:Ye.updateSettings,onSuccess:X=>{t.setQueryData(["settings"],X),r(X),s(!1),l(!0),setTimeout(()=>l(!1),2e3),t.invalidateQueries({queryKey:["archiveStats"]})}}),se=()=>{i&&Z.mutate(i)},V=(X,ae)=>{i&&r({...i,[X]:ae})};return P||!i?p.jsx("div",{className:"p-8 flex justify-center",children:p.jsx(Yt,{className:"w-8 h-8 text-bambu-green animate-spin"})}):p.jsxs("div",{className:"p-8",children:[p.jsxs("div",{className:"mb-8 flex items-center justify-between",children:[p.jsxs("div",{children:[p.jsx("h1",{className:"text-2xl font-bold text-white",children:"Settings"}),p.jsx("p",{className:"text-bambu-gray",children:"Configure Bambusy"})]}),p.jsxs(st,{onClick:se,disabled:!a||Z.isPending,children:[Z.isPending?p.jsx(Yt,{className:"w-4 h-4 animate-spin"}):o?p.jsx(O0,{className:"w-4 h-4"}):p.jsx(Rx,{className:"w-4 h-4"}),o?"Saved!":"Save"]})]}),Z.isError&&p.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: ",Z.error.message]}),p.jsxs("div",{className:"flex gap-8",children:[p.jsxs("div",{className:"space-y-6 flex-1 max-w-xl",children:[p.jsxs(Zt,{children:[p.jsx(Fo,{children:p.jsx("h2",{className:"text-lg font-semibold text-white",children:"Archive Settings"})}),p.jsxs(cn,{className:"space-y-4",children:[p.jsxs("div",{className:"flex items-center justify-between",children:[p.jsxs("div",{children:[p.jsx("p",{className:"text-white",children:"Auto-archive prints"}),p.jsx("p",{className:"text-sm text-bambu-gray",children:"Automatically save 3MF files when prints complete"})]}),p.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[p.jsx("input",{type:"checkbox",checked:i.auto_archive,onChange:X=>V("auto_archive",X.target.checked),className:"sr-only peer"}),p.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"})]})]}),p.jsxs("div",{className:"flex items-center justify-between",children:[p.jsxs("div",{children:[p.jsx("p",{className:"text-white",children:"Save thumbnails"}),p.jsx("p",{className:"text-sm text-bambu-gray",children:"Extract and save preview images from 3MF files"})]}),p.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[p.jsx("input",{type:"checkbox",checked:i.save_thumbnails,onChange:X=>V("save_thumbnails",X.target.checked),className:"sr-only peer"}),p.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"})]})]}),p.jsxs("div",{className:"flex items-center justify-between",children:[p.jsxs("div",{children:[p.jsx("p",{className:"text-white",children:"Capture finish photo"}),p.jsx("p",{className:"text-sm text-bambu-gray",children:"Take a photo from printer camera when print completes"})]}),p.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[p.jsx("input",{type:"checkbox",checked:i.capture_finish_photo,onChange:X=>V("capture_finish_photo",X.target.checked),className:"sr-only peer"}),p.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"})]})]}),i.capture_finish_photo&&F&&!F.installed&&p.jsxs("div",{className:"flex items-start gap-2 p-3 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",children:[p.jsx(hc,{className:"w-5 h-5 text-yellow-500 flex-shrink-0 mt-0.5"}),p.jsxs("div",{className:"text-sm",children:[p.jsx("p",{className:"text-yellow-500 font-medium",children:"ffmpeg not installed"}),p.jsxs("p",{className:"text-bambu-gray mt-1",children:["Camera capture requires ffmpeg. Install it via"," ",p.jsx("code",{className:"bg-bambu-dark-tertiary px-1 rounded",children:"brew install ffmpeg"})," (macOS) or"," ",p.jsx("code",{className:"bg-bambu-dark-tertiary px-1 rounded",children:"apt install ffmpeg"})," (Linux)."]})]})]})]})]}),p.jsxs(Zt,{children:[p.jsx(Fo,{children:p.jsx("h2",{className:"text-lg font-semibold text-white",children:"Cost Tracking"})}),p.jsxs(cn,{className:"space-y-4",children:[p.jsxs("div",{children:[p.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:"Default filament cost (per kg)"}),p.jsx("input",{type:"number",step:"0.01",min:"0",value:i.default_filament_cost,onChange:X=>V("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"})]}),p.jsxs("div",{children:[p.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:"Currency"}),p.jsxs("select",{value:i.currency,onChange:X=>V("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:[p.jsx("option",{value:"USD",children:"USD ($)"}),p.jsx("option",{value:"EUR",children:"EUR (€)"}),p.jsx("option",{value:"GBP",children:"GBP (£)"}),p.jsx("option",{value:"CHF",children:"CHF (Fr.)"}),p.jsx("option",{value:"JPY",children:"JPY (¥)"}),p.jsx("option",{value:"CNY",children:"CNY (¥)"}),p.jsx("option",{value:"CAD",children:"CAD ($)"}),p.jsx("option",{value:"AUD",children:"AUD ($)"})]})]}),p.jsxs("div",{children:[p.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:"Electricity cost per kWh"}),p.jsx("input",{type:"number",step:"0.01",min:"0",value:i.energy_cost_per_kwh,onChange:X=>V("energy_cost_per_kwh",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"})]}),p.jsxs("div",{children:[p.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:"Energy display mode"}),p.jsxs("select",{value:i.energy_tracking_mode||"total",onChange:X=>V("energy_tracking_mode",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:[p.jsx("option",{value:"print",children:"Prints Only"}),p.jsx("option",{value:"total",children:"Total Consumption"})]}),p.jsx("p",{className:"text-xs text-bambu-gray mt-1",children:i.energy_tracking_mode==="print"?"Dashboard shows sum of energy used during prints":"Dashboard shows lifetime energy from smart plugs"})]})]})]}),p.jsxs(Zt,{children:[p.jsx(Fo,{children:p.jsx("h2",{className:"text-lg font-semibold text-white",children:e("settings.general")})}),p.jsxs(cn,{className:"space-y-4",children:[p.jsxs("div",{children:[p.jsxs("label",{className:"block text-sm text-bambu-gray mb-1",children:[p.jsx(O_,{className:"w-4 h-4 inline mr-1"}),e("settings.language")]}),p.jsx("select",{value:n.language,onChange:X=>n.changeLanguage(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:hj.map(X=>p.jsxs("option",{value:X.code,children:[X.nativeName," (",X.name,")"]},X.code))}),p.jsx("p",{className:"text-xs text-bambu-gray mt-1",children:e("settings.languageDescription")})]}),p.jsxs("div",{children:[p.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:e("settings.defaultView")}),p.jsx("select",{value:x,onChange:X=>w(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:a_.map(X=>p.jsx("option",{value:X.to,children:e(X.labelKey)},X.id))}),p.jsx("p",{className:"text-xs text-bambu-gray mt-1",children:e("settings.defaultViewDescription")})]}),p.jsxs("div",{className:"flex items-center justify-between",children:[p.jsxs("div",{children:[p.jsx("p",{className:"text-white",children:"Sidebar order"}),p.jsx("p",{className:"text-sm text-bambu-gray",children:"Drag items in the sidebar to reorder. Reset to default order here."})]}),p.jsxs(st,{variant:"secondary",size:"sm",onClick:T,children:[p.jsx(VS,{className:"w-4 h-4"}),"Reset"]})]})]})]}),p.jsxs(Zt,{children:[p.jsx(Fo,{children:p.jsx("h2",{className:"text-lg font-semibold text-white",children:"AMS Display Thresholds"})}),p.jsxs(cn,{className:"space-y-4",children:[p.jsx("p",{className:"text-sm text-bambu-gray",children:"Configure color thresholds for AMS humidity and temperature indicators."}),p.jsxs("div",{className:"space-y-3",children:[p.jsxs("div",{className:"flex items-center gap-2 text-white",children:[p.jsx(Jae,{className:"w-4 h-4 text-blue-400"}),p.jsx("span",{className:"font-medium",children:"Humidity"})]}),p.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[p.jsxs("div",{children:[p.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:"Good (green) ≤"}),p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("input",{type:"number",min:"0",max:"100",value:i.ams_humidity_good??40,onChange:X=>V("ams_humidity_good",parseInt(X.target.value)||40),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"}),p.jsx("span",{className:"text-bambu-gray",children:"%"})]})]}),p.jsxs("div",{children:[p.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:"Fair (orange) ≤"}),p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("input",{type:"number",min:"0",max:"100",value:i.ams_humidity_fair??60,onChange:X=>V("ams_humidity_fair",parseInt(X.target.value)||60),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"}),p.jsx("span",{className:"text-bambu-gray",children:"%"})]})]})]}),p.jsx("p",{className:"text-xs text-bambu-gray",children:"Above fair threshold shows as red (bad)"})]}),p.jsxs("div",{className:"space-y-3 pt-2 border-t border-bambu-dark-tertiary",children:[p.jsxs("div",{className:"flex items-center gap-2 text-white",children:[p.jsx(l0,{className:"w-4 h-4 text-orange-400"}),p.jsx("span",{className:"font-medium",children:"Temperature"})]}),p.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[p.jsxs("div",{children:[p.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:"Good (blue) ≤"}),p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("input",{type:"number",step:"0.5",min:"0",max:"60",value:i.ams_temp_good??28,onChange:X=>V("ams_temp_good",parseFloat(X.target.value)||28),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"}),p.jsx("span",{className:"text-bambu-gray",children:"°C"})]})]}),p.jsxs("div",{children:[p.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:"Fair (orange) ≤"}),p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("input",{type:"number",step:"0.5",min:"0",max:"60",value:i.ams_temp_fair??35,onChange:X=>V("ams_temp_fair",parseFloat(X.target.value)||35),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"}),p.jsx("span",{className:"text-bambu-gray",children:"°C"})]})]})]}),p.jsx("p",{className:"text-xs text-bambu-gray",children:"Above fair threshold shows as red (hot)"})]})]})]})]}),p.jsxs("div",{className:"space-y-6 flex-1 max-w-md",children:[p.jsx(GVe,{}),p.jsxs(Zt,{children:[p.jsx(Fo,{children:p.jsx("h2",{className:"text-lg font-semibold text-white",children:"Updates"})}),p.jsxs(cn,{className:"space-y-4",children:[p.jsxs("div",{className:"flex items-center justify-between",children:[p.jsxs("div",{children:[p.jsx("p",{className:"text-white",children:"Check for updates"}),p.jsx("p",{className:"text-sm text-bambu-gray",children:"Automatically check for new versions on startup"})]}),p.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[p.jsx("input",{type:"checkbox",checked:i.check_updates,onChange:X=>V("check_updates",X.target.checked),className:"sr-only peer"}),p.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"})]})]}),p.jsxs("div",{className:"border-t border-bambu-dark-tertiary pt-4",children:[p.jsxs("div",{className:"flex items-center justify-between mb-2",children:[p.jsxs("div",{children:[p.jsx("p",{className:"text-white",children:"Current version"}),p.jsxs("p",{className:"text-sm text-bambu-gray",children:["v",I?.version||"..."]})]}),p.jsxs(st,{variant:"secondary",size:"sm",onClick:()=>O(),disabled:B,children:[B?p.jsx(Yt,{className:"w-4 h-4 animate-spin"}):p.jsx(Zo,{className:"w-4 h-4"}),"Check now"]})]}),W?.update_available?p.jsxs("div",{className:"mt-4 p-3 bg-bambu-green/10 border border-bambu-green/30 rounded-lg",children:[p.jsxs("div",{className:"flex items-start justify-between",children:[p.jsxs("div",{children:[p.jsxs("p",{className:"text-bambu-green font-medium",children:["Update available: v",W.latest_version]}),W.release_name&&W.release_name!==W.latest_version&&p.jsx("p",{className:"text-sm text-bambu-gray mt-1",children:W.release_name}),W.release_notes&&p.jsx("p",{className:"text-sm text-bambu-gray mt-2 whitespace-pre-line line-clamp-3",children:W.release_notes})]}),W.release_url&&p.jsx("a",{href:W.release_url,target:"_blank",rel:"noopener noreferrer",className:"text-bambu-gray hover:text-white transition-colors",title:"View release on GitHub",children:p.jsx(uc,{className:"w-4 h-4"})})]}),H?.status==="downloading"||H?.status==="installing"?p.jsxs("div",{className:"mt-3",children:[p.jsxs("div",{className:"flex items-center gap-2 text-sm text-bambu-gray",children:[p.jsx(Yt,{className:"w-4 h-4 animate-spin"}),p.jsx("span",{children:H.message})]}),p.jsx("div",{className:"mt-2 w-full bg-bambu-dark-tertiary rounded-full h-2",children:p.jsx("div",{className:"bg-bambu-green h-2 rounded-full transition-all duration-300",style:{width:`${H.progress}%`}})})]}):H?.status==="complete"?p.jsx("div",{className:"mt-3 p-2 bg-bambu-green/20 rounded text-sm text-bambu-green",children:H.message}):H?.status==="error"?p.jsx("div",{className:"mt-3 p-2 bg-red-500/20 rounded text-sm text-red-400",children:H.error||H.message}):p.jsxs(st,{className:"mt-3",onClick:()=>K.mutate(),disabled:K.isPending,children:[K.isPending?p.jsx(Yt,{className:"w-4 h-4 animate-spin"}):p.jsx($u,{className:"w-4 h-4"}),"Install Update"]})]}):W?.error?p.jsxs("div",{className:"mt-2 p-2 bg-red-500/10 border border-red-500/30 rounded text-sm text-red-400",children:["Failed to check for updates: ",W.error]}):W&&!W.update_available?p.jsx("p",{className:"mt-2 text-sm text-bambu-gray",children:"You're running the latest version"}):null]})]})]})]}),p.jsx("div",{className:"w-80 flex-shrink-0",children:p.jsxs(Zt,{children:[p.jsx(Fo,{children:p.jsxs("div",{className:"flex items-center justify-between",children:[p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx(SN,{className:"w-5 h-5 text-bambu-green"}),p.jsx("h2",{className:"text-lg font-semibold text-white",children:"Smart Plugs"})]}),p.jsxs(st,{size:"sm",onClick:()=>{m(null),d(!0)},children:[p.jsx(dc,{className:"w-4 h-4"}),"Add"]})]})}),p.jsxs(cn,{children:[p.jsx("p",{className:"text-sm text-bambu-gray mb-4",children:"Connect Tasmota-based smart plugs to automate power control for your printers."}),U?p.jsx("div",{className:"flex justify-center py-8",children:p.jsx(Yt,{className:"w-6 h-6 text-bambu-green animate-spin"})}):A&&A.length>0?p.jsx("div",{className:"space-y-4",children:A.map(X=>p.jsx(jVe,{plug:X,onEdit:ae=>{m(ae),d(!0)}},X.id))}):p.jsxs("div",{className:"text-center py-8 text-bambu-gray",children:[p.jsx(SN,{className:"w-12 h-12 mx-auto mb-3 opacity-30"}),p.jsx("p",{children:"No smart plugs configured"}),p.jsx("p",{className:"text-sm mt-1",children:"Add a Tasmota plug to get started"})]})]})]})}),p.jsx("div",{className:"w-80 flex-shrink-0",children:p.jsxs(Zt,{children:[p.jsx(Fo,{children:p.jsxs("div",{className:"flex items-center justify-between",children:[p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx(vN,{className:"w-5 h-5 text-bambu-green"}),p.jsx("h2",{className:"text-lg font-semibold text-white",children:"Notifications"})]}),p.jsxs(st,{size:"sm",onClick:()=>{v(null),y(!0)},children:[p.jsx(dc,{className:"w-4 h-4"}),"Add"]})]})}),p.jsxs(cn,{children:[p.jsx("p",{className:"text-sm text-bambu-gray mb-4",children:"Get notified about print events via WhatsApp, Telegram, Email, and more."}),p.jsxs("div",{className:"flex items-center justify-between py-3 border-b border-bambu-dark-tertiary mb-4",children:[p.jsxs("div",{children:[p.jsx("p",{className:"text-white",children:e("settings.notificationLanguage")}),p.jsx("p",{className:"text-sm text-bambu-gray",children:e("settings.notificationLanguageDescription")})]}),p.jsx("select",{value:i.notification_language||"en",onChange:X=>V("notification_language",X.target.value),className:"px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:outline-none focus:ring-2 focus:ring-bambu-green",children:hj.map(X=>p.jsx("option",{value:X.code,children:X.nativeName},X.code))})]}),D?p.jsx("div",{className:"flex justify-center py-8",children:p.jsx(Yt,{className:"w-6 h-6 text-bambu-green animate-spin"})}):N&&N.length>0?p.jsx("div",{className:"space-y-4",children:N.map(X=>p.jsx(BVe,{provider:X,onEdit:ae=>{v(ae),y(!0)}},X.id))}):p.jsxs("div",{className:"text-center py-8 text-bambu-gray",children:[p.jsx(vN,{className:"w-12 h-12 mx-auto mb-3 opacity-30"}),p.jsx("p",{children:"No notification providers configured"}),p.jsx("p",{className:"text-sm mt-1",children:"Add a provider to get started"})]})]})]})})]}),c&&p.jsx(FVe,{plug:f,onClose:()=>{d(!1),m(null)}}),g&&p.jsx(HVe,{provider:_,onClose:()=>{y(!1),v(null)}})]})}const IJ=t=>{const e=parseFloat(t);return(Math.trunc(e*1e3)/1e3).toFixed(3)},qVe=t=>t.startsWith("HH")?"HF":"S",XVe=t=>{const e=t.match(/^([A-Z]{2}\d{2})/);return e?e[1]:"HH00"},UJ=t=>{const e=["High Flow_","High Flow ","Standard_","Standard ","HF_","HF ","S_","S "];for(const i of e)if(t.startsWith(i))return t.slice(i.length);const n=t.indexOf("_");return n>0?t.slice(n+1):t};function iN({profile:t,onEdit:e}){const n=qVe(t.nozzle_id),i=t.nozzle_diameter,r=t.name||"Unnamed",a=UJ(t.name||"");return p.jsxs("button",{onClick:e,className:"w-full text-left px-3 py-2 bg-bambu-dark rounded hover:bg-bambu-dark-tertiary transition-colors",children:[p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("span",{className:"text-bambu-green font-mono text-sm font-bold whitespace-nowrap",children:IJ(t.k_value)}),p.jsx("span",{className:"text-white text-sm truncate flex-1",title:r,children:r}),p.jsxs("span",{className:"text-xs text-bambu-gray whitespace-nowrap",children:[n," ",i]})]}),p.jsxs("div",{className:"text-xs text-bambu-gray mt-0.5 truncate",title:`Filament: ${a}`,children:["Filament: ",a||t.filament_id]})]})}function J$({profile:t,printerId:e,nozzleDiameter:n,existingProfiles:i=[],isDualNozzle:r=!1,onClose:a,onSave:s}){const{showToast:o}=Mo(),l=Jn(),[c,d]=E.useState(t?.name||""),[f,m]=E.useState(t?.k_value?IJ(t.k_value):"0.020"),[g,y]=E.useState(t?.filament_id||""),[_,v]=E.useState(t?.nozzle_id?XVe(t.nozzle_id):"HH00"),[x,M]=E.useState(t?.nozzle_diameter||n),[w,T]=E.useState(t?[t.extruder_id]:r?[0,1]:[0]),[C,P]=E.useState(!1),[A,U]=E.useState({current:0,total:0}),N=ui.useMemo(()=>{const H=new Map;for(const $ of i)if($.filament_id&&!H.has($.filament_id)){const K=UJ($.name||"");H.set($.filament_id,{id:$.filament_id,name:K||$.filament_id})}return Array.from(H.values()).sort(($,K)=>$.name.localeCompare(K.name))},[i]),D=Ot({mutationFn:H=>(console.log("[KProfile] Calling API..."),Ye.setKProfile(e,H)),onSuccess:H=>{console.log("[KProfile] Save success:",H),o("K-profile saved"),P(!0),setTimeout(()=>{l.invalidateQueries({queryKey:["kprofiles",e]}),P(!1),s()},2500)},onError:H=>{console.error("[KProfile] Save error:",H),o(H.message,"error"),P(!1)}}),F=Ot({mutationFn:H=>(console.log("[KProfile] Deleting profile..."),Ye.deleteKProfile(e,H)),onSuccess:H=>{console.log("[KProfile] Delete success:",H),o("K-profile deleted"),P(!0),setTimeout(()=>{l.invalidateQueries({queryKey:["kprofiles",e]}),P(!1),a()},2500)},onError:H=>{console.error("[KProfile] Delete error:",H),o(H.message,"error"),P(!1)}}),[I,W]=E.useState(!1),O=()=>{t&&F.mutate({slot_id:t.slot_id,extruder_id:t.extruder_id,nozzle_id:t.nozzle_id,nozzle_diameter:t.nozzle_diameter,filament_id:t.filament_id,setting_id:t.setting_id})},B=async H=>{if(H.preventDefault(),r&&!t&&w.length===0){o("Please select at least one extruder","error");return}const $=parseFloat(f).toFixed(6),K=`${_}-${x}`;if(t||w.length===1){const Z={name:c,k_value:$,filament_id:g,nozzle_id:K,nozzle_diameter:x,extruder_id:t?t.extruder_id:w[0],setting_id:t?.setting_id,slot_id:t?.slot_id??0};console.log("[KProfile] Saving profile:",Z),D.mutate(Z);return}P(!0),U({current:0,total:w.length});for(let Z=0;Z<w.length;Z++){const se=w[Z],V={name:c,k_value:$,filament_id:g,nozzle_id:K,nozzle_diameter:x,extruder_id:se,setting_id:void 0,slot_id:0};U({current:Z+1,total:w.length}),console.log(`[KProfile] Saving profile ${Z+1}/${w.length} for extruder ${se}:`,V);try{await Ye.setKProfile(e,V),Z<w.length-1&&await new Promise(X=>setTimeout(X,1500))}catch(X){console.error(`[KProfile] Failed to save for extruder ${se}:`,X),o(`Failed to save for ${se===1?"Left":"Right"} extruder`,"error"),P(!1),U({current:0,total:0});return}}o(`K-profile saved to ${w.length} extruders`),setTimeout(()=>{l.invalidateQueries({queryKey:["kprofiles",e]}),P(!1),U({current:0,total:0}),s()},2500)};return p.jsxs("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4",children:[p.jsxs(Zt,{className:"w-full max-w-md relative",children:[C&&p.jsxs("div",{className:"absolute inset-0 bg-bambu-dark-secondary/90 flex flex-col items-center justify-center z-10 rounded-lg",children:[p.jsx(Yt,{className:"w-8 h-8 text-bambu-green animate-spin mb-3"}),p.jsx("p",{className:"text-white font-medium",children:A.total>1?`Saving to extruder ${A.current}/${A.total}...`:"Syncing with printer..."}),p.jsx("p",{className:"text-bambu-gray text-sm mt-1",children:"Please wait"})]}),p.jsxs(cn,{className:"p-0",children:[p.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-bambu-dark-tertiary",children:[p.jsx("h2",{className:"text-xl font-semibold text-white",children:t?"Edit K-Profile":"Add K-Profile"}),p.jsx("button",{onClick:a,className:"text-bambu-gray hover:text-white transition-colors",disabled:C,children:p.jsx(Cn,{className:"w-5 h-5"})})]}),p.jsxs("form",{onSubmit:B,className:"p-4 space-y-4",children:[p.jsxs("div",{children:[p.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:"Profile Name"}),p.jsx("input",{type:"text",value:c,onChange:H=>d(H.target.value),disabled:!!t,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 ${t?"opacity-60 cursor-not-allowed":""}`,placeholder:"My PLA Profile",required:!t})]}),p.jsxs("div",{children:[p.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:"K-Value"}),p.jsx("input",{type:"text",inputMode:"decimal",value:f,onChange:H=>{const $=H.target.value;($===""||/^\d*\.?\d*$/.test($))&&m($)},onBlur:H=>{const $=parseFloat(H.target.value);isNaN($)||m((Math.trunc($*1e3)/1e3).toFixed(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 font-mono",placeholder:"0.020",required:!0}),p.jsx("p",{className:"text-xs text-bambu-gray mt-1",children:"Typical range: 0.01 - 0.06 for PLA, 0.02 - 0.10 for PETG"})]}),p.jsxs("div",{children:[p.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:"Filament"}),p.jsxs("select",{value:g,onChange:H=>{const $=H.target.value;if(y($),!t&&$&&!c){const K=N.find(Z=>Z.id===$);K&&d(`${_==="HH00"?"HF":"S"} ${K.name}`)}},disabled:!!t,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 ${t?"opacity-60 cursor-not-allowed":""}`,required:!t,children:[p.jsx("option",{value:"",children:"Select filament..."}),t?.filament_id&&p.jsx("option",{value:t.filament_id,children:N.find(H=>H.id===t.filament_id)?.name||t.filament_id},t.filament_id),!t&&N.map(H=>p.jsx("option",{value:H.id,children:H.name},H.id))]}),!t&&N.length===0&&p.jsx("p",{className:"text-xs text-bambu-gray mt-1",children:"No filaments found. Create a K-profile in Bambu Studio first."})]}),p.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[p.jsxs("div",{children:[p.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:"Flow Type"}),p.jsxs("select",{value:_,onChange:H=>{const $=H.target.value;if(v($),!t&&g&&!c){const K=N.find(Z=>Z.id===g);K&&d(`${$==="HH00"?"HF":"S"} ${K.name}`)}},disabled:!!t,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 ${t?"opacity-60 cursor-not-allowed":""}`,children:[p.jsx("option",{value:"HH00",children:"High Flow"}),p.jsx("option",{value:"HS00",children:"Standard"})]})]}),p.jsxs("div",{children:[p.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:"Nozzle Size"}),p.jsxs("select",{value:x,onChange:H=>M(H.target.value),disabled:!!t,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 ${t?"opacity-60 cursor-not-allowed":""}`,children:[p.jsx("option",{value:"0.2",children:"0.2mm"}),p.jsx("option",{value:"0.4",children:"0.4mm"}),p.jsx("option",{value:"0.6",children:"0.6mm"}),p.jsx("option",{value:"0.8",children:"0.8mm"})]})]})]}),r&&p.jsxs("div",{children:[p.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:t?"Extruder":"Extruders"}),t?p.jsx("div",{className:"px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white opacity-60",children:t.extruder_id===1?"Left":"Right"}):p.jsxs("div",{className:"flex gap-4",children:[p.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[p.jsx("input",{type:"checkbox",checked:w.includes(1),onChange:H=>{H.target.checked?T([...w,1]):T(w.filter($=>$!==1))},className:"w-4 h-4 rounded border-bambu-dark-tertiary bg-bambu-dark text-bambu-green focus:ring-bambu-green focus:ring-offset-0 accent-bambu-green"}),p.jsx("span",{className:"text-white",children:"Left"})]}),p.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[p.jsx("input",{type:"checkbox",checked:w.includes(0),onChange:H=>{H.target.checked?T([...w,0]):T(w.filter($=>$!==0))},className:"w-4 h-4 rounded border-bambu-dark-tertiary bg-bambu-dark text-bambu-green focus:ring-bambu-green focus:ring-offset-0 accent-bambu-green"}),p.jsx("span",{className:"text-white",children:"Right"})]})]})]}),p.jsxs("div",{className:"flex gap-2 pt-4",children:[t&&p.jsx(st,{type:"button",variant:"secondary",onClick:()=>W(!0),disabled:F.isPending||C,className:"text-red-500 hover:bg-red-500/10",children:F.isPending?p.jsx(Yt,{className:"w-4 h-4 animate-spin"}):p.jsx(na,{className:"w-4 h-4"})}),p.jsx(st,{type:"button",variant:"secondary",onClick:a,disabled:C,className:"flex-1",children:"Cancel"}),p.jsxs(st,{type:"submit",disabled:D.isPending||C,className:"flex-1",children:[D.isPending?p.jsx(Yt,{className:"w-4 h-4 animate-spin"}):p.jsx(TP,{className:"w-4 h-4"}),"Save"]})]})]})]})]}),I&&p.jsx("div",{className:"fixed inset-0 bg-black/70 flex items-center justify-center z-[60]",children:p.jsx(Zt,{className:"w-full max-w-sm",children:p.jsxs(cn,{className:"p-6",children:[p.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[p.jsx("div",{className:"w-10 h-10 rounded-full bg-red-500/20 flex items-center justify-center",children:p.jsx(na,{className:"w-5 h-5 text-red-500"})}),p.jsxs("div",{children:[p.jsx("h3",{className:"text-lg font-semibold text-white",children:"Delete Profile"}),p.jsx("p",{className:"text-sm text-bambu-gray",children:"This cannot be undone"})]})]}),p.jsxs("p",{className:"text-bambu-gray mb-6",children:["Are you sure you want to delete ",p.jsxs("span",{className:"text-white font-medium",children:['"',t?.name,'"']})," from the printer?"]}),p.jsxs("div",{className:"flex gap-3",children:[p.jsx(st,{variant:"secondary",onClick:()=>W(!1),className:"flex-1",children:"Cancel"}),p.jsxs(st,{onClick:()=>{W(!1),O()},disabled:F.isPending,className:"flex-1 bg-red-500 hover:bg-red-600 text-white",children:[F.isPending?p.jsx(Yt,{className:"w-4 h-4 animate-spin"}):p.jsx(na,{className:"w-4 h-4"}),"Delete"]})]})]})})})]})}function KVe(){const[t,e]=E.useState(null),[n,i]=E.useState("0.4"),[r,a]=E.useState(null),[s,o]=E.useState(!1),[l,c]=E.useState(""),[d,f]=E.useState("all"),[m,g]=E.useState("all"),{data:y,isLoading:_}=It({queryKey:["printers"],queryFn:Ye.getPrinters}),{data:v,isLoading:x,error:M,refetch:w}=It({queryKey:["kprofiles",t,n],queryFn:()=>Ye.getKProfiles(t,n),enabled:!!t,retry:!1,staleTime:0,refetchOnMount:"always"}),T=M?.message?.includes("not connected");E.useEffect(()=>{if(!t&&y&&y.length>0){const N=y.find(D=>D.is_active);N&&e(N.id)}},[t,y]),E.useEffect(()=>{if(t){const N=setTimeout(()=>{w()},150);return()=>clearTimeout(N)}},[t,n]);const C=y?.filter(N=>N.is_active)||[],P=ui.useMemo(()=>v?.profiles?v.profiles.filter(N=>{const D=l.toLowerCase(),F=!D||N.name.toLowerCase().includes(D)||N.filament_id.toLowerCase().includes(D),I=d==="all"||d==="left"&&N.extruder_id===1||d==="right"&&N.extruder_id===0,W=m==="all"||m==="hf"&&N.nozzle_id.startsWith("HH")||m==="s"&&N.nozzle_id.startsWith("HS");return F&&I&&W}):[],[v?.profiles,l,d,m]),U=y?.find(N=>N.id===t)?.nozzle_count===2;return _?p.jsx("div",{className:"flex justify-center py-12",children:p.jsx(Yt,{className:"w-8 h-8 text-bambu-green animate-spin"})}):!y||y.length===0?p.jsx(Zt,{children:p.jsxs(cn,{className:"py-12 text-center",children:[p.jsx(id,{className:"w-12 h-12 text-bambu-gray mx-auto mb-4"}),p.jsx("h3",{className:"text-lg font-semibold text-white mb-2",children:"No Printers Configured"}),p.jsx("p",{className:"text-bambu-gray",children:"Add a printer in Settings to manage K-profiles"})]})}):C.length===0?p.jsx(Zt,{children:p.jsxs(cn,{className:"py-12 text-center",children:[p.jsx(fc,{className:"w-12 h-12 text-bambu-gray mx-auto mb-4"}),p.jsx("h3",{className:"text-lg font-semibold text-white mb-2",children:"No Active Printers"}),p.jsx("p",{className:"text-bambu-gray",children:"Enable a printer connection to view its K-profiles"})]})}):p.jsxs(p.Fragment,{children:[p.jsxs("div",{className:"flex flex-wrap gap-4 mb-6",children:[p.jsxs("div",{className:"flex-1 min-w-48",children:[p.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:"Printer"}),p.jsx("select",{value:t||"",onChange:N=>e(parseInt(N.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:C.map(N=>p.jsx("option",{value:N.id,children:N.name},N.id))})]}),p.jsxs("div",{className:"w-32",children:[p.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:"Nozzle"}),p.jsxs("select",{value:n,onChange:N=>i(N.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:[p.jsx("option",{value:"0.2",children:"0.2mm"}),p.jsx("option",{value:"0.4",children:"0.4mm"}),p.jsx("option",{value:"0.6",children:"0.6mm"}),p.jsx("option",{value:"0.8",children:"0.8mm"})]})]}),p.jsxs("div",{className:"flex items-end gap-2",children:[p.jsxs(st,{variant:"secondary",onClick:()=>w(),disabled:x,children:[p.jsx(Zo,{className:`w-4 h-4 ${x?"animate-spin":""}`}),"Refresh"]}),p.jsxs(st,{onClick:()=>o(!0),children:[p.jsx(dc,{className:"w-4 h-4"}),"Add Profile"]})]})]}),p.jsxs("div",{className:"flex flex-wrap gap-4 mb-6",children:[p.jsxs("div",{className:"flex-1 min-w-48 relative",children:[p.jsx(L0,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray"}),p.jsx("input",{type:"text",value:l,onChange:N=>c(N.target.value),placeholder:"Search by name or filament...",className:"w-full pl-10 pr-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white placeholder-bambu-gray focus:border-bambu-green focus:outline-none"})]}),U&&p.jsx("div",{className:"w-36",children:p.jsxs("select",{value:d,onChange:N=>f(N.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:[p.jsx("option",{value:"all",children:"All Extruders"}),p.jsx("option",{value:"left",children:"Left Only"}),p.jsx("option",{value:"right",children:"Right Only"})]})}),p.jsx("div",{className:"w-32",children:p.jsxs("select",{value:m,onChange:N=>g(N.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:[p.jsx("option",{value:"all",children:"All Flow"}),p.jsx("option",{value:"hf",children:"HF Only"}),p.jsx("option",{value:"s",children:"S Only"})]})})]}),x?p.jsx("div",{className:"flex justify-center py-12",children:p.jsx(Yt,{className:"w-8 h-8 text-bambu-green animate-spin"})}):T?p.jsx(Zt,{children:p.jsxs(cn,{className:"py-12 text-center",children:[p.jsx(PP,{className:"w-12 h-12 text-bambu-gray mx-auto mb-4"}),p.jsx("h3",{className:"text-lg font-semibold text-white mb-2",children:"Printer Offline"}),p.jsx("p",{className:"text-bambu-gray mb-4",children:"The selected printer is not connected. Power it on to view K-profiles."}),p.jsxs(st,{variant:"secondary",onClick:()=>w(),children:[p.jsx(Zo,{className:"w-4 h-4"}),"Retry"]})]})}):P.length>0?U?p.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[p.jsxs("div",{children:[p.jsx("h3",{className:"text-sm font-medium text-bambu-gray mb-2 px-1",children:"Left Extruder"}),p.jsx("div",{className:"space-y-1",children:P.filter(N=>N.extruder_id===1).map(N=>p.jsx(iN,{profile:N,onEdit:()=>a(N)},N.slot_id))})]}),p.jsxs("div",{children:[p.jsx("h3",{className:"text-sm font-medium text-bambu-gray mb-2 px-1",children:"Right Extruder"}),p.jsx("div",{className:"space-y-1",children:P.filter(N=>N.extruder_id===0).map(N=>p.jsx(iN,{profile:N,onEdit:()=>a(N)},N.slot_id))})]})]}):p.jsx("div",{className:"space-y-1",children:P.map(N=>p.jsx(iN,{profile:N,onEdit:()=>a(N)},N.slot_id))}):l||d!=="all"||m!=="all"?p.jsx(Zt,{children:p.jsxs(cn,{className:"py-12 text-center",children:[p.jsx(L0,{className:"w-12 h-12 text-bambu-gray mx-auto mb-4"}),p.jsx("h3",{className:"text-lg font-semibold text-white mb-2",children:"No Matching Profiles"}),p.jsx("p",{className:"text-bambu-gray",children:"No profiles match your search criteria"})]})}):p.jsx(Zt,{children:p.jsxs(cn,{className:"py-12 text-center",children:[p.jsx(TP,{className:"w-12 h-12 text-bambu-gray mx-auto mb-4"}),p.jsx("h3",{className:"text-lg font-semibold text-white mb-2",children:"No K-Profiles"}),p.jsxs("p",{className:"text-bambu-gray mb-4",children:["No pressure advance profiles found for ",n,"mm nozzle"]}),p.jsxs(st,{onClick:()=>o(!0),children:[p.jsx(dc,{className:"w-4 h-4"}),"Create First Profile"]})]})}),r&&t&&p.jsx(J$,{profile:r,printerId:t,nozzleDiameter:n,existingProfiles:v?.profiles,isDualNozzle:U,onClose:()=>a(null),onSave:()=>a(null)}),s&&t&&p.jsx(J$,{printerId:t,nozzleDiameter:n,existingProfiles:v?.profiles,isDualNozzle:U,onClose:()=>o(!1),onSave:()=>o(!1)})]})}function YVe({onSuccess:t}){const{showToast:e}=Mo(),[n,i]=E.useState("email"),[r,a]=E.useState(""),[s,o]=E.useState(""),[l,c]=E.useState(""),[d,f]=E.useState(""),[m,g]=E.useState("global"),y=Ot({mutationFn:()=>Ye.cloudLogin(r,s,m),onSuccess:w=>{w.success?(e("Logged in successfully"),t()):w.needs_verification?(e("Verification code sent to your email"),i("code")):e(w.message,"error")},onError:w=>{e(w.message,"error")}}),_=Ot({mutationFn:()=>Ye.cloudVerify(r,l),onSuccess:w=>{w.success?(e("Logged in successfully"),t()):e(w.message,"error")},onError:w=>{e(w.message,"error")}}),v=Ot({mutationFn:()=>Ye.cloudSetToken(d),onSuccess:()=>{e("Token set successfully"),t()},onError:w=>{e(w.message,"error")}}),x=w=>{w.preventDefault(),n==="email"?y.mutate():n==="code"?_.mutate():n==="token"&&v.mutate()},M=y.isPending||_.isPending||v.isPending;return p.jsxs(Zt,{className:"max-w-md mx-auto",children:[p.jsx(Fo,{children:p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx(AP,{className:"w-5 h-5 text-bambu-green"}),p.jsx("h2",{className:"text-xl font-semibold text-white",children:"Connect to Bambu Cloud"})]})}),p.jsx(cn,{children:p.jsxs("form",{onSubmit:x,className:"space-y-4",children:[n==="email"&&p.jsxs(p.Fragment,{children:[p.jsxs("div",{children:[p.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:"Email"}),p.jsx("input",{type:"email",value:r,onChange:w=>a(w.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})]}),p.jsxs("div",{children:[p.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:"Password"}),p.jsx("input",{type:"password",value:s,onChange:w=>o(w.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})]}),p.jsxs("div",{children:[p.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:"Region"}),p.jsxs("select",{value:m,onChange:w=>g(w.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:[p.jsx("option",{value:"global",children:"Global"}),p.jsx("option",{value:"china",children:"China"})]})]})]}),n==="code"&&p.jsxs("div",{children:[p.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:"Verification Code"}),p.jsxs("p",{className:"text-xs text-bambu-gray mb-2",children:["Check your email (",r,") for a 6-digit code"]}),p.jsx("input",{type:"text",value:l,onChange:w=>c(w.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"&&p.jsxs("div",{children:[p.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:"Access Token"}),p.jsx("p",{className:"text-xs text-bambu-gray mb-2",children:"Paste your Bambu Lab access token (from Bambu Studio)"}),p.jsx("textarea",{value:d,onChange:w=>f(w.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})]}),p.jsxs("div",{className:"flex gap-2",children:[n==="code"&&p.jsx(st,{type:"button",variant:"secondary",onClick:()=>i("email"),className:"flex-1",children:"Back"}),p.jsxs(st,{type:"submit",disabled:M,className:"flex-1",children:[M?p.jsx(Yt,{className:"w-4 h-4 animate-spin"}):p.jsx(jj,{className:"w-4 h-4"}),n==="email"?"Login":n==="code"?"Verify":"Set Token"]})]}),n==="email"&&p.jsx("div",{className:"pt-4 border-t border-bambu-dark-tertiary",children:p.jsxs("button",{type:"button",onClick:()=>i("token"),className:"text-sm text-bambu-gray hover:text-white flex items-center gap-1",children:[p.jsx(Dse,{className:"w-3 h-3"}),"Use access token instead"]})}),n==="token"&&p.jsx("div",{className:"pt-4 border-t border-bambu-dark-tertiary",children:p.jsxs("button",{type:"button",onClick:()=>i("email"),className:"text-sm text-bambu-gray hover:text-white flex items-center gap-1",children:[p.jsx(jj,{className:"w-3 h-3"}),"Login with email instead"]})})]})})]})}function ZVe({setting:t,onClick:e}){return p.jsxs("button",{onClick:e,className:"w-full text-left p-3 bg-bambu-dark rounded-lg hover:bg-bambu-dark-tertiary transition-colors",children:[p.jsx("p",{className:"text-white font-medium truncate",children:t.name}),t.updated_time&&p.jsxs("p",{className:"text-xs text-bambu-gray mt-1",children:["Updated: ",new Date(t.updated_time).toLocaleDateString()]})]})}function QVe({setting:t,onClose:e}){const{data:n,isLoading:i}=It({queryKey:["cloudSettingDetail",t.setting_id],queryFn:()=>Ye.getCloudSettingDetail(t.setting_id)});return p.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4",children:p.jsx(Zt,{className:"w-full max-w-2xl max-h-[90vh] flex flex-col",children:p.jsxs(cn,{className:"p-0 flex flex-col h-full",children:[p.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-bambu-dark-tertiary",children:[p.jsxs("div",{children:[p.jsx("h2",{className:"text-xl font-semibold text-white",children:t.name}),p.jsxs("p",{className:"text-sm text-bambu-gray capitalize",children:[t.type," preset"]})]}),p.jsx("button",{onClick:e,className:"text-bambu-gray hover:text-white transition-colors",children:p.jsx(Cn,{className:"w-5 h-5"})})]}),p.jsx("div",{className:"flex-1 overflow-y-auto p-4",children:i?p.jsx("div",{className:"flex justify-center py-8",children:p.jsx(Yt,{className:"w-8 h-8 text-bambu-green animate-spin"})}):n?p.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)}):p.jsx("p",{className:"text-bambu-gray text-center py-8",children:"Failed to load preset details"})}),p.jsx("div",{className:"p-4 border-t border-bambu-dark-tertiary",children:p.jsx(st,{variant:"secondary",onClick:e,className:"w-full",children:"Close"})})]})})})}function JVe({settings:t}){const[e,n]=E.useState(new Set),[i,r]=E.useState(null),a=l=>[...l].sort((c,d)=>c.name.localeCompare(d.name)),s=l=>{n(c=>{const d=new Set(c);return d.has(l)?d.delete(l):d.add(l),d})},o=[{key:"filament",label:"Filament Presets",icon:BG,items:a(t.filament)},{key:"printer",label:"Printer Presets",icon:fc,items:a(t.printer)},{key:"process",label:"Process Presets",icon:RP,items:a(t.process)}];return p.jsxs(p.Fragment,{children:[p.jsx("div",{className:"space-y-4",children:o.map(({key:l,label:c,icon:d,items:f})=>p.jsxs(Zt,{children:[p.jsxs("button",{onClick:()=>s(l),className:"w-full flex items-center justify-between p-4",children:[p.jsxs("div",{className:"flex items-center gap-3",children:[p.jsx(d,{className:"w-5 h-5 text-bambu-green"}),p.jsx("span",{className:"text-lg font-semibold text-white",children:c}),p.jsxs("span",{className:"text-sm text-bambu-gray",children:["(",f.length,")"]})]}),e.has(l)?p.jsx(Cx,{className:"w-5 h-5 text-bambu-gray"}):p.jsx(zf,{className:"w-5 h-5 text-bambu-gray"})]}),e.has(l)&&f.length>0&&p.jsx(cn,{className:"pt-0",children:p.jsx("div",{className:"grid gap-2 sm:grid-cols-2 lg:grid-cols-3",children:f.map(m=>p.jsx(ZVe,{setting:m,onClick:()=>r(m)},m.setting_id))})}),e.has(l)&&f.length===0&&p.jsx(cn,{className:"pt-0",children:p.jsx("p",{className:"text-bambu-gray text-sm",children:"No presets found"})})]},l))}),i&&p.jsx(QVe,{setting:i,onClose:()=>r(null)})]})}function e$e(){const t=Jn(),{showToast:e}=Mo(),[n,i]=E.useState("kprofiles"),{data:r,isLoading:a}=It({queryKey:["cloudStatus"],queryFn:Ye.getCloudStatus}),{data:s,isLoading:o,refetch:l}=It({queryKey:["cloudSettings"],queryFn:()=>Ye.getCloudSettings(),enabled:!!r?.is_authenticated,retry:!1,staleTime:1e3*60*5}),c=Ot({mutationFn:Ye.cloudLogout,onSuccess:()=>{t.invalidateQueries({queryKey:["cloudStatus"]}),t.removeQueries({queryKey:["cloudSettings"]}),e("Logged out")}}),d=()=>{t.invalidateQueries({queryKey:["cloudStatus"]})};return a?p.jsx("div",{className:"p-8 flex justify-center",children:p.jsx(Yt,{className:"w-8 h-8 text-bambu-green animate-spin"})}):p.jsxs("div",{className:"p-8",children:[p.jsxs("div",{className:"mb-6",children:[p.jsx("h1",{className:"text-2xl font-bold text-white",children:"Profiles"}),p.jsx("p",{className:"text-bambu-gray",children:"Manage your slicer presets and pressure advance calibrations"})]}),p.jsxs("div",{className:"flex border-b border-bambu-dark-tertiary mb-6",children:[p.jsxs("button",{onClick:()=>i("cloud"),className:`flex items-center gap-2 px-4 py-3 text-sm font-medium transition-colors border-b-2 -mb-px ${n==="cloud"?"text-bambu-green border-bambu-green":"text-bambu-gray hover:text-white border-transparent"}`,children:[p.jsx(AP,{className:"w-4 h-4"}),"Cloud Profiles"]}),p.jsxs("button",{onClick:()=>i("kprofiles"),className:`flex items-center gap-2 px-4 py-3 text-sm font-medium transition-colors border-b-2 -mb-px ${n==="kprofiles"?"text-bambu-green border-bambu-green":"text-bambu-gray hover:text-white border-transparent"}`,children:[p.jsx(TP,{className:"w-4 h-4"}),"K-Profiles"]})]}),n==="cloud"&&p.jsxs(p.Fragment,{children:[p.jsxs("div",{className:"mb-6 flex items-center justify-between",children:[p.jsx("p",{className:"text-bambu-gray",children:r?.is_authenticated?`Connected as ${r.email}`:"Connect to Bambu Cloud to access your slicer presets"}),r?.is_authenticated&&p.jsxs("div",{className:"flex gap-2",children:[p.jsxs(st,{variant:"secondary",onClick:()=>l(),disabled:o,children:[p.jsx(Zo,{className:`w-4 h-4 ${o?"animate-spin":""}`}),"Refresh"]}),p.jsxs(st,{variant:"secondary",onClick:()=>c.mutate(),disabled:c.isPending,children:[p.jsx(Kse,{className:"w-4 h-4"}),"Logout"]})]})]}),r?.is_authenticated?o?p.jsx("div",{className:"flex justify-center py-12",children:p.jsx(Yt,{className:"w-8 h-8 text-bambu-green animate-spin"})}):s?p.jsx(JVe,{settings:s}):p.jsx(Zt,{children:p.jsxs(cn,{className:"py-8 text-center",children:[p.jsx("p",{className:"text-bambu-gray",children:"Failed to load profiles"}),p.jsx(st,{className:"mt-4",onClick:()=>l(),children:"Retry"})]})}):p.jsx(YVe,{onSuccess:d})]}),n==="kprofiles"&&p.jsx(KVe,{})]})}const hP={Droplet:BG,Flame:mse,Ruler:Soe,Sparkles:Uoe,Square:I0,Cable:Eae,Wrench:Ip};function A_(t){return t&&hP[t]||Ip}function N0(t){return t<1?`${Math.round(t*60)}m`:`${t.toFixed(1)}h`}function t$e(t){const e=Math.floor(t),n=Math.round((t-e)*60);return e===0?`${n} minutes`:n===0?`${e} hours`:`${e}h ${n}m`}function n$e({item:t,onPerform:e,onToggle:n}){const i=A_(t.maintenance_type_icon),r=Math.max(0,Math.min(100,(t.interval_hours-t.hours_until_due)/t.interval_hours*100)),a=()=>t.enabled?t.is_due?"text-red-400":t.is_warning?"text-yellow-400":"text-bambu-green":"text-bambu-gray",s=()=>t.enabled?t.is_due?"bg-red-500":t.is_warning?"bg-yellow-500":"bg-bambu-green":"bg-bambu-gray/30",o=()=>t.enabled?t.is_due?`Overdue by ${N0(Math.abs(t.hours_until_due))}`:t.is_warning?`Due in ${N0(t.hours_until_due)}`:`${N0(t.hours_until_due)} left`:"Disabled";return p.jsxs("div",{className:`flex items-center gap-4 p-3 rounded-lg ${t.is_due?"bg-red-500/10":t.is_warning?"bg-yellow-500/10":"bg-bambu-dark"}`,children:[p.jsxs("div",{className:"flex items-center gap-3 min-w-[180px]",children:[p.jsx(i,{className:`w-4 h-4 ${a()}`}),p.jsx("span",{className:`text-sm ${t.enabled?"text-white":"text-bambu-gray"}`,children:t.maintenance_type_name})]}),p.jsx("div",{className:"flex-1 max-w-[200px]",children:p.jsx("div",{className:"w-full h-1.5 bg-bambu-dark-tertiary rounded-full overflow-hidden",children:p.jsx("div",{className:`h-full transition-all ${s()}`,style:{width:`${r}%`}})})}),p.jsxs("div",{className:`text-xs min-w-[120px] ${a()}`,children:[t.is_due&&p.jsx(hc,{className:"w-3 h-3 inline mr-1"}),t.is_warning&&p.jsx(xa,{className:"w-3 h-3 inline mr-1"}),!t.is_due&&!t.is_warning&&t.enabled&&p.jsx(O0,{className:"w-3 h-3 inline mr-1"}),o()]}),p.jsx(ns,{checked:t.enabled,onChange:l=>n(t.id,l)}),p.jsxs(st,{size:"sm",variant:t.is_due?"primary":"secondary",onClick:()=>e(t.id),disabled:!t.enabled,className:"min-w-[70px]",children:[p.jsx(VS,{className:"w-3 h-3"}),"Done"]})]})}function i$e({overview:t,onPerform:e,onToggle:n,onSetHours:i}){const[r,a]=E.useState(!1),[s,o]=E.useState(!1),[l,c]=E.useState(t.total_print_hours.toFixed(1)),d=[...t.maintenance_items].sort((g,y)=>g.maintenance_type_id-y.maintenance_type_id),f=[...t.maintenance_items].filter(g=>g.enabled).sort((g,y)=>g.is_due&&!y.is_due?-1:!g.is_due&&y.is_due?1:g.is_warning&&!y.is_warning?-1:!g.is_warning&&y.is_warning?1:g.hours_until_due-y.hours_until_due)[0],m=()=>{const g=parseFloat(l);!isNaN(g)&&g>=0&&(i(t.printer_id,g),o(!1))};return p.jsxs(Zt,{children:[p.jsxs("div",{className:"p-4",children:[p.jsxs("div",{className:"flex items-center justify-between mb-4",children:[p.jsxs("div",{className:"flex items-center gap-3",children:[p.jsx("h2",{className:"text-lg font-semibold text-white",children:t.printer_name}),t.due_count>0&&p.jsxs("span",{className:"px-2.5 py-1 bg-red-500/20 text-red-400 text-xs font-medium rounded-full flex items-center gap-1",children:[p.jsx(hc,{className:"w-3 h-3"}),t.due_count," overdue"]}),t.warning_count>0&&p.jsxs("span",{className:"px-2.5 py-1 bg-yellow-500/20 text-yellow-400 text-xs font-medium rounded-full flex items-center gap-1",children:[p.jsx(xa,{className:"w-3 h-3"}),t.warning_count," due soon"]}),t.due_count===0&&t.warning_count===0&&p.jsxs("span",{className:"px-2.5 py-1 bg-bambu-green/20 text-bambu-green text-xs font-medium rounded-full flex items-center gap-1",children:[p.jsx(O0,{className:"w-3 h-3"}),"All good"]})]}),p.jsx("button",{onClick:()=>a(!r),className:"flex items-center gap-1 px-3 py-1.5 text-sm text-bambu-gray hover:text-white hover:bg-bambu-dark rounded transition-colors",children:r?p.jsxs(p.Fragment,{children:[p.jsx(zG,{className:"w-4 h-4"}),"Hide"]}):p.jsxs(p.Fragment,{children:[p.jsx(Cx,{className:"w-4 h-4"}),"Details"]})})]}),p.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[p.jsxs("div",{className:"p-3 bg-bambu-dark rounded-lg",children:[p.jsx("div",{className:"text-xs text-bambu-gray mb-1 uppercase tracking-wide",children:"Total Print Time"}),s?p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("input",{type:"number",value:l,onChange:g=>c(g.target.value),onKeyDown:g=>{g.key==="Enter"&&m(),g.key==="Escape"&&o(!1)},className:"w-20 px-2 py-1 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded text-white text-lg font-semibold",min:"0",step:"1",autoFocus:!0}),p.jsx("span",{className:"text-sm text-bambu-gray",children:"hours"}),p.jsxs("div",{className:"flex gap-1 ml-auto",children:[p.jsx(st,{size:"sm",onClick:m,children:"Save"}),p.jsx(st,{size:"sm",variant:"secondary",onClick:()=>o(!1),children:"✕"})]})]}):p.jsxs("button",{onClick:()=>{c(Math.round(t.total_print_hours).toString()),o(!0)},className:"flex items-center gap-2 group",title:"Click to edit total print hours",children:[p.jsx("span",{className:"text-xl font-semibold text-white group-hover:text-bambu-green transition-colors",children:t$e(t.total_print_hours)}),p.jsx(NP,{className:"w-4 h-4 text-bambu-gray group-hover:text-bambu-green transition-colors"})]})]}),p.jsxs("div",{className:`p-3 rounded-lg ${f?.is_due?"bg-red-500/10":f?.is_warning?"bg-yellow-500/10":"bg-bambu-dark"}`,children:[p.jsx("div",{className:"text-xs text-bambu-gray mb-1 uppercase tracking-wide",children:"Next Maintenance"}),f?p.jsxs("div",{children:[p.jsx("div",{className:`text-lg font-semibold ${f.is_due?"text-red-400":f.is_warning?"text-yellow-400":"text-white"}`,children:f.maintenance_type_name}),p.jsx("div",{className:`text-sm ${f.is_due?"text-red-400":f.is_warning?"text-yellow-400":"text-bambu-gray"}`,children:f.is_due?p.jsxs(p.Fragment,{children:["Overdue by ",N0(Math.abs(f.hours_until_due))]}):p.jsxs(p.Fragment,{children:["Due in ",N0(f.hours_until_due)]})})]}):p.jsx("div",{className:"text-white",children:"No tasks enabled"})]})]})]}),r&&p.jsx(cn,{className:"pt-0 space-y-2 border-t border-bambu-dark-tertiary mt-4",children:p.jsx("div",{className:"pt-4",children:d.map(g=>p.jsx(n$e,{item:g,onPerform:e,onToggle:n},g.id))})})]})}function r$e({overview:t,types:e,onUpdateInterval:n,onAddType:i,onDeleteType:r}){const[a,s]=E.useState(null),[o,l]=E.useState(""),[c,d]=E.useState(!1),[f,m]=E.useState(""),[g,y]=E.useState("100"),[_,v]=E.useState("Wrench"),x=(P,A)=>{const U=parseFloat(o);if(!isNaN(U)&&U>0){const N=Math.abs(U-A)<.01?null:U;n(P,N)}s(null)},M=P=>{P.preventDefault(),f.trim()&&parseFloat(g)>0&&(i({name:f.trim(),default_interval_hours:parseFloat(g),icon:_}),m(""),y("100"),d(!1))},w=t?.map(P=>({printerId:P.printer_id,printerName:P.printer_name,items:P.maintenance_items.sort((A,U)=>A.maintenance_type_id-U.maintenance_type_id)})).sort((P,A)=>P.printerName.localeCompare(A.printerName))||[],T=e.filter(P=>P.is_system),C=e.filter(P=>!P.is_system);return p.jsxs("div",{className:"space-y-8",children:[p.jsxs("div",{children:[p.jsxs("div",{className:"flex items-center justify-between mb-4",children:[p.jsx("h2",{className:"text-lg font-semibold text-white",children:"Maintenance Types"}),p.jsxs(st,{size:"sm",variant:"secondary",onClick:()=>d(!c),children:[p.jsx(dc,{className:"w-4 h-4"}),"Add Custom Type"]})]}),c&&p.jsx(Zt,{className:"mb-4",children:p.jsx("div",{className:"p-4",children:p.jsx("form",{onSubmit:M,children:p.jsxs("div",{className:"flex gap-3 items-end",children:[p.jsxs("div",{className:"flex-1",children:[p.jsx("label",{className:"block text-xs text-bambu-gray mb-1",children:"Name"}),p.jsx("input",{type:"text",value:f,onChange:P=>m(P.target.value),className:"w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded text-white text-sm",placeholder:"e.g., Replace HEPA Filter",autoFocus:!0})]}),p.jsxs("div",{className:"w-28",children:[p.jsx("label",{className:"block text-xs text-bambu-gray mb-1",children:"Interval (hours)"}),p.jsx("input",{type:"number",value:g,onChange:P=>y(P.target.value),className:"w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded text-white text-sm",min:"1"})]}),p.jsxs("div",{children:[p.jsx("label",{className:"block text-xs text-bambu-gray mb-1",children:"Icon"}),p.jsx("div",{className:"flex gap-1",children:Object.keys(hP).map(P=>{const A=hP[P];return p.jsx("button",{type:"button",onClick:()=>v(P),className:`p-2 rounded ${_===P?"bg-bambu-green text-white":"bg-bambu-dark-tertiary text-bambu-gray hover:text-white"}`,children:p.jsx(A,{className:"w-4 h-4"})},P)})})]}),p.jsxs("div",{className:"flex gap-2",children:[p.jsx(st,{type:"submit",size:"sm",disabled:!f.trim(),children:"Add"}),p.jsx(st,{type:"button",size:"sm",variant:"secondary",onClick:()=>d(!1),children:"Cancel"})]})]})})})}),p.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-3",children:[T.map(P=>{const A=A_(P.icon);return p.jsx("div",{className:"bg-bambu-dark-secondary rounded-lg p-4 border border-bambu-dark-tertiary",children:p.jsxs("div",{className:"flex items-center gap-3",children:[p.jsx("div",{className:"p-2 bg-bambu-dark rounded-lg",children:p.jsx(A,{className:"w-5 h-5 text-bambu-gray"})}),p.jsxs("div",{className:"flex-1 min-w-0",children:[p.jsx("div",{className:"text-sm font-medium text-white truncate",children:P.name}),p.jsxs("div",{className:"text-xs text-bambu-gray mt-0.5",children:[P.default_interval_hours,"h interval"]})]})]})},P.id)}),C.map(P=>{const A=A_(P.icon);return p.jsx("div",{className:"bg-bambu-dark-secondary rounded-lg p-4 border border-bambu-green/30",children:p.jsxs("div",{className:"flex items-center gap-3",children:[p.jsx("div",{className:"p-2 bg-bambu-green/20 rounded-lg",children:p.jsx(A,{className:"w-5 h-5 text-bambu-green"})}),p.jsxs("div",{className:"flex-1 min-w-0",children:[p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("span",{className:"text-sm font-medium text-white truncate",children:P.name}),p.jsx("span",{className:"px-1.5 py-0.5 bg-bambu-green/20 text-bambu-green text-[10px] font-medium rounded",children:"Custom"})]}),p.jsxs("div",{className:"text-xs text-bambu-gray mt-0.5",children:[P.default_interval_hours,"h interval"]})]}),p.jsx("button",{onClick:()=>{confirm(`Delete "${P.name}"?`)&&r(P.id)},className:"p-1.5 rounded hover:bg-bambu-dark text-bambu-gray hover:text-red-400 transition-colors",children:p.jsx(na,{className:"w-4 h-4"})})]})},P.id)})]})]}),w.length>0&&p.jsxs("div",{children:[p.jsx("h2",{className:"text-lg font-semibold text-white mb-2",children:"Interval Overrides"}),p.jsx("p",{className:"text-sm text-bambu-gray mb-4",children:"Set custom intervals per printer."}),p.jsx("div",{className:"space-y-3",children:w.map(P=>p.jsx(Zt,{children:p.jsxs("div",{className:"p-4",children:[p.jsx("h3",{className:"text-sm font-medium text-white mb-3",children:P.printerName}),p.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-2",children:P.items.map(A=>{const U=A_(A.maintenance_type_icon),D=e.find(I=>I.id===A.maintenance_type_id)?.default_interval_hours||A.interval_hours,F=a===A.id;return p.jsxs("div",{className:"flex items-center gap-2 p-2 bg-bambu-dark rounded-lg",children:[p.jsx(U,{className:"w-4 h-4 text-bambu-gray shrink-0"}),p.jsx("span",{className:"text-xs text-bambu-gray flex-1 truncate",children:A.maintenance_type_name}),F?p.jsxs("div",{className:"flex items-center gap-1",children:[p.jsx("input",{type:"number",value:o,onChange:I=>l(I.target.value),onKeyDown:I=>{I.key==="Enter"&&x(A.id,D),I.key==="Escape"&&s(null)},className:"w-16 px-2 py-1 bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded text-white text-xs",min:"1",autoFocus:!0}),p.jsx(st,{size:"sm",onClick:()=>x(A.id,D),children:"OK"})]}):p.jsxs("button",{onClick:()=>{s(A.id),l(A.interval_hours.toString())},className:"px-2 py-1 bg-bambu-dark-tertiary hover:bg-bambu-dark-secondary border border-bambu-dark-tertiary hover:border-bambu-green rounded text-xs font-medium text-white transition-colors",children:[A.interval_hours,"h",p.jsx(NP,{className:"w-3 h-3 inline ml-1.5 text-bambu-gray"})]})]},A.id)})})]})},P.printerId))})]}),w.length===0&&p.jsx(Zt,{children:p.jsxs(cn,{className:"text-center py-12",children:[p.jsx(xa,{className:"w-12 h-12 mx-auto mb-4 text-bambu-gray/30"}),p.jsx("p",{className:"text-bambu-gray",children:"No printers configured"}),p.jsx("p",{className:"text-sm text-bambu-gray/70 mt-1",children:"Add printers to configure maintenance intervals"})]})})]})}function a$e(){const t=Jn(),{showToast:e}=Mo(),[n,i]=E.useState("status"),{data:r,isLoading:a}=It({queryKey:["maintenanceOverview"],queryFn:Ye.getMaintenanceOverview}),{data:s}=It({queryKey:["maintenanceTypes"],queryFn:Ye.getMaintenanceTypes}),o=Ot({mutationFn:({id:x,notes:M})=>Ye.performMaintenance(x,M),onSuccess:()=>{t.invalidateQueries({queryKey:["maintenanceOverview"]}),t.invalidateQueries({queryKey:["maintenanceSummary"]}),e("Maintenance marked as done")},onError:x=>{e(x.message,"error")}}),l=Ot({mutationFn:({id:x,data:M})=>Ye.updateMaintenanceItem(x,M),onSuccess:()=>{t.invalidateQueries({queryKey:["maintenanceOverview"]})},onError:x=>{e(x.message,"error")}}),c=Ot({mutationFn:Ye.createMaintenanceType,onSuccess:()=>{t.invalidateQueries({queryKey:["maintenanceTypes"]}),t.invalidateQueries({queryKey:["maintenanceOverview"]}),e("Maintenance type added")},onError:x=>{e(x.message,"error")}}),d=Ot({mutationFn:Ye.deleteMaintenanceType,onSuccess:()=>{t.invalidateQueries({queryKey:["maintenanceTypes"]}),t.invalidateQueries({queryKey:["maintenanceOverview"]}),e("Maintenance type deleted")},onError:x=>{e(x.message,"error")}}),f=Ot({mutationFn:({printerId:x,hours:M})=>Ye.setPrinterHours(x,M),onSuccess:()=>{t.invalidateQueries({queryKey:["maintenanceOverview"]}),t.invalidateQueries({queryKey:["maintenanceSummary"]}),e("Print hours updated")},onError:x=>{e(x.message,"error")}}),m=x=>{o.mutate({id:x})},g=(x,M)=>{l.mutate({id:x,data:{enabled:M}})},y=(x,M)=>{f.mutate({printerId:x,hours:M})};if(a)return p.jsx("div",{className:"p-8 flex justify-center",children:p.jsx(Yt,{className:"w-8 h-8 text-bambu-green animate-spin"})});const _=r?.reduce((x,M)=>x+M.due_count,0)||0,v=r?.reduce((x,M)=>x+M.warning_count,0)||0;return p.jsxs("div",{className:"p-8",children:[p.jsxs("div",{className:"mb-6",children:[p.jsx("h1",{className:"text-2xl font-bold text-white",children:"Maintenance"}),p.jsx("p",{className:"text-bambu-gray text-sm",children:n==="status"?p.jsxs(p.Fragment,{children:[_>0&&p.jsxs("span",{className:"text-red-400",children:[_," tasks overdue"]}),_>0&&v>0&&" · ",v>0&&p.jsxs("span",{className:"text-yellow-400",children:[v," due soon"]}),_===0&&v===0&&"All maintenance up to date"]}):"Configure maintenance types and intervals"})]}),p.jsxs("div",{className:"flex gap-1 mb-6 border-b border-bambu-dark-tertiary",children:[p.jsx("button",{onClick:()=>i("status"),className:`px-4 py-2 text-sm font-medium border-b-2 -mb-px transition-colors ${n==="status"?"text-bambu-green border-bambu-green":"text-bambu-gray border-transparent hover:text-white"}`,children:"Status"}),p.jsx("button",{onClick:()=>i("settings"),className:`px-4 py-2 text-sm font-medium border-b-2 -mb-px transition-colors ${n==="settings"?"text-bambu-green border-bambu-green":"text-bambu-gray border-transparent hover:text-white"}`,children:"Settings"})]}),n==="status"?p.jsx("div",{className:"space-y-4",children:r&&r.length>0?[...r].sort((x,M)=>x.printer_name.localeCompare(M.printer_name)).map(x=>p.jsx(i$e,{overview:x,onPerform:m,onToggle:g,onSetHours:y},x.printer_id)):p.jsx(Zt,{children:p.jsxs(cn,{className:"text-center py-12",children:[p.jsx(Ip,{className:"w-12 h-12 mx-auto mb-4 text-bambu-gray/30"}),p.jsx("p",{className:"text-bambu-gray",children:"No printers configured"}),p.jsx("p",{className:"text-sm text-bambu-gray/70 mt-1",children:"Add printers to start tracking maintenance"})]})})}):p.jsx(r$e,{overview:r,types:s||[],onUpdateInterval:(x,M)=>l.mutate({id:x,data:{custom_interval_hours:M}}),onAddType:x=>c.mutate(x),onDeleteType:x=>d.mutate(x)})]})}function s$e(){const{printerId:t}=kie(),e=parseInt(t||"0",10),[n,i]=E.useState("stream"),[r,a]=E.useState(!1),[s,o]=E.useState(!0),[l,c]=E.useState(Date.now()),[d,f]=E.useState(!1),[m,g]=E.useState(!1),y=E.useRef(null),_=E.useRef(null),{data:v}=It({queryKey:["printer",e],queryFn:()=>Ye.getPrinter(e),enabled:e>0});E.useEffect(()=>(v&&(document.title=`${v.name} - Camera`),()=>{document.title="Bambusy"}),[v]),E.useEffect(()=>()=>{y.current&&(y.current.src="")},[]),E.useEffect(()=>{if(s&&!d){const N=setTimeout(()=>{o(!1)},n==="stream"?3e3:2e4);return()=>clearTimeout(N)}},[n,s,l,d]),E.useEffect(()=>{const U=()=>{g(!!document.fullscreenElement)};return document.addEventListener("fullscreenchange",U),()=>document.removeEventListener("fullscreenchange",U)},[]);const x=()=>{a(!0),o(!1)},M=()=>{o(!1),a(!1)},w=U=>{n===U||d||(f(!0),o(!0),a(!1),y.current&&(y.current.src=""),setTimeout(()=>{i(U),c(Date.now()),f(!1)},100))},T=()=>{d||(f(!0),o(!0),a(!1),y.current&&(y.current.src=""),setTimeout(()=>{c(Date.now()),f(!1)},100))},C=()=>{_.current&&(document.fullscreenElement?document.exitFullscreen():_.current.requestFullscreen())},P=d?"":n==="stream"?`/api/v1/printers/${e}/camera/stream?fps=10&t=${l}`:`/api/v1/printers/${e}/camera/snapshot?t=${l}`,A=s||d;return e?p.jsxs("div",{ref:_,className:"min-h-screen bg-black flex flex-col",children:[p.jsxs("div",{className:"flex items-center justify-between px-4 py-2 bg-bambu-dark-secondary border-b border-bambu-dark-tertiary",children:[p.jsxs("h1",{className:"text-sm font-medium text-white flex items-center gap-2",children:[p.jsx(k_,{className:"w-4 h-4"}),v?.name||`Printer ${e}`]}),p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsxs("div",{className:"flex bg-bambu-dark rounded p-0.5",children:[p.jsx("button",{onClick:()=>w("stream"),disabled:A,className:`px-3 py-1 text-xs rounded transition-colors ${n==="stream"?"bg-bambu-green text-white":"text-bambu-gray hover:text-white disabled:opacity-50"}`,children:"Live"}),p.jsx("button",{onClick:()=>w("snapshot"),disabled:A,className:`px-3 py-1 text-xs rounded transition-colors ${n==="snapshot"?"bg-bambu-green text-white":"text-bambu-gray hover:text-white disabled:opacity-50"}`,children:"Snapshot"})]}),p.jsx("button",{onClick:T,disabled:A,className:"p-1.5 hover:bg-bambu-dark-tertiary rounded disabled:opacity-50",title:n==="stream"?"Restart stream":"Refresh snapshot",children:p.jsx(Zo,{className:`w-4 h-4 text-bambu-gray ${A?"animate-spin":""}`})}),p.jsx("button",{onClick:C,className:"p-1.5 hover:bg-bambu-dark-tertiary rounded",title:m?"Exit fullscreen":"Fullscreen",children:m?p.jsx(ioe,{className:"w-4 h-4 text-bambu-gray"}):p.jsx(Jse,{className:"w-4 h-4 text-bambu-gray"})})]})]}),p.jsx("div",{className:"flex-1 flex items-center justify-center p-2",children:p.jsxs("div",{className:"relative w-full h-full flex items-center justify-center",children:[(s||d)&&p.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-black/50 z-10",children:p.jsxs("div",{className:"text-center",children:[p.jsx(Zo,{className:"w-8 h-8 text-bambu-gray animate-spin mx-auto mb-2"}),p.jsx("p",{className:"text-sm text-bambu-gray",children:n==="stream"?"Connecting to camera...":"Capturing snapshot..."})]})}),r&&p.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-black z-10",children:p.jsxs("div",{className:"text-center p-4",children:[p.jsx(hc,{className:"w-12 h-12 text-orange-400 mx-auto mb-3"}),p.jsx("p",{className:"text-white mb-2",children:"Camera unavailable"}),p.jsx("p",{className:"text-xs text-bambu-gray mb-4 max-w-md",children:"Make sure the printer is powered on and connected."}),p.jsx("button",{onClick:T,className:"px-4 py-2 bg-bambu-green text-white rounded hover:bg-bambu-green/80 transition-colors",children:"Retry"})]})}),p.jsx("img",{ref:y,src:P,alt:"Camera stream",className:"max-w-full max-h-full object-contain",onError:P?x:void 0,onLoad:P?M:void 0},l)]})})]}):p.jsx("div",{className:"min-h-screen bg-black flex items-center justify-center",children:p.jsx("p",{className:"text-white",children:"Invalid printer ID"})})}function o$e(){const t=E.useRef(null),e=E.useRef(null),n=Jn(),[i,r]=E.useState(!1),a=E.useCallback(()=>{if(t.current?.readyState===WebSocket.OPEN)return;const c=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/api/v1/ws`,d=new WebSocket(c);let f=null;d.onopen=()=>{console.log("[WebSocket] Connected"),r(!0),f=window.setInterval(()=>{d.readyState===WebSocket.OPEN&&d.send(JSON.stringify({type:"ping"}))},3e4)},d.onmessage=m=>{try{const g=JSON.parse(m.data);s(g)}catch{}},d.onclose=m=>{console.log("[WebSocket] Closed",m.code,m.reason),f&&(clearInterval(f),f=null),r(!1),t.current=null,e.current=window.setTimeout(()=>{a()},3e3)},d.onerror=m=>{console.error("[WebSocket] Error",m),d.close()},t.current=d},[]),s=E.useCallback(l=>{switch(l.type){case"printer_status":l.printer_id!==void 0&&n.setQueryData(["printerStatus",l.printer_id],c=>{const d={...c,...l.data};return d.wifi_signal==null&&c?.wifi_signal!=null&&(d.wifi_signal=c.wifi_signal),d});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]);E.useEffect(()=>(a(),()=>{e.current&&clearTimeout(e.current),t.current&&t.current.close()}),[a]);const o=E.useCallback(l=>{t.current?.readyState===WebSocket.OPEN&&t.current.send(JSON.stringify(l))},[]);return{isConnected:i,sendMessage:o}}const l$e=new Yre({defaultOptions:{queries:{staleTime:1e3*60,retry:1}}});function c$e({children:t}){return o$e(),p.jsx(p.Fragment,{children:t})}function u$e(){return p.jsx(ble,{children:p.jsx(Nle,{children:p.jsx(Zre,{client:l$e,children:p.jsx(c$e,{children:p.jsx(vre,{children:p.jsxs(Kie,{children:[p.jsx(Lo,{path:"/camera/:printerId",element:p.jsx(s$e,{})}),p.jsxs(Lo,{path:"/",element:p.jsx(Ale,{}),children:[p.jsx(Lo,{index:!0,element:p.jsx(ace,{})}),p.jsx(Lo,{path:"archives",element:p.jsx(P2e,{})}),p.jsx(Lo,{path:"queue",element:p.jsx(O2e,{})}),p.jsx(Lo,{path:"stats",element:p.jsx(UVe,{})}),p.jsx(Lo,{path:"profiles",element:p.jsx(e$e,{})}),p.jsx(Lo,{path:"maintenance",element:p.jsx(a$e,{})}),p.jsx(Lo,{path:"settings",element:p.jsx(WVe,{})})]})]})})})})})})}Qte.createRoot(document.getElementById("root")).render(p.jsx(E.StrictMode,{children:p.jsx(u$e,{})}));