index-in5STeRb.js 2.3 MB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594
  1. function tee(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 Yx=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Vs(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var NE={exports:{}},ng={};var UU;function nee(){if(UU)return ng;UU=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 ng.Fragment=e,ng.jsx=n,ng.jsxs=n,ng}var FU;function iee(){return FU||(FU=1,NE.exports=nee()),NE.exports}var S=iee(),PE={exports:{}},$t={};var zU;function ree(){if(zU)return $t;zU=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"),p=Symbol.iterator;function m(H){return H===null||typeof H!="object"?null:(H=p&&H[p]||H["@@iterator"],typeof H=="function"?H:null)}var y={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},b=Object.assign,x={};function v(H,X,re){this.props=H,this.context=X,this.refs=x,this.updater=re||y}v.prototype.isReactComponent={},v.prototype.setState=function(H,X){if(typeof H!="object"&&typeof H!="function"&&H!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,H,X,"setState")},v.prototype.forceUpdate=function(H){this.updater.enqueueForceUpdate(this,H,"forceUpdate")};function M(){}M.prototype=v.prototype;function w(H,X,re){this.props=H,this.context=X,this.refs=x,this.updater=re||y}var E=w.prototype=new M;E.constructor=w,b(E,v.prototype),E.isPureReactComponent=!0;var T=Array.isArray;function P(){}var R={H:null,A:null,T:null,S:null},U=Object.prototype.hasOwnProperty;function N(H,X,re){var ce=re.ref;return{$$typeof:t,type:H,key:X,ref:ce!==void 0?ce:null,props:re}}function O(H,X){return N(H.type,X,H.props)}function B(H){return typeof H=="object"&&H!==null&&H.$$typeof===t}function I(H){var X={"=":"=0",":":"=2"};return"$"+H.replace(/[=:]/g,function(re){return X[re]})}var W=/\/+/g;function L(H,X){return typeof H=="object"&&H!==null&&H.key!=null?I(""+H.key):X.toString(36)}function $(H){switch(H.status){case"fulfilled":return H.value;case"rejected":throw H.reason;default:switch(typeof H.status=="string"?H.then(P,P):(H.status="pending",H.then(function(X){H.status==="pending"&&(H.status="fulfilled",H.value=X)},function(X){H.status==="pending"&&(H.status="rejected",H.reason=X)})),H.status){case"fulfilled":return H.value;case"rejected":throw H.reason}}throw H}function q(H,X,re,ce,ye){var me=typeof H;(me==="undefined"||me==="boolean")&&(H=null);var be=!1;if(H===null)be=!0;else switch(me){case"bigint":case"string":case"number":be=!0;break;case"object":switch(H.$$typeof){case t:case e:be=!0;break;case d:return be=H._init,q(be(H._payload),X,re,ce,ye)}}if(be)return ye=ye(H),be=ce===""?"."+L(H,0):ce,T(ye)?(re="",be!=null&&(re=be.replace(W,"$&/")+"/"),q(ye,X,re,"",function(Ae){return Ae})):ye!=null&&(B(ye)&&(ye=O(ye,re+(ye.key==null||H&&H.key===ye.key?"":(""+ye.key).replace(W,"$&/")+"/")+be)),X.push(ye)),1;be=0;var De=ce===""?".":ce+":";if(T(H))for(var he=0;he<H.length;he++)ce=H[he],me=De+L(ce,he),be+=q(ce,X,re,me,ye);else if(he=m(H),typeof he=="function")for(H=he.call(H),he=0;!(ce=H.next()).done;)ce=ce.value,me=De+L(ce,he++),be+=q(ce,X,re,me,ye);else if(me==="object"){if(typeof H.then=="function")return q($(H),X,re,ce,ye);throw X=String(H),Error("Objects are not valid as a React child (found: "+(X==="[object Object]"?"object with keys {"+Object.keys(H).join(", ")+"}":X)+"). If you meant to render a collection of children, use an array instead.")}return be}function G(H,X,re){if(H==null)return H;var ce=[],ye=0;return q(H,ce,"","",function(me){return X.call(re,me,ye++)}),ce}function Y(H){if(H._status===-1){var X=H._result;X=X(),X.then(function(re){(H._status===0||H._status===-1)&&(H._status=1,H._result=re)},function(re){(H._status===0||H._status===-1)&&(H._status=2,H._result=re)}),H._status===-1&&(H._status=0,H._result=X)}if(H._status===1)return H._result.default;throw H._result}var Q=typeof reportError=="function"?reportError:function(H){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var X=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof H=="object"&&H!==null&&typeof H.message=="string"?String(H.message):String(H),error:H});if(!window.dispatchEvent(X))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",H);return}console.error(H)},se={map:G,forEach:function(H,X,re){G(H,function(){X.apply(this,arguments)},re)},count:function(H){var X=0;return G(H,function(){X++}),X},toArray:function(H){return G(H,function(X){return X})||[]},only:function(H){if(!B(H))throw Error("React.Children.only expected to receive a single React element child.");return H}};return $t.Activity=f,$t.Children=se,$t.Component=v,$t.Fragment=n,$t.Profiler=r,$t.PureComponent=w,$t.StrictMode=i,$t.Suspense=l,$t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=R,$t.__COMPILER_RUNTIME={__proto__:null,c:function(H){return R.H.useMemoCache(H)}},$t.cache=function(H){return function(){return H.apply(null,arguments)}},$t.cacheSignal=function(){return null},$t.cloneElement=function(H,X,re){if(H==null)throw Error("The argument must be a React element, but you passed "+H+".");var ce=b({},H.props),ye=H.key;if(X!=null)for(me in X.key!==void 0&&(ye=""+X.key),X)!U.call(X,me)||me==="key"||me==="__self"||me==="__source"||me==="ref"&&X.ref===void 0||(ce[me]=X[me]);var me=arguments.length-2;if(me===1)ce.children=re;else if(1<me){for(var be=Array(me),De=0;De<me;De++)be[De]=arguments[De+2];ce.children=be}return N(H.type,ye,ce)},$t.createContext=function(H){return H={$$typeof:s,_currentValue:H,_currentValue2:H,_threadCount:0,Provider:null,Consumer:null},H.Provider=H,H.Consumer={$$typeof:a,_context:H},H},$t.createElement=function(H,X,re){var ce,ye={},me=null;if(X!=null)for(ce in X.key!==void 0&&(me=""+X.key),X)U.call(X,ce)&&ce!=="key"&&ce!=="__self"&&ce!=="__source"&&(ye[ce]=X[ce]);var be=arguments.length-2;if(be===1)ye.children=re;else if(1<be){for(var De=Array(be),he=0;he<be;he++)De[he]=arguments[he+2];ye.children=De}if(H&&H.defaultProps)for(ce in be=H.defaultProps,be)ye[ce]===void 0&&(ye[ce]=be[ce]);return N(H,me,ye)},$t.createRef=function(){return{current:null}},$t.forwardRef=function(H){return{$$typeof:o,render:H}},$t.isValidElement=B,$t.lazy=function(H){return{$$typeof:d,_payload:{_status:-1,_result:H},_init:Y}},$t.memo=function(H,X){return{$$typeof:c,type:H,compare:X===void 0?null:X}},$t.startTransition=function(H){var X=R.T,re={};R.T=re;try{var ce=H(),ye=R.S;ye!==null&&ye(re,ce),typeof ce=="object"&&ce!==null&&typeof ce.then=="function"&&ce.then(P,Q)}catch(me){Q(me)}finally{X!==null&&re.types!==null&&(X.types=re.types),R.T=X}},$t.unstable_useCacheRefresh=function(){return R.H.useCacheRefresh()},$t.use=function(H){return R.H.use(H)},$t.useActionState=function(H,X,re){return R.H.useActionState(H,X,re)},$t.useCallback=function(H,X){return R.H.useCallback(H,X)},$t.useContext=function(H){return R.H.useContext(H)},$t.useDebugValue=function(){},$t.useDeferredValue=function(H,X){return R.H.useDeferredValue(H,X)},$t.useEffect=function(H,X){return R.H.useEffect(H,X)},$t.useEffectEvent=function(H){return R.H.useEffectEvent(H)},$t.useId=function(){return R.H.useId()},$t.useImperativeHandle=function(H,X,re){return R.H.useImperativeHandle(H,X,re)},$t.useInsertionEffect=function(H,X){return R.H.useInsertionEffect(H,X)},$t.useLayoutEffect=function(H,X){return R.H.useLayoutEffect(H,X)},$t.useMemo=function(H,X){return R.H.useMemo(H,X)},$t.useOptimistic=function(H,X){return R.H.useOptimistic(H,X)},$t.useReducer=function(H,X,re){return R.H.useReducer(H,X,re)},$t.useRef=function(H){return R.H.useRef(H)},$t.useState=function(H){return R.H.useState(H)},$t.useSyncExternalStore=function(H,X,re){return R.H.useSyncExternalStore(H,X,re)},$t.useTransition=function(){return R.H.useTransition()},$t.version="19.2.0",$t}var BU;function Hp(){return BU||(BU=1,PE.exports=ree()),PE.exports}var C=Hp();const yi=Vs(C),aee=tee({__proto__:null,default:yi},[C]);var DE={exports:{}},ig={},OE={exports:{}},LE={};var jU;function see(){return jU||(jU=1,(function(t){function e(q,G){var Y=q.length;q.push(G);e:for(;0<Y;){var Q=Y-1>>>1,se=q[Q];if(0<r(se,G))q[Q]=G,q[Y]=se,Y=Q;else break e}}function n(q){return q.length===0?null:q[0]}function i(q){if(q.length===0)return null;var G=q[0],Y=q.pop();if(Y!==G){q[0]=Y;e:for(var Q=0,se=q.length,H=se>>>1;Q<H;){var X=2*(Q+1)-1,re=q[X],ce=X+1,ye=q[ce];if(0>r(re,Y))ce<se&&0>r(ye,re)?(q[Q]=ye,q[ce]=Y,Q=ce):(q[Q]=re,q[X]=Y,Q=X);else if(ce<se&&0>r(ye,Y))q[Q]=ye,q[ce]=Y,Q=ce;else break e}}return G}function r(q,G){var Y=q.sortIndex-G.sortIndex;return Y!==0?Y:q.id-G.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,p=3,m=!1,y=!1,b=!1,x=!1,v=typeof setTimeout=="function"?setTimeout:null,M=typeof clearTimeout=="function"?clearTimeout:null,w=typeof setImmediate<"u"?setImmediate:null;function E(q){for(var G=n(c);G!==null;){if(G.callback===null)i(c);else if(G.startTime<=q)i(c),G.sortIndex=G.expirationTime,e(l,G);else break;G=n(c)}}function T(q){if(b=!1,E(q),!y)if(n(l)!==null)y=!0,P||(P=!0,I());else{var G=n(c);G!==null&&$(T,G.startTime-q)}}var P=!1,R=-1,U=5,N=-1;function O(){return x?!0:!(t.unstable_now()-N<U)}function B(){if(x=!1,P){var q=t.unstable_now();N=q;var G=!0;try{e:{y=!1,b&&(b=!1,M(R),R=-1),m=!0;var Y=p;try{t:{for(E(q),f=n(l);f!==null&&!(f.expirationTime>q&&O());){var Q=f.callback;if(typeof Q=="function"){f.callback=null,p=f.priorityLevel;var se=Q(f.expirationTime<=q);if(q=t.unstable_now(),typeof se=="function"){f.callback=se,E(q),G=!0;break t}f===n(l)&&i(l),E(q)}else i(l);f=n(l)}if(f!==null)G=!0;else{var H=n(c);H!==null&&$(T,H.startTime-q),G=!1}}break e}finally{f=null,p=Y,m=!1}G=void 0}}finally{G?I():P=!1}}}var I;if(typeof w=="function")I=function(){w(B)};else if(typeof MessageChannel<"u"){var W=new MessageChannel,L=W.port2;W.port1.onmessage=B,I=function(){L.postMessage(null)}}else I=function(){v(B,0)};function $(q,G){R=v(function(){q(t.unstable_now())},G)}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(q){q.callback=null},t.unstable_forceFrameRate=function(q){0>q||125<q?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):U=0<q?Math.floor(1e3/q):5},t.unstable_getCurrentPriorityLevel=function(){return p},t.unstable_next=function(q){switch(p){case 1:case 2:case 3:var G=3;break;default:G=p}var Y=p;p=G;try{return q()}finally{p=Y}},t.unstable_requestPaint=function(){x=!0},t.unstable_runWithPriority=function(q,G){switch(q){case 1:case 2:case 3:case 4:case 5:break;default:q=3}var Y=p;p=q;try{return G()}finally{p=Y}},t.unstable_scheduleCallback=function(q,G,Y){var Q=t.unstable_now();switch(typeof Y=="object"&&Y!==null?(Y=Y.delay,Y=typeof Y=="number"&&0<Y?Q+Y:Q):Y=Q,q){case 1:var se=-1;break;case 2:se=250;break;case 5:se=1073741823;break;case 4:se=1e4;break;default:se=5e3}return se=Y+se,q={id:d++,callback:G,priorityLevel:q,startTime:Y,expirationTime:se,sortIndex:-1},Y>Q?(q.sortIndex=Y,e(c,q),n(l)===null&&q===n(c)&&(b?(M(R),R=-1):b=!0,$(T,Y-Q))):(q.sortIndex=se,e(l,q),y||m||(y=!0,P||(P=!0,I()))),q},t.unstable_shouldYield=O,t.unstable_wrapCallback=function(q){var G=p;return function(){var Y=p;p=G;try{return q.apply(this,arguments)}finally{p=Y}}}})(LE)),LE}var HU;function oee(){return HU||(HU=1,OE.exports=see()),OE.exports}var kE={exports:{}},Gr={};var VU;function lee(){if(VU)return Gr;VU=1;var t=Hp();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 Gr.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=i,Gr.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)},Gr.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()}},Gr.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))},Gr.prefetchDNS=function(l){typeof l=="string"&&i.d.D(l)},Gr.preinit=function(l,c){if(typeof l=="string"&&c&&typeof c.as=="string"){var d=c.as,f=o(d,c.crossOrigin),p=typeof c.integrity=="string"?c.integrity:void 0,m=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:p,fetchPriority:m}):d==="script"&&i.d.X(l,{crossOrigin:f,integrity:p,fetchPriority:m,nonce:typeof c.nonce=="string"?c.nonce:void 0})}},Gr.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)},Gr.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})}},Gr.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)},Gr.requestFormReset=function(l){i.d.r(l)},Gr.unstable_batchedUpdates=function(l,c){return l(c)},Gr.useFormState=function(l,c,d){return s.H.useFormState(l,c,d)},Gr.useFormStatus=function(){return s.H.useHostTransitionStatus()},Gr.version="19.2.0",Gr}var GU;function CV(){if(GU)return kE.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(),kE.exports=lee(),kE.exports}var $U;function cee(){if($U)return ig;$U=1;var t=oee(),e=Hp(),n=CV();function i(u){var h="https://react.dev/errors/"+u;if(1<arguments.length){h+="?args[]="+encodeURIComponent(arguments[1]);for(var g=2;g<arguments.length;g++)h+="&args[]="+encodeURIComponent(arguments[g])}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,g=u;if(u.alternate)for(;h.return;)h=h.return;else{u=h;do h=u,(h.flags&4098)!==0&&(g=h.return),u=h.return;while(u)}return h.tag===3?g: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 g=u,_=h;;){var A=g.return;if(A===null)break;var D=A.alternate;if(D===null){if(_=A.return,_!==null){g=_;continue}break}if(A.child===D.child){for(D=A.child;D;){if(D===g)return l(A),u;if(D===_)return l(A),h;D=D.sibling}throw Error(i(188))}if(g.return!==_.return)g=A,_=D;else{for(var j=!1,te=A.child;te;){if(te===g){j=!0,g=A,_=D;break}if(te===_){j=!0,_=A,g=D;break}te=te.sibling}if(!j){for(te=D.child;te;){if(te===g){j=!0,g=D,_=A;break}if(te===_){j=!0,_=D,g=A;break}te=te.sibling}if(!j)throw Error(i(189))}}if(g.alternate!==_)throw Error(i(190))}if(g.tag!==3)throw Error(i(188));return g.stateNode.current===g?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,p=Symbol.for("react.element"),m=Symbol.for("react.transitional.element"),y=Symbol.for("react.portal"),b=Symbol.for("react.fragment"),x=Symbol.for("react.strict_mode"),v=Symbol.for("react.profiler"),M=Symbol.for("react.consumer"),w=Symbol.for("react.context"),E=Symbol.for("react.forward_ref"),T=Symbol.for("react.suspense"),P=Symbol.for("react.suspense_list"),R=Symbol.for("react.memo"),U=Symbol.for("react.lazy"),N=Symbol.for("react.activity"),O=Symbol.for("react.memo_cache_sentinel"),B=Symbol.iterator;function I(u){return u===null||typeof u!="object"?null:(u=B&&u[B]||u["@@iterator"],typeof u=="function"?u:null)}var W=Symbol.for("react.client.reference");function L(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 b:return"Fragment";case v:return"Profiler";case x:return"StrictMode";case T: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 E:var h=u.render;return u=u.displayName,u||(u=h.displayName||h.name||"",u=u!==""?"ForwardRef("+u+")":"ForwardRef"),u;case R:return h=u.displayName||null,h!==null?h:L(u.type)||"Memo";case U:h=u._payload,u=u._init;try{return L(u(h))}catch{}}return null}var $=Array.isArray,q=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,G=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Y={pending:!1,data:null,method:null,action:null},Q=[],se=-1;function H(u){return{current:u}}function X(u){0>se||(u.current=Q[se],Q[se]=null,se--)}function re(u,h){se++,Q[se]=u.current,u.current=h}var ce=H(null),ye=H(null),me=H(null),be=H(null);function De(u,h){switch(re(me,h),re(ye,u),re(ce,null),h.nodeType){case 9:case 11:u=(u=h.documentElement)&&(u=u.namespaceURI)?sU(u):0;break;default:if(u=h.tagName,h=h.namespaceURI)h=sU(h),u=oU(h,u);else switch(u){case"svg":u=1;break;case"math":u=2;break;default:u=0}}X(ce),re(ce,u)}function he(){X(ce),X(ye),X(me)}function Ae(u){u.memoizedState!==null&&re(be,u);var h=ce.current,g=oU(h,u.type);h!==g&&(re(ye,u),re(ce,g))}function Be(u){ye.current===u&&(X(ce),X(ye)),be.current===u&&(X(be),Jm._currentValue=Y)}var le,ut;function z(u){if(le===void 0)try{throw Error()}catch(g){var h=g.stack.trim().match(/\n( *(at )?)/);le=h&&h[1]||"",ut=-1<g.stack.indexOf(`
  2. at`)?" (<anonymous>)":-1<g.stack.indexOf("@")?"@unknown:0:0":""}return`
  3. `+le+u+ut}var V=!1;function ne(u,h){if(!u||V)return"";V=!0;var g=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var _={DetermineComponentFrameRoot:function(){try{if(h){var it=function(){throw Error()};if(Object.defineProperty(it.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(it,[])}catch(Ye){var Ve=Ye}Reflect.construct(u,[],it)}else{try{it.call()}catch(Ye){Ve=Ye}u.call(it.prototype)}}else{try{throw Error()}catch(Ye){Ve=Ye}(it=u())&&typeof it.catch=="function"&&it.catch(function(){})}}catch(Ye){if(Ye&&Ve&&typeof Ye.stack=="string")return[Ye.stack,Ve.stack]}return[null,null]}};_.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var A=Object.getOwnPropertyDescriptor(_.DetermineComponentFrameRoot,"name");A&&A.configurable&&Object.defineProperty(_.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var D=_.DetermineComponentFrameRoot(),j=D[0],te=D[1];if(j&&te){var Se=j.split(`
  4. `),ze=te.split(`
  5. `);for(A=_=0;_<Se.length&&!Se[_].includes("DetermineComponentFrameRoot");)_++;for(;A<ze.length&&!ze[A].includes("DetermineComponentFrameRoot");)A++;if(_===Se.length||A===ze.length)for(_=Se.length-1,A=ze.length-1;1<=_&&0<=A&&Se[_]!==ze[A];)A--;for(;1<=_&&0<=A;_--,A--)if(Se[_]!==ze[A]){if(_!==1||A!==1)do if(_--,A--,0>A||Se[_]!==ze[A]){var Je=`
  6. `+Se[_].replace(" at new "," at ");return u.displayName&&Je.includes("<anonymous>")&&(Je=Je.replace("<anonymous>",u.displayName)),Je}while(1<=_&&0<=A);break}}}finally{V=!1,Error.prepareStackTrace=g}return(g=u?u.displayName||u.name:"")?z(g):""}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 ne(u.type,!1);case 11:return ne(u.type.render,!1);case 1:return ne(u.type,!0);case 31:return z("Activity");default:return""}}function ee(u){try{var h="",g=null;do h+=J(u,g),g=u,u=u.return;while(u);return h}catch(_){return`
  7. Error generating stack: `+_.message+`
  8. `+_.stack}}var ae=Object.prototype.hasOwnProperty,ie=t.unstable_scheduleCallback,we=t.unstable_cancelCallback,ve=t.unstable_shouldYield,F=t.unstable_requestPaint,k=t.unstable_now,K=t.unstable_getCurrentPriorityLevel,pe=t.unstable_ImmediatePriority,xe=t.unstable_UserBlockingPriority,fe=t.unstable_NormalPriority,Ke=t.unstable_LowPriority,ke=t.unstable_IdlePriority,$e=t.log,rt=t.unstable_setDisableYieldValue,Ue=null,Pe=null;function dt(u){if(typeof $e=="function"&&rt(u),Pe&&typeof Pe.setStrictMode=="function")try{Pe.setStrictMode(Ue,u)}catch{}}var et=Math.clz32?Math.clz32:ue,Qe=Math.log,st=Math.LN2;function ue(u){return u>>>=0,u===0?32:31-(Qe(u)/st|0)|0}var tt=256,de=262144,Le=4194304;function Ee(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 ge(u,h,g){var _=u.pendingLanes;if(_===0)return 0;var A=0,D=u.suspendedLanes,j=u.pingedLanes;u=u.warmLanes;var te=_&134217727;return te!==0?(_=te&~D,_!==0?A=Ee(_):(j&=te,j!==0?A=Ee(j):g||(g=te&~u,g!==0&&(A=Ee(g))))):(te=_&~D,te!==0?A=Ee(te):j!==0?A=Ee(j):g||(g=_&~u,g!==0&&(A=Ee(g)))),A===0?0:h!==0&&h!==A&&(h&D)===0&&(D=A&-A,g=h&-h,D>=g||D===32&&(g&4194048)!==0)?h:A}function je(u,h){return(u.pendingLanes&~(u.suspendedLanes&~u.pingedLanes)&h)===0}function at(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 yt(){var u=Le;return Le<<=1,(Le&62914560)===0&&(Le=4194304),u}function Ct(u){for(var h=[],g=0;31>g;g++)h.push(u);return h}function tn(u,h){u.pendingLanes|=h,h!==268435456&&(u.suspendedLanes=0,u.pingedLanes=0,u.warmLanes=0)}function Pt(u,h,g,_,A,D){var j=u.pendingLanes;u.pendingLanes=g,u.suspendedLanes=0,u.pingedLanes=0,u.warmLanes=0,u.expiredLanes&=g,u.entangledLanes&=g,u.errorRecoveryDisabledLanes&=g,u.shellSuspendCounter=0;var te=u.entanglements,Se=u.expirationTimes,ze=u.hiddenUpdates;for(g=j&~g;0<g;){var Je=31-et(g),it=1<<Je;te[Je]=0,Se[Je]=-1;var Ve=ze[Je];if(Ve!==null)for(ze[Je]=null,Je=0;Je<Ve.length;Je++){var Ye=Ve[Je];Ye!==null&&(Ye.lane&=-536870913)}g&=~it}_!==0&&wn(u,_,0),D!==0&&A===0&&u.tag!==0&&(u.suspendedLanes|=D&~(j&~h))}function wn(u,h,g){u.pendingLanes|=h,u.suspendedLanes&=~h;var _=31-et(h);u.entangledLanes|=h,u.entanglements[_]=u.entanglements[_]|1073741824|g&261930}function zn(u,h){var g=u.entangledLanes|=h;for(u=u.entanglements;g;){var _=31-et(g),A=1<<_;A&h|u[_]&h&&(u[_]|=h),g&=~A}}function ur(u,h){var g=h&-h;return g=(g&42)!==0?1:Xi(g),(g&(u.suspendedLanes|h))!==0?0:g}function Xi(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 dr(u){return u&=-u,2<u?8<u?(u&134217727)!==0?32:268435456:8:2}function Ar(){var u=G.p;return u!==0?u:(u=window.event,u===void 0?32:NU(u.type))}function Vr(u,h){var g=G.p;try{return G.p=u,h()}finally{G.p=g}}var Di=Math.random().toString(36).slice(2),si="__reactFiber$"+Di,wi="__reactProps$"+Di,$s="__reactContainer$"+Di,gc="__reactEvents$"+Di,oe="__reactListeners$"+Di,Ie="__reactHandles$"+Di,qe="__reactResources$"+Di,Xe="__reactMarker$"+Di;function We(u){delete u[si],delete u[wi],delete u[gc],delete u[oe],delete u[Ie]}function bt(u){var h=u[si];if(h)return h;for(var g=u.parentNode;g;){if(h=g[$s]||g[si]){if(g=h.alternate,h.child!==null||g!==null&&g.child!==null)for(u=pU(u);u!==null;){if(g=u[si])return g;u=pU(u)}return h}u=g,g=u.parentNode}return null}function Z(u){if(u=u[si]||u[$s]){var h=u.tag;if(h===5||h===6||h===13||h===31||h===26||h===27||h===3)return u}return null}function _e(u){var h=u.tag;if(h===5||h===26||h===27||h===6)return u.stateNode;throw Error(i(33))}function Ne(u){var h=u[qe];return h||(h=u[qe]={hoistableStyles:new Map,hoistableScripts:new Map}),h}function Re(u){u[Xe]=!0}var Me=new Set,Ze={};function ot(u,h){mt(u,h),mt(u+"Capture",h)}function mt(u,h){for(Ze[u]=h,u=0;u<h.length;u++)Me.add(h[u])}var pt=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={},St={};function ft(u){return ae.call(St,u)?!0:ae.call(Rt,u)?!1:pt.test(u)?St[u]=!0:(Rt[u]=!0,!1)}function jt(u,h,g){if(ft(h))if(g===null)u.removeAttribute(h);else{switch(typeof g){case"undefined":case"function":case"symbol":u.removeAttribute(h);return;case"boolean":var _=h.toLowerCase().slice(0,5);if(_!=="data-"&&_!=="aria-"){u.removeAttribute(h);return}}u.setAttribute(h,""+g)}}function Ot(u,h,g){if(g===null)u.removeAttribute(h);else{switch(typeof g){case"undefined":case"function":case"symbol":case"boolean":u.removeAttribute(h);return}u.setAttribute(h,""+g)}}function Yt(u,h,g,_){if(_===null)u.removeAttribute(g);else{switch(typeof _){case"undefined":case"function":case"symbol":case"boolean":u.removeAttribute(g);return}u.setAttributeNS(h,g,""+_)}}function rn(u){switch(typeof u){case"bigint":case"boolean":case"number":case"string":case"undefined":return u;case"object":return u;default:return""}}function cn(u){var h=u.type;return(u=u.nodeName)&&u.toLowerCase()==="input"&&(h==="checkbox"||h==="radio")}function Dt(u,h,g){var _=Object.getOwnPropertyDescriptor(u.constructor.prototype,h);if(!u.hasOwnProperty(h)&&typeof _<"u"&&typeof _.get=="function"&&typeof _.set=="function"){var A=_.get,D=_.set;return Object.defineProperty(u,h,{configurable:!0,get:function(){return A.call(this)},set:function(j){g=""+j,D.call(this,j)}}),Object.defineProperty(u,h,{enumerable:_.enumerable}),{getValue:function(){return g},setValue:function(j){g=""+j},stopTracking:function(){u._valueTracker=null,delete u[h]}}}}function Gt(u){if(!u._valueTracker){var h=cn(u)?"checked":"value";u._valueTracker=Dt(u,h,""+u[h])}}function Wt(u){if(!u)return!1;var h=u._valueTracker;if(!h)return!0;var g=h.getValue(),_="";return u&&(_=cn(u)?u.checked?"true":"false":u.value),u=_,u!==g?(h.setValue(u),!0):!1}function hi(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 Mi=/[\n"\\]/g;function Sn(u){return u.replace(Mi,function(h){return"\\"+h.charCodeAt(0).toString(16)+" "})}function Ws(u,h,g,_,A,D,j,te){u.name="",j!=null&&typeof j!="function"&&typeof j!="symbol"&&typeof j!="boolean"?u.type=j:u.removeAttribute("type"),h!=null?j==="number"?(h===0&&u.value===""||u.value!=h)&&(u.value=""+rn(h)):u.value!==""+rn(h)&&(u.value=""+rn(h)):j!=="submit"&&j!=="reset"||u.removeAttribute("value"),h!=null?fr(u,j,rn(h)):g!=null?fr(u,j,rn(g)):_!=null&&u.removeAttribute("value"),A==null&&D!=null&&(u.defaultChecked=!!D),A!=null&&(u.checked=A&&typeof A!="function"&&typeof A!="symbol"),te!=null&&typeof te!="function"&&typeof te!="symbol"&&typeof te!="boolean"?u.name=""+rn(te):u.removeAttribute("name")}function Mn(u,h,g,_,A,D,j,te){if(D!=null&&typeof D!="function"&&typeof D!="symbol"&&typeof D!="boolean"&&(u.type=D),h!=null||g!=null){if(!(D!=="submit"&&D!=="reset"||h!=null)){Gt(u);return}g=g!=null?""+rn(g):"",h=h!=null?""+rn(h):g,te||h===u.value||(u.value=h),u.defaultValue=h}_=_??A,_=typeof _!="function"&&typeof _!="symbol"&&!!_,u.checked=te?u.checked:!!_,u.defaultChecked=!!_,j!=null&&typeof j!="function"&&typeof j!="symbol"&&typeof j!="boolean"&&(u.name=j),Gt(u)}function fr(u,h,g){h==="number"&&hi(u.ownerDocument)===u||u.defaultValue===""+g||(u.defaultValue=""+g)}function Yi(u,h,g,_){if(u=u.options,h){h={};for(var A=0;A<g.length;A++)h["$"+g[A]]=!0;for(g=0;g<u.length;g++)A=h.hasOwnProperty("$"+u[g].value),u[g].selected!==A&&(u[g].selected=A),A&&_&&(u[g].defaultSelected=!0)}else{for(g=""+rn(g),h=null,A=0;A<u.length;A++){if(u[A].value===g){u[A].selected=!0,_&&(u[A].defaultSelected=!0);return}h!==null||u[A].disabled||(h=u[A])}h!==null&&(h.selected=!0)}}function hr(u,h,g){if(h!=null&&(h=""+rn(h),h!==u.value&&(u.value=h),g==null)){u.defaultValue!==h&&(u.defaultValue=h);return}u.defaultValue=g!=null?""+rn(g):""}function Tr(u,h,g,_){if(h==null){if(_!=null){if(g!=null)throw Error(i(92));if($(_)){if(1<_.length)throw Error(i(93));_=_[0]}g=_}g==null&&(g=""),h=g}g=rn(h),u.defaultValue=g,_=u.textContent,_===g&&_!==""&&_!==null&&(u.value=_),Gt(u)}function yo(u,h){if(h){var g=u.firstChild;if(g&&g===u.lastChild&&g.nodeType===3){g.nodeValue=h;return}}u.textContent=h}var Ko=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 iL(u,h,g){var _=h.indexOf("--")===0;g==null||typeof g=="boolean"||g===""?_?u.setProperty(h,""):h==="float"?u.cssFloat="":u[h]="":_?u.setProperty(h,g):typeof g!="number"||g===0||Ko.has(h)?h==="float"?u.cssFloat=g:u[h]=(""+g).trim():u[h]=g+"px"}function rL(u,h,g){if(h!=null&&typeof h!="object")throw Error(i(62));if(u=u.style,g!=null){for(var _ in g)!g.hasOwnProperty(_)||h!=null&&h.hasOwnProperty(_)||(_.indexOf("--")===0?u.setProperty(_,""):_==="float"?u.cssFloat="":u[_]="");for(var A in h)_=h[A],h.hasOwnProperty(A)&&g[A]!==_&&iL(u,A,_)}else for(var D in h)h.hasOwnProperty(D)&&iL(u,D,h[D])}function Aw(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 ZZ=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"]]),JZ=/^[\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 Bv(u){return JZ.test(""+u)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":u}function Zo(){}var Tw=null;function Cw(u){return u=u.target||u.srcElement||window,u.correspondingUseElement&&(u=u.correspondingUseElement),u.nodeType===3?u.parentNode:u}var Nf=null,Pf=null;function aL(u){var h=Z(u);if(h&&(u=h.stateNode)){var g=u[wi]||null;e:switch(u=h.stateNode,h.type){case"input":if(Ws(u,g.value,g.defaultValue,g.defaultValue,g.checked,g.defaultChecked,g.type,g.name),h=g.name,g.type==="radio"&&h!=null){for(g=u;g.parentNode;)g=g.parentNode;for(g=g.querySelectorAll('input[name="'+Sn(""+h)+'"][type="radio"]'),h=0;h<g.length;h++){var _=g[h];if(_!==u&&_.form===u.form){var A=_[wi]||null;if(!A)throw Error(i(90));Ws(_,A.value,A.defaultValue,A.defaultValue,A.checked,A.defaultChecked,A.type,A.name)}}for(h=0;h<g.length;h++)_=g[h],_.form===u.form&&Wt(_)}break e;case"textarea":hr(u,g.value,g.defaultValue);break e;case"select":h=g.value,h!=null&&Yi(u,!!g.multiple,h,!1)}}}var Rw=!1;function sL(u,h,g){if(Rw)return u(h,g);Rw=!0;try{var _=u(h);return _}finally{if(Rw=!1,(Nf!==null||Pf!==null)&&(Tx(),Nf&&(h=Nf,u=Pf,Pf=Nf=null,aL(h),u)))for(h=0;h<u.length;h++)aL(u[h])}}function mm(u,h){var g=u.stateNode;if(g===null)return null;var _=g[wi]||null;if(_===null)return null;g=_[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":(_=!_.disabled)||(u=u.type,_=!(u==="button"||u==="input"||u==="select"||u==="textarea")),u=!_;break e;default:u=!1}if(u)return null;if(g&&typeof g!="function")throw Error(i(231,h,typeof g));return g}var Jo=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Nw=!1;if(Jo)try{var gm={};Object.defineProperty(gm,"passive",{get:function(){Nw=!0}}),window.addEventListener("test",gm,gm),window.removeEventListener("test",gm,gm)}catch{Nw=!1}var vc=null,Pw=null,jv=null;function oL(){if(jv)return jv;var u,h=Pw,g=h.length,_,A="value"in vc?vc.value:vc.textContent,D=A.length;for(u=0;u<g&&h[u]===A[u];u++);var j=g-u;for(_=1;_<=j&&h[g-_]===A[D-_];_++);return jv=A.slice(u,1<_?1-_:void 0)}function Hv(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 Vv(){return!0}function lL(){return!1}function ya(u){function h(g,_,A,D,j){this._reactName=g,this._targetInst=A,this.type=_,this.nativeEvent=D,this.target=j,this.currentTarget=null;for(var te in u)u.hasOwnProperty(te)&&(g=u[te],this[te]=g?g(D):D[te]);return this.isDefaultPrevented=(D.defaultPrevented!=null?D.defaultPrevented:D.returnValue===!1)?Vv:lL,this.isPropagationStopped=lL,this}return f(h.prototype,{preventDefault:function(){this.defaultPrevented=!0;var g=this.nativeEvent;g&&(g.preventDefault?g.preventDefault():typeof g.returnValue!="unknown"&&(g.returnValue=!1),this.isDefaultPrevented=Vv)},stopPropagation:function(){var g=this.nativeEvent;g&&(g.stopPropagation?g.stopPropagation():typeof g.cancelBubble!="unknown"&&(g.cancelBubble=!0),this.isPropagationStopped=Vv)},persist:function(){},isPersistent:Vv}),h}var Wu={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(u){return u.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Gv=ya(Wu),vm=f({},Wu,{view:0,detail:0}),QZ=ya(vm),Dw,Ow,xm,$v=f({},vm,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:kw,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!==xm&&(xm&&u.type==="mousemove"?(Dw=u.screenX-xm.screenX,Ow=u.screenY-xm.screenY):Ow=Dw=0,xm=u),Dw)},movementY:function(u){return"movementY"in u?u.movementY:Ow}}),cL=ya($v),eJ=f({},$v,{dataTransfer:0}),tJ=ya(eJ),nJ=f({},vm,{relatedTarget:0}),Lw=ya(nJ),iJ=f({},Wu,{animationName:0,elapsedTime:0,pseudoElement:0}),rJ=ya(iJ),aJ=f({},Wu,{clipboardData:function(u){return"clipboardData"in u?u.clipboardData:window.clipboardData}}),sJ=ya(aJ),oJ=f({},Wu,{data:0}),uL=ya(oJ),lJ={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},cJ={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"},uJ={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function dJ(u){var h=this.nativeEvent;return h.getModifierState?h.getModifierState(u):(u=uJ[u])?!!h[u]:!1}function kw(){return dJ}var fJ=f({},vm,{key:function(u){if(u.key){var h=lJ[u.key]||u.key;if(h!=="Unidentified")return h}return u.type==="keypress"?(u=Hv(u),u===13?"Enter":String.fromCharCode(u)):u.type==="keydown"||u.type==="keyup"?cJ[u.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:kw,charCode:function(u){return u.type==="keypress"?Hv(u):0},keyCode:function(u){return u.type==="keydown"||u.type==="keyup"?u.keyCode:0},which:function(u){return u.type==="keypress"?Hv(u):u.type==="keydown"||u.type==="keyup"?u.keyCode:0}}),hJ=ya(fJ),pJ=f({},$v,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),dL=ya(pJ),mJ=f({},vm,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:kw}),gJ=ya(mJ),vJ=f({},Wu,{propertyName:0,elapsedTime:0,pseudoElement:0}),xJ=ya(vJ),yJ=f({},$v,{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}),bJ=ya(yJ),_J=f({},Wu,{newState:0,oldState:0}),SJ=ya(_J),wJ=[9,13,27,32],Iw=Jo&&"CompositionEvent"in window,ym=null;Jo&&"documentMode"in document&&(ym=document.documentMode);var MJ=Jo&&"TextEvent"in window&&!ym,fL=Jo&&(!Iw||ym&&8<ym&&11>=ym),hL=" ",pL=!1;function mL(u,h){switch(u){case"keyup":return wJ.indexOf(h.keyCode)!==-1;case"keydown":return h.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function gL(u){return u=u.detail,typeof u=="object"&&"data"in u?u.data:null}var Df=!1;function EJ(u,h){switch(u){case"compositionend":return gL(h);case"keypress":return h.which!==32?null:(pL=!0,hL);case"textInput":return u=h.data,u===hL&&pL?null:u;default:return null}}function AJ(u,h){if(Df)return u==="compositionend"||!Iw&&mL(u,h)?(u=oL(),jv=Pw=vc=null,Df=!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 fL&&h.locale!=="ko"?null:h.data;default:return null}}var TJ={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 vL(u){var h=u&&u.nodeName&&u.nodeName.toLowerCase();return h==="input"?!!TJ[u.type]:h==="textarea"}function xL(u,h,g,_){Nf?Pf?Pf.push(_):Pf=[_]:Nf=_,h=Lx(h,"onChange"),0<h.length&&(g=new Gv("onChange","change",null,g,_),u.push({event:g,listeners:h}))}var bm=null,_m=null;function CJ(u){eU(u,0)}function Wv(u){var h=_e(u);if(Wt(h))return u}function yL(u,h){if(u==="change")return h}var bL=!1;if(Jo){var Uw;if(Jo){var Fw="oninput"in document;if(!Fw){var _L=document.createElement("div");_L.setAttribute("oninput","return;"),Fw=typeof _L.oninput=="function"}Uw=Fw}else Uw=!1;bL=Uw&&(!document.documentMode||9<document.documentMode)}function SL(){bm&&(bm.detachEvent("onpropertychange",wL),_m=bm=null)}function wL(u){if(u.propertyName==="value"&&Wv(_m)){var h=[];xL(h,_m,u,Cw(u)),sL(CJ,h)}}function RJ(u,h,g){u==="focusin"?(SL(),bm=h,_m=g,bm.attachEvent("onpropertychange",wL)):u==="focusout"&&SL()}function NJ(u){if(u==="selectionchange"||u==="keyup"||u==="keydown")return Wv(_m)}function PJ(u,h){if(u==="click")return Wv(h)}function DJ(u,h){if(u==="input"||u==="change")return Wv(h)}function OJ(u,h){return u===h&&(u!==0||1/u===1/h)||u!==u&&h!==h}var Ba=typeof Object.is=="function"?Object.is:OJ;function Sm(u,h){if(Ba(u,h))return!0;if(typeof u!="object"||u===null||typeof h!="object"||h===null)return!1;var g=Object.keys(u),_=Object.keys(h);if(g.length!==_.length)return!1;for(_=0;_<g.length;_++){var A=g[_];if(!ae.call(h,A)||!Ba(u[A],h[A]))return!1}return!0}function ML(u){for(;u&&u.firstChild;)u=u.firstChild;return u}function EL(u,h){var g=ML(u);u=0;for(var _;g;){if(g.nodeType===3){if(_=u+g.textContent.length,u<=h&&_>=h)return{node:g,offset:h-u};u=_}e:{for(;g;){if(g.nextSibling){g=g.nextSibling;break e}g=g.parentNode}g=void 0}g=ML(g)}}function AL(u,h){return u&&h?u===h?!0:u&&u.nodeType===3?!1:h&&h.nodeType===3?AL(u,h.parentNode):"contains"in u?u.contains(h):u.compareDocumentPosition?!!(u.compareDocumentPosition(h)&16):!1:!1}function TL(u){u=u!=null&&u.ownerDocument!=null&&u.ownerDocument.defaultView!=null?u.ownerDocument.defaultView:window;for(var h=hi(u.document);h instanceof u.HTMLIFrameElement;){try{var g=typeof h.contentWindow.location.href=="string"}catch{g=!1}if(g)u=h.contentWindow;else break;h=hi(u.document)}return h}function zw(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 LJ=Jo&&"documentMode"in document&&11>=document.documentMode,Of=null,Bw=null,wm=null,jw=!1;function CL(u,h,g){var _=g.window===g?g.document:g.nodeType===9?g:g.ownerDocument;jw||Of==null||Of!==hi(_)||(_=Of,"selectionStart"in _&&zw(_)?_={start:_.selectionStart,end:_.selectionEnd}:(_=(_.ownerDocument&&_.ownerDocument.defaultView||window).getSelection(),_={anchorNode:_.anchorNode,anchorOffset:_.anchorOffset,focusNode:_.focusNode,focusOffset:_.focusOffset}),wm&&Sm(wm,_)||(wm=_,_=Lx(Bw,"onSelect"),0<_.length&&(h=new Gv("onSelect","select",null,h,g),u.push({event:h,listeners:_}),h.target=Of)))}function qu(u,h){var g={};return g[u.toLowerCase()]=h.toLowerCase(),g["Webkit"+u]="webkit"+h,g["Moz"+u]="moz"+h,g}var Lf={animationend:qu("Animation","AnimationEnd"),animationiteration:qu("Animation","AnimationIteration"),animationstart:qu("Animation","AnimationStart"),transitionrun:qu("Transition","TransitionRun"),transitionstart:qu("Transition","TransitionStart"),transitioncancel:qu("Transition","TransitionCancel"),transitionend:qu("Transition","TransitionEnd")},Hw={},RL={};Jo&&(RL=document.createElement("div").style,"AnimationEvent"in window||(delete Lf.animationend.animation,delete Lf.animationiteration.animation,delete Lf.animationstart.animation),"TransitionEvent"in window||delete Lf.transitionend.transition);function Xu(u){if(Hw[u])return Hw[u];if(!Lf[u])return u;var h=Lf[u],g;for(g in h)if(h.hasOwnProperty(g)&&g in RL)return Hw[u]=h[g];return u}var NL=Xu("animationend"),PL=Xu("animationiteration"),DL=Xu("animationstart"),kJ=Xu("transitionrun"),IJ=Xu("transitionstart"),UJ=Xu("transitioncancel"),OL=Xu("transitionend"),LL=new Map,Vw="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(" ");Vw.push("scrollEnd");function qs(u,h){LL.set(u,h),ot(h,[u])}var qv=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)},cs=[],kf=0,Gw=0;function Xv(){for(var u=kf,h=Gw=kf=0;h<u;){var g=cs[h];cs[h++]=null;var _=cs[h];cs[h++]=null;var A=cs[h];cs[h++]=null;var D=cs[h];if(cs[h++]=null,_!==null&&A!==null){var j=_.pending;j===null?A.next=A:(A.next=j.next,j.next=A),_.pending=A}D!==0&&kL(g,A,D)}}function Yv(u,h,g,_){cs[kf++]=u,cs[kf++]=h,cs[kf++]=g,cs[kf++]=_,Gw|=_,u.lanes|=_,u=u.alternate,u!==null&&(u.lanes|=_)}function $w(u,h,g,_){return Yv(u,h,g,_),Kv(u)}function Yu(u,h){return Yv(u,null,null,h),Kv(u)}function kL(u,h,g){u.lanes|=g;var _=u.alternate;_!==null&&(_.lanes|=g);for(var A=!1,D=u.return;D!==null;)D.childLanes|=g,_=D.alternate,_!==null&&(_.childLanes|=g),D.tag===22&&(u=D.stateNode,u===null||u._visibility&1||(A=!0)),u=D,D=D.return;return u.tag===3?(D=u.stateNode,A&&h!==null&&(A=31-et(g),u=D.hiddenUpdates,_=u[A],_===null?u[A]=[h]:_.push(h),h.lane=g|536870912),D):null}function Kv(u){if(50<$m)throw $m=0,eE=null,Error(i(185));for(var h=u.return;h!==null;)u=h,h=u.return;return u.tag===3?u.stateNode:null}var If={};function FJ(u,h,g,_){this.tag=u,this.key=g,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=_,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function ja(u,h,g,_){return new FJ(u,h,g,_)}function Ww(u){return u=u.prototype,!(!u||!u.isReactComponent)}function Qo(u,h){var g=u.alternate;return g===null?(g=ja(u.tag,h,u.key,u.mode),g.elementType=u.elementType,g.type=u.type,g.stateNode=u.stateNode,g.alternate=u,u.alternate=g):(g.pendingProps=h,g.type=u.type,g.flags=0,g.subtreeFlags=0,g.deletions=null),g.flags=u.flags&65011712,g.childLanes=u.childLanes,g.lanes=u.lanes,g.child=u.child,g.memoizedProps=u.memoizedProps,g.memoizedState=u.memoizedState,g.updateQueue=u.updateQueue,h=u.dependencies,g.dependencies=h===null?null:{lanes:h.lanes,firstContext:h.firstContext},g.sibling=u.sibling,g.index=u.index,g.ref=u.ref,g.refCleanup=u.refCleanup,g}function IL(u,h){u.flags&=65011714;var g=u.alternate;return g===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=g.childLanes,u.lanes=g.lanes,u.child=g.child,u.subtreeFlags=0,u.deletions=null,u.memoizedProps=g.memoizedProps,u.memoizedState=g.memoizedState,u.updateQueue=g.updateQueue,u.type=g.type,h=g.dependencies,u.dependencies=h===null?null:{lanes:h.lanes,firstContext:h.firstContext}),u}function Zv(u,h,g,_,A,D){var j=0;if(_=u,typeof u=="function")Ww(u)&&(j=1);else if(typeof u=="string")j=VQ(u,g,ce.current)?26:u==="html"||u==="head"||u==="body"?27:5;else e:switch(u){case N:return u=ja(31,g,h,A),u.elementType=N,u.lanes=D,u;case b:return Ku(g.children,A,D,h);case x:j=8,A|=24;break;case v:return u=ja(12,g,h,A|2),u.elementType=v,u.lanes=D,u;case T:return u=ja(13,g,h,A),u.elementType=T,u.lanes=D,u;case P:return u=ja(19,g,h,A),u.elementType=P,u.lanes=D,u;default:if(typeof u=="object"&&u!==null)switch(u.$$typeof){case w:j=10;break e;case M:j=9;break e;case E:j=11;break e;case R:j=14;break e;case U:j=16,_=null;break e}j=29,g=Error(i(130,u===null?"null":typeof u,"")),_=null}return h=ja(j,g,h,A),h.elementType=u,h.type=_,h.lanes=D,h}function Ku(u,h,g,_){return u=ja(7,u,_,h),u.lanes=g,u}function qw(u,h,g){return u=ja(6,u,null,h),u.lanes=g,u}function UL(u){var h=ja(18,null,null,0);return h.stateNode=u,h}function Xw(u,h,g){return h=ja(4,u.children!==null?u.children:[],u.key,h),h.lanes=g,h.stateNode={containerInfo:u.containerInfo,pendingChildren:null,implementation:u.implementation},h}var FL=new WeakMap;function us(u,h){if(typeof u=="object"&&u!==null){var g=FL.get(u);return g!==void 0?g:(h={value:u,source:h,stack:ee(h)},FL.set(u,h),h)}return{value:u,source:h,stack:ee(h)}}var Uf=[],Ff=0,Jv=null,Mm=0,ds=[],fs=0,xc=null,bo=1,_o="";function el(u,h){Uf[Ff++]=Mm,Uf[Ff++]=Jv,Jv=u,Mm=h}function zL(u,h,g){ds[fs++]=bo,ds[fs++]=_o,ds[fs++]=xc,xc=u;var _=bo;u=_o;var A=32-et(_)-1;_&=~(1<<A),g+=1;var D=32-et(h)+A;if(30<D){var j=A-A%5;D=(_&(1<<j)-1).toString(32),_>>=j,A-=j,bo=1<<32-et(h)+A|g<<A|_,_o=D+u}else bo=1<<D|g<<A|_,_o=u}function Yw(u){u.return!==null&&(el(u,1),zL(u,1,0))}function Kw(u){for(;u===Jv;)Jv=Uf[--Ff],Uf[Ff]=null,Mm=Uf[--Ff],Uf[Ff]=null;for(;u===xc;)xc=ds[--fs],ds[fs]=null,_o=ds[--fs],ds[fs]=null,bo=ds[--fs],ds[fs]=null}function BL(u,h){ds[fs++]=bo,ds[fs++]=_o,ds[fs++]=xc,bo=h.id,_o=h.overflow,xc=u}var Cr=null,Xn=null,hn=!1,yc=null,hs=!1,Zw=Error(i(519));function bc(u){var h=Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Em(us(h,u)),Zw}function jL(u){var h=u.stateNode,g=u.type,_=u.memoizedProps;switch(h[si]=u,h[wi]=_,g){case"dialog":on("cancel",h),on("close",h);break;case"iframe":case"object":case"embed":on("load",h);break;case"video":case"audio":for(g=0;g<qm.length;g++)on(qm[g],h);break;case"source":on("error",h);break;case"img":case"image":case"link":on("error",h),on("load",h);break;case"details":on("toggle",h);break;case"input":on("invalid",h),Mn(h,_.value,_.defaultValue,_.checked,_.defaultChecked,_.type,_.name,!0);break;case"select":on("invalid",h);break;case"textarea":on("invalid",h),Tr(h,_.value,_.defaultValue,_.children)}g=_.children,typeof g!="string"&&typeof g!="number"&&typeof g!="bigint"||h.textContent===""+g||_.suppressHydrationWarning===!0||rU(h.textContent,g)?(_.popover!=null&&(on("beforetoggle",h),on("toggle",h)),_.onScroll!=null&&on("scroll",h),_.onScrollEnd!=null&&on("scrollend",h),_.onClick!=null&&(h.onclick=Zo),h=!0):h=!1,h||bc(u,!0)}function HL(u){for(Cr=u.return;Cr;)switch(Cr.tag){case 5:case 31:case 13:hs=!1;return;case 27:case 3:hs=!0;return;default:Cr=Cr.return}}function zf(u){if(u!==Cr)return!1;if(!hn)return HL(u),hn=!0,!1;var h=u.tag,g;if((g=h!==3&&h!==27)&&((g=h===5)&&(g=u.type,g=!(g!=="form"&&g!=="button")||mE(u.type,u.memoizedProps)),g=!g),g&&Xn&&bc(u),HL(u),h===13){if(u=u.memoizedState,u=u!==null?u.dehydrated:null,!u)throw Error(i(317));Xn=hU(u)}else if(h===31){if(u=u.memoizedState,u=u!==null?u.dehydrated:null,!u)throw Error(i(317));Xn=hU(u)}else h===27?(h=Xn,Lc(u.type)?(u=bE,bE=null,Xn=u):Xn=h):Xn=Cr?ms(u.stateNode.nextSibling):null;return!0}function Zu(){Xn=Cr=null,hn=!1}function Jw(){var u=yc;return u!==null&&(wa===null?wa=u:wa.push.apply(wa,u),yc=null),u}function Em(u){yc===null?yc=[u]:yc.push(u)}var Qw=H(null),Ju=null,tl=null;function _c(u,h,g){re(Qw,h._currentValue),h._currentValue=g}function nl(u){u._currentValue=Qw.current,X(Qw)}function eM(u,h,g){for(;u!==null;){var _=u.alternate;if((u.childLanes&h)!==h?(u.childLanes|=h,_!==null&&(_.childLanes|=h)):_!==null&&(_.childLanes&h)!==h&&(_.childLanes|=h),u===g)break;u=u.return}}function tM(u,h,g,_){var A=u.child;for(A!==null&&(A.return=u);A!==null;){var D=A.dependencies;if(D!==null){var j=A.child;D=D.firstContext;e:for(;D!==null;){var te=D;D=A;for(var Se=0;Se<h.length;Se++)if(te.context===h[Se]){D.lanes|=g,te=D.alternate,te!==null&&(te.lanes|=g),eM(D.return,g,u),_||(j=null);break e}D=te.next}}else if(A.tag===18){if(j=A.return,j===null)throw Error(i(341));j.lanes|=g,D=j.alternate,D!==null&&(D.lanes|=g),eM(j,g,u),j=null}else j=A.child;if(j!==null)j.return=A;else for(j=A;j!==null;){if(j===u){j=null;break}if(A=j.sibling,A!==null){A.return=j.return,j=A;break}j=j.return}A=j}}function Bf(u,h,g,_){u=null;for(var A=h,D=!1;A!==null;){if(!D){if((A.flags&524288)!==0)D=!0;else if((A.flags&262144)!==0)break}if(A.tag===10){var j=A.alternate;if(j===null)throw Error(i(387));if(j=j.memoizedProps,j!==null){var te=A.type;Ba(A.pendingProps.value,j.value)||(u!==null?u.push(te):u=[te])}}else if(A===be.current){if(j=A.alternate,j===null)throw Error(i(387));j.memoizedState.memoizedState!==A.memoizedState.memoizedState&&(u!==null?u.push(Jm):u=[Jm])}A=A.return}u!==null&&tM(h,u,g,_),h.flags|=262144}function Qv(u){for(u=u.firstContext;u!==null;){if(!Ba(u.context._currentValue,u.memoizedValue))return!0;u=u.next}return!1}function Qu(u){Ju=u,tl=null,u=u.dependencies,u!==null&&(u.firstContext=null)}function Rr(u){return VL(Ju,u)}function ex(u,h){return Ju===null&&Qu(u),VL(u,h)}function VL(u,h){var g=h._currentValue;if(h={context:h,memoizedValue:g,next:null},tl===null){if(u===null)throw Error(i(308));tl=h,u.dependencies={lanes:0,firstContext:h},u.flags|=524288}else tl=tl.next=h;return g}var zJ=typeof AbortController<"u"?AbortController:function(){var u=[],h=this.signal={aborted:!1,addEventListener:function(g,_){u.push(_)}};this.abort=function(){h.aborted=!0,u.forEach(function(g){return g()})}},BJ=t.unstable_scheduleCallback,jJ=t.unstable_NormalPriority,Oi={$$typeof:w,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function nM(){return{controller:new zJ,data:new Map,refCount:0}}function Am(u){u.refCount--,u.refCount===0&&BJ(jJ,function(){u.controller.abort()})}var Tm=null,iM=0,jf=0,Hf=null;function HJ(u,h){if(Tm===null){var g=Tm=[];iM=0,jf=sE(),Hf={status:"pending",value:void 0,then:function(_){g.push(_)}}}return iM++,h.then(GL,GL),h}function GL(){if(--iM===0&&Tm!==null){Hf!==null&&(Hf.status="fulfilled");var u=Tm;Tm=null,jf=0,Hf=null;for(var h=0;h<u.length;h++)(0,u[h])()}}function VJ(u,h){var g=[],_={status:"pending",value:null,reason:null,then:function(A){g.push(A)}};return u.then(function(){_.status="fulfilled",_.value=h;for(var A=0;A<g.length;A++)(0,g[A])(h)},function(A){for(_.status="rejected",_.reason=A,A=0;A<g.length;A++)(0,g[A])(void 0)}),_}var $L=q.S;q.S=function(u,h){CI=k(),typeof h=="object"&&h!==null&&typeof h.then=="function"&&HJ(u,h),$L!==null&&$L(u,h)};var ed=H(null);function rM(){var u=ed.current;return u!==null?u:Bn.pooledCache}function tx(u,h){h===null?re(ed,ed.current):re(ed,h.pool)}function WL(){var u=rM();return u===null?null:{parent:Oi._currentValue,pool:u}}var Vf=Error(i(460)),aM=Error(i(474)),nx=Error(i(542)),ix={then:function(){}};function qL(u){return u=u.status,u==="fulfilled"||u==="rejected"}function XL(u,h,g){switch(g=u[g],g===void 0?u.push(h):g!==h&&(h.then(Zo,Zo),h=g),h.status){case"fulfilled":return h.value;case"rejected":throw u=h.reason,KL(u),u;default:if(typeof h.status=="string")h.then(Zo,Zo);else{if(u=Bn,u!==null&&100<u.shellSuspendCounter)throw Error(i(482));u=h,u.status="pending",u.then(function(_){if(h.status==="pending"){var A=h;A.status="fulfilled",A.value=_}},function(_){if(h.status==="pending"){var A=h;A.status="rejected",A.reason=_}})}switch(h.status){case"fulfilled":return h.value;case"rejected":throw u=h.reason,KL(u),u}throw nd=h,Vf}}function td(u){try{var h=u._init;return h(u._payload)}catch(g){throw g!==null&&typeof g=="object"&&typeof g.then=="function"?(nd=g,Vf):g}}var nd=null;function YL(){if(nd===null)throw Error(i(459));var u=nd;return nd=null,u}function KL(u){if(u===Vf||u===nx)throw Error(i(483))}var Gf=null,Cm=0;function rx(u){var h=Cm;return Cm+=1,Gf===null&&(Gf=[]),XL(Gf,u,h)}function Rm(u,h){h=h.props.ref,u.ref=h!==void 0?h:null}function ax(u,h){throw h.$$typeof===p?Error(i(525)):(u=Object.prototype.toString.call(h),Error(i(31,u==="[object Object]"?"object with keys {"+Object.keys(h).join(", ")+"}":u)))}function ZL(u){function h(Oe,Te){if(u){var Fe=Oe.deletions;Fe===null?(Oe.deletions=[Te],Oe.flags|=16):Fe.push(Te)}}function g(Oe,Te){if(!u)return null;for(;Te!==null;)h(Oe,Te),Te=Te.sibling;return null}function _(Oe){for(var Te=new Map;Oe!==null;)Oe.key!==null?Te.set(Oe.key,Oe):Te.set(Oe.index,Oe),Oe=Oe.sibling;return Te}function A(Oe,Te){return Oe=Qo(Oe,Te),Oe.index=0,Oe.sibling=null,Oe}function D(Oe,Te,Fe){return Oe.index=Fe,u?(Fe=Oe.alternate,Fe!==null?(Fe=Fe.index,Fe<Te?(Oe.flags|=67108866,Te):Fe):(Oe.flags|=67108866,Te)):(Oe.flags|=1048576,Te)}function j(Oe){return u&&Oe.alternate===null&&(Oe.flags|=67108866),Oe}function te(Oe,Te,Fe,nt){return Te===null||Te.tag!==6?(Te=qw(Fe,Oe.mode,nt),Te.return=Oe,Te):(Te=A(Te,Fe),Te.return=Oe,Te)}function Se(Oe,Te,Fe,nt){var Lt=Fe.type;return Lt===b?Je(Oe,Te,Fe.props.children,nt,Fe.key):Te!==null&&(Te.elementType===Lt||typeof Lt=="object"&&Lt!==null&&Lt.$$typeof===U&&td(Lt)===Te.type)?(Te=A(Te,Fe.props),Rm(Te,Fe),Te.return=Oe,Te):(Te=Zv(Fe.type,Fe.key,Fe.props,null,Oe.mode,nt),Rm(Te,Fe),Te.return=Oe,Te)}function ze(Oe,Te,Fe,nt){return Te===null||Te.tag!==4||Te.stateNode.containerInfo!==Fe.containerInfo||Te.stateNode.implementation!==Fe.implementation?(Te=Xw(Fe,Oe.mode,nt),Te.return=Oe,Te):(Te=A(Te,Fe.children||[]),Te.return=Oe,Te)}function Je(Oe,Te,Fe,nt,Lt){return Te===null||Te.tag!==7?(Te=Ku(Fe,Oe.mode,nt,Lt),Te.return=Oe,Te):(Te=A(Te,Fe),Te.return=Oe,Te)}function it(Oe,Te,Fe){if(typeof Te=="string"&&Te!==""||typeof Te=="number"||typeof Te=="bigint")return Te=qw(""+Te,Oe.mode,Fe),Te.return=Oe,Te;if(typeof Te=="object"&&Te!==null){switch(Te.$$typeof){case m:return Fe=Zv(Te.type,Te.key,Te.props,null,Oe.mode,Fe),Rm(Fe,Te),Fe.return=Oe,Fe;case y:return Te=Xw(Te,Oe.mode,Fe),Te.return=Oe,Te;case U:return Te=td(Te),it(Oe,Te,Fe)}if($(Te)||I(Te))return Te=Ku(Te,Oe.mode,Fe,null),Te.return=Oe,Te;if(typeof Te.then=="function")return it(Oe,rx(Te),Fe);if(Te.$$typeof===w)return it(Oe,ex(Oe,Te),Fe);ax(Oe,Te)}return null}function Ve(Oe,Te,Fe,nt){var Lt=Te!==null?Te.key:null;if(typeof Fe=="string"&&Fe!==""||typeof Fe=="number"||typeof Fe=="bigint")return Lt!==null?null:te(Oe,Te,""+Fe,nt);if(typeof Fe=="object"&&Fe!==null){switch(Fe.$$typeof){case m:return Fe.key===Lt?Se(Oe,Te,Fe,nt):null;case y:return Fe.key===Lt?ze(Oe,Te,Fe,nt):null;case U:return Fe=td(Fe),Ve(Oe,Te,Fe,nt)}if($(Fe)||I(Fe))return Lt!==null?null:Je(Oe,Te,Fe,nt,null);if(typeof Fe.then=="function")return Ve(Oe,Te,rx(Fe),nt);if(Fe.$$typeof===w)return Ve(Oe,Te,ex(Oe,Fe),nt);ax(Oe,Fe)}return null}function Ye(Oe,Te,Fe,nt,Lt){if(typeof nt=="string"&&nt!==""||typeof nt=="number"||typeof nt=="bigint")return Oe=Oe.get(Fe)||null,te(Te,Oe,""+nt,Lt);if(typeof nt=="object"&&nt!==null){switch(nt.$$typeof){case m:return Oe=Oe.get(nt.key===null?Fe:nt.key)||null,Se(Te,Oe,nt,Lt);case y:return Oe=Oe.get(nt.key===null?Fe:nt.key)||null,ze(Te,Oe,nt,Lt);case U:return nt=td(nt),Ye(Oe,Te,Fe,nt,Lt)}if($(nt)||I(nt))return Oe=Oe.get(Fe)||null,Je(Te,Oe,nt,Lt,null);if(typeof nt.then=="function")return Ye(Oe,Te,Fe,rx(nt),Lt);if(nt.$$typeof===w)return Ye(Oe,Te,Fe,ex(Te,nt),Lt);ax(Te,nt)}return null}function Tt(Oe,Te,Fe,nt){for(var Lt=null,gn=null,Nt=Te,Xt=Te=0,dn=null;Nt!==null&&Xt<Fe.length;Xt++){Nt.index>Xt?(dn=Nt,Nt=null):dn=Nt.sibling;var vn=Ve(Oe,Nt,Fe[Xt],nt);if(vn===null){Nt===null&&(Nt=dn);break}u&&Nt&&vn.alternate===null&&h(Oe,Nt),Te=D(vn,Te,Xt),gn===null?Lt=vn:gn.sibling=vn,gn=vn,Nt=dn}if(Xt===Fe.length)return g(Oe,Nt),hn&&el(Oe,Xt),Lt;if(Nt===null){for(;Xt<Fe.length;Xt++)Nt=it(Oe,Fe[Xt],nt),Nt!==null&&(Te=D(Nt,Te,Xt),gn===null?Lt=Nt:gn.sibling=Nt,gn=Nt);return hn&&el(Oe,Xt),Lt}for(Nt=_(Nt);Xt<Fe.length;Xt++)dn=Ye(Nt,Oe,Xt,Fe[Xt],nt),dn!==null&&(u&&dn.alternate!==null&&Nt.delete(dn.key===null?Xt:dn.key),Te=D(dn,Te,Xt),gn===null?Lt=dn:gn.sibling=dn,gn=dn);return u&&Nt.forEach(function(zc){return h(Oe,zc)}),hn&&el(Oe,Xt),Lt}function Ft(Oe,Te,Fe,nt){if(Fe==null)throw Error(i(151));for(var Lt=null,gn=null,Nt=Te,Xt=Te=0,dn=null,vn=Fe.next();Nt!==null&&!vn.done;Xt++,vn=Fe.next()){Nt.index>Xt?(dn=Nt,Nt=null):dn=Nt.sibling;var zc=Ve(Oe,Nt,vn.value,nt);if(zc===null){Nt===null&&(Nt=dn);break}u&&Nt&&zc.alternate===null&&h(Oe,Nt),Te=D(zc,Te,Xt),gn===null?Lt=zc:gn.sibling=zc,gn=zc,Nt=dn}if(vn.done)return g(Oe,Nt),hn&&el(Oe,Xt),Lt;if(Nt===null){for(;!vn.done;Xt++,vn=Fe.next())vn=it(Oe,vn.value,nt),vn!==null&&(Te=D(vn,Te,Xt),gn===null?Lt=vn:gn.sibling=vn,gn=vn);return hn&&el(Oe,Xt),Lt}for(Nt=_(Nt);!vn.done;Xt++,vn=Fe.next())vn=Ye(Nt,Oe,Xt,vn.value,nt),vn!==null&&(u&&vn.alternate!==null&&Nt.delete(vn.key===null?Xt:vn.key),Te=D(vn,Te,Xt),gn===null?Lt=vn:gn.sibling=vn,gn=vn);return u&&Nt.forEach(function(eee){return h(Oe,eee)}),hn&&el(Oe,Xt),Lt}function Pn(Oe,Te,Fe,nt){if(typeof Fe=="object"&&Fe!==null&&Fe.type===b&&Fe.key===null&&(Fe=Fe.props.children),typeof Fe=="object"&&Fe!==null){switch(Fe.$$typeof){case m:e:{for(var Lt=Fe.key;Te!==null;){if(Te.key===Lt){if(Lt=Fe.type,Lt===b){if(Te.tag===7){g(Oe,Te.sibling),nt=A(Te,Fe.props.children),nt.return=Oe,Oe=nt;break e}}else if(Te.elementType===Lt||typeof Lt=="object"&&Lt!==null&&Lt.$$typeof===U&&td(Lt)===Te.type){g(Oe,Te.sibling),nt=A(Te,Fe.props),Rm(nt,Fe),nt.return=Oe,Oe=nt;break e}g(Oe,Te);break}else h(Oe,Te);Te=Te.sibling}Fe.type===b?(nt=Ku(Fe.props.children,Oe.mode,nt,Fe.key),nt.return=Oe,Oe=nt):(nt=Zv(Fe.type,Fe.key,Fe.props,null,Oe.mode,nt),Rm(nt,Fe),nt.return=Oe,Oe=nt)}return j(Oe);case y:e:{for(Lt=Fe.key;Te!==null;){if(Te.key===Lt)if(Te.tag===4&&Te.stateNode.containerInfo===Fe.containerInfo&&Te.stateNode.implementation===Fe.implementation){g(Oe,Te.sibling),nt=A(Te,Fe.children||[]),nt.return=Oe,Oe=nt;break e}else{g(Oe,Te);break}else h(Oe,Te);Te=Te.sibling}nt=Xw(Fe,Oe.mode,nt),nt.return=Oe,Oe=nt}return j(Oe);case U:return Fe=td(Fe),Pn(Oe,Te,Fe,nt)}if($(Fe))return Tt(Oe,Te,Fe,nt);if(I(Fe)){if(Lt=I(Fe),typeof Lt!="function")throw Error(i(150));return Fe=Lt.call(Fe),Ft(Oe,Te,Fe,nt)}if(typeof Fe.then=="function")return Pn(Oe,Te,rx(Fe),nt);if(Fe.$$typeof===w)return Pn(Oe,Te,ex(Oe,Fe),nt);ax(Oe,Fe)}return typeof Fe=="string"&&Fe!==""||typeof Fe=="number"||typeof Fe=="bigint"?(Fe=""+Fe,Te!==null&&Te.tag===6?(g(Oe,Te.sibling),nt=A(Te,Fe),nt.return=Oe,Oe=nt):(g(Oe,Te),nt=qw(Fe,Oe.mode,nt),nt.return=Oe,Oe=nt),j(Oe)):g(Oe,Te)}return function(Oe,Te,Fe,nt){try{Cm=0;var Lt=Pn(Oe,Te,Fe,nt);return Gf=null,Lt}catch(Nt){if(Nt===Vf||Nt===nx)throw Nt;var gn=ja(29,Nt,null,Oe.mode);return gn.lanes=nt,gn.return=Oe,gn}finally{}}}var id=ZL(!0),JL=ZL(!1),Sc=!1;function sM(u){u.updateQueue={baseState:u.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function oM(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 wc(u){return{lane:u,tag:0,payload:null,callback:null,next:null}}function Mc(u,h,g){var _=u.updateQueue;if(_===null)return null;if(_=_.shared,(_n&2)!==0){var A=_.pending;return A===null?h.next=h:(h.next=A.next,A.next=h),_.pending=h,h=Kv(u),kL(u,null,g),h}return Yv(u,_,h,g),Kv(u)}function Nm(u,h,g){if(h=h.updateQueue,h!==null&&(h=h.shared,(g&4194048)!==0)){var _=h.lanes;_&=u.pendingLanes,g|=_,h.lanes=g,zn(u,g)}}function lM(u,h){var g=u.updateQueue,_=u.alternate;if(_!==null&&(_=_.updateQueue,g===_)){var A=null,D=null;if(g=g.firstBaseUpdate,g!==null){do{var j={lane:g.lane,tag:g.tag,payload:g.payload,callback:null,next:null};D===null?A=D=j:D=D.next=j,g=g.next}while(g!==null);D===null?A=D=h:D=D.next=h}else A=D=h;g={baseState:_.baseState,firstBaseUpdate:A,lastBaseUpdate:D,shared:_.shared,callbacks:_.callbacks},u.updateQueue=g;return}u=g.lastBaseUpdate,u===null?g.firstBaseUpdate=h:u.next=h,g.lastBaseUpdate=h}var cM=!1;function Pm(){if(cM){var u=Hf;if(u!==null)throw u}}function Dm(u,h,g,_){cM=!1;var A=u.updateQueue;Sc=!1;var D=A.firstBaseUpdate,j=A.lastBaseUpdate,te=A.shared.pending;if(te!==null){A.shared.pending=null;var Se=te,ze=Se.next;Se.next=null,j===null?D=ze:j.next=ze,j=Se;var Je=u.alternate;Je!==null&&(Je=Je.updateQueue,te=Je.lastBaseUpdate,te!==j&&(te===null?Je.firstBaseUpdate=ze:te.next=ze,Je.lastBaseUpdate=Se))}if(D!==null){var it=A.baseState;j=0,Je=ze=Se=null,te=D;do{var Ve=te.lane&-536870913,Ye=Ve!==te.lane;if(Ye?(un&Ve)===Ve:(_&Ve)===Ve){Ve!==0&&Ve===jf&&(cM=!0),Je!==null&&(Je=Je.next={lane:0,tag:te.tag,payload:te.payload,callback:null,next:null});e:{var Tt=u,Ft=te;Ve=h;var Pn=g;switch(Ft.tag){case 1:if(Tt=Ft.payload,typeof Tt=="function"){it=Tt.call(Pn,it,Ve);break e}it=Tt;break e;case 3:Tt.flags=Tt.flags&-65537|128;case 0:if(Tt=Ft.payload,Ve=typeof Tt=="function"?Tt.call(Pn,it,Ve):Tt,Ve==null)break e;it=f({},it,Ve);break e;case 2:Sc=!0}}Ve=te.callback,Ve!==null&&(u.flags|=64,Ye&&(u.flags|=8192),Ye=A.callbacks,Ye===null?A.callbacks=[Ve]:Ye.push(Ve))}else Ye={lane:Ve,tag:te.tag,payload:te.payload,callback:te.callback,next:null},Je===null?(ze=Je=Ye,Se=it):Je=Je.next=Ye,j|=Ve;if(te=te.next,te===null){if(te=A.shared.pending,te===null)break;Ye=te,te=Ye.next,Ye.next=null,A.lastBaseUpdate=Ye,A.shared.pending=null}}while(!0);Je===null&&(Se=it),A.baseState=Se,A.firstBaseUpdate=ze,A.lastBaseUpdate=Je,D===null&&(A.shared.lanes=0),Rc|=j,u.lanes=j,u.memoizedState=it}}function QL(u,h){if(typeof u!="function")throw Error(i(191,u));u.call(h)}function ek(u,h){var g=u.callbacks;if(g!==null)for(u.callbacks=null,u=0;u<g.length;u++)QL(g[u],h)}var $f=H(null),sx=H(0);function tk(u,h){u=dl,re(sx,u),re($f,h),dl=u|h.baseLanes}function uM(){re(sx,dl),re($f,$f.current)}function dM(){dl=sx.current,X($f),X(sx)}var Ha=H(null),ps=null;function Ec(u){var h=u.alternate;re(Ei,Ei.current&1),re(Ha,u),ps===null&&(h===null||$f.current!==null||h.memoizedState!==null)&&(ps=u)}function fM(u){re(Ei,Ei.current),re(Ha,u),ps===null&&(ps=u)}function nk(u){u.tag===22?(re(Ei,Ei.current),re(Ha,u),ps===null&&(ps=u)):Ac()}function Ac(){re(Ei,Ei.current),re(Ha,Ha.current)}function Va(u){X(Ha),ps===u&&(ps=null),X(Ei)}var Ei=H(0);function ox(u){for(var h=u;h!==null;){if(h.tag===13){var g=h.memoizedState;if(g!==null&&(g=g.dehydrated,g===null||xE(g)||yE(g)))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 il=0,qt=null,Rn=null,Li=null,lx=!1,Wf=!1,rd=!1,cx=0,Om=0,qf=null,GJ=0;function pi(){throw Error(i(321))}function hM(u,h){if(h===null)return!1;for(var g=0;g<h.length&&g<u.length;g++)if(!Ba(u[g],h[g]))return!1;return!0}function pM(u,h,g,_,A,D){return il=D,qt=h,h.memoizedState=null,h.updateQueue=null,h.lanes=0,q.H=u===null||u.memoizedState===null?zk:RM,rd=!1,D=g(_,A),rd=!1,Wf&&(D=rk(h,g,_,A)),ik(u),D}function ik(u){q.H=Im;var h=Rn!==null&&Rn.next!==null;if(il=0,Li=Rn=qt=null,lx=!1,Om=0,qf=null,h)throw Error(i(300));u===null||ki||(u=u.dependencies,u!==null&&Qv(u)&&(ki=!0))}function rk(u,h,g,_){qt=u;var A=0;do{if(Wf&&(qf=null),Om=0,Wf=!1,25<=A)throw Error(i(301));if(A+=1,Li=Rn=null,u.updateQueue!=null){var D=u.updateQueue;D.lastEffect=null,D.events=null,D.stores=null,D.memoCache!=null&&(D.memoCache.index=0)}q.H=Bk,D=h(g,_)}while(Wf);return D}function $J(){var u=q.H,h=u.useState()[0];return h=typeof h.then=="function"?Lm(h):h,u=u.useState()[0],(Rn!==null?Rn.memoizedState:null)!==u&&(qt.flags|=1024),h}function mM(){var u=cx!==0;return cx=0,u}function gM(u,h,g){h.updateQueue=u.updateQueue,h.flags&=-2053,u.lanes&=~g}function vM(u){if(lx){for(u=u.memoizedState;u!==null;){var h=u.queue;h!==null&&(h.pending=null),u=u.next}lx=!1}il=0,Li=Rn=qt=null,Wf=!1,Om=cx=0,qf=null}function aa(){var u={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Li===null?qt.memoizedState=Li=u:Li=Li.next=u,Li}function Ai(){if(Rn===null){var u=qt.alternate;u=u!==null?u.memoizedState:null}else u=Rn.next;var h=Li===null?qt.memoizedState:Li.next;if(h!==null)Li=h,Rn=u;else{if(u===null)throw qt.alternate===null?Error(i(467)):Error(i(310));Rn=u,u={memoizedState:Rn.memoizedState,baseState:Rn.baseState,baseQueue:Rn.baseQueue,queue:Rn.queue,next:null},Li===null?qt.memoizedState=Li=u:Li=Li.next=u}return Li}function ux(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Lm(u){var h=Om;return Om+=1,qf===null&&(qf=[]),u=XL(qf,u,h),h=qt,(Li===null?h.memoizedState:Li.next)===null&&(h=h.alternate,q.H=h===null||h.memoizedState===null?zk:RM),u}function dx(u){if(u!==null&&typeof u=="object"){if(typeof u.then=="function")return Lm(u);if(u.$$typeof===w)return Rr(u)}throw Error(i(438,String(u)))}function xM(u){var h=null,g=qt.updateQueue;if(g!==null&&(h=g.memoCache),h==null){var _=qt.alternate;_!==null&&(_=_.updateQueue,_!==null&&(_=_.memoCache,_!=null&&(h={data:_.data.map(function(A){return A.slice()}),index:0})))}if(h==null&&(h={data:[],index:0}),g===null&&(g=ux(),qt.updateQueue=g),g.memoCache=h,g=h.data[h.index],g===void 0)for(g=h.data[h.index]=Array(u),_=0;_<u;_++)g[_]=O;return h.index++,g}function rl(u,h){return typeof h=="function"?h(u):h}function fx(u){var h=Ai();return yM(h,Rn,u)}function yM(u,h,g){var _=u.queue;if(_===null)throw Error(i(311));_.lastRenderedReducer=g;var A=u.baseQueue,D=_.pending;if(D!==null){if(A!==null){var j=A.next;A.next=D.next,D.next=j}h.baseQueue=A=D,_.pending=null}if(D=u.baseState,A===null)u.memoizedState=D;else{h=A.next;var te=j=null,Se=null,ze=h,Je=!1;do{var it=ze.lane&-536870913;if(it!==ze.lane?(un&it)===it:(il&it)===it){var Ve=ze.revertLane;if(Ve===0)Se!==null&&(Se=Se.next={lane:0,revertLane:0,gesture:null,action:ze.action,hasEagerState:ze.hasEagerState,eagerState:ze.eagerState,next:null}),it===jf&&(Je=!0);else if((il&Ve)===Ve){ze=ze.next,Ve===jf&&(Je=!0);continue}else it={lane:0,revertLane:ze.revertLane,gesture:null,action:ze.action,hasEagerState:ze.hasEagerState,eagerState:ze.eagerState,next:null},Se===null?(te=Se=it,j=D):Se=Se.next=it,qt.lanes|=Ve,Rc|=Ve;it=ze.action,rd&&g(D,it),D=ze.hasEagerState?ze.eagerState:g(D,it)}else Ve={lane:it,revertLane:ze.revertLane,gesture:ze.gesture,action:ze.action,hasEagerState:ze.hasEagerState,eagerState:ze.eagerState,next:null},Se===null?(te=Se=Ve,j=D):Se=Se.next=Ve,qt.lanes|=it,Rc|=it;ze=ze.next}while(ze!==null&&ze!==h);if(Se===null?j=D:Se.next=te,!Ba(D,u.memoizedState)&&(ki=!0,Je&&(g=Hf,g!==null)))throw g;u.memoizedState=D,u.baseState=j,u.baseQueue=Se,_.lastRenderedState=D}return A===null&&(_.lanes=0),[u.memoizedState,_.dispatch]}function bM(u){var h=Ai(),g=h.queue;if(g===null)throw Error(i(311));g.lastRenderedReducer=u;var _=g.dispatch,A=g.pending,D=h.memoizedState;if(A!==null){g.pending=null;var j=A=A.next;do D=u(D,j.action),j=j.next;while(j!==A);Ba(D,h.memoizedState)||(ki=!0),h.memoizedState=D,h.baseQueue===null&&(h.baseState=D),g.lastRenderedState=D}return[D,_]}function ak(u,h,g){var _=qt,A=Ai(),D=hn;if(D){if(g===void 0)throw Error(i(407));g=g()}else g=h();var j=!Ba((Rn||A).memoizedState,g);if(j&&(A.memoizedState=g,ki=!0),A=A.queue,wM(lk.bind(null,_,A,u),[u]),A.getSnapshot!==h||j||Li!==null&&Li.memoizedState.tag&1){if(_.flags|=2048,Xf(9,{destroy:void 0},ok.bind(null,_,A,g,h),null),Bn===null)throw Error(i(349));D||(il&127)!==0||sk(_,h,g)}return g}function sk(u,h,g){u.flags|=16384,u={getSnapshot:h,value:g},h=qt.updateQueue,h===null?(h=ux(),qt.updateQueue=h,h.stores=[u]):(g=h.stores,g===null?h.stores=[u]:g.push(u))}function ok(u,h,g,_){h.value=g,h.getSnapshot=_,ck(h)&&uk(u)}function lk(u,h,g){return g(function(){ck(h)&&uk(u)})}function ck(u){var h=u.getSnapshot;u=u.value;try{var g=h();return!Ba(u,g)}catch{return!0}}function uk(u){var h=Yu(u,2);h!==null&&Ma(h,u,2)}function _M(u){var h=aa();if(typeof u=="function"){var g=u;if(u=g(),rd){dt(!0);try{g()}finally{dt(!1)}}}return h.memoizedState=h.baseState=u,h.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:rl,lastRenderedState:u},h}function dk(u,h,g,_){return u.baseState=g,yM(u,Rn,typeof _=="function"?_:rl)}function WJ(u,h,g,_,A){if(mx(u))throw Error(i(485));if(u=h.action,u!==null){var D={payload:A,action:u,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(j){D.listeners.push(j)}};q.T!==null?g(!0):D.isTransition=!1,_(D),g=h.pending,g===null?(D.next=h.pending=D,fk(h,D)):(D.next=g.next,h.pending=g.next=D)}}function fk(u,h){var g=h.action,_=h.payload,A=u.state;if(h.isTransition){var D=q.T,j={};q.T=j;try{var te=g(A,_),Se=q.S;Se!==null&&Se(j,te),hk(u,h,te)}catch(ze){SM(u,h,ze)}finally{D!==null&&j.types!==null&&(D.types=j.types),q.T=D}}else try{D=g(A,_),hk(u,h,D)}catch(ze){SM(u,h,ze)}}function hk(u,h,g){g!==null&&typeof g=="object"&&typeof g.then=="function"?g.then(function(_){pk(u,h,_)},function(_){return SM(u,h,_)}):pk(u,h,g)}function pk(u,h,g){h.status="fulfilled",h.value=g,mk(h),u.state=g,h=u.pending,h!==null&&(g=h.next,g===h?u.pending=null:(g=g.next,h.next=g,fk(u,g)))}function SM(u,h,g){var _=u.pending;if(u.pending=null,_!==null){_=_.next;do h.status="rejected",h.reason=g,mk(h),h=h.next;while(h!==_)}u.action=null}function mk(u){u=u.listeners;for(var h=0;h<u.length;h++)(0,u[h])()}function gk(u,h){return h}function vk(u,h){if(hn){var g=Bn.formState;if(g!==null){e:{var _=qt;if(hn){if(Xn){t:{for(var A=Xn,D=hs;A.nodeType!==8;){if(!D){A=null;break t}if(A=ms(A.nextSibling),A===null){A=null;break t}}D=A.data,A=D==="F!"||D==="F"?A:null}if(A){Xn=ms(A.nextSibling),_=A.data==="F!";break e}}bc(_)}_=!1}_&&(h=g[0])}}return g=aa(),g.memoizedState=g.baseState=h,_={pending:null,lanes:0,dispatch:null,lastRenderedReducer:gk,lastRenderedState:h},g.queue=_,g=Ik.bind(null,qt,_),_.dispatch=g,_=_M(!1),D=CM.bind(null,qt,!1,_.queue),_=aa(),A={state:h,dispatch:null,action:u,pending:null},_.queue=A,g=WJ.bind(null,qt,A,D,g),A.dispatch=g,_.memoizedState=u,[h,g,!1]}function xk(u){var h=Ai();return yk(h,Rn,u)}function yk(u,h,g){if(h=yM(u,h,gk)[0],u=fx(rl)[0],typeof h=="object"&&h!==null&&typeof h.then=="function")try{var _=Lm(h)}catch(j){throw j===Vf?nx:j}else _=h;h=Ai();var A=h.queue,D=A.dispatch;return g!==h.memoizedState&&(qt.flags|=2048,Xf(9,{destroy:void 0},qJ.bind(null,A,g),null)),[_,D,u]}function qJ(u,h){u.action=h}function bk(u){var h=Ai(),g=Rn;if(g!==null)return yk(h,g,u);Ai(),h=h.memoizedState,g=Ai();var _=g.queue.dispatch;return g.memoizedState=u,[h,_,!1]}function Xf(u,h,g,_){return u={tag:u,create:g,deps:_,inst:h,next:null},h=qt.updateQueue,h===null&&(h=ux(),qt.updateQueue=h),g=h.lastEffect,g===null?h.lastEffect=u.next=u:(_=g.next,g.next=u,u.next=_,h.lastEffect=u),u}function _k(){return Ai().memoizedState}function hx(u,h,g,_){var A=aa();qt.flags|=u,A.memoizedState=Xf(1|h,{destroy:void 0},g,_===void 0?null:_)}function px(u,h,g,_){var A=Ai();_=_===void 0?null:_;var D=A.memoizedState.inst;Rn!==null&&_!==null&&hM(_,Rn.memoizedState.deps)?A.memoizedState=Xf(h,D,g,_):(qt.flags|=u,A.memoizedState=Xf(1|h,D,g,_))}function Sk(u,h){hx(8390656,8,u,h)}function wM(u,h){px(2048,8,u,h)}function XJ(u){qt.flags|=4;var h=qt.updateQueue;if(h===null)h=ux(),qt.updateQueue=h,h.events=[u];else{var g=h.events;g===null?h.events=[u]:g.push(u)}}function wk(u){var h=Ai().memoizedState;return XJ({ref:h,nextImpl:u}),function(){if((_n&2)!==0)throw Error(i(440));return h.impl.apply(void 0,arguments)}}function Mk(u,h){return px(4,2,u,h)}function Ek(u,h){return px(4,4,u,h)}function Ak(u,h){if(typeof h=="function"){u=u();var g=h(u);return function(){typeof g=="function"?g():h(null)}}if(h!=null)return u=u(),h.current=u,function(){h.current=null}}function Tk(u,h,g){g=g!=null?g.concat([u]):null,px(4,4,Ak.bind(null,h,u),g)}function MM(){}function Ck(u,h){var g=Ai();h=h===void 0?null:h;var _=g.memoizedState;return h!==null&&hM(h,_[1])?_[0]:(g.memoizedState=[u,h],u)}function Rk(u,h){var g=Ai();h=h===void 0?null:h;var _=g.memoizedState;if(h!==null&&hM(h,_[1]))return _[0];if(_=u(),rd){dt(!0);try{u()}finally{dt(!1)}}return g.memoizedState=[_,h],_}function EM(u,h,g){return g===void 0||(il&1073741824)!==0&&(un&261930)===0?u.memoizedState=h:(u.memoizedState=g,u=NI(),qt.lanes|=u,Rc|=u,g)}function Nk(u,h,g,_){return Ba(g,h)?g:$f.current!==null?(u=EM(u,g,_),Ba(u,h)||(ki=!0),u):(il&42)===0||(il&1073741824)!==0&&(un&261930)===0?(ki=!0,u.memoizedState=g):(u=NI(),qt.lanes|=u,Rc|=u,h)}function Pk(u,h,g,_,A){var D=G.p;G.p=D!==0&&8>D?D:8;var j=q.T,te={};q.T=te,CM(u,!1,h,g);try{var Se=A(),ze=q.S;if(ze!==null&&ze(te,Se),Se!==null&&typeof Se=="object"&&typeof Se.then=="function"){var Je=VJ(Se,_);km(u,h,Je,Wa(u))}else km(u,h,_,Wa(u))}catch(it){km(u,h,{then:function(){},status:"rejected",reason:it},Wa())}finally{G.p=D,j!==null&&te.types!==null&&(j.types=te.types),q.T=j}}function YJ(){}function AM(u,h,g,_){if(u.tag!==5)throw Error(i(476));var A=Dk(u).queue;Pk(u,A,h,Y,g===null?YJ:function(){return Ok(u),g(_)})}function Dk(u){var h=u.memoizedState;if(h!==null)return h;h={memoizedState:Y,baseState:Y,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:rl,lastRenderedState:Y},next:null};var g={};return h.next={memoizedState:g,baseState:g,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:rl,lastRenderedState:g},next:null},u.memoizedState=h,u=u.alternate,u!==null&&(u.memoizedState=h),h}function Ok(u){var h=Dk(u);h.next===null&&(h=u.alternate.memoizedState),km(u,h.next.queue,{},Wa())}function TM(){return Rr(Jm)}function Lk(){return Ai().memoizedState}function kk(){return Ai().memoizedState}function KJ(u){for(var h=u.return;h!==null;){switch(h.tag){case 24:case 3:var g=Wa();u=wc(g);var _=Mc(h,u,g);_!==null&&(Ma(_,h,g),Nm(_,h,g)),h={cache:nM()},u.payload=h;return}h=h.return}}function ZJ(u,h,g){var _=Wa();g={lane:_,revertLane:0,gesture:null,action:g,hasEagerState:!1,eagerState:null,next:null},mx(u)?Uk(h,g):(g=$w(u,h,g,_),g!==null&&(Ma(g,u,_),Fk(g,h,_)))}function Ik(u,h,g){var _=Wa();km(u,h,g,_)}function km(u,h,g,_){var A={lane:_,revertLane:0,gesture:null,action:g,hasEagerState:!1,eagerState:null,next:null};if(mx(u))Uk(h,A);else{var D=u.alternate;if(u.lanes===0&&(D===null||D.lanes===0)&&(D=h.lastRenderedReducer,D!==null))try{var j=h.lastRenderedState,te=D(j,g);if(A.hasEagerState=!0,A.eagerState=te,Ba(te,j))return Yv(u,h,A,0),Bn===null&&Xv(),!1}catch{}finally{}if(g=$w(u,h,A,_),g!==null)return Ma(g,u,_),Fk(g,h,_),!0}return!1}function CM(u,h,g,_){if(_={lane:2,revertLane:sE(),gesture:null,action:_,hasEagerState:!1,eagerState:null,next:null},mx(u)){if(h)throw Error(i(479))}else h=$w(u,g,_,2),h!==null&&Ma(h,u,2)}function mx(u){var h=u.alternate;return u===qt||h!==null&&h===qt}function Uk(u,h){Wf=lx=!0;var g=u.pending;g===null?h.next=h:(h.next=g.next,g.next=h),u.pending=h}function Fk(u,h,g){if((g&4194048)!==0){var _=h.lanes;_&=u.pendingLanes,g|=_,h.lanes=g,zn(u,g)}}var Im={readContext:Rr,use:dx,useCallback:pi,useContext:pi,useEffect:pi,useImperativeHandle:pi,useLayoutEffect:pi,useInsertionEffect:pi,useMemo:pi,useReducer:pi,useRef:pi,useState:pi,useDebugValue:pi,useDeferredValue:pi,useTransition:pi,useSyncExternalStore:pi,useId:pi,useHostTransitionStatus:pi,useFormState:pi,useActionState:pi,useOptimistic:pi,useMemoCache:pi,useCacheRefresh:pi};Im.useEffectEvent=pi;var zk={readContext:Rr,use:dx,useCallback:function(u,h){return aa().memoizedState=[u,h===void 0?null:h],u},useContext:Rr,useEffect:Sk,useImperativeHandle:function(u,h,g){g=g!=null?g.concat([u]):null,hx(4194308,4,Ak.bind(null,h,u),g)},useLayoutEffect:function(u,h){return hx(4194308,4,u,h)},useInsertionEffect:function(u,h){hx(4,2,u,h)},useMemo:function(u,h){var g=aa();h=h===void 0?null:h;var _=u();if(rd){dt(!0);try{u()}finally{dt(!1)}}return g.memoizedState=[_,h],_},useReducer:function(u,h,g){var _=aa();if(g!==void 0){var A=g(h);if(rd){dt(!0);try{g(h)}finally{dt(!1)}}}else A=h;return _.memoizedState=_.baseState=A,u={pending:null,lanes:0,dispatch:null,lastRenderedReducer:u,lastRenderedState:A},_.queue=u,u=u.dispatch=ZJ.bind(null,qt,u),[_.memoizedState,u]},useRef:function(u){var h=aa();return u={current:u},h.memoizedState=u},useState:function(u){u=_M(u);var h=u.queue,g=Ik.bind(null,qt,h);return h.dispatch=g,[u.memoizedState,g]},useDebugValue:MM,useDeferredValue:function(u,h){var g=aa();return EM(g,u,h)},useTransition:function(){var u=_M(!1);return u=Pk.bind(null,qt,u.queue,!0,!1),aa().memoizedState=u,[!1,u]},useSyncExternalStore:function(u,h,g){var _=qt,A=aa();if(hn){if(g===void 0)throw Error(i(407));g=g()}else{if(g=h(),Bn===null)throw Error(i(349));(un&127)!==0||sk(_,h,g)}A.memoizedState=g;var D={value:g,getSnapshot:h};return A.queue=D,Sk(lk.bind(null,_,D,u),[u]),_.flags|=2048,Xf(9,{destroy:void 0},ok.bind(null,_,D,g,h),null),g},useId:function(){var u=aa(),h=Bn.identifierPrefix;if(hn){var g=_o,_=bo;g=(_&~(1<<32-et(_)-1)).toString(32)+g,h="_"+h+"R_"+g,g=cx++,0<g&&(h+="H"+g.toString(32)),h+="_"}else g=GJ++,h="_"+h+"r_"+g.toString(32)+"_";return u.memoizedState=h},useHostTransitionStatus:TM,useFormState:vk,useActionState:vk,useOptimistic:function(u){var h=aa();h.memoizedState=h.baseState=u;var g={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return h.queue=g,h=CM.bind(null,qt,!0,g),g.dispatch=h,[u,h]},useMemoCache:xM,useCacheRefresh:function(){return aa().memoizedState=KJ.bind(null,qt)},useEffectEvent:function(u){var h=aa(),g={impl:u};return h.memoizedState=g,function(){if((_n&2)!==0)throw Error(i(440));return g.impl.apply(void 0,arguments)}}},RM={readContext:Rr,use:dx,useCallback:Ck,useContext:Rr,useEffect:wM,useImperativeHandle:Tk,useInsertionEffect:Mk,useLayoutEffect:Ek,useMemo:Rk,useReducer:fx,useRef:_k,useState:function(){return fx(rl)},useDebugValue:MM,useDeferredValue:function(u,h){var g=Ai();return Nk(g,Rn.memoizedState,u,h)},useTransition:function(){var u=fx(rl)[0],h=Ai().memoizedState;return[typeof u=="boolean"?u:Lm(u),h]},useSyncExternalStore:ak,useId:Lk,useHostTransitionStatus:TM,useFormState:xk,useActionState:xk,useOptimistic:function(u,h){var g=Ai();return dk(g,Rn,u,h)},useMemoCache:xM,useCacheRefresh:kk};RM.useEffectEvent=wk;var Bk={readContext:Rr,use:dx,useCallback:Ck,useContext:Rr,useEffect:wM,useImperativeHandle:Tk,useInsertionEffect:Mk,useLayoutEffect:Ek,useMemo:Rk,useReducer:bM,useRef:_k,useState:function(){return bM(rl)},useDebugValue:MM,useDeferredValue:function(u,h){var g=Ai();return Rn===null?EM(g,u,h):Nk(g,Rn.memoizedState,u,h)},useTransition:function(){var u=bM(rl)[0],h=Ai().memoizedState;return[typeof u=="boolean"?u:Lm(u),h]},useSyncExternalStore:ak,useId:Lk,useHostTransitionStatus:TM,useFormState:bk,useActionState:bk,useOptimistic:function(u,h){var g=Ai();return Rn!==null?dk(g,Rn,u,h):(g.baseState=u,[u,g.queue.dispatch])},useMemoCache:xM,useCacheRefresh:kk};Bk.useEffectEvent=wk;function NM(u,h,g,_){h=u.memoizedState,g=g(_,h),g=g==null?h:f({},h,g),u.memoizedState=g,u.lanes===0&&(u.updateQueue.baseState=g)}var PM={enqueueSetState:function(u,h,g){u=u._reactInternals;var _=Wa(),A=wc(_);A.payload=h,g!=null&&(A.callback=g),h=Mc(u,A,_),h!==null&&(Ma(h,u,_),Nm(h,u,_))},enqueueReplaceState:function(u,h,g){u=u._reactInternals;var _=Wa(),A=wc(_);A.tag=1,A.payload=h,g!=null&&(A.callback=g),h=Mc(u,A,_),h!==null&&(Ma(h,u,_),Nm(h,u,_))},enqueueForceUpdate:function(u,h){u=u._reactInternals;var g=Wa(),_=wc(g);_.tag=2,h!=null&&(_.callback=h),h=Mc(u,_,g),h!==null&&(Ma(h,u,g),Nm(h,u,g))}};function jk(u,h,g,_,A,D,j){return u=u.stateNode,typeof u.shouldComponentUpdate=="function"?u.shouldComponentUpdate(_,D,j):h.prototype&&h.prototype.isPureReactComponent?!Sm(g,_)||!Sm(A,D):!0}function Hk(u,h,g,_){u=h.state,typeof h.componentWillReceiveProps=="function"&&h.componentWillReceiveProps(g,_),typeof h.UNSAFE_componentWillReceiveProps=="function"&&h.UNSAFE_componentWillReceiveProps(g,_),h.state!==u&&PM.enqueueReplaceState(h,h.state,null)}function ad(u,h){var g=h;if("ref"in h){g={};for(var _ in h)_!=="ref"&&(g[_]=h[_])}if(u=u.defaultProps){g===h&&(g=f({},g));for(var A in u)g[A]===void 0&&(g[A]=u[A])}return g}function Vk(u){qv(u)}function Gk(u){console.error(u)}function $k(u){qv(u)}function gx(u,h){try{var g=u.onUncaughtError;g(h.value,{componentStack:h.stack})}catch(_){setTimeout(function(){throw _})}}function Wk(u,h,g){try{var _=u.onCaughtError;_(g.value,{componentStack:g.stack,errorBoundary:h.tag===1?h.stateNode:null})}catch(A){setTimeout(function(){throw A})}}function DM(u,h,g){return g=wc(g),g.tag=3,g.payload={element:null},g.callback=function(){gx(u,h)},g}function qk(u){return u=wc(u),u.tag=3,u}function Xk(u,h,g,_){var A=g.type.getDerivedStateFromError;if(typeof A=="function"){var D=_.value;u.payload=function(){return A(D)},u.callback=function(){Wk(h,g,_)}}var j=g.stateNode;j!==null&&typeof j.componentDidCatch=="function"&&(u.callback=function(){Wk(h,g,_),typeof A!="function"&&(Nc===null?Nc=new Set([this]):Nc.add(this));var te=_.stack;this.componentDidCatch(_.value,{componentStack:te!==null?te:""})})}function JJ(u,h,g,_,A){if(g.flags|=32768,_!==null&&typeof _=="object"&&typeof _.then=="function"){if(h=g.alternate,h!==null&&Bf(h,g,A,!0),g=Ha.current,g!==null){switch(g.tag){case 31:case 13:return ps===null?Cx():g.alternate===null&&mi===0&&(mi=3),g.flags&=-257,g.flags|=65536,g.lanes=A,_===ix?g.flags|=16384:(h=g.updateQueue,h===null?g.updateQueue=new Set([_]):h.add(_),iE(u,_,A)),!1;case 22:return g.flags|=65536,_===ix?g.flags|=16384:(h=g.updateQueue,h===null?(h={transitions:null,markerInstances:null,retryQueue:new Set([_])},g.updateQueue=h):(g=h.retryQueue,g===null?h.retryQueue=new Set([_]):g.add(_)),iE(u,_,A)),!1}throw Error(i(435,g.tag))}return iE(u,_,A),Cx(),!1}if(hn)return h=Ha.current,h!==null?((h.flags&65536)===0&&(h.flags|=256),h.flags|=65536,h.lanes=A,_!==Zw&&(u=Error(i(422),{cause:_}),Em(us(u,g)))):(_!==Zw&&(h=Error(i(423),{cause:_}),Em(us(h,g))),u=u.current.alternate,u.flags|=65536,A&=-A,u.lanes|=A,_=us(_,g),A=DM(u.stateNode,_,A),lM(u,A),mi!==4&&(mi=2)),!1;var D=Error(i(520),{cause:_});if(D=us(D,g),Gm===null?Gm=[D]:Gm.push(D),mi!==4&&(mi=2),h===null)return!0;_=us(_,g),g=h;do{switch(g.tag){case 3:return g.flags|=65536,u=A&-A,g.lanes|=u,u=DM(g.stateNode,_,u),lM(g,u),!1;case 1:if(h=g.type,D=g.stateNode,(g.flags&128)===0&&(typeof h.getDerivedStateFromError=="function"||D!==null&&typeof D.componentDidCatch=="function"&&(Nc===null||!Nc.has(D))))return g.flags|=65536,A&=-A,g.lanes|=A,A=qk(A),Xk(A,u,g,_),lM(g,A),!1}g=g.return}while(g!==null);return!1}var OM=Error(i(461)),ki=!1;function Nr(u,h,g,_){h.child=u===null?JL(h,null,g,_):id(h,u.child,g,_)}function Yk(u,h,g,_,A){g=g.render;var D=h.ref;if("ref"in _){var j={};for(var te in _)te!=="ref"&&(j[te]=_[te])}else j=_;return Qu(h),_=pM(u,h,g,j,D,A),te=mM(),u!==null&&!ki?(gM(u,h,A),al(u,h,A)):(hn&&te&&Yw(h),h.flags|=1,Nr(u,h,_,A),h.child)}function Kk(u,h,g,_,A){if(u===null){var D=g.type;return typeof D=="function"&&!Ww(D)&&D.defaultProps===void 0&&g.compare===null?(h.tag=15,h.type=D,Zk(u,h,D,_,A)):(u=Zv(g.type,null,_,h,h.mode,A),u.ref=h.ref,u.return=h,h.child=u)}if(D=u.child,!jM(u,A)){var j=D.memoizedProps;if(g=g.compare,g=g!==null?g:Sm,g(j,_)&&u.ref===h.ref)return al(u,h,A)}return h.flags|=1,u=Qo(D,_),u.ref=h.ref,u.return=h,h.child=u}function Zk(u,h,g,_,A){if(u!==null){var D=u.memoizedProps;if(Sm(D,_)&&u.ref===h.ref)if(ki=!1,h.pendingProps=_=D,jM(u,A))(u.flags&131072)!==0&&(ki=!0);else return h.lanes=u.lanes,al(u,h,A)}return LM(u,h,g,_,A)}function Jk(u,h,g,_){var A=_.children,D=u!==null?u.memoizedState:null;if(u===null&&h.stateNode===null&&(h.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),_.mode==="hidden"){if((h.flags&128)!==0){if(D=D!==null?D.baseLanes|g:g,u!==null){for(_=h.child=u.child,A=0;_!==null;)A=A|_.lanes|_.childLanes,_=_.sibling;_=A&~D}else _=0,h.child=null;return Qk(u,h,D,g,_)}if((g&536870912)!==0)h.memoizedState={baseLanes:0,cachePool:null},u!==null&&tx(h,D!==null?D.cachePool:null),D!==null?tk(h,D):uM(),nk(h);else return _=h.lanes=536870912,Qk(u,h,D!==null?D.baseLanes|g:g,g,_)}else D!==null?(tx(h,D.cachePool),tk(h,D),Ac(),h.memoizedState=null):(u!==null&&tx(h,null),uM(),Ac());return Nr(u,h,A,g),h.child}function Um(u,h){return u!==null&&u.tag===22||h.stateNode!==null||(h.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),h.sibling}function Qk(u,h,g,_,A){var D=rM();return D=D===null?null:{parent:Oi._currentValue,pool:D},h.memoizedState={baseLanes:g,cachePool:D},u!==null&&tx(h,null),uM(),nk(h),u!==null&&Bf(u,h,_,!0),h.childLanes=A,null}function vx(u,h){return h=yx({mode:h.mode,children:h.children},u.mode),h.ref=u.ref,u.child=h,h.return=u,h}function eI(u,h,g){return id(h,u.child,null,g),u=vx(h,h.pendingProps),u.flags|=2,Va(h),h.memoizedState=null,u}function QJ(u,h,g){var _=h.pendingProps,A=(h.flags&128)!==0;if(h.flags&=-129,u===null){if(hn){if(_.mode==="hidden")return u=vx(h,_),h.lanes=536870912,Um(null,u);if(fM(h),(u=Xn)?(u=fU(u,hs),u=u!==null&&u.data==="&"?u:null,u!==null&&(h.memoizedState={dehydrated:u,treeContext:xc!==null?{id:bo,overflow:_o}:null,retryLane:536870912,hydrationErrors:null},g=UL(u),g.return=h,h.child=g,Cr=h,Xn=null)):u=null,u===null)throw bc(h);return h.lanes=536870912,null}return vx(h,_)}var D=u.memoizedState;if(D!==null){var j=D.dehydrated;if(fM(h),A)if(h.flags&256)h.flags&=-257,h=eI(u,h,g);else if(h.memoizedState!==null)h.child=u.child,h.flags|=128,h=null;else throw Error(i(558));else if(ki||Bf(u,h,g,!1),A=(g&u.childLanes)!==0,ki||A){if(_=Bn,_!==null&&(j=ur(_,g),j!==0&&j!==D.retryLane))throw D.retryLane=j,Yu(u,j),Ma(_,u,j),OM;Cx(),h=eI(u,h,g)}else u=D.treeContext,Xn=ms(j.nextSibling),Cr=h,hn=!0,yc=null,hs=!1,u!==null&&BL(h,u),h=vx(h,_),h.flags|=4096;return h}return u=Qo(u.child,{mode:_.mode,children:_.children}),u.ref=h.ref,h.child=u,u.return=h,u}function xx(u,h){var g=h.ref;if(g===null)u!==null&&u.ref!==null&&(h.flags|=4194816);else{if(typeof g!="function"&&typeof g!="object")throw Error(i(284));(u===null||u.ref!==g)&&(h.flags|=4194816)}}function LM(u,h,g,_,A){return Qu(h),g=pM(u,h,g,_,void 0,A),_=mM(),u!==null&&!ki?(gM(u,h,A),al(u,h,A)):(hn&&_&&Yw(h),h.flags|=1,Nr(u,h,g,A),h.child)}function tI(u,h,g,_,A,D){return Qu(h),h.updateQueue=null,g=rk(h,_,g,A),ik(u),_=mM(),u!==null&&!ki?(gM(u,h,D),al(u,h,D)):(hn&&_&&Yw(h),h.flags|=1,Nr(u,h,g,D),h.child)}function nI(u,h,g,_,A){if(Qu(h),h.stateNode===null){var D=If,j=g.contextType;typeof j=="object"&&j!==null&&(D=Rr(j)),D=new g(_,D),h.memoizedState=D.state!==null&&D.state!==void 0?D.state:null,D.updater=PM,h.stateNode=D,D._reactInternals=h,D=h.stateNode,D.props=_,D.state=h.memoizedState,D.refs={},sM(h),j=g.contextType,D.context=typeof j=="object"&&j!==null?Rr(j):If,D.state=h.memoizedState,j=g.getDerivedStateFromProps,typeof j=="function"&&(NM(h,g,j,_),D.state=h.memoizedState),typeof g.getDerivedStateFromProps=="function"||typeof D.getSnapshotBeforeUpdate=="function"||typeof D.UNSAFE_componentWillMount!="function"&&typeof D.componentWillMount!="function"||(j=D.state,typeof D.componentWillMount=="function"&&D.componentWillMount(),typeof D.UNSAFE_componentWillMount=="function"&&D.UNSAFE_componentWillMount(),j!==D.state&&PM.enqueueReplaceState(D,D.state,null),Dm(h,_,D,A),Pm(),D.state=h.memoizedState),typeof D.componentDidMount=="function"&&(h.flags|=4194308),_=!0}else if(u===null){D=h.stateNode;var te=h.memoizedProps,Se=ad(g,te);D.props=Se;var ze=D.context,Je=g.contextType;j=If,typeof Je=="object"&&Je!==null&&(j=Rr(Je));var it=g.getDerivedStateFromProps;Je=typeof it=="function"||typeof D.getSnapshotBeforeUpdate=="function",te=h.pendingProps!==te,Je||typeof D.UNSAFE_componentWillReceiveProps!="function"&&typeof D.componentWillReceiveProps!="function"||(te||ze!==j)&&Hk(h,D,_,j),Sc=!1;var Ve=h.memoizedState;D.state=Ve,Dm(h,_,D,A),Pm(),ze=h.memoizedState,te||Ve!==ze||Sc?(typeof it=="function"&&(NM(h,g,it,_),ze=h.memoizedState),(Se=Sc||jk(h,g,Se,_,Ve,ze,j))?(Je||typeof D.UNSAFE_componentWillMount!="function"&&typeof D.componentWillMount!="function"||(typeof D.componentWillMount=="function"&&D.componentWillMount(),typeof D.UNSAFE_componentWillMount=="function"&&D.UNSAFE_componentWillMount()),typeof D.componentDidMount=="function"&&(h.flags|=4194308)):(typeof D.componentDidMount=="function"&&(h.flags|=4194308),h.memoizedProps=_,h.memoizedState=ze),D.props=_,D.state=ze,D.context=j,_=Se):(typeof D.componentDidMount=="function"&&(h.flags|=4194308),_=!1)}else{D=h.stateNode,oM(u,h),j=h.memoizedProps,Je=ad(g,j),D.props=Je,it=h.pendingProps,Ve=D.context,ze=g.contextType,Se=If,typeof ze=="object"&&ze!==null&&(Se=Rr(ze)),te=g.getDerivedStateFromProps,(ze=typeof te=="function"||typeof D.getSnapshotBeforeUpdate=="function")||typeof D.UNSAFE_componentWillReceiveProps!="function"&&typeof D.componentWillReceiveProps!="function"||(j!==it||Ve!==Se)&&Hk(h,D,_,Se),Sc=!1,Ve=h.memoizedState,D.state=Ve,Dm(h,_,D,A),Pm();var Ye=h.memoizedState;j!==it||Ve!==Ye||Sc||u!==null&&u.dependencies!==null&&Qv(u.dependencies)?(typeof te=="function"&&(NM(h,g,te,_),Ye=h.memoizedState),(Je=Sc||jk(h,g,Je,_,Ve,Ye,Se)||u!==null&&u.dependencies!==null&&Qv(u.dependencies))?(ze||typeof D.UNSAFE_componentWillUpdate!="function"&&typeof D.componentWillUpdate!="function"||(typeof D.componentWillUpdate=="function"&&D.componentWillUpdate(_,Ye,Se),typeof D.UNSAFE_componentWillUpdate=="function"&&D.UNSAFE_componentWillUpdate(_,Ye,Se)),typeof D.componentDidUpdate=="function"&&(h.flags|=4),typeof D.getSnapshotBeforeUpdate=="function"&&(h.flags|=1024)):(typeof D.componentDidUpdate!="function"||j===u.memoizedProps&&Ve===u.memoizedState||(h.flags|=4),typeof D.getSnapshotBeforeUpdate!="function"||j===u.memoizedProps&&Ve===u.memoizedState||(h.flags|=1024),h.memoizedProps=_,h.memoizedState=Ye),D.props=_,D.state=Ye,D.context=Se,_=Je):(typeof D.componentDidUpdate!="function"||j===u.memoizedProps&&Ve===u.memoizedState||(h.flags|=4),typeof D.getSnapshotBeforeUpdate!="function"||j===u.memoizedProps&&Ve===u.memoizedState||(h.flags|=1024),_=!1)}return D=_,xx(u,h),_=(h.flags&128)!==0,D||_?(D=h.stateNode,g=_&&typeof g.getDerivedStateFromError!="function"?null:D.render(),h.flags|=1,u!==null&&_?(h.child=id(h,u.child,null,A),h.child=id(h,null,g,A)):Nr(u,h,g,A),h.memoizedState=D.state,u=h.child):u=al(u,h,A),u}function iI(u,h,g,_){return Zu(),h.flags|=256,Nr(u,h,g,_),h.child}var kM={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function IM(u){return{baseLanes:u,cachePool:WL()}}function UM(u,h,g){return u=u!==null?u.childLanes&~g:0,h&&(u|=$a),u}function rI(u,h,g){var _=h.pendingProps,A=!1,D=(h.flags&128)!==0,j;if((j=D)||(j=u!==null&&u.memoizedState===null?!1:(Ei.current&2)!==0),j&&(A=!0,h.flags&=-129),j=(h.flags&32)!==0,h.flags&=-33,u===null){if(hn){if(A?Ec(h):Ac(),(u=Xn)?(u=fU(u,hs),u=u!==null&&u.data!=="&"?u:null,u!==null&&(h.memoizedState={dehydrated:u,treeContext:xc!==null?{id:bo,overflow:_o}:null,retryLane:536870912,hydrationErrors:null},g=UL(u),g.return=h,h.child=g,Cr=h,Xn=null)):u=null,u===null)throw bc(h);return yE(u)?h.lanes=32:h.lanes=536870912,null}var te=_.children;return _=_.fallback,A?(Ac(),A=h.mode,te=yx({mode:"hidden",children:te},A),_=Ku(_,A,g,null),te.return=h,_.return=h,te.sibling=_,h.child=te,_=h.child,_.memoizedState=IM(g),_.childLanes=UM(u,j,g),h.memoizedState=kM,Um(null,_)):(Ec(h),FM(h,te))}var Se=u.memoizedState;if(Se!==null&&(te=Se.dehydrated,te!==null)){if(D)h.flags&256?(Ec(h),h.flags&=-257,h=zM(u,h,g)):h.memoizedState!==null?(Ac(),h.child=u.child,h.flags|=128,h=null):(Ac(),te=_.fallback,A=h.mode,_=yx({mode:"visible",children:_.children},A),te=Ku(te,A,g,null),te.flags|=2,_.return=h,te.return=h,_.sibling=te,h.child=_,id(h,u.child,null,g),_=h.child,_.memoizedState=IM(g),_.childLanes=UM(u,j,g),h.memoizedState=kM,h=Um(null,_));else if(Ec(h),yE(te)){if(j=te.nextSibling&&te.nextSibling.dataset,j)var ze=j.dgst;j=ze,_=Error(i(419)),_.stack="",_.digest=j,Em({value:_,source:null,stack:null}),h=zM(u,h,g)}else if(ki||Bf(u,h,g,!1),j=(g&u.childLanes)!==0,ki||j){if(j=Bn,j!==null&&(_=ur(j,g),_!==0&&_!==Se.retryLane))throw Se.retryLane=_,Yu(u,_),Ma(j,u,_),OM;xE(te)||Cx(),h=zM(u,h,g)}else xE(te)?(h.flags|=192,h.child=u.child,h=null):(u=Se.treeContext,Xn=ms(te.nextSibling),Cr=h,hn=!0,yc=null,hs=!1,u!==null&&BL(h,u),h=FM(h,_.children),h.flags|=4096);return h}return A?(Ac(),te=_.fallback,A=h.mode,Se=u.child,ze=Se.sibling,_=Qo(Se,{mode:"hidden",children:_.children}),_.subtreeFlags=Se.subtreeFlags&65011712,ze!==null?te=Qo(ze,te):(te=Ku(te,A,g,null),te.flags|=2),te.return=h,_.return=h,_.sibling=te,h.child=_,Um(null,_),_=h.child,te=u.child.memoizedState,te===null?te=IM(g):(A=te.cachePool,A!==null?(Se=Oi._currentValue,A=A.parent!==Se?{parent:Se,pool:Se}:A):A=WL(),te={baseLanes:te.baseLanes|g,cachePool:A}),_.memoizedState=te,_.childLanes=UM(u,j,g),h.memoizedState=kM,Um(u.child,_)):(Ec(h),g=u.child,u=g.sibling,g=Qo(g,{mode:"visible",children:_.children}),g.return=h,g.sibling=null,u!==null&&(j=h.deletions,j===null?(h.deletions=[u],h.flags|=16):j.push(u)),h.child=g,h.memoizedState=null,g)}function FM(u,h){return h=yx({mode:"visible",children:h},u.mode),h.return=u,u.child=h}function yx(u,h){return u=ja(22,u,null,h),u.lanes=0,u}function zM(u,h,g){return id(h,u.child,null,g),u=FM(h,h.pendingProps.children),u.flags|=2,h.memoizedState=null,u}function aI(u,h,g){u.lanes|=h;var _=u.alternate;_!==null&&(_.lanes|=h),eM(u.return,h,g)}function BM(u,h,g,_,A,D){var j=u.memoizedState;j===null?u.memoizedState={isBackwards:h,rendering:null,renderingStartTime:0,last:_,tail:g,tailMode:A,treeForkCount:D}:(j.isBackwards=h,j.rendering=null,j.renderingStartTime=0,j.last=_,j.tail=g,j.tailMode=A,j.treeForkCount=D)}function sI(u,h,g){var _=h.pendingProps,A=_.revealOrder,D=_.tail;_=_.children;var j=Ei.current,te=(j&2)!==0;if(te?(j=j&1|2,h.flags|=128):j&=1,re(Ei,j),Nr(u,h,_,g),_=hn?Mm:0,!te&&u!==null&&(u.flags&128)!==0)e:for(u=h.child;u!==null;){if(u.tag===13)u.memoizedState!==null&&aI(u,g,h);else if(u.tag===19)aI(u,g,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(A){case"forwards":for(g=h.child,A=null;g!==null;)u=g.alternate,u!==null&&ox(u)===null&&(A=g),g=g.sibling;g=A,g===null?(A=h.child,h.child=null):(A=g.sibling,g.sibling=null),BM(h,!1,A,g,D,_);break;case"backwards":case"unstable_legacy-backwards":for(g=null,A=h.child,h.child=null;A!==null;){if(u=A.alternate,u!==null&&ox(u)===null){h.child=A;break}u=A.sibling,A.sibling=g,g=A,A=u}BM(h,!0,g,null,D,_);break;case"together":BM(h,!1,null,null,void 0,_);break;default:h.memoizedState=null}return h.child}function al(u,h,g){if(u!==null&&(h.dependencies=u.dependencies),Rc|=h.lanes,(g&h.childLanes)===0)if(u!==null){if(Bf(u,h,g,!1),(g&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,g=Qo(u,u.pendingProps),h.child=g,g.return=h;u.sibling!==null;)u=u.sibling,g=g.sibling=Qo(u,u.pendingProps),g.return=h;g.sibling=null}return h.child}function jM(u,h){return(u.lanes&h)!==0?!0:(u=u.dependencies,!!(u!==null&&Qv(u)))}function eQ(u,h,g){switch(h.tag){case 3:De(h,h.stateNode.containerInfo),_c(h,Oi,u.memoizedState.cache),Zu();break;case 27:case 5:Ae(h);break;case 4:De(h,h.stateNode.containerInfo);break;case 10:_c(h,h.type,h.memoizedProps.value);break;case 31:if(h.memoizedState!==null)return h.flags|=128,fM(h),null;break;case 13:var _=h.memoizedState;if(_!==null)return _.dehydrated!==null?(Ec(h),h.flags|=128,null):(g&h.child.childLanes)!==0?rI(u,h,g):(Ec(h),u=al(u,h,g),u!==null?u.sibling:null);Ec(h);break;case 19:var A=(u.flags&128)!==0;if(_=(g&h.childLanes)!==0,_||(Bf(u,h,g,!1),_=(g&h.childLanes)!==0),A){if(_)return sI(u,h,g);h.flags|=128}if(A=h.memoizedState,A!==null&&(A.rendering=null,A.tail=null,A.lastEffect=null),re(Ei,Ei.current),_)break;return null;case 22:return h.lanes=0,Jk(u,h,g,h.pendingProps);case 24:_c(h,Oi,u.memoizedState.cache)}return al(u,h,g)}function oI(u,h,g){if(u!==null)if(u.memoizedProps!==h.pendingProps)ki=!0;else{if(!jM(u,g)&&(h.flags&128)===0)return ki=!1,eQ(u,h,g);ki=(u.flags&131072)!==0}else ki=!1,hn&&(h.flags&1048576)!==0&&zL(h,Mm,h.index);switch(h.lanes=0,h.tag){case 16:e:{var _=h.pendingProps;if(u=td(h.elementType),h.type=u,typeof u=="function")Ww(u)?(_=ad(u,_),h.tag=1,h=nI(null,h,u,_,g)):(h.tag=0,h=LM(null,h,u,_,g));else{if(u!=null){var A=u.$$typeof;if(A===E){h.tag=11,h=Yk(null,h,u,_,g);break e}else if(A===R){h.tag=14,h=Kk(null,h,u,_,g);break e}}throw h=L(u)||u,Error(i(306,h,""))}}return h;case 0:return LM(u,h,h.type,h.pendingProps,g);case 1:return _=h.type,A=ad(_,h.pendingProps),nI(u,h,_,A,g);case 3:e:{if(De(h,h.stateNode.containerInfo),u===null)throw Error(i(387));_=h.pendingProps;var D=h.memoizedState;A=D.element,oM(u,h),Dm(h,_,null,g);var j=h.memoizedState;if(_=j.cache,_c(h,Oi,_),_!==D.cache&&tM(h,[Oi],g,!0),Pm(),_=j.element,D.isDehydrated)if(D={element:_,isDehydrated:!1,cache:j.cache},h.updateQueue.baseState=D,h.memoizedState=D,h.flags&256){h=iI(u,h,_,g);break e}else if(_!==A){A=us(Error(i(424)),h),Em(A),h=iI(u,h,_,g);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(Xn=ms(u.firstChild),Cr=h,hn=!0,yc=null,hs=!0,g=JL(h,null,_,g),h.child=g;g;)g.flags=g.flags&-3|4096,g=g.sibling}else{if(Zu(),_===A){h=al(u,h,g);break e}Nr(u,h,_,g)}h=h.child}return h;case 26:return xx(u,h),u===null?(g=xU(h.type,null,h.pendingProps,null))?h.memoizedState=g:hn||(g=h.type,u=h.pendingProps,_=kx(me.current).createElement(g),_[si]=h,_[wi]=u,Pr(_,g,u),Re(_),h.stateNode=_):h.memoizedState=xU(h.type,u.memoizedProps,h.pendingProps,u.memoizedState),null;case 27:return Ae(h),u===null&&hn&&(_=h.stateNode=mU(h.type,h.pendingProps,me.current),Cr=h,hs=!0,A=Xn,Lc(h.type)?(bE=A,Xn=ms(_.firstChild)):Xn=A),Nr(u,h,h.pendingProps.children,g),xx(u,h),u===null&&(h.flags|=4194304),h.child;case 5:return u===null&&hn&&((A=_=Xn)&&(_=NQ(_,h.type,h.pendingProps,hs),_!==null?(h.stateNode=_,Cr=h,Xn=ms(_.firstChild),hs=!1,A=!0):A=!1),A||bc(h)),Ae(h),A=h.type,D=h.pendingProps,j=u!==null?u.memoizedProps:null,_=D.children,mE(A,D)?_=null:j!==null&&mE(A,j)&&(h.flags|=32),h.memoizedState!==null&&(A=pM(u,h,$J,null,null,g),Jm._currentValue=A),xx(u,h),Nr(u,h,_,g),h.child;case 6:return u===null&&hn&&((u=g=Xn)&&(g=PQ(g,h.pendingProps,hs),g!==null?(h.stateNode=g,Cr=h,Xn=null,u=!0):u=!1),u||bc(h)),null;case 13:return rI(u,h,g);case 4:return De(h,h.stateNode.containerInfo),_=h.pendingProps,u===null?h.child=id(h,null,_,g):Nr(u,h,_,g),h.child;case 11:return Yk(u,h,h.type,h.pendingProps,g);case 7:return Nr(u,h,h.pendingProps,g),h.child;case 8:return Nr(u,h,h.pendingProps.children,g),h.child;case 12:return Nr(u,h,h.pendingProps.children,g),h.child;case 10:return _=h.pendingProps,_c(h,h.type,_.value),Nr(u,h,_.children,g),h.child;case 9:return A=h.type._context,_=h.pendingProps.children,Qu(h),A=Rr(A),_=_(A),h.flags|=1,Nr(u,h,_,g),h.child;case 14:return Kk(u,h,h.type,h.pendingProps,g);case 15:return Zk(u,h,h.type,h.pendingProps,g);case 19:return sI(u,h,g);case 31:return QJ(u,h,g);case 22:return Jk(u,h,g,h.pendingProps);case 24:return Qu(h),_=Rr(Oi),u===null?(A=rM(),A===null&&(A=Bn,D=nM(),A.pooledCache=D,D.refCount++,D!==null&&(A.pooledCacheLanes|=g),A=D),h.memoizedState={parent:_,cache:A},sM(h),_c(h,Oi,A)):((u.lanes&g)!==0&&(oM(u,h),Dm(h,null,null,g),Pm()),A=u.memoizedState,D=h.memoizedState,A.parent!==_?(A={parent:_,cache:_},h.memoizedState=A,h.lanes===0&&(h.memoizedState=h.updateQueue.baseState=A),_c(h,Oi,_)):(_=D.cache,_c(h,Oi,_),_!==A.cache&&tM(h,[Oi],g,!0))),Nr(u,h,h.pendingProps.children,g),h.child;case 29:throw h.pendingProps}throw Error(i(156,h.tag))}function sl(u){u.flags|=4}function HM(u,h,g,_,A){if((h=(u.mode&32)!==0)&&(h=!1),h){if(u.flags|=16777216,(A&335544128)===A)if(u.stateNode.complete)u.flags|=8192;else if(LI())u.flags|=8192;else throw nd=ix,aM}else u.flags&=-16777217}function lI(u,h){if(h.type!=="stylesheet"||(h.state.loading&4)!==0)u.flags&=-16777217;else if(u.flags|=16777216,!wU(h))if(LI())u.flags|=8192;else throw nd=ix,aM}function bx(u,h){h!==null&&(u.flags|=4),u.flags&16384&&(h=u.tag!==22?yt():536870912,u.lanes|=h,Jf|=h)}function Fm(u,h){if(!hn)switch(u.tailMode){case"hidden":h=u.tail;for(var g=null;h!==null;)h.alternate!==null&&(g=h),h=h.sibling;g===null?u.tail=null:g.sibling=null;break;case"collapsed":g=u.tail;for(var _=null;g!==null;)g.alternate!==null&&(_=g),g=g.sibling;_===null?h||u.tail===null?u.tail=null:u.tail.sibling=null:_.sibling=null}}function Yn(u){var h=u.alternate!==null&&u.alternate.child===u.child,g=0,_=0;if(h)for(var A=u.child;A!==null;)g|=A.lanes|A.childLanes,_|=A.subtreeFlags&65011712,_|=A.flags&65011712,A.return=u,A=A.sibling;else for(A=u.child;A!==null;)g|=A.lanes|A.childLanes,_|=A.subtreeFlags,_|=A.flags,A.return=u,A=A.sibling;return u.subtreeFlags|=_,u.childLanes=g,h}function tQ(u,h,g){var _=h.pendingProps;switch(Kw(h),h.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Yn(h),null;case 1:return Yn(h),null;case 3:return g=h.stateNode,_=null,u!==null&&(_=u.memoizedState.cache),h.memoizedState.cache!==_&&(h.flags|=2048),nl(Oi),he(),g.pendingContext&&(g.context=g.pendingContext,g.pendingContext=null),(u===null||u.child===null)&&(zf(h)?sl(h):u===null||u.memoizedState.isDehydrated&&(h.flags&256)===0||(h.flags|=1024,Jw())),Yn(h),null;case 26:var A=h.type,D=h.memoizedState;return u===null?(sl(h),D!==null?(Yn(h),lI(h,D)):(Yn(h),HM(h,A,null,_,g))):D?D!==u.memoizedState?(sl(h),Yn(h),lI(h,D)):(Yn(h),h.flags&=-16777217):(u=u.memoizedProps,u!==_&&sl(h),Yn(h),HM(h,A,u,_,g)),null;case 27:if(Be(h),g=me.current,A=h.type,u!==null&&h.stateNode!=null)u.memoizedProps!==_&&sl(h);else{if(!_){if(h.stateNode===null)throw Error(i(166));return Yn(h),null}u=ce.current,zf(h)?jL(h):(u=mU(A,_,g),h.stateNode=u,sl(h))}return Yn(h),null;case 5:if(Be(h),A=h.type,u!==null&&h.stateNode!=null)u.memoizedProps!==_&&sl(h);else{if(!_){if(h.stateNode===null)throw Error(i(166));return Yn(h),null}if(D=ce.current,zf(h))jL(h);else{var j=kx(me.current);switch(D){case 1:D=j.createElementNS("http://www.w3.org/2000/svg",A);break;case 2:D=j.createElementNS("http://www.w3.org/1998/Math/MathML",A);break;default:switch(A){case"svg":D=j.createElementNS("http://www.w3.org/2000/svg",A);break;case"math":D=j.createElementNS("http://www.w3.org/1998/Math/MathML",A);break;case"script":D=j.createElement("div"),D.innerHTML="<script><\/script>",D=D.removeChild(D.firstChild);break;case"select":D=typeof _.is=="string"?j.createElement("select",{is:_.is}):j.createElement("select"),_.multiple?D.multiple=!0:_.size&&(D.size=_.size);break;default:D=typeof _.is=="string"?j.createElement(A,{is:_.is}):j.createElement(A)}}D[si]=h,D[wi]=_;e:for(j=h.child;j!==null;){if(j.tag===5||j.tag===6)D.appendChild(j.stateNode);else if(j.tag!==4&&j.tag!==27&&j.child!==null){j.child.return=j,j=j.child;continue}if(j===h)break e;for(;j.sibling===null;){if(j.return===null||j.return===h)break e;j=j.return}j.sibling.return=j.return,j=j.sibling}h.stateNode=D;e:switch(Pr(D,A,_),A){case"button":case"input":case"select":case"textarea":_=!!_.autoFocus;break e;case"img":_=!0;break e;default:_=!1}_&&sl(h)}}return Yn(h),HM(h,h.type,u===null?null:u.memoizedProps,h.pendingProps,g),null;case 6:if(u&&h.stateNode!=null)u.memoizedProps!==_&&sl(h);else{if(typeof _!="string"&&h.stateNode===null)throw Error(i(166));if(u=me.current,zf(h)){if(u=h.stateNode,g=h.memoizedProps,_=null,A=Cr,A!==null)switch(A.tag){case 27:case 5:_=A.memoizedProps}u[si]=h,u=!!(u.nodeValue===g||_!==null&&_.suppressHydrationWarning===!0||rU(u.nodeValue,g)),u||bc(h,!0)}else u=kx(u).createTextNode(_),u[si]=h,h.stateNode=u}return Yn(h),null;case 31:if(g=h.memoizedState,u===null||u.memoizedState!==null){if(_=zf(h),g!==null){if(u===null){if(!_)throw Error(i(318));if(u=h.memoizedState,u=u!==null?u.dehydrated:null,!u)throw Error(i(557));u[si]=h}else Zu(),(h.flags&128)===0&&(h.memoizedState=null),h.flags|=4;Yn(h),u=!1}else g=Jw(),u!==null&&u.memoizedState!==null&&(u.memoizedState.hydrationErrors=g),u=!0;if(!u)return h.flags&256?(Va(h),h):(Va(h),null);if((h.flags&128)!==0)throw Error(i(558))}return Yn(h),null;case 13:if(_=h.memoizedState,u===null||u.memoizedState!==null&&u.memoizedState.dehydrated!==null){if(A=zf(h),_!==null&&_.dehydrated!==null){if(u===null){if(!A)throw Error(i(318));if(A=h.memoizedState,A=A!==null?A.dehydrated:null,!A)throw Error(i(317));A[si]=h}else Zu(),(h.flags&128)===0&&(h.memoizedState=null),h.flags|=4;Yn(h),A=!1}else A=Jw(),u!==null&&u.memoizedState!==null&&(u.memoizedState.hydrationErrors=A),A=!0;if(!A)return h.flags&256?(Va(h),h):(Va(h),null)}return Va(h),(h.flags&128)!==0?(h.lanes=g,h):(g=_!==null,u=u!==null&&u.memoizedState!==null,g&&(_=h.child,A=null,_.alternate!==null&&_.alternate.memoizedState!==null&&_.alternate.memoizedState.cachePool!==null&&(A=_.alternate.memoizedState.cachePool.pool),D=null,_.memoizedState!==null&&_.memoizedState.cachePool!==null&&(D=_.memoizedState.cachePool.pool),D!==A&&(_.flags|=2048)),g!==u&&g&&(h.child.flags|=8192),bx(h,h.updateQueue),Yn(h),null);case 4:return he(),u===null&&uE(h.stateNode.containerInfo),Yn(h),null;case 10:return nl(h.type),Yn(h),null;case 19:if(X(Ei),_=h.memoizedState,_===null)return Yn(h),null;if(A=(h.flags&128)!==0,D=_.rendering,D===null)if(A)Fm(_,!1);else{if(mi!==0||u!==null&&(u.flags&128)!==0)for(u=h.child;u!==null;){if(D=ox(u),D!==null){for(h.flags|=128,Fm(_,!1),u=D.updateQueue,h.updateQueue=u,bx(h,u),h.subtreeFlags=0,u=g,g=h.child;g!==null;)IL(g,u),g=g.sibling;return re(Ei,Ei.current&1|2),hn&&el(h,_.treeForkCount),h.child}u=u.sibling}_.tail!==null&&k()>Ex&&(h.flags|=128,A=!0,Fm(_,!1),h.lanes=4194304)}else{if(!A)if(u=ox(D),u!==null){if(h.flags|=128,A=!0,u=u.updateQueue,h.updateQueue=u,bx(h,u),Fm(_,!0),_.tail===null&&_.tailMode==="hidden"&&!D.alternate&&!hn)return Yn(h),null}else 2*k()-_.renderingStartTime>Ex&&g!==536870912&&(h.flags|=128,A=!0,Fm(_,!1),h.lanes=4194304);_.isBackwards?(D.sibling=h.child,h.child=D):(u=_.last,u!==null?u.sibling=D:h.child=D,_.last=D)}return _.tail!==null?(u=_.tail,_.rendering=u,_.tail=u.sibling,_.renderingStartTime=k(),u.sibling=null,g=Ei.current,re(Ei,A?g&1|2:g&1),hn&&el(h,_.treeForkCount),u):(Yn(h),null);case 22:case 23:return Va(h),dM(),_=h.memoizedState!==null,u!==null?u.memoizedState!==null!==_&&(h.flags|=8192):_&&(h.flags|=8192),_?(g&536870912)!==0&&(h.flags&128)===0&&(Yn(h),h.subtreeFlags&6&&(h.flags|=8192)):Yn(h),g=h.updateQueue,g!==null&&bx(h,g.retryQueue),g=null,u!==null&&u.memoizedState!==null&&u.memoizedState.cachePool!==null&&(g=u.memoizedState.cachePool.pool),_=null,h.memoizedState!==null&&h.memoizedState.cachePool!==null&&(_=h.memoizedState.cachePool.pool),_!==g&&(h.flags|=2048),u!==null&&X(ed),null;case 24:return g=null,u!==null&&(g=u.memoizedState.cache),h.memoizedState.cache!==g&&(h.flags|=2048),nl(Oi),Yn(h),null;case 25:return null;case 30:return null}throw Error(i(156,h.tag))}function nQ(u,h){switch(Kw(h),h.tag){case 1:return u=h.flags,u&65536?(h.flags=u&-65537|128,h):null;case 3:return nl(Oi),he(),u=h.flags,(u&65536)!==0&&(u&128)===0?(h.flags=u&-65537|128,h):null;case 26:case 27:case 5:return Be(h),null;case 31:if(h.memoizedState!==null){if(Va(h),h.alternate===null)throw Error(i(340));Zu()}return u=h.flags,u&65536?(h.flags=u&-65537|128,h):null;case 13:if(Va(h),u=h.memoizedState,u!==null&&u.dehydrated!==null){if(h.alternate===null)throw Error(i(340));Zu()}return u=h.flags,u&65536?(h.flags=u&-65537|128,h):null;case 19:return X(Ei),null;case 4:return he(),null;case 10:return nl(h.type),null;case 22:case 23:return Va(h),dM(),u!==null&&X(ed),u=h.flags,u&65536?(h.flags=u&-65537|128,h):null;case 24:return nl(Oi),null;case 25:return null;default:return null}}function cI(u,h){switch(Kw(h),h.tag){case 3:nl(Oi),he();break;case 26:case 27:case 5:Be(h);break;case 4:he();break;case 31:h.memoizedState!==null&&Va(h);break;case 13:Va(h);break;case 19:X(Ei);break;case 10:nl(h.type);break;case 22:case 23:Va(h),dM(),u!==null&&X(ed);break;case 24:nl(Oi)}}function zm(u,h){try{var g=h.updateQueue,_=g!==null?g.lastEffect:null;if(_!==null){var A=_.next;g=A;do{if((g.tag&u)===u){_=void 0;var D=g.create,j=g.inst;_=D(),j.destroy=_}g=g.next}while(g!==A)}}catch(te){An(h,h.return,te)}}function Tc(u,h,g){try{var _=h.updateQueue,A=_!==null?_.lastEffect:null;if(A!==null){var D=A.next;_=D;do{if((_.tag&u)===u){var j=_.inst,te=j.destroy;if(te!==void 0){j.destroy=void 0,A=h;var Se=g,ze=te;try{ze()}catch(Je){An(A,Se,Je)}}}_=_.next}while(_!==D)}}catch(Je){An(h,h.return,Je)}}function uI(u){var h=u.updateQueue;if(h!==null){var g=u.stateNode;try{ek(h,g)}catch(_){An(u,u.return,_)}}}function dI(u,h,g){g.props=ad(u.type,u.memoizedProps),g.state=u.memoizedState;try{g.componentWillUnmount()}catch(_){An(u,h,_)}}function Bm(u,h){try{var g=u.ref;if(g!==null){switch(u.tag){case 26:case 27:case 5:var _=u.stateNode;break;case 30:_=u.stateNode;break;default:_=u.stateNode}typeof g=="function"?u.refCleanup=g(_):g.current=_}}catch(A){An(u,h,A)}}function So(u,h){var g=u.ref,_=u.refCleanup;if(g!==null)if(typeof _=="function")try{_()}catch(A){An(u,h,A)}finally{u.refCleanup=null,u=u.alternate,u!=null&&(u.refCleanup=null)}else if(typeof g=="function")try{g(null)}catch(A){An(u,h,A)}else g.current=null}function fI(u){var h=u.type,g=u.memoizedProps,_=u.stateNode;try{e:switch(h){case"button":case"input":case"select":case"textarea":g.autoFocus&&_.focus();break e;case"img":g.src?_.src=g.src:g.srcSet&&(_.srcset=g.srcSet)}}catch(A){An(u,u.return,A)}}function VM(u,h,g){try{var _=u.stateNode;MQ(_,u.type,g,h),_[wi]=h}catch(A){An(u,u.return,A)}}function hI(u){return u.tag===5||u.tag===3||u.tag===26||u.tag===27&&Lc(u.type)||u.tag===4}function GM(u){e:for(;;){for(;u.sibling===null;){if(u.return===null||hI(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&&Lc(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 $M(u,h,g){var _=u.tag;if(_===5||_===6)u=u.stateNode,h?(g.nodeType===9?g.body:g.nodeName==="HTML"?g.ownerDocument.body:g).insertBefore(u,h):(h=g.nodeType===9?g.body:g.nodeName==="HTML"?g.ownerDocument.body:g,h.appendChild(u),g=g._reactRootContainer,g!=null||h.onclick!==null||(h.onclick=Zo));else if(_!==4&&(_===27&&Lc(u.type)&&(g=u.stateNode,h=null),u=u.child,u!==null))for($M(u,h,g),u=u.sibling;u!==null;)$M(u,h,g),u=u.sibling}function _x(u,h,g){var _=u.tag;if(_===5||_===6)u=u.stateNode,h?g.insertBefore(u,h):g.appendChild(u);else if(_!==4&&(_===27&&Lc(u.type)&&(g=u.stateNode),u=u.child,u!==null))for(_x(u,h,g),u=u.sibling;u!==null;)_x(u,h,g),u=u.sibling}function pI(u){var h=u.stateNode,g=u.memoizedProps;try{for(var _=u.type,A=h.attributes;A.length;)h.removeAttributeNode(A[0]);Pr(h,_,g),h[si]=u,h[wi]=g}catch(D){An(u,u.return,D)}}var ol=!1,Ii=!1,WM=!1,mI=typeof WeakSet=="function"?WeakSet:Set,pr=null;function iQ(u,h){if(u=u.containerInfo,hE=Hx,u=TL(u),zw(u)){if("selectionStart"in u)var g={start:u.selectionStart,end:u.selectionEnd};else e:{g=(g=u.ownerDocument)&&g.defaultView||window;var _=g.getSelection&&g.getSelection();if(_&&_.rangeCount!==0){g=_.anchorNode;var A=_.anchorOffset,D=_.focusNode;_=_.focusOffset;try{g.nodeType,D.nodeType}catch{g=null;break e}var j=0,te=-1,Se=-1,ze=0,Je=0,it=u,Ve=null;t:for(;;){for(var Ye;it!==g||A!==0&&it.nodeType!==3||(te=j+A),it!==D||_!==0&&it.nodeType!==3||(Se=j+_),it.nodeType===3&&(j+=it.nodeValue.length),(Ye=it.firstChild)!==null;)Ve=it,it=Ye;for(;;){if(it===u)break t;if(Ve===g&&++ze===A&&(te=j),Ve===D&&++Je===_&&(Se=j),(Ye=it.nextSibling)!==null)break;it=Ve,Ve=it.parentNode}it=Ye}g=te===-1||Se===-1?null:{start:te,end:Se}}else g=null}g=g||{start:0,end:0}}else g=null;for(pE={focusedElem:u,selectionRange:g},Hx=!1,pr=h;pr!==null;)if(h=pr,u=h.child,(h.subtreeFlags&1028)!==0&&u!==null)u.return=h,pr=u;else for(;pr!==null;){switch(h=pr,D=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(g=0;g<u.length;g++)A=u[g],A.ref.impl=A.nextImpl;break;case 11:case 15:break;case 1:if((u&1024)!==0&&D!==null){u=void 0,g=h,A=D.memoizedProps,D=D.memoizedState,_=g.stateNode;try{var Tt=ad(g.type,A);u=_.getSnapshotBeforeUpdate(Tt,D),_.__reactInternalSnapshotBeforeUpdate=u}catch(Ft){An(g,g.return,Ft)}}break;case 3:if((u&1024)!==0){if(u=h.stateNode.containerInfo,g=u.nodeType,g===9)vE(u);else if(g===1)switch(u.nodeName){case"HEAD":case"HTML":case"BODY":vE(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,pr=u;break}pr=h.return}}function gI(u,h,g){var _=g.flags;switch(g.tag){case 0:case 11:case 15:cl(u,g),_&4&&zm(5,g);break;case 1:if(cl(u,g),_&4)if(u=g.stateNode,h===null)try{u.componentDidMount()}catch(j){An(g,g.return,j)}else{var A=ad(g.type,h.memoizedProps);h=h.memoizedState;try{u.componentDidUpdate(A,h,u.__reactInternalSnapshotBeforeUpdate)}catch(j){An(g,g.return,j)}}_&64&&uI(g),_&512&&Bm(g,g.return);break;case 3:if(cl(u,g),_&64&&(u=g.updateQueue,u!==null)){if(h=null,g.child!==null)switch(g.child.tag){case 27:case 5:h=g.child.stateNode;break;case 1:h=g.child.stateNode}try{ek(u,h)}catch(j){An(g,g.return,j)}}break;case 27:h===null&&_&4&&pI(g);case 26:case 5:cl(u,g),h===null&&_&4&&fI(g),_&512&&Bm(g,g.return);break;case 12:cl(u,g);break;case 31:cl(u,g),_&4&&yI(u,g);break;case 13:cl(u,g),_&4&&bI(u,g),_&64&&(u=g.memoizedState,u!==null&&(u=u.dehydrated,u!==null&&(g=fQ.bind(null,g),DQ(u,g))));break;case 22:if(_=g.memoizedState!==null||ol,!_){h=h!==null&&h.memoizedState!==null||Ii,A=ol;var D=Ii;ol=_,(Ii=h)&&!D?ul(u,g,(g.subtreeFlags&8772)!==0):cl(u,g),ol=A,Ii=D}break;case 30:break;default:cl(u,g)}}function vI(u){var h=u.alternate;h!==null&&(u.alternate=null,vI(h)),u.child=null,u.deletions=null,u.sibling=null,u.tag===5&&(h=u.stateNode,h!==null&&We(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 ni=null,ba=!1;function ll(u,h,g){for(g=g.child;g!==null;)xI(u,h,g),g=g.sibling}function xI(u,h,g){if(Pe&&typeof Pe.onCommitFiberUnmount=="function")try{Pe.onCommitFiberUnmount(Ue,g)}catch{}switch(g.tag){case 26:Ii||So(g,h),ll(u,h,g),g.memoizedState?g.memoizedState.count--:g.stateNode&&(g=g.stateNode,g.parentNode.removeChild(g));break;case 27:Ii||So(g,h);var _=ni,A=ba;Lc(g.type)&&(ni=g.stateNode,ba=!1),ll(u,h,g),Ym(g.stateNode),ni=_,ba=A;break;case 5:Ii||So(g,h);case 6:if(_=ni,A=ba,ni=null,ll(u,h,g),ni=_,ba=A,ni!==null)if(ba)try{(ni.nodeType===9?ni.body:ni.nodeName==="HTML"?ni.ownerDocument.body:ni).removeChild(g.stateNode)}catch(D){An(g,h,D)}else try{ni.removeChild(g.stateNode)}catch(D){An(g,h,D)}break;case 18:ni!==null&&(ba?(u=ni,uU(u.nodeType===9?u.body:u.nodeName==="HTML"?u.ownerDocument.body:u,g.stateNode),sh(u)):uU(ni,g.stateNode));break;case 4:_=ni,A=ba,ni=g.stateNode.containerInfo,ba=!0,ll(u,h,g),ni=_,ba=A;break;case 0:case 11:case 14:case 15:Tc(2,g,h),Ii||Tc(4,g,h),ll(u,h,g);break;case 1:Ii||(So(g,h),_=g.stateNode,typeof _.componentWillUnmount=="function"&&dI(g,h,_)),ll(u,h,g);break;case 21:ll(u,h,g);break;case 22:Ii=(_=Ii)||g.memoizedState!==null,ll(u,h,g),Ii=_;break;default:ll(u,h,g)}}function yI(u,h){if(h.memoizedState===null&&(u=h.alternate,u!==null&&(u=u.memoizedState,u!==null))){u=u.dehydrated;try{sh(u)}catch(g){An(h,h.return,g)}}}function bI(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(g){An(h,h.return,g)}}function rQ(u){switch(u.tag){case 31:case 13:case 19:var h=u.stateNode;return h===null&&(h=u.stateNode=new mI),h;case 22:return u=u.stateNode,h=u._retryCache,h===null&&(h=u._retryCache=new mI),h;default:throw Error(i(435,u.tag))}}function Sx(u,h){var g=rQ(u);h.forEach(function(_){if(!g.has(_)){g.add(_);var A=hQ.bind(null,u,_);_.then(A,A)}})}function _a(u,h){var g=h.deletions;if(g!==null)for(var _=0;_<g.length;_++){var A=g[_],D=u,j=h,te=j;e:for(;te!==null;){switch(te.tag){case 27:if(Lc(te.type)){ni=te.stateNode,ba=!1;break e}break;case 5:ni=te.stateNode,ba=!1;break e;case 3:case 4:ni=te.stateNode.containerInfo,ba=!0;break e}te=te.return}if(ni===null)throw Error(i(160));xI(D,j,A),ni=null,ba=!1,D=A.alternate,D!==null&&(D.return=null),A.return=null}if(h.subtreeFlags&13886)for(h=h.child;h!==null;)_I(h,u),h=h.sibling}var Xs=null;function _I(u,h){var g=u.alternate,_=u.flags;switch(u.tag){case 0:case 11:case 14:case 15:_a(h,u),Sa(u),_&4&&(Tc(3,u,u.return),zm(3,u),Tc(5,u,u.return));break;case 1:_a(h,u),Sa(u),_&512&&(Ii||g===null||So(g,g.return)),_&64&&ol&&(u=u.updateQueue,u!==null&&(_=u.callbacks,_!==null&&(g=u.shared.hiddenCallbacks,u.shared.hiddenCallbacks=g===null?_:g.concat(_))));break;case 26:var A=Xs;if(_a(h,u),Sa(u),_&512&&(Ii||g===null||So(g,g.return)),_&4){var D=g!==null?g.memoizedState:null;if(_=u.memoizedState,g===null)if(_===null)if(u.stateNode===null){e:{_=u.type,g=u.memoizedProps,A=A.ownerDocument||A;t:switch(_){case"title":D=A.getElementsByTagName("title")[0],(!D||D[Xe]||D[si]||D.namespaceURI==="http://www.w3.org/2000/svg"||D.hasAttribute("itemprop"))&&(D=A.createElement(_),A.head.insertBefore(D,A.querySelector("head > title"))),Pr(D,_,g),D[si]=u,Re(D),_=D;break e;case"link":var j=_U("link","href",A).get(_+(g.href||""));if(j){for(var te=0;te<j.length;te++)if(D=j[te],D.getAttribute("href")===(g.href==null||g.href===""?null:g.href)&&D.getAttribute("rel")===(g.rel==null?null:g.rel)&&D.getAttribute("title")===(g.title==null?null:g.title)&&D.getAttribute("crossorigin")===(g.crossOrigin==null?null:g.crossOrigin)){j.splice(te,1);break t}}D=A.createElement(_),Pr(D,_,g),A.head.appendChild(D);break;case"meta":if(j=_U("meta","content",A).get(_+(g.content||""))){for(te=0;te<j.length;te++)if(D=j[te],D.getAttribute("content")===(g.content==null?null:""+g.content)&&D.getAttribute("name")===(g.name==null?null:g.name)&&D.getAttribute("property")===(g.property==null?null:g.property)&&D.getAttribute("http-equiv")===(g.httpEquiv==null?null:g.httpEquiv)&&D.getAttribute("charset")===(g.charSet==null?null:g.charSet)){j.splice(te,1);break t}}D=A.createElement(_),Pr(D,_,g),A.head.appendChild(D);break;default:throw Error(i(468,_))}D[si]=u,Re(D),_=D}u.stateNode=_}else SU(A,u.type,u.stateNode);else u.stateNode=bU(A,_,u.memoizedProps);else D!==_?(D===null?g.stateNode!==null&&(g=g.stateNode,g.parentNode.removeChild(g)):D.count--,_===null?SU(A,u.type,u.stateNode):bU(A,_,u.memoizedProps)):_===null&&u.stateNode!==null&&VM(u,u.memoizedProps,g.memoizedProps)}break;case 27:_a(h,u),Sa(u),_&512&&(Ii||g===null||So(g,g.return)),g!==null&&_&4&&VM(u,u.memoizedProps,g.memoizedProps);break;case 5:if(_a(h,u),Sa(u),_&512&&(Ii||g===null||So(g,g.return)),u.flags&32){A=u.stateNode;try{yo(A,"")}catch(Tt){An(u,u.return,Tt)}}_&4&&u.stateNode!=null&&(A=u.memoizedProps,VM(u,A,g!==null?g.memoizedProps:A)),_&1024&&(WM=!0);break;case 6:if(_a(h,u),Sa(u),_&4){if(u.stateNode===null)throw Error(i(162));_=u.memoizedProps,g=u.stateNode;try{g.nodeValue=_}catch(Tt){An(u,u.return,Tt)}}break;case 3:if(Fx=null,A=Xs,Xs=Ix(h.containerInfo),_a(h,u),Xs=A,Sa(u),_&4&&g!==null&&g.memoizedState.isDehydrated)try{sh(h.containerInfo)}catch(Tt){An(u,u.return,Tt)}WM&&(WM=!1,SI(u));break;case 4:_=Xs,Xs=Ix(u.stateNode.containerInfo),_a(h,u),Sa(u),Xs=_;break;case 12:_a(h,u),Sa(u);break;case 31:_a(h,u),Sa(u),_&4&&(_=u.updateQueue,_!==null&&(u.updateQueue=null,Sx(u,_)));break;case 13:_a(h,u),Sa(u),u.child.flags&8192&&u.memoizedState!==null!=(g!==null&&g.memoizedState!==null)&&(Mx=k()),_&4&&(_=u.updateQueue,_!==null&&(u.updateQueue=null,Sx(u,_)));break;case 22:A=u.memoizedState!==null;var Se=g!==null&&g.memoizedState!==null,ze=ol,Je=Ii;if(ol=ze||A,Ii=Je||Se,_a(h,u),Ii=Je,ol=ze,Sa(u),_&8192)e:for(h=u.stateNode,h._visibility=A?h._visibility&-2:h._visibility|1,A&&(g===null||Se||ol||Ii||sd(u)),g=null,h=u;;){if(h.tag===5||h.tag===26){if(g===null){Se=g=h;try{if(D=Se.stateNode,A)j=D.style,typeof j.setProperty=="function"?j.setProperty("display","none","important"):j.display="none";else{te=Se.stateNode;var it=Se.memoizedProps.style,Ve=it!=null&&it.hasOwnProperty("display")?it.display:null;te.style.display=Ve==null||typeof Ve=="boolean"?"":(""+Ve).trim()}}catch(Tt){An(Se,Se.return,Tt)}}}else if(h.tag===6){if(g===null){Se=h;try{Se.stateNode.nodeValue=A?"":Se.memoizedProps}catch(Tt){An(Se,Se.return,Tt)}}}else if(h.tag===18){if(g===null){Se=h;try{var Ye=Se.stateNode;A?dU(Ye,!0):dU(Se.stateNode,!1)}catch(Tt){An(Se,Se.return,Tt)}}}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;g===h&&(g=null),h=h.return}g===h&&(g=null),h.sibling.return=h.return,h=h.sibling}_&4&&(_=u.updateQueue,_!==null&&(g=_.retryQueue,g!==null&&(_.retryQueue=null,Sx(u,g))));break;case 19:_a(h,u),Sa(u),_&4&&(_=u.updateQueue,_!==null&&(u.updateQueue=null,Sx(u,_)));break;case 30:break;case 21:break;default:_a(h,u),Sa(u)}}function Sa(u){var h=u.flags;if(h&2){try{for(var g,_=u.return;_!==null;){if(hI(_)){g=_;break}_=_.return}if(g==null)throw Error(i(160));switch(g.tag){case 27:var A=g.stateNode,D=GM(u);_x(u,D,A);break;case 5:var j=g.stateNode;g.flags&32&&(yo(j,""),g.flags&=-33);var te=GM(u);_x(u,te,j);break;case 3:case 4:var Se=g.stateNode.containerInfo,ze=GM(u);$M(u,ze,Se);break;default:throw Error(i(161))}}catch(Je){An(u,u.return,Je)}u.flags&=-3}h&4096&&(u.flags&=-4097)}function SI(u){if(u.subtreeFlags&1024)for(u=u.child;u!==null;){var h=u;SI(h),h.tag===5&&h.flags&1024&&h.stateNode.reset(),u=u.sibling}}function cl(u,h){if(h.subtreeFlags&8772)for(h=h.child;h!==null;)gI(u,h.alternate,h),h=h.sibling}function sd(u){for(u=u.child;u!==null;){var h=u;switch(h.tag){case 0:case 11:case 14:case 15:Tc(4,h,h.return),sd(h);break;case 1:So(h,h.return);var g=h.stateNode;typeof g.componentWillUnmount=="function"&&dI(h,h.return,g),sd(h);break;case 27:Ym(h.stateNode);case 26:case 5:So(h,h.return),sd(h);break;case 22:h.memoizedState===null&&sd(h);break;case 30:sd(h);break;default:sd(h)}u=u.sibling}}function ul(u,h,g){for(g=g&&(h.subtreeFlags&8772)!==0,h=h.child;h!==null;){var _=h.alternate,A=u,D=h,j=D.flags;switch(D.tag){case 0:case 11:case 15:ul(A,D,g),zm(4,D);break;case 1:if(ul(A,D,g),_=D,A=_.stateNode,typeof A.componentDidMount=="function")try{A.componentDidMount()}catch(ze){An(_,_.return,ze)}if(_=D,A=_.updateQueue,A!==null){var te=_.stateNode;try{var Se=A.shared.hiddenCallbacks;if(Se!==null)for(A.shared.hiddenCallbacks=null,A=0;A<Se.length;A++)QL(Se[A],te)}catch(ze){An(_,_.return,ze)}}g&&j&64&&uI(D),Bm(D,D.return);break;case 27:pI(D);case 26:case 5:ul(A,D,g),g&&_===null&&j&4&&fI(D),Bm(D,D.return);break;case 12:ul(A,D,g);break;case 31:ul(A,D,g),g&&j&4&&yI(A,D);break;case 13:ul(A,D,g),g&&j&4&&bI(A,D);break;case 22:D.memoizedState===null&&ul(A,D,g),Bm(D,D.return);break;case 30:break;default:ul(A,D,g)}h=h.sibling}}function qM(u,h){var g=null;u!==null&&u.memoizedState!==null&&u.memoizedState.cachePool!==null&&(g=u.memoizedState.cachePool.pool),u=null,h.memoizedState!==null&&h.memoizedState.cachePool!==null&&(u=h.memoizedState.cachePool.pool),u!==g&&(u!=null&&u.refCount++,g!=null&&Am(g))}function XM(u,h){u=null,h.alternate!==null&&(u=h.alternate.memoizedState.cache),h=h.memoizedState.cache,h!==u&&(h.refCount++,u!=null&&Am(u))}function Ys(u,h,g,_){if(h.subtreeFlags&10256)for(h=h.child;h!==null;)wI(u,h,g,_),h=h.sibling}function wI(u,h,g,_){var A=h.flags;switch(h.tag){case 0:case 11:case 15:Ys(u,h,g,_),A&2048&&zm(9,h);break;case 1:Ys(u,h,g,_);break;case 3:Ys(u,h,g,_),A&2048&&(u=null,h.alternate!==null&&(u=h.alternate.memoizedState.cache),h=h.memoizedState.cache,h!==u&&(h.refCount++,u!=null&&Am(u)));break;case 12:if(A&2048){Ys(u,h,g,_),u=h.stateNode;try{var D=h.memoizedProps,j=D.id,te=D.onPostCommit;typeof te=="function"&&te(j,h.alternate===null?"mount":"update",u.passiveEffectDuration,-0)}catch(Se){An(h,h.return,Se)}}else Ys(u,h,g,_);break;case 31:Ys(u,h,g,_);break;case 13:Ys(u,h,g,_);break;case 23:break;case 22:D=h.stateNode,j=h.alternate,h.memoizedState!==null?D._visibility&2?Ys(u,h,g,_):jm(u,h):D._visibility&2?Ys(u,h,g,_):(D._visibility|=2,Yf(u,h,g,_,(h.subtreeFlags&10256)!==0||!1)),A&2048&&qM(j,h);break;case 24:Ys(u,h,g,_),A&2048&&XM(h.alternate,h);break;default:Ys(u,h,g,_)}}function Yf(u,h,g,_,A){for(A=A&&((h.subtreeFlags&10256)!==0||!1),h=h.child;h!==null;){var D=u,j=h,te=g,Se=_,ze=j.flags;switch(j.tag){case 0:case 11:case 15:Yf(D,j,te,Se,A),zm(8,j);break;case 23:break;case 22:var Je=j.stateNode;j.memoizedState!==null?Je._visibility&2?Yf(D,j,te,Se,A):jm(D,j):(Je._visibility|=2,Yf(D,j,te,Se,A)),A&&ze&2048&&qM(j.alternate,j);break;case 24:Yf(D,j,te,Se,A),A&&ze&2048&&XM(j.alternate,j);break;default:Yf(D,j,te,Se,A)}h=h.sibling}}function jm(u,h){if(h.subtreeFlags&10256)for(h=h.child;h!==null;){var g=u,_=h,A=_.flags;switch(_.tag){case 22:jm(g,_),A&2048&&qM(_.alternate,_);break;case 24:jm(g,_),A&2048&&XM(_.alternate,_);break;default:jm(g,_)}h=h.sibling}}var Hm=8192;function Kf(u,h,g){if(u.subtreeFlags&Hm)for(u=u.child;u!==null;)MI(u,h,g),u=u.sibling}function MI(u,h,g){switch(u.tag){case 26:Kf(u,h,g),u.flags&Hm&&u.memoizedState!==null&&GQ(g,Xs,u.memoizedState,u.memoizedProps);break;case 5:Kf(u,h,g);break;case 3:case 4:var _=Xs;Xs=Ix(u.stateNode.containerInfo),Kf(u,h,g),Xs=_;break;case 22:u.memoizedState===null&&(_=u.alternate,_!==null&&_.memoizedState!==null?(_=Hm,Hm=16777216,Kf(u,h,g),Hm=_):Kf(u,h,g));break;default:Kf(u,h,g)}}function EI(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 Vm(u){var h=u.deletions;if((u.flags&16)!==0){if(h!==null)for(var g=0;g<h.length;g++){var _=h[g];pr=_,TI(_,u)}EI(u)}if(u.subtreeFlags&10256)for(u=u.child;u!==null;)AI(u),u=u.sibling}function AI(u){switch(u.tag){case 0:case 11:case 15:Vm(u),u.flags&2048&&Tc(9,u,u.return);break;case 3:Vm(u);break;case 12:Vm(u);break;case 22:var h=u.stateNode;u.memoizedState!==null&&h._visibility&2&&(u.return===null||u.return.tag!==13)?(h._visibility&=-3,wx(u)):Vm(u);break;default:Vm(u)}}function wx(u){var h=u.deletions;if((u.flags&16)!==0){if(h!==null)for(var g=0;g<h.length;g++){var _=h[g];pr=_,TI(_,u)}EI(u)}for(u=u.child;u!==null;){switch(h=u,h.tag){case 0:case 11:case 15:Tc(8,h,h.return),wx(h);break;case 22:g=h.stateNode,g._visibility&2&&(g._visibility&=-3,wx(h));break;default:wx(h)}u=u.sibling}}function TI(u,h){for(;pr!==null;){var g=pr;switch(g.tag){case 0:case 11:case 15:Tc(8,g,h);break;case 23:case 22:if(g.memoizedState!==null&&g.memoizedState.cachePool!==null){var _=g.memoizedState.cachePool.pool;_!=null&&_.refCount++}break;case 24:Am(g.memoizedState.cache)}if(_=g.child,_!==null)_.return=g,pr=_;else e:for(g=u;pr!==null;){_=pr;var A=_.sibling,D=_.return;if(vI(_),_===g){pr=null;break e}if(A!==null){A.return=D,pr=A;break e}pr=D}}}var aQ={getCacheForType:function(u){var h=Rr(Oi),g=h.data.get(u);return g===void 0&&(g=u(),h.data.set(u,g)),g},cacheSignal:function(){return Rr(Oi).controller.signal}},sQ=typeof WeakMap=="function"?WeakMap:Map,_n=0,Bn=null,sn=null,un=0,En=0,Ga=null,Cc=!1,Zf=!1,YM=!1,dl=0,mi=0,Rc=0,od=0,KM=0,$a=0,Jf=0,Gm=null,wa=null,ZM=!1,Mx=0,CI=0,Ex=1/0,Ax=null,Nc=null,Ki=0,Pc=null,Qf=null,fl=0,JM=0,QM=null,RI=null,$m=0,eE=null;function Wa(){return(_n&2)!==0&&un!==0?un&-un:q.T!==null?sE():Ar()}function NI(){if($a===0)if((un&536870912)===0||hn){var u=de;de<<=1,(de&3932160)===0&&(de=262144),$a=u}else $a=536870912;return u=Ha.current,u!==null&&(u.flags|=32),$a}function Ma(u,h,g){(u===Bn&&(En===2||En===9)||u.cancelPendingCommit!==null)&&(eh(u,0),Dc(u,un,$a,!1)),tn(u,g),((_n&2)===0||u!==Bn)&&(u===Bn&&((_n&2)===0&&(od|=g),mi===4&&Dc(u,un,$a,!1)),wo(u))}function PI(u,h,g){if((_n&6)!==0)throw Error(i(327));var _=!g&&(h&127)===0&&(h&u.expiredLanes)===0||je(u,h),A=_?cQ(u,h):nE(u,h,!0),D=_;do{if(A===0){Zf&&!_&&Dc(u,h,0,!1);break}else{if(g=u.current.alternate,D&&!oQ(g)){A=nE(u,h,!1),D=!1;continue}if(A===2){if(D=h,u.errorRecoveryDisabledLanes&D)var j=0;else j=u.pendingLanes&-536870913,j=j!==0?j:j&536870912?536870912:0;if(j!==0){h=j;e:{var te=u;A=Gm;var Se=te.current.memoizedState.isDehydrated;if(Se&&(eh(te,j).flags|=256),j=nE(te,j,!1),j!==2){if(YM&&!Se){te.errorRecoveryDisabledLanes|=D,od|=D,A=4;break e}D=wa,wa=A,D!==null&&(wa===null?wa=D:wa.push.apply(wa,D))}A=j}if(D=!1,A!==2)continue}}if(A===1){eh(u,0),Dc(u,h,0,!0);break}e:{switch(_=u,D=A,D){case 0:case 1:throw Error(i(345));case 4:if((h&4194048)!==h)break;case 6:Dc(_,h,$a,!Cc);break e;case 2:wa=null;break;case 3:case 5:break;default:throw Error(i(329))}if((h&62914560)===h&&(A=Mx+300-k(),10<A)){if(Dc(_,h,$a,!Cc),ge(_,0,!0)!==0)break e;fl=h,_.timeoutHandle=lU(DI.bind(null,_,g,wa,Ax,ZM,h,$a,od,Jf,Cc,D,"Throttled",-0,0),A);break e}DI(_,g,wa,Ax,ZM,h,$a,od,Jf,Cc,D,null,-0,0)}}break}while(!0);wo(u)}function DI(u,h,g,_,A,D,j,te,Se,ze,Je,it,Ve,Ye){if(u.timeoutHandle=-1,it=h.subtreeFlags,it&8192||(it&16785408)===16785408){it={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Zo},MI(h,D,it);var Tt=(D&62914560)===D?Mx-k():(D&4194048)===D?CI-k():0;if(Tt=$Q(it,Tt),Tt!==null){fl=D,u.cancelPendingCommit=Tt(BI.bind(null,u,h,D,g,_,A,j,te,Se,Je,it,null,Ve,Ye)),Dc(u,D,j,!ze);return}}BI(u,h,D,g,_,A,j,te,Se)}function oQ(u){for(var h=u;;){var g=h.tag;if((g===0||g===11||g===15)&&h.flags&16384&&(g=h.updateQueue,g!==null&&(g=g.stores,g!==null)))for(var _=0;_<g.length;_++){var A=g[_],D=A.getSnapshot;A=A.value;try{if(!Ba(D(),A))return!1}catch{return!1}}if(g=h.child,h.subtreeFlags&16384&&g!==null)g.return=h,h=g;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 Dc(u,h,g,_){h&=~KM,h&=~od,u.suspendedLanes|=h,u.pingedLanes&=~h,_&&(u.warmLanes|=h),_=u.expirationTimes;for(var A=h;0<A;){var D=31-et(A),j=1<<D;_[D]=-1,A&=~j}g!==0&&wn(u,g,h)}function Tx(){return(_n&6)===0?(Wm(0),!1):!0}function tE(){if(sn!==null){if(En===0)var u=sn.return;else u=sn,tl=Ju=null,vM(u),Gf=null,Cm=0,u=sn;for(;u!==null;)cI(u.alternate,u),u=u.return;sn=null}}function eh(u,h){var g=u.timeoutHandle;g!==-1&&(u.timeoutHandle=-1,TQ(g)),g=u.cancelPendingCommit,g!==null&&(u.cancelPendingCommit=null,g()),fl=0,tE(),Bn=u,sn=g=Qo(u.current,null),un=h,En=0,Ga=null,Cc=!1,Zf=je(u,h),YM=!1,Jf=$a=KM=od=Rc=mi=0,wa=Gm=null,ZM=!1,(h&8)!==0&&(h|=h&32);var _=u.entangledLanes;if(_!==0)for(u=u.entanglements,_&=h;0<_;){var A=31-et(_),D=1<<A;h|=u[A],_&=~D}return dl=h,Xv(),g}function OI(u,h){qt=null,q.H=Im,h===Vf||h===nx?(h=YL(),En=3):h===aM?(h=YL(),En=4):En=h===OM?8:h!==null&&typeof h=="object"&&typeof h.then=="function"?6:1,Ga=h,sn===null&&(mi=1,gx(u,us(h,u.current)))}function LI(){var u=Ha.current;return u===null?!0:(un&4194048)===un?ps===null:(un&62914560)===un||(un&536870912)!==0?u===ps:!1}function kI(){var u=q.H;return q.H=Im,u===null?Im:u}function II(){var u=q.A;return q.A=aQ,u}function Cx(){mi=4,Cc||(un&4194048)!==un&&Ha.current!==null||(Zf=!0),(Rc&134217727)===0&&(od&134217727)===0||Bn===null||Dc(Bn,un,$a,!1)}function nE(u,h,g){var _=_n;_n|=2;var A=kI(),D=II();(Bn!==u||un!==h)&&(Ax=null,eh(u,h)),h=!1;var j=mi;e:do try{if(En!==0&&sn!==null){var te=sn,Se=Ga;switch(En){case 8:tE(),j=6;break e;case 3:case 2:case 9:case 6:Ha.current===null&&(h=!0);var ze=En;if(En=0,Ga=null,th(u,te,Se,ze),g&&Zf){j=0;break e}break;default:ze=En,En=0,Ga=null,th(u,te,Se,ze)}}lQ(),j=mi;break}catch(Je){OI(u,Je)}while(!0);return h&&u.shellSuspendCounter++,tl=Ju=null,_n=_,q.H=A,q.A=D,sn===null&&(Bn=null,un=0,Xv()),j}function lQ(){for(;sn!==null;)UI(sn)}function cQ(u,h){var g=_n;_n|=2;var _=kI(),A=II();Bn!==u||un!==h?(Ax=null,Ex=k()+500,eh(u,h)):Zf=je(u,h);e:do try{if(En!==0&&sn!==null){h=sn;var D=Ga;t:switch(En){case 1:En=0,Ga=null,th(u,h,D,1);break;case 2:case 9:if(qL(D)){En=0,Ga=null,FI(h);break}h=function(){En!==2&&En!==9||Bn!==u||(En=7),wo(u)},D.then(h,h);break e;case 3:En=7;break e;case 4:En=5;break e;case 7:qL(D)?(En=0,Ga=null,FI(h)):(En=0,Ga=null,th(u,h,D,7));break;case 5:var j=null;switch(sn.tag){case 26:j=sn.memoizedState;case 5:case 27:var te=sn;if(j?wU(j):te.stateNode.complete){En=0,Ga=null;var Se=te.sibling;if(Se!==null)sn=Se;else{var ze=te.return;ze!==null?(sn=ze,Rx(ze)):sn=null}break t}}En=0,Ga=null,th(u,h,D,5);break;case 6:En=0,Ga=null,th(u,h,D,6);break;case 8:tE(),mi=6;break e;default:throw Error(i(462))}}uQ();break}catch(Je){OI(u,Je)}while(!0);return tl=Ju=null,q.H=_,q.A=A,_n=g,sn!==null?0:(Bn=null,un=0,Xv(),mi)}function uQ(){for(;sn!==null&&!ve();)UI(sn)}function UI(u){var h=oI(u.alternate,u,dl);u.memoizedProps=u.pendingProps,h===null?Rx(u):sn=h}function FI(u){var h=u,g=h.alternate;switch(h.tag){case 15:case 0:h=tI(g,h,h.pendingProps,h.type,void 0,un);break;case 11:h=tI(g,h,h.pendingProps,h.type.render,h.ref,un);break;case 5:vM(h);default:cI(g,h),h=sn=IL(h,dl),h=oI(g,h,dl)}u.memoizedProps=u.pendingProps,h===null?Rx(u):sn=h}function th(u,h,g,_){tl=Ju=null,vM(h),Gf=null,Cm=0;var A=h.return;try{if(JJ(u,A,h,g,un)){mi=1,gx(u,us(g,u.current)),sn=null;return}}catch(D){if(A!==null)throw sn=A,D;mi=1,gx(u,us(g,u.current)),sn=null;return}h.flags&32768?(hn||_===1?u=!0:Zf||(un&536870912)!==0?u=!1:(Cc=u=!0,(_===2||_===9||_===3||_===6)&&(_=Ha.current,_!==null&&_.tag===13&&(_.flags|=16384))),zI(h,u)):Rx(h)}function Rx(u){var h=u;do{if((h.flags&32768)!==0){zI(h,Cc);return}u=h.return;var g=tQ(h.alternate,h,dl);if(g!==null){sn=g;return}if(h=h.sibling,h!==null){sn=h;return}sn=h=u}while(h!==null);mi===0&&(mi=5)}function zI(u,h){do{var g=nQ(u.alternate,u);if(g!==null){g.flags&=32767,sn=g;return}if(g=u.return,g!==null&&(g.flags|=32768,g.subtreeFlags=0,g.deletions=null),!h&&(u=u.sibling,u!==null)){sn=u;return}sn=u=g}while(u!==null);mi=6,sn=null}function BI(u,h,g,_,A,D,j,te,Se){u.cancelPendingCommit=null;do Nx();while(Ki!==0);if((_n&6)!==0)throw Error(i(327));if(h!==null){if(h===u.current)throw Error(i(177));if(D=h.lanes|h.childLanes,D|=Gw,Pt(u,g,D,j,te,Se),u===Bn&&(sn=Bn=null,un=0),Qf=h,Pc=u,fl=g,JM=D,QM=A,RI=_,(h.subtreeFlags&10256)!==0||(h.flags&10256)!==0?(u.callbackNode=null,u.callbackPriority=0,pQ(fe,function(){return $I(),null})):(u.callbackNode=null,u.callbackPriority=0),_=(h.flags&13878)!==0,(h.subtreeFlags&13878)!==0||_){_=q.T,q.T=null,A=G.p,G.p=2,j=_n,_n|=4;try{iQ(u,h,g)}finally{_n=j,G.p=A,q.T=_}}Ki=1,jI(),HI(),VI()}}function jI(){if(Ki===1){Ki=0;var u=Pc,h=Qf,g=(h.flags&13878)!==0;if((h.subtreeFlags&13878)!==0||g){g=q.T,q.T=null;var _=G.p;G.p=2;var A=_n;_n|=4;try{_I(h,u);var D=pE,j=TL(u.containerInfo),te=D.focusedElem,Se=D.selectionRange;if(j!==te&&te&&te.ownerDocument&&AL(te.ownerDocument.documentElement,te)){if(Se!==null&&zw(te)){var ze=Se.start,Je=Se.end;if(Je===void 0&&(Je=ze),"selectionStart"in te)te.selectionStart=ze,te.selectionEnd=Math.min(Je,te.value.length);else{var it=te.ownerDocument||document,Ve=it&&it.defaultView||window;if(Ve.getSelection){var Ye=Ve.getSelection(),Tt=te.textContent.length,Ft=Math.min(Se.start,Tt),Pn=Se.end===void 0?Ft:Math.min(Se.end,Tt);!Ye.extend&&Ft>Pn&&(j=Pn,Pn=Ft,Ft=j);var Oe=EL(te,Ft),Te=EL(te,Pn);if(Oe&&Te&&(Ye.rangeCount!==1||Ye.anchorNode!==Oe.node||Ye.anchorOffset!==Oe.offset||Ye.focusNode!==Te.node||Ye.focusOffset!==Te.offset)){var Fe=it.createRange();Fe.setStart(Oe.node,Oe.offset),Ye.removeAllRanges(),Ft>Pn?(Ye.addRange(Fe),Ye.extend(Te.node,Te.offset)):(Fe.setEnd(Te.node,Te.offset),Ye.addRange(Fe))}}}}for(it=[],Ye=te;Ye=Ye.parentNode;)Ye.nodeType===1&&it.push({element:Ye,left:Ye.scrollLeft,top:Ye.scrollTop});for(typeof te.focus=="function"&&te.focus(),te=0;te<it.length;te++){var nt=it[te];nt.element.scrollLeft=nt.left,nt.element.scrollTop=nt.top}}Hx=!!hE,pE=hE=null}finally{_n=A,G.p=_,q.T=g}}u.current=h,Ki=2}}function HI(){if(Ki===2){Ki=0;var u=Pc,h=Qf,g=(h.flags&8772)!==0;if((h.subtreeFlags&8772)!==0||g){g=q.T,q.T=null;var _=G.p;G.p=2;var A=_n;_n|=4;try{gI(u,h.alternate,h)}finally{_n=A,G.p=_,q.T=g}}Ki=3}}function VI(){if(Ki===4||Ki===3){Ki=0,F();var u=Pc,h=Qf,g=fl,_=RI;(h.subtreeFlags&10256)!==0||(h.flags&10256)!==0?Ki=5:(Ki=0,Qf=Pc=null,GI(u,u.pendingLanes));var A=u.pendingLanes;if(A===0&&(Nc=null),dr(g),h=h.stateNode,Pe&&typeof Pe.onCommitFiberRoot=="function")try{Pe.onCommitFiberRoot(Ue,h,void 0,(h.current.flags&128)===128)}catch{}if(_!==null){h=q.T,A=G.p,G.p=2,q.T=null;try{for(var D=u.onRecoverableError,j=0;j<_.length;j++){var te=_[j];D(te.value,{componentStack:te.stack})}}finally{q.T=h,G.p=A}}(fl&3)!==0&&Nx(),wo(u),A=u.pendingLanes,(g&261930)!==0&&(A&42)!==0?u===eE?$m++:($m=0,eE=u):$m=0,Wm(0)}}function GI(u,h){(u.pooledCacheLanes&=h)===0&&(h=u.pooledCache,h!=null&&(u.pooledCache=null,Am(h)))}function Nx(){return jI(),HI(),VI(),$I()}function $I(){if(Ki!==5)return!1;var u=Pc,h=JM;JM=0;var g=dr(fl),_=q.T,A=G.p;try{G.p=32>g?32:g,q.T=null,g=QM,QM=null;var D=Pc,j=fl;if(Ki=0,Qf=Pc=null,fl=0,(_n&6)!==0)throw Error(i(331));var te=_n;if(_n|=4,AI(D.current),wI(D,D.current,j,g),_n=te,Wm(0,!1),Pe&&typeof Pe.onPostCommitFiberRoot=="function")try{Pe.onPostCommitFiberRoot(Ue,D)}catch{}return!0}finally{G.p=A,q.T=_,GI(u,h)}}function WI(u,h,g){h=us(g,h),h=DM(u.stateNode,h,2),u=Mc(u,h,2),u!==null&&(tn(u,2),wo(u))}function An(u,h,g){if(u.tag===3)WI(u,u,g);else for(;h!==null;){if(h.tag===3){WI(h,u,g);break}else if(h.tag===1){var _=h.stateNode;if(typeof h.type.getDerivedStateFromError=="function"||typeof _.componentDidCatch=="function"&&(Nc===null||!Nc.has(_))){u=us(g,u),g=qk(2),_=Mc(h,g,2),_!==null&&(Xk(g,_,h,u),tn(_,2),wo(_));break}}h=h.return}}function iE(u,h,g){var _=u.pingCache;if(_===null){_=u.pingCache=new sQ;var A=new Set;_.set(h,A)}else A=_.get(h),A===void 0&&(A=new Set,_.set(h,A));A.has(g)||(YM=!0,A.add(g),u=dQ.bind(null,u,h,g),h.then(u,u))}function dQ(u,h,g){var _=u.pingCache;_!==null&&_.delete(h),u.pingedLanes|=u.suspendedLanes&g,u.warmLanes&=~g,Bn===u&&(un&g)===g&&(mi===4||mi===3&&(un&62914560)===un&&300>k()-Mx?(_n&2)===0&&eh(u,0):KM|=g,Jf===un&&(Jf=0)),wo(u)}function qI(u,h){h===0&&(h=yt()),u=Yu(u,h),u!==null&&(tn(u,h),wo(u))}function fQ(u){var h=u.memoizedState,g=0;h!==null&&(g=h.retryLane),qI(u,g)}function hQ(u,h){var g=0;switch(u.tag){case 31:case 13:var _=u.stateNode,A=u.memoizedState;A!==null&&(g=A.retryLane);break;case 19:_=u.stateNode;break;case 22:_=u.stateNode._retryCache;break;default:throw Error(i(314))}_!==null&&_.delete(h),qI(u,g)}function pQ(u,h){return ie(u,h)}var Px=null,nh=null,rE=!1,Dx=!1,aE=!1,Oc=0;function wo(u){u!==nh&&u.next===null&&(nh===null?Px=nh=u:nh=nh.next=u),Dx=!0,rE||(rE=!0,gQ())}function Wm(u,h){if(!aE&&Dx){aE=!0;do for(var g=!1,_=Px;_!==null;){if(u!==0){var A=_.pendingLanes;if(A===0)var D=0;else{var j=_.suspendedLanes,te=_.pingedLanes;D=(1<<31-et(42|u)+1)-1,D&=A&~(j&~te),D=D&201326741?D&201326741|1:D?D|2:0}D!==0&&(g=!0,ZI(_,D))}else D=un,D=ge(_,_===Bn?D:0,_.cancelPendingCommit!==null||_.timeoutHandle!==-1),(D&3)===0||je(_,D)||(g=!0,ZI(_,D));_=_.next}while(g);aE=!1}}function mQ(){XI()}function XI(){Dx=rE=!1;var u=0;Oc!==0&&AQ()&&(u=Oc);for(var h=k(),g=null,_=Px;_!==null;){var A=_.next,D=YI(_,h);D===0?(_.next=null,g===null?Px=A:g.next=A,A===null&&(nh=g)):(g=_,(u!==0||(D&3)!==0)&&(Dx=!0)),_=A}Ki!==0&&Ki!==5||Wm(u),Oc!==0&&(Oc=0)}function YI(u,h){for(var g=u.suspendedLanes,_=u.pingedLanes,A=u.expirationTimes,D=u.pendingLanes&-62914561;0<D;){var j=31-et(D),te=1<<j,Se=A[j];Se===-1?((te&g)===0||(te&_)!==0)&&(A[j]=at(te,h)):Se<=h&&(u.expiredLanes|=te),D&=~te}if(h=Bn,g=un,g=ge(u,u===h?g:0,u.cancelPendingCommit!==null||u.timeoutHandle!==-1),_=u.callbackNode,g===0||u===h&&(En===2||En===9)||u.cancelPendingCommit!==null)return _!==null&&_!==null&&we(_),u.callbackNode=null,u.callbackPriority=0;if((g&3)===0||je(u,g)){if(h=g&-g,h===u.callbackPriority)return h;switch(_!==null&&we(_),dr(g)){case 2:case 8:g=xe;break;case 32:g=fe;break;case 268435456:g=ke;break;default:g=fe}return _=KI.bind(null,u),g=ie(g,_),u.callbackPriority=h,u.callbackNode=g,h}return _!==null&&_!==null&&we(_),u.callbackPriority=2,u.callbackNode=null,2}function KI(u,h){if(Ki!==0&&Ki!==5)return u.callbackNode=null,u.callbackPriority=0,null;var g=u.callbackNode;if(Nx()&&u.callbackNode!==g)return null;var _=un;return _=ge(u,u===Bn?_:0,u.cancelPendingCommit!==null||u.timeoutHandle!==-1),_===0?null:(PI(u,_,h),YI(u,k()),u.callbackNode!=null&&u.callbackNode===g?KI.bind(null,u):null)}function ZI(u,h){if(Nx())return null;PI(u,h,!0)}function gQ(){CQ(function(){(_n&6)!==0?ie(pe,mQ):XI()})}function sE(){if(Oc===0){var u=jf;u===0&&(u=tt,tt<<=1,(tt&261888)===0&&(tt=256)),Oc=u}return Oc}function JI(u){return u==null||typeof u=="symbol"||typeof u=="boolean"?null:typeof u=="function"?u:Bv(""+u)}function QI(u,h){var g=h.ownerDocument.createElement("input");return g.name=h.name,g.value=h.value,u.id&&g.setAttribute("form",u.id),h.parentNode.insertBefore(g,h),u=new FormData(u),g.parentNode.removeChild(g),u}function vQ(u,h,g,_,A){if(h==="submit"&&g&&g.stateNode===A){var D=JI((A[wi]||null).action),j=_.submitter;j&&(h=(h=j[wi]||null)?JI(h.formAction):j.getAttribute("formAction"),h!==null&&(D=h,j=null));var te=new Gv("action","action",null,_,A);u.push({event:te,listeners:[{instance:null,listener:function(){if(_.defaultPrevented){if(Oc!==0){var Se=j?QI(A,j):new FormData(A);AM(g,{pending:!0,data:Se,method:A.method,action:D},null,Se)}}else typeof D=="function"&&(te.preventDefault(),Se=j?QI(A,j):new FormData(A),AM(g,{pending:!0,data:Se,method:A.method,action:D},D,Se))},currentTarget:A}]})}}for(var oE=0;oE<Vw.length;oE++){var lE=Vw[oE],xQ=lE.toLowerCase(),yQ=lE[0].toUpperCase()+lE.slice(1);qs(xQ,"on"+yQ)}qs(NL,"onAnimationEnd"),qs(PL,"onAnimationIteration"),qs(DL,"onAnimationStart"),qs("dblclick","onDoubleClick"),qs("focusin","onFocus"),qs("focusout","onBlur"),qs(kJ,"onTransitionRun"),qs(IJ,"onTransitionStart"),qs(UJ,"onTransitionCancel"),qs(OL,"onTransitionEnd"),mt("onMouseEnter",["mouseout","mouseover"]),mt("onMouseLeave",["mouseout","mouseover"]),mt("onPointerEnter",["pointerout","pointerover"]),mt("onPointerLeave",["pointerout","pointerover"]),ot("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),ot("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),ot("onBeforeInput",["compositionend","keypress","textInput","paste"]),ot("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),ot("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),ot("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var qm="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(" "),bQ=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(qm));function eU(u,h){h=(h&4)!==0;for(var g=0;g<u.length;g++){var _=u[g],A=_.event;_=_.listeners;e:{var D=void 0;if(h)for(var j=_.length-1;0<=j;j--){var te=_[j],Se=te.instance,ze=te.currentTarget;if(te=te.listener,Se!==D&&A.isPropagationStopped())break e;D=te,A.currentTarget=ze;try{D(A)}catch(Je){qv(Je)}A.currentTarget=null,D=Se}else for(j=0;j<_.length;j++){if(te=_[j],Se=te.instance,ze=te.currentTarget,te=te.listener,Se!==D&&A.isPropagationStopped())break e;D=te,A.currentTarget=ze;try{D(A)}catch(Je){qv(Je)}A.currentTarget=null,D=Se}}}}function on(u,h){var g=h[gc];g===void 0&&(g=h[gc]=new Set);var _=u+"__bubble";g.has(_)||(tU(h,u,2,!1),g.add(_))}function cE(u,h,g){var _=0;h&&(_|=4),tU(g,u,_,h)}var Ox="_reactListening"+Math.random().toString(36).slice(2);function uE(u){if(!u[Ox]){u[Ox]=!0,Me.forEach(function(g){g!=="selectionchange"&&(bQ.has(g)||cE(g,!1,u),cE(g,!0,u))});var h=u.nodeType===9?u:u.ownerDocument;h===null||h[Ox]||(h[Ox]=!0,cE("selectionchange",!1,h))}}function tU(u,h,g,_){switch(NU(h)){case 2:var A=XQ;break;case 8:A=YQ;break;default:A=EE}g=A.bind(null,h,g,u),A=void 0,!Nw||h!=="touchstart"&&h!=="touchmove"&&h!=="wheel"||(A=!0),_?A!==void 0?u.addEventListener(h,g,{capture:!0,passive:A}):u.addEventListener(h,g,!0):A!==void 0?u.addEventListener(h,g,{passive:A}):u.addEventListener(h,g,!1)}function dE(u,h,g,_,A){var D=_;if((h&1)===0&&(h&2)===0&&_!==null)e:for(;;){if(_===null)return;var j=_.tag;if(j===3||j===4){var te=_.stateNode.containerInfo;if(te===A)break;if(j===4)for(j=_.return;j!==null;){var Se=j.tag;if((Se===3||Se===4)&&j.stateNode.containerInfo===A)return;j=j.return}for(;te!==null;){if(j=bt(te),j===null)return;if(Se=j.tag,Se===5||Se===6||Se===26||Se===27){_=D=j;continue e}te=te.parentNode}}_=_.return}sL(function(){var ze=D,Je=Cw(g),it=[];e:{var Ve=LL.get(u);if(Ve!==void 0){var Ye=Gv,Tt=u;switch(u){case"keypress":if(Hv(g)===0)break e;case"keydown":case"keyup":Ye=hJ;break;case"focusin":Tt="focus",Ye=Lw;break;case"focusout":Tt="blur",Ye=Lw;break;case"beforeblur":case"afterblur":Ye=Lw;break;case"click":if(g.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":Ye=cL;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Ye=tJ;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Ye=gJ;break;case NL:case PL:case DL:Ye=rJ;break;case OL:Ye=xJ;break;case"scroll":case"scrollend":Ye=QZ;break;case"wheel":Ye=bJ;break;case"copy":case"cut":case"paste":Ye=sJ;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Ye=dL;break;case"toggle":case"beforetoggle":Ye=SJ}var Ft=(h&4)!==0,Pn=!Ft&&(u==="scroll"||u==="scrollend"),Oe=Ft?Ve!==null?Ve+"Capture":null:Ve;Ft=[];for(var Te=ze,Fe;Te!==null;){var nt=Te;if(Fe=nt.stateNode,nt=nt.tag,nt!==5&&nt!==26&&nt!==27||Fe===null||Oe===null||(nt=mm(Te,Oe),nt!=null&&Ft.push(Xm(Te,nt,Fe))),Pn)break;Te=Te.return}0<Ft.length&&(Ve=new Ye(Ve,Tt,null,g,Je),it.push({event:Ve,listeners:Ft}))}}if((h&7)===0){e:{if(Ve=u==="mouseover"||u==="pointerover",Ye=u==="mouseout"||u==="pointerout",Ve&&g!==Tw&&(Tt=g.relatedTarget||g.fromElement)&&(bt(Tt)||Tt[$s]))break e;if((Ye||Ve)&&(Ve=Je.window===Je?Je:(Ve=Je.ownerDocument)?Ve.defaultView||Ve.parentWindow:window,Ye?(Tt=g.relatedTarget||g.toElement,Ye=ze,Tt=Tt?bt(Tt):null,Tt!==null&&(Pn=a(Tt),Ft=Tt.tag,Tt!==Pn||Ft!==5&&Ft!==27&&Ft!==6)&&(Tt=null)):(Ye=null,Tt=ze),Ye!==Tt)){if(Ft=cL,nt="onMouseLeave",Oe="onMouseEnter",Te="mouse",(u==="pointerout"||u==="pointerover")&&(Ft=dL,nt="onPointerLeave",Oe="onPointerEnter",Te="pointer"),Pn=Ye==null?Ve:_e(Ye),Fe=Tt==null?Ve:_e(Tt),Ve=new Ft(nt,Te+"leave",Ye,g,Je),Ve.target=Pn,Ve.relatedTarget=Fe,nt=null,bt(Je)===ze&&(Ft=new Ft(Oe,Te+"enter",Tt,g,Je),Ft.target=Fe,Ft.relatedTarget=Pn,nt=Ft),Pn=nt,Ye&&Tt)t:{for(Ft=_Q,Oe=Ye,Te=Tt,Fe=0,nt=Oe;nt;nt=Ft(nt))Fe++;nt=0;for(var Lt=Te;Lt;Lt=Ft(Lt))nt++;for(;0<Fe-nt;)Oe=Ft(Oe),Fe--;for(;0<nt-Fe;)Te=Ft(Te),nt--;for(;Fe--;){if(Oe===Te||Te!==null&&Oe===Te.alternate){Ft=Oe;break t}Oe=Ft(Oe),Te=Ft(Te)}Ft=null}else Ft=null;Ye!==null&&nU(it,Ve,Ye,Ft,!1),Tt!==null&&Pn!==null&&nU(it,Pn,Tt,Ft,!0)}}e:{if(Ve=ze?_e(ze):window,Ye=Ve.nodeName&&Ve.nodeName.toLowerCase(),Ye==="select"||Ye==="input"&&Ve.type==="file")var gn=yL;else if(vL(Ve))if(bL)gn=DJ;else{gn=NJ;var Nt=RJ}else Ye=Ve.nodeName,!Ye||Ye.toLowerCase()!=="input"||Ve.type!=="checkbox"&&Ve.type!=="radio"?ze&&Aw(ze.elementType)&&(gn=yL):gn=PJ;if(gn&&(gn=gn(u,ze))){xL(it,gn,g,Je);break e}Nt&&Nt(u,Ve,ze),u==="focusout"&&ze&&Ve.type==="number"&&ze.memoizedProps.value!=null&&fr(Ve,"number",Ve.value)}switch(Nt=ze?_e(ze):window,u){case"focusin":(vL(Nt)||Nt.contentEditable==="true")&&(Of=Nt,Bw=ze,wm=null);break;case"focusout":wm=Bw=Of=null;break;case"mousedown":jw=!0;break;case"contextmenu":case"mouseup":case"dragend":jw=!1,CL(it,g,Je);break;case"selectionchange":if(LJ)break;case"keydown":case"keyup":CL(it,g,Je)}var Xt;if(Iw)e:{switch(u){case"compositionstart":var dn="onCompositionStart";break e;case"compositionend":dn="onCompositionEnd";break e;case"compositionupdate":dn="onCompositionUpdate";break e}dn=void 0}else Df?mL(u,g)&&(dn="onCompositionEnd"):u==="keydown"&&g.keyCode===229&&(dn="onCompositionStart");dn&&(fL&&g.locale!=="ko"&&(Df||dn!=="onCompositionStart"?dn==="onCompositionEnd"&&Df&&(Xt=oL()):(vc=Je,Pw="value"in vc?vc.value:vc.textContent,Df=!0)),Nt=Lx(ze,dn),0<Nt.length&&(dn=new uL(dn,u,null,g,Je),it.push({event:dn,listeners:Nt}),Xt?dn.data=Xt:(Xt=gL(g),Xt!==null&&(dn.data=Xt)))),(Xt=MJ?EJ(u,g):AJ(u,g))&&(dn=Lx(ze,"onBeforeInput"),0<dn.length&&(Nt=new uL("onBeforeInput","beforeinput",null,g,Je),it.push({event:Nt,listeners:dn}),Nt.data=Xt)),vQ(it,u,ze,g,Je)}eU(it,h)})}function Xm(u,h,g){return{instance:u,listener:h,currentTarget:g}}function Lx(u,h){for(var g=h+"Capture",_=[];u!==null;){var A=u,D=A.stateNode;if(A=A.tag,A!==5&&A!==26&&A!==27||D===null||(A=mm(u,g),A!=null&&_.unshift(Xm(u,A,D)),A=mm(u,h),A!=null&&_.push(Xm(u,A,D))),u.tag===3)return _;u=u.return}return[]}function _Q(u){if(u===null)return null;do u=u.return;while(u&&u.tag!==5&&u.tag!==27);return u||null}function nU(u,h,g,_,A){for(var D=h._reactName,j=[];g!==null&&g!==_;){var te=g,Se=te.alternate,ze=te.stateNode;if(te=te.tag,Se!==null&&Se===_)break;te!==5&&te!==26&&te!==27||ze===null||(Se=ze,A?(ze=mm(g,D),ze!=null&&j.unshift(Xm(g,ze,Se))):A||(ze=mm(g,D),ze!=null&&j.push(Xm(g,ze,Se)))),g=g.return}j.length!==0&&u.push({event:h,listeners:j})}var SQ=/\r\n?/g,wQ=/\u0000|\uFFFD/g;function iU(u){return(typeof u=="string"?u:""+u).replace(SQ,`
  9. `).replace(wQ,"")}function rU(u,h){return h=iU(h),iU(u)===h}function Nn(u,h,g,_,A,D){switch(g){case"children":typeof _=="string"?h==="body"||h==="textarea"&&_===""||yo(u,_):(typeof _=="number"||typeof _=="bigint")&&h!=="body"&&yo(u,""+_);break;case"className":Ot(u,"class",_);break;case"tabIndex":Ot(u,"tabindex",_);break;case"dir":case"role":case"viewBox":case"width":case"height":Ot(u,g,_);break;case"style":rL(u,_,D);break;case"data":if(h!=="object"){Ot(u,"data",_);break}case"src":case"href":if(_===""&&(h!=="a"||g!=="href")){u.removeAttribute(g);break}if(_==null||typeof _=="function"||typeof _=="symbol"||typeof _=="boolean"){u.removeAttribute(g);break}_=Bv(""+_),u.setAttribute(g,_);break;case"action":case"formAction":if(typeof _=="function"){u.setAttribute(g,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof D=="function"&&(g==="formAction"?(h!=="input"&&Nn(u,h,"name",A.name,A,null),Nn(u,h,"formEncType",A.formEncType,A,null),Nn(u,h,"formMethod",A.formMethod,A,null),Nn(u,h,"formTarget",A.formTarget,A,null)):(Nn(u,h,"encType",A.encType,A,null),Nn(u,h,"method",A.method,A,null),Nn(u,h,"target",A.target,A,null)));if(_==null||typeof _=="symbol"||typeof _=="boolean"){u.removeAttribute(g);break}_=Bv(""+_),u.setAttribute(g,_);break;case"onClick":_!=null&&(u.onclick=Zo);break;case"onScroll":_!=null&&on("scroll",u);break;case"onScrollEnd":_!=null&&on("scrollend",u);break;case"dangerouslySetInnerHTML":if(_!=null){if(typeof _!="object"||!("__html"in _))throw Error(i(61));if(g=_.__html,g!=null){if(A.children!=null)throw Error(i(60));u.innerHTML=g}}break;case"multiple":u.multiple=_&&typeof _!="function"&&typeof _!="symbol";break;case"muted":u.muted=_&&typeof _!="function"&&typeof _!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(_==null||typeof _=="function"||typeof _=="boolean"||typeof _=="symbol"){u.removeAttribute("xlink:href");break}g=Bv(""+_),u.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",g);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":_!=null&&typeof _!="function"&&typeof _!="symbol"?u.setAttribute(g,""+_):u.removeAttribute(g);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":_&&typeof _!="function"&&typeof _!="symbol"?u.setAttribute(g,""):u.removeAttribute(g);break;case"capture":case"download":_===!0?u.setAttribute(g,""):_!==!1&&_!=null&&typeof _!="function"&&typeof _!="symbol"?u.setAttribute(g,_):u.removeAttribute(g);break;case"cols":case"rows":case"size":case"span":_!=null&&typeof _!="function"&&typeof _!="symbol"&&!isNaN(_)&&1<=_?u.setAttribute(g,_):u.removeAttribute(g);break;case"rowSpan":case"start":_==null||typeof _=="function"||typeof _=="symbol"||isNaN(_)?u.removeAttribute(g):u.setAttribute(g,_);break;case"popover":on("beforetoggle",u),on("toggle",u),jt(u,"popover",_);break;case"xlinkActuate":Yt(u,"http://www.w3.org/1999/xlink","xlink:actuate",_);break;case"xlinkArcrole":Yt(u,"http://www.w3.org/1999/xlink","xlink:arcrole",_);break;case"xlinkRole":Yt(u,"http://www.w3.org/1999/xlink","xlink:role",_);break;case"xlinkShow":Yt(u,"http://www.w3.org/1999/xlink","xlink:show",_);break;case"xlinkTitle":Yt(u,"http://www.w3.org/1999/xlink","xlink:title",_);break;case"xlinkType":Yt(u,"http://www.w3.org/1999/xlink","xlink:type",_);break;case"xmlBase":Yt(u,"http://www.w3.org/XML/1998/namespace","xml:base",_);break;case"xmlLang":Yt(u,"http://www.w3.org/XML/1998/namespace","xml:lang",_);break;case"xmlSpace":Yt(u,"http://www.w3.org/XML/1998/namespace","xml:space",_);break;case"is":jt(u,"is",_);break;case"innerText":case"textContent":break;default:(!(2<g.length)||g[0]!=="o"&&g[0]!=="O"||g[1]!=="n"&&g[1]!=="N")&&(g=ZZ.get(g)||g,jt(u,g,_))}}function fE(u,h,g,_,A,D){switch(g){case"style":rL(u,_,D);break;case"dangerouslySetInnerHTML":if(_!=null){if(typeof _!="object"||!("__html"in _))throw Error(i(61));if(g=_.__html,g!=null){if(A.children!=null)throw Error(i(60));u.innerHTML=g}}break;case"children":typeof _=="string"?yo(u,_):(typeof _=="number"||typeof _=="bigint")&&yo(u,""+_);break;case"onScroll":_!=null&&on("scroll",u);break;case"onScrollEnd":_!=null&&on("scrollend",u);break;case"onClick":_!=null&&(u.onclick=Zo);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Ze.hasOwnProperty(g))e:{if(g[0]==="o"&&g[1]==="n"&&(A=g.endsWith("Capture"),h=g.slice(2,A?g.length-7:void 0),D=u[wi]||null,D=D!=null?D[g]:null,typeof D=="function"&&u.removeEventListener(h,D,A),typeof _=="function")){typeof D!="function"&&D!==null&&(g in u?u[g]=null:u.hasAttribute(g)&&u.removeAttribute(g)),u.addEventListener(h,_,A);break e}g in u?u[g]=_:_===!0?u.setAttribute(g,""):jt(u,g,_)}}}function Pr(u,h,g){switch(h){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":on("error",u),on("load",u);var _=!1,A=!1,D;for(D in g)if(g.hasOwnProperty(D)){var j=g[D];if(j!=null)switch(D){case"src":_=!0;break;case"srcSet":A=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(i(137,h));default:Nn(u,h,D,j,g,null)}}A&&Nn(u,h,"srcSet",g.srcSet,g,null),_&&Nn(u,h,"src",g.src,g,null);return;case"input":on("invalid",u);var te=D=j=A=null,Se=null,ze=null;for(_ in g)if(g.hasOwnProperty(_)){var Je=g[_];if(Je!=null)switch(_){case"name":A=Je;break;case"type":j=Je;break;case"checked":Se=Je;break;case"defaultChecked":ze=Je;break;case"value":D=Je;break;case"defaultValue":te=Je;break;case"children":case"dangerouslySetInnerHTML":if(Je!=null)throw Error(i(137,h));break;default:Nn(u,h,_,Je,g,null)}}Mn(u,D,te,Se,ze,j,A,!1);return;case"select":on("invalid",u),_=j=D=null;for(A in g)if(g.hasOwnProperty(A)&&(te=g[A],te!=null))switch(A){case"value":D=te;break;case"defaultValue":j=te;break;case"multiple":_=te;default:Nn(u,h,A,te,g,null)}h=D,g=j,u.multiple=!!_,h!=null?Yi(u,!!_,h,!1):g!=null&&Yi(u,!!_,g,!0);return;case"textarea":on("invalid",u),D=A=_=null;for(j in g)if(g.hasOwnProperty(j)&&(te=g[j],te!=null))switch(j){case"value":_=te;break;case"defaultValue":A=te;break;case"children":D=te;break;case"dangerouslySetInnerHTML":if(te!=null)throw Error(i(91));break;default:Nn(u,h,j,te,g,null)}Tr(u,_,A,D);return;case"option":for(Se in g)if(g.hasOwnProperty(Se)&&(_=g[Se],_!=null))switch(Se){case"selected":u.selected=_&&typeof _!="function"&&typeof _!="symbol";break;default:Nn(u,h,Se,_,g,null)}return;case"dialog":on("beforetoggle",u),on("toggle",u),on("cancel",u),on("close",u);break;case"iframe":case"object":on("load",u);break;case"video":case"audio":for(_=0;_<qm.length;_++)on(qm[_],u);break;case"image":on("error",u),on("load",u);break;case"details":on("toggle",u);break;case"embed":case"source":case"link":on("error",u),on("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 g)if(g.hasOwnProperty(ze)&&(_=g[ze],_!=null))switch(ze){case"children":case"dangerouslySetInnerHTML":throw Error(i(137,h));default:Nn(u,h,ze,_,g,null)}return;default:if(Aw(h)){for(Je in g)g.hasOwnProperty(Je)&&(_=g[Je],_!==void 0&&fE(u,h,Je,_,g,void 0));return}}for(te in g)g.hasOwnProperty(te)&&(_=g[te],_!=null&&Nn(u,h,te,_,g,null))}function MQ(u,h,g,_){switch(h){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var A=null,D=null,j=null,te=null,Se=null,ze=null,Je=null;for(Ye in g){var it=g[Ye];if(g.hasOwnProperty(Ye)&&it!=null)switch(Ye){case"checked":break;case"value":break;case"defaultValue":Se=it;default:_.hasOwnProperty(Ye)||Nn(u,h,Ye,null,_,it)}}for(var Ve in _){var Ye=_[Ve];if(it=g[Ve],_.hasOwnProperty(Ve)&&(Ye!=null||it!=null))switch(Ve){case"type":D=Ye;break;case"name":A=Ye;break;case"checked":ze=Ye;break;case"defaultChecked":Je=Ye;break;case"value":j=Ye;break;case"defaultValue":te=Ye;break;case"children":case"dangerouslySetInnerHTML":if(Ye!=null)throw Error(i(137,h));break;default:Ye!==it&&Nn(u,h,Ve,Ye,_,it)}}Ws(u,j,te,Se,ze,Je,D,A);return;case"select":Ye=j=te=Ve=null;for(D in g)if(Se=g[D],g.hasOwnProperty(D)&&Se!=null)switch(D){case"value":break;case"multiple":Ye=Se;default:_.hasOwnProperty(D)||Nn(u,h,D,null,_,Se)}for(A in _)if(D=_[A],Se=g[A],_.hasOwnProperty(A)&&(D!=null||Se!=null))switch(A){case"value":Ve=D;break;case"defaultValue":te=D;break;case"multiple":j=D;default:D!==Se&&Nn(u,h,A,D,_,Se)}h=te,g=j,_=Ye,Ve!=null?Yi(u,!!g,Ve,!1):!!_!=!!g&&(h!=null?Yi(u,!!g,h,!0):Yi(u,!!g,g?[]:"",!1));return;case"textarea":Ye=Ve=null;for(te in g)if(A=g[te],g.hasOwnProperty(te)&&A!=null&&!_.hasOwnProperty(te))switch(te){case"value":break;case"children":break;default:Nn(u,h,te,null,_,A)}for(j in _)if(A=_[j],D=g[j],_.hasOwnProperty(j)&&(A!=null||D!=null))switch(j){case"value":Ve=A;break;case"defaultValue":Ye=A;break;case"children":break;case"dangerouslySetInnerHTML":if(A!=null)throw Error(i(91));break;default:A!==D&&Nn(u,h,j,A,_,D)}hr(u,Ve,Ye);return;case"option":for(var Tt in g)if(Ve=g[Tt],g.hasOwnProperty(Tt)&&Ve!=null&&!_.hasOwnProperty(Tt))switch(Tt){case"selected":u.selected=!1;break;default:Nn(u,h,Tt,null,_,Ve)}for(Se in _)if(Ve=_[Se],Ye=g[Se],_.hasOwnProperty(Se)&&Ve!==Ye&&(Ve!=null||Ye!=null))switch(Se){case"selected":u.selected=Ve&&typeof Ve!="function"&&typeof Ve!="symbol";break;default:Nn(u,h,Se,Ve,_,Ye)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var Ft in g)Ve=g[Ft],g.hasOwnProperty(Ft)&&Ve!=null&&!_.hasOwnProperty(Ft)&&Nn(u,h,Ft,null,_,Ve);for(ze in _)if(Ve=_[ze],Ye=g[ze],_.hasOwnProperty(ze)&&Ve!==Ye&&(Ve!=null||Ye!=null))switch(ze){case"children":case"dangerouslySetInnerHTML":if(Ve!=null)throw Error(i(137,h));break;default:Nn(u,h,ze,Ve,_,Ye)}return;default:if(Aw(h)){for(var Pn in g)Ve=g[Pn],g.hasOwnProperty(Pn)&&Ve!==void 0&&!_.hasOwnProperty(Pn)&&fE(u,h,Pn,void 0,_,Ve);for(Je in _)Ve=_[Je],Ye=g[Je],!_.hasOwnProperty(Je)||Ve===Ye||Ve===void 0&&Ye===void 0||fE(u,h,Je,Ve,_,Ye);return}}for(var Oe in g)Ve=g[Oe],g.hasOwnProperty(Oe)&&Ve!=null&&!_.hasOwnProperty(Oe)&&Nn(u,h,Oe,null,_,Ve);for(it in _)Ve=_[it],Ye=g[it],!_.hasOwnProperty(it)||Ve===Ye||Ve==null&&Ye==null||Nn(u,h,it,Ve,_,Ye)}function aU(u){switch(u){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function EQ(){if(typeof performance.getEntriesByType=="function"){for(var u=0,h=0,g=performance.getEntriesByType("resource"),_=0;_<g.length;_++){var A=g[_],D=A.transferSize,j=A.initiatorType,te=A.duration;if(D&&te&&aU(j)){for(j=0,te=A.responseEnd,_+=1;_<g.length;_++){var Se=g[_],ze=Se.startTime;if(ze>te)break;var Je=Se.transferSize,it=Se.initiatorType;Je&&aU(it)&&(Se=Se.responseEnd,j+=Je*(Se<te?1:(te-ze)/(Se-ze)))}if(--_,h+=8*(D+j)/(A.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 hE=null,pE=null;function kx(u){return u.nodeType===9?u:u.ownerDocument}function sU(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 oU(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 mE(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 gE=null;function AQ(){var u=window.event;return u&&u.type==="popstate"?u===gE?!1:(gE=u,!0):(gE=null,!1)}var lU=typeof setTimeout=="function"?setTimeout:void 0,TQ=typeof clearTimeout=="function"?clearTimeout:void 0,cU=typeof Promise=="function"?Promise:void 0,CQ=typeof queueMicrotask=="function"?queueMicrotask:typeof cU<"u"?function(u){return cU.resolve(null).then(u).catch(RQ)}:lU;function RQ(u){setTimeout(function(){throw u})}function Lc(u){return u==="head"}function uU(u,h){var g=h,_=0;do{var A=g.nextSibling;if(u.removeChild(g),A&&A.nodeType===8)if(g=A.data,g==="/$"||g==="/&"){if(_===0){u.removeChild(A),sh(h);return}_--}else if(g==="$"||g==="$?"||g==="$~"||g==="$!"||g==="&")_++;else if(g==="html")Ym(u.ownerDocument.documentElement);else if(g==="head"){g=u.ownerDocument.head,Ym(g);for(var D=g.firstChild;D;){var j=D.nextSibling,te=D.nodeName;D[Xe]||te==="SCRIPT"||te==="STYLE"||te==="LINK"&&D.rel.toLowerCase()==="stylesheet"||g.removeChild(D),D=j}}else g==="body"&&Ym(u.ownerDocument.body);g=A}while(g);sh(h)}function dU(u,h){var g=u;u=0;do{var _=g.nextSibling;if(g.nodeType===1?h?(g._stashedDisplay=g.style.display,g.style.display="none"):(g.style.display=g._stashedDisplay||"",g.getAttribute("style")===""&&g.removeAttribute("style")):g.nodeType===3&&(h?(g._stashedText=g.nodeValue,g.nodeValue=""):g.nodeValue=g._stashedText||""),_&&_.nodeType===8)if(g=_.data,g==="/$"){if(u===0)break;u--}else g!=="$"&&g!=="$?"&&g!=="$~"&&g!=="$!"||u++;g=_}while(g)}function vE(u){var h=u.firstChild;for(h&&h.nodeType===10&&(h=h.nextSibling);h;){var g=h;switch(h=h.nextSibling,g.nodeName){case"HTML":case"HEAD":case"BODY":vE(g),We(g);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(g.rel.toLowerCase()==="stylesheet")continue}u.removeChild(g)}}function NQ(u,h,g,_){for(;u.nodeType===1;){var A=g;if(u.nodeName.toLowerCase()!==h.toLowerCase()){if(!_&&(u.nodeName!=="INPUT"||u.type!=="hidden"))break}else if(_){if(!u[Xe])switch(h){case"meta":if(!u.hasAttribute("itemprop"))break;return u;case"link":if(D=u.getAttribute("rel"),D==="stylesheet"&&u.hasAttribute("data-precedence"))break;if(D!==A.rel||u.getAttribute("href")!==(A.href==null||A.href===""?null:A.href)||u.getAttribute("crossorigin")!==(A.crossOrigin==null?null:A.crossOrigin)||u.getAttribute("title")!==(A.title==null?null:A.title))break;return u;case"style":if(u.hasAttribute("data-precedence"))break;return u;case"script":if(D=u.getAttribute("src"),(D!==(A.src==null?null:A.src)||u.getAttribute("type")!==(A.type==null?null:A.type)||u.getAttribute("crossorigin")!==(A.crossOrigin==null?null:A.crossOrigin))&&D&&u.hasAttribute("async")&&!u.hasAttribute("itemprop"))break;return u;default:return u}}else if(h==="input"&&u.type==="hidden"){var D=A.name==null?null:""+A.name;if(A.type==="hidden"&&u.getAttribute("name")===D)return u}else return u;if(u=ms(u.nextSibling),u===null)break}return null}function PQ(u,h,g){if(h==="")return null;for(;u.nodeType!==3;)if((u.nodeType!==1||u.nodeName!=="INPUT"||u.type!=="hidden")&&!g||(u=ms(u.nextSibling),u===null))return null;return u}function fU(u,h){for(;u.nodeType!==8;)if((u.nodeType!==1||u.nodeName!=="INPUT"||u.type!=="hidden")&&!h||(u=ms(u.nextSibling),u===null))return null;return u}function xE(u){return u.data==="$?"||u.data==="$~"}function yE(u){return u.data==="$!"||u.data==="$?"&&u.ownerDocument.readyState!=="loading"}function DQ(u,h){var g=u.ownerDocument;if(u.data==="$~")u._reactRetry=h;else if(u.data!=="$?"||g.readyState!=="loading")h();else{var _=function(){h(),g.removeEventListener("DOMContentLoaded",_)};g.addEventListener("DOMContentLoaded",_),u._reactRetry=_}}function ms(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 bE=null;function hU(u){u=u.nextSibling;for(var h=0;u;){if(u.nodeType===8){var g=u.data;if(g==="/$"||g==="/&"){if(h===0)return ms(u.nextSibling);h--}else g!=="$"&&g!=="$!"&&g!=="$?"&&g!=="$~"&&g!=="&"||h++}u=u.nextSibling}return null}function pU(u){u=u.previousSibling;for(var h=0;u;){if(u.nodeType===8){var g=u.data;if(g==="$"||g==="$!"||g==="$?"||g==="$~"||g==="&"){if(h===0)return u;h--}else g!=="/$"&&g!=="/&"||h++}u=u.previousSibling}return null}function mU(u,h,g){switch(h=kx(g),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 Ym(u){for(var h=u.attributes;h.length;)u.removeAttributeNode(h[0]);We(u)}var gs=new Map,gU=new Set;function Ix(u){return typeof u.getRootNode=="function"?u.getRootNode():u.nodeType===9?u:u.ownerDocument}var hl=G.d;G.d={f:OQ,r:LQ,D:kQ,C:IQ,L:UQ,m:FQ,X:BQ,S:zQ,M:jQ};function OQ(){var u=hl.f(),h=Tx();return u||h}function LQ(u){var h=Z(u);h!==null&&h.tag===5&&h.type==="form"?Ok(h):hl.r(u)}var ih=typeof document>"u"?null:document;function vU(u,h,g){var _=ih;if(_&&typeof h=="string"&&h){var A=Sn(h);A='link[rel="'+u+'"][href="'+A+'"]',typeof g=="string"&&(A+='[crossorigin="'+g+'"]'),gU.has(A)||(gU.add(A),u={rel:u,crossOrigin:g,href:h},_.querySelector(A)===null&&(h=_.createElement("link"),Pr(h,"link",u),Re(h),_.head.appendChild(h)))}}function kQ(u){hl.D(u),vU("dns-prefetch",u,null)}function IQ(u,h){hl.C(u,h),vU("preconnect",u,h)}function UQ(u,h,g){hl.L(u,h,g);var _=ih;if(_&&u&&h){var A='link[rel="preload"][as="'+Sn(h)+'"]';h==="image"&&g&&g.imageSrcSet?(A+='[imagesrcset="'+Sn(g.imageSrcSet)+'"]',typeof g.imageSizes=="string"&&(A+='[imagesizes="'+Sn(g.imageSizes)+'"]')):A+='[href="'+Sn(u)+'"]';var D=A;switch(h){case"style":D=rh(u);break;case"script":D=ah(u)}gs.has(D)||(u=f({rel:"preload",href:h==="image"&&g&&g.imageSrcSet?void 0:u,as:h},g),gs.set(D,u),_.querySelector(A)!==null||h==="style"&&_.querySelector(Km(D))||h==="script"&&_.querySelector(Zm(D))||(h=_.createElement("link"),Pr(h,"link",u),Re(h),_.head.appendChild(h)))}}function FQ(u,h){hl.m(u,h);var g=ih;if(g&&u){var _=h&&typeof h.as=="string"?h.as:"script",A='link[rel="modulepreload"][as="'+Sn(_)+'"][href="'+Sn(u)+'"]',D=A;switch(_){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":D=ah(u)}if(!gs.has(D)&&(u=f({rel:"modulepreload",href:u},h),gs.set(D,u),g.querySelector(A)===null)){switch(_){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(g.querySelector(Zm(D)))return}_=g.createElement("link"),Pr(_,"link",u),Re(_),g.head.appendChild(_)}}}function zQ(u,h,g){hl.S(u,h,g);var _=ih;if(_&&u){var A=Ne(_).hoistableStyles,D=rh(u);h=h||"default";var j=A.get(D);if(!j){var te={loading:0,preload:null};if(j=_.querySelector(Km(D)))te.loading=5;else{u=f({rel:"stylesheet",href:u,"data-precedence":h},g),(g=gs.get(D))&&_E(u,g);var Se=j=_.createElement("link");Re(Se),Pr(Se,"link",u),Se._p=new Promise(function(ze,Je){Se.onload=ze,Se.onerror=Je}),Se.addEventListener("load",function(){te.loading|=1}),Se.addEventListener("error",function(){te.loading|=2}),te.loading|=4,Ux(j,h,_)}j={type:"stylesheet",instance:j,count:1,state:te},A.set(D,j)}}}function BQ(u,h){hl.X(u,h);var g=ih;if(g&&u){var _=Ne(g).hoistableScripts,A=ah(u),D=_.get(A);D||(D=g.querySelector(Zm(A)),D||(u=f({src:u,async:!0},h),(h=gs.get(A))&&SE(u,h),D=g.createElement("script"),Re(D),Pr(D,"link",u),g.head.appendChild(D)),D={type:"script",instance:D,count:1,state:null},_.set(A,D))}}function jQ(u,h){hl.M(u,h);var g=ih;if(g&&u){var _=Ne(g).hoistableScripts,A=ah(u),D=_.get(A);D||(D=g.querySelector(Zm(A)),D||(u=f({src:u,async:!0,type:"module"},h),(h=gs.get(A))&&SE(u,h),D=g.createElement("script"),Re(D),Pr(D,"link",u),g.head.appendChild(D)),D={type:"script",instance:D,count:1,state:null},_.set(A,D))}}function xU(u,h,g,_){var A=(A=me.current)?Ix(A):null;if(!A)throw Error(i(446));switch(u){case"meta":case"title":return null;case"style":return typeof g.precedence=="string"&&typeof g.href=="string"?(h=rh(g.href),g=Ne(A).hoistableStyles,_=g.get(h),_||(_={type:"style",instance:null,count:0,state:null},g.set(h,_)),_):{type:"void",instance:null,count:0,state:null};case"link":if(g.rel==="stylesheet"&&typeof g.href=="string"&&typeof g.precedence=="string"){u=rh(g.href);var D=Ne(A).hoistableStyles,j=D.get(u);if(j||(A=A.ownerDocument||A,j={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},D.set(u,j),(D=A.querySelector(Km(u)))&&!D._p&&(j.instance=D,j.state.loading=5),gs.has(u)||(g={rel:"preload",as:"style",href:g.href,crossOrigin:g.crossOrigin,integrity:g.integrity,media:g.media,hrefLang:g.hrefLang,referrerPolicy:g.referrerPolicy},gs.set(u,g),D||HQ(A,u,g,j.state))),h&&_===null)throw Error(i(528,""));return j}if(h&&_!==null)throw Error(i(529,""));return null;case"script":return h=g.async,g=g.src,typeof g=="string"&&h&&typeof h!="function"&&typeof h!="symbol"?(h=ah(g),g=Ne(A).hoistableScripts,_=g.get(h),_||(_={type:"script",instance:null,count:0,state:null},g.set(h,_)),_):{type:"void",instance:null,count:0,state:null};default:throw Error(i(444,u))}}function rh(u){return'href="'+Sn(u)+'"'}function Km(u){return'link[rel="stylesheet"]['+u+"]"}function yU(u){return f({},u,{"data-precedence":u.precedence,precedence:null})}function HQ(u,h,g,_){u.querySelector('link[rel="preload"][as="style"]['+h+"]")?_.loading=1:(h=u.createElement("link"),_.preload=h,h.addEventListener("load",function(){return _.loading|=1}),h.addEventListener("error",function(){return _.loading|=2}),Pr(h,"link",g),Re(h),u.head.appendChild(h))}function ah(u){return'[src="'+Sn(u)+'"]'}function Zm(u){return"script[async]"+u}function bU(u,h,g){if(h.count++,h.instance===null)switch(h.type){case"style":var _=u.querySelector('style[data-href~="'+Sn(g.href)+'"]');if(_)return h.instance=_,Re(_),_;var A=f({},g,{"data-href":g.href,"data-precedence":g.precedence,href:null,precedence:null});return _=(u.ownerDocument||u).createElement("style"),Re(_),Pr(_,"style",A),Ux(_,g.precedence,u),h.instance=_;case"stylesheet":A=rh(g.href);var D=u.querySelector(Km(A));if(D)return h.state.loading|=4,h.instance=D,Re(D),D;_=yU(g),(A=gs.get(A))&&_E(_,A),D=(u.ownerDocument||u).createElement("link"),Re(D);var j=D;return j._p=new Promise(function(te,Se){j.onload=te,j.onerror=Se}),Pr(D,"link",_),h.state.loading|=4,Ux(D,g.precedence,u),h.instance=D;case"script":return D=ah(g.src),(A=u.querySelector(Zm(D)))?(h.instance=A,Re(A),A):(_=g,(A=gs.get(D))&&(_=f({},g),SE(_,A)),u=u.ownerDocument||u,A=u.createElement("script"),Re(A),Pr(A,"link",_),u.head.appendChild(A),h.instance=A);case"void":return null;default:throw Error(i(443,h.type))}else h.type==="stylesheet"&&(h.state.loading&4)===0&&(_=h.instance,h.state.loading|=4,Ux(_,g.precedence,u));return h.instance}function Ux(u,h,g){for(var _=g.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),A=_.length?_[_.length-1]:null,D=A,j=0;j<_.length;j++){var te=_[j];if(te.dataset.precedence===h)D=te;else if(D!==A)break}D?D.parentNode.insertBefore(u,D.nextSibling):(h=g.nodeType===9?g.head:g,h.insertBefore(u,h.firstChild))}function _E(u,h){u.crossOrigin==null&&(u.crossOrigin=h.crossOrigin),u.referrerPolicy==null&&(u.referrerPolicy=h.referrerPolicy),u.title==null&&(u.title=h.title)}function SE(u,h){u.crossOrigin==null&&(u.crossOrigin=h.crossOrigin),u.referrerPolicy==null&&(u.referrerPolicy=h.referrerPolicy),u.integrity==null&&(u.integrity=h.integrity)}var Fx=null;function _U(u,h,g){if(Fx===null){var _=new Map,A=Fx=new Map;A.set(g,_)}else A=Fx,_=A.get(g),_||(_=new Map,A.set(g,_));if(_.has(u))return _;for(_.set(u,null),g=g.getElementsByTagName(u),A=0;A<g.length;A++){var D=g[A];if(!(D[Xe]||D[si]||u==="link"&&D.getAttribute("rel")==="stylesheet")&&D.namespaceURI!=="http://www.w3.org/2000/svg"){var j=D.getAttribute(h)||"";j=u+j;var te=_.get(j);te?te.push(D):_.set(j,[D])}}return _}function SU(u,h,g){u=u.ownerDocument||u,u.head.insertBefore(g,h==="title"?u.querySelector("head > title"):null)}function VQ(u,h,g){if(g===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 wU(u){return!(u.type==="stylesheet"&&(u.state.loading&3)===0)}function GQ(u,h,g,_){if(g.type==="stylesheet"&&(typeof _.media!="string"||matchMedia(_.media).matches!==!1)&&(g.state.loading&4)===0){if(g.instance===null){var A=rh(_.href),D=h.querySelector(Km(A));if(D){h=D._p,h!==null&&typeof h=="object"&&typeof h.then=="function"&&(u.count++,u=zx.bind(u),h.then(u,u)),g.state.loading|=4,g.instance=D,Re(D);return}D=h.ownerDocument||h,_=yU(_),(A=gs.get(A))&&_E(_,A),D=D.createElement("link"),Re(D);var j=D;j._p=new Promise(function(te,Se){j.onload=te,j.onerror=Se}),Pr(D,"link",_),g.instance=D}u.stylesheets===null&&(u.stylesheets=new Map),u.stylesheets.set(g,h),(h=g.state.preload)&&(g.state.loading&3)===0&&(u.count++,g=zx.bind(u),h.addEventListener("load",g),h.addEventListener("error",g))}}var wE=0;function $Q(u,h){return u.stylesheets&&u.count===0&&jx(u,u.stylesheets),0<u.count||0<u.imgCount?function(g){var _=setTimeout(function(){if(u.stylesheets&&jx(u,u.stylesheets),u.unsuspend){var D=u.unsuspend;u.unsuspend=null,D()}},6e4+h);0<u.imgBytes&&wE===0&&(wE=62500*EQ());var A=setTimeout(function(){if(u.waitingForImages=!1,u.count===0&&(u.stylesheets&&jx(u,u.stylesheets),u.unsuspend)){var D=u.unsuspend;u.unsuspend=null,D()}},(u.imgBytes>wE?50:800)+h);return u.unsuspend=g,function(){u.unsuspend=null,clearTimeout(_),clearTimeout(A)}}:null}function zx(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)jx(this,this.stylesheets);else if(this.unsuspend){var u=this.unsuspend;this.unsuspend=null,u()}}}var Bx=null;function jx(u,h){u.stylesheets=null,u.unsuspend!==null&&(u.count++,Bx=new Map,h.forEach(WQ,u),Bx=null,zx.call(u))}function WQ(u,h){if(!(h.state.loading&4)){var g=Bx.get(u);if(g)var _=g.get(null);else{g=new Map,Bx.set(u,g);for(var A=u.querySelectorAll("link[data-precedence],style[data-precedence]"),D=0;D<A.length;D++){var j=A[D];(j.nodeName==="LINK"||j.getAttribute("media")!=="not all")&&(g.set(j.dataset.precedence,j),_=j)}_&&g.set(null,_)}A=h.instance,j=A.getAttribute("data-precedence"),D=g.get(j)||_,D===_&&g.set(null,A),g.set(j,A),this.count++,_=zx.bind(this),A.addEventListener("load",_),A.addEventListener("error",_),D?D.parentNode.insertBefore(A,D.nextSibling):(u=u.nodeType===9?u.head:u,u.insertBefore(A,u.firstChild)),h.state.loading|=4}}var Jm={$$typeof:w,Provider:null,Consumer:null,_currentValue:Y,_currentValue2:Y,_threadCount:0};function qQ(u,h,g,_,A,D,j,te,Se){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=Ct(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ct(0),this.hiddenUpdates=Ct(null),this.identifierPrefix=_,this.onUncaughtError=A,this.onCaughtError=D,this.onRecoverableError=j,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=Se,this.incompleteTransitions=new Map}function MU(u,h,g,_,A,D,j,te,Se,ze,Je,it){return u=new qQ(u,h,g,j,Se,ze,Je,it,te),h=1,D===!0&&(h|=24),D=ja(3,null,null,h),u.current=D,D.stateNode=u,h=nM(),h.refCount++,u.pooledCache=h,h.refCount++,D.memoizedState={element:_,isDehydrated:g,cache:h},sM(D),u}function EU(u){return u?(u=If,u):If}function AU(u,h,g,_,A,D){A=EU(A),_.context===null?_.context=A:_.pendingContext=A,_=wc(h),_.payload={element:g},D=D===void 0?null:D,D!==null&&(_.callback=D),g=Mc(u,_,h),g!==null&&(Ma(g,u,h),Nm(g,u,h))}function TU(u,h){if(u=u.memoizedState,u!==null&&u.dehydrated!==null){var g=u.retryLane;u.retryLane=g!==0&&g<h?g:h}}function ME(u,h){TU(u,h),(u=u.alternate)&&TU(u,h)}function CU(u){if(u.tag===13||u.tag===31){var h=Yu(u,67108864);h!==null&&Ma(h,u,67108864),ME(u,67108864)}}function RU(u){if(u.tag===13||u.tag===31){var h=Wa();h=Xi(h);var g=Yu(u,h);g!==null&&Ma(g,u,h),ME(u,h)}}var Hx=!0;function XQ(u,h,g,_){var A=q.T;q.T=null;var D=G.p;try{G.p=2,EE(u,h,g,_)}finally{G.p=D,q.T=A}}function YQ(u,h,g,_){var A=q.T;q.T=null;var D=G.p;try{G.p=8,EE(u,h,g,_)}finally{G.p=D,q.T=A}}function EE(u,h,g,_){if(Hx){var A=AE(_);if(A===null)dE(u,h,_,Vx,g),PU(u,_);else if(ZQ(A,u,h,g,_))_.stopPropagation();else if(PU(u,_),h&4&&-1<KQ.indexOf(u)){for(;A!==null;){var D=Z(A);if(D!==null)switch(D.tag){case 3:if(D=D.stateNode,D.current.memoizedState.isDehydrated){var j=Ee(D.pendingLanes);if(j!==0){var te=D;for(te.pendingLanes|=2,te.entangledLanes|=2;j;){var Se=1<<31-et(j);te.entanglements[1]|=Se,j&=~Se}wo(D),(_n&6)===0&&(Ex=k()+500,Wm(0))}}break;case 31:case 13:te=Yu(D,2),te!==null&&Ma(te,D,2),Tx(),ME(D,2)}if(D=AE(_),D===null&&dE(u,h,_,Vx,g),D===A)break;A=D}A!==null&&_.stopPropagation()}else dE(u,h,_,null,g)}}function AE(u){return u=Cw(u),TE(u)}var Vx=null;function TE(u){if(Vx=null,u=bt(u),u!==null){var h=a(u);if(h===null)u=null;else{var g=h.tag;if(g===13){if(u=s(h),u!==null)return u;u=null}else if(g===31){if(u=o(h),u!==null)return u;u=null}else if(g===3){if(h.stateNode.current.memoizedState.isDehydrated)return h.tag===3?h.stateNode.containerInfo:null;u=null}else h!==u&&(u=null)}}return Vx=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(K()){case pe:return 2;case xe:return 8;case fe:case Ke:return 32;case ke:return 268435456;default:return 32}default:return 32}}var CE=!1,kc=null,Ic=null,Uc=null,Qm=new Map,eg=new Map,Fc=[],KQ="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 PU(u,h){switch(u){case"focusin":case"focusout":kc=null;break;case"dragenter":case"dragleave":Ic=null;break;case"mouseover":case"mouseout":Uc=null;break;case"pointerover":case"pointerout":Qm.delete(h.pointerId);break;case"gotpointercapture":case"lostpointercapture":eg.delete(h.pointerId)}}function tg(u,h,g,_,A,D){return u===null||u.nativeEvent!==D?(u={blockedOn:h,domEventName:g,eventSystemFlags:_,nativeEvent:D,targetContainers:[A]},h!==null&&(h=Z(h),h!==null&&CU(h)),u):(u.eventSystemFlags|=_,h=u.targetContainers,A!==null&&h.indexOf(A)===-1&&h.push(A),u)}function ZQ(u,h,g,_,A){switch(h){case"focusin":return kc=tg(kc,u,h,g,_,A),!0;case"dragenter":return Ic=tg(Ic,u,h,g,_,A),!0;case"mouseover":return Uc=tg(Uc,u,h,g,_,A),!0;case"pointerover":var D=A.pointerId;return Qm.set(D,tg(Qm.get(D)||null,u,h,g,_,A)),!0;case"gotpointercapture":return D=A.pointerId,eg.set(D,tg(eg.get(D)||null,u,h,g,_,A)),!0}return!1}function DU(u){var h=bt(u.target);if(h!==null){var g=a(h);if(g!==null){if(h=g.tag,h===13){if(h=s(g),h!==null){u.blockedOn=h,Vr(u.priority,function(){RU(g)});return}}else if(h===31){if(h=o(g),h!==null){u.blockedOn=h,Vr(u.priority,function(){RU(g)});return}}else if(h===3&&g.stateNode.current.memoizedState.isDehydrated){u.blockedOn=g.tag===3?g.stateNode.containerInfo:null;return}}}u.blockedOn=null}function Gx(u){if(u.blockedOn!==null)return!1;for(var h=u.targetContainers;0<h.length;){var g=AE(u.nativeEvent);if(g===null){g=u.nativeEvent;var _=new g.constructor(g.type,g);Tw=_,g.target.dispatchEvent(_),Tw=null}else return h=Z(g),h!==null&&CU(h),u.blockedOn=g,!1;h.shift()}return!0}function OU(u,h,g){Gx(u)&&g.delete(h)}function JQ(){CE=!1,kc!==null&&Gx(kc)&&(kc=null),Ic!==null&&Gx(Ic)&&(Ic=null),Uc!==null&&Gx(Uc)&&(Uc=null),Qm.forEach(OU),eg.forEach(OU)}function $x(u,h){u.blockedOn===h&&(u.blockedOn=null,CE||(CE=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,JQ)))}var Wx=null;function LU(u){Wx!==u&&(Wx=u,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){Wx===u&&(Wx=null);for(var h=0;h<u.length;h+=3){var g=u[h],_=u[h+1],A=u[h+2];if(typeof _!="function"){if(TE(_||g)===null)continue;break}var D=Z(g);D!==null&&(u.splice(h,3),h-=3,AM(D,{pending:!0,data:A,method:g.method,action:_},_,A))}}))}function sh(u){function h(Se){return $x(Se,u)}kc!==null&&$x(kc,u),Ic!==null&&$x(Ic,u),Uc!==null&&$x(Uc,u),Qm.forEach(h),eg.forEach(h);for(var g=0;g<Fc.length;g++){var _=Fc[g];_.blockedOn===u&&(_.blockedOn=null)}for(;0<Fc.length&&(g=Fc[0],g.blockedOn===null);)DU(g),g.blockedOn===null&&Fc.shift();if(g=(u.ownerDocument||u).$$reactFormReplay,g!=null)for(_=0;_<g.length;_+=3){var A=g[_],D=g[_+1],j=A[wi]||null;if(typeof D=="function")j||LU(g);else if(j){var te=null;if(D&&D.hasAttribute("formAction")){if(A=D,j=D[wi]||null)te=j.formAction;else if(TE(A)!==null)continue}else te=j.action;typeof te=="function"?g[_+1]=te:(g.splice(_,3),_-=3),LU(g)}}}function kU(){function u(D){D.canIntercept&&D.info==="react-transition"&&D.intercept({handler:function(){return new Promise(function(j){return A=j})},focusReset:"manual",scroll:"manual"})}function h(){A!==null&&(A(),A=null),_||setTimeout(g,20)}function g(){if(!_&&!navigation.transition){var D=navigation.currentEntry;D&&D.url!=null&&navigation.navigate(D.url,{state:D.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var _=!1,A=null;return navigation.addEventListener("navigate",u),navigation.addEventListener("navigatesuccess",h),navigation.addEventListener("navigateerror",h),setTimeout(g,100),function(){_=!0,navigation.removeEventListener("navigate",u),navigation.removeEventListener("navigatesuccess",h),navigation.removeEventListener("navigateerror",h),A!==null&&(A(),A=null)}}}function RE(u){this._internalRoot=u}qx.prototype.render=RE.prototype.render=function(u){var h=this._internalRoot;if(h===null)throw Error(i(409));var g=h.current,_=Wa();AU(g,_,u,h,null,null)},qx.prototype.unmount=RE.prototype.unmount=function(){var u=this._internalRoot;if(u!==null){this._internalRoot=null;var h=u.containerInfo;AU(u.current,2,null,u,null,null),Tx(),h[$s]=null}};function qx(u){this._internalRoot=u}qx.prototype.unstable_scheduleHydration=function(u){if(u){var h=Ar();u={blockedOn:null,target:u,priority:h};for(var g=0;g<Fc.length&&h!==0&&h<Fc[g].priority;g++);Fc.splice(g,0,u),g===0&&DU(u)}};var IU=e.version;if(IU!=="19.2.0")throw Error(i(527,IU,"19.2.0"));G.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 QQ={bundleType:0,version:"19.2.0",rendererPackageName:"react-dom",currentDispatcherRef:q,reconcilerVersion:"19.2.0"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Xx=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Xx.isDisabled&&Xx.supportsFiber)try{Ue=Xx.inject(QQ),Pe=Xx}catch{}}return ig.createRoot=function(u,h){if(!r(u))throw Error(i(299));var g=!1,_="",A=Vk,D=Gk,j=$k;return h!=null&&(h.unstable_strictMode===!0&&(g=!0),h.identifierPrefix!==void 0&&(_=h.identifierPrefix),h.onUncaughtError!==void 0&&(A=h.onUncaughtError),h.onCaughtError!==void 0&&(D=h.onCaughtError),h.onRecoverableError!==void 0&&(j=h.onRecoverableError)),h=MU(u,1,!1,null,null,g,_,null,A,D,j,kU),u[$s]=h.current,uE(u),new RE(h)},ig.hydrateRoot=function(u,h,g){if(!r(u))throw Error(i(299));var _=!1,A="",D=Vk,j=Gk,te=$k,Se=null;return g!=null&&(g.unstable_strictMode===!0&&(_=!0),g.identifierPrefix!==void 0&&(A=g.identifierPrefix),g.onUncaughtError!==void 0&&(D=g.onUncaughtError),g.onCaughtError!==void 0&&(j=g.onCaughtError),g.onRecoverableError!==void 0&&(te=g.onRecoverableError),g.formState!==void 0&&(Se=g.formState)),h=MU(u,1,!0,h,g??null,_,A,Se,D,j,te,kU),h.context=EU(null),g=h.current,_=Wa(),_=Xi(_),A=wc(_),A.callback=null,Mc(g,A,_),g=_,h.current.lanes=g,tn(h,g),wo(h),u[$s]=h.current,uE(u),new qx(h)},ig.version="19.2.0",ig}var WU;function uee(){if(WU)return DE.exports;WU=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(),DE.exports=cee(),DE.exports}var dee=uee();var qU="popstate";function fee(t={}){function e(i,r){let{pathname:a,search:s,hash:o}=i.location;return v2("",{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:o0(r)}return pee(e,n,null,t)}function li(t,e){if(t===!1||t===null||typeof t>"u")throw new Error(e)}function po(t,e){if(!t){typeof console<"u"&&console.warn(e);try{throw new Error(e)}catch{}}}function hee(){return Math.random().toString(36).substring(2,10)}function XU(t,e){return{usr:t.state,key:t.key,idx:e}}function v2(t,e,n=null,i){return{pathname:typeof t=="string"?t:t.pathname,search:"",hash:"",...typeof e=="string"?Vp(e):e,state:n,key:e&&e.key||i||hee()}}function o0({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 Vp(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 pee(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 x=d(),v=x==null?null:x-c;c=x,l&&l({action:o,location:b.location,delta:v})}function p(x,v){o="PUSH";let M=v2(b.location,x,v);c=d()+1;let w=XU(M,c),E=b.createHref(M);try{s.pushState(w,"",E)}catch(T){if(T instanceof DOMException&&T.name==="DataCloneError")throw T;r.location.assign(E)}a&&l&&l({action:o,location:b.location,delta:1})}function m(x,v){o="REPLACE";let M=v2(b.location,x,v);c=d();let w=XU(M,c),E=b.createHref(M);s.replaceState(w,"",E),a&&l&&l({action:o,location:b.location,delta:0})}function y(x){return mee(x)}let b={get action(){return o},get location(){return t(r,s)},listen(x){if(l)throw new Error("A history only accepts one active listener");return r.addEventListener(qU,f),l=x,()=>{r.removeEventListener(qU,f),l=null}},createHref(x){return e(r,x)},createURL:y,encodeLocation(x){let v=y(x);return{pathname:v.pathname,search:v.search,hash:v.hash}},push:p,replace:m,go(x){return s.go(x)}};return b}function mee(t,e=!1){let n="http://localhost";typeof window<"u"&&(n=window.location.origin!=="null"?window.location.origin:window.location.href),li(n,"No window.location.(origin|href) available to create URL");let i=typeof t=="string"?t:o0(t);return i=i.replace(/ $/,"%20"),!e&&i.startsWith("//")&&(i=n+i),new URL(i,n)}function RV(t,e,n="/"){return gee(t,e,n,!1)}function gee(t,e,n,i){let r=typeof e=="string"?Vp(e):e,a=Zl(r.pathname||"/",n);if(a==null)return null;let s=NV(t);vee(s);let o=null;for(let l=0;o==null&&l<s.length;++l){let c=Cee(a);o=Aee(s[l],c,i)}return o}function NV(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;li(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=Vl([i,d.relativePath]),p=n.concat(d);s.children&&s.children.length>0&&(li(s.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${f}".`),NV(s.children,e,p,f,l)),!(s.path==null&&!s.index)&&e.push({path:f,score:Mee(f,s.index),routesMeta:p})};return t.forEach((s,o)=>{if(s.path===""||!s.path?.includes("?"))a(s,o);else for(let l of PV(s.path))a(s,o,!0,l)}),e}function PV(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=PV(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 vee(t){t.sort((e,n)=>e.score!==n.score?n.score-e.score:Eee(e.routesMeta.map(i=>i.childrenIndex),n.routesMeta.map(i=>i.childrenIndex)))}var xee=/^:[\w-]+$/,yee=3,bee=2,_ee=1,See=10,wee=-2,YU=t=>t==="*";function Mee(t,e){let n=t.split("/"),i=n.length;return n.some(YU)&&(i+=wee),e&&(i+=bee),n.filter(r=>!YU(r)).reduce((r,a)=>r+(xee.test(a)?yee:a===""?_ee:See),i)}function Eee(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 Aee(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=Kb({path:l.relativePath,caseSensitive:l.caseSensitive,end:c},d),p=l.route;if(!f&&c&&n&&!i[i.length-1].route.index&&(f=Kb({path:l.relativePath,caseSensitive:l.caseSensitive,end:!1},d)),!f)return null;Object.assign(r,f.params),s.push({params:r,pathname:Vl([a,f.pathname]),pathnameBase:Oee(Vl([a,f.pathnameBase])),route:p}),f.pathnameBase!=="/"&&(a=Vl([a,f.pathnameBase]))}return s}function Kb(t,e){typeof t=="string"&&(t={path:t,caseSensitive:!1,end:!0});let[n,i]=Tee(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},p)=>{if(d==="*"){let y=o[p]||"";s=a.slice(0,a.length-y.length).replace(/(.)\/+$/,"$1")}const m=o[p];return f&&!m?c[d]=void 0:c[d]=(m||"").replace(/%2F/g,"/"),c},{}),pathname:a,pathnameBase:s,pattern:t}}function Tee(t,e=!1,n=!0){po(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 Cee(t){try{return t.split("/").map(e=>decodeURIComponent(e).replace(/\//g,"%2F")).join("/")}catch(e){return po(!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 Zl(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 Ree=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Nee=t=>Ree.test(t);function Pee(t,e="/"){let{pathname:n,search:i="",hash:r=""}=typeof t=="string"?Vp(t):t,a;if(n)if(Nee(n))a=n;else{if(n.includes("//")){let s=n;n=n.replace(/\/\/+/g,"/"),po(!1,`Pathnames cannot have embedded double slashes - normalizing ${s} -> ${n}`)}n.startsWith("/")?a=KU(n.substring(1),"/"):a=KU(n,e)}else a=e;return{pathname:a,search:Lee(i),hash:kee(r)}}function KU(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 IE(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 Dee(t){return t.filter((e,n)=>n===0||e.route.path&&e.route.path.length>0)}function DV(t){let e=Dee(t);return e.map((n,i)=>i===e.length-1?n.pathname:n.pathnameBase)}function OV(t,e,n,i=!1){let r;typeof t=="string"?r=Vp(t):(r={...t},li(!r.pathname||!r.pathname.includes("?"),IE("?","pathname","search",r)),li(!r.pathname||!r.pathname.includes("#"),IE("#","pathname","hash",r)),li(!r.search||!r.search.includes("#"),IE("#","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 p=s.split("/");for(;p[0]==="..";)p.shift(),f-=1;r.pathname=p.join("/")}o=f>=0?e[f]:"/"}let l=Pee(r,o),c=s&&s!=="/"&&s.endsWith("/"),d=(a||s===".")&&n.endsWith("/");return!l.pathname.endsWith("/")&&(c||d)&&(l.pathname+="/"),l}var Vl=t=>t.join("/").replace(/\/\/+/g,"/"),Oee=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),Lee=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,kee=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t;function Iee(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 LV=["POST","PUT","PATCH","DELETE"];new Set(LV);var Uee=["GET",...LV];new Set(Uee);var Gp=C.createContext(null);Gp.displayName="DataRouter";var tS=C.createContext(null);tS.displayName="DataRouterState";C.createContext(!1);var kV=C.createContext({isTransitioning:!1});kV.displayName="ViewTransition";var Fee=C.createContext(new Map);Fee.displayName="Fetchers";var zee=C.createContext(null);zee.displayName="Await";var qo=C.createContext(null);qo.displayName="Navigation";var Q0=C.createContext(null);Q0.displayName="Location";var Xo=C.createContext({outlet:null,matches:[],isDataRoute:!1});Xo.displayName="Route";var bN=C.createContext(null);bN.displayName="RouteError";function Bee(t,{relative:e}={}){li(ev(),"useHref() may be used only in the context of a <Router> component.");let{basename:n,navigator:i}=C.useContext(qo),{hash:r,pathname:a,search:s}=tv(t,{relative:e}),o=a;return n!=="/"&&(o=a==="/"?n:Vl([n,a])),i.createHref({pathname:o,search:s,hash:r})}function ev(){return C.useContext(Q0)!=null}function wf(){return li(ev(),"useLocation() may be used only in the context of a <Router> component."),C.useContext(Q0).location}var IV="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function UV(t){C.useContext(qo).static||C.useLayoutEffect(t)}function FV(){let{isDataRoute:t}=C.useContext(Xo);return t?tte():jee()}function jee(){li(ev(),"useNavigate() may be used only in the context of a <Router> component.");let t=C.useContext(Gp),{basename:e,navigator:n}=C.useContext(qo),{matches:i}=C.useContext(Xo),{pathname:r}=wf(),a=JSON.stringify(DV(i)),s=C.useRef(!1);return UV(()=>{s.current=!0}),C.useCallback((l,c={})=>{if(po(s.current,IV),!s.current)return;if(typeof l=="number"){n.go(l);return}let d=OV(l,JSON.parse(a),r,c.relative==="path");t==null&&e!=="/"&&(d.pathname=d.pathname==="/"?e:Vl([e,d.pathname])),(c.replace?n.replace:n.push)(d,c.state,c)},[e,n,a,r,t])}var Hee=C.createContext(null);function Vee(t){let e=C.useContext(Xo).outlet;return C.useMemo(()=>e&&C.createElement(Hee.Provider,{value:t},e),[e,t])}function tv(t,{relative:e}={}){let{matches:n}=C.useContext(Xo),{pathname:i}=wf(),r=JSON.stringify(DV(n));return C.useMemo(()=>OV(t,JSON.parse(r),i,e==="path"),[t,r,i,e])}function Gee(t,e){return zV(t,e)}function zV(t,e,n,i,r){li(ev(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:a}=C.useContext(qo),{matches:s}=C.useContext(Xo),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||"";BV(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 p=wf(),m;if(e){let M=typeof e=="string"?Vp(e):e;li(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.`),m=M}else m=p;let y=m.pathname||"/",b=y;if(d!=="/"){let M=d.replace(/^\//,"").split("/");b="/"+y.replace(/^\//,"").split("/").slice(M.length).join("/")}let x=RV(t,{pathname:b});po(f||x!=null,`No routes matched location "${m.pathname}${m.search}${m.hash}" `),po(x==null||x[x.length-1].route.element!==void 0||x[x.length-1].route.Component!==void 0||x[x.length-1].route.lazy!==void 0,`Matched leaf route at location "${m.pathname}${m.search}${m.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let v=Yee(x&&x.map(M=>Object.assign({},M,{params:Object.assign({},l,M.params),pathname:Vl([d,a.encodeLocation?a.encodeLocation(M.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:M.pathname]),pathnameBase:M.pathnameBase==="/"?d:Vl([d,a.encodeLocation?a.encodeLocation(M.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:M.pathnameBase])})),s,n,i,r);return e&&v?C.createElement(Q0.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",...m},navigationType:"POP"}},v):v}function $ee(){let t=ete(),e=Iee(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=C.createElement(C.Fragment,null,C.createElement("p",null,"💿 Hey developer 👋"),C.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",C.createElement("code",{style:a},"ErrorBoundary")," or"," ",C.createElement("code",{style:a},"errorElement")," prop on your route.")),C.createElement(C.Fragment,null,C.createElement("h2",null,"Unexpected Application Error!"),C.createElement("h3",{style:{fontStyle:"italic"}},e),n?C.createElement("pre",{style:r},n):null,s)}var Wee=C.createElement($ee,null),qee=class extends C.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?C.createElement(Xo.Provider,{value:this.props.routeContext},C.createElement(bN.Provider,{value:this.state.error,children:this.props.component})):this.props.children}};function Xee({routeContext:t,match:e,children:n}){let i=C.useContext(Gp);return i&&i.static&&i.staticContext&&(e.route.errorElement||e.route.ErrorBoundary)&&(i.staticContext._deepestRenderedBoundaryId=e.route.id),C.createElement(Xo.Provider,{value:t},n)}function Yee(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);li(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:p,errors:m}=n,y=f.route.loader&&!p.hasOwnProperty(f.route.id)&&(!m||m[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,p)=>{let m,y=!1,b=null,x=null;n&&(m=s&&f.route.id?s[f.route.id]:void 0,b=f.route.errorElement||Wee,o&&(l<0&&p===0?(BV("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),y=!0,x=null):l===p&&(y=!0,x=f.route.hydrateFallbackElement||null)));let v=e.concat(a.slice(0,p+1)),M=()=>{let w;return m?w=b:y?w=x:f.route.Component?w=C.createElement(f.route.Component,null):f.route.element?w=f.route.element:w=d,C.createElement(Xee,{match:f,routeContext:{outlet:d,matches:v,isDataRoute:n!=null},children:w})};return n&&(f.route.ErrorBoundary||f.route.errorElement||p===0)?C.createElement(qee,{location:n.location,revalidation:n.revalidation,component:b,error:m,children:M(),routeContext:{outlet:null,matches:v,isDataRoute:!0},onError:c}):M()},null)}function _N(t){return`${t} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Kee(t){let e=C.useContext(Gp);return li(e,_N(t)),e}function Zee(t){let e=C.useContext(tS);return li(e,_N(t)),e}function Jee(t){let e=C.useContext(Xo);return li(e,_N(t)),e}function SN(t){let e=Jee(t),n=e.matches[e.matches.length-1];return li(n.route.id,`${t} can only be used on routes that contain a unique "id"`),n.route.id}function Qee(){return SN("useRouteId")}function ete(){let t=C.useContext(bN),e=Zee("useRouteError"),n=SN("useRouteError");return t!==void 0?t:e.errors?.[n]}function tte(){let{router:t}=Kee("useNavigate"),e=SN("useNavigate"),n=C.useRef(!1);return UV(()=>{n.current=!0}),C.useCallback(async(r,a={})=>{po(n.current,IV),n.current&&(typeof r=="number"?t.navigate(r):await t.navigate(r,{fromRouteId:e,...a}))},[t,e])}var ZU={};function BV(t,e,n){!e&&!ZU[t]&&(ZU[t]=!0,po(!1,n))}C.memo(nte);function nte({routes:t,future:e,state:n,unstable_onError:i}){return zV(t,void 0,n,i,e)}function ite(t){return Vee(t.context)}function bd(t){li(!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 rte({basename:t="/",children:e=null,location:n,navigationType:i="POP",navigator:r,static:a=!1}){li(!ev(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let s=t.replace(/^\/*/,"/"),o=C.useMemo(()=>({basename:s,navigator:r,static:a,future:{}}),[s,r,a]);typeof n=="string"&&(n=Vp(n));let{pathname:l="/",search:c="",hash:d="",state:f=null,key:p="default"}=n,m=C.useMemo(()=>{let y=Zl(l,s);return y==null?null:{location:{pathname:y,search:c,hash:d,state:f,key:p},navigationType:i}},[s,l,c,d,f,p,i]);return po(m!=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.`),m==null?null:C.createElement(qo.Provider,{value:o},C.createElement(Q0.Provider,{children:e,value:m}))}function ate({children:t,location:e}){return Gee(x2(t),e)}function x2(t,e=[]){let n=[];return C.Children.forEach(t,(i,r)=>{if(!C.isValidElement(i))return;let a=[...e,r];if(i.type===C.Fragment){n.push.apply(n,x2(i.props.children,a));return}li(i.type===bd,`[${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>`),li(!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=x2(i.props.children,a)),n.push(s)}),n}var Tb="get",Cb="application/x-www-form-urlencoded";function nS(t){return t!=null&&typeof t.tagName=="string"}function ste(t){return nS(t)&&t.tagName.toLowerCase()==="button"}function ote(t){return nS(t)&&t.tagName.toLowerCase()==="form"}function lte(t){return nS(t)&&t.tagName.toLowerCase()==="input"}function cte(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function ute(t,e){return t.button===0&&(!e||e==="_self")&&!cte(t)}var Kx=null;function dte(){if(Kx===null)try{new FormData(document.createElement("form"),0),Kx=!1}catch{Kx=!0}return Kx}var fte=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function UE(t){return t!=null&&!fte.has(t)?(po(!1,`"${t}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Cb}"`),null):t}function hte(t,e){let n,i,r,a,s;if(ote(t)){let o=t.getAttribute("action");i=o?Zl(o,e):null,n=t.getAttribute("method")||Tb,r=UE(t.getAttribute("enctype"))||Cb,a=new FormData(t)}else if(ste(t)||lte(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?Zl(l,e):null,n=t.getAttribute("formmethod")||o.getAttribute("method")||Tb,r=UE(t.getAttribute("formenctype"))||UE(o.getAttribute("enctype"))||Cb,a=new FormData(o,t),!dte()){let{name:c,type:d,value:f}=t;if(d==="image"){let p=c?`${c}.`:"";a.append(`${p}x`,"0"),a.append(`${p}y`,"0")}else c&&a.append(c,f)}}else{if(nS(t))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=Tb,i=null,r=Cb,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 wN(t,e){if(t===!1||t===null||typeof t>"u")throw new Error(e)}function pte(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&&Zl(i.pathname,e)==="/"?i.pathname=`${e.replace(/\/$/,"")}/_root.${n}`:i.pathname=`${i.pathname.replace(/\/$/,"")}.${n}`,i}async function mte(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 gte(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 vte(t,e,n){let i=await Promise.all(t.map(async r=>{let a=e.routes[r.route.id];if(a){let s=await mte(a,n);return s.links?s.links():[]}return[]}));return _te(i.flat(1).filter(gte).filter(r=>r.rel==="stylesheet"||r.rel==="preload").map(r=>r.rel==="stylesheet"?{...r,rel:"prefetch",as:"style"}:{...r,rel:"prefetch"}))}function JU(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 xte(t,e,{includeHydrateFallback:n}={}){return yte(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 yte(t){return[...new Set(t)]}function bte(t){let e={},n=Object.keys(t).sort();for(let i of n)e[i]=t[i];return e}function _te(t,e){let n=new Set;return new Set(e),t.reduce((i,r)=>{let a=JSON.stringify(bte(r));return n.has(a)||(n.add(a),i.push({key:a,link:r})),i},[])}function jV(){let t=C.useContext(Gp);return wN(t,"You must render this element inside a <DataRouterContext.Provider> element"),t}function Ste(){let t=C.useContext(tS);return wN(t,"You must render this element inside a <DataRouterStateContext.Provider> element"),t}var MN=C.createContext(void 0);MN.displayName="FrameworkContext";function HV(){let t=C.useContext(MN);return wN(t,"You must render this element inside a <HydratedRouter> element"),t}function wte(t,e){let n=C.useContext(MN),[i,r]=C.useState(!1),[a,s]=C.useState(!1),{onFocus:o,onBlur:l,onMouseEnter:c,onMouseLeave:d,onTouchStart:f}=e,p=C.useRef(null);C.useEffect(()=>{if(t==="render"&&s(!0),t==="viewport"){let b=v=>{v.forEach(M=>{s(M.isIntersecting)})},x=new IntersectionObserver(b,{threshold:.5});return p.current&&x.observe(p.current),()=>{x.disconnect()}}},[t]),C.useEffect(()=>{if(i){let b=setTimeout(()=>{s(!0)},100);return()=>{clearTimeout(b)}}},[i]);let m=()=>{r(!0)},y=()=>{r(!1),s(!1)};return n?t!=="intent"?[a,p,{}]:[a,p,{onFocus:rg(o,m),onBlur:rg(l,y),onMouseEnter:rg(c,m),onMouseLeave:rg(d,y),onTouchStart:rg(f,m)}]:[!1,p,{}]}function rg(t,e){return n=>{t&&t(n),n.defaultPrevented||e(n)}}function Mte({page:t,...e}){let{router:n}=jV(),i=C.useMemo(()=>RV(n.routes,t,n.basename),[n.routes,t,n.basename]);return i?C.createElement(Ate,{page:t,matches:i,...e}):null}function Ete(t){let{manifest:e,routeModules:n}=HV(),[i,r]=C.useState([]);return C.useEffect(()=>{let a=!1;return vte(t,e,n).then(s=>{a||r(s)}),()=>{a=!0}},[t,e,n]),i}function Ate({page:t,matches:e,...n}){let i=wf(),{manifest:r,routeModules:a}=HV(),{basename:s}=jV(),{loaderData:o,matches:l}=Ste(),c=C.useMemo(()=>JU(t,e,l,r,i,"data"),[t,e,l,r,i]),d=C.useMemo(()=>JU(t,e,l,r,i,"assets"),[t,e,l,r,i]),f=C.useMemo(()=>{if(t===i.pathname+i.search+i.hash)return[];let y=new Set,b=!1;if(e.forEach(v=>{let M=r.routes[v.route.id];!M||!M.hasLoader||(!c.some(w=>w.route.id===v.route.id)&&v.route.id in o&&a[v.route.id]?.shouldRevalidate||M.hasClientLoader?b=!0:y.add(v.route.id))}),y.size===0)return[];let x=pte(t,s,"data");return b&&y.size>0&&x.searchParams.set("_routes",e.filter(v=>y.has(v.route.id)).map(v=>v.route.id).join(",")),[x.pathname+x.search]},[s,o,i,r,c,e,t,a]),p=C.useMemo(()=>xte(d,r),[d,r]),m=Ete(d);return C.createElement(C.Fragment,null,f.map(y=>C.createElement("link",{key:y,rel:"prefetch",as:"fetch",href:y,...n})),p.map(y=>C.createElement("link",{key:y,rel:"modulepreload",href:y,...n})),m.map(({key:y,link:b})=>C.createElement("link",{key:y,nonce:n.nonce,...b})))}function Tte(...t){return e=>{t.forEach(n=>{typeof n=="function"?n(e):n!=null&&(n.current=e)})}}var VV=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{VV&&(window.__reactRouterVersion="7.9.6")}catch{}function Cte({basename:t,children:e,window:n}){let i=C.useRef();i.current==null&&(i.current=fee({window:n,v5Compat:!0}));let r=i.current,[a,s]=C.useState({action:r.action,location:r.location}),o=C.useCallback(l=>{C.startTransition(()=>s(l))},[s]);return C.useLayoutEffect(()=>r.listen(o),[r,o]),C.createElement(rte,{basename:t,children:e,location:a.location,navigationType:a.action,navigator:r})}var GV=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,$V=C.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,...p},m){let{basename:y}=C.useContext(qo),b=typeof c=="string"&&GV.test(c),x,v=!1;if(typeof c=="string"&&b&&(x=c,VV))try{let N=new URL(window.location.href),O=c.startsWith("//")?new URL(N.protocol+c):new URL(c),B=Zl(O.pathname,y);O.origin===N.origin&&B!=null?c=B+O.search+O.hash:v=!0}catch{po(!1,`<Link to="${c}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}let M=Bee(c,{relative:r}),[w,E,T]=wte(i,p),P=Pte(c,{replace:s,state:o,target:l,preventScrollReset:d,relative:r,viewTransition:f});function R(N){e&&e(N),N.defaultPrevented||P(N)}let U=C.createElement("a",{...p,...T,href:x||M,onClick:v||a?e:R,ref:Tte(m,E),target:l,"data-discover":!b&&n==="render"?"true":void 0});return w&&!b?C.createElement(C.Fragment,null,U,C.createElement(Mte,{page:M})):U});$V.displayName="Link";var WV=C.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=tv(s,{relative:c.relative}),p=wf(),m=C.useContext(tS),{navigator:y,basename:b}=C.useContext(qo),x=m!=null&&Ite(f)&&o===!0,v=y.encodeLocation?y.encodeLocation(f).pathname:f.pathname,M=p.pathname,w=m&&m.navigation&&m.navigation.location?m.navigation.location.pathname:null;n||(M=M.toLowerCase(),w=w?w.toLowerCase():null,v=v.toLowerCase()),w&&b&&(w=Zl(w,b)||w);const E=v!=="/"&&v.endsWith("/")?v.length-1:v.length;let T=M===v||!r&&M.startsWith(v)&&M.charAt(E)==="/",P=w!=null&&(w===v||!r&&w.startsWith(v)&&w.charAt(v.length)==="/"),R={isActive:T,isPending:P,isTransitioning:x},U=T?e:void 0,N;typeof i=="function"?N=i(R):N=[i,T?"active":null,P?"pending":null,x?"transitioning":null].filter(Boolean).join(" ");let O=typeof a=="function"?a(R):a;return C.createElement($V,{...c,"aria-current":U,className:N,ref:d,style:O,to:s,viewTransition:o},typeof l=="function"?l(R):l)});WV.displayName="NavLink";var Rte=C.forwardRef(({discover:t="render",fetcherKey:e,navigate:n,reloadDocument:i,replace:r,state:a,method:s=Tb,action:o,onSubmit:l,relative:c,preventScrollReset:d,viewTransition:f,...p},m)=>{let y=Lte(),b=kte(o,{relative:c}),x=s.toLowerCase()==="get"?"get":"post",v=typeof o=="string"&&GV.test(o),M=w=>{if(l&&l(w),w.defaultPrevented)return;w.preventDefault();let E=w.nativeEvent.submitter,T=E?.getAttribute("formmethod")||s;y(E||w.currentTarget,{fetcherKey:e,method:T,navigate:n,replace:r,state:a,relative:c,preventScrollReset:d,viewTransition:f})};return C.createElement("form",{ref:m,method:x,action:b,onSubmit:i?l:M,...p,"data-discover":!v&&t==="render"?"true":void 0})});Rte.displayName="Form";function Nte(t){return`${t} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function qV(t){let e=C.useContext(Gp);return li(e,Nte(t)),e}function Pte(t,{target:e,replace:n,state:i,preventScrollReset:r,relative:a,viewTransition:s}={}){let o=FV(),l=wf(),c=tv(t,{relative:a});return C.useCallback(d=>{if(ute(d,e)){d.preventDefault();let f=n!==void 0?n:o0(l)===o0(c);o(t,{replace:f,state:i,preventScrollReset:r,relative:a,viewTransition:s})}},[l,o,c,n,i,e,t,r,a,s])}var Dte=0,Ote=()=>`__${String(++Dte)}__`;function Lte(){let{router:t}=qV("useSubmit"),{basename:e}=C.useContext(qo),n=Qee();return C.useCallback(async(i,r={})=>{let{action:a,method:s,encType:o,formData:l,body:c}=hte(i,e);if(r.navigate===!1){let d=r.fetcherKey||Ote();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 kte(t,{relative:e}={}){let{basename:n}=C.useContext(qo),i=C.useContext(Xo);li(i,"useFormAction must be used inside a RouteContext");let[r]=i.matches.slice(-1),a={...tv(t||".",{relative:e})},s=wf();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:Vl([n,a.pathname])),o0(a)}function Ite(t,{relative:e}={}){let n=C.useContext(kV);li(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:i}=qV("useViewTransitionState"),r=tv(t,{relative:e});if(!n.isTransitioning)return!1;let a=Zl(n.currentLocation.pathname,i)||n.currentLocation.pathname,s=Zl(n.nextLocation.pathname,i)||n.nextLocation.pathname;return Kb(r.pathname,s)!=null||Kb(r.pathname,a)!=null}var Il=CV();const Ute=Vs(Il);var $p=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(){}},Fte={setTimeout:(t,e)=>setTimeout(t,e),clearTimeout:t=>clearTimeout(t),setInterval:(t,e)=>setInterval(t,e),clearInterval:t=>clearInterval(t)},zte=class{#e=Fte;#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)}},Pd=new zte;function Bte(t){setTimeout(t,0)}var Qd=typeof window>"u"||"Deno"in globalThis;function ca(){}function jte(t,e){return typeof t=="function"?t(e):t}function y2(t){return typeof t=="number"&&t>=0&&t!==1/0}function XV(t,e){return Math.max(t+(e||0)-Date.now(),0)}function yu(t,e){return typeof t=="function"?t(e):t}function Es(t,e){return typeof t=="function"?t(e):t}function QU(t,e){const{type:n="all",exact:i,fetchStatus:r,predicate:a,queryKey:s,stale:o}=t;if(s){if(i){if(e.queryHash!==EN(s,e.options))return!1}else if(!l0(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 e4(t,e){const{exact:n,status:i,predicate:r,mutationKey:a}=t;if(a){if(!e.options.mutationKey)return!1;if(n){if(ef(e.options.mutationKey)!==ef(a))return!1}else if(!l0(e.options.mutationKey,a))return!1}return!(i&&e.state.status!==i||r&&!r(e))}function EN(t,e){return(e?.queryKeyHashFn||ef)(t)}function ef(t){return JSON.stringify(t,(e,n)=>b2(n)?Object.keys(n).sort().reduce((i,r)=>(i[r]=n[r],i),{}):n)}function l0(t,e){return t===e?!0:typeof t!=typeof e?!1:t&&e&&typeof t=="object"&&typeof e=="object"?Object.keys(e).every(n=>l0(t[n],e[n])):!1}var Hte=Object.prototype.hasOwnProperty;function YV(t,e){if(t===e)return t;const n=t4(t)&&t4(e);if(!n&&!(b2(t)&&b2(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],p=e[d];if(f===p){o[d]=f,(n?c<r:Hte.call(t,d))&&l++;continue}if(f===null||p===null||typeof f!="object"||typeof p!="object"){o[d]=p;continue}const m=YV(f,p);o[d]=m,m===f&&l++}return r===s&&l===r?t:o}function Zb(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 t4(t){return Array.isArray(t)&&t.length===Object.keys(t).length}function b2(t){if(!n4(t))return!1;const e=t.constructor;if(e===void 0)return!0;const n=e.prototype;return!(!n4(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(t)!==Object.prototype)}function n4(t){return Object.prototype.toString.call(t)==="[object Object]"}function Vte(t){return new Promise(e=>{Pd.setTimeout(e,t)})}function _2(t,e,n){return typeof n.structuralSharing=="function"?n.structuralSharing(t,e):n.structuralSharing!==!1?YV(t,e):e}function Gte(t,e,n=0){const i=[...t,e];return n&&i.length>n?i.slice(1):i}function $te(t,e,n=0){const i=[e,...t];return n&&i.length>n?i.slice(0,-1):i}var AN=Symbol();function KV(t,e){return!t.queryFn&&e?.initialPromise?()=>e.initialPromise:!t.queryFn||t.queryFn===AN?()=>Promise.reject(new Error(`Missing queryFn: '${t.queryHash}'`)):t.queryFn}function ZV(t,e){return typeof t=="function"?t(...e):!!t}var Wte=class extends $p{#e;#t;#n;constructor(){super(),this.#n=t=>{if(!Qd&&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"}},TN=new Wte;function S2(){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 qte=Bte;function Xte(){let t=[],e=0,n=o=>{o()},i=o=>{o()},r=qte;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 er=Xte(),Yte=class extends $p{#e=!0;#t;#n;constructor(){super(),this.#n=t=>{if(!Qd&&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}},Jb=new Yte;function Kte(t){return Math.min(1e3*2**t,3e4)}function JV(t){return(t??"online")==="online"?Jb.isOnline():!0}var w2=class extends Error{constructor(t){super("CancelledError"),this.revert=t?.revert,this.silent=t?.silent}};function QV(t){let e=!1,n=0,i;const r=S2(),a=()=>r.status!=="pending",s=b=>{if(!a()){const x=new w2(b);p(x),t.onCancel?.(x)}},o=()=>{e=!0},l=()=>{e=!1},c=()=>TN.isFocused()&&(t.networkMode==="always"||Jb.isOnline())&&t.canRun(),d=()=>JV(t.networkMode)&&t.canRun(),f=b=>{a()||(i?.(),r.resolve(b))},p=b=>{a()||(i?.(),r.reject(b))},m=()=>new Promise(b=>{i=x=>{(a()||c())&&b(x)},t.onPause?.()}).then(()=>{i=void 0,a()||t.onContinue?.()}),y=()=>{if(a())return;let b;const x=n===0?t.initialPromise:void 0;try{b=x??t.fn()}catch(v){b=Promise.reject(v)}Promise.resolve(b).then(f).catch(v=>{if(a())return;const M=t.retry??(Qd?0:3),w=t.retryDelay??Kte,E=typeof w=="function"?w(n,v):w,T=M===!0||typeof M=="number"&&n<M||typeof M=="function"&&M(n,v);if(e||!T){p(v);return}n++,t.onFail?.(n,v),Vte(E).then(()=>c()?void 0:m()).then(()=>{e?p(v):y()})})};return{promise:r,status:()=>r.status,cancel:s,continue:()=>(i?.(),r),cancelRetry:o,continueRetry:l,canStart:d,start:()=>(d()?y():m().then(y),r)}}var eG=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),y2(this.gcTime)&&(this.#e=Pd.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(t){this.gcTime=Math.max(this.gcTime||0,t??(Qd?1/0:300*1e3))}clearGcTimeout(){this.#e&&(Pd.clearTimeout(this.#e),this.#e=void 0)}},Zte=class extends eG{#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=r4(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=r4(this.options);e.data!==void 0&&(this.setState(i4(e.data,e.dataUpdatedAt)),this.#e=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&this.#n.remove(this)}setData(t,e){const n=_2(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(ca).catch(ca):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(this.#e)}isActive(){return this.observers.some(t=>Es(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===AN||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>yu(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:!XV(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=KV(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=QV({initialPromise:e?.initialPromise,fn:s.fetchFn,onCancel:o=>{o instanceof w2&&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 w2){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,...tG(n.data,this.options),fetchMeta:t.meta??null};case"success":const i={...n,...i4(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),er.batch(()=>{this.observers.forEach(n=>{n.onQueryUpdate()}),this.#n.notify({query:this,type:"updated",action:t})})}};function tG(t,e){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:JV(e.networkMode)?"fetching":"paused",...t===void 0&&{error:null,status:"pending"}}}function i4(t,e){return{data:t,dataUpdatedAt:e??Date.now(),error:null,isInvalidated:!1,status:"success"}}function r4(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 Jte=class extends $p{constructor(t,e){super(),this.options=e,this.#e=t,this.#a=null,this.#o=S2(),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),a4(this.#t,this.options)?this.#d():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return M2(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return M2(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 Es(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&&!Zb(this.options,e)&&this.#e.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#t,observer:this});const i=this.hasListeners();i&&s4(this.#t,n,this.options,e)&&this.#d(),this.updateResult(),i&&(this.#t!==n||Es(this.options.enabled,this.#t)!==Es(e.enabled,this.#t)||yu(this.options.staleTime,this.#t)!==yu(e.staleTime,this.#t))&&this.#g();const r=this.#v();i&&(this.#t!==n||Es(this.options.enabled,this.#t)!==Es(e.enabled,this.#t)||r!==this.#l)&&this.#x(r)}getOptimisticResult(t){const e=this.#e.getQueryCache().build(this.#e,t),n=this.createResult(e,t);return ene(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(ca)),e}#g(){this.#b();const t=yu(this.options.staleTime,this.#t);if(Qd||this.#r.isStale||!y2(t))return;const n=XV(this.#r.dataUpdatedAt,t)+1;this.#c=Pd.setTimeout(()=>{this.#r.isStale||this.updateResult()},n)}#v(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#x(t){this.#_(),this.#l=t,!(Qd||Es(this.options.enabled,this.#t)===!1||!y2(this.#l)||this.#l===0)&&(this.#u=Pd.setInterval(()=>{(this.options.refetchIntervalInBackground||TN.isFocused())&&this.#d()},this.#l))}#y(){this.#g(),this.#x(this.#v())}#b(){this.#c&&(Pd.clearTimeout(this.#c),this.#c=void 0)}#_(){this.#u&&(Pd.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,p;if(e._optimisticResults){const U=this.hasListeners(),N=!U&&a4(t,e),O=U&&s4(t,n,e,i);(N||O)&&(d={...d,...tG(c.data,t.options)}),e._optimisticResults==="isRestoring"&&(d.fetchStatus="idle")}let{error:m,errorUpdatedAt:y,status:b}=d;p=d.data;let x=!1;if(e.placeholderData!==void 0&&p===void 0&&b==="pending"){let U;r?.isPlaceholderData&&e.placeholderData===s?.placeholderData?(U=r.data,x=!0):U=typeof e.placeholderData=="function"?e.placeholderData(this.#h?.state.data,this.#h):e.placeholderData,U!==void 0&&(b="success",p=_2(r?.data,U,e),f=!0)}if(e.select&&p!==void 0&&!x)if(r&&p===a?.data&&e.select===this.#m)p=this.#f;else try{this.#m=e.select,p=e.select(p),p=_2(r?.data,p,e),this.#f=p,this.#a=null}catch(U){this.#a=U}this.#a&&(m=this.#a,p=this.#f,y=Date.now(),b="error");const v=d.fetchStatus==="fetching",M=b==="pending",w=b==="error",E=M&&v,T=p!==void 0,R={status:b,fetchStatus:d.fetchStatus,isPending:M,isSuccess:b==="success",isError:w,isInitialLoading:E,isLoading:E,data:p,dataUpdatedAt:d.dataUpdatedAt,error:m,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:v,isRefetching:v&&!M,isLoadingError:w&&!T,isPaused:d.fetchStatus==="paused",isPlaceholderData:f,isRefetchError:w&&T,isStale:CN(t,e),refetch:this.refetch,promise:this.#o,isEnabled:Es(e.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const U=B=>{R.status==="error"?B.reject(R.error):R.data!==void 0&&B.resolve(R.data)},N=()=>{const B=this.#o=R.promise=S2();U(B)},O=this.#o;switch(O.status){case"pending":t.queryHash===n.queryHash&&U(O);break;case"fulfilled":(R.status==="error"||R.data!==O.value)&&N();break;case"rejected":(R.status!=="error"||R.error!==O.reason)&&N();break}}return R}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),Zb(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){er.batch(()=>{t.listeners&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:"observerResultsUpdated"})})}};function Qte(t,e){return Es(e.enabled,t)!==!1&&t.state.data===void 0&&!(t.state.status==="error"&&e.retryOnMount===!1)}function a4(t,e){return Qte(t,e)||t.state.data!==void 0&&M2(t,e,e.refetchOnMount)}function M2(t,e,n){if(Es(e.enabled,t)!==!1&&yu(e.staleTime,t)!=="static"){const i=typeof n=="function"?n(t):n;return i==="always"||i!==!1&&CN(t,e)}return!1}function s4(t,e,n,i){return(t!==e||Es(i.enabled,t)===!1)&&(!n.suspense||t.state.status!=="error")&&CN(t,n)}function CN(t,e){return Es(e.enabled,t)!==!1&&t.isStaleByTime(yu(e.staleTime,t))}function ene(t,e){return!Zb(t.getCurrentResult(),e)}function o4(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)})},p=KV(e.options,e.fetchOptions),m=async(y,b,x)=>{if(d)return Promise.reject();if(b==null&&y.pages.length)return Promise.resolve(y);const M=(()=>{const P={client:e.client,queryKey:e.queryKey,pageParam:b,direction:x?"backward":"forward",meta:e.options.meta};return f(P),P})(),w=await p(M),{maxPages:E}=e.options,T=x?$te:Gte;return{pages:T(y.pages,w,E),pageParams:T(y.pageParams,b,E)}};if(r&&a.length){const y=r==="backward",b=y?tne:l4,x={pages:a,pageParams:s},v=b(i,x);o=await m(x,v,y)}else{const y=t??a.length;do{const b=l===0?s[0]??i.initialPageParam:l4(i,o);if(l>0&&b==null)break;o=await m(o,b),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 l4(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 tne(t,{pages:e,pageParams:n}){return e.length>0?t.getPreviousPageParam?.(e[0],e,n[0],n):void 0}var nne=class extends eG{#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||nG(),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=QV({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),er.batch(()=>{this.#t.forEach(n=>{n.onMutationUpdate(t)}),this.#n.notify({mutation:this,type:"updated",action:t})})}};function nG(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var ine=class extends $p{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 nne({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=Zx(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=Zx(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=Zx(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=Zx(t);return typeof e=="string"?this.#t.get(e)?.find(i=>i!==t&&i.state.isPaused)?.continue()??Promise.resolve():Promise.resolve()}clear(){er.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=>e4(e,n))}findAll(t={}){return this.getAll().filter(e=>e4(t,e))}notify(t){er.batch(()=>{this.listeners.forEach(e=>{e(t)})})}resumePausedMutations(){const t=this.getAll().filter(e=>e.state.isPaused);return er.batch(()=>Promise.all(t.map(e=>e.continue().catch(ca))))}};function Zx(t){return t.options.scope?.id}var rne=class extends $p{#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),Zb(this.options,n)||this.#e.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.#n,observer:this}),n?.mutationKey&&this.options.mutationKey&&ef(n.mutationKey)!==ef(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??nG();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){er.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)})})}},ane=class extends $p{constructor(t={}){super(),this.config=t,this.#e=new Map}#e;build(t,e,n){const i=e.queryKey,r=e.queryHash??EN(i,e);let a=this.get(r);return a||(a=new Zte({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(){er.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=>QU(e,n))}findAll(t={}){const e=this.getAll();return Object.keys(t).length>0?e.filter(n=>QU(t,n)):e}notify(t){er.batch(()=>{this.listeners.forEach(e=>{e(t)})})}onFocus(){er.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){er.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},sne=class{#e;#t;#n;#r;#i;#s;#o;#a;constructor(t={}){this.#e=t.queryCache||new ane,this.#t=t.mutationCache||new ine,this.#n=t.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#s=0}mount(){this.#s++,this.#s===1&&(this.#o=TN.subscribe(async t=>{t&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#a=Jb.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(yu(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=jte(e,a);if(s!==void 0)return this.#e.build(this,i).setData(s,{...n,manual:!0})}setQueriesData(t,e,n){return er.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;er.batch(()=>{e.findAll(t).forEach(n=>{e.remove(n)})})}resetQueries(t,e){const n=this.#e;return er.batch(()=>(n.findAll(t).forEach(i=>{i.reset()}),this.refetchQueries({type:"active",...t},e)))}cancelQueries(t,e={}){const n={revert:!0,...e},i=er.batch(()=>this.#e.findAll(t).map(r=>r.cancel(n)));return Promise.all(i).then(ca).catch(ca)}invalidateQueries(t,e={}){return er.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=er.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(ca)),r.state.fetchStatus==="paused"?Promise.resolve():a}));return Promise.all(i).then(ca)}fetchQuery(t){const e=this.defaultQueryOptions(t);e.retry===void 0&&(e.retry=!1);const n=this.#e.build(this,e);return n.isStaleByTime(yu(e.staleTime,n))?n.fetch(e):Promise.resolve(n.state.data)}prefetchQuery(t){return this.fetchQuery(t).then(ca).catch(ca)}fetchInfiniteQuery(t){return t.behavior=o4(t.pages),this.fetchQuery(t)}prefetchInfiniteQuery(t){return this.fetchInfiniteQuery(t).then(ca).catch(ca)}ensureInfiniteQueryData(t){return t.behavior=o4(t.pages),this.ensureQueryData(t)}resumePausedMutations(){return Jb.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(ef(t),{queryKey:t,defaultOptions:e})}getQueryDefaults(t){const e=[...this.#r.values()],n={};return e.forEach(i=>{l0(t,i.queryKey)&&Object.assign(n,i.defaultOptions)}),n}setMutationDefaults(t,e){this.#i.set(ef(t),{mutationKey:t,defaultOptions:e})}getMutationDefaults(t){const e=[...this.#i.values()],n={};return e.forEach(i=>{l0(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=EN(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===AN&&(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()}},iG=C.createContext(void 0),Hr=t=>{const e=C.useContext(iG);if(!e)throw new Error("No QueryClient set, use QueryClientProvider to set one");return e},one=({client:t,children:e})=>(C.useEffect(()=>(t.mount(),()=>{t.unmount()}),[t]),S.jsx(iG.Provider,{value:t,children:e})),rG=C.createContext(!1),lne=()=>C.useContext(rG);rG.Provider;function cne(){let t=!1;return{clearReset:()=>{t=!1},reset:()=>{t=!0},isReset:()=>t}}var une=C.createContext(cne()),dne=()=>C.useContext(une),fne=(t,e)=>{(t.suspense||t.throwOnError||t.experimental_prefetchInRender)&&(e.isReset()||(t.retryOnMount=!1))},hne=t=>{C.useEffect(()=>{t.clearReset()},[t])},pne=({result:t,errorResetBoundary:e,throwOnError:n,query:i,suspense:r})=>t.isError&&!e.isReset()&&!t.isFetching&&i&&(r&&t.data===void 0||ZV(n,[t.error,i])),mne=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))}},gne=(t,e)=>t.isLoading&&t.isFetching&&!e,vne=(t,e)=>t?.suspense&&e.isPending,c4=(t,e,n)=>e.fetchOptimistic(t).catch(()=>{n.clearReset()});function xne(t,e,n){const i=lne(),r=dne(),a=Hr(),s=a.defaultQueryOptions(t);a.getDefaultOptions().queries?._experimental_beforeQuery?.(s),s._optimisticResults=i?"isRestoring":"optimistic",mne(s),fne(s,r),hne(r);const o=!a.getQueryCache().get(s.queryHash),[l]=C.useState(()=>new e(a,s)),c=l.getOptimisticResult(s),d=!i&&t.subscribed!==!1;if(C.useSyncExternalStore(C.useCallback(f=>{const p=d?l.subscribe(er.batchCalls(f)):ca;return l.updateResult(),p},[l,d]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),C.useEffect(()=>{l.setOptions(s)},[s,l]),vne(s,c))throw c4(s,l,r);if(pne({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&&!Qd&&gne(c,i)&&(o?c4(s,l,r):a.getQueryCache().get(s.queryHash)?.promise)?.catch(ca).finally(()=>{l.updateResult()}),s.notifyOnChangeProps?c:l.trackResult(c)}function ei(t,e){return xne(t,Jte)}function Gn(t,e){const n=Hr(),[i]=C.useState(()=>new rne(n,t));C.useEffect(()=>{i.setOptions(t)},[i,t]);const r=C.useSyncExternalStore(C.useCallback(s=>i.subscribe(er.batchCalls(s)),[i]),()=>i.getCurrentResult(),()=>i.getCurrentResult()),a=C.useCallback((s,o)=>{i.mutate(s,o).catch(ca)},[i]);if(r.error&&ZV(i.options.throwOnError,[r.error]))throw r.error;return{...r,mutate:a,mutateAsync:r.mutate}}const yne=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),bne=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,n,i)=>i?i.toUpperCase():n.toLowerCase()),u4=t=>{const e=bne(t);return e.charAt(0).toUpperCase()+e.slice(1)},aG=(...t)=>t.filter((e,n,i)=>!!e&&e.trim()!==""&&i.indexOf(e)===n).join(" ").trim(),_ne=t=>{for(const e in t)if(e.startsWith("aria-")||e==="role"||e==="title")return!0};var Sne={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 wne=C.forwardRef(({color:t="currentColor",size:e=24,strokeWidth:n=2,absoluteStrokeWidth:i,className:r="",children:a,iconNode:s,...o},l)=>C.createElement("svg",{ref:l,...Sne,width:e,height:e,stroke:t,strokeWidth:i?Number(n)*24/Number(e):n,className:aG("lucide",r),...!a&&!_ne(o)&&{"aria-hidden":"true"},...o},[...s.map(([c,d])=>C.createElement(c,d)),...Array.isArray(a)?a:[a]]));const ct=(t,e)=>{const n=C.forwardRef(({className:i,...r},a)=>C.createElement(wne,{ref:a,iconNode:e,className:aG(`lucide-${yne(u4(t))}`,`lucide-${t}`,i),...r}));return n.displayName=u4(t),n};const Mne=[["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"}]],Ene=ct("archive",Mne);const Ane=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],Tne=ct("arrow-down",Ane);const Cne=[["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"}]],Rne=ct("arrow-up-down",Cne);const Nne=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],Pne=ct("arrow-up",Nne);const Dne=[["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"}]],One=ct("bold",Dne);const Lne=[["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"}]],c0=ct("box",Lne);const kne=[["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"}]],Ine=ct("calendar-days",kne);const Une=[["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"}]],E2=ct("calendar",Une);const Fne=[["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"}]],A2=ct("camera",Fne);const zne=[["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"}]],Bne=ct("chart-column",zne);const jne=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Hne=ct("check",jne);const Vne=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Gne=ct("chevron-down",Vne);const $ne=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Wp=ct("chevron-right",$ne);const Wne=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],tf=ct("chevron-left",Wne);const qne=[["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"}]],RN=ct("circle-alert",qne);const Xne=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],iS=ct("circle-check-big",Xne);const Yne=[["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"}]],sG=ct("circle-x",Yne);const Kne=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],nv=ct("clock",Kne);const Zne=[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]],NN=ct("cloud",Zne);const Jne=[["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"}]],Qne=ct("code-xml",Jne);const eie=[["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"}]],T2=ct("copy",eie);const tie=[["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"}]],nie=ct("dollar-sign",tie);const iie=[["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"}]],nf=ct("download",iie);const rie=[["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"}]],aie=ct("droplet",rie);const sie=[["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"}]],oie=ct("ellipsis-vertical",sie);const lie=[["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"}]],gp=ct("external-link",lie);const cie=[["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"}]],uie=ct("eye-off",cie);const die=[["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"}]],d4=ct("eye",die);const fie=[["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"}]],hie=ct("file-box",fie);const pie=[["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"}]],mie=ct("file-exclamation-point",pie);const gie=[["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"}]],Zh=ct("file-text",gie);const vie=[["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"}]],oG=ct("file",vie);const xie=[["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"}]],u0=ct("film",xie);const yie=[["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"}]],bie=ct("folder-open",yie);const _ie=[["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"}]],Sie=ct("folder",_ie);const wie=[["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"}]],Mie=ct("funnel",wie);const Eie=[["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"}]],f4=ct("github",Eie);const Aie=[["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"}]],C2=ct("globe",Aie);const Tie=[["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"}]],Cie=ct("grip-vertical",Tie);const Rie=[["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"}]],lG=ct("hard-drive",Rie);const Nie=[["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"}]],rS=ct("image",Nie);const Pie=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],Die=ct("info",Pie);const Oie=[["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"}]],Lie=ct("italic",Oie);const kie=[["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"}]],Iie=ct("key",kie);const Uie=[["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"}]],R2=ct("keyboard",Uie);const Fie=[["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"}]],cG=ct("layers",Fie);const zie=[["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"}]],Bie=ct("layout-grid",zie);const jie=[["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"}]],Hie=ct("link",jie);const Vie=[["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"}]],Gie=ct("list-ordered",Vie);const $ie=[["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"}]],uG=ct("list",$ie);const Wie=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],ci=ct("loader-circle",Wie);const qie=[["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"}]],h4=ct("log-in",qie);const Xie=[["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"}]],Yie=ct("log-out",Xie);const Kie=[["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"}]],Zie=ct("maximize-2",Kie);const Jie=[["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"}]],Qie=ct("minimize-2",Jie);const ere=[["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"}]],p4=ct("moon",ere);const tre=[["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"}]],Qb=ct("package",tre);const nre=[["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"}]],ire=ct("pause",nre);const rre=[["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"}]],are=ct("pen-line",rre);const sre=[["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"}]],ore=ct("pen",sre);const lre=[["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"}]],m4=ct("pencil",lre);const cre=[["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"}]],dG=ct("play",cre);const ure=[["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"}]],N2=ct("plug",ure);const dre=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],d0=ct("plus",dre);const fre=[["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"}]],hre=ct("power-off",fre);const pre=[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]],mre=ct("power",pre);const gre=[["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"}]],rf=ct("printer",gre);const vre=[["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"}]],xre=ct("qr-code",vre);const yre=[["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"}]],aS=ct("refresh-cw",yre);const bre=[["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"}]],fG=ct("rotate-ccw",bre);const _re=[["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"}]],sS=ct("save",_re);const Sre=[["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"}]],wre=ct("scan-search",Sre);const Mre=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],hG=ct("search",Mre);const Ere=[["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"}]],pG=ct("settings-2",Ere);const Are=[["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"}]],Tre=ct("settings",Are);const Cre=[["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"}]],Rre=ct("skip-back",Cre);const Nre=[["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"}]],Pre=ct("skip-forward",Nre);const Dre=[["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"}]],e_=ct("square-check-big",Dre);const Ore=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],t_=ct("square",Ore);const Lre=[["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"}]],f0=ct("star",Lre);const kre=[["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"}]],Ire=ct("sticky-note",kre);const Ure=[["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"}]],g4=ct("sun",Ure);const Fre=[["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"}]],h0=ct("tag",Fre);const zre=[["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"}]],Bre=ct("target",zre);const jre=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],Hre=ct("terminal",jre);const Vre=[["path",{d:"M21 5H3",key:"1fi0y6"}],["path",{d:"M17 12H7",key:"16if0g"}],["path",{d:"M19 19H5",key:"vjpgq2"}]],Gre=ct("text-align-center",Vre);const $re=[["path",{d:"M21 5H3",key:"1fi0y6"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M21 19H7",key:"4cu937"}]],Wre=ct("text-align-end",$re);const qre=[["path",{d:"M21 5H3",key:"1fi0y6"}],["path",{d:"M15 12H3",key:"6jk70r"}],["path",{d:"M17 19H3",key:"z6ezky"}]],Xre=ct("text-align-start",qre);const Yre=[["path",{d:"M14 4v10.54a4 4 0 1 1-4 0V4a2 2 0 0 1 4 0Z",key:"17jzev"}]],Rb=ct("thermometer",Yre);const Kre=[["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"}]],Jl=ct("trash-2",Kre);const Zre=[["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"}]],mG=ct("triangle-alert",Zre);const Jre=[["path",{d:"M6 4v6a6 6 0 0 0 12 0V4",key:"9kb039"}],["line",{x1:"4",x2:"20",y1:"20",y2:"20",key:"nun2al"}]],Qre=ct("underline",Jre);const eae=[["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"}]],tae=ct("unlink",eae);const nae=[["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"}]],n_=ct("upload",nae);const iae=[["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"}]],v4=ct("user",iae);const rae=[["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"}]],PN=ct("wifi-off",rae);const aae=[["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"}]],DN=ct("wifi",aae);const sae=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],_i=ct("x",sae);const oae=[["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"}]],lae=ct("zoom-in",oae);const cae=[["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"}]],uae=ct("zoom-out",cae),gG=C.createContext(void 0);function dae({children:t}){const[e,n]=C.useState(()=>{const a=localStorage.getItem("theme");return a||(window.matchMedia("(prefers-color-scheme: light)").matches?"light":"dark")});C.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 S.jsx(gG.Provider,{value:{theme:e,toggleTheme:i,setTheme:r},children:t})}function fae(){const t=C.useContext(gG);if(!t)throw new Error("useTheme must be used within a ThemeProvider");return t}function bi({children:t,className:e="",onClick:n,onContextMenu:i}){return S.jsx("div",{className:`bg-bambu-dark-secondary rounded-xl border border-bambu-dark-tertiary ${e}`,onClick:n,onContextMenu:i,children:t})}function Ng({children:t,className:e=""}){return S.jsx("div",{className:`px-6 py-4 border-b border-bambu-dark-tertiary ${e}`,children:t})}function Ri({children:t,className:e=""}){return S.jsx("div",{className:`p-6 ${e}`,children:t})}const hae=[{category:"Navigation",items:[{keys:["1"],description:"Go to Printers"},{keys:["2"],description:"Go to Archives"},{keys:["3"],description:"Go to Statistics"},{keys:["4"],description:"Go to Cloud Profiles"},{keys:["5"],description:"Go to Settings"}]},{category:"Archives",items:[{keys:["/"],description:"Focus search"},{keys:["U"],description:"Open upload modal"},{keys:["Esc"],description:"Clear selection / blur input"},{keys:["Right-click"],description:"Context menu on cards"}]},{category:"General",items:[{keys:["?"],description:"Show this help"}]}];function x4({children:t}){return S.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 pae({onClose:t}){return S.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4",onClick:t,children:S.jsx(bi,{className:"w-full max-w-md",onClick:e=>e.stopPropagation(),children:S.jsxs(Ri,{className:"p-0",children:[S.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-bambu-dark-tertiary",children:[S.jsxs("div",{className:"flex items-center gap-2",children:[S.jsx(R2,{className:"w-5 h-5 text-bambu-green"}),S.jsx("h2",{className:"text-xl font-semibold text-white",children:"Keyboard Shortcuts"})]}),S.jsx("button",{onClick:t,className:"text-bambu-gray hover:text-white transition-colors",children:S.jsx(_i,{className:"w-5 h-5"})})]}),S.jsx("div",{className:"p-4 space-y-6 max-h-[60vh] overflow-y-auto",children:hae.map(e=>S.jsxs("div",{children:[S.jsx("h3",{className:"text-sm font-medium text-bambu-gray mb-3",children:e.category}),S.jsx("div",{className:"space-y-2",children:e.items.map(n=>S.jsxs("div",{className:"flex items-center justify-between",children:[S.jsx("span",{className:"text-white text-sm",children:n.description}),S.jsx("div",{className:"flex gap-1",children:n.keys.map(i=>S.jsx(x4,{children:i},i))})]},n.description))})]},e.category))}),S.jsx("div",{className:"p-4 border-t border-bambu-dark-tertiary",children:S.jsxs("p",{className:"text-xs text-bambu-gray text-center",children:["Press ",S.jsx(x4,{children:"Esc"})," or click outside to close"]})})]})})})}const mae=[{to:"/",icon:rf,label:"Printers"},{to:"/archives",icon:Ene,label:"Archives"},{to:"/stats",icon:Bne,label:"Statistics"},{to:"/cloud",icon:NN,label:"Cloud Profiles"},{to:"/settings",icon:Tre,label:"Settings"}];function gae(){const t=FV(),{theme:e,toggleTheme:n}=fae(),[i,r]=C.useState(()=>localStorage.getItem("sidebarExpanded")!=="false"),[a,s]=C.useState(!1);C.useEffect(()=>{localStorage.setItem("sidebarExpanded",String(i))},[i]);const o=C.useCallback(l=>{const c=l.target;if(!(c.tagName==="INPUT"||c.tagName==="TEXTAREA"||c.isContentEditable)&&!l.metaKey&&!l.ctrlKey&&!l.altKey)switch(l.key){case"1":l.preventDefault(),t("/");break;case"2":l.preventDefault(),t("/archives");break;case"3":l.preventDefault(),t("/stats");break;case"4":l.preventDefault(),t("/cloud");break;case"5":l.preventDefault(),t("/settings");break;case"?":l.preventDefault(),s(!0);break;case"Escape":s(!1);break}},[t]);return C.useEffect(()=>(document.addEventListener("keydown",o),()=>document.removeEventListener("keydown",o)),[o]),S.jsxs("div",{className:"flex min-h-screen",children:[S.jsxs("aside",{className:`${i?"w-64":"w-16"} bg-bambu-dark-secondary border-r border-bambu-dark-tertiary flex flex-col fixed inset-y-0 left-0 z-30 transition-all duration-300`,children:[S.jsx("div",{className:`border-b border-bambu-dark-tertiary flex items-center justify-center ${i?"p-4":"p-2"}`,children:S.jsx("img",{src:e==="dark"?"/img/bambusy_logo_dark.png":"/img/bambusy_logo_light.png",alt:"Bambusy",className:i?"h-16 w-auto":"h-8 w-8 object-cover object-left"})}),S.jsx("nav",{className:"flex-1 p-2",children:S.jsx("ul",{className:"space-y-2",children:mae.map(({to:l,icon:c,label:d})=>S.jsx("li",{children:S.jsxs(WV,{to:l,className:({isActive:f})=>`flex items-center ${i?"gap-3 px-4":"justify-center px-2"} py-3 rounded-lg transition-colors ${f?"bg-bambu-green text-white":"text-bambu-gray-light hover:bg-bambu-dark-tertiary hover:text-white"}`,title:i?void 0:d,children:[S.jsx(c,{className:"w-5 h-5 flex-shrink-0"}),i&&S.jsx("span",{children:d})]})},l))})}),S.jsx("button",{onClick:()=>r(!i),className:"p-2 mx-2 mb-2 rounded-lg hover:bg-bambu-dark-tertiary transition-colors text-bambu-gray-light hover:text-white flex items-center justify-center",title:i?"Collapse sidebar":"Expand sidebar",children:i?S.jsx(tf,{className:"w-5 h-5"}):S.jsx(Wp,{className:"w-5 h-5"})}),S.jsx("div",{className:"p-2 border-t border-bambu-dark-tertiary",children:i?S.jsxs("div",{className:"flex items-center justify-between px-2",children:[S.jsx("span",{className:"text-sm text-bambu-gray",children:"v0.1.2"}),S.jsxs("div",{className:"flex items-center gap-1",children:[S.jsx("a",{href:"https://github.com/maziggy/bambusy",target:"_blank",rel:"noopener noreferrer",className:"p-2 rounded-lg hover:bg-bambu-dark-tertiary transition-colors text-bambu-gray-light hover:text-white",title:"View on GitHub",children:S.jsx(f4,{className:"w-5 h-5"})}),S.jsx("button",{onClick:()=>s(!0),className:"p-2 rounded-lg hover:bg-bambu-dark-tertiary transition-colors text-bambu-gray-light hover:text-white",title:"Keyboard shortcuts (?)",children:S.jsx(R2,{className:"w-5 h-5"})}),S.jsx("button",{onClick:n,className:"p-2 rounded-lg hover:bg-bambu-dark-tertiary transition-colors text-bambu-gray-light hover:text-white",title:e==="dark"?"Switch to light mode":"Switch to dark mode",children:e==="dark"?S.jsx(g4,{className:"w-5 h-5"}):S.jsx(p4,{className:"w-5 h-5"})})]})]}):S.jsxs("div",{className:"flex flex-col items-center gap-1",children:[S.jsx("a",{href:"https://github.com/maziggy/bambusy",target:"_blank",rel:"noopener noreferrer",className:"p-2 rounded-lg hover:bg-bambu-dark-tertiary transition-colors text-bambu-gray-light hover:text-white",title:"View on GitHub",children:S.jsx(f4,{className:"w-5 h-5"})}),S.jsx("button",{onClick:()=>s(!0),className:"p-2 rounded-lg hover:bg-bambu-dark-tertiary transition-colors text-bambu-gray-light hover:text-white",title:"Keyboard shortcuts (?)",children:S.jsx(R2,{className:"w-5 h-5"})}),S.jsx("button",{onClick:n,className:"p-2 rounded-lg hover:bg-bambu-dark-tertiary transition-colors text-bambu-gray-light hover:text-white",title:e==="dark"?"Switch to light mode":"Switch to dark mode",children:e==="dark"?S.jsx(g4,{className:"w-5 h-5"}):S.jsx(p4,{className:"w-5 h-5"})})]})})]}),S.jsx("main",{className:`flex-1 bg-bambu-dark overflow-auto ${i?"ml-64":"ml-16"} transition-all duration-300`,children:S.jsx(ite,{})}),a&&S.jsx(pae,{onClose:()=>s(!1)})]})}const Kr="/api/v1";async function zt(t,e={}){const n=await fetch(`${Kr}${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 vt={getPrinters:()=>zt("/printers/"),getPrinter:t=>zt(`/printers/${t}`),createPrinter:t=>zt("/printers/",{method:"POST",body:JSON.stringify(t)}),updatePrinter:(t,e)=>zt(`/printers/${t}`,{method:"PATCH",body:JSON.stringify(e)}),deletePrinter:t=>zt(`/printers/${t}`,{method:"DELETE"}),getPrinterStatus:t=>zt(`/printers/${t}/status`),connectPrinter:t=>zt(`/printers/${t}/connect`,{method:"POST"}),disconnectPrinter:t=>zt(`/printers/${t}/disconnect`,{method:"POST"}),enableMQTTLogging:t=>zt(`/printers/${t}/logging/enable`,{method:"POST"}),disableMQTTLogging:t=>zt(`/printers/${t}/logging/disable`,{method:"POST"}),getMQTTLogs:t=>zt(`/printers/${t}/logging`),clearMQTTLogs:t=>zt(`/printers/${t}/logging`,{method:"DELETE"}),getPrinterFiles:(t,e="/")=>zt(`/printers/${t}/files?path=${encodeURIComponent(e)}`),getPrinterFileDownloadUrl:(t,e)=>`${Kr}/printers/${t}/files/download?path=${encodeURIComponent(e)}`,deletePrinterFile:(t,e)=>zt(`/printers/${t}/files?path=${encodeURIComponent(e)}`,{method:"DELETE"}),getPrinterStorage:t=>zt(`/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)),zt(`/archives/?${i}`)},getArchive:t=>zt(`/archives/${t}`),updateArchive:(t,e)=>zt(`/archives/${t}`,{method:"PATCH",body:JSON.stringify(e)}),toggleFavorite:t=>zt(`/archives/${t}/favorite`,{method:"POST"}),deleteArchive:t=>zt(`/archives/${t}`,{method:"DELETE"}),getArchiveStats:()=>zt("/archives/stats"),getArchiveDuplicates:t=>zt(`/archives/${t}/duplicates`),backfillContentHashes:()=>zt("/archives/backfill-hashes",{method:"POST"}),getArchiveThumbnail:t=>`${Kr}/archives/${t}/thumbnail`,getArchiveDownload:t=>`${Kr}/archives/${t}/download`,getArchiveGcode:t=>`${Kr}/archives/${t}/gcode`,getArchiveTimelapse:t=>`${Kr}/archives/${t}/timelapse`,scanArchiveTimelapse:t=>zt(`/archives/${t}/timelapse/scan`,{method:"POST"}),uploadArchiveTimelapse:async(t,e)=>{const n=new FormData;n.append("file",e);const i=await fetch(`${Kr}/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)=>`${Kr}/archives/${t}/photos/${encodeURIComponent(e)}`,uploadArchivePhoto:async(t,e)=>{const n=new FormData;n.append("file",e);const i=await fetch(`${Kr}/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)=>zt(`/archives/${t}/photos/${encodeURIComponent(e)}`,{method:"DELETE"}),getArchiveQRCodeUrl:(t,e=200)=>`${Kr}/archives/${t}/qrcode?size=${e}`,getArchiveCapabilities:t=>zt(`/archives/${t}/capabilities`),getArchiveProjectPage:t=>zt(`/archives/${t}/project-page`),updateArchiveProjectPage:(t,e)=>zt(`/archives/${t}/project-page`,{method:"PATCH",body:JSON.stringify(e)}),getArchiveProjectImageUrl:(t,e)=>`${Kr}/archives/${t}/project-image/${encodeURIComponent(e)}`,getArchiveForSlicer:(t,e)=>`${Kr}/archives/${t}/file/${encodeURIComponent(e.endsWith(".3mf")?e:e+".3mf")}`,reprintArchive:(t,e)=>zt(`/archives/${t}/reprint?printer_id=${e}`,{method:"POST"}),uploadArchive:async(t,e)=>{const n=new FormData;n.append("file",t);const i=e?`${Kr}/archives/upload?printer_id=${e}`:`${Kr}/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?`${Kr}/archives/upload-bulk?printer_id=${e}`:`${Kr}/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:()=>zt("/settings/"),updateSettings:t=>zt("/settings/",{method:"PUT",body:JSON.stringify(t)}),resetSettings:()=>zt("/settings/reset",{method:"POST"}),getCloudStatus:()=>zt("/cloud/status"),cloudLogin:(t,e,n="global")=>zt("/cloud/login",{method:"POST",body:JSON.stringify({email:t,password:e,region:n})}),cloudVerify:(t,e)=>zt("/cloud/verify",{method:"POST",body:JSON.stringify({email:t,code:e})}),cloudSetToken:t=>zt("/cloud/token",{method:"POST",body:JSON.stringify({access_token:t})}),cloudLogout:()=>zt("/cloud/logout",{method:"POST"}),getCloudSettings:(t="01.09.00.00")=>zt(`/cloud/settings?version=${t}`),getCloudSettingDetail:t=>zt(`/cloud/settings/${t}`),getCloudDevices:()=>zt("/cloud/devices"),getSmartPlugs:()=>zt("/smart-plugs/"),getSmartPlug:t=>zt(`/smart-plugs/${t}`),createSmartPlug:t=>zt("/smart-plugs/",{method:"POST",body:JSON.stringify(t)}),updateSmartPlug:(t,e)=>zt(`/smart-plugs/${t}`,{method:"PATCH",body:JSON.stringify(e)}),deleteSmartPlug:t=>zt(`/smart-plugs/${t}`,{method:"DELETE"}),controlSmartPlug:(t,e)=>zt(`/smart-plugs/${t}/control`,{method:"POST",body:JSON.stringify({action:e})}),getSmartPlugStatus:t=>zt(`/smart-plugs/${t}/status`),testSmartPlugConnection:(t,e,n)=>zt("/smart-plugs/test-connection",{method:"POST",body:JSON.stringify({ip_address:t,username:e,password:n})})};function xt({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 S.jsx("button",{className:`${a} ${s[t]} ${o[e]} ${n}`,...r,children:i})}function qp({title:t,message:e,confirmText:n="Confirm",cancelText:i="Cancel",variant:r="default",onConfirm:a,onCancel:s}){C.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 S.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4",onClick:s,children:S.jsx(bi,{className:"w-full max-w-md",onClick:c=>c.stopPropagation(),children:S.jsxs(Ri,{className:"p-6",children:[S.jsxs("div",{className:"flex items-start gap-4",children:[S.jsx("div",{className:`p-2 rounded-full bg-bambu-dark ${l.icon}`,children:S.jsx(mG,{className:"w-6 h-6"})}),S.jsxs("div",{className:"flex-1",children:[S.jsx("h3",{className:"text-lg font-semibold text-white mb-2",children:t}),S.jsx("p",{className:"text-bambu-gray text-sm",children:e})]})]}),S.jsxs("div",{className:"flex gap-3 mt-6",children:[S.jsx(xt,{variant:"secondary",onClick:s,className:"flex-1",children:i}),S.jsx(xt,{onClick:a,className:`flex-1 ${l.button}`,children:n})]})]})})})}const vG=C.createContext(void 0);function Mf(){const t=C.useContext(vG);if(!t)throw new Error("useToast must be used within a ToastProvider");return t}const vae={success:S.jsx(iS,{className:"w-5 h-5 text-green-400"}),error:S.jsx(sG,{className:"w-5 h-5 text-red-400"}),warning:S.jsx(RN,{className:"w-5 h-5 text-yellow-400"}),info:S.jsx(Die,{className:"w-5 h-5 text-blue-400"})},xae={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 yae({children:t}){const[e,n]=C.useState([]),i=C.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=C.useCallback(a=>{n(s=>s.filter(o=>o.id!==a))},[]);return S.jsxs(vG.Provider,{value:{showToast:i},children:[t,S.jsx("div",{className:"fixed bottom-4 right-4 z-50 flex flex-col gap-2",children:e.map(a=>S.jsxs("div",{className:`flex items-center gap-3 px-4 py-3 rounded-lg border shadow-lg backdrop-blur-sm animate-slide-in ${xae[a.type]}`,children:[vae[a.type],S.jsx("span",{className:"text-white text-sm",children:a.message}),S.jsx("button",{onClick:()=>r(a.id),className:"ml-2 text-bambu-gray hover:text-white transition-colors",children:S.jsx(_i,{className:"w-4 h-4"})})]},a.id))})]})}function bae(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 _ae(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 Sae(t,e){if(e)return Sie;switch(t.toLowerCase().split(".").pop()||""){case"3mf":return hie;case"gcode":return Zh;case"mp4":case"avi":return u0;case"png":case"jpg":case"jpeg":return rS;default:return oG}}function wae({printerId:t,printerName:e,onClose:n}){const{showToast:i}=Mf(),r=Hr(),[a,s]=C.useState("/"),[o,l]=C.useState(null),[c,d]=C.useState(""),[f,p]=C.useState(null);C.useEffect(()=>{const R=U=>{U.key==="Escape"&&n()};return window.addEventListener("keydown",R),()=>window.removeEventListener("keydown",R)},[n]);const{data:m,isLoading:y,refetch:b}=ei({queryKey:["printerFiles",t,a],queryFn:()=>vt.getPrinterFiles(t,a)}),{data:x}=ei({queryKey:["printerStorage",t],queryFn:()=>vt.getPrinterStorage(t),staleTime:3e4}),v=Gn({mutationFn:R=>vt.deletePrinterFile(t,R),onSuccess:(R,U)=>{i(`Deleted: ${U.split("/").pop()}`),r.invalidateQueries({queryKey:["printerFiles",t]}),l(null)},onError:R=>{i(`Delete failed: ${R.message}`,"error")}}),M=R=>{s(R),l(null)},w=()=>{if(a==="/")return;const R=a.split("/").filter(Boolean);R.pop(),s(R.length?"/"+R.join("/"):"/"),l(null)},E=R=>{window.open(vt.getPrinterFileDownloadUrl(t,R),"_blank")},T=R=>{p(R)},P=[{path:"/",label:"Root"},{path:"/cache",label:"Cache"},{path:"/model",label:"Models"},{path:"/timelapse",label:"Timelapse"}];return S.jsxs("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4",onClick:n,children:[S.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:R=>R.stopPropagation(),children:[S.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-bambu-dark-tertiary flex-shrink-0",children:[S.jsxs("div",{className:"flex items-center gap-3",children:[S.jsx(lG,{className:"w-5 h-5 text-bambu-green"}),S.jsxs("div",{children:[S.jsx("h2",{className:"text-lg font-semibold text-white",children:"File Manager"}),S.jsx("p",{className:"text-sm text-bambu-gray",children:e})]})]}),S.jsxs("div",{className:"flex items-center gap-4",children:[x?.used_bytes!=null&&x.used_bytes>0&&S.jsxs("div",{className:"text-sm text-bambu-gray",children:["Used: ",_ae(x.used_bytes)]}),S.jsx("button",{onClick:n,className:"text-bambu-gray hover:text-white transition-colors",children:S.jsx(_i,{className:"w-5 h-5"})})]})]}),S.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(R=>S.jsx("button",{onClick:()=>{M(R.path),d("")},className:`px-3 py-1 text-sm rounded-full transition-colors ${a===R.path?"bg-bambu-green text-white":"bg-bambu-dark-tertiary text-bambu-gray hover:text-white"}`,children:R.label},R.path)),S.jsx("div",{className:"flex-1"}),S.jsxs("div",{className:"relative",children:[S.jsx(hG,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray"}),S.jsx("input",{type:"text",placeholder:"Filter files...",value:c,onChange:R=>d(R.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"})]}),S.jsx(xt,{variant:"secondary",size:"sm",onClick:()=>b(),disabled:y,children:S.jsx(aS,{className:`w-4 h-4 ${y?"animate-spin":""}`})})]}),S.jsxs("div",{className:"flex items-center gap-2 px-4 py-2 bg-bambu-dark text-sm flex-shrink-0",children:[S.jsx("button",{onClick:w,disabled:a==="/",className:"p-1 rounded hover:bg-bambu-dark-tertiary disabled:opacity-50 disabled:cursor-not-allowed",children:S.jsx(tf,{className:"w-4 h-4"})}),S.jsx("span",{className:"text-bambu-gray font-mono",children:a})]}),S.jsx("div",{className:"flex-1 overflow-y-auto p-2 min-h-0",children:y?S.jsx("div",{className:"flex items-center justify-center py-12",children:S.jsx(ci,{className:"w-8 h-8 text-bambu-green animate-spin"})}):m?.files?.length?S.jsx("div",{className:"space-y-1",children:[...m.files].filter(R=>!c||R.name.toLowerCase().includes(c.toLowerCase())).sort((R,U)=>R.is_directory&&!U.is_directory?-1:!R.is_directory&&U.is_directory?1:R.name.localeCompare(U.name)).map(R=>{const U=Sae(R.name,R.is_directory),N=o===R.path;return S.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:()=>{R.is_directory?M(R.path):l(N?null:R.path)},children:[S.jsx(U,{className:`w-5 h-5 flex-shrink-0 ${R.is_directory?"text-bambu-green":"text-bambu-gray"}`}),S.jsx("span",{className:"flex-1 text-white truncate",children:R.name}),!R.is_directory&&S.jsx("span",{className:"text-sm text-bambu-gray",children:bae(R.size)}),R.is_directory&&S.jsx(tf,{className:"w-4 h-4 text-bambu-gray rotate-180"})]},R.path)})}):S.jsx("div",{className:"text-center py-12 text-bambu-gray",children:"No files in this directory"})}),S.jsxs("div",{className:"flex items-center justify-between p-4 border-t border-bambu-dark-tertiary bg-bambu-dark/50 flex-shrink-0",children:[S.jsx("div",{className:"text-sm text-bambu-gray",children:c?`${m?.files?.filter(R=>R.name.toLowerCase().includes(c.toLowerCase())).length||0} of ${m?.files?.length||0} items`:`${m?.files?.length||0} items`}),S.jsxs("div",{className:"flex gap-2",children:[S.jsxs(xt,{variant:"secondary",disabled:!o,onClick:()=>o&&E(o),children:[S.jsx(nf,{className:"w-4 h-4"}),"Download"]}),S.jsxs(xt,{variant:"secondary",disabled:!o||v.isPending,onClick:()=>o&&T(o),className:"text-red-400 hover:text-red-300",children:[v.isPending?S.jsx(ci,{className:"w-4 h-4 animate-spin"}):S.jsx(Jl,{className:"w-4 h-4"}),"Delete"]})]})]})]}),f&&S.jsx(qp,{title:"Delete File",message:`Delete "${f.split("/").pop()}"? This cannot be undone.`,confirmText:"Delete",variant:"danger",onConfirm:()=>{v.mutate(f),p(null)},onCancel:()=>p(null)})]})}function Mae({printerId:t,printerName:e,onClose:n}){const i=Hr(),[r,a]=C.useState(!0),[s,o]=C.useState(new Set),l=C.useRef(null),{data:c,isLoading:d,refetch:f}=ei({queryKey:["mqtt-logs",t],queryFn:()=>vt.getMQTTLogs(t),refetchInterval:1e3}),p=Gn({mutationFn:()=>vt.enableMQTTLogging(t),onSuccess:()=>{i.invalidateQueries({queryKey:["mqtt-logs",t]})}}),m=Gn({mutationFn:()=>vt.disableMQTTLogging(t),onSuccess:()=>{i.invalidateQueries({queryKey:["mqtt-logs",t]})}}),y=Gn({mutationFn:()=>vt.clearMQTTLogs(t),onSuccess:()=>{i.invalidateQueries({queryKey:["mqtt-logs",t]})}});C.useEffect(()=>{r&&l.current&&(l.current.scrollTop=l.current.scrollHeight)},[c?.logs,r]);const b=E=>{o(T=>{const P=new Set(T);return P.has(E)?P.delete(E):P.add(E),P})},x=E=>new Date(E).toLocaleTimeString("en-US",{hour12:!1,fractionalSecondDigits:3}),v=(E,T)=>{const P=JSON.stringify(E,null,T?2:0);return!T&&P.length>100?P.substring(0,100)+"...":P},M=c?.logging_enabled??!1,w=c?.logs??[];return S.jsx("div",{className:"fixed inset-0 bg-black/70 flex items-center justify-center z-50 p-4",children:S.jsxs("div",{className:"bg-bambu-dark-secondary rounded-lg max-w-4xl w-full max-h-[85vh] flex flex-col",children:[S.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-bambu-dark-tertiary",children:[S.jsxs("div",{children:[S.jsx("h2",{className:"text-lg font-semibold text-white",children:"MQTT Debug Log"}),S.jsx("p",{className:"text-sm text-bambu-gray",children:e})]}),S.jsx("button",{onClick:n,className:"text-bambu-gray hover:text-white transition-colors",children:S.jsx(_i,{className:"w-5 h-5"})})]}),S.jsxs("div",{className:"flex items-center gap-2 p-4 border-b border-bambu-dark-tertiary",children:[M?S.jsxs(xt,{size:"sm",variant:"secondary",onClick:()=>m.mutate(),disabled:m.isPending,children:[S.jsx(t_,{className:"w-4 h-4"}),"Stop"]}):S.jsxs(xt,{size:"sm",onClick:()=>p.mutate(),disabled:p.isPending,children:[S.jsx(dG,{className:"w-4 h-4"}),"Start Logging"]}),S.jsxs(xt,{size:"sm",variant:"secondary",onClick:()=>y.mutate(),disabled:y.isPending||w.length===0,children:[S.jsx(Jl,{className:"w-4 h-4"}),"Clear"]}),S.jsx(xt,{size:"sm",variant:"secondary",onClick:()=>f(),disabled:d,children:S.jsx(aS,{className:`w-4 h-4 ${d?"animate-spin":""}`})}),S.jsx("div",{className:"flex-1"}),S.jsxs("label",{className:"flex items-center gap-2 text-sm text-bambu-gray cursor-pointer",children:[S.jsx("input",{type:"checkbox",checked:r,onChange:E=>a(E.target.checked),className:"rounded border-bambu-dark-tertiary"}),"Auto-scroll"]}),S.jsxs("span",{className:"text-sm text-bambu-gray",children:[w.length," message",w.length!==1?"s":""]})]}),S.jsx("div",{ref:l,className:"flex-1 overflow-auto p-4 font-mono text-xs bg-bambu-dark min-h-[400px]",children:w.length===0?S.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-bambu-gray",children:[S.jsx("p",{className:"mb-2",children:"No messages logged yet"}),!M&&S.jsx("p",{className:"text-sm",children:'Click "Start Logging" to begin capturing MQTT messages'})]}):S.jsx("div",{className:"space-y-1",children:w.map((E,T)=>{const P=s.has(T),R=E.direction==="in";return S.jsxs("div",{className:`p-2 rounded cursor-pointer hover:bg-bambu-dark-secondary transition-colors ${P?"bg-bambu-dark-secondary":""}`,onClick:()=>b(T),children:[S.jsxs("div",{className:"flex items-start gap-2",children:[S.jsx("span",{className:"text-bambu-gray shrink-0",children:x(E.timestamp)}),S.jsx("span",{className:`shrink-0 ${R?"text-blue-400":"text-green-400"}`,title:R?"Incoming":"Outgoing",children:R?S.jsx(Tne,{className:"w-3 h-3"}):S.jsx(Pne,{className:"w-3 h-3"})}),S.jsx("span",{className:"text-purple-400 shrink-0",children:E.topic})]}),S.jsx("pre",{className:`mt-1 text-white/80 overflow-x-auto ${P?"whitespace-pre-wrap":"truncate"}`,children:v(E.payload,P)})]},T)})})}),S.jsxs("div",{className:"flex items-center justify-between p-4 border-t border-bambu-dark-tertiary",children:[S.jsx("div",{className:"text-sm text-bambu-gray",children:M?S.jsxs("span",{className:"flex items-center gap-2",children:[S.jsx("span",{className:"w-2 h-2 bg-green-500 rounded-full animate-pulse"}),"Logging active - messages will auto-refresh"]}):S.jsx("span",{children:"Logging stopped"})}),S.jsx(xt,{variant:"secondary",onClick:n,children:"Close"})]})]})})}function Eae(t){const e=Math.floor(t/3600),n=Math.floor(t%3600/60);return e>0?`${e}h ${n}m`:`${n}m`}function Aae({url:t,printName:e}){const[n,i]=C.useState(!1),[r,a]=C.useState(!1),[s,o]=C.useState(!1);return S.jsxs(S.Fragment,{children:[S.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?S.jsxs(S.Fragment,{children:[S.jsx("img",{src:t,alt:"Print preview",className:`w-full h-full object-cover ${n?"block":"hidden"}`,onLoad:()=>i(!0),onError:()=>a(!0)}),!n&&S.jsx(c0,{className:"w-8 h-8 text-bambu-gray"})]}):S.jsx(c0,{className:"w-8 h-8 text-bambu-gray"})}),s&&t&&S.jsx("div",{className:"fixed inset-0 bg-black/80 flex items-center justify-center z-50 p-8",onClick:()=>o(!1),children:S.jsxs("div",{className:"relative max-w-2xl max-h-full",children:[S.jsx("img",{src:t,alt:"Print preview",className:"max-w-full max-h-[80vh] rounded-lg shadow-2xl"}),e&&S.jsx("p",{className:"text-white text-center mt-4 text-lg",children:e})]})})]})}function Tae({printer:t,hideIfDisconnected:e}){const n=Hr(),[i,r]=C.useState(!1),[a,s]=C.useState(!1),[o,l]=C.useState(!1),[c,d]=C.useState(!1),{data:f}=ei({queryKey:["printerStatus",t.id],queryFn:()=>vt.getPrinterStatus(t.id),refetchInterval:3e4}),p=e&&f&&!f.connected,m=Gn({mutationFn:()=>vt.deletePrinter(t.id),onSuccess:()=>{n.invalidateQueries({queryKey:["printers"]})}}),y=Gn({mutationFn:()=>vt.connectPrinter(t.id),onSuccess:()=>{n.invalidateQueries({queryKey:["printerStatus",t.id]})}});return p?null:S.jsxs(bi,{className:"relative",children:[S.jsxs(Ri,{children:[S.jsxs("div",{className:"flex items-start justify-between mb-4",children:[S.jsxs("div",{children:[S.jsx("h3",{className:"text-lg font-semibold text-white",children:t.name}),S.jsx("p",{className:"text-sm text-bambu-gray",children:t.model||"Unknown Model"})]}),S.jsxs("div",{className:"flex items-center gap-2",children:[S.jsxs("span",{className:`flex items-center gap-1.5 px-2 py-1 rounded-full text-xs ${f?.connected?"bg-bambu-green/20 text-bambu-green":"bg-red-500/20 text-red-400"}`,children:[f?.connected?S.jsx(DN,{className:"w-3 h-3"}):S.jsx(PN,{className:"w-3 h-3"}),f?.connected?"Connected":"Offline"]}),f?.connected&&S.jsxs("span",{className:`flex items-center gap-1 px-2 py-1 rounded-full text-xs ${f.hms_errors&&f.hms_errors.length>0?f.hms_errors.some(b=>b.severity<=2)?"bg-red-500/20 text-red-400":"bg-orange-500/20 text-orange-400":"bg-bambu-green/20 text-bambu-green"}`,title:f.hms_errors&&f.hms_errors.length>0?`${f.hms_errors.length} HMS error(s)`:"No HMS errors",children:[S.jsx(mG,{className:"w-3 h-3"}),f.hms_errors&&f.hms_errors.length>0?f.hms_errors.length:"OK"]}),S.jsxs("div",{className:"relative",children:[S.jsx(xt,{variant:"ghost",size:"sm",onClick:()=>r(!i),children:S.jsx(oie,{className:"w-4 h-4"})}),i&&S.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:[S.jsxs("button",{className:"w-full px-4 py-2 text-left text-sm hover:bg-bambu-dark-tertiary flex items-center gap-2",onClick:()=>{y.mutate(),r(!1)},children:[S.jsx(aS,{className:"w-4 h-4"}),"Reconnect"]}),S.jsxs("button",{className:"w-full px-4 py-2 text-left text-sm hover:bg-bambu-dark-tertiary flex items-center gap-2",onClick:()=>{d(!0),r(!1)},children:[S.jsx(Hre,{className:"w-4 h-4"}),"MQTT Debug"]}),S.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:()=>{s(!0),r(!1)},children:[S.jsx(Jl,{className:"w-4 h-4"}),"Delete"]})]})]})]})]}),a&&S.jsx(qp,{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:()=>{m.mutate(),s(!1)},onCancel:()=>s(!1)}),f?.connected&&S.jsxs(S.Fragment,{children:[S.jsxs("div",{className:"mb-4",children:[S.jsx("p",{className:"text-sm text-bambu-gray mb-1",children:"Status"}),S.jsx("p",{className:"text-white font-medium capitalize",children:f.state?.toLowerCase()||"Idle"})]}),f.current_print&&f.state==="RUNNING"&&S.jsx("div",{className:"mb-4 p-3 bg-bambu-dark rounded-lg",children:S.jsxs("div",{className:"flex gap-3",children:[S.jsx(Aae,{url:f.cover_url,printName:f.subtask_name||f.current_print||void 0}),S.jsxs("div",{className:"flex-1 min-w-0",children:[S.jsx("p",{className:"text-sm text-bambu-gray mb-1",children:"Printing"}),S.jsx("p",{className:"text-white text-sm mb-2 truncate",children:f.subtask_name||f.current_print}),S.jsxs("div",{className:"flex items-center justify-between text-sm",children:[S.jsx("div",{className:"flex-1 bg-bambu-dark-tertiary rounded-full h-2 mr-3",children:S.jsx("div",{className:"bg-bambu-green h-2 rounded-full transition-all",style:{width:`${f.progress||0}%`}})}),S.jsxs("span",{className:"text-white",children:[Math.round(f.progress||0),"%"]})]}),S.jsxs("div",{className:"flex items-center gap-3 mt-2 text-xs text-bambu-gray",children:[f.remaining_time!=null&&f.remaining_time>0&&S.jsxs("span",{className:"flex items-center gap-1",children:[S.jsx(nv,{className:"w-3 h-3"}),Eae(f.remaining_time*60)]}),f.layer_num!=null&&f.total_layers!=null&&f.total_layers>0&&S.jsxs("span",{children:["Layer ",f.layer_num,"/",f.total_layers]})]})]})]})}),f.temperatures&&S.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[S.jsxs("div",{className:"text-center p-2 bg-bambu-dark rounded-lg",children:[S.jsx(Rb,{className:"w-4 h-4 mx-auto mb-1 text-orange-400"}),S.jsx("p",{className:"text-xs text-bambu-gray",children:"Nozzle"}),S.jsxs("p",{className:"text-sm text-white",children:[Math.round(f.temperatures.nozzle||0),"°C"]})]}),S.jsxs("div",{className:"text-center p-2 bg-bambu-dark rounded-lg",children:[S.jsx(Rb,{className:"w-4 h-4 mx-auto mb-1 text-blue-400"}),S.jsx("p",{className:"text-xs text-bambu-gray",children:"Bed"}),S.jsxs("p",{className:"text-sm text-white",children:[Math.round(f.temperatures.bed||0),"°C"]})]}),f.temperatures.chamber!==void 0&&S.jsxs("div",{className:"text-center p-2 bg-bambu-dark rounded-lg",children:[S.jsx(Rb,{className:"w-4 h-4 mx-auto mb-1 text-green-400"}),S.jsx("p",{className:"text-xs text-bambu-gray",children:"Chamber"}),S.jsxs("p",{className:"text-sm text-white",children:[Math.round(f.temperatures.chamber||0),"°C"]})]})]})]}),S.jsxs("div",{className:"mt-4 pt-4 border-t border-bambu-dark-tertiary flex items-center justify-between",children:[S.jsxs("div",{className:"text-xs text-bambu-gray",children:[S.jsx("p",{children:t.ip_address}),S.jsx("p",{className:"truncate",children:t.serial_number})]}),S.jsxs(xt,{variant:"secondary",size:"sm",onClick:()=>l(!0),title:"Browse printer files",children:[S.jsx(lG,{className:"w-4 h-4"}),"Files"]})]})]}),o&&S.jsx(wae,{printerId:t.id,printerName:t.name,onClose:()=>l(!1)}),c&&S.jsx(Mae,{printerId:t.id,printerName:t.name,onClose:()=>d(!1)})]})}function Cae({onClose:t,onAdd:e}){const[n,i]=C.useState({name:"",serial_number:"",ip_address:"",access_code:"",model:"",auto_archive:!0});return C.useEffect(()=>{const r=a=>{a.key==="Escape"&&t()};return window.addEventListener("keydown",r),()=>window.removeEventListener("keydown",r)},[t]),S.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",onClick:t,children:S.jsx(bi,{className:"w-full max-w-md",onClick:r=>r.stopPropagation(),children:S.jsxs(Ri,{children:[S.jsx("h2",{className:"text-xl font-semibold mb-4",children:"Add Printer"}),S.jsxs("form",{onSubmit:r=>{r.preventDefault(),e(n)},className:"space-y-4",children:[S.jsxs("div",{children:[S.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:"Name"}),S.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"})]}),S.jsxs("div",{children:[S.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:"IP Address"}),S.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"})]}),S.jsxs("div",{children:[S.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:"Serial Number"}),S.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"})]}),S.jsxs("div",{children:[S.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:"Access Code"}),S.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"})]}),S.jsxs("div",{children:[S.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:"Model (optional)"}),S.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:[S.jsx("option",{value:"",children:"Select model..."}),S.jsxs("optgroup",{label:"H2 Series",children:[S.jsx("option",{value:"H2C",children:"H2C"}),S.jsx("option",{value:"H2D",children:"H2D"}),S.jsx("option",{value:"H2S",children:"H2S"})]}),S.jsxs("optgroup",{label:"X1 Series",children:[S.jsx("option",{value:"X1E",children:"X1E"}),S.jsx("option",{value:"X1C",children:"X1 Carbon"}),S.jsx("option",{value:"X1",children:"X1"})]}),S.jsxs("optgroup",{label:"P Series",children:[S.jsx("option",{value:"P2S",children:"P2S"}),S.jsx("option",{value:"P1S",children:"P1S"}),S.jsx("option",{value:"P1P",children:"P1P"})]}),S.jsxs("optgroup",{label:"A1 Series",children:[S.jsx("option",{value:"A1",children:"A1"}),S.jsx("option",{value:"A1 Mini",children:"A1 Mini"})]})]})]}),S.jsxs("div",{className:"flex items-center gap-2",children:[S.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"}),S.jsx("label",{htmlFor:"auto_archive",className:"text-sm text-bambu-gray",children:"Auto-archive completed prints"})]}),S.jsxs("div",{className:"flex gap-3 pt-4",children:[S.jsx(xt,{type:"button",variant:"secondary",onClick:t,className:"flex-1",children:"Cancel"}),S.jsx(xt,{type:"submit",className:"flex-1",children:"Add Printer"})]})]})]})})})}function Rae(){const[t,e]=C.useState(!1),[n,i]=C.useState(()=>localStorage.getItem("hideDisconnectedPrinters")==="true"),r=Hr(),{data:a,isLoading:s}=ei({queryKey:["printers"],queryFn:vt.getPrinters}),o=Gn({mutationFn:vt.createPrinter,onSuccess:()=>{r.invalidateQueries({queryKey:["printers"]}),e(!1)}}),l=()=>{const c=!n;i(c),localStorage.setItem("hideDisconnectedPrinters",String(c))};return S.jsxs("div",{className:"p-8",children:[S.jsxs("div",{className:"flex items-center justify-between mb-8",children:[S.jsxs("div",{children:[S.jsx("h1",{className:"text-2xl font-bold text-white",children:"Printers"}),S.jsx("p",{className:"text-bambu-gray",children:"Manage your Bambu Lab printers"})]}),S.jsxs("div",{className:"flex items-center gap-4",children:[S.jsxs("label",{className:"flex items-center gap-2 text-sm text-bambu-gray cursor-pointer",children:[S.jsx("input",{type:"checkbox",checked:n,onChange:l,className:"rounded border-bambu-dark-tertiary bg-bambu-dark text-bambu-green focus:ring-bambu-green"}),"Hide offline"]}),S.jsxs(xt,{onClick:()=>e(!0),children:[S.jsx(d0,{className:"w-4 h-4"}),"Add Printer"]})]})]}),s?S.jsx("div",{className:"text-center py-12 text-bambu-gray",children:"Loading printers..."}):a?.length===0?S.jsx(bi,{children:S.jsxs(Ri,{className:"text-center py-12",children:[S.jsx("p",{className:"text-bambu-gray mb-4",children:"No printers configured yet"}),S.jsxs(xt,{onClick:()=>e(!0),children:[S.jsx(d0,{className:"w-4 h-4"}),"Add Your First Printer"]})]})}):S.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:a?.map(c=>S.jsx(Tae,{printer:c,hideIfDisconnected:n},c.id))}),t&&S.jsx(Cae,{onClose:()=>e(!1),onAdd:c=>o.mutate(c)})]})}const ON="181",rp={ROTATE:0,DOLLY:1,PAN:2},Jh={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},Nae=0,y4=1,Pae=2,xG=1,Dae=2,Cl=3,Ru=0,Pa=1,Po=2,Gl=0,ap=1,b4=2,_4=3,S4=4,Oae=5,Ed=100,Lae=101,kae=102,Iae=103,Uae=104,Fae=200,zae=201,Bae=202,jae=203,P2=204,D2=205,Hae=206,Vae=207,Gae=208,$ae=209,Wae=210,qae=211,Xae=212,Yae=213,Kae=214,O2=0,L2=1,k2=2,vp=3,I2=4,U2=5,F2=6,z2=7,LN=0,Zae=1,Jae=2,bu=0,Qae=1,ese=2,tse=3,nse=4,ise=5,rse=6,ase=7,yG=300,xp=301,yp=302,B2=303,j2=304,oS=306,H2=1e3,Ul=1001,V2=1002,ns=1003,sse=1004,Jx=1005,Ls=1006,FE=1007,Dd=1008,zo=1009,bG=1010,_G=1011,p0=1012,kN=1013,af=1014,Fl=1015,Xp=1016,IN=1017,UN=1018,m0=1020,SG=35902,wG=35899,MG=1021,EG=1022,lo=1023,g0=1026,v0=1027,AG=1028,FN=1029,zN=1030,BN=1031,jN=1033,Nb=33776,Pb=33777,Db=33778,Ob=33779,G2=35840,$2=35841,W2=35842,q2=35843,X2=36196,Y2=37492,K2=37496,Z2=37808,J2=37809,Q2=37810,eR=37811,tR=37812,nR=37813,iR=37814,rR=37815,aR=37816,sR=37817,oR=37818,lR=37819,cR=37820,uR=37821,dR=36492,fR=36494,hR=36495,pR=36283,mR=36284,gR=36285,vR=36286,ose=3200,lse=3201,TG=0,cse=1,cu="",As="srgb",bp="srgb-linear",i_="linear",On="srgb",oh=7680,w4=519,use=512,dse=513,fse=514,CG=515,hse=516,pse=517,mse=518,gse=519,M4=35044,E4="300 es",Oo=2e3,r_=2001;function RG(t){for(let e=t.length-1;e>=0;--e)if(t[e]>=65535)return!0;return!1}function a_(t){return document.createElementNS("http://www.w3.org/1999/xhtml",t)}function vse(){const t=a_("canvas");return t.style.display="block",t}const A4={};function T4(...t){const e="THREE."+t.shift();console.log(e,...t)}function Ht(...t){const e="THREE."+t.shift();console.warn(e,...t)}function Ci(...t){const e="THREE."+t.shift();console.error(e,...t)}function x0(...t){const e=t.join(" ");e in A4||(A4[e]=!0,Ht(...t))}function xse(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 Ef=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 $r=["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"],Lb=Math.PI/180,xR=180/Math.PI;function iv(){const t=Math.random()*4294967295|0,e=Math.random()*4294967295|0,n=Math.random()*4294967295|0,i=Math.random()*4294967295|0;return($r[t&255]+$r[t>>8&255]+$r[t>>16&255]+$r[t>>24&255]+"-"+$r[e&255]+$r[e>>8&255]+"-"+$r[e>>16&15|64]+$r[e>>24&255]+"-"+$r[n&63|128]+$r[n>>8&255]+"-"+$r[n>>16&255]+$r[n>>24&255]+$r[i&255]+$r[i>>8&255]+$r[i>>16&255]+$r[i>>24&255]).toLowerCase()}function ln(t,e,n){return Math.max(e,Math.min(n,t))}function yse(t,e){return(t%e+e)%e}function zE(t,e,n){return(1-n)*t+n*e}function ag(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 Ea(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 bse={DEG2RAD:Lb};let Qt=class NG{constructor(e=0,n=0){NG.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=ln(this.x,e.x,n.x),this.y=ln(this.y,e.y,n.y),this}clampScalar(e,n){return this.x=ln(this.x,e,n),this.y=ln(this.y,e,n),this}clampLength(e,n){const i=this.length();return this.divideScalar(i||1).multiplyScalar(ln(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(ln(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}},sf=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],p=a[s+0],m=a[s+1],y=a[s+2],b=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]=p,e[n+1]=m,e[n+2]=y,e[n+3]=b;return}if(f!==b||l!==p||c!==m||d!==y){let x=l*p+c*m+d*y+f*b;x<0&&(p=-p,m=-m,y=-y,b=-b,x=-x);let v=1-o;if(x<.9995){const M=Math.acos(x),w=Math.sin(M);v=Math.sin(v*M)/w,o=Math.sin(o*M)/w,l=l*v+p*o,c=c*v+m*o,d=d*v+y*o,f=f*v+b*o}else{l=l*v+p*o,c=c*v+m*o,d=d*v+y*o,f=f*v+b*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],p=a[s+1],m=a[s+2],y=a[s+3];return e[n]=o*y+d*f+l*m-c*p,e[n+1]=l*y+d*p+c*f-o*m,e[n+2]=c*y+d*m+o*p-l*f,e[n+3]=d*y-o*f-l*p-c*m,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,n,i,r){return this._x=e,this._y=n,this._z=i,this._w=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,n=!0){const i=e._x,r=e._y,a=e._z,s=e._order,o=Math.cos,l=Math.sin,c=o(i/2),d=o(r/2),f=o(a/2),p=l(i/2),m=l(r/2),y=l(a/2);switch(s){case"XYZ":this._x=p*d*f+c*m*y,this._y=c*m*f-p*d*y,this._z=c*d*y+p*m*f,this._w=c*d*f-p*m*y;break;case"YXZ":this._x=p*d*f+c*m*y,this._y=c*m*f-p*d*y,this._z=c*d*y-p*m*f,this._w=c*d*f+p*m*y;break;case"ZXY":this._x=p*d*f-c*m*y,this._y=c*m*f+p*d*y,this._z=c*d*y+p*m*f,this._w=c*d*f-p*m*y;break;case"ZYX":this._x=p*d*f-c*m*y,this._y=c*m*f+p*d*y,this._z=c*d*y-p*m*f,this._w=c*d*f+p*m*y;break;case"YZX":this._x=p*d*f+c*m*y,this._y=c*m*f+p*d*y,this._z=c*d*y-p*m*f,this._w=c*d*f-p*m*y;break;case"XZY":this._x=p*d*f-c*m*y,this._y=c*m*f-p*d*y,this._z=c*d*y+p*m*f,this._w=c*d*f+p*m*y;break;default:Ht("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],p=i+o+f;if(p>0){const m=.5/Math.sqrt(p+1);this._w=.25/m,this._x=(d-l)*m,this._y=(a-c)*m,this._z=(s-r)*m}else if(i>o&&i>f){const m=2*Math.sqrt(1+i-o-f);this._w=(d-l)/m,this._x=.25*m,this._y=(r+s)/m,this._z=(a+c)/m}else if(o>f){const m=2*Math.sqrt(1+o-i-f);this._w=(a-c)/m,this._x=(r+s)/m,this._y=.25*m,this._z=(l+d)/m}else{const m=2*Math.sqrt(1+f-i-o);this._w=(s-r)/m,this._x=(a+c)/m,this._y=(l+d)/m,this._z=.25*m}return this._onChangeCallback(),this}setFromUnitVectors(e,n){let i=e.dot(n)+1;return i<1e-8?(i=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=i):(this._x=0,this._y=-e.z,this._z=e.y,this._w=i)):(this._x=e.y*n.z-e.z*n.y,this._y=e.z*n.x-e.x*n.z,this._z=e.x*n.y-e.y*n.x,this._w=i),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(ln(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}},Ge=class PG{constructor(e=0,n=0,i=0){PG.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(C4.setFromEuler(e))}applyAxisAngle(e,n){return this.applyQuaternion(C4.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=ln(this.x,e.x,n.x),this.y=ln(this.y,e.y,n.y),this.z=ln(this.z,e.z,n.z),this}clampScalar(e,n){return this.x=ln(this.x,e,n),this.y=ln(this.y,e,n),this.z=ln(this.z,e,n),this}clampLength(e,n){const i=this.length();return this.divideScalar(i||1).multiplyScalar(ln(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 BE.copy(this).projectOnVector(e),this.sub(BE)}reflect(e){return this.sub(BE.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(ln(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 BE=new Ge,C4=new sf;let nn=class DG{constructor(e,n,i,r,a,s,o,l,c){DG.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],p=i[2],m=i[5],y=i[8],b=r[0],x=r[3],v=r[6],M=r[1],w=r[4],E=r[7],T=r[2],P=r[5],R=r[8];return a[0]=s*b+o*M+l*T,a[3]=s*x+o*w+l*P,a[6]=s*v+o*E+l*R,a[1]=c*b+d*M+f*T,a[4]=c*x+d*w+f*P,a[7]=c*v+d*E+f*R,a[2]=p*b+m*M+y*T,a[5]=p*x+m*w+y*P,a[8]=p*v+m*E+y*R,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,p=o*l-d*a,m=c*a-s*l,y=n*f+i*p+r*m;if(y===0)return this.set(0,0,0,0,0,0,0,0,0);const b=1/y;return e[0]=f*b,e[1]=(r*c-d*i)*b,e[2]=(o*i-r*s)*b,e[3]=p*b,e[4]=(d*n-r*l)*b,e[5]=(r*a-o*n)*b,e[6]=m*b,e[7]=(i*l-c*n)*b,e[8]=(s*n-i*a)*b,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(jE.makeScale(e,n)),this}rotate(e){return this.premultiply(jE.makeRotation(-e)),this}translate(e,n){return this.premultiply(jE.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 jE=new nn,R4=new nn().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),N4=new nn().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function _se(){const t={enabled:!0,workingColorSpace:bp,spaces:{},convert:function(r,a,s){return this.enabled===!1||a===s||!a||!s||(this.spaces[a].transfer===On&&(r.r=$l(r.r),r.g=$l(r.g),r.b=$l(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===On&&(r.r=sp(r.r),r.g=sp(r.g),r.b=sp(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===cu?i_: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 x0("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),t.workingToColorSpace(r,a)},toWorkingColorSpace:function(r,a){return x0("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({[bp]:{primaries:e,whitePoint:i,transfer:i_,toXYZ:R4,fromXYZ:N4,luminanceCoefficients:n,workingColorSpaceConfig:{unpackColorSpace:As},outputColorSpaceConfig:{drawingBufferColorSpace:As}},[As]:{primaries:e,whitePoint:i,transfer:On,toXYZ:R4,fromXYZ:N4,luminanceCoefficients:n,outputColorSpaceConfig:{drawingBufferColorSpace:As}}}),t}const xn=_se();function $l(t){return t<.04045?t*.0773993808:Math.pow(t*.9478672986+.0521327014,2.4)}function sp(t){return t<.0031308?t*12.92:1.055*Math.pow(t,.41666)-.055}let lh,Sse=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{lh===void 0&&(lh=a_("canvas")),lh.width=e.width,lh.height=e.height;const r=lh.getContext("2d");e instanceof ImageData?r.putImageData(e,0,0):r.drawImage(e,0,0,e.width,e.height),i=lh}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=a_("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]=$l(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($l(n[i]/255)*255):n[i]=$l(n[i]);return{data:n,width:e.width,height:e.height}}else return Ht("ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}},wse=0,HN=class{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:wse++}),this.uuid=iv(),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(HE(r[s].image)):a.push(HE(r[s]))}else a=HE(r);i.url=a}return n||(e.images[this.uuid]=i),i}};function HE(t){return typeof HTMLImageElement<"u"&&t instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&t instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&t instanceof ImageBitmap?Sse.getDataURL(t):t.data?{data:Array.from(t.data),width:t.width,height:t.height,type:t.data.constructor.name}:(Ht("Texture: Unable to serialize Texture."),{})}let Mse=0;const VE=new Ge;let vo=class kb extends Ef{constructor(e=kb.DEFAULT_IMAGE,n=kb.DEFAULT_MAPPING,i=Ul,r=Ul,a=Ls,s=Dd,o=lo,l=zo,c=kb.DEFAULT_ANISOTROPY,d=cu){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:Mse++}),this.uuid=iv(),this.name="",this.source=new HN(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 Qt(0,0),this.repeat=new Qt(1,1),this.center=new Qt(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new nn,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(VE).x}get height(){return this.source.getSize(VE).y}get depth(){return this.source.getSize(VE).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){Ht(`Texture.setValues(): parameter '${n}' has value of undefined.`);continue}const r=this[n];if(r===void 0){Ht(`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!==yG)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case H2:e.x=e.x-Math.floor(e.x);break;case Ul:e.x=e.x<0?0:1;break;case V2: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 H2:e.y=e.y-Math.floor(e.y);break;case Ul:e.y=e.y<0?0:1;break;case V2: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++}};vo.DEFAULT_IMAGE=null;vo.DEFAULT_MAPPING=yG;vo.DEFAULT_ANISOTROPY=1;let Bi=class OG{constructor(e=0,n=0,i=0,r=1){OG.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],p=l[1],m=l[5],y=l[9],b=l[2],x=l[6],v=l[10];if(Math.abs(d-p)<.01&&Math.abs(f-b)<.01&&Math.abs(y-x)<.01){if(Math.abs(d+p)<.1&&Math.abs(f+b)<.1&&Math.abs(y+x)<.1&&Math.abs(c+m+v-3)<.1)return this.set(1,0,0,0),this;n=Math.PI;const w=(c+1)/2,E=(m+1)/2,T=(v+1)/2,P=(d+p)/4,R=(f+b)/4,U=(y+x)/4;return w>E&&w>T?w<.01?(i=0,r=.707106781,a=.707106781):(i=Math.sqrt(w),r=P/i,a=R/i):E>T?E<.01?(i=.707106781,r=0,a=.707106781):(r=Math.sqrt(E),i=P/r,a=U/r):T<.01?(i=.707106781,r=.707106781,a=0):(a=Math.sqrt(T),i=R/a,r=U/a),this.set(i,r,a,n),this}let M=Math.sqrt((x-y)*(x-y)+(f-b)*(f-b)+(p-d)*(p-d));return Math.abs(M)<.001&&(M=1),this.x=(x-y)/M,this.y=(f-b)/M,this.z=(p-d)/M,this.w=Math.acos((c+m+v-1)/2),this}setFromMatrixPosition(e){const n=e.elements;return this.x=n[12],this.y=n[13],this.z=n[14],this.w=n[15],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,n){return this.x=ln(this.x,e.x,n.x),this.y=ln(this.y,e.y,n.y),this.z=ln(this.z,e.z,n.z),this.w=ln(this.w,e.w,n.w),this}clampScalar(e,n){return this.x=ln(this.x,e,n),this.y=ln(this.y,e,n),this.z=ln(this.z,e,n),this.w=ln(this.w,e,n),this}clampLength(e,n){const i=this.length();return this.divideScalar(i||1).multiplyScalar(ln(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}},Ese=class extends Ef{constructor(e=1,n=1,i={}){super(),i=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:Ls,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 Bi(0,0,e,n),this.scissorTest=!1,this.viewport=new Bi(0,0,e,n);const r={width:e,height:n,depth:i.depth},a=new vo(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:Ls,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 HN(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"})}},of=class extends Ese{constructor(e=1,n=1,i={}){super(e,n,i),this.isWebGLRenderTarget=!0}},LG=class extends vo{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=ns,this.minFilter=ns,this.wrapR=Ul,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}},Ase=class extends vo{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=ns,this.minFilter=ns,this.wrapR=Ul,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}},lf=class{constructor(e=new Ge(1/0,1/0,1/0),n=new Ge(-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(Ks.fromArray(e,n));return this}setFromBufferAttribute(e){this.makeEmpty();for(let n=0,i=e.count;n<i;n++)this.expandByPoint(Ks.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=Ks.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,Ks):Ks.fromBufferAttribute(a,s),Ks.applyMatrix4(e.matrixWorld),this.expandByPoint(Ks);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),Qx.copy(e.boundingBox)):(i.boundingBox===null&&i.computeBoundingBox(),Qx.copy(i.boundingBox)),Qx.applyMatrix4(e.matrixWorld),this.union(Qx)}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,Ks),Ks.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(sg),ey.subVectors(this.max,sg),ch.subVectors(e.a,sg),uh.subVectors(e.b,sg),dh.subVectors(e.c,sg),Bc.subVectors(uh,ch),jc.subVectors(dh,uh),ld.subVectors(ch,dh);let n=[0,-Bc.z,Bc.y,0,-jc.z,jc.y,0,-ld.z,ld.y,Bc.z,0,-Bc.x,jc.z,0,-jc.x,ld.z,0,-ld.x,-Bc.y,Bc.x,0,-jc.y,jc.x,0,-ld.y,ld.x,0];return!GE(n,ch,uh,dh,ey)||(n=[1,0,0,0,1,0,0,0,1],!GE(n,ch,uh,dh,ey))?!1:(ty.crossVectors(Bc,jc),n=[ty.x,ty.y,ty.z],GE(n,ch,uh,dh,ey))}clampPoint(e,n){return n.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Ks).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(Ks).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:(pl[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),pl[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),pl[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),pl[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),pl[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),pl[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),pl[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),pl[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(pl),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 pl=[new Ge,new Ge,new Ge,new Ge,new Ge,new Ge,new Ge,new Ge],Ks=new Ge,Qx=new lf,ch=new Ge,uh=new Ge,dh=new Ge,Bc=new Ge,jc=new Ge,ld=new Ge,sg=new Ge,ey=new Ge,ty=new Ge,cd=new Ge;function GE(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 Tse=new lf,og=new Ge,$E=new Ge;let lS=class{constructor(e=new Ge,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):Tse.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):($E.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(og.copy(e.center).add($E)),this.expandByPoint(og.copy(e.center).sub($E))),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 ml=new Ge,WE=new Ge,ny=new Ge,Hc=new Ge,qE=new Ge,iy=new Ge,XE=new Ge;let VN=class{constructor(e=new Ge,n=new Ge(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,ml)),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=ml.subVectors(e,this.origin).dot(this.direction);return n<0?this.origin.distanceToSquared(e):(ml.copy(this.origin).addScaledVector(this.direction,n),ml.distanceToSquared(e))}distanceSqToSegment(e,n,i,r){WE.copy(e).add(n).multiplyScalar(.5),ny.copy(n).sub(e).normalize(),Hc.copy(this.origin).sub(WE);const a=e.distanceTo(n)*.5,s=-this.direction.dot(ny),o=Hc.dot(this.direction),l=-Hc.dot(ny),c=Hc.lengthSq(),d=Math.abs(1-s*s);let f,p,m,y;if(d>0)if(f=s*l-o,p=s*o-l,y=a*d,f>=0)if(p>=-y)if(p<=y){const b=1/d;f*=b,p*=b,m=f*(f+s*p+2*o)+p*(s*f+p+2*l)+c}else p=a,f=Math.max(0,-(s*p+o)),m=-f*f+p*(p+2*l)+c;else p=-a,f=Math.max(0,-(s*p+o)),m=-f*f+p*(p+2*l)+c;else p<=-y?(f=Math.max(0,-(-s*a+o)),p=f>0?-a:Math.min(Math.max(-a,-l),a),m=-f*f+p*(p+2*l)+c):p<=y?(f=0,p=Math.min(Math.max(-a,-l),a),m=p*(p+2*l)+c):(f=Math.max(0,-(s*a+o)),p=f>0?a:Math.min(Math.max(-a,-l),a),m=-f*f+p*(p+2*l)+c);else p=s>0?-a:a,f=Math.max(0,-(s*p+o)),m=-f*f+p*(p+2*l)+c;return i&&i.copy(this.origin).addScaledVector(this.direction,f),r&&r.copy(WE).addScaledVector(ny,p),m}intersectSphere(e,n){ml.subVectors(e.center,this.origin);const i=ml.dot(this.direction),r=ml.dot(ml)-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,p=this.origin;return c>=0?(i=(e.min.x-p.x)*c,r=(e.max.x-p.x)*c):(i=(e.max.x-p.x)*c,r=(e.min.x-p.x)*c),d>=0?(a=(e.min.y-p.y)*d,s=(e.max.y-p.y)*d):(a=(e.max.y-p.y)*d,s=(e.min.y-p.y)*d),i>s||a>r||((a>i||isNaN(i))&&(i=a),(s<r||isNaN(r))&&(r=s),f>=0?(o=(e.min.z-p.z)*f,l=(e.max.z-p.z)*f):(o=(e.max.z-p.z)*f,l=(e.min.z-p.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,ml)!==null}intersectTriangle(e,n,i,r,a){qE.subVectors(n,e),iy.subVectors(i,e),XE.crossVectors(qE,iy);let s=this.direction.dot(XE),o;if(s>0){if(r)return null;o=1}else if(s<0)o=-1,s=-s;else return null;Hc.subVectors(this.origin,e);const l=o*this.direction.dot(iy.crossVectors(Hc,iy));if(l<0)return null;const c=o*this.direction.dot(qE.cross(Hc));if(c<0||l+c>s)return null;const d=-o*Hc.dot(XE);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)}},Gi=class yR{constructor(e,n,i,r,a,s,o,l,c,d,f,p,m,y,b,x){yR.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,p,m,y,b,x)}set(e,n,i,r,a,s,o,l,c,d,f,p,m,y,b,x){const v=this.elements;return v[0]=e,v[4]=n,v[8]=i,v[12]=r,v[1]=a,v[5]=s,v[9]=o,v[13]=l,v[2]=c,v[6]=d,v[10]=f,v[14]=p,v[3]=m,v[7]=y,v[11]=b,v[15]=x,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new yR().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/fh.setFromMatrixColumn(e,0).length(),a=1/fh.setFromMatrixColumn(e,1).length(),s=1/fh.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 p=s*d,m=s*f,y=o*d,b=o*f;n[0]=l*d,n[4]=-l*f,n[8]=c,n[1]=m+y*c,n[5]=p-b*c,n[9]=-o*l,n[2]=b-p*c,n[6]=y+m*c,n[10]=s*l}else if(e.order==="YXZ"){const p=l*d,m=l*f,y=c*d,b=c*f;n[0]=p+b*o,n[4]=y*o-m,n[8]=s*c,n[1]=s*f,n[5]=s*d,n[9]=-o,n[2]=m*o-y,n[6]=b+p*o,n[10]=s*l}else if(e.order==="ZXY"){const p=l*d,m=l*f,y=c*d,b=c*f;n[0]=p-b*o,n[4]=-s*f,n[8]=y+m*o,n[1]=m+y*o,n[5]=s*d,n[9]=b-p*o,n[2]=-s*c,n[6]=o,n[10]=s*l}else if(e.order==="ZYX"){const p=s*d,m=s*f,y=o*d,b=o*f;n[0]=l*d,n[4]=y*c-m,n[8]=p*c+b,n[1]=l*f,n[5]=b*c+p,n[9]=m*c-y,n[2]=-c,n[6]=o*l,n[10]=s*l}else if(e.order==="YZX"){const p=s*l,m=s*c,y=o*l,b=o*c;n[0]=l*d,n[4]=b-p*f,n[8]=y*f+m,n[1]=f,n[5]=s*d,n[9]=-o*d,n[2]=-c*d,n[6]=m*f+y,n[10]=p-b*f}else if(e.order==="XZY"){const p=s*l,m=s*c,y=o*l,b=o*c;n[0]=l*d,n[4]=-f,n[8]=c*d,n[1]=p*f+b,n[5]=s*d,n[9]=m*f-y,n[2]=y*f-m,n[6]=o*d,n[10]=b*f+p}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(Cse,e,Rse)}lookAt(e,n,i){const r=this.elements;return qa.subVectors(e,n),qa.lengthSq()===0&&(qa.z=1),qa.normalize(),Vc.crossVectors(i,qa),Vc.lengthSq()===0&&(Math.abs(i.z)===1?qa.x+=1e-4:qa.z+=1e-4,qa.normalize(),Vc.crossVectors(i,qa)),Vc.normalize(),ry.crossVectors(qa,Vc),r[0]=Vc.x,r[4]=ry.x,r[8]=qa.x,r[1]=Vc.y,r[5]=ry.y,r[9]=qa.y,r[2]=Vc.z,r[6]=ry.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],p=i[9],m=i[13],y=i[2],b=i[6],x=i[10],v=i[14],M=i[3],w=i[7],E=i[11],T=i[15],P=r[0],R=r[4],U=r[8],N=r[12],O=r[1],B=r[5],I=r[9],W=r[13],L=r[2],$=r[6],q=r[10],G=r[14],Y=r[3],Q=r[7],se=r[11],H=r[15];return a[0]=s*P+o*O+l*L+c*Y,a[4]=s*R+o*B+l*$+c*Q,a[8]=s*U+o*I+l*q+c*se,a[12]=s*N+o*W+l*G+c*H,a[1]=d*P+f*O+p*L+m*Y,a[5]=d*R+f*B+p*$+m*Q,a[9]=d*U+f*I+p*q+m*se,a[13]=d*N+f*W+p*G+m*H,a[2]=y*P+b*O+x*L+v*Y,a[6]=y*R+b*B+x*$+v*Q,a[10]=y*U+b*I+x*q+v*se,a[14]=y*N+b*W+x*G+v*H,a[3]=M*P+w*O+E*L+T*Y,a[7]=M*R+w*B+E*$+T*Q,a[11]=M*U+w*I+E*q+T*se,a[15]=M*N+w*W+E*G+T*H,this}multiplyScalar(e){const n=this.elements;return n[0]*=e,n[4]*=e,n[8]*=e,n[12]*=e,n[1]*=e,n[5]*=e,n[9]*=e,n[13]*=e,n[2]*=e,n[6]*=e,n[10]*=e,n[14]*=e,n[3]*=e,n[7]*=e,n[11]*=e,n[15]*=e,this}determinant(){const e=this.elements,n=e[0],i=e[4],r=e[8],a=e[12],s=e[1],o=e[5],l=e[9],c=e[13],d=e[2],f=e[6],p=e[10],m=e[14],y=e[3],b=e[7],x=e[11],v=e[15];return y*(+a*l*f-r*c*f-a*o*p+i*c*p+r*o*m-i*l*m)+b*(+n*l*m-n*c*p+a*s*p-r*s*m+r*c*d-a*l*d)+x*(+n*c*f-n*o*m-a*s*f+i*s*m+a*o*d-i*c*d)+v*(-r*o*d-n*l*f+n*o*p+r*s*f-i*s*p+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],p=e[10],m=e[11],y=e[12],b=e[13],x=e[14],v=e[15],M=f*x*c-b*p*c+b*l*m-o*x*m-f*l*v+o*p*v,w=y*p*c-d*x*c-y*l*m+s*x*m+d*l*v-s*p*v,E=d*b*c-y*f*c+y*o*m-s*b*m-d*o*v+s*f*v,T=y*f*l-d*b*l-y*o*p+s*b*p+d*o*x-s*f*x,P=n*M+i*w+r*E+a*T;if(P===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const R=1/P;return e[0]=M*R,e[1]=(b*p*a-f*x*a-b*r*m+i*x*m+f*r*v-i*p*v)*R,e[2]=(o*x*a-b*l*a+b*r*c-i*x*c-o*r*v+i*l*v)*R,e[3]=(f*l*a-o*p*a-f*r*c+i*p*c+o*r*m-i*l*m)*R,e[4]=w*R,e[5]=(d*x*a-y*p*a+y*r*m-n*x*m-d*r*v+n*p*v)*R,e[6]=(y*l*a-s*x*a-y*r*c+n*x*c+s*r*v-n*l*v)*R,e[7]=(s*p*a-d*l*a+d*r*c-n*p*c-s*r*m+n*l*m)*R,e[8]=E*R,e[9]=(y*f*a-d*b*a-y*i*m+n*b*m+d*i*v-n*f*v)*R,e[10]=(s*b*a-y*o*a+y*i*c-n*b*c-s*i*v+n*o*v)*R,e[11]=(d*o*a-s*f*a-d*i*c+n*f*c+s*i*m-n*o*m)*R,e[12]=T*R,e[13]=(d*b*r-y*f*r+y*i*p-n*b*p-d*i*x+n*f*x)*R,e[14]=(y*o*r-s*b*r-y*i*l+n*b*l+s*i*x-n*o*x)*R,e[15]=(s*f*r-d*o*r+d*i*l-n*f*l-s*i*p+n*o*p)*R,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,p=a*c,m=a*d,y=a*f,b=s*d,x=s*f,v=o*f,M=l*c,w=l*d,E=l*f,T=i.x,P=i.y,R=i.z;return r[0]=(1-(b+v))*T,r[1]=(m+E)*T,r[2]=(y-w)*T,r[3]=0,r[4]=(m-E)*P,r[5]=(1-(p+v))*P,r[6]=(x+M)*P,r[7]=0,r[8]=(y+w)*R,r[9]=(x-M)*R,r[10]=(1-(p+b))*R,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=fh.set(r[0],r[1],r[2]).length();const s=fh.set(r[4],r[5],r[6]).length(),o=fh.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],Zs.copy(this);const c=1/a,d=1/s,f=1/o;return Zs.elements[0]*=c,Zs.elements[1]*=c,Zs.elements[2]*=c,Zs.elements[4]*=d,Zs.elements[5]*=d,Zs.elements[6]*=d,Zs.elements[8]*=f,Zs.elements[9]*=f,Zs.elements[10]*=f,n.setFromRotationMatrix(Zs),i.x=a,i.y=s,i.z=o,this}makePerspective(e,n,i,r,a,s,o=Oo,l=!1){const c=this.elements,d=2*a/(n-e),f=2*a/(i-r),p=(n+e)/(n-e),m=(i+r)/(i-r);let y,b;if(l)y=a/(s-a),b=s*a/(s-a);else if(o===Oo)y=-(s+a)/(s-a),b=-2*s*a/(s-a);else if(o===r_)y=-s/(s-a),b=-s*a/(s-a);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+o);return c[0]=d,c[4]=0,c[8]=p,c[12]=0,c[1]=0,c[5]=f,c[9]=m,c[13]=0,c[2]=0,c[6]=0,c[10]=y,c[14]=b,c[3]=0,c[7]=0,c[11]=-1,c[15]=0,this}makeOrthographic(e,n,i,r,a,s,o=Oo,l=!1){const c=this.elements,d=2/(n-e),f=2/(i-r),p=-(n+e)/(n-e),m=-(i+r)/(i-r);let y,b;if(l)y=1/(s-a),b=s/(s-a);else if(o===Oo)y=-2/(s-a),b=-(s+a)/(s-a);else if(o===r_)y=-1/(s-a),b=-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]=p,c[1]=0,c[5]=f,c[9]=0,c[13]=m,c[2]=0,c[6]=0,c[10]=y,c[14]=b,c[3]=0,c[7]=0,c[11]=0,c[15]=1,this}equals(e){const n=this.elements,i=e.elements;for(let r=0;r<16;r++)if(n[r]!==i[r])return!1;return!0}fromArray(e,n=0){for(let i=0;i<16;i++)this.elements[i]=e[i+n];return this}toArray(e=[],n=0){const i=this.elements;return e[n]=i[0],e[n+1]=i[1],e[n+2]=i[2],e[n+3]=i[3],e[n+4]=i[4],e[n+5]=i[5],e[n+6]=i[6],e[n+7]=i[7],e[n+8]=i[8],e[n+9]=i[9],e[n+10]=i[10],e[n+11]=i[11],e[n+12]=i[12],e[n+13]=i[13],e[n+14]=i[14],e[n+15]=i[15],e}};const fh=new Ge,Zs=new Gi,Cse=new Ge(0,0,0),Rse=new Ge(1,1,1),Vc=new Ge,ry=new Ge,qa=new Ge,P4=new Gi,D4=new sf;let Nu=class kG{constructor(e=0,n=0,i=0,r=kG.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],p=r[6],m=r[10];switch(n){case"XYZ":this._y=Math.asin(ln(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-d,m),this._z=Math.atan2(-s,a)):(this._x=Math.atan2(p,c),this._z=0);break;case"YXZ":this._x=Math.asin(-ln(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(o,m),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-f,a),this._z=0);break;case"ZXY":this._x=Math.asin(ln(p,-1,1)),Math.abs(p)<.9999999?(this._y=Math.atan2(-f,m),this._z=Math.atan2(-s,c)):(this._y=0,this._z=Math.atan2(l,a));break;case"ZYX":this._y=Math.asin(-ln(f,-1,1)),Math.abs(f)<.9999999?(this._x=Math.atan2(p,m),this._z=Math.atan2(l,a)):(this._x=0,this._z=Math.atan2(-s,c));break;case"YZX":this._z=Math.asin(ln(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,m));break;case"XZY":this._z=Math.asin(-ln(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(p,c),this._y=Math.atan2(o,a)):(this._x=Math.atan2(-d,m),this._y=0);break;default:Ht("Euler: .setFromRotationMatrix() encountered an unknown order: "+n)}return this._order=n,i===!0&&this._onChangeCallback(),this}setFromQuaternion(e,n,i){return P4.makeRotationFromQuaternion(e),this.setFromRotationMatrix(P4,n,i)}setFromVector3(e,n=this._order){return this.set(e.x,e.y,e.z,n)}reorder(e){return D4.setFromEuler(this),this.setFromQuaternion(D4,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}};Nu.DEFAULT_ORDER="XYZ";let IG=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}},Nse=0;const O4=new Ge,hh=new sf,gl=new Gi,ay=new Ge,lg=new Ge,Pse=new Ge,Dse=new sf,L4=new Ge(1,0,0),k4=new Ge(0,1,0),I4=new Ge(0,0,1),U4={type:"added"},Ose={type:"removed"},ph={type:"childadded",child:null},YE={type:"childremoved",child:null};let ss=class Ib extends Ef{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:Nse++}),this.uuid=iv(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=Ib.DEFAULT_UP.clone();const e=new Ge,n=new Nu,i=new sf,r=new Ge(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 Gi},normalMatrix:{value:new nn}}),this.matrix=new Gi,this.matrixWorld=new Gi,this.matrixAutoUpdate=Ib.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=Ib.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new IG,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 hh.setFromAxisAngle(e,n),this.quaternion.multiply(hh),this}rotateOnWorldAxis(e,n){return hh.setFromAxisAngle(e,n),this.quaternion.premultiply(hh),this}rotateX(e){return this.rotateOnAxis(L4,e)}rotateY(e){return this.rotateOnAxis(k4,e)}rotateZ(e){return this.rotateOnAxis(I4,e)}translateOnAxis(e,n){return O4.copy(e).applyQuaternion(this.quaternion),this.position.add(O4.multiplyScalar(n)),this}translateX(e){return this.translateOnAxis(L4,e)}translateY(e){return this.translateOnAxis(k4,e)}translateZ(e){return this.translateOnAxis(I4,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(gl.copy(this.matrixWorld).invert())}lookAt(e,n,i){e.isVector3?ay.copy(e):ay.set(e,n,i);const r=this.parent;this.updateWorldMatrix(!0,!1),lg.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?gl.lookAt(lg,ay,this.up):gl.lookAt(ay,lg,this.up),this.quaternion.setFromRotationMatrix(gl),r&&(gl.extractRotation(r.matrixWorld),hh.setFromRotationMatrix(gl),this.quaternion.premultiply(hh.invert()))}add(e){if(arguments.length>1){for(let n=0;n<arguments.length;n++)this.add(arguments[n]);return this}return e===this?(Ci("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(U4),ph.child=e,this.dispatchEvent(ph),ph.child=null):Ci("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(Ose),YE.child=e,this.dispatchEvent(YE),YE.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),gl.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),gl.multiply(e.parent.matrixWorld)),e.applyMatrix4(gl),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(U4),ph.child=e,this.dispatchEvent(ph),ph.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(lg,e,Pse),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(lg,Dse,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),p=s(e.skeletons),m=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),p.length>0&&(i.skeletons=p),m.length>0&&(i.animations=m),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}};ss.DEFAULT_UP=new Ge(0,1,0);ss.DEFAULT_MATRIX_AUTO_UPDATE=!0;ss.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;const Js=new Ge,vl=new Ge,KE=new Ge,xl=new Ge,mh=new Ge,gh=new Ge,F4=new Ge,ZE=new Ge,JE=new Ge,QE=new Ge,eA=new Bi,tA=new Bi,nA=new Bi;let cg=class $h{constructor(e=new Ge,n=new Ge,i=new Ge){this.a=e,this.b=n,this.c=i}static getNormal(e,n,i,r){r.subVectors(i,n),Js.subVectors(e,n),r.cross(Js);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){Js.subVectors(r,n),vl.subVectors(i,n),KE.subVectors(e,n);const s=Js.dot(Js),o=Js.dot(vl),l=Js.dot(KE),c=vl.dot(vl),d=vl.dot(KE),f=s*c-o*o;if(f===0)return a.set(0,0,0),null;const p=1/f,m=(c*l-o*d)*p,y=(s*d-o*l)*p;return a.set(1-m-y,y,m)}static containsPoint(e,n,i,r){return this.getBarycoord(e,n,i,r,xl)===null?!1:xl.x>=0&&xl.y>=0&&xl.x+xl.y<=1}static getInterpolation(e,n,i,r,a,s,o,l){return this.getBarycoord(e,n,i,r,xl)===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,xl.x),l.addScaledVector(s,xl.y),l.addScaledVector(o,xl.z),l)}static getInterpolatedAttribute(e,n,i,r,a,s){return eA.setScalar(0),tA.setScalar(0),nA.setScalar(0),eA.fromBufferAttribute(e,n),tA.fromBufferAttribute(e,i),nA.fromBufferAttribute(e,r),s.setScalar(0),s.addScaledVector(eA,a.x),s.addScaledVector(tA,a.y),s.addScaledVector(nA,a.z),s}static isFrontFacing(e,n,i,r){return Js.subVectors(i,n),vl.subVectors(e,n),Js.cross(vl).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 Js.subVectors(this.c,this.b),vl.subVectors(this.a,this.b),Js.cross(vl).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return $h.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,n){return $h.getBarycoord(e,this.a,this.b,this.c,n)}getInterpolation(e,n,i,r,a){return $h.getInterpolation(e,this.a,this.b,this.c,n,i,r,a)}containsPoint(e){return $h.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return $h.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;mh.subVectors(r,i),gh.subVectors(a,i),ZE.subVectors(e,i);const l=mh.dot(ZE),c=gh.dot(ZE);if(l<=0&&c<=0)return n.copy(i);JE.subVectors(e,r);const d=mh.dot(JE),f=gh.dot(JE);if(d>=0&&f<=d)return n.copy(r);const p=l*f-d*c;if(p<=0&&l>=0&&d<=0)return s=l/(l-d),n.copy(i).addScaledVector(mh,s);QE.subVectors(e,a);const m=mh.dot(QE),y=gh.dot(QE);if(y>=0&&m<=y)return n.copy(a);const b=m*c-l*y;if(b<=0&&c>=0&&y<=0)return o=c/(c-y),n.copy(i).addScaledVector(gh,o);const x=d*y-m*f;if(x<=0&&f-d>=0&&m-y>=0)return F4.subVectors(a,r),o=(f-d)/(f-d+(m-y)),n.copy(r).addScaledVector(F4,o);const v=1/(x+b+p);return s=b*v,o=p*v,n.copy(i).addScaledVector(mh,s).addScaledVector(gh,o)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}};const UG={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},Gc={h:0,s:0,l:0},sy={h:0,s:0,l:0};function iA(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 fn=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=As){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,xn.colorSpaceToWorking(this,n),this}setRGB(e,n,i,r=xn.workingColorSpace){return this.r=e,this.g=n,this.b=i,xn.colorSpaceToWorking(this,r),this}setHSL(e,n,i,r=xn.workingColorSpace){if(e=yse(e,1),n=ln(n,0,1),i=ln(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=iA(s,a,e+1/3),this.g=iA(s,a,e),this.b=iA(s,a,e-1/3)}return xn.colorSpaceToWorking(this,r),this}setStyle(e,n=As){function i(a){a!==void 0&&parseFloat(a)<1&&Ht("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:Ht("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);Ht("Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,n);return this}setColorName(e,n=As){const i=UG[e.toLowerCase()];return i!==void 0?this.setHex(i,n):Ht("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=$l(e.r),this.g=$l(e.g),this.b=$l(e.b),this}copyLinearToSRGB(e){return this.r=sp(e.r),this.g=sp(e.g),this.b=sp(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=As){return xn.workingToColorSpace(Wr.copy(this),e),Math.round(ln(Wr.r*255,0,255))*65536+Math.round(ln(Wr.g*255,0,255))*256+Math.round(ln(Wr.b*255,0,255))}getHexString(e=As){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,n=xn.workingColorSpace){xn.workingToColorSpace(Wr.copy(this),n);const i=Wr.r,r=Wr.g,a=Wr.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=xn.workingColorSpace){return xn.workingToColorSpace(Wr.copy(this),n),e.r=Wr.r,e.g=Wr.g,e.b=Wr.b,e}getStyle(e=As){xn.workingToColorSpace(Wr.copy(this),e);const n=Wr.r,i=Wr.g,r=Wr.b;return e!==As?`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(Gc),this.setHSL(Gc.h+e,Gc.s+n,Gc.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(Gc),e.getHSL(sy);const i=zE(Gc.h,sy.h,n),r=zE(Gc.s,sy.s,n),a=zE(Gc.l,sy.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 Wr=new fn;fn.NAMES=UG;let Lse=0,Yp=class extends Ef{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:Lse++}),this.uuid=iv(),this.name="",this.type="Material",this.blending=ap,this.side=Ru,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=P2,this.blendDst=D2,this.blendEquation=Ed,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new fn(0,0,0),this.blendAlpha=0,this.depthFunc=vp,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=w4,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=oh,this.stencilZFail=oh,this.stencilZPass=oh,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){Ht(`Material: parameter '${n}' has value of undefined.`);continue}const r=this[n];if(r===void 0){Ht(`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!==ap&&(i.blending=this.blending),this.side!==Ru&&(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!==P2&&(i.blendSrc=this.blendSrc),this.blendDst!==D2&&(i.blendDst=this.blendDst),this.blendEquation!==Ed&&(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!==vp&&(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!==w4&&(i.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(i.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(i.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==oh&&(i.stencilFail=this.stencilFail),this.stencilZFail!==oh&&(i.stencilZFail=this.stencilZFail),this.stencilZPass!==oh&&(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++}},GN=class extends Yp{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new fn(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 Nu,this.combine=LN,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 Ui=new Ge,oy=new Qt;let kse=0,Is=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:kse++}),this.name="",this.array=e,this.itemSize=n,this.count=e!==void 0?e.length/n:0,this.normalized=i,this.usage=M4,this.updateRanges=[],this.gpuType=Fl,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++)oy.fromBufferAttribute(this,n),oy.applyMatrix3(e),this.setXY(n,oy.x,oy.y);else if(this.itemSize===3)for(let n=0,i=this.count;n<i;n++)Ui.fromBufferAttribute(this,n),Ui.applyMatrix3(e),this.setXYZ(n,Ui.x,Ui.y,Ui.z);return this}applyMatrix4(e){for(let n=0,i=this.count;n<i;n++)Ui.fromBufferAttribute(this,n),Ui.applyMatrix4(e),this.setXYZ(n,Ui.x,Ui.y,Ui.z);return this}applyNormalMatrix(e){for(let n=0,i=this.count;n<i;n++)Ui.fromBufferAttribute(this,n),Ui.applyNormalMatrix(e),this.setXYZ(n,Ui.x,Ui.y,Ui.z);return this}transformDirection(e){for(let n=0,i=this.count;n<i;n++)Ui.fromBufferAttribute(this,n),Ui.transformDirection(e),this.setXYZ(n,Ui.x,Ui.y,Ui.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=ag(i,this.array)),i}setComponent(e,n,i){return this.normalized&&(i=Ea(i,this.array)),this.array[e*this.itemSize+n]=i,this}getX(e){let n=this.array[e*this.itemSize];return this.normalized&&(n=ag(n,this.array)),n}setX(e,n){return this.normalized&&(n=Ea(n,this.array)),this.array[e*this.itemSize]=n,this}getY(e){let n=this.array[e*this.itemSize+1];return this.normalized&&(n=ag(n,this.array)),n}setY(e,n){return this.normalized&&(n=Ea(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=ag(n,this.array)),n}setZ(e,n){return this.normalized&&(n=Ea(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=ag(n,this.array)),n}setW(e,n){return this.normalized&&(n=Ea(n,this.array)),this.array[e*this.itemSize+3]=n,this}setXY(e,n,i){return e*=this.itemSize,this.normalized&&(n=Ea(n,this.array),i=Ea(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=Ea(n,this.array),i=Ea(i,this.array),r=Ea(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=Ea(n,this.array),i=Ea(i,this.array),r=Ea(r,this.array),a=Ea(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!==M4&&(e.usage=this.usage),e}},FG=class extends Is{constructor(e,n,i){super(new Uint16Array(e),n,i)}},zG=class extends Is{constructor(e,n,i){super(new Uint32Array(e),n,i)}},fo=class extends Is{constructor(e,n,i){super(new Float32Array(e),n,i)}},Ise=0;const vs=new Gi,rA=new ss,vh=new Ge,Xa=new lf,ug=new lf,mr=new Ge;let Yo=class BG extends Ef{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:Ise++}),this.uuid=iv(),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(RG(e)?zG:FG)(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 nn().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 vs.makeRotationFromQuaternion(e),this.applyMatrix4(vs),this}rotateX(e){return vs.makeRotationX(e),this.applyMatrix4(vs),this}rotateY(e){return vs.makeRotationY(e),this.applyMatrix4(vs),this}rotateZ(e){return vs.makeRotationZ(e),this.applyMatrix4(vs),this}translate(e,n,i){return vs.makeTranslation(e,n,i),this.applyMatrix4(vs),this}scale(e,n,i){return vs.makeScale(e,n,i),this.applyMatrix4(vs),this}lookAt(e){return rA.lookAt(e),rA.updateMatrix(),this.applyMatrix4(rA.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(vh).negate(),this.translate(vh.x,vh.y,vh.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 fo(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&&Ht("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 lf);const e=this.attributes.position,n=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){Ci("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new Ge(-1/0,-1/0,-1/0),new Ge(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];Xa.setFromBufferAttribute(a),this.morphTargetsRelative?(mr.addVectors(this.boundingBox.min,Xa.min),this.boundingBox.expandByPoint(mr),mr.addVectors(this.boundingBox.max,Xa.max),this.boundingBox.expandByPoint(mr)):(this.boundingBox.expandByPoint(Xa.min),this.boundingBox.expandByPoint(Xa.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&Ci('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 lS);const e=this.attributes.position,n=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){Ci("BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new Ge,1/0);return}if(e){const i=this.boundingSphere.center;if(Xa.setFromBufferAttribute(e),n)for(let a=0,s=n.length;a<s;a++){const o=n[a];ug.setFromBufferAttribute(o),this.morphTargetsRelative?(mr.addVectors(Xa.min,ug.min),Xa.expandByPoint(mr),mr.addVectors(Xa.max,ug.max),Xa.expandByPoint(mr)):(Xa.expandByPoint(ug.min),Xa.expandByPoint(ug.max))}Xa.getCenter(i);let r=0;for(let a=0,s=e.count;a<s;a++)mr.fromBufferAttribute(e,a),r=Math.max(r,i.distanceToSquared(mr));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++)mr.fromBufferAttribute(o,c),l&&(vh.fromBufferAttribute(e,c),mr.add(vh)),r=Math.max(r,i.distanceToSquared(mr))}this.boundingSphere.radius=Math.sqrt(r),isNaN(this.boundingSphere.radius)&&Ci('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){Ci("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 Is(new Float32Array(4*i.count),4));const s=this.getAttribute("tangent"),o=[],l=[];for(let U=0;U<i.count;U++)o[U]=new Ge,l[U]=new Ge;const c=new Ge,d=new Ge,f=new Ge,p=new Qt,m=new Qt,y=new Qt,b=new Ge,x=new Ge;function v(U,N,O){c.fromBufferAttribute(i,U),d.fromBufferAttribute(i,N),f.fromBufferAttribute(i,O),p.fromBufferAttribute(a,U),m.fromBufferAttribute(a,N),y.fromBufferAttribute(a,O),d.sub(c),f.sub(c),m.sub(p),y.sub(p);const B=1/(m.x*y.y-y.x*m.y);isFinite(B)&&(b.copy(d).multiplyScalar(y.y).addScaledVector(f,-m.y).multiplyScalar(B),x.copy(f).multiplyScalar(m.x).addScaledVector(d,-y.x).multiplyScalar(B),o[U].add(b),o[N].add(b),o[O].add(b),l[U].add(x),l[N].add(x),l[O].add(x))}let M=this.groups;M.length===0&&(M=[{start:0,count:e.count}]);for(let U=0,N=M.length;U<N;++U){const O=M[U],B=O.start,I=O.count;for(let W=B,L=B+I;W<L;W+=3)v(e.getX(W+0),e.getX(W+1),e.getX(W+2))}const w=new Ge,E=new Ge,T=new Ge,P=new Ge;function R(U){T.fromBufferAttribute(r,U),P.copy(T);const N=o[U];w.copy(N),w.sub(T.multiplyScalar(T.dot(N))).normalize(),E.crossVectors(P,N);const B=E.dot(l[U])<0?-1:1;s.setXYZW(U,w.x,w.y,w.z,B)}for(let U=0,N=M.length;U<N;++U){const O=M[U],B=O.start,I=O.count;for(let W=B,L=B+I;W<L;W+=3)R(e.getX(W+0)),R(e.getX(W+1)),R(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 Is(new Float32Array(n.count*3),3),this.setAttribute("normal",i);else for(let p=0,m=i.count;p<m;p++)i.setXYZ(p,0,0,0);const r=new Ge,a=new Ge,s=new Ge,o=new Ge,l=new Ge,c=new Ge,d=new Ge,f=new Ge;if(e)for(let p=0,m=e.count;p<m;p+=3){const y=e.getX(p+0),b=e.getX(p+1),x=e.getX(p+2);r.fromBufferAttribute(n,y),a.fromBufferAttribute(n,b),s.fromBufferAttribute(n,x),d.subVectors(s,a),f.subVectors(r,a),d.cross(f),o.fromBufferAttribute(i,y),l.fromBufferAttribute(i,b),c.fromBufferAttribute(i,x),o.add(d),l.add(d),c.add(d),i.setXYZ(y,o.x,o.y,o.z),i.setXYZ(b,l.x,l.y,l.z),i.setXYZ(x,c.x,c.y,c.z)}else for(let p=0,m=n.count;p<m;p+=3)r.fromBufferAttribute(n,p+0),a.fromBufferAttribute(n,p+1),s.fromBufferAttribute(n,p+2),d.subVectors(s,a),f.subVectors(r,a),d.cross(f),i.setXYZ(p+0,d.x,d.y,d.z),i.setXYZ(p+1,d.x,d.y,d.z),i.setXYZ(p+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++)mr.fromBufferAttribute(e,n),mr.normalize(),e.setXYZ(n,mr.x,mr.y,mr.z)}toNonIndexed(){function e(o,l){const c=o.array,d=o.itemSize,f=o.normalized,p=new c.constructor(l.length*d);let m=0,y=0;for(let b=0,x=l.length;b<x;b++){o.isInterleavedBufferAttribute?m=l[b]*o.data.stride+o.offset:m=l[b]*d;for(let v=0;v<d;v++)p[y++]=c[m++]}return new Is(p,d,f)}if(this.index===null)return Ht("BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const n=new BG,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 p=c[d],m=e(p,i);l.push(m)}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,p=c.length;f<p;f++){const m=c[f];d.push(m.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 p=0,m=f.length;p<m;p++)d.push(f[p].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 z4=new Gi,ud=new VN,ly=new lS,B4=new Ge,cy=new Ge,uy=new Ge,dy=new Ge,aA=new Ge,fy=new Ge,j4=new Ge,hy=new Ge;let Bo=class extends ss{constructor(e=new Yo,n=new GN){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){fy.set(0,0,0);for(let l=0,c=a.length;l<c;l++){const d=o[l],f=a[l];d!==0&&(aA.fromBufferAttribute(f,e),s?fy.addScaledVector(aA,d):fy.addScaledVector(aA.sub(n),d))}n.add(fy)}return n}raycast(e,n){const i=this.geometry,r=this.material,a=this.matrixWorld;r!==void 0&&(i.boundingSphere===null&&i.computeBoundingSphere(),ly.copy(i.boundingSphere),ly.applyMatrix4(a),ud.copy(e.ray).recast(e.near),!(ly.containsPoint(ud.origin)===!1&&(ud.intersectSphere(ly,B4)===null||ud.origin.distanceToSquared(B4)>(e.far-e.near)**2))&&(z4.copy(a).invert(),ud.copy(e.ray).applyMatrix4(z4),!(i.boundingBox!==null&&ud.intersectsBox(i.boundingBox)===!1)&&this._computeIntersections(e,n,ud)))}_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,p=a.groups,m=a.drawRange;if(o!==null)if(Array.isArray(s))for(let y=0,b=p.length;y<b;y++){const x=p[y],v=s[x.materialIndex],M=Math.max(x.start,m.start),w=Math.min(o.count,Math.min(x.start+x.count,m.start+m.count));for(let E=M,T=w;E<T;E+=3){const P=o.getX(E),R=o.getX(E+1),U=o.getX(E+2);r=py(this,v,e,i,c,d,f,P,R,U),r&&(r.faceIndex=Math.floor(E/3),r.face.materialIndex=x.materialIndex,n.push(r))}}else{const y=Math.max(0,m.start),b=Math.min(o.count,m.start+m.count);for(let x=y,v=b;x<v;x+=3){const M=o.getX(x),w=o.getX(x+1),E=o.getX(x+2);r=py(this,s,e,i,c,d,f,M,w,E),r&&(r.faceIndex=Math.floor(x/3),n.push(r))}}else if(l!==void 0)if(Array.isArray(s))for(let y=0,b=p.length;y<b;y++){const x=p[y],v=s[x.materialIndex],M=Math.max(x.start,m.start),w=Math.min(l.count,Math.min(x.start+x.count,m.start+m.count));for(let E=M,T=w;E<T;E+=3){const P=E,R=E+1,U=E+2;r=py(this,v,e,i,c,d,f,P,R,U),r&&(r.faceIndex=Math.floor(E/3),r.face.materialIndex=x.materialIndex,n.push(r))}}else{const y=Math.max(0,m.start),b=Math.min(l.count,m.start+m.count);for(let x=y,v=b;x<v;x+=3){const M=x,w=x+1,E=x+2;r=py(this,s,e,i,c,d,f,M,w,E),r&&(r.faceIndex=Math.floor(x/3),n.push(r))}}}};function Use(t,e,n,i,r,a,s,o){let l;if(e.side===Pa?l=i.intersectTriangle(s,a,r,!0,o):l=i.intersectTriangle(r,a,s,e.side===Ru,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 py(t,e,n,i,r,a,s,o,l,c){t.getVertexPosition(o,cy),t.getVertexPosition(l,uy),t.getVertexPosition(c,dy);const d=Use(t,e,n,i,cy,uy,dy,j4);if(d){const f=new Ge;cg.getBarycoord(j4,cy,uy,dy,f),r&&(d.uv=cg.getInterpolatedAttribute(r,o,l,c,f,new Qt)),a&&(d.uv1=cg.getInterpolatedAttribute(a,o,l,c,f,new Qt)),s&&(d.normal=cg.getInterpolatedAttribute(s,o,l,c,f,new Ge),d.normal.dot(i.direction)>0&&d.normal.multiplyScalar(-1));const p={a:o,b:l,c,normal:new Ge,materialIndex:0};cg.getNormal(cy,uy,dy,p.normal),d.face=p,d.barycoord=f}return d}let $N=class jG extends Yo{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 p=0,m=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 fo(c,3)),this.setAttribute("normal",new fo(d,3)),this.setAttribute("uv",new fo(f,2));function y(b,x,v,M,w,E,T,P,R,U,N){const O=E/R,B=T/U,I=E/2,W=T/2,L=P/2,$=R+1,q=U+1;let G=0,Y=0;const Q=new Ge;for(let se=0;se<q;se++){const H=se*B-W;for(let X=0;X<$;X++){const re=X*O-I;Q[b]=re*M,Q[x]=H*w,Q[v]=L,c.push(Q.x,Q.y,Q.z),Q[b]=0,Q[x]=0,Q[v]=P>0?1:-1,d.push(Q.x,Q.y,Q.z),f.push(X/R),f.push(1-se/U),G+=1}}for(let se=0;se<U;se++)for(let H=0;H<R;H++){const X=p+H+$*se,re=p+H+$*(se+1),ce=p+(H+1)+$*(se+1),ye=p+(H+1)+$*se;l.push(X,re,ye),l.push(re,ce,ye),Y+=6}o.addGroup(m,Y,N),m+=Y,p+=G}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new jG(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}};function _p(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?(Ht("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 oa(t){const e={};for(let n=0;n<t.length;n++){const i=_p(t[n]);for(const r in i)e[r]=i[r]}return e}function Fse(t){const e=[];for(let n=0;n<t.length;n++)e.push(t[n].clone());return e}function HG(t){const e=t.getRenderTarget();return e===null?t.outputColorSpace:e.isXRRenderTarget===!0?e.texture.colorSpace:xn.workingColorSpace}const zse={clone:_p,merge:oa};var Bse=`void main() {
  11. gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
  12. }`,jse=`void main() {
  13. gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
  14. }`;let Ql=class extends Yp{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=Bse,this.fragmentShader=jse,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=_p(e.uniforms),this.uniformsGroups=Fse(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}},VG=class extends ss{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new Gi,this.projectionMatrix=new Gi,this.projectionMatrixInverse=new Gi,this.coordinateSystem=Oo,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 $c=new Ge,H4=new Qt,V4=new Qt;let Rs=class extends VG{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=xR*2*Math.atan(n),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(Lb*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return xR*2*Math.atan(Math.tan(Lb*.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){$c.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),n.set($c.x,$c.y).multiplyScalar(-e/$c.z),$c.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),i.set($c.x,$c.y).multiplyScalar(-e/$c.z)}getViewSize(e,n){return this.getViewBounds(e,H4,V4),n.subVectors(V4,H4)}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(Lb*.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 xh=-90,yh=1;let Hse=class extends ss{constructor(e,n,i){super(),this.type="CubeCamera",this.renderTarget=i,this.coordinateSystem=null,this.activeMipmapLevel=0;const r=new Rs(xh,yh,e,n);r.layers=this.layers,this.add(r);const a=new Rs(xh,yh,e,n);a.layers=this.layers,this.add(a);const s=new Rs(xh,yh,e,n);s.layers=this.layers,this.add(s);const o=new Rs(xh,yh,e,n);o.layers=this.layers,this.add(o);const l=new Rs(xh,yh,e,n);l.layers=this.layers,this.add(l);const c=new Rs(xh,yh,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===Oo)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===r_)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(),p=e.getActiveCubeFace(),m=e.getActiveMipmapLevel(),y=e.xr.enabled;e.xr.enabled=!1;const b=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=b,e.setRenderTarget(i,5,r),e.render(n,d),e.setRenderTarget(f,p,m),e.xr.enabled=y,i.texture.needsPMREMUpdate=!0}},GG=class extends vo{constructor(e=[],n=xp,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}},Vse=class extends of{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 GG(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 $N(5,5,5),a=new Ql({name:"CubemapFromEquirect",uniforms:_p(i.uniforms),vertexShader:i.vertexShader,fragmentShader:i.fragmentShader,side:Pa,blending:Gl});a.uniforms.tEquirect.value=n;const s=new Bo(r,a),o=n.minFilter;return n.minFilter===Dd&&(n.minFilter=Ls),new Hse(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)}},Pg=class extends ss{constructor(){super(),this.isGroup=!0,this.type="Group"}};const Gse={type:"move"};let sA=class{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Pg,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 Pg,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new Ge,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new Ge),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new Pg,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new Ge,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new Ge),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 b of e.hand.values()){const x=n.getJointPose(b,i),v=this._getHandJoint(c,b);x!==null&&(v.matrix.fromArray(x.transform.matrix),v.matrix.decompose(v.position,v.rotation,v.scale),v.matrixWorldNeedsUpdate=!0,v.jointRadius=x.radius),v.visible=x!==null}const d=c.joints["index-finger-tip"],f=c.joints["thumb-tip"],p=d.position.distanceTo(f.position),m=.02,y=.005;c.inputState.pinching&&p>m+y?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&p<=m-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(Gse)))}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 Pg;i.matrixAutoUpdate=!1,i.visible=!1,e.joints[n.jointName]=i,e.add(i)}return e.joints[n.jointName]}},$se=class extends ss{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 Nu,this.environmentIntensity=1,this.environmentRotation=new Nu,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}},Wse=class extends vo{constructor(e=null,n=1,i=1,r,a,s,o,l,c=ns,d=ns,f,p){super(null,s,o,l,c,d,r,a,f,p),this.isDataTexture=!0,this.image={data:e,width:n,height:i},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}};const oA=new Ge,qse=new Ge,Xse=new nn;let tu=class{constructor(e=new Ge(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=oA.subVectors(i,n).cross(qse.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(oA),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||Xse.getNormalMatrix(e),r=this.coplanarPoint(oA).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 dd=new lS,Yse=new Qt(.5,.5),my=new Ge;let WN=class{constructor(e=new tu,n=new tu,i=new tu,r=new tu,a=new tu,s=new tu){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=Oo,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],p=a[6],m=a[7],y=a[8],b=a[9],x=a[10],v=a[11],M=a[12],w=a[13],E=a[14],T=a[15];if(r[0].setComponents(c-s,m-d,v-y,T-M).normalize(),r[1].setComponents(c+s,m+d,v+y,T+M).normalize(),r[2].setComponents(c+o,m+f,v+b,T+w).normalize(),r[3].setComponents(c-o,m-f,v-b,T-w).normalize(),i)r[4].setComponents(l,p,x,E).normalize(),r[5].setComponents(c-l,m-p,v-x,T-E).normalize();else if(r[4].setComponents(c-l,m-p,v-x,T-E).normalize(),n===Oo)r[5].setComponents(c+l,m+p,v+x,T+E).normalize();else if(n===r_)r[5].setComponents(l,p,x,E).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(),dd.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const n=e.geometry;n.boundingSphere===null&&n.computeBoundingSphere(),dd.copy(n.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(dd)}intersectsSprite(e){dd.center.set(0,0,0);const n=Yse.distanceTo(e.center);return dd.radius=.7071067811865476+n,dd.applyMatrix4(e.matrixWorld),this.intersectsSphere(dd)}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(my.x=r.normal.x>0?e.max.x:e.min.x,my.y=r.normal.y>0?e.max.y:e.min.y,my.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(my)<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)}},$G=class extends Yp{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new fn(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 s_=new Ge,o_=new Ge,G4=new Gi,dg=new VN,gy=new lS,lA=new Ge,$4=new Ge;let Kse=class extends ss{constructor(e=new Yo,n=new $G){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++)s_.fromBufferAttribute(n,r-1),o_.fromBufferAttribute(n,r),i[r]=i[r-1],i[r]+=s_.distanceTo(o_);e.setAttribute("lineDistance",new fo(i,1))}else Ht("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;G4.copy(r).invert(),dg.copy(e.ray).applyMatrix4(G4);const o=a/((this.scale.x+this.scale.y+this.scale.z)/3),l=o*o,c=this.isLineSegments?2:1,d=i.index,p=i.attributes.position;if(d!==null){const m=Math.max(0,s.start),y=Math.min(d.count,s.start+s.count);for(let b=m,x=y-1;b<x;b+=c){const v=d.getX(b),M=d.getX(b+1),w=vy(this,e,dg,l,v,M,b);w&&n.push(w)}if(this.isLineLoop){const b=d.getX(y-1),x=d.getX(m),v=vy(this,e,dg,l,b,x,y-1);v&&n.push(v)}}else{const m=Math.max(0,s.start),y=Math.min(p.count,s.start+s.count);for(let b=m,x=y-1;b<x;b+=c){const v=vy(this,e,dg,l,b,b+1,b);v&&n.push(v)}if(this.isLineLoop){const b=vy(this,e,dg,l,y-1,m,y-1);b&&n.push(b)}}}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 vy(t,e,n,i,r,a,s){const o=t.geometry.attributes.position;if(s_.fromBufferAttribute(o,r),o_.fromBufferAttribute(o,a),n.distanceSqToSegment(s_,o_,lA,$4)>i)return;lA.applyMatrix4(t.matrixWorld);const c=e.ray.origin.distanceTo(lA);if(!(c<e.near||c>e.far))return{distance:c,point:$4.clone().applyMatrix4(t.matrixWorld),index:s,face:null,faceIndex:null,barycoord:null,object:t}}const W4=new Ge,q4=new Ge;let Zse=class extends Kse{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)W4.fromBufferAttribute(n,r),q4.fromBufferAttribute(n,r+1),i[r]=r===0?0:i[r-1],i[r+1]=i[r]+W4.distanceTo(q4);e.setAttribute("lineDistance",new fo(i,1))}else Ht("LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}},WG=class extends vo{constructor(e,n,i=af,r,a,s,o=ns,l=ns,c,d=g0,f=1){if(d!==g0&&d!==v0)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");const p={width:e,height:n,depth:f};super(p,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 HN(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 qG extends vo{constructor(e=null){super(),this.sourceTexture=e,this.isExternalTexture=!0}copy(e){return super.copy(e),this.sourceTexture=e.sourceTexture,this}}let qN=class XG extends Yo{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,p=n/l,m=[],y=[],b=[],x=[];for(let v=0;v<d;v++){const M=v*p-s;for(let w=0;w<c;w++){const E=w*f-a;y.push(E,-M,0),b.push(0,0,1),x.push(w/o),x.push(1-v/l)}}for(let v=0;v<l;v++)for(let M=0;M<o;M++){const w=M+c*v,E=M+c*(v+1),T=M+1+c*(v+1),P=M+1+c*v;m.push(w,E,P),m.push(E,T,P)}this.setIndex(m),this.setAttribute("position",new fo(y,3)),this.setAttribute("normal",new fo(b,3)),this.setAttribute("uv",new fo(x,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new XG(e.width,e.height,e.widthSegments,e.heightSegments)}};class Jse extends Yp{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new fn(16777215),this.specular=new fn(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new fn(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=TG,this.normalScale=new Qt(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Nu,this.combine=LN,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 Qse=class extends Yp{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=ose,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}},eoe=class extends Yp{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}},YG=class extends ss{constructor(e,n=1){super(),this.isLight=!0,this.type="Light",this.color=new fn(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 cA=new Gi,X4=new Ge,Y4=new Ge;let toe=class{constructor(e){this.camera=e,this.intensity=1,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new Qt(512,512),this.mapType=zo,this.map=null,this.mapPass=null,this.matrix=new Gi,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new WN,this._frameExtents=new Qt(1,1),this._viewportCount=1,this._viewports=[new Bi(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const n=this.camera,i=this.matrix;X4.setFromMatrixPosition(e.matrixWorld),n.position.copy(X4),Y4.setFromMatrixPosition(e.target.matrixWorld),n.lookAt(Y4),n.updateMatrixWorld(),cA.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(cA,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(cA)}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}},KG=class extends VG{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 noe extends toe{constructor(){super(new KG(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class K4 extends YG{constructor(e,n){super(e,n),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(ss.DEFAULT_UP),this.updateMatrix(),this.target=new ss,this.shadow=new noe}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}let ioe=class extends YG{constructor(e,n){super(e,n),this.isAmbientLight=!0,this.type="AmbientLight"}},roe=class extends Rs{constructor(e=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=e}},Z4=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=ln(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(ln(n/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}};class aoe extends Zse{constructor(e=10,n=10,i=4473924,r=8947848){i=new fn(i),r=new fn(r);const a=n/2,s=e/n,o=e/2,l=[],c=[];for(let p=0,m=0,y=-o;p<=n;p++,y+=s){l.push(-o,0,y,o,0,y),l.push(y,0,-o,y,0,o);const b=p===a?i:r;b.toArray(c,m),m+=3,b.toArray(c,m),m+=3,b.toArray(c,m),m+=3,b.toArray(c,m),m+=3}const d=new Yo;d.setAttribute("position",new fo(l,3)),d.setAttribute("color",new fo(c,3));const f=new $G({vertexColors:!0,toneMapped:!1});super(d,f),this.type="GridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}class soe extends Ef{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){Ht("Controls: connect() now requires an element.");return}this.domElement!==null&&this.disconnect(),this.domElement=e}disconnect(){}dispose(){}update(){}}function J4(t,e,n,i){const r=ooe(i);switch(n){case MG:return t*e;case AG:return t*e/r.components*r.byteLength;case FN:return t*e/r.components*r.byteLength;case zN:return t*e*2/r.components*r.byteLength;case BN:return t*e*2/r.components*r.byteLength;case EG:return t*e*3/r.components*r.byteLength;case lo:return t*e*4/r.components*r.byteLength;case jN:return t*e*4/r.components*r.byteLength;case Nb:case Pb:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*8;case Db:case Ob:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*16;case $2:case q2:return Math.max(t,16)*Math.max(e,8)/4;case G2:case W2:return Math.max(t,8)*Math.max(e,8)/2;case X2:case Y2:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*8;case K2:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*16;case Z2:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*16;case J2:return Math.floor((t+4)/5)*Math.floor((e+3)/4)*16;case Q2:return Math.floor((t+4)/5)*Math.floor((e+4)/5)*16;case eR:return Math.floor((t+5)/6)*Math.floor((e+4)/5)*16;case tR:return Math.floor((t+5)/6)*Math.floor((e+5)/6)*16;case nR:return Math.floor((t+7)/8)*Math.floor((e+4)/5)*16;case iR:return Math.floor((t+7)/8)*Math.floor((e+5)/6)*16;case rR:return Math.floor((t+7)/8)*Math.floor((e+7)/8)*16;case aR:return Math.floor((t+9)/10)*Math.floor((e+4)/5)*16;case sR:return Math.floor((t+9)/10)*Math.floor((e+5)/6)*16;case oR:return Math.floor((t+9)/10)*Math.floor((e+7)/8)*16;case lR:return Math.floor((t+9)/10)*Math.floor((e+9)/10)*16;case cR:return Math.floor((t+11)/12)*Math.floor((e+9)/10)*16;case uR:return Math.floor((t+11)/12)*Math.floor((e+11)/12)*16;case dR:case fR:case hR:return Math.ceil(t/4)*Math.ceil(e/4)*16;case pR:case mR:return Math.ceil(t/4)*Math.ceil(e/4)*8;case gR:case vR:return Math.ceil(t/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${n} format.`)}function ooe(t){switch(t){case zo:case bG:return{byteLength:1,components:1};case p0:case _G:case Xp:return{byteLength:2,components:1};case IN:case UN:return{byteLength:2,components:4};case af:case kN:case Fl:return{byteLength:4,components:1};case SG:case wG:return{byteLength:4,components:3}}throw new Error(`Unknown texture type ${t}.`)}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:ON}}));typeof window<"u"&&(window.__THREE__?Ht("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=ON);function ZG(){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 loe(t){const e=new WeakMap;function n(o,l){const c=o.array,d=o.usage,f=c.byteLength,p=t.createBuffer();t.bindBuffer(l,p),t.bufferData(l,c,d),o.onUploadCallback();let m;if(c instanceof Float32Array)m=t.FLOAT;else if(typeof Float16Array<"u"&&c instanceof Float16Array)m=t.HALF_FLOAT;else if(c instanceof Uint16Array)o.isFloat16BufferAttribute?m=t.HALF_FLOAT:m=t.UNSIGNED_SHORT;else if(c instanceof Int16Array)m=t.SHORT;else if(c instanceof Uint32Array)m=t.UNSIGNED_INT;else if(c instanceof Int32Array)m=t.INT;else if(c instanceof Int8Array)m=t.BYTE;else if(c instanceof Uint8Array)m=t.UNSIGNED_BYTE;else if(c instanceof Uint8ClampedArray)m=t.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+c);return{buffer:p,type:m,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((m,y)=>m.start-y.start);let p=0;for(let m=1;m<f.length;m++){const y=f[p],b=f[m];b.start<=y.start+y.count+1?y.count=Math.max(y.count,b.start+b.count-y.start):(++p,f[p]=b)}f.length=p+1;for(let m=0,y=f.length;m<y;m++){const b=f[m];t.bufferSubData(c,b.start*d.BYTES_PER_ELEMENT,d,b.start,b.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 coe=`#ifdef USE_ALPHAHASH
  34. if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;
  35. #endif`,uoe=`#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`,doe=`#ifdef USE_ALPHAMAP
  71. diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;
  72. #endif`,foe=`#ifdef USE_ALPHAMAP
  73. uniform sampler2D alphaMap;
  74. #endif`,hoe=`#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`,poe=`#ifdef USE_ALPHATEST
  82. uniform float alphaTest;
  83. #endif`,moe=`#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`,goe=`#ifdef USE_AOMAP
  97. uniform sampler2D aoMap;
  98. uniform float aoMapIntensity;
  99. #endif`,voe=`#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`,xoe=`#ifdef USE_BATCHING
  134. mat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) );
  135. #endif`,yoe=`vec3 transformed = vec3( position );
  136. #ifdef USE_ALPHAHASH
  137. vPosition = vec3( position );
  138. #endif`,boe=`vec3 objectNormal = vec3( normal );
  139. #ifdef USE_TANGENT
  140. vec3 objectTangent = vec3( tangent.xyz );
  141. #endif`,_oe=`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`,Soe=`#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`,woe=`#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`,Moe=`#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`,Eoe=`#if NUM_CLIPPING_PLANES > 0
  286. varying vec3 vClipPosition;
  287. uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];
  288. #endif`,Aoe=`#if NUM_CLIPPING_PLANES > 0
  289. varying vec3 vClipPosition;
  290. #endif`,Toe=`#if NUM_CLIPPING_PLANES > 0
  291. vClipPosition = - mvPosition.xyz;
  292. #endif`,Coe=`#if defined( USE_COLOR_ALPHA )
  293. diffuseColor *= vColor;
  294. #elif defined( USE_COLOR )
  295. diffuseColor.rgb *= vColor;
  296. #endif`,Roe=`#if defined( USE_COLOR_ALPHA )
  297. varying vec4 vColor;
  298. #elif defined( USE_COLOR )
  299. varying vec3 vColor;
  300. #endif`,Noe=`#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`,Poe=`#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`,Doe=`#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`,Ooe=`#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`,Loe=`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`,koe=`#ifdef USE_DISPLACEMENTMAP
  508. uniform sampler2D displacementMap;
  509. uniform float displacementScale;
  510. uniform float displacementBias;
  511. #endif`,Ioe=`#ifdef USE_DISPLACEMENTMAP
  512. transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );
  513. #endif`,Uoe=`#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`,Foe=`#ifdef USE_EMISSIVEMAP
  520. uniform sampler2D emissiveMap;
  521. #endif`,zoe="gl_FragColor = linearToOutputTexel( gl_FragColor );",Boe=`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. }`,joe=`#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`,Hoe=`#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`,Voe=`#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`,Goe=`#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`,$oe=`#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`,Woe=`#ifdef USE_FOG
  606. vFogDepth = - mvPosition.z;
  607. #endif`,qoe=`#ifdef USE_FOG
  608. varying float vFogDepth;
  609. #endif`,Xoe=`#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`,Yoe=`#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`,Koe=`#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. }`,Zoe=`#ifdef USE_LIGHTMAP
  638. uniform sampler2D lightMap;
  639. uniform float lightMapIntensity;
  640. #endif`,Joe=`LambertMaterial material;
  641. material.diffuseColor = diffuseColor.rgb;
  642. material.specularStrength = specularStrength;`,Qoe=`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`,ele=`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`,tle=`#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`,nle=`ToonMaterial material;
  806. material.diffuseColor = diffuseColor.rgb;`,ile=`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`,rle=`BlinnPhongMaterial material;
  819. material.diffuseColor = diffuseColor.rgb;
  820. material.specularColor = specular;
  821. material.specularShininess = shininess;
  822. material.specularStrength = specularStrength;`,ale=`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`,sle=`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`,ole=`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. }`,lle=`
  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`,cle=`#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`,ule=`#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`,dle=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )
  1381. gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;
  1382. #endif`,fle=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )
  1383. uniform float logDepthBufFC;
  1384. varying float vFragDepth;
  1385. varying float vIsPerspective;
  1386. #endif`,hle=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER
  1387. varying float vFragDepth;
  1388. varying float vIsPerspective;
  1389. #endif`,ple=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER
  1390. vFragDepth = 1.0 + gl_Position.w;
  1391. vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );
  1392. #endif`,mle=`#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`,gle=`#ifdef USE_MAP
  1399. uniform sampler2D map;
  1400. #endif`,vle=`#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`,xle=`#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`,yle=`float metalnessFactor = metalness;
  1425. #ifdef USE_METALNESSMAP
  1426. vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );
  1427. metalnessFactor *= texelMetalness.b;
  1428. #endif`,ble=`#ifdef USE_METALNESSMAP
  1429. uniform sampler2D metalnessMap;
  1430. #endif`,_le=`#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`,Sle=`#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`,wle=`#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`,Mle=`#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`,Ele=`#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`,Ale=`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;`,Tle=`#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`,Cle=`#ifndef FLAT_SHADED
  1526. varying vec3 vNormal;
  1527. #ifdef USE_TANGENT
  1528. varying vec3 vTangent;
  1529. varying vec3 vBitangent;
  1530. #endif
  1531. #endif`,Rle=`#ifndef FLAT_SHADED
  1532. varying vec3 vNormal;
  1533. #ifdef USE_TANGENT
  1534. varying vec3 vTangent;
  1535. varying vec3 vBitangent;
  1536. #endif
  1537. #endif`,Nle=`#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`,Ple=`#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`,Dle=`#ifdef USE_CLEARCOAT
  1566. vec3 clearcoatNormal = nonPerturbedNormal;
  1567. #endif`,Ole=`#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`,Lle=`#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`,kle=`#ifdef USE_IRIDESCENCEMAP
  1581. uniform sampler2D iridescenceMap;
  1582. #endif
  1583. #ifdef USE_IRIDESCENCE_THICKNESSMAP
  1584. uniform sampler2D iridescenceThicknessMap;
  1585. #endif`,Ile=`#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 );`,Ule=`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. }`,Fle=`#ifdef PREMULTIPLIED_ALPHA
  1661. gl_FragColor.rgb *= gl_FragColor.a;
  1662. #endif`,zle=`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;`,Ble=`#ifdef DITHERING
  1671. gl_FragColor.rgb = dithering( gl_FragColor.rgb );
  1672. #endif`,jle=`#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`,Hle=`float roughnessFactor = roughness;
  1680. #ifdef USE_ROUGHNESSMAP
  1681. vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );
  1682. roughnessFactor *= texelRoughness.g;
  1683. #endif`,Vle=`#ifdef USE_ROUGHNESSMAP
  1684. uniform sampler2D roughnessMap;
  1685. #endif`,Gle=`#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`,$le=`#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`,Wle=`#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`,qle=`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. }`,Xle=`#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`,Yle=`#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`,Kle=`#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`,Zle=`#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`,Jle=`float specularStrength;
  2024. #ifdef USE_SPECULARMAP
  2025. vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );
  2026. specularStrength = texelSpecular.r;
  2027. #else
  2028. specularStrength = 1.0;
  2029. #endif`,Qle=`#ifdef USE_SPECULARMAP
  2030. uniform sampler2D specularMap;
  2031. #endif`,ece=`#if defined( TONE_MAPPING )
  2032. gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );
  2033. #endif`,tce=`#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; }`,nce=`#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`,ice=`#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`,rce=`#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`,ace=`#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`,sce=`#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`,oce=`#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 lce=`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. }`,cce=`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. }`,uce=`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. }`,dce=`#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. }`,fce=`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. }`,hce=`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. }`,pce=`#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. }`,mce=`#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. }`,gce=`#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. }`,vce=`#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. }`,xce=`varying vec3 vWorldDirection;
  2702. #include <common>
  2703. void main() {
  2704. vWorldDirection = transformDirection( position, modelMatrix );
  2705. #include <begin_vertex>
  2706. #include <project_vertex>
  2707. }`,yce=`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. }`,bce=`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. }`,_ce=`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. }`,Sce=`#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. }`,wce=`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. }`,Mce=`#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. }`,Ece=`#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. }`,Ace=`#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. }`,Tce=`#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. }`,Cce=`#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. }`,Rce=`#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. }`,Nce=`#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. }`,Pce=`#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. }`,Dce=`#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. }`,Oce=`#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. }`,Lce=`#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. }`,kce=`#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. }`,Ice=`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. }`,Uce=`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. }`,Fce=`#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. }`,zce=`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. }`,Bce=`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. }`,jce=`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. }`,Zt={alphahash_fragment:coe,alphahash_pars_fragment:uoe,alphamap_fragment:doe,alphamap_pars_fragment:foe,alphatest_fragment:hoe,alphatest_pars_fragment:poe,aomap_fragment:moe,aomap_pars_fragment:goe,batching_pars_vertex:voe,batching_vertex:xoe,begin_vertex:yoe,beginnormal_vertex:boe,bsdfs:_oe,iridescence_fragment:Soe,bumpmap_pars_fragment:woe,clipping_planes_fragment:Moe,clipping_planes_pars_fragment:Eoe,clipping_planes_pars_vertex:Aoe,clipping_planes_vertex:Toe,color_fragment:Coe,color_pars_fragment:Roe,color_pars_vertex:Noe,color_vertex:Poe,common:Doe,cube_uv_reflection_fragment:Ooe,defaultnormal_vertex:Loe,displacementmap_pars_vertex:koe,displacementmap_vertex:Ioe,emissivemap_fragment:Uoe,emissivemap_pars_fragment:Foe,colorspace_fragment:zoe,colorspace_pars_fragment:Boe,envmap_fragment:joe,envmap_common_pars_fragment:Hoe,envmap_pars_fragment:Voe,envmap_pars_vertex:Goe,envmap_physical_pars_fragment:tle,envmap_vertex:$oe,fog_vertex:Woe,fog_pars_vertex:qoe,fog_fragment:Xoe,fog_pars_fragment:Yoe,gradientmap_pars_fragment:Koe,lightmap_pars_fragment:Zoe,lights_lambert_fragment:Joe,lights_lambert_pars_fragment:Qoe,lights_pars_begin:ele,lights_toon_fragment:nle,lights_toon_pars_fragment:ile,lights_phong_fragment:rle,lights_phong_pars_fragment:ale,lights_physical_fragment:sle,lights_physical_pars_fragment:ole,lights_fragment_begin:lle,lights_fragment_maps:cle,lights_fragment_end:ule,logdepthbuf_fragment:dle,logdepthbuf_pars_fragment:fle,logdepthbuf_pars_vertex:hle,logdepthbuf_vertex:ple,map_fragment:mle,map_pars_fragment:gle,map_particle_fragment:vle,map_particle_pars_fragment:xle,metalnessmap_fragment:yle,metalnessmap_pars_fragment:ble,morphinstance_vertex:_le,morphcolor_vertex:Sle,morphnormal_vertex:wle,morphtarget_pars_vertex:Mle,morphtarget_vertex:Ele,normal_fragment_begin:Ale,normal_fragment_maps:Tle,normal_pars_fragment:Cle,normal_pars_vertex:Rle,normal_vertex:Nle,normalmap_pars_fragment:Ple,clearcoat_normal_fragment_begin:Dle,clearcoat_normal_fragment_maps:Ole,clearcoat_pars_fragment:Lle,iridescence_pars_fragment:kle,opaque_fragment:Ile,packing:Ule,premultiplied_alpha_fragment:Fle,project_vertex:zle,dithering_fragment:Ble,dithering_pars_fragment:jle,roughnessmap_fragment:Hle,roughnessmap_pars_fragment:Vle,shadowmap_pars_fragment:Gle,shadowmap_pars_vertex:$le,shadowmap_vertex:Wle,shadowmask_pars_fragment:qle,skinbase_vertex:Xle,skinning_pars_vertex:Yle,skinning_vertex:Kle,skinnormal_vertex:Zle,specularmap_fragment:Jle,specularmap_pars_fragment:Qle,tonemapping_fragment:ece,tonemapping_pars_fragment:tce,transmission_fragment:nce,transmission_pars_fragment:ice,uv_pars_fragment:rce,uv_pars_vertex:ace,uv_vertex:sce,worldpos_vertex:oce,background_vert:lce,background_frag:cce,backgroundCube_vert:uce,backgroundCube_frag:dce,cube_vert:fce,cube_frag:hce,depth_vert:pce,depth_frag:mce,distanceRGBA_vert:gce,distanceRGBA_frag:vce,equirect_vert:xce,equirect_frag:yce,linedashed_vert:bce,linedashed_frag:_ce,meshbasic_vert:Sce,meshbasic_frag:wce,meshlambert_vert:Mce,meshlambert_frag:Ece,meshmatcap_vert:Ace,meshmatcap_frag:Tce,meshnormal_vert:Cce,meshnormal_frag:Rce,meshphong_vert:Nce,meshphong_frag:Pce,meshphysical_vert:Dce,meshphysical_frag:Oce,meshtoon_vert:Lce,meshtoon_frag:kce,points_vert:Ice,points_frag:Uce,shadow_vert:Fce,shadow_frag:zce,sprite_vert:Bce,sprite_frag:jce},_t={common:{diffuse:{value:new fn(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new nn},alphaMap:{value:null},alphaMapTransform:{value:new nn},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new nn}},envmap:{envMap:{value:null},envMapRotation:{value:new nn},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 nn}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new nn}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new nn},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new nn},normalScale:{value:new Qt(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new nn},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new nn}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new nn}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new nn}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new fn(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 fn(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new nn},alphaTest:{value:0},uvTransform:{value:new nn}},sprite:{diffuse:{value:new fn(16777215)},opacity:{value:1},center:{value:new Qt(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new nn},alphaMap:{value:null},alphaMapTransform:{value:new nn},alphaTest:{value:0}}},No={basic:{uniforms:oa([_t.common,_t.specularmap,_t.envmap,_t.aomap,_t.lightmap,_t.fog]),vertexShader:Zt.meshbasic_vert,fragmentShader:Zt.meshbasic_frag},lambert:{uniforms:oa([_t.common,_t.specularmap,_t.envmap,_t.aomap,_t.lightmap,_t.emissivemap,_t.bumpmap,_t.normalmap,_t.displacementmap,_t.fog,_t.lights,{emissive:{value:new fn(0)}}]),vertexShader:Zt.meshlambert_vert,fragmentShader:Zt.meshlambert_frag},phong:{uniforms:oa([_t.common,_t.specularmap,_t.envmap,_t.aomap,_t.lightmap,_t.emissivemap,_t.bumpmap,_t.normalmap,_t.displacementmap,_t.fog,_t.lights,{emissive:{value:new fn(0)},specular:{value:new fn(1118481)},shininess:{value:30}}]),vertexShader:Zt.meshphong_vert,fragmentShader:Zt.meshphong_frag},standard:{uniforms:oa([_t.common,_t.envmap,_t.aomap,_t.lightmap,_t.emissivemap,_t.bumpmap,_t.normalmap,_t.displacementmap,_t.roughnessmap,_t.metalnessmap,_t.fog,_t.lights,{emissive:{value:new fn(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Zt.meshphysical_vert,fragmentShader:Zt.meshphysical_frag},toon:{uniforms:oa([_t.common,_t.aomap,_t.lightmap,_t.emissivemap,_t.bumpmap,_t.normalmap,_t.displacementmap,_t.gradientmap,_t.fog,_t.lights,{emissive:{value:new fn(0)}}]),vertexShader:Zt.meshtoon_vert,fragmentShader:Zt.meshtoon_frag},matcap:{uniforms:oa([_t.common,_t.bumpmap,_t.normalmap,_t.displacementmap,_t.fog,{matcap:{value:null}}]),vertexShader:Zt.meshmatcap_vert,fragmentShader:Zt.meshmatcap_frag},points:{uniforms:oa([_t.points,_t.fog]),vertexShader:Zt.points_vert,fragmentShader:Zt.points_frag},dashed:{uniforms:oa([_t.common,_t.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Zt.linedashed_vert,fragmentShader:Zt.linedashed_frag},depth:{uniforms:oa([_t.common,_t.displacementmap]),vertexShader:Zt.depth_vert,fragmentShader:Zt.depth_frag},normal:{uniforms:oa([_t.common,_t.bumpmap,_t.normalmap,_t.displacementmap,{opacity:{value:1}}]),vertexShader:Zt.meshnormal_vert,fragmentShader:Zt.meshnormal_frag},sprite:{uniforms:oa([_t.sprite,_t.fog]),vertexShader:Zt.sprite_vert,fragmentShader:Zt.sprite_frag},background:{uniforms:{uvTransform:{value:new nn},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Zt.background_vert,fragmentShader:Zt.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new nn}},vertexShader:Zt.backgroundCube_vert,fragmentShader:Zt.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Zt.cube_vert,fragmentShader:Zt.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Zt.equirect_vert,fragmentShader:Zt.equirect_frag},distanceRGBA:{uniforms:oa([_t.common,_t.displacementmap,{referencePosition:{value:new Ge},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Zt.distanceRGBA_vert,fragmentShader:Zt.distanceRGBA_frag},shadow:{uniforms:oa([_t.lights,_t.fog,{color:{value:new fn(0)},opacity:{value:1}}]),vertexShader:Zt.shadow_vert,fragmentShader:Zt.shadow_frag}};No.physical={uniforms:oa([No.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new nn},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new nn},clearcoatNormalScale:{value:new Qt(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new nn},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new nn},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new nn},sheen:{value:0},sheenColor:{value:new fn(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new nn},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new nn},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new nn},transmissionSamplerSize:{value:new Qt},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new nn},attenuationDistance:{value:0},attenuationColor:{value:new fn(0)},specularColor:{value:new fn(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new nn},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new nn},anisotropyVector:{value:new Qt},anisotropyMap:{value:null},anisotropyMapTransform:{value:new nn}}]),vertexShader:Zt.meshphysical_vert,fragmentShader:Zt.meshphysical_frag};const xy={r:0,b:0,g:0},fd=new Nu,Hce=new Gi;function Vce(t,e,n,i,r,a,s){const o=new fn(0);let l=a===!0?0:1,c,d,f=null,p=0,m=null;function y(w){let E=w.isScene===!0?w.background:null;return E&&E.isTexture&&(E=(w.backgroundBlurriness>0?n:e).get(E)),E}function b(w){let E=!1;const T=y(w);T===null?v(o,l):T&&T.isColor&&(v(T,1),E=!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||E)&&(i.buffers.depth.setTest(!0),i.buffers.depth.setMask(!0),i.buffers.color.setMask(!0),t.clear(t.autoClearColor,t.autoClearDepth,t.autoClearStencil))}function x(w,E){const T=y(E);T&&(T.isCubeTexture||T.mapping===oS)?(d===void 0&&(d=new Bo(new $N(1,1,1),new Ql({name:"BackgroundCubeMaterial",uniforms:_p(No.backgroundCube.uniforms),vertexShader:No.backgroundCube.vertexShader,fragmentShader:No.backgroundCube.fragmentShader,side:Pa,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),d.geometry.deleteAttribute("normal"),d.geometry.deleteAttribute("uv"),d.onBeforeRender=function(P,R,U){this.matrixWorld.copyPosition(U.matrixWorld)},Object.defineProperty(d.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),r.update(d)),fd.copy(E.backgroundRotation),fd.x*=-1,fd.y*=-1,fd.z*=-1,T.isCubeTexture&&T.isRenderTargetTexture===!1&&(fd.y*=-1,fd.z*=-1),d.material.uniforms.envMap.value=T,d.material.uniforms.flipEnvMap.value=T.isCubeTexture&&T.isRenderTargetTexture===!1?-1:1,d.material.uniforms.backgroundBlurriness.value=E.backgroundBlurriness,d.material.uniforms.backgroundIntensity.value=E.backgroundIntensity,d.material.uniforms.backgroundRotation.value.setFromMatrix4(Hce.makeRotationFromEuler(fd)),d.material.toneMapped=xn.getTransfer(T.colorSpace)!==On,(f!==T||p!==T.version||m!==t.toneMapping)&&(d.material.needsUpdate=!0,f=T,p=T.version,m=t.toneMapping),d.layers.enableAll(),w.unshift(d,d.geometry,d.material,0,0,null)):T&&T.isTexture&&(c===void 0&&(c=new Bo(new qN(2,2),new Ql({name:"BackgroundMaterial",uniforms:_p(No.background.uniforms),vertexShader:No.background.vertexShader,fragmentShader:No.background.fragmentShader,side:Ru,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=T,c.material.uniforms.backgroundIntensity.value=E.backgroundIntensity,c.material.toneMapped=xn.getTransfer(T.colorSpace)!==On,T.matrixAutoUpdate===!0&&T.updateMatrix(),c.material.uniforms.uvTransform.value.copy(T.matrix),(f!==T||p!==T.version||m!==t.toneMapping)&&(c.material.needsUpdate=!0,f=T,p=T.version,m=t.toneMapping),c.layers.enableAll(),w.unshift(c,c.geometry,c.material,0,0,null))}function v(w,E){w.getRGB(xy,HG(t)),i.buffers.color.setClear(xy.r,xy.g,xy.b,E,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,E=1){o.set(w),l=E,v(o,l)},getClearAlpha:function(){return l},setClearAlpha:function(w){l=w,v(o,l)},render:b,addToRenderList:x,dispose:M}}function Gce(t,e){const n=t.getParameter(t.MAX_VERTEX_ATTRIBS),i={},r=p(null);let a=r,s=!1;function o(O,B,I,W,L){let $=!1;const q=f(W,I,B);a!==q&&(a=q,c(a.object)),$=m(O,W,I,L),$&&y(O,W,I,L),L!==null&&e.update(L,t.ELEMENT_ARRAY_BUFFER),($||s)&&(s=!1,E(O,B,I,W),L!==null&&t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,e.get(L).buffer))}function l(){return t.createVertexArray()}function c(O){return t.bindVertexArray(O)}function d(O){return t.deleteVertexArray(O)}function f(O,B,I){const W=I.wireframe===!0;let L=i[O.id];L===void 0&&(L={},i[O.id]=L);let $=L[B.id];$===void 0&&($={},L[B.id]=$);let q=$[W];return q===void 0&&(q=p(l()),$[W]=q),q}function p(O){const B=[],I=[],W=[];for(let L=0;L<n;L++)B[L]=0,I[L]=0,W[L]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:B,enabledAttributes:I,attributeDivisors:W,object:O,attributes:{},index:null}}function m(O,B,I,W){const L=a.attributes,$=B.attributes;let q=0;const G=I.getAttributes();for(const Y in G)if(G[Y].location>=0){const se=L[Y];let H=$[Y];if(H===void 0&&(Y==="instanceMatrix"&&O.instanceMatrix&&(H=O.instanceMatrix),Y==="instanceColor"&&O.instanceColor&&(H=O.instanceColor)),se===void 0||se.attribute!==H||H&&se.data!==H.data)return!0;q++}return a.attributesNum!==q||a.index!==W}function y(O,B,I,W){const L={},$=B.attributes;let q=0;const G=I.getAttributes();for(const Y in G)if(G[Y].location>=0){let se=$[Y];se===void 0&&(Y==="instanceMatrix"&&O.instanceMatrix&&(se=O.instanceMatrix),Y==="instanceColor"&&O.instanceColor&&(se=O.instanceColor));const H={};H.attribute=se,se&&se.data&&(H.data=se.data),L[Y]=H,q++}a.attributes=L,a.attributesNum=q,a.index=W}function b(){const O=a.newAttributes;for(let B=0,I=O.length;B<I;B++)O[B]=0}function x(O){v(O,0)}function v(O,B){const I=a.newAttributes,W=a.enabledAttributes,L=a.attributeDivisors;I[O]=1,W[O]===0&&(t.enableVertexAttribArray(O),W[O]=1),L[O]!==B&&(t.vertexAttribDivisor(O,B),L[O]=B)}function M(){const O=a.newAttributes,B=a.enabledAttributes;for(let I=0,W=B.length;I<W;I++)B[I]!==O[I]&&(t.disableVertexAttribArray(I),B[I]=0)}function w(O,B,I,W,L,$,q){q===!0?t.vertexAttribIPointer(O,B,I,L,$):t.vertexAttribPointer(O,B,I,W,L,$)}function E(O,B,I,W){b();const L=W.attributes,$=I.getAttributes(),q=B.defaultAttributeValues;for(const G in $){const Y=$[G];if(Y.location>=0){let Q=L[G];if(Q===void 0&&(G==="instanceMatrix"&&O.instanceMatrix&&(Q=O.instanceMatrix),G==="instanceColor"&&O.instanceColor&&(Q=O.instanceColor)),Q!==void 0){const se=Q.normalized,H=Q.itemSize,X=e.get(Q);if(X===void 0)continue;const re=X.buffer,ce=X.type,ye=X.bytesPerElement,me=ce===t.INT||ce===t.UNSIGNED_INT||Q.gpuType===kN;if(Q.isInterleavedBufferAttribute){const be=Q.data,De=be.stride,he=Q.offset;if(be.isInstancedInterleavedBuffer){for(let Ae=0;Ae<Y.locationSize;Ae++)v(Y.location+Ae,be.meshPerAttribute);O.isInstancedMesh!==!0&&W._maxInstanceCount===void 0&&(W._maxInstanceCount=be.meshPerAttribute*be.count)}else for(let Ae=0;Ae<Y.locationSize;Ae++)x(Y.location+Ae);t.bindBuffer(t.ARRAY_BUFFER,re);for(let Ae=0;Ae<Y.locationSize;Ae++)w(Y.location+Ae,H/Y.locationSize,ce,se,De*ye,(he+H/Y.locationSize*Ae)*ye,me)}else{if(Q.isInstancedBufferAttribute){for(let be=0;be<Y.locationSize;be++)v(Y.location+be,Q.meshPerAttribute);O.isInstancedMesh!==!0&&W._maxInstanceCount===void 0&&(W._maxInstanceCount=Q.meshPerAttribute*Q.count)}else for(let be=0;be<Y.locationSize;be++)x(Y.location+be);t.bindBuffer(t.ARRAY_BUFFER,re);for(let be=0;be<Y.locationSize;be++)w(Y.location+be,H/Y.locationSize,ce,se,H*ye,H/Y.locationSize*be*ye,me)}}else if(q!==void 0){const se=q[G];if(se!==void 0)switch(se.length){case 2:t.vertexAttrib2fv(Y.location,se);break;case 3:t.vertexAttrib3fv(Y.location,se);break;case 4:t.vertexAttrib4fv(Y.location,se);break;default:t.vertexAttrib1fv(Y.location,se)}}}}M()}function T(){U();for(const O in i){const B=i[O];for(const I in B){const W=B[I];for(const L in W)d(W[L].object),delete W[L];delete B[I]}delete i[O]}}function P(O){if(i[O.id]===void 0)return;const B=i[O.id];for(const I in B){const W=B[I];for(const L in W)d(W[L].object),delete W[L];delete B[I]}delete i[O.id]}function R(O){for(const B in i){const I=i[B];if(I[O.id]===void 0)continue;const W=I[O.id];for(const L in W)d(W[L].object),delete W[L];delete I[O.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:T,releaseStatesOfGeometry:P,releaseStatesOfProgram:R,initAttributes:b,enableAttribute:x,disableUnusedAttributes:M}}function $ce(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 m=0;for(let y=0;y<f;y++)m+=d[y];n.update(m,i,1)}function l(c,d,f,p){if(f===0)return;const m=e.get("WEBGL_multi_draw");if(m===null)for(let y=0;y<c.length;y++)s(c[y],d[y],p[y]);else{m.multiDrawArraysInstancedWEBGL(i,c,0,d,0,p,0,f);let y=0;for(let b=0;b<f;b++)y+=d[b]*p[b];n.update(y,i,1)}}this.setMode=r,this.render=a,this.renderInstances=s,this.renderMultiDraw=o,this.renderMultiDrawInstances=l}function Wce(t,e,n,i){let r;function a(){if(r!==void 0)return r;if(e.has("EXT_texture_filter_anisotropic")===!0){const R=e.get("EXT_texture_filter_anisotropic");r=t.getParameter(R.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else r=0;return r}function s(R){return!(R!==lo&&i.convert(R)!==t.getParameter(t.IMPLEMENTATION_COLOR_READ_FORMAT))}function o(R){const U=R===Xp&&(e.has("EXT_color_buffer_half_float")||e.has("EXT_color_buffer_float"));return!(R!==zo&&i.convert(R)!==t.getParameter(t.IMPLEMENTATION_COLOR_READ_TYPE)&&R!==Fl&&!U)}function l(R){if(R==="highp"){if(t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.HIGH_FLOAT).precision>0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.HIGH_FLOAT).precision>0)return"highp";R="mediump"}return R==="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&&(Ht("WebGLRenderer:",c,"not supported, using",d,"instead."),c=d);const f=n.logarithmicDepthBuffer===!0,p=n.reversedDepthBuffer===!0&&e.has("EXT_clip_control"),m=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),y=t.getParameter(t.MAX_VERTEX_TEXTURE_IMAGE_UNITS),b=t.getParameter(t.MAX_TEXTURE_SIZE),x=t.getParameter(t.MAX_CUBE_MAP_TEXTURE_SIZE),v=t.getParameter(t.MAX_VERTEX_ATTRIBS),M=t.getParameter(t.MAX_VERTEX_UNIFORM_VECTORS),w=t.getParameter(t.MAX_VARYING_VECTORS),E=t.getParameter(t.MAX_FRAGMENT_UNIFORM_VECTORS),T=y>0,P=t.getParameter(t.MAX_SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:a,getMaxPrecision:l,textureFormatReadable:s,textureTypeReadable:o,precision:c,logarithmicDepthBuffer:f,reversedDepthBuffer:p,maxTextures:m,maxVertexTextures:y,maxTextureSize:b,maxCubemapSize:x,maxAttributes:v,maxVertexUniforms:M,maxVaryings:w,maxFragmentUniforms:E,vertexTextures:T,maxSamples:P}}function qce(t){const e=this;let n=null,i=0,r=!1,a=!1;const s=new tu,o=new nn,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(f,p){const m=f.length!==0||p||i!==0||r;return r=p,i=f.length,m},this.beginShadows=function(){a=!0,d(null)},this.endShadows=function(){a=!1},this.setGlobalState=function(f,p){n=d(f,p,0)},this.setState=function(f,p,m){const y=f.clippingPlanes,b=f.clipIntersection,x=f.clipShadows,v=t.get(f);if(!r||y===null||y.length===0||a&&!x)a?d(null):c();else{const M=a?0:i,w=M*4;let E=v.clippingState||null;l.value=E,E=d(y,p,w,m);for(let T=0;T!==w;++T)E[T]=n[T];v.clippingState=E,this.numIntersection=b?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,p,m,y){const b=f!==null?f.length:0;let x=null;if(b!==0){if(x=l.value,y!==!0||x===null){const v=m+b*4,M=p.matrixWorldInverse;o.getNormalMatrix(M),(x===null||x.length<v)&&(x=new Float32Array(v));for(let w=0,E=m;w!==b;++w,E+=4)s.copy(f[w]).applyMatrix4(M,o),s.normal.toArray(x,E),x[E+3]=s.constant}l.value=x,l.needsUpdate=!0}return e.numPlanes=b,e.numIntersection=0,x}}function Xce(t){let e=new WeakMap;function n(s,o){return o===B2?s.mapping=xp:o===j2&&(s.mapping=yp),s}function i(s){if(s&&s.isTexture){const o=s.mapping;if(o===B2||o===j2)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 Vse(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 hu=4,Q4=[.125,.215,.35,.446,.526,.582],Ad=20,Yce=256,fg=new KG,eF=new fn;let uA=null,dA=0,fA=0,hA=!1;const Kce=new Ge;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=Kce}=a;uA=this._renderer.getRenderTarget(),dA=this._renderer.getActiveCubeFace(),fA=this._renderer.getActiveMipmapLevel(),hA=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=iF(),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(uA,dA,fA),this._renderer.xr.enabled=hA,e.scissorTest=!1,bh(e,0,0,e.width,e.height)}_fromTexture(e,n){e.mapping===xp||e.mapping===yp?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),uA=this._renderer.getRenderTarget(),dA=this._renderer.getActiveCubeFace(),fA=this._renderer.getActiveMipmapLevel(),hA=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:Ls,minFilter:Ls,generateMipmaps:!1,type:Xp,format:lo,colorSpace:bp,depthBuffer:!1},r=nF(e,n,i);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==n){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=nF(e,n,i);const{_lodMax:a}=this;({lodMeshes:this._lodMeshes,sizeLods:this._sizeLods,sigmas:this._sigmas}=Zce(a)),this._blurMaterial=Qce(a,e,n),this._ggxMaterial=Jce(a,e,n)}return r}_compileMaterial(e){const n=new Bo(new Yo,e);this._renderer.compile(n,fg)}_sceneToCubeUV(e,n,i,r,a){const l=new Rs(90,1,n,i),c=[1,-1,1,1,1,1],d=[1,1,1,-1,-1,-1],f=this._renderer,p=f.autoClear,m=f.toneMapping;f.getClearColor(eF),f.toneMapping=bu,f.autoClear=!1,f.state.buffers.depth.getReversed()&&(f.setRenderTarget(r),f.clearDepth(),f.setRenderTarget(null)),this._backgroundBox===null&&(this._backgroundBox=new Bo(new $N,new GN({name:"PMREM.Background",side:Pa,depthWrite:!1,depthTest:!1})));const b=this._backgroundBox,x=b.material;let v=!1;const M=e.background;M?M.isColor&&(x.color.copy(M),e.background=null,v=!0):(x.color.copy(eF),v=!0);for(let w=0;w<6;w++){const E=w%3;E===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)):E===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 T=this._cubeSize;bh(r,E*T,w>2?T:0,T,T),f.setRenderTarget(r),v&&f.render(b,l),f.render(e,l)}f.toneMapping=m,f.autoClear=p,e.background=M}_textureToCubeUV(e,n){const i=this._renderer,r=e.mapping===xp||e.mapping===yp;r?(this._cubemapMaterial===null&&(this._cubemapMaterial=rF()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=iF());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;bh(n,0,0,3*l,2*l),i.setRenderTarget(n),i.render(s,fg)}_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),p=.05+c*.95,m=f*p,{_lodMax:y}=this,b=this._sizeLods[i],x=3*b*(i>y-hu?i-y+hu:0),v=4*(this._cubeSize-b);l.envMap.value=e.texture,l.roughness.value=m,l.mipInt.value=y-n,bh(a,x,v,3*b,2*b),r.setRenderTarget(a),r.render(o,fg),l.envMap.value=a.texture,l.roughness.value=0,l.mipInt.value=y-i,bh(e,x,v,3*b,2*b),r.setRenderTarget(e),r.render(o,fg)}_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"&&Ci("blur direction must be either latitudinal or longitudinal!");const d=3,f=this._lodMeshes[r];f.material=c;const p=c.uniforms,m=this._sizeLods[i]-1,y=isFinite(a)?Math.PI/(2*m):2*Math.PI/(2*Ad-1),b=a/y,x=isFinite(a)?1+Math.floor(d*b):Ad;x>Ad&&Ht(`sigmaRadians, ${a}, is too large and will clip, as it requested ${x} samples when the maximum is set to ${Ad}`);const v=[];let M=0;for(let R=0;R<Ad;++R){const U=R/b,N=Math.exp(-U*U/2);v.push(N),R===0?M+=N:R<x&&(M+=2*N)}for(let R=0;R<v.length;R++)v[R]=v[R]/M;p.envMap.value=e.texture,p.samples.value=x,p.weights.value=v,p.latitudinal.value=s==="latitudinal",o&&(p.poleAxis.value=o);const{_lodMax:w}=this;p.dTheta.value=y,p.mipInt.value=w-i;const E=this._sizeLods[r],T=3*E*(r>w-hu?r-w+hu:0),P=4*(this._cubeSize-E);bh(n,T,P,3*E,2*E),l.setRenderTarget(n),l.render(f,fg)}};function Zce(t){const e=[],n=[],i=[];let r=t;const a=t-hu+1+Q4.length;for(let s=0;s<a;s++){const o=Math.pow(2,r);e.push(o);let l=1/o;s>t-hu?l=Q4[s-t+hu-1]:s===0&&(l=0),n.push(l);const c=1/(o-2),d=-c,f=1+c,p=[d,d,f,d,f,f,d,d,f,f,d,f],m=6,y=6,b=3,x=2,v=1,M=new Float32Array(b*y*m),w=new Float32Array(x*y*m),E=new Float32Array(v*y*m);for(let P=0;P<m;P++){const R=P%3*2/3-1,U=P>2?0:-1,N=[R,U,0,R+2/3,U,0,R+2/3,U+1,0,R,U,0,R+2/3,U+1,0,R,U+1,0];M.set(N,b*y*P),w.set(p,x*y*P);const O=[P,P,P,P,P,P];E.set(O,v*y*P)}const T=new Yo;T.setAttribute("position",new Is(M,b)),T.setAttribute("uv",new Is(w,x)),T.setAttribute("faceIndex",new Is(E,v)),i.push(new Bo(T,null)),r>hu&&r--}return{lodMeshes:i,sizeLods:e,sigmas:n}}function nF(t,e,n){const i=new of(t,e,n);return i.texture.mapping=oS,i.texture.name="PMREM.cubeUv",i.scissorTest=!0,i}function bh(t,e,n,i,r){t.viewport.set(e,n,i,r),t.scissor.set(e,n,i,r)}function Jce(t,e,n){return new Ql({name:"PMREMGGXConvolution",defines:{GGX_SAMPLES:Yce,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:cS(),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:Gl,depthTest:!1,depthWrite:!1})}function Qce(t,e,n){const i=new Float32Array(Ad),r=new Ge(0,1,0);return new Ql({name:"SphericalGaussianBlur",defines:{n:Ad,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:cS(),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:Gl,depthTest:!1,depthWrite:!1})}function iF(){return new Ql({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:cS(),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:Gl,depthTest:!1,depthWrite:!1})}function rF(){return new Ql({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:cS(),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:Gl,depthTest:!1,depthWrite:!1})}function cS(){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 eue(t){let e=new WeakMap,n=null;function i(o){if(o&&o.isTexture){const l=o.mapping,c=l===B2||l===j2,d=l===xp||l===yp;if(c||d){let f=e.get(o);const p=f!==void 0?f.texture.pmremVersion:0;if(o.isRenderTargetTexture&&o.pmremVersion!==p)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 m=o.image;return c&&m&&m.height>0||d&&m&&r(m)?(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 tue(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&&x0("WebGLRenderer: "+i+" extension not supported."),r}}}function nue(t,e,n,i){const r={},a=new WeakMap;function s(f){const p=f.target;p.index!==null&&e.remove(p.index);for(const y in p.attributes)e.remove(p.attributes[y]);p.removeEventListener("dispose",s),delete r[p.id];const m=a.get(p);m&&(e.remove(m),a.delete(p)),i.releaseStatesOfGeometry(p),p.isInstancedBufferGeometry===!0&&delete p._maxInstanceCount,n.memory.geometries--}function o(f,p){return r[p.id]===!0||(p.addEventListener("dispose",s),r[p.id]=!0,n.memory.geometries++),p}function l(f){const p=f.attributes;for(const m in p)e.update(p[m],t.ARRAY_BUFFER)}function c(f){const p=[],m=f.index,y=f.attributes.position;let b=0;if(m!==null){const M=m.array;b=m.version;for(let w=0,E=M.length;w<E;w+=3){const T=M[w+0],P=M[w+1],R=M[w+2];p.push(T,P,P,R,R,T)}}else if(y!==void 0){const M=y.array;b=y.version;for(let w=0,E=M.length/3-1;w<E;w+=3){const T=w+0,P=w+1,R=w+2;p.push(T,P,P,R,R,T)}}else return;const x=new(RG(p)?zG:FG)(p,1);x.version=b;const v=a.get(f);v&&e.remove(v),a.set(f,x)}function d(f){const p=a.get(f);if(p){const m=f.index;m!==null&&p.version<m.version&&c(f)}else c(f);return a.get(f)}return{get:o,update:l,getWireframeAttribute:d}}function iue(t,e,n){let i;function r(p){i=p}let a,s;function o(p){a=p.type,s=p.bytesPerElement}function l(p,m){t.drawElements(i,m,a,p*s),n.update(m,i,1)}function c(p,m,y){y!==0&&(t.drawElementsInstanced(i,m,a,p*s,y),n.update(m,i,y))}function d(p,m,y){if(y===0)return;e.get("WEBGL_multi_draw").multiDrawElementsWEBGL(i,m,0,a,p,0,y);let x=0;for(let v=0;v<y;v++)x+=m[v];n.update(x,i,1)}function f(p,m,y,b){if(y===0)return;const x=e.get("WEBGL_multi_draw");if(x===null)for(let v=0;v<p.length;v++)c(p[v]/s,m[v],b[v]);else{x.multiDrawElementsInstancedWEBGL(i,m,0,a,p,0,b,0,y);let v=0;for(let M=0;M<y;M++)v+=m[M]*b[M];n.update(v,i,1)}}this.setMode=r,this.setIndex=o,this.render=l,this.renderInstances=c,this.renderMultiDraw=d,this.renderMultiDrawInstances=f}function rue(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:Ci("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 aue(t,e,n){const i=new WeakMap,r=new Bi;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 p=i.get(o);if(p===void 0||p.count!==f){let O=function(){U.dispose(),i.delete(o),o.removeEventListener("dispose",O)};var m=O;p!==void 0&&p.texture.dispose();const y=o.morphAttributes.position!==void 0,b=o.morphAttributes.normal!==void 0,x=o.morphAttributes.color!==void 0,v=o.morphAttributes.position||[],M=o.morphAttributes.normal||[],w=o.morphAttributes.color||[];let E=0;y===!0&&(E=1),b===!0&&(E=2),x===!0&&(E=3);let T=o.attributes.position.count*E,P=1;T>e.maxTextureSize&&(P=Math.ceil(T/e.maxTextureSize),T=e.maxTextureSize);const R=new Float32Array(T*P*4*f),U=new LG(R,T,P,f);U.type=Fl,U.needsUpdate=!0;const N=E*4;for(let B=0;B<f;B++){const I=v[B],W=M[B],L=w[B],$=T*P*4*B;for(let q=0;q<I.count;q++){const G=q*N;y===!0&&(r.fromBufferAttribute(I,q),R[$+G+0]=r.x,R[$+G+1]=r.y,R[$+G+2]=r.z,R[$+G+3]=0),b===!0&&(r.fromBufferAttribute(W,q),R[$+G+4]=r.x,R[$+G+5]=r.y,R[$+G+6]=r.z,R[$+G+7]=0),x===!0&&(r.fromBufferAttribute(L,q),R[$+G+8]=r.x,R[$+G+9]=r.y,R[$+G+10]=r.z,R[$+G+11]=L.itemSize===4?r.w:1)}}p={count:f,texture:U,size:new Qt(T,P)},i.set(o,p),o.addEventListener("dispose",O)}if(s.isInstancedMesh===!0&&s.morphTexture!==null)l.getUniforms().setValue(t,"morphTexture",s.morphTexture,n);else{let y=0;for(let x=0;x<c.length;x++)y+=c[x];const b=o.morphTargetsRelative?1:1-y;l.getUniforms().setValue(t,"morphTargetBaseInfluence",b),l.getUniforms().setValue(t,"morphTargetInfluences",c)}l.getUniforms().setValue(t,"morphTargetsTexture",p.texture,n),l.getUniforms().setValue(t,"morphTargetsTextureSize",p.size)}return{update:a}}function sue(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 p=l.skeleton;r.get(p)!==c&&(p.update(),r.set(p,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 JG=new vo,aF=new WG(1,1),QG=new LG,e$=new Ase,t$=new GG,sF=[],oF=[],lF=new Float32Array(16),cF=new Float32Array(9),uF=new Float32Array(4);function Kp(t,e,n){const i=t[0];if(i<=0||i>0)return t;const r=e*n;let a=sF[r];if(a===void 0&&(a=new Float32Array(r),sF[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 tr(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 nr(t,e){for(let n=0,i=e.length;n<i;n++)t[n]=e[n]}function uS(t,e){let n=oF[e];n===void 0&&(n=new Int32Array(e),oF[e]=n);for(let i=0;i!==e;++i)n[i]=t.allocateTextureUnit();return n}function oue(t,e){const n=this.cache;n[0]!==e&&(t.uniform1f(this.addr,e),n[0]=e)}function lue(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(tr(n,e))return;t.uniform2fv(this.addr,e),nr(n,e)}}function cue(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(tr(n,e))return;t.uniform3fv(this.addr,e),nr(n,e)}}function uue(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(tr(n,e))return;t.uniform4fv(this.addr,e),nr(n,e)}}function due(t,e){const n=this.cache,i=e.elements;if(i===void 0){if(tr(n,e))return;t.uniformMatrix2fv(this.addr,!1,e),nr(n,e)}else{if(tr(n,i))return;uF.set(i),t.uniformMatrix2fv(this.addr,!1,uF),nr(n,i)}}function fue(t,e){const n=this.cache,i=e.elements;if(i===void 0){if(tr(n,e))return;t.uniformMatrix3fv(this.addr,!1,e),nr(n,e)}else{if(tr(n,i))return;cF.set(i),t.uniformMatrix3fv(this.addr,!1,cF),nr(n,i)}}function hue(t,e){const n=this.cache,i=e.elements;if(i===void 0){if(tr(n,e))return;t.uniformMatrix4fv(this.addr,!1,e),nr(n,e)}else{if(tr(n,i))return;lF.set(i),t.uniformMatrix4fv(this.addr,!1,lF),nr(n,i)}}function pue(t,e){const n=this.cache;n[0]!==e&&(t.uniform1i(this.addr,e),n[0]=e)}function mue(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(tr(n,e))return;t.uniform2iv(this.addr,e),nr(n,e)}}function gue(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(tr(n,e))return;t.uniform3iv(this.addr,e),nr(n,e)}}function vue(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(tr(n,e))return;t.uniform4iv(this.addr,e),nr(n,e)}}function xue(t,e){const n=this.cache;n[0]!==e&&(t.uniform1ui(this.addr,e),n[0]=e)}function yue(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(tr(n,e))return;t.uniform2uiv(this.addr,e),nr(n,e)}}function bue(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(tr(n,e))return;t.uniform3uiv(this.addr,e),nr(n,e)}}function _ue(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(tr(n,e))return;t.uniform4uiv(this.addr,e),nr(n,e)}}function Sue(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?(aF.compareFunction=CG,a=aF):a=JG,n.setTexture2D(e||a,r)}function wue(t,e,n){const i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(t.uniform1i(this.addr,r),i[0]=r),n.setTexture3D(e||e$,r)}function Mue(t,e,n){const i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(t.uniform1i(this.addr,r),i[0]=r),n.setTextureCube(e||t$,r)}function Eue(t,e,n){const i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(t.uniform1i(this.addr,r),i[0]=r),n.setTexture2DArray(e||QG,r)}function Aue(t){switch(t){case 5126:return oue;case 35664:return lue;case 35665:return cue;case 35666:return uue;case 35674:return due;case 35675:return fue;case 35676:return hue;case 5124:case 35670:return pue;case 35667:case 35671:return mue;case 35668:case 35672:return gue;case 35669:case 35673:return vue;case 5125:return xue;case 36294:return yue;case 36295:return bue;case 36296:return _ue;case 35678:case 36198:case 36298:case 36306:case 35682:return Sue;case 35679:case 36299:case 36307:return wue;case 35680:case 36300:case 36308:case 36293:return Mue;case 36289:case 36303:case 36311:case 36292:return Eue}}function Tue(t,e){t.uniform1fv(this.addr,e)}function Cue(t,e){const n=Kp(e,this.size,2);t.uniform2fv(this.addr,n)}function Rue(t,e){const n=Kp(e,this.size,3);t.uniform3fv(this.addr,n)}function Nue(t,e){const n=Kp(e,this.size,4);t.uniform4fv(this.addr,n)}function Pue(t,e){const n=Kp(e,this.size,4);t.uniformMatrix2fv(this.addr,!1,n)}function Due(t,e){const n=Kp(e,this.size,9);t.uniformMatrix3fv(this.addr,!1,n)}function Oue(t,e){const n=Kp(e,this.size,16);t.uniformMatrix4fv(this.addr,!1,n)}function Lue(t,e){t.uniform1iv(this.addr,e)}function kue(t,e){t.uniform2iv(this.addr,e)}function Iue(t,e){t.uniform3iv(this.addr,e)}function Uue(t,e){t.uniform4iv(this.addr,e)}function Fue(t,e){t.uniform1uiv(this.addr,e)}function zue(t,e){t.uniform2uiv(this.addr,e)}function Bue(t,e){t.uniform3uiv(this.addr,e)}function jue(t,e){t.uniform4uiv(this.addr,e)}function Hue(t,e,n){const i=this.cache,r=e.length,a=uS(n,r);tr(i,a)||(t.uniform1iv(this.addr,a),nr(i,a));for(let s=0;s!==r;++s)n.setTexture2D(e[s]||JG,a[s])}function Vue(t,e,n){const i=this.cache,r=e.length,a=uS(n,r);tr(i,a)||(t.uniform1iv(this.addr,a),nr(i,a));for(let s=0;s!==r;++s)n.setTexture3D(e[s]||e$,a[s])}function Gue(t,e,n){const i=this.cache,r=e.length,a=uS(n,r);tr(i,a)||(t.uniform1iv(this.addr,a),nr(i,a));for(let s=0;s!==r;++s)n.setTextureCube(e[s]||t$,a[s])}function $ue(t,e,n){const i=this.cache,r=e.length,a=uS(n,r);tr(i,a)||(t.uniform1iv(this.addr,a),nr(i,a));for(let s=0;s!==r;++s)n.setTexture2DArray(e[s]||QG,a[s])}function Wue(t){switch(t){case 5126:return Tue;case 35664:return Cue;case 35665:return Rue;case 35666:return Nue;case 35674:return Pue;case 35675:return Due;case 35676:return Oue;case 5124:case 35670:return Lue;case 35667:case 35671:return kue;case 35668:case 35672:return Iue;case 35669:case 35673:return Uue;case 5125:return Fue;case 36294:return zue;case 36295:return Bue;case 36296:return jue;case 35678:case 36198:case 36298:case 36306:case 35682:return Hue;case 35679:case 36299:case 36307:return Vue;case 35680:case 36300:case 36308:case 36293:return Gue;case 36289:case 36303:case 36311:case 36292:return $ue}}let que=class{constructor(e,n,i){this.id=e,this.addr=i,this.cache=[],this.type=n.type,this.setValue=Aue(n.type)}},Xue=class{constructor(e,n,i){this.id=e,this.addr=i,this.cache=[],this.type=n.type,this.size=n.size,this.setValue=Wue(n.type)}},Yue=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 pA=/(\w+)(\])?(\[|\.)?/g;function dF(t,e){t.seq.push(e),t.map[e.id]=e}function Kue(t,e,n){const i=t.name,r=i.length;for(pA.lastIndex=0;;){const a=pA.exec(i),s=pA.lastIndex;let o=a[1];const l=a[2]==="]",c=a[3];if(l&&(o=o|0),c===void 0||c==="["&&s+2===r){dF(n,c===void 0?new que(o,t,e):new Xue(o,t,e));break}else{let f=n.map[o];f===void 0&&(f=new Yue(o),dF(n,f)),n=f}}}let Ub=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);Kue(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 fF(t,e,n){const i=t.createShader(e);return t.shaderSource(i,n),t.compileShader(i),i}const Zue=37297;let Jue=0;function Que(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 hF=new nn;function ede(t){xn._getMatrix(hF,xn.workingColorSpace,t);const e=`mat3( ${hF.elements.map(n=>n.toFixed(4))} )`;switch(xn.getTransfer(t)){case i_:return[e,"LinearTransferOETF"];case On:return[e,"sRGBTransferOETF"];default:return Ht("WebGLProgram: Unsupported color space: ",t),[e,"LinearTransferOETF"]}}function pF(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. `+Que(t.getShaderSource(e),o)}else return a}function tde(t,e){const n=ede(e);return[`vec4 ${t}( vec4 value ) {`,` return ${n[1]}( vec4( value.rgb * ${n[0]}, value.a ) );`,"}"].join(`
  3754. `)}function nde(t,e){let n;switch(e){case Qae:n="Linear";break;case ese:n="Reinhard";break;case tse:n="Cineon";break;case nse:n="ACESFilmic";break;case rse:n="AgX";break;case ase:n="Neutral";break;case ise:n="Custom";break;default:Ht("WebGLProgram: Unsupported toneMapping:",e),n="Linear"}return"vec3 "+t+"( vec3 color ) { return "+n+"ToneMapping( color ); }"}const yy=new Ge;function ide(){xn.getLuminanceCoefficients(yy);const t=yy.x.toFixed(4),e=yy.y.toFixed(4),n=yy.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",` const vec3 weights = vec3( ${t}, ${e}, ${n} );`," return dot( weights, rgb );","}"].join(`
  3755. `)}function rde(t){return[t.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",t.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(Dg).join(`
  3756. `)}function ade(t){const e=[];for(const n in t){const i=t[n];i!==!1&&e.push("#define "+n+" "+i)}return e.join(`
  3757. `)}function sde(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 Dg(t){return t!==""}function mF(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 gF(t,e){return t.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const ode=/^[ \t]*#include +<([\w\d./]+)>/gm;function bR(t){return t.replace(ode,cde)}const lde=new Map;function cde(t,e){let n=Zt[e];if(n===void 0){const i=lde.get(e);if(i!==void 0)n=Zt[i],Ht('WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,i);else throw new Error("Can not resolve #include <"+e+">")}return bR(n)}const ude=/#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(ude,dde)}function dde(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 xF(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 fde(t){let e="SHADOWMAP_TYPE_BASIC";return t.shadowMapType===xG?e="SHADOWMAP_TYPE_PCF":t.shadowMapType===Dae?e="SHADOWMAP_TYPE_PCF_SOFT":t.shadowMapType===Cl&&(e="SHADOWMAP_TYPE_VSM"),e}function hde(t){let e="ENVMAP_TYPE_CUBE";if(t.envMap)switch(t.envMapMode){case xp:case yp:e="ENVMAP_TYPE_CUBE";break;case oS:e="ENVMAP_TYPE_CUBE_UV";break}return e}function pde(t){let e="ENVMAP_MODE_REFLECTION";if(t.envMap)switch(t.envMapMode){case yp:e="ENVMAP_MODE_REFRACTION";break}return e}function mde(t){let e="ENVMAP_BLENDING_NONE";if(t.envMap)switch(t.combine){case LN:e="ENVMAP_BLENDING_MULTIPLY";break;case Zae:e="ENVMAP_BLENDING_MIX";break;case Jae:e="ENVMAP_BLENDING_ADD";break}return e}function gde(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 vde(t,e,n,i){const r=t.getContext(),a=n.defines;let s=n.vertexShader,o=n.fragmentShader;const l=fde(n),c=hde(n),d=pde(n),f=mde(n),p=gde(n),m=rde(n),y=ade(a),b=r.createProgram();let x,v,M=n.glslVersion?"#version "+n.glslVersion+`
  3778. `:"";n.isRawShaderMaterial?(x=["#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,y].filter(Dg).join(`
  3779. `),x.length>0&&(x+=`
  3780. `),v=["#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,y].filter(Dg).join(`
  3781. `),v.length>0&&(v+=`
  3782. `)):(x=[xF(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(Dg).join(`
  3784. `),v=[xF(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:"",p?"#define CUBEUV_TEXEL_WIDTH "+p.texelWidth:"",p?"#define CUBEUV_TEXEL_HEIGHT "+p.texelHeight:"",p?"#define CUBEUV_MAX_MIP "+p.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!==bu?"#define TONE_MAPPING":"",n.toneMapping!==bu?Zt.tonemapping_pars_fragment:"",n.toneMapping!==bu?nde("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",n.opaque?"#define OPAQUE":"",Zt.colorspace_pars_fragment,tde("linearToOutputTexel",n.outputColorSpace),ide(),n.useDepthPacking?"#define DEPTH_PACKING "+n.depthPacking:"",`
  3785. `].filter(Dg).join(`
  3786. `)),s=bR(s),s=mF(s,n),s=gF(s,n),o=bR(o),o=mF(o,n),o=gF(o,n),s=vF(s),o=vF(o),n.isRawShaderMaterial!==!0&&(M=`#version 300 es
  3787. `,x=[m,"#define attribute in","#define varying out","#define texture2D texture"].join(`
  3788. `)+`
  3789. `+x,v=["#define varying in",n.glslVersion===E4?"":"layout(location = 0) out highp vec4 pc_fragColor;",n.glslVersion===E4?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join(`
  3790. `)+`
  3791. `+v);const w=M+x+s,E=M+v+o,T=fF(r,r.VERTEX_SHADER,w),P=fF(r,r.FRAGMENT_SHADER,E);r.attachShader(b,T),r.attachShader(b,P),n.index0AttributeName!==void 0?r.bindAttribLocation(b,0,n.index0AttributeName):n.morphTargets===!0&&r.bindAttribLocation(b,0,"position"),r.linkProgram(b);function R(B){if(t.debug.checkShaderErrors){const I=r.getProgramInfoLog(b)||"",W=r.getShaderInfoLog(T)||"",L=r.getShaderInfoLog(P)||"",$=I.trim(),q=W.trim(),G=L.trim();let Y=!0,Q=!0;if(r.getProgramParameter(b,r.LINK_STATUS)===!1)if(Y=!1,typeof t.debug.onShaderError=="function")t.debug.onShaderError(r,b,T,P);else{const se=pF(r,T,"vertex"),H=pF(r,P,"fragment");Ci("THREE.WebGLProgram: Shader Error "+r.getError()+" - VALIDATE_STATUS "+r.getProgramParameter(b,r.VALIDATE_STATUS)+`
  3792. Material Name: `+B.name+`
  3793. Material Type: `+B.type+`
  3794. Program Info Log: `+$+`
  3795. `+se+`
  3796. `+H)}else $!==""?Ht("WebGLProgram: Program Info Log:",$):(q===""||G==="")&&(Q=!1);Q&&(B.diagnostics={runnable:Y,programLog:$,vertexShader:{log:q,prefix:x},fragmentShader:{log:G,prefix:v}})}r.deleteShader(T),r.deleteShader(P),U=new Ub(r,b),N=sde(r,b)}let U;this.getUniforms=function(){return U===void 0&&R(this),U};let N;this.getAttributes=function(){return N===void 0&&R(this),N};let O=n.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return O===!1&&(O=r.getProgramParameter(b,Zue)),O},this.destroy=function(){i.releaseStatesOfProgram(this),r.deleteProgram(b),this.program=void 0},this.type=n.shaderType,this.name=n.shaderName,this.id=Jue++,this.cacheKey=e,this.usedTimes=1,this.program=b,this.vertexShader=T,this.fragmentShader=P,this}let xde=0,yde=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 bde(e),n.set(e,i)),i}},bde=class{constructor(e){this.id=xde++,this.code=e,this.usedTimes=0}};function _de(t,e,n,i,r,a,s){const o=new IG,l=new yde,c=new Set,d=[],f=r.logarithmicDepthBuffer,p=r.vertexTextures;let m=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 b(N){return c.add(N),N===0?"uv":`uv${N}`}function x(N,O,B,I,W){const L=I.fog,$=W.geometry,q=N.isMeshStandardMaterial?I.environment:null,G=(N.isMeshStandardMaterial?n:e).get(N.envMap||q),Y=G&&G.mapping===oS?G.image.height:null,Q=y[N.type];N.precision!==null&&(m=r.getMaxPrecision(N.precision),m!==N.precision&&Ht("WebGLProgram.getParameters:",N.precision,"not supported, using",m,"instead."));const se=$.morphAttributes.position||$.morphAttributes.normal||$.morphAttributes.color,H=se!==void 0?se.length:0;let X=0;$.morphAttributes.position!==void 0&&(X=1),$.morphAttributes.normal!==void 0&&(X=2),$.morphAttributes.color!==void 0&&(X=3);let re,ce,ye,me;if(Q){const Ct=No[Q];re=Ct.vertexShader,ce=Ct.fragmentShader}else re=N.vertexShader,ce=N.fragmentShader,l.update(N),ye=l.getVertexShaderID(N),me=l.getFragmentShaderID(N);const be=t.getRenderTarget(),De=t.state.buffers.depth.getReversed(),he=W.isInstancedMesh===!0,Ae=W.isBatchedMesh===!0,Be=!!N.map,le=!!N.matcap,ut=!!G,z=!!N.aoMap,V=!!N.lightMap,ne=!!N.bumpMap,J=!!N.normalMap,ee=!!N.displacementMap,ae=!!N.emissiveMap,ie=!!N.metalnessMap,we=!!N.roughnessMap,ve=N.anisotropy>0,F=N.clearcoat>0,k=N.dispersion>0,K=N.iridescence>0,pe=N.sheen>0,xe=N.transmission>0,fe=ve&&!!N.anisotropyMap,Ke=F&&!!N.clearcoatMap,ke=F&&!!N.clearcoatNormalMap,$e=F&&!!N.clearcoatRoughnessMap,rt=K&&!!N.iridescenceMap,Ue=K&&!!N.iridescenceThicknessMap,Pe=pe&&!!N.sheenColorMap,dt=pe&&!!N.sheenRoughnessMap,et=!!N.specularMap,Qe=!!N.specularColorMap,st=!!N.specularIntensityMap,ue=xe&&!!N.transmissionMap,tt=xe&&!!N.thicknessMap,de=!!N.gradientMap,Le=!!N.alphaMap,Ee=N.alphaTest>0,ge=!!N.alphaHash,je=!!N.extensions;let at=bu;N.toneMapped&&(be===null||be.isXRRenderTarget===!0)&&(at=t.toneMapping);const yt={shaderID:Q,shaderType:N.type,shaderName:N.name,vertexShader:re,fragmentShader:ce,defines:N.defines,customVertexShaderID:ye,customFragmentShaderID:me,isRawShaderMaterial:N.isRawShaderMaterial===!0,glslVersion:N.glslVersion,precision:m,batching:Ae,batchingColor:Ae&&W._colorsTexture!==null,instancing:he,instancingColor:he&&W.instanceColor!==null,instancingMorph:he&&W.morphTexture!==null,supportsVertexTextures:p,outputColorSpace:be===null?t.outputColorSpace:be.isXRRenderTarget===!0?be.texture.colorSpace:bp,alphaToCoverage:!!N.alphaToCoverage,map:Be,matcap:le,envMap:ut,envMapMode:ut&&G.mapping,envMapCubeUVHeight:Y,aoMap:z,lightMap:V,bumpMap:ne,normalMap:J,displacementMap:p&&ee,emissiveMap:ae,normalMapObjectSpace:J&&N.normalMapType===cse,normalMapTangentSpace:J&&N.normalMapType===TG,metalnessMap:ie,roughnessMap:we,anisotropy:ve,anisotropyMap:fe,clearcoat:F,clearcoatMap:Ke,clearcoatNormalMap:ke,clearcoatRoughnessMap:$e,dispersion:k,iridescence:K,iridescenceMap:rt,iridescenceThicknessMap:Ue,sheen:pe,sheenColorMap:Pe,sheenRoughnessMap:dt,specularMap:et,specularColorMap:Qe,specularIntensityMap:st,transmission:xe,transmissionMap:ue,thicknessMap:tt,gradientMap:de,opaque:N.transparent===!1&&N.blending===ap&&N.alphaToCoverage===!1,alphaMap:Le,alphaTest:Ee,alphaHash:ge,combine:N.combine,mapUv:Be&&b(N.map.channel),aoMapUv:z&&b(N.aoMap.channel),lightMapUv:V&&b(N.lightMap.channel),bumpMapUv:ne&&b(N.bumpMap.channel),normalMapUv:J&&b(N.normalMap.channel),displacementMapUv:ee&&b(N.displacementMap.channel),emissiveMapUv:ae&&b(N.emissiveMap.channel),metalnessMapUv:ie&&b(N.metalnessMap.channel),roughnessMapUv:we&&b(N.roughnessMap.channel),anisotropyMapUv:fe&&b(N.anisotropyMap.channel),clearcoatMapUv:Ke&&b(N.clearcoatMap.channel),clearcoatNormalMapUv:ke&&b(N.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:$e&&b(N.clearcoatRoughnessMap.channel),iridescenceMapUv:rt&&b(N.iridescenceMap.channel),iridescenceThicknessMapUv:Ue&&b(N.iridescenceThicknessMap.channel),sheenColorMapUv:Pe&&b(N.sheenColorMap.channel),sheenRoughnessMapUv:dt&&b(N.sheenRoughnessMap.channel),specularMapUv:et&&b(N.specularMap.channel),specularColorMapUv:Qe&&b(N.specularColorMap.channel),specularIntensityMapUv:st&&b(N.specularIntensityMap.channel),transmissionMapUv:ue&&b(N.transmissionMap.channel),thicknessMapUv:tt&&b(N.thicknessMap.channel),alphaMapUv:Le&&b(N.alphaMap.channel),vertexTangents:!!$.attributes.tangent&&(J||ve),vertexColors:N.vertexColors,vertexAlphas:N.vertexColors===!0&&!!$.attributes.color&&$.attributes.color.itemSize===4,pointsUvs:W.isPoints===!0&&!!$.attributes.uv&&(Be||Le),fog:!!L,useFog:N.fog===!0,fogExp2:!!L&&L.isFogExp2,flatShading:N.flatShading===!0&&N.wireframe===!1,sizeAttenuation:N.sizeAttenuation===!0,logarithmicDepthBuffer:f,reversedDepthBuffer:De,skinning:W.isSkinnedMesh===!0,morphTargets:$.morphAttributes.position!==void 0,morphNormals:$.morphAttributes.normal!==void 0,morphColors:$.morphAttributes.color!==void 0,morphTargetsCount:H,morphTextureStride:X,numDirLights:O.directional.length,numPointLights:O.point.length,numSpotLights:O.spot.length,numSpotLightMaps:O.spotLightMap.length,numRectAreaLights:O.rectArea.length,numHemiLights:O.hemi.length,numDirLightShadows:O.directionalShadowMap.length,numPointLightShadows:O.pointShadowMap.length,numSpotLightShadows:O.spotShadowMap.length,numSpotLightShadowsWithMaps:O.numSpotLightShadowsWithMaps,numLightProbes:O.numLightProbes,numClippingPlanes:s.numPlanes,numClipIntersection:s.numIntersection,dithering:N.dithering,shadowMapEnabled:t.shadowMap.enabled&&B.length>0,shadowMapType:t.shadowMap.type,toneMapping:at,decodeVideoTexture:Be&&N.map.isVideoTexture===!0&&xn.getTransfer(N.map.colorSpace)===On,decodeVideoTextureEmissive:ae&&N.emissiveMap.isVideoTexture===!0&&xn.getTransfer(N.emissiveMap.colorSpace)===On,premultipliedAlpha:N.premultipliedAlpha,doubleSided:N.side===Po,flipSided:N.side===Pa,useDepthPacking:N.depthPacking>=0,depthPacking:N.depthPacking||0,index0AttributeName:N.index0AttributeName,extensionClipCullDistance:je&&N.extensions.clipCullDistance===!0&&i.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(je&&N.extensions.multiDraw===!0||Ae)&&i.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:i.has("KHR_parallel_shader_compile"),customProgramCacheKey:N.customProgramCacheKey()};return yt.vertexUv1s=c.has(1),yt.vertexUv2s=c.has(2),yt.vertexUv3s=c.has(3),c.clear(),yt}function v(N){const O=[];if(N.shaderID?O.push(N.shaderID):(O.push(N.customVertexShaderID),O.push(N.customFragmentShaderID)),N.defines!==void 0)for(const B in N.defines)O.push(B),O.push(N.defines[B]);return N.isRawShaderMaterial===!1&&(M(O,N),w(O,N),O.push(t.outputColorSpace)),O.push(N.customProgramCacheKey),O.join()}function M(N,O){N.push(O.precision),N.push(O.outputColorSpace),N.push(O.envMapMode),N.push(O.envMapCubeUVHeight),N.push(O.mapUv),N.push(O.alphaMapUv),N.push(O.lightMapUv),N.push(O.aoMapUv),N.push(O.bumpMapUv),N.push(O.normalMapUv),N.push(O.displacementMapUv),N.push(O.emissiveMapUv),N.push(O.metalnessMapUv),N.push(O.roughnessMapUv),N.push(O.anisotropyMapUv),N.push(O.clearcoatMapUv),N.push(O.clearcoatNormalMapUv),N.push(O.clearcoatRoughnessMapUv),N.push(O.iridescenceMapUv),N.push(O.iridescenceThicknessMapUv),N.push(O.sheenColorMapUv),N.push(O.sheenRoughnessMapUv),N.push(O.specularMapUv),N.push(O.specularColorMapUv),N.push(O.specularIntensityMapUv),N.push(O.transmissionMapUv),N.push(O.thicknessMapUv),N.push(O.combine),N.push(O.fogExp2),N.push(O.sizeAttenuation),N.push(O.morphTargetsCount),N.push(O.morphAttributeCount),N.push(O.numDirLights),N.push(O.numPointLights),N.push(O.numSpotLights),N.push(O.numSpotLightMaps),N.push(O.numHemiLights),N.push(O.numRectAreaLights),N.push(O.numDirLightShadows),N.push(O.numPointLightShadows),N.push(O.numSpotLightShadows),N.push(O.numSpotLightShadowsWithMaps),N.push(O.numLightProbes),N.push(O.shadowMapType),N.push(O.toneMapping),N.push(O.numClippingPlanes),N.push(O.numClipIntersection),N.push(O.depthPacking)}function w(N,O){o.disableAll(),O.supportsVertexTextures&&o.enable(0),O.instancing&&o.enable(1),O.instancingColor&&o.enable(2),O.instancingMorph&&o.enable(3),O.matcap&&o.enable(4),O.envMap&&o.enable(5),O.normalMapObjectSpace&&o.enable(6),O.normalMapTangentSpace&&o.enable(7),O.clearcoat&&o.enable(8),O.iridescence&&o.enable(9),O.alphaTest&&o.enable(10),O.vertexColors&&o.enable(11),O.vertexAlphas&&o.enable(12),O.vertexUv1s&&o.enable(13),O.vertexUv2s&&o.enable(14),O.vertexUv3s&&o.enable(15),O.vertexTangents&&o.enable(16),O.anisotropy&&o.enable(17),O.alphaHash&&o.enable(18),O.batching&&o.enable(19),O.dispersion&&o.enable(20),O.batchingColor&&o.enable(21),O.gradientMap&&o.enable(22),N.push(o.mask),o.disableAll(),O.fog&&o.enable(0),O.useFog&&o.enable(1),O.flatShading&&o.enable(2),O.logarithmicDepthBuffer&&o.enable(3),O.reversedDepthBuffer&&o.enable(4),O.skinning&&o.enable(5),O.morphTargets&&o.enable(6),O.morphNormals&&o.enable(7),O.morphColors&&o.enable(8),O.premultipliedAlpha&&o.enable(9),O.shadowMapEnabled&&o.enable(10),O.doubleSided&&o.enable(11),O.flipSided&&o.enable(12),O.useDepthPacking&&o.enable(13),O.dithering&&o.enable(14),O.transmission&&o.enable(15),O.sheen&&o.enable(16),O.opaque&&o.enable(17),O.pointsUvs&&o.enable(18),O.decodeVideoTexture&&o.enable(19),O.decodeVideoTextureEmissive&&o.enable(20),O.alphaToCoverage&&o.enable(21),N.push(o.mask)}function E(N){const O=y[N.type];let B;if(O){const I=No[O];B=zse.clone(I.uniforms)}else B=N.uniforms;return B}function T(N,O){let B;for(let I=0,W=d.length;I<W;I++){const L=d[I];if(L.cacheKey===O){B=L,++B.usedTimes;break}}return B===void 0&&(B=new vde(t,O,N,a),d.push(B)),B}function P(N){if(--N.usedTimes===0){const O=d.indexOf(N);d[O]=d[d.length-1],d.pop(),N.destroy()}}function R(N){l.remove(N)}function U(){l.dispose()}return{getParameters:x,getProgramCacheKey:v,getUniforms:E,acquireProgram:T,releaseProgram:P,releaseShaderCache:R,programs:d,dispose:U}}function Sde(){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 wde(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 yF(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 bF(){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,p,m,y,b,x){let v=t[e];return v===void 0?(v={id:f.id,object:f,geometry:p,material:m,groupOrder:y,renderOrder:f.renderOrder,z:b,group:x},t[e]=v):(v.id=f.id,v.object=f,v.geometry=p,v.material=m,v.groupOrder=y,v.renderOrder=f.renderOrder,v.z=b,v.group=x),e++,v}function o(f,p,m,y,b,x){const v=s(f,p,m,y,b,x);m.transmission>0?i.push(v):m.transparent===!0?r.push(v):n.push(v)}function l(f,p,m,y,b,x){const v=s(f,p,m,y,b,x);m.transmission>0?i.unshift(v):m.transparent===!0?r.unshift(v):n.unshift(v)}function c(f,p){n.length>1&&n.sort(f||wde),i.length>1&&i.sort(p||yF),r.length>1&&r.sort(p||yF)}function d(){for(let f=e,p=t.length;f<p;f++){const m=t[f];if(m.id===null)break;m.id=null,m.object=null,m.geometry=null,m.material=null,m.group=null}}return{opaque:n,transmissive:i,transparent:r,init:a,push:o,unshift:l,finish:d,sort:c}}function Mde(){let t=new WeakMap;function e(i,r){const a=t.get(i);let s;return a===void 0?(s=new bF,t.set(i,[s])):r>=a.length?(s=new bF,a.push(s)):s=a[r],s}function n(){t=new WeakMap}return{get:e,dispose:n}}function Ede(){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 Ge,color:new fn};break;case"SpotLight":n={position:new Ge,direction:new Ge,color:new fn,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new Ge,color:new fn,distance:0,decay:0};break;case"HemisphereLight":n={direction:new Ge,skyColor:new fn,groundColor:new fn};break;case"RectAreaLight":n={color:new fn,position:new Ge,halfWidth:new Ge,halfHeight:new Ge};break}return t[e.id]=n,n}}}function Ade(){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 Qt};break;case"SpotLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Qt};break;case"PointLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Qt,shadowCameraNear:1,shadowCameraFar:1e3};break}return t[e.id]=n,n}}}let Tde=0;function Cde(t,e){return(e.castShadow?2:0)-(t.castShadow?2:0)+(e.map?1:0)-(t.map?1:0)}function Rde(t){const e=new Ede,n=Ade(),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 Ge);const r=new Ge,a=new Gi,s=new Gi;function o(c){let d=0,f=0,p=0;for(let N=0;N<9;N++)i.probe[N].set(0,0,0);let m=0,y=0,b=0,x=0,v=0,M=0,w=0,E=0,T=0,P=0,R=0;c.sort(Cde);for(let N=0,O=c.length;N<O;N++){const B=c[N],I=B.color,W=B.intensity,L=B.distance,$=B.shadow&&B.shadow.map?B.shadow.map.texture:null;if(B.isAmbientLight)d+=I.r*W,f+=I.g*W,p+=I.b*W;else if(B.isLightProbe){for(let q=0;q<9;q++)i.probe[q].addScaledVector(B.sh.coefficients[q],W);R++}else if(B.isDirectionalLight){const q=e.get(B);if(q.color.copy(B.color).multiplyScalar(B.intensity),B.castShadow){const G=B.shadow,Y=n.get(B);Y.shadowIntensity=G.intensity,Y.shadowBias=G.bias,Y.shadowNormalBias=G.normalBias,Y.shadowRadius=G.radius,Y.shadowMapSize=G.mapSize,i.directionalShadow[m]=Y,i.directionalShadowMap[m]=$,i.directionalShadowMatrix[m]=B.shadow.matrix,M++}i.directional[m]=q,m++}else if(B.isSpotLight){const q=e.get(B);q.position.setFromMatrixPosition(B.matrixWorld),q.color.copy(I).multiplyScalar(W),q.distance=L,q.coneCos=Math.cos(B.angle),q.penumbraCos=Math.cos(B.angle*(1-B.penumbra)),q.decay=B.decay,i.spot[b]=q;const G=B.shadow;if(B.map&&(i.spotLightMap[T]=B.map,T++,G.updateMatrices(B),B.castShadow&&P++),i.spotLightMatrix[b]=G.matrix,B.castShadow){const Y=n.get(B);Y.shadowIntensity=G.intensity,Y.shadowBias=G.bias,Y.shadowNormalBias=G.normalBias,Y.shadowRadius=G.radius,Y.shadowMapSize=G.mapSize,i.spotShadow[b]=Y,i.spotShadowMap[b]=$,E++}b++}else if(B.isRectAreaLight){const q=e.get(B);q.color.copy(I).multiplyScalar(W),q.halfWidth.set(B.width*.5,0,0),q.halfHeight.set(0,B.height*.5,0),i.rectArea[x]=q,x++}else if(B.isPointLight){const q=e.get(B);if(q.color.copy(B.color).multiplyScalar(B.intensity),q.distance=B.distance,q.decay=B.decay,B.castShadow){const G=B.shadow,Y=n.get(B);Y.shadowIntensity=G.intensity,Y.shadowBias=G.bias,Y.shadowNormalBias=G.normalBias,Y.shadowRadius=G.radius,Y.shadowMapSize=G.mapSize,Y.shadowCameraNear=G.camera.near,Y.shadowCameraFar=G.camera.far,i.pointShadow[y]=Y,i.pointShadowMap[y]=$,i.pointShadowMatrix[y]=B.shadow.matrix,w++}i.point[y]=q,y++}else if(B.isHemisphereLight){const q=e.get(B);q.skyColor.copy(B.color).multiplyScalar(W),q.groundColor.copy(B.groundColor).multiplyScalar(W),i.hemi[v]=q,v++}}x>0&&(t.has("OES_texture_float_linear")===!0?(i.rectAreaLTC1=_t.LTC_FLOAT_1,i.rectAreaLTC2=_t.LTC_FLOAT_2):(i.rectAreaLTC1=_t.LTC_HALF_1,i.rectAreaLTC2=_t.LTC_HALF_2)),i.ambient[0]=d,i.ambient[1]=f,i.ambient[2]=p;const U=i.hash;(U.directionalLength!==m||U.pointLength!==y||U.spotLength!==b||U.rectAreaLength!==x||U.hemiLength!==v||U.numDirectionalShadows!==M||U.numPointShadows!==w||U.numSpotShadows!==E||U.numSpotMaps!==T||U.numLightProbes!==R)&&(i.directional.length=m,i.spot.length=b,i.rectArea.length=x,i.point.length=y,i.hemi.length=v,i.directionalShadow.length=M,i.directionalShadowMap.length=M,i.pointShadow.length=w,i.pointShadowMap.length=w,i.spotShadow.length=E,i.spotShadowMap.length=E,i.directionalShadowMatrix.length=M,i.pointShadowMatrix.length=w,i.spotLightMatrix.length=E+T-P,i.spotLightMap.length=T,i.numSpotLightShadowsWithMaps=P,i.numLightProbes=R,U.directionalLength=m,U.pointLength=y,U.spotLength=b,U.rectAreaLength=x,U.hemiLength=v,U.numDirectionalShadows=M,U.numPointShadows=w,U.numSpotShadows=E,U.numSpotMaps=T,U.numLightProbes=R,i.version=Tde++)}function l(c,d){let f=0,p=0,m=0,y=0,b=0;const x=d.matrixWorldInverse;for(let v=0,M=c.length;v<M;v++){const w=c[v];if(w.isDirectionalLight){const E=i.directional[f];E.direction.setFromMatrixPosition(w.matrixWorld),r.setFromMatrixPosition(w.target.matrixWorld),E.direction.sub(r),E.direction.transformDirection(x),f++}else if(w.isSpotLight){const E=i.spot[m];E.position.setFromMatrixPosition(w.matrixWorld),E.position.applyMatrix4(x),E.direction.setFromMatrixPosition(w.matrixWorld),r.setFromMatrixPosition(w.target.matrixWorld),E.direction.sub(r),E.direction.transformDirection(x),m++}else if(w.isRectAreaLight){const E=i.rectArea[y];E.position.setFromMatrixPosition(w.matrixWorld),E.position.applyMatrix4(x),s.identity(),a.copy(w.matrixWorld),a.premultiply(x),s.extractRotation(a),E.halfWidth.set(w.width*.5,0,0),E.halfHeight.set(0,w.height*.5,0),E.halfWidth.applyMatrix4(s),E.halfHeight.applyMatrix4(s),y++}else if(w.isPointLight){const E=i.point[p];E.position.setFromMatrixPosition(w.matrixWorld),E.position.applyMatrix4(x),p++}else if(w.isHemisphereLight){const E=i.hemi[b];E.direction.setFromMatrixPosition(w.matrixWorld),E.direction.transformDirection(x),b++}}}return{setup:o,setupView:l,state:i}}function _F(t){const e=new Rde(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 Nde(t){let e=new WeakMap;function n(r,a=0){const s=e.get(r);let o;return s===void 0?(o=new _F(t),e.set(r,[o])):a>=s.length?(o=new _F(t),s.push(o)):o=s[a],o}function i(){e=new WeakMap}return{get:n,dispose:i}}const Pde=`void main() {
  3797. gl_Position = vec4( position, 1.0 );
  3798. }`,Dde=`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 Ode(t,e,n){let i=new WN;const r=new Qt,a=new Qt,s=new Bi,o=new Qse({depthPacking:lse}),l=new eoe,c={},d=n.maxTextureSize,f={[Ru]:Pa,[Pa]:Ru,[Po]:Po},p=new Ql({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Qt},radius:{value:4}},vertexShader:Pde,fragmentShader:Dde}),m=p.clone();m.defines.HORIZONTAL_PASS=1;const y=new Yo;y.setAttribute("position",new Is(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const b=new Bo(y,p),x=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=xG;let v=this.type;this.render=function(P,R,U){if(x.enabled===!1||x.autoUpdate===!1&&x.needsUpdate===!1||P.length===0)return;const N=t.getRenderTarget(),O=t.getActiveCubeFace(),B=t.getActiveMipmapLevel(),I=t.state;I.setBlending(Gl),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=v!==Cl&&this.type===Cl,L=v===Cl&&this.type!==Cl;for(let $=0,q=P.length;$<q;$++){const G=P[$],Y=G.shadow;if(Y===void 0){Ht("WebGLShadowMap:",G,"has no shadow.");continue}if(Y.autoUpdate===!1&&Y.needsUpdate===!1)continue;r.copy(Y.mapSize);const Q=Y.getFrameExtents();if(r.multiply(Q),a.copy(Y.mapSize),(r.x>d||r.y>d)&&(r.x>d&&(a.x=Math.floor(d/Q.x),r.x=a.x*Q.x,Y.mapSize.x=a.x),r.y>d&&(a.y=Math.floor(d/Q.y),r.y=a.y*Q.y,Y.mapSize.y=a.y)),Y.map===null||W===!0||L===!0){const H=this.type!==Cl?{minFilter:ns,magFilter:ns}:{};Y.map!==null&&Y.map.dispose(),Y.map=new of(r.x,r.y,H),Y.map.texture.name=G.name+".shadowMap",Y.camera.updateProjectionMatrix()}t.setRenderTarget(Y.map),t.clear();const se=Y.getViewportCount();for(let H=0;H<se;H++){const X=Y.getViewport(H);s.set(a.x*X.x,a.y*X.y,a.x*X.z,a.y*X.w),I.viewport(s),Y.updateMatrices(G,H),i=Y.getFrustum(),E(R,U,Y.camera,G,this.type)}Y.isPointLightShadow!==!0&&this.type===Cl&&M(Y,U),Y.needsUpdate=!1}v=this.type,x.needsUpdate=!1,t.setRenderTarget(N,O,B)};function M(P,R){const U=e.update(b);p.defines.VSM_SAMPLES!==P.blurSamples&&(p.defines.VSM_SAMPLES=P.blurSamples,m.defines.VSM_SAMPLES=P.blurSamples,p.needsUpdate=!0,m.needsUpdate=!0),P.mapPass===null&&(P.mapPass=new of(r.x,r.y)),p.uniforms.shadow_pass.value=P.map.texture,p.uniforms.resolution.value=P.mapSize,p.uniforms.radius.value=P.radius,t.setRenderTarget(P.mapPass),t.clear(),t.renderBufferDirect(R,null,U,p,b,null),m.uniforms.shadow_pass.value=P.mapPass.texture,m.uniforms.resolution.value=P.mapSize,m.uniforms.radius.value=P.radius,t.setRenderTarget(P.map),t.clear(),t.renderBufferDirect(R,null,U,m,b,null)}function w(P,R,U,N){let O=null;const B=U.isPointLight===!0?P.customDistanceMaterial:P.customDepthMaterial;if(B!==void 0)O=B;else if(O=U.isPointLight===!0?l:o,t.localClippingEnabled&&R.clipShadows===!0&&Array.isArray(R.clippingPlanes)&&R.clippingPlanes.length!==0||R.displacementMap&&R.displacementScale!==0||R.alphaMap&&R.alphaTest>0||R.map&&R.alphaTest>0||R.alphaToCoverage===!0){const I=O.uuid,W=R.uuid;let L=c[I];L===void 0&&(L={},c[I]=L);let $=L[W];$===void 0&&($=O.clone(),L[W]=$,R.addEventListener("dispose",T)),O=$}if(O.visible=R.visible,O.wireframe=R.wireframe,N===Cl?O.side=R.shadowSide!==null?R.shadowSide:R.side:O.side=R.shadowSide!==null?R.shadowSide:f[R.side],O.alphaMap=R.alphaMap,O.alphaTest=R.alphaToCoverage===!0?.5:R.alphaTest,O.map=R.map,O.clipShadows=R.clipShadows,O.clippingPlanes=R.clippingPlanes,O.clipIntersection=R.clipIntersection,O.displacementMap=R.displacementMap,O.displacementScale=R.displacementScale,O.displacementBias=R.displacementBias,O.wireframeLinewidth=R.wireframeLinewidth,O.linewidth=R.linewidth,U.isPointLight===!0&&O.isMeshDistanceMaterial===!0){const I=t.properties.get(O);I.light=U}return O}function E(P,R,U,N,O){if(P.visible===!1)return;if(P.layers.test(R.layers)&&(P.isMesh||P.isLine||P.isPoints)&&(P.castShadow||P.receiveShadow&&O===Cl)&&(!P.frustumCulled||i.intersectsObject(P))){P.modelViewMatrix.multiplyMatrices(U.matrixWorldInverse,P.matrixWorld);const W=e.update(P),L=P.material;if(Array.isArray(L)){const $=W.groups;for(let q=0,G=$.length;q<G;q++){const Y=$[q],Q=L[Y.materialIndex];if(Q&&Q.visible){const se=w(P,Q,N,O);P.onBeforeShadow(t,P,R,U,W,se,Y),t.renderBufferDirect(U,null,W,se,P,Y),P.onAfterShadow(t,P,R,U,W,se,Y)}}}else if(L.visible){const $=w(P,L,N,O);P.onBeforeShadow(t,P,R,U,W,$,null),t.renderBufferDirect(U,null,W,$,P,null),P.onAfterShadow(t,P,R,U,W,$,null)}}const I=P.children;for(let W=0,L=I.length;W<L;W++)E(I[W],R,U,N,O)}function T(P){P.target.removeEventListener("dispose",T);for(const U in c){const N=c[U],O=P.target.uuid;O in N&&(N[O].dispose(),delete N[O])}}}const Lde={[O2]:L2,[k2]:F2,[I2]:z2,[vp]:U2,[L2]:O2,[F2]:k2,[z2]:I2,[U2]:vp};function kde(t,e){function n(){let ue=!1;const tt=new Bi;let de=null;const Le=new Bi(0,0,0,0);return{setMask:function(Ee){de!==Ee&&!ue&&(t.colorMask(Ee,Ee,Ee,Ee),de=Ee)},setLocked:function(Ee){ue=Ee},setClear:function(Ee,ge,je,at,yt){yt===!0&&(Ee*=at,ge*=at,je*=at),tt.set(Ee,ge,je,at),Le.equals(tt)===!1&&(t.clearColor(Ee,ge,je,at),Le.copy(tt))},reset:function(){ue=!1,de=null,Le.set(-1,0,0,0)}}}function i(){let ue=!1,tt=!1,de=null,Le=null,Ee=null;return{setReversed:function(ge){if(tt!==ge){const je=e.get("EXT_clip_control");ge?je.clipControlEXT(je.LOWER_LEFT_EXT,je.ZERO_TO_ONE_EXT):je.clipControlEXT(je.LOWER_LEFT_EXT,je.NEGATIVE_ONE_TO_ONE_EXT),tt=ge;const at=Ee;Ee=null,this.setClear(at)}},getReversed:function(){return tt},setTest:function(ge){ge?be(t.DEPTH_TEST):De(t.DEPTH_TEST)},setMask:function(ge){de!==ge&&!ue&&(t.depthMask(ge),de=ge)},setFunc:function(ge){if(tt&&(ge=Lde[ge]),Le!==ge){switch(ge){case O2:t.depthFunc(t.NEVER);break;case L2:t.depthFunc(t.ALWAYS);break;case k2:t.depthFunc(t.LESS);break;case vp:t.depthFunc(t.LEQUAL);break;case I2:t.depthFunc(t.EQUAL);break;case U2:t.depthFunc(t.GEQUAL);break;case F2:t.depthFunc(t.GREATER);break;case z2:t.depthFunc(t.NOTEQUAL);break;default:t.depthFunc(t.LEQUAL)}Le=ge}},setLocked:function(ge){ue=ge},setClear:function(ge){Ee!==ge&&(tt&&(ge=1-ge),t.clearDepth(ge),Ee=ge)},reset:function(){ue=!1,de=null,Le=null,Ee=null,tt=!1}}}function r(){let ue=!1,tt=null,de=null,Le=null,Ee=null,ge=null,je=null,at=null,yt=null;return{setTest:function(Ct){ue||(Ct?be(t.STENCIL_TEST):De(t.STENCIL_TEST))},setMask:function(Ct){tt!==Ct&&!ue&&(t.stencilMask(Ct),tt=Ct)},setFunc:function(Ct,tn,Pt){(de!==Ct||Le!==tn||Ee!==Pt)&&(t.stencilFunc(Ct,tn,Pt),de=Ct,Le=tn,Ee=Pt)},setOp:function(Ct,tn,Pt){(ge!==Ct||je!==tn||at!==Pt)&&(t.stencilOp(Ct,tn,Pt),ge=Ct,je=tn,at=Pt)},setLocked:function(Ct){ue=Ct},setClear:function(Ct){yt!==Ct&&(t.clearStencil(Ct),yt=Ct)},reset:function(){ue=!1,tt=null,de=null,Le=null,Ee=null,ge=null,je=null,at=null,yt=null}}}const a=new n,s=new i,o=new r,l=new WeakMap,c=new WeakMap;let d={},f={},p=new WeakMap,m=[],y=null,b=!1,x=null,v=null,M=null,w=null,E=null,T=null,P=null,R=new fn(0,0,0),U=0,N=!1,O=null,B=null,I=null,W=null,L=null;const $=t.getParameter(t.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let q=!1,G=0;const Y=t.getParameter(t.VERSION);Y.indexOf("WebGL")!==-1?(G=parseFloat(/^WebGL (\d)/.exec(Y)[1]),q=G>=1):Y.indexOf("OpenGL ES")!==-1&&(G=parseFloat(/^OpenGL ES (\d)/.exec(Y)[1]),q=G>=2);let Q=null,se={};const H=t.getParameter(t.SCISSOR_BOX),X=t.getParameter(t.VIEWPORT),re=new Bi().fromArray(H),ce=new Bi().fromArray(X);function ye(ue,tt,de,Le){const Ee=new Uint8Array(4),ge=t.createTexture();t.bindTexture(ue,ge),t.texParameteri(ue,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(ue,t.TEXTURE_MAG_FILTER,t.NEAREST);for(let je=0;je<de;je++)ue===t.TEXTURE_3D||ue===t.TEXTURE_2D_ARRAY?t.texImage3D(tt,0,t.RGBA,1,1,Le,0,t.RGBA,t.UNSIGNED_BYTE,Ee):t.texImage2D(tt+je,0,t.RGBA,1,1,0,t.RGBA,t.UNSIGNED_BYTE,Ee);return ge}const me={};me[t.TEXTURE_2D]=ye(t.TEXTURE_2D,t.TEXTURE_2D,1),me[t.TEXTURE_CUBE_MAP]=ye(t.TEXTURE_CUBE_MAP,t.TEXTURE_CUBE_MAP_POSITIVE_X,6),me[t.TEXTURE_2D_ARRAY]=ye(t.TEXTURE_2D_ARRAY,t.TEXTURE_2D_ARRAY,1,1),me[t.TEXTURE_3D]=ye(t.TEXTURE_3D,t.TEXTURE_3D,1,1),a.setClear(0,0,0,1),s.setClear(1),o.setClear(0),be(t.DEPTH_TEST),s.setFunc(vp),ne(!1),J(y4),be(t.CULL_FACE),z(Gl);function be(ue){d[ue]!==!0&&(t.enable(ue),d[ue]=!0)}function De(ue){d[ue]!==!1&&(t.disable(ue),d[ue]=!1)}function he(ue,tt){return f[ue]!==tt?(t.bindFramebuffer(ue,tt),f[ue]=tt,ue===t.DRAW_FRAMEBUFFER&&(f[t.FRAMEBUFFER]=tt),ue===t.FRAMEBUFFER&&(f[t.DRAW_FRAMEBUFFER]=tt),!0):!1}function Ae(ue,tt){let de=m,Le=!1;if(ue){de=p.get(tt),de===void 0&&(de=[],p.set(tt,de));const Ee=ue.textures;if(de.length!==Ee.length||de[0]!==t.COLOR_ATTACHMENT0){for(let ge=0,je=Ee.length;ge<je;ge++)de[ge]=t.COLOR_ATTACHMENT0+ge;de.length=Ee.length,Le=!0}}else de[0]!==t.BACK&&(de[0]=t.BACK,Le=!0);Le&&t.drawBuffers(de)}function Be(ue){return y!==ue?(t.useProgram(ue),y=ue,!0):!1}const le={[Ed]:t.FUNC_ADD,[Lae]:t.FUNC_SUBTRACT,[kae]:t.FUNC_REVERSE_SUBTRACT};le[Iae]=t.MIN,le[Uae]=t.MAX;const ut={[Fae]:t.ZERO,[zae]:t.ONE,[Bae]:t.SRC_COLOR,[P2]:t.SRC_ALPHA,[Wae]:t.SRC_ALPHA_SATURATE,[Gae]:t.DST_COLOR,[Hae]:t.DST_ALPHA,[jae]:t.ONE_MINUS_SRC_COLOR,[D2]:t.ONE_MINUS_SRC_ALPHA,[$ae]:t.ONE_MINUS_DST_COLOR,[Vae]:t.ONE_MINUS_DST_ALPHA,[qae]:t.CONSTANT_COLOR,[Xae]:t.ONE_MINUS_CONSTANT_COLOR,[Yae]:t.CONSTANT_ALPHA,[Kae]:t.ONE_MINUS_CONSTANT_ALPHA};function z(ue,tt,de,Le,Ee,ge,je,at,yt,Ct){if(ue===Gl){b===!0&&(De(t.BLEND),b=!1);return}if(b===!1&&(be(t.BLEND),b=!0),ue!==Oae){if(ue!==x||Ct!==N){if((v!==Ed||E!==Ed)&&(t.blendEquation(t.FUNC_ADD),v=Ed,E=Ed),Ct)switch(ue){case ap:t.blendFuncSeparate(t.ONE,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA);break;case b4:t.blendFunc(t.ONE,t.ONE);break;case _4:t.blendFuncSeparate(t.ZERO,t.ONE_MINUS_SRC_COLOR,t.ZERO,t.ONE);break;case S4:t.blendFuncSeparate(t.DST_COLOR,t.ONE_MINUS_SRC_ALPHA,t.ZERO,t.ONE);break;default:Ci("WebGLState: Invalid blending: ",ue);break}else switch(ue){case ap:t.blendFuncSeparate(t.SRC_ALPHA,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA);break;case b4:t.blendFuncSeparate(t.SRC_ALPHA,t.ONE,t.ONE,t.ONE);break;case _4:Ci("WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true");break;case S4:Ci("WebGLState: MultiplyBlending requires material.premultipliedAlpha = true");break;default:Ci("WebGLState: Invalid blending: ",ue);break}M=null,w=null,T=null,P=null,R.set(0,0,0),U=0,x=ue,N=Ct}return}Ee=Ee||tt,ge=ge||de,je=je||Le,(tt!==v||Ee!==E)&&(t.blendEquationSeparate(le[tt],le[Ee]),v=tt,E=Ee),(de!==M||Le!==w||ge!==T||je!==P)&&(t.blendFuncSeparate(ut[de],ut[Le],ut[ge],ut[je]),M=de,w=Le,T=ge,P=je),(at.equals(R)===!1||yt!==U)&&(t.blendColor(at.r,at.g,at.b,yt),R.copy(at),U=yt),x=ue,N=!1}function V(ue,tt){ue.side===Po?De(t.CULL_FACE):be(t.CULL_FACE);let de=ue.side===Pa;tt&&(de=!de),ne(de),ue.blending===ap&&ue.transparent===!1?z(Gl):z(ue.blending,ue.blendEquation,ue.blendSrc,ue.blendDst,ue.blendEquationAlpha,ue.blendSrcAlpha,ue.blendDstAlpha,ue.blendColor,ue.blendAlpha,ue.premultipliedAlpha),s.setFunc(ue.depthFunc),s.setTest(ue.depthTest),s.setMask(ue.depthWrite),a.setMask(ue.colorWrite);const Le=ue.stencilWrite;o.setTest(Le),Le&&(o.setMask(ue.stencilWriteMask),o.setFunc(ue.stencilFunc,ue.stencilRef,ue.stencilFuncMask),o.setOp(ue.stencilFail,ue.stencilZFail,ue.stencilZPass)),ae(ue.polygonOffset,ue.polygonOffsetFactor,ue.polygonOffsetUnits),ue.alphaToCoverage===!0?be(t.SAMPLE_ALPHA_TO_COVERAGE):De(t.SAMPLE_ALPHA_TO_COVERAGE)}function ne(ue){O!==ue&&(ue?t.frontFace(t.CW):t.frontFace(t.CCW),O=ue)}function J(ue){ue!==Nae?(be(t.CULL_FACE),ue!==B&&(ue===y4?t.cullFace(t.BACK):ue===Pae?t.cullFace(t.FRONT):t.cullFace(t.FRONT_AND_BACK))):De(t.CULL_FACE),B=ue}function ee(ue){ue!==I&&(q&&t.lineWidth(ue),I=ue)}function ae(ue,tt,de){ue?(be(t.POLYGON_OFFSET_FILL),(W!==tt||L!==de)&&(t.polygonOffset(tt,de),W=tt,L=de)):De(t.POLYGON_OFFSET_FILL)}function ie(ue){ue?be(t.SCISSOR_TEST):De(t.SCISSOR_TEST)}function we(ue){ue===void 0&&(ue=t.TEXTURE0+$-1),Q!==ue&&(t.activeTexture(ue),Q=ue)}function ve(ue,tt,de){de===void 0&&(Q===null?de=t.TEXTURE0+$-1:de=Q);let Le=se[de];Le===void 0&&(Le={type:void 0,texture:void 0},se[de]=Le),(Le.type!==ue||Le.texture!==tt)&&(Q!==de&&(t.activeTexture(de),Q=de),t.bindTexture(ue,tt||me[ue]),Le.type=ue,Le.texture=tt)}function F(){const ue=se[Q];ue!==void 0&&ue.type!==void 0&&(t.bindTexture(ue.type,null),ue.type=void 0,ue.texture=void 0)}function k(){try{t.compressedTexImage2D(...arguments)}catch(ue){ue("WebGLState:",ue)}}function K(){try{t.compressedTexImage3D(...arguments)}catch(ue){ue("WebGLState:",ue)}}function pe(){try{t.texSubImage2D(...arguments)}catch(ue){ue("WebGLState:",ue)}}function xe(){try{t.texSubImage3D(...arguments)}catch(ue){ue("WebGLState:",ue)}}function fe(){try{t.compressedTexSubImage2D(...arguments)}catch(ue){ue("WebGLState:",ue)}}function Ke(){try{t.compressedTexSubImage3D(...arguments)}catch(ue){ue("WebGLState:",ue)}}function ke(){try{t.texStorage2D(...arguments)}catch(ue){ue("WebGLState:",ue)}}function $e(){try{t.texStorage3D(...arguments)}catch(ue){ue("WebGLState:",ue)}}function rt(){try{t.texImage2D(...arguments)}catch(ue){ue("WebGLState:",ue)}}function Ue(){try{t.texImage3D(...arguments)}catch(ue){ue("WebGLState:",ue)}}function Pe(ue){re.equals(ue)===!1&&(t.scissor(ue.x,ue.y,ue.z,ue.w),re.copy(ue))}function dt(ue){ce.equals(ue)===!1&&(t.viewport(ue.x,ue.y,ue.z,ue.w),ce.copy(ue))}function et(ue,tt){let de=c.get(tt);de===void 0&&(de=new WeakMap,c.set(tt,de));let Le=de.get(ue);Le===void 0&&(Le=t.getUniformBlockIndex(tt,ue.name),de.set(ue,Le))}function Qe(ue,tt){const Le=c.get(tt).get(ue);l.get(tt)!==Le&&(t.uniformBlockBinding(tt,Le,ue.__bindingPointIndex),l.set(tt,Le))}function st(){t.disable(t.BLEND),t.disable(t.CULL_FACE),t.disable(t.DEPTH_TEST),t.disable(t.POLYGON_OFFSET_FILL),t.disable(t.SCISSOR_TEST),t.disable(t.STENCIL_TEST),t.disable(t.SAMPLE_ALPHA_TO_COVERAGE),t.blendEquation(t.FUNC_ADD),t.blendFunc(t.ONE,t.ZERO),t.blendFuncSeparate(t.ONE,t.ZERO,t.ONE,t.ZERO),t.blendColor(0,0,0,0),t.colorMask(!0,!0,!0,!0),t.clearColor(0,0,0,0),t.depthMask(!0),t.depthFunc(t.LESS),s.setReversed(!1),t.clearDepth(1),t.stencilMask(4294967295),t.stencilFunc(t.ALWAYS,0,4294967295),t.stencilOp(t.KEEP,t.KEEP,t.KEEP),t.clearStencil(0),t.cullFace(t.BACK),t.frontFace(t.CCW),t.polygonOffset(0,0),t.activeTexture(t.TEXTURE0),t.bindFramebuffer(t.FRAMEBUFFER,null),t.bindFramebuffer(t.DRAW_FRAMEBUFFER,null),t.bindFramebuffer(t.READ_FRAMEBUFFER,null),t.useProgram(null),t.lineWidth(1),t.scissor(0,0,t.canvas.width,t.canvas.height),t.viewport(0,0,t.canvas.width,t.canvas.height),d={},Q=null,se={},f={},p=new WeakMap,m=[],y=null,b=!1,x=null,v=null,M=null,w=null,E=null,T=null,P=null,R=new fn(0,0,0),U=0,N=!1,O=null,B=null,I=null,W=null,L=null,re.set(0,0,t.canvas.width,t.canvas.height),ce.set(0,0,t.canvas.width,t.canvas.height),a.reset(),s.reset(),o.reset()}return{buffers:{color:a,depth:s,stencil:o},enable:be,disable:De,bindFramebuffer:he,drawBuffers:Ae,useProgram:Be,setBlending:z,setMaterial:V,setFlipSided:ne,setCullFace:J,setLineWidth:ee,setPolygonOffset:ae,setScissorTest:ie,activeTexture:we,bindTexture:ve,unbindTexture:F,compressedTexImage2D:k,compressedTexImage3D:K,texImage2D:rt,texImage3D:Ue,updateUBOMapping:et,uniformBlockBinding:Qe,texStorage2D:ke,texStorage3D:$e,texSubImage2D:pe,texSubImage3D:xe,compressedTexSubImage2D:fe,compressedTexSubImage3D:Ke,scissor:Pe,viewport:dt,reset:st}}function Ide(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 Qt,d=new WeakMap;let f;const p=new WeakMap;let m=!1;try{m=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function y(F,k){return m?new OffscreenCanvas(F,k):a_("canvas")}function b(F,k,K){let pe=1;const xe=ve(F);if((xe.width>K||xe.height>K)&&(pe=K/Math.max(xe.width,xe.height)),pe<1)if(typeof HTMLImageElement<"u"&&F instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&F instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&F instanceof ImageBitmap||typeof VideoFrame<"u"&&F instanceof VideoFrame){const fe=Math.floor(pe*xe.width),Ke=Math.floor(pe*xe.height);f===void 0&&(f=y(fe,Ke));const ke=k?y(fe,Ke):f;return ke.width=fe,ke.height=Ke,ke.getContext("2d").drawImage(F,0,0,fe,Ke),Ht("WebGLRenderer: Texture has been resized from ("+xe.width+"x"+xe.height+") to ("+fe+"x"+Ke+")."),ke}else return"data"in F&&Ht("WebGLRenderer: Image in DataTexture is too big ("+xe.width+"x"+xe.height+")."),F;return F}function x(F){return F.generateMipmaps}function v(F){t.generateMipmap(F)}function M(F){return F.isWebGLCubeRenderTarget?t.TEXTURE_CUBE_MAP:F.isWebGL3DRenderTarget?t.TEXTURE_3D:F.isWebGLArrayRenderTarget||F.isCompressedArrayTexture?t.TEXTURE_2D_ARRAY:t.TEXTURE_2D}function w(F,k,K,pe,xe=!1){if(F!==null){if(t[F]!==void 0)return t[F];Ht("WebGLRenderer: Attempt to use non-existing WebGL internal format '"+F+"'")}let fe=k;if(k===t.RED&&(K===t.FLOAT&&(fe=t.R32F),K===t.HALF_FLOAT&&(fe=t.R16F),K===t.UNSIGNED_BYTE&&(fe=t.R8)),k===t.RED_INTEGER&&(K===t.UNSIGNED_BYTE&&(fe=t.R8UI),K===t.UNSIGNED_SHORT&&(fe=t.R16UI),K===t.UNSIGNED_INT&&(fe=t.R32UI),K===t.BYTE&&(fe=t.R8I),K===t.SHORT&&(fe=t.R16I),K===t.INT&&(fe=t.R32I)),k===t.RG&&(K===t.FLOAT&&(fe=t.RG32F),K===t.HALF_FLOAT&&(fe=t.RG16F),K===t.UNSIGNED_BYTE&&(fe=t.RG8)),k===t.RG_INTEGER&&(K===t.UNSIGNED_BYTE&&(fe=t.RG8UI),K===t.UNSIGNED_SHORT&&(fe=t.RG16UI),K===t.UNSIGNED_INT&&(fe=t.RG32UI),K===t.BYTE&&(fe=t.RG8I),K===t.SHORT&&(fe=t.RG16I),K===t.INT&&(fe=t.RG32I)),k===t.RGB_INTEGER&&(K===t.UNSIGNED_BYTE&&(fe=t.RGB8UI),K===t.UNSIGNED_SHORT&&(fe=t.RGB16UI),K===t.UNSIGNED_INT&&(fe=t.RGB32UI),K===t.BYTE&&(fe=t.RGB8I),K===t.SHORT&&(fe=t.RGB16I),K===t.INT&&(fe=t.RGB32I)),k===t.RGBA_INTEGER&&(K===t.UNSIGNED_BYTE&&(fe=t.RGBA8UI),K===t.UNSIGNED_SHORT&&(fe=t.RGBA16UI),K===t.UNSIGNED_INT&&(fe=t.RGBA32UI),K===t.BYTE&&(fe=t.RGBA8I),K===t.SHORT&&(fe=t.RGBA16I),K===t.INT&&(fe=t.RGBA32I)),k===t.RGB&&(K===t.UNSIGNED_INT_5_9_9_9_REV&&(fe=t.RGB9_E5),K===t.UNSIGNED_INT_10F_11F_11F_REV&&(fe=t.R11F_G11F_B10F)),k===t.RGBA){const Ke=xe?i_:xn.getTransfer(pe);K===t.FLOAT&&(fe=t.RGBA32F),K===t.HALF_FLOAT&&(fe=t.RGBA16F),K===t.UNSIGNED_BYTE&&(fe=Ke===On?t.SRGB8_ALPHA8:t.RGBA8),K===t.UNSIGNED_SHORT_4_4_4_4&&(fe=t.RGBA4),K===t.UNSIGNED_SHORT_5_5_5_1&&(fe=t.RGB5_A1)}return(fe===t.R16F||fe===t.R32F||fe===t.RG16F||fe===t.RG32F||fe===t.RGBA16F||fe===t.RGBA32F)&&e.get("EXT_color_buffer_float"),fe}function E(F,k){let K;return F?k===null||k===af||k===m0?K=t.DEPTH24_STENCIL8:k===Fl?K=t.DEPTH32F_STENCIL8:k===p0&&(K=t.DEPTH24_STENCIL8,Ht("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):k===null||k===af||k===m0?K=t.DEPTH_COMPONENT24:k===Fl?K=t.DEPTH_COMPONENT32F:k===p0&&(K=t.DEPTH_COMPONENT16),K}function T(F,k){return x(F)===!0||F.isFramebufferTexture&&F.minFilter!==ns&&F.minFilter!==Ls?Math.log2(Math.max(k.width,k.height))+1:F.mipmaps!==void 0&&F.mipmaps.length>0?F.mipmaps.length:F.isCompressedTexture&&Array.isArray(F.image)?k.mipmaps.length:1}function P(F){const k=F.target;k.removeEventListener("dispose",P),U(k),k.isVideoTexture&&d.delete(k)}function R(F){const k=F.target;k.removeEventListener("dispose",R),O(k)}function U(F){const k=i.get(F);if(k.__webglInit===void 0)return;const K=F.source,pe=p.get(K);if(pe){const xe=pe[k.__cacheKey];xe.usedTimes--,xe.usedTimes===0&&N(F),Object.keys(pe).length===0&&p.delete(K)}i.remove(F)}function N(F){const k=i.get(F);t.deleteTexture(k.__webglTexture);const K=F.source,pe=p.get(K);delete pe[k.__cacheKey],s.memory.textures--}function O(F){const k=i.get(F);if(F.depthTexture&&(F.depthTexture.dispose(),i.remove(F.depthTexture)),F.isWebGLCubeRenderTarget)for(let pe=0;pe<6;pe++){if(Array.isArray(k.__webglFramebuffer[pe]))for(let xe=0;xe<k.__webglFramebuffer[pe].length;xe++)t.deleteFramebuffer(k.__webglFramebuffer[pe][xe]);else t.deleteFramebuffer(k.__webglFramebuffer[pe]);k.__webglDepthbuffer&&t.deleteRenderbuffer(k.__webglDepthbuffer[pe])}else{if(Array.isArray(k.__webglFramebuffer))for(let pe=0;pe<k.__webglFramebuffer.length;pe++)t.deleteFramebuffer(k.__webglFramebuffer[pe]);else t.deleteFramebuffer(k.__webglFramebuffer);if(k.__webglDepthbuffer&&t.deleteRenderbuffer(k.__webglDepthbuffer),k.__webglMultisampledFramebuffer&&t.deleteFramebuffer(k.__webglMultisampledFramebuffer),k.__webglColorRenderbuffer)for(let pe=0;pe<k.__webglColorRenderbuffer.length;pe++)k.__webglColorRenderbuffer[pe]&&t.deleteRenderbuffer(k.__webglColorRenderbuffer[pe]);k.__webglDepthRenderbuffer&&t.deleteRenderbuffer(k.__webglDepthRenderbuffer)}const K=F.textures;for(let pe=0,xe=K.length;pe<xe;pe++){const fe=i.get(K[pe]);fe.__webglTexture&&(t.deleteTexture(fe.__webglTexture),s.memory.textures--),i.remove(K[pe])}i.remove(F)}let B=0;function I(){B=0}function W(){const F=B;return F>=r.maxTextures&&Ht("WebGLTextures: Trying to use "+F+" texture units while this GPU supports only "+r.maxTextures),B+=1,F}function L(F){const k=[];return k.push(F.wrapS),k.push(F.wrapT),k.push(F.wrapR||0),k.push(F.magFilter),k.push(F.minFilter),k.push(F.anisotropy),k.push(F.internalFormat),k.push(F.format),k.push(F.type),k.push(F.generateMipmaps),k.push(F.premultiplyAlpha),k.push(F.flipY),k.push(F.unpackAlignment),k.push(F.colorSpace),k.join()}function $(F,k){const K=i.get(F);if(F.isVideoTexture&&ie(F),F.isRenderTargetTexture===!1&&F.isExternalTexture!==!0&&F.version>0&&K.__version!==F.version){const pe=F.image;if(pe===null)Ht("WebGLRenderer: Texture marked for update but no image data found.");else if(pe.complete===!1)Ht("WebGLRenderer: Texture marked for update but image is incomplete");else{me(K,F,k);return}}else F.isExternalTexture&&(K.__webglTexture=F.sourceTexture?F.sourceTexture:null);n.bindTexture(t.TEXTURE_2D,K.__webglTexture,t.TEXTURE0+k)}function q(F,k){const K=i.get(F);if(F.isRenderTargetTexture===!1&&F.version>0&&K.__version!==F.version){me(K,F,k);return}else F.isExternalTexture&&(K.__webglTexture=F.sourceTexture?F.sourceTexture:null);n.bindTexture(t.TEXTURE_2D_ARRAY,K.__webglTexture,t.TEXTURE0+k)}function G(F,k){const K=i.get(F);if(F.isRenderTargetTexture===!1&&F.version>0&&K.__version!==F.version){me(K,F,k);return}n.bindTexture(t.TEXTURE_3D,K.__webglTexture,t.TEXTURE0+k)}function Y(F,k){const K=i.get(F);if(F.version>0&&K.__version!==F.version){be(K,F,k);return}n.bindTexture(t.TEXTURE_CUBE_MAP,K.__webglTexture,t.TEXTURE0+k)}const Q={[H2]:t.REPEAT,[Ul]:t.CLAMP_TO_EDGE,[V2]:t.MIRRORED_REPEAT},se={[ns]:t.NEAREST,[sse]:t.NEAREST_MIPMAP_NEAREST,[Jx]:t.NEAREST_MIPMAP_LINEAR,[Ls]:t.LINEAR,[FE]:t.LINEAR_MIPMAP_NEAREST,[Dd]:t.LINEAR_MIPMAP_LINEAR},H={[use]:t.NEVER,[gse]:t.ALWAYS,[dse]:t.LESS,[CG]:t.LEQUAL,[fse]:t.EQUAL,[mse]:t.GEQUAL,[hse]:t.GREATER,[pse]:t.NOTEQUAL};function X(F,k){if(k.type===Fl&&e.has("OES_texture_float_linear")===!1&&(k.magFilter===Ls||k.magFilter===FE||k.magFilter===Jx||k.magFilter===Dd||k.minFilter===Ls||k.minFilter===FE||k.minFilter===Jx||k.minFilter===Dd)&&Ht("WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),t.texParameteri(F,t.TEXTURE_WRAP_S,Q[k.wrapS]),t.texParameteri(F,t.TEXTURE_WRAP_T,Q[k.wrapT]),(F===t.TEXTURE_3D||F===t.TEXTURE_2D_ARRAY)&&t.texParameteri(F,t.TEXTURE_WRAP_R,Q[k.wrapR]),t.texParameteri(F,t.TEXTURE_MAG_FILTER,se[k.magFilter]),t.texParameteri(F,t.TEXTURE_MIN_FILTER,se[k.minFilter]),k.compareFunction&&(t.texParameteri(F,t.TEXTURE_COMPARE_MODE,t.COMPARE_REF_TO_TEXTURE),t.texParameteri(F,t.TEXTURE_COMPARE_FUNC,H[k.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(k.magFilter===ns||k.minFilter!==Jx&&k.minFilter!==Dd||k.type===Fl&&e.has("OES_texture_float_linear")===!1)return;if(k.anisotropy>1||i.get(k).__currentAnisotropy){const K=e.get("EXT_texture_filter_anisotropic");t.texParameterf(F,K.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(k.anisotropy,r.getMaxAnisotropy())),i.get(k).__currentAnisotropy=k.anisotropy}}}function re(F,k){let K=!1;F.__webglInit===void 0&&(F.__webglInit=!0,k.addEventListener("dispose",P));const pe=k.source;let xe=p.get(pe);xe===void 0&&(xe={},p.set(pe,xe));const fe=L(k);if(fe!==F.__cacheKey){xe[fe]===void 0&&(xe[fe]={texture:t.createTexture(),usedTimes:0},s.memory.textures++,K=!0),xe[fe].usedTimes++;const Ke=xe[F.__cacheKey];Ke!==void 0&&(xe[F.__cacheKey].usedTimes--,Ke.usedTimes===0&&N(k)),F.__cacheKey=fe,F.__webglTexture=xe[fe].texture}return K}function ce(F,k,K){return Math.floor(Math.floor(F/K)/k)}function ye(F,k,K,pe){const fe=F.updateRanges;if(fe.length===0)n.texSubImage2D(t.TEXTURE_2D,0,0,0,k.width,k.height,K,pe,k.data);else{fe.sort((Ue,Pe)=>Ue.start-Pe.start);let Ke=0;for(let Ue=1;Ue<fe.length;Ue++){const Pe=fe[Ke],dt=fe[Ue],et=Pe.start+Pe.count,Qe=ce(dt.start,k.width,4),st=ce(Pe.start,k.width,4);dt.start<=et+1&&Qe===st&&ce(dt.start+dt.count-1,k.width,4)===Qe?Pe.count=Math.max(Pe.count,dt.start+dt.count-Pe.start):(++Ke,fe[Ke]=dt)}fe.length=Ke+1;const ke=t.getParameter(t.UNPACK_ROW_LENGTH),$e=t.getParameter(t.UNPACK_SKIP_PIXELS),rt=t.getParameter(t.UNPACK_SKIP_ROWS);t.pixelStorei(t.UNPACK_ROW_LENGTH,k.width);for(let Ue=0,Pe=fe.length;Ue<Pe;Ue++){const dt=fe[Ue],et=Math.floor(dt.start/4),Qe=Math.ceil(dt.count/4),st=et%k.width,ue=Math.floor(et/k.width),tt=Qe,de=1;t.pixelStorei(t.UNPACK_SKIP_PIXELS,st),t.pixelStorei(t.UNPACK_SKIP_ROWS,ue),n.texSubImage2D(t.TEXTURE_2D,0,st,ue,tt,de,K,pe,k.data)}F.clearUpdateRanges(),t.pixelStorei(t.UNPACK_ROW_LENGTH,ke),t.pixelStorei(t.UNPACK_SKIP_PIXELS,$e),t.pixelStorei(t.UNPACK_SKIP_ROWS,rt)}}function me(F,k,K){let pe=t.TEXTURE_2D;(k.isDataArrayTexture||k.isCompressedArrayTexture)&&(pe=t.TEXTURE_2D_ARRAY),k.isData3DTexture&&(pe=t.TEXTURE_3D);const xe=re(F,k),fe=k.source;n.bindTexture(pe,F.__webglTexture,t.TEXTURE0+K);const Ke=i.get(fe);if(fe.version!==Ke.__version||xe===!0){n.activeTexture(t.TEXTURE0+K);const ke=xn.getPrimaries(xn.workingColorSpace),$e=k.colorSpace===cu?null:xn.getPrimaries(k.colorSpace),rt=k.colorSpace===cu||ke===$e?t.NONE:t.BROWSER_DEFAULT_WEBGL;t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,k.flipY),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,k.premultiplyAlpha),t.pixelStorei(t.UNPACK_ALIGNMENT,k.unpackAlignment),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,rt);let Ue=b(k.image,!1,r.maxTextureSize);Ue=we(k,Ue);const Pe=a.convert(k.format,k.colorSpace),dt=a.convert(k.type);let et=w(k.internalFormat,Pe,dt,k.colorSpace,k.isVideoTexture);X(pe,k);let Qe;const st=k.mipmaps,ue=k.isVideoTexture!==!0,tt=Ke.__version===void 0||xe===!0,de=fe.dataReady,Le=T(k,Ue);if(k.isDepthTexture)et=E(k.format===v0,k.type),tt&&(ue?n.texStorage2D(t.TEXTURE_2D,1,et,Ue.width,Ue.height):n.texImage2D(t.TEXTURE_2D,0,et,Ue.width,Ue.height,0,Pe,dt,null));else if(k.isDataTexture)if(st.length>0){ue&&tt&&n.texStorage2D(t.TEXTURE_2D,Le,et,st[0].width,st[0].height);for(let Ee=0,ge=st.length;Ee<ge;Ee++)Qe=st[Ee],ue?de&&n.texSubImage2D(t.TEXTURE_2D,Ee,0,0,Qe.width,Qe.height,Pe,dt,Qe.data):n.texImage2D(t.TEXTURE_2D,Ee,et,Qe.width,Qe.height,0,Pe,dt,Qe.data);k.generateMipmaps=!1}else ue?(tt&&n.texStorage2D(t.TEXTURE_2D,Le,et,Ue.width,Ue.height),de&&ye(k,Ue,Pe,dt)):n.texImage2D(t.TEXTURE_2D,0,et,Ue.width,Ue.height,0,Pe,dt,Ue.data);else if(k.isCompressedTexture)if(k.isCompressedArrayTexture){ue&&tt&&n.texStorage3D(t.TEXTURE_2D_ARRAY,Le,et,st[0].width,st[0].height,Ue.depth);for(let Ee=0,ge=st.length;Ee<ge;Ee++)if(Qe=st[Ee],k.format!==lo)if(Pe!==null)if(ue){if(de)if(k.layerUpdates.size>0){const je=J4(Qe.width,Qe.height,k.format,k.type);for(const at of k.layerUpdates){const yt=Qe.data.subarray(at*je/Qe.data.BYTES_PER_ELEMENT,(at+1)*je/Qe.data.BYTES_PER_ELEMENT);n.compressedTexSubImage3D(t.TEXTURE_2D_ARRAY,Ee,0,0,at,Qe.width,Qe.height,1,Pe,yt)}k.clearLayerUpdates()}else n.compressedTexSubImage3D(t.TEXTURE_2D_ARRAY,Ee,0,0,0,Qe.width,Qe.height,Ue.depth,Pe,Qe.data)}else n.compressedTexImage3D(t.TEXTURE_2D_ARRAY,Ee,et,Qe.width,Qe.height,Ue.depth,0,Qe.data,0,0);else Ht("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else ue?de&&n.texSubImage3D(t.TEXTURE_2D_ARRAY,Ee,0,0,0,Qe.width,Qe.height,Ue.depth,Pe,dt,Qe.data):n.texImage3D(t.TEXTURE_2D_ARRAY,Ee,et,Qe.width,Qe.height,Ue.depth,0,Pe,dt,Qe.data)}else{ue&&tt&&n.texStorage2D(t.TEXTURE_2D,Le,et,st[0].width,st[0].height);for(let Ee=0,ge=st.length;Ee<ge;Ee++)Qe=st[Ee],k.format!==lo?Pe!==null?ue?de&&n.compressedTexSubImage2D(t.TEXTURE_2D,Ee,0,0,Qe.width,Qe.height,Pe,Qe.data):n.compressedTexImage2D(t.TEXTURE_2D,Ee,et,Qe.width,Qe.height,0,Qe.data):Ht("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):ue?de&&n.texSubImage2D(t.TEXTURE_2D,Ee,0,0,Qe.width,Qe.height,Pe,dt,Qe.data):n.texImage2D(t.TEXTURE_2D,Ee,et,Qe.width,Qe.height,0,Pe,dt,Qe.data)}else if(k.isDataArrayTexture)if(ue){if(tt&&n.texStorage3D(t.TEXTURE_2D_ARRAY,Le,et,Ue.width,Ue.height,Ue.depth),de)if(k.layerUpdates.size>0){const Ee=J4(Ue.width,Ue.height,k.format,k.type);for(const ge of k.layerUpdates){const je=Ue.data.subarray(ge*Ee/Ue.data.BYTES_PER_ELEMENT,(ge+1)*Ee/Ue.data.BYTES_PER_ELEMENT);n.texSubImage3D(t.TEXTURE_2D_ARRAY,0,0,0,ge,Ue.width,Ue.height,1,Pe,dt,je)}k.clearLayerUpdates()}else n.texSubImage3D(t.TEXTURE_2D_ARRAY,0,0,0,0,Ue.width,Ue.height,Ue.depth,Pe,dt,Ue.data)}else n.texImage3D(t.TEXTURE_2D_ARRAY,0,et,Ue.width,Ue.height,Ue.depth,0,Pe,dt,Ue.data);else if(k.isData3DTexture)ue?(tt&&n.texStorage3D(t.TEXTURE_3D,Le,et,Ue.width,Ue.height,Ue.depth),de&&n.texSubImage3D(t.TEXTURE_3D,0,0,0,0,Ue.width,Ue.height,Ue.depth,Pe,dt,Ue.data)):n.texImage3D(t.TEXTURE_3D,0,et,Ue.width,Ue.height,Ue.depth,0,Pe,dt,Ue.data);else if(k.isFramebufferTexture){if(tt)if(ue)n.texStorage2D(t.TEXTURE_2D,Le,et,Ue.width,Ue.height);else{let Ee=Ue.width,ge=Ue.height;for(let je=0;je<Le;je++)n.texImage2D(t.TEXTURE_2D,je,et,Ee,ge,0,Pe,dt,null),Ee>>=1,ge>>=1}}else if(st.length>0){if(ue&&tt){const Ee=ve(st[0]);n.texStorage2D(t.TEXTURE_2D,Le,et,Ee.width,Ee.height)}for(let Ee=0,ge=st.length;Ee<ge;Ee++)Qe=st[Ee],ue?de&&n.texSubImage2D(t.TEXTURE_2D,Ee,0,0,Pe,dt,Qe):n.texImage2D(t.TEXTURE_2D,Ee,et,Pe,dt,Qe);k.generateMipmaps=!1}else if(ue){if(tt){const Ee=ve(Ue);n.texStorage2D(t.TEXTURE_2D,Le,et,Ee.width,Ee.height)}de&&n.texSubImage2D(t.TEXTURE_2D,0,0,0,Pe,dt,Ue)}else n.texImage2D(t.TEXTURE_2D,0,et,Pe,dt,Ue);x(k)&&v(pe),Ke.__version=fe.version,k.onUpdate&&k.onUpdate(k)}F.__version=k.version}function be(F,k,K){if(k.image.length!==6)return;const pe=re(F,k),xe=k.source;n.bindTexture(t.TEXTURE_CUBE_MAP,F.__webglTexture,t.TEXTURE0+K);const fe=i.get(xe);if(xe.version!==fe.__version||pe===!0){n.activeTexture(t.TEXTURE0+K);const Ke=xn.getPrimaries(xn.workingColorSpace),ke=k.colorSpace===cu?null:xn.getPrimaries(k.colorSpace),$e=k.colorSpace===cu||Ke===ke?t.NONE:t.BROWSER_DEFAULT_WEBGL;t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,k.flipY),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,k.premultiplyAlpha),t.pixelStorei(t.UNPACK_ALIGNMENT,k.unpackAlignment),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,$e);const rt=k.isCompressedTexture||k.image[0].isCompressedTexture,Ue=k.image[0]&&k.image[0].isDataTexture,Pe=[];for(let ge=0;ge<6;ge++)!rt&&!Ue?Pe[ge]=b(k.image[ge],!0,r.maxCubemapSize):Pe[ge]=Ue?k.image[ge].image:k.image[ge],Pe[ge]=we(k,Pe[ge]);const dt=Pe[0],et=a.convert(k.format,k.colorSpace),Qe=a.convert(k.type),st=w(k.internalFormat,et,Qe,k.colorSpace),ue=k.isVideoTexture!==!0,tt=fe.__version===void 0||pe===!0,de=xe.dataReady;let Le=T(k,dt);X(t.TEXTURE_CUBE_MAP,k);let Ee;if(rt){ue&&tt&&n.texStorage2D(t.TEXTURE_CUBE_MAP,Le,st,dt.width,dt.height);for(let ge=0;ge<6;ge++){Ee=Pe[ge].mipmaps;for(let je=0;je<Ee.length;je++){const at=Ee[je];k.format!==lo?et!==null?ue?de&&n.compressedTexSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+ge,je,0,0,at.width,at.height,et,at.data):n.compressedTexImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+ge,je,st,at.width,at.height,0,at.data):Ht("WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):ue?de&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+ge,je,0,0,at.width,at.height,et,Qe,at.data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+ge,je,st,at.width,at.height,0,et,Qe,at.data)}}}else{if(Ee=k.mipmaps,ue&&tt){Ee.length>0&&Le++;const ge=ve(Pe[0]);n.texStorage2D(t.TEXTURE_CUBE_MAP,Le,st,ge.width,ge.height)}for(let ge=0;ge<6;ge++)if(Ue){ue?de&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+ge,0,0,0,Pe[ge].width,Pe[ge].height,et,Qe,Pe[ge].data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+ge,0,st,Pe[ge].width,Pe[ge].height,0,et,Qe,Pe[ge].data);for(let je=0;je<Ee.length;je++){const yt=Ee[je].image[ge].image;ue?de&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+ge,je+1,0,0,yt.width,yt.height,et,Qe,yt.data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+ge,je+1,st,yt.width,yt.height,0,et,Qe,yt.data)}}else{ue?de&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+ge,0,0,0,et,Qe,Pe[ge]):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+ge,0,st,et,Qe,Pe[ge]);for(let je=0;je<Ee.length;je++){const at=Ee[je];ue?de&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+ge,je+1,0,0,et,Qe,at.image[ge]):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+ge,je+1,st,et,Qe,at.image[ge])}}}x(k)&&v(t.TEXTURE_CUBE_MAP),fe.__version=xe.version,k.onUpdate&&k.onUpdate(k)}F.__version=k.version}function De(F,k,K,pe,xe,fe){const Ke=a.convert(K.format,K.colorSpace),ke=a.convert(K.type),$e=w(K.internalFormat,Ke,ke,K.colorSpace),rt=i.get(k),Ue=i.get(K);if(Ue.__renderTarget=k,!rt.__hasExternalTextures){const Pe=Math.max(1,k.width>>fe),dt=Math.max(1,k.height>>fe);xe===t.TEXTURE_3D||xe===t.TEXTURE_2D_ARRAY?n.texImage3D(xe,fe,$e,Pe,dt,k.depth,0,Ke,ke,null):n.texImage2D(xe,fe,$e,Pe,dt,0,Ke,ke,null)}n.bindFramebuffer(t.FRAMEBUFFER,F),ae(k)?o.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,pe,xe,Ue.__webglTexture,0,ee(k)):(xe===t.TEXTURE_2D||xe>=t.TEXTURE_CUBE_MAP_POSITIVE_X&&xe<=t.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&t.framebufferTexture2D(t.FRAMEBUFFER,pe,xe,Ue.__webglTexture,fe),n.bindFramebuffer(t.FRAMEBUFFER,null)}function he(F,k,K){if(t.bindRenderbuffer(t.RENDERBUFFER,F),k.depthBuffer){const pe=k.depthTexture,xe=pe&&pe.isDepthTexture?pe.type:null,fe=E(k.stencilBuffer,xe),Ke=k.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,ke=ee(k);ae(k)?o.renderbufferStorageMultisampleEXT(t.RENDERBUFFER,ke,fe,k.width,k.height):K?t.renderbufferStorageMultisample(t.RENDERBUFFER,ke,fe,k.width,k.height):t.renderbufferStorage(t.RENDERBUFFER,fe,k.width,k.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,Ke,t.RENDERBUFFER,F)}else{const pe=k.textures;for(let xe=0;xe<pe.length;xe++){const fe=pe[xe],Ke=a.convert(fe.format,fe.colorSpace),ke=a.convert(fe.type),$e=w(fe.internalFormat,Ke,ke,fe.colorSpace),rt=ee(k);K&&ae(k)===!1?t.renderbufferStorageMultisample(t.RENDERBUFFER,rt,$e,k.width,k.height):ae(k)?o.renderbufferStorageMultisampleEXT(t.RENDERBUFFER,rt,$e,k.width,k.height):t.renderbufferStorage(t.RENDERBUFFER,$e,k.width,k.height)}}t.bindRenderbuffer(t.RENDERBUFFER,null)}function Ae(F,k){if(k&&k.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(n.bindFramebuffer(t.FRAMEBUFFER,F),!(k.depthTexture&&k.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");const pe=i.get(k.depthTexture);pe.__renderTarget=k,(!pe.__webglTexture||k.depthTexture.image.width!==k.width||k.depthTexture.image.height!==k.height)&&(k.depthTexture.image.width=k.width,k.depthTexture.image.height=k.height,k.depthTexture.needsUpdate=!0),$(k.depthTexture,0);const xe=pe.__webglTexture,fe=ee(k);if(k.depthTexture.format===g0)ae(k)?o.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.TEXTURE_2D,xe,0,fe):t.framebufferTexture2D(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.TEXTURE_2D,xe,0);else if(k.depthTexture.format===v0)ae(k)?o.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.TEXTURE_2D,xe,0,fe):t.framebufferTexture2D(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.TEXTURE_2D,xe,0);else throw new Error("Unknown depthTexture format")}function Be(F){const k=i.get(F),K=F.isWebGLCubeRenderTarget===!0;if(k.__boundDepthTexture!==F.depthTexture){const pe=F.depthTexture;if(k.__depthDisposeCallback&&k.__depthDisposeCallback(),pe){const xe=()=>{delete k.__boundDepthTexture,delete k.__depthDisposeCallback,pe.removeEventListener("dispose",xe)};pe.addEventListener("dispose",xe),k.__depthDisposeCallback=xe}k.__boundDepthTexture=pe}if(F.depthTexture&&!k.__autoAllocateDepthBuffer){if(K)throw new Error("target.depthTexture not supported in Cube render targets");const pe=F.texture.mipmaps;pe&&pe.length>0?Ae(k.__webglFramebuffer[0],F):Ae(k.__webglFramebuffer,F)}else if(K){k.__webglDepthbuffer=[];for(let pe=0;pe<6;pe++)if(n.bindFramebuffer(t.FRAMEBUFFER,k.__webglFramebuffer[pe]),k.__webglDepthbuffer[pe]===void 0)k.__webglDepthbuffer[pe]=t.createRenderbuffer(),he(k.__webglDepthbuffer[pe],F,!1);else{const xe=F.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,fe=k.__webglDepthbuffer[pe];t.bindRenderbuffer(t.RENDERBUFFER,fe),t.framebufferRenderbuffer(t.FRAMEBUFFER,xe,t.RENDERBUFFER,fe)}}else{const pe=F.texture.mipmaps;if(pe&&pe.length>0?n.bindFramebuffer(t.FRAMEBUFFER,k.__webglFramebuffer[0]):n.bindFramebuffer(t.FRAMEBUFFER,k.__webglFramebuffer),k.__webglDepthbuffer===void 0)k.__webglDepthbuffer=t.createRenderbuffer(),he(k.__webglDepthbuffer,F,!1);else{const xe=F.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,fe=k.__webglDepthbuffer;t.bindRenderbuffer(t.RENDERBUFFER,fe),t.framebufferRenderbuffer(t.FRAMEBUFFER,xe,t.RENDERBUFFER,fe)}}n.bindFramebuffer(t.FRAMEBUFFER,null)}function le(F,k,K){const pe=i.get(F);k!==void 0&&De(pe.__webglFramebuffer,F,F.texture,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,0),K!==void 0&&Be(F)}function ut(F){const k=F.texture,K=i.get(F),pe=i.get(k);F.addEventListener("dispose",R);const xe=F.textures,fe=F.isWebGLCubeRenderTarget===!0,Ke=xe.length>1;if(Ke||(pe.__webglTexture===void 0&&(pe.__webglTexture=t.createTexture()),pe.__version=k.version,s.memory.textures++),fe){K.__webglFramebuffer=[];for(let ke=0;ke<6;ke++)if(k.mipmaps&&k.mipmaps.length>0){K.__webglFramebuffer[ke]=[];for(let $e=0;$e<k.mipmaps.length;$e++)K.__webglFramebuffer[ke][$e]=t.createFramebuffer()}else K.__webglFramebuffer[ke]=t.createFramebuffer()}else{if(k.mipmaps&&k.mipmaps.length>0){K.__webglFramebuffer=[];for(let ke=0;ke<k.mipmaps.length;ke++)K.__webglFramebuffer[ke]=t.createFramebuffer()}else K.__webglFramebuffer=t.createFramebuffer();if(Ke)for(let ke=0,$e=xe.length;ke<$e;ke++){const rt=i.get(xe[ke]);rt.__webglTexture===void 0&&(rt.__webglTexture=t.createTexture(),s.memory.textures++)}if(F.samples>0&&ae(F)===!1){K.__webglMultisampledFramebuffer=t.createFramebuffer(),K.__webglColorRenderbuffer=[],n.bindFramebuffer(t.FRAMEBUFFER,K.__webglMultisampledFramebuffer);for(let ke=0;ke<xe.length;ke++){const $e=xe[ke];K.__webglColorRenderbuffer[ke]=t.createRenderbuffer(),t.bindRenderbuffer(t.RENDERBUFFER,K.__webglColorRenderbuffer[ke]);const rt=a.convert($e.format,$e.colorSpace),Ue=a.convert($e.type),Pe=w($e.internalFormat,rt,Ue,$e.colorSpace,F.isXRRenderTarget===!0),dt=ee(F);t.renderbufferStorageMultisample(t.RENDERBUFFER,dt,Pe,F.width,F.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+ke,t.RENDERBUFFER,K.__webglColorRenderbuffer[ke])}t.bindRenderbuffer(t.RENDERBUFFER,null),F.depthBuffer&&(K.__webglDepthRenderbuffer=t.createRenderbuffer(),he(K.__webglDepthRenderbuffer,F,!0)),n.bindFramebuffer(t.FRAMEBUFFER,null)}}if(fe){n.bindTexture(t.TEXTURE_CUBE_MAP,pe.__webglTexture),X(t.TEXTURE_CUBE_MAP,k);for(let ke=0;ke<6;ke++)if(k.mipmaps&&k.mipmaps.length>0)for(let $e=0;$e<k.mipmaps.length;$e++)De(K.__webglFramebuffer[ke][$e],F,k,t.COLOR_ATTACHMENT0,t.TEXTURE_CUBE_MAP_POSITIVE_X+ke,$e);else De(K.__webglFramebuffer[ke],F,k,t.COLOR_ATTACHMENT0,t.TEXTURE_CUBE_MAP_POSITIVE_X+ke,0);x(k)&&v(t.TEXTURE_CUBE_MAP),n.unbindTexture()}else if(Ke){for(let ke=0,$e=xe.length;ke<$e;ke++){const rt=xe[ke],Ue=i.get(rt);let Pe=t.TEXTURE_2D;(F.isWebGL3DRenderTarget||F.isWebGLArrayRenderTarget)&&(Pe=F.isWebGL3DRenderTarget?t.TEXTURE_3D:t.TEXTURE_2D_ARRAY),n.bindTexture(Pe,Ue.__webglTexture),X(Pe,rt),De(K.__webglFramebuffer,F,rt,t.COLOR_ATTACHMENT0+ke,Pe,0),x(rt)&&v(Pe)}n.unbindTexture()}else{let ke=t.TEXTURE_2D;if((F.isWebGL3DRenderTarget||F.isWebGLArrayRenderTarget)&&(ke=F.isWebGL3DRenderTarget?t.TEXTURE_3D:t.TEXTURE_2D_ARRAY),n.bindTexture(ke,pe.__webglTexture),X(ke,k),k.mipmaps&&k.mipmaps.length>0)for(let $e=0;$e<k.mipmaps.length;$e++)De(K.__webglFramebuffer[$e],F,k,t.COLOR_ATTACHMENT0,ke,$e);else De(K.__webglFramebuffer,F,k,t.COLOR_ATTACHMENT0,ke,0);x(k)&&v(ke),n.unbindTexture()}F.depthBuffer&&Be(F)}function z(F){const k=F.textures;for(let K=0,pe=k.length;K<pe;K++){const xe=k[K];if(x(xe)){const fe=M(F),Ke=i.get(xe).__webglTexture;n.bindTexture(fe,Ke),v(fe),n.unbindTexture()}}}const V=[],ne=[];function J(F){if(F.samples>0){if(ae(F)===!1){const k=F.textures,K=F.width,pe=F.height;let xe=t.COLOR_BUFFER_BIT;const fe=F.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,Ke=i.get(F),ke=k.length>1;if(ke)for(let rt=0;rt<k.length;rt++)n.bindFramebuffer(t.FRAMEBUFFER,Ke.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+rt,t.RENDERBUFFER,null),n.bindFramebuffer(t.FRAMEBUFFER,Ke.__webglFramebuffer),t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0+rt,t.TEXTURE_2D,null,0);n.bindFramebuffer(t.READ_FRAMEBUFFER,Ke.__webglMultisampledFramebuffer);const $e=F.texture.mipmaps;$e&&$e.length>0?n.bindFramebuffer(t.DRAW_FRAMEBUFFER,Ke.__webglFramebuffer[0]):n.bindFramebuffer(t.DRAW_FRAMEBUFFER,Ke.__webglFramebuffer);for(let rt=0;rt<k.length;rt++){if(F.resolveDepthBuffer&&(F.depthBuffer&&(xe|=t.DEPTH_BUFFER_BIT),F.stencilBuffer&&F.resolveStencilBuffer&&(xe|=t.STENCIL_BUFFER_BIT)),ke){t.framebufferRenderbuffer(t.READ_FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.RENDERBUFFER,Ke.__webglColorRenderbuffer[rt]);const Ue=i.get(k[rt]).__webglTexture;t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,Ue,0)}t.blitFramebuffer(0,0,K,pe,0,0,K,pe,xe,t.NEAREST),l===!0&&(V.length=0,ne.length=0,V.push(t.COLOR_ATTACHMENT0+rt),F.depthBuffer&&F.resolveDepthBuffer===!1&&(V.push(fe),ne.push(fe),t.invalidateFramebuffer(t.DRAW_FRAMEBUFFER,ne)),t.invalidateFramebuffer(t.READ_FRAMEBUFFER,V))}if(n.bindFramebuffer(t.READ_FRAMEBUFFER,null),n.bindFramebuffer(t.DRAW_FRAMEBUFFER,null),ke)for(let rt=0;rt<k.length;rt++){n.bindFramebuffer(t.FRAMEBUFFER,Ke.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+rt,t.RENDERBUFFER,Ke.__webglColorRenderbuffer[rt]);const Ue=i.get(k[rt]).__webglTexture;n.bindFramebuffer(t.FRAMEBUFFER,Ke.__webglFramebuffer),t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0+rt,t.TEXTURE_2D,Ue,0)}n.bindFramebuffer(t.DRAW_FRAMEBUFFER,Ke.__webglMultisampledFramebuffer)}else if(F.depthBuffer&&F.resolveDepthBuffer===!1&&l){const k=F.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT;t.invalidateFramebuffer(t.DRAW_FRAMEBUFFER,[k])}}}function ee(F){return Math.min(r.maxSamples,F.samples)}function ae(F){const k=i.get(F);return F.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&k.__useRenderToTexture!==!1}function ie(F){const k=s.render.frame;d.get(F)!==k&&(d.set(F,k),F.update())}function we(F,k){const K=F.colorSpace,pe=F.format,xe=F.type;return F.isCompressedTexture===!0||F.isVideoTexture===!0||K!==bp&&K!==cu&&(xn.getTransfer(K)===On?(pe!==lo||xe!==zo)&&Ht("WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):Ci("WebGLTextures: Unsupported texture color space:",K)),k}function ve(F){return typeof HTMLImageElement<"u"&&F instanceof HTMLImageElement?(c.width=F.naturalWidth||F.width,c.height=F.naturalHeight||F.height):typeof VideoFrame<"u"&&F instanceof VideoFrame?(c.width=F.displayWidth,c.height=F.displayHeight):(c.width=F.width,c.height=F.height),c}this.allocateTextureUnit=W,this.resetTextureUnits=I,this.setTexture2D=$,this.setTexture2DArray=q,this.setTexture3D=G,this.setTextureCube=Y,this.rebindTextures=le,this.setupRenderTarget=ut,this.updateRenderTargetMipmap=z,this.updateMultisampleRenderTarget=J,this.setupDepthRenderbuffer=Be,this.setupFrameBufferTexture=De,this.useMultisampledRTT=ae}function Ude(t,e){function n(i,r=cu){let a;const s=xn.getTransfer(r);if(i===zo)return t.UNSIGNED_BYTE;if(i===IN)return t.UNSIGNED_SHORT_4_4_4_4;if(i===UN)return t.UNSIGNED_SHORT_5_5_5_1;if(i===SG)return t.UNSIGNED_INT_5_9_9_9_REV;if(i===wG)return t.UNSIGNED_INT_10F_11F_11F_REV;if(i===bG)return t.BYTE;if(i===_G)return t.SHORT;if(i===p0)return t.UNSIGNED_SHORT;if(i===kN)return t.INT;if(i===af)return t.UNSIGNED_INT;if(i===Fl)return t.FLOAT;if(i===Xp)return t.HALF_FLOAT;if(i===MG)return t.ALPHA;if(i===EG)return t.RGB;if(i===lo)return t.RGBA;if(i===g0)return t.DEPTH_COMPONENT;if(i===v0)return t.DEPTH_STENCIL;if(i===AG)return t.RED;if(i===FN)return t.RED_INTEGER;if(i===zN)return t.RG;if(i===BN)return t.RG_INTEGER;if(i===jN)return t.RGBA_INTEGER;if(i===Nb||i===Pb||i===Db||i===Ob)if(s===On)if(a=e.get("WEBGL_compressed_texture_s3tc_srgb"),a!==null){if(i===Nb)return a.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(i===Pb)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(i===Db)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(i===Ob)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(a=e.get("WEBGL_compressed_texture_s3tc"),a!==null){if(i===Nb)return a.COMPRESSED_RGB_S3TC_DXT1_EXT;if(i===Pb)return a.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(i===Db)return a.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(i===Ob)return a.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(i===G2||i===$2||i===W2||i===q2)if(a=e.get("WEBGL_compressed_texture_pvrtc"),a!==null){if(i===G2)return a.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(i===$2)return a.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(i===W2)return a.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(i===q2)return a.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(i===X2||i===Y2||i===K2)if(a=e.get("WEBGL_compressed_texture_etc"),a!==null){if(i===X2||i===Y2)return s===On?a.COMPRESSED_SRGB8_ETC2:a.COMPRESSED_RGB8_ETC2;if(i===K2)return s===On?a.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:a.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(i===Z2||i===J2||i===Q2||i===eR||i===tR||i===nR||i===iR||i===rR||i===aR||i===sR||i===oR||i===lR||i===cR||i===uR)if(a=e.get("WEBGL_compressed_texture_astc"),a!==null){if(i===Z2)return s===On?a.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:a.COMPRESSED_RGBA_ASTC_4x4_KHR;if(i===J2)return s===On?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:a.COMPRESSED_RGBA_ASTC_5x4_KHR;if(i===Q2)return s===On?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:a.COMPRESSED_RGBA_ASTC_5x5_KHR;if(i===eR)return s===On?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:a.COMPRESSED_RGBA_ASTC_6x5_KHR;if(i===tR)return s===On?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:a.COMPRESSED_RGBA_ASTC_6x6_KHR;if(i===nR)return s===On?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:a.COMPRESSED_RGBA_ASTC_8x5_KHR;if(i===iR)return s===On?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:a.COMPRESSED_RGBA_ASTC_8x6_KHR;if(i===rR)return s===On?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:a.COMPRESSED_RGBA_ASTC_8x8_KHR;if(i===aR)return s===On?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:a.COMPRESSED_RGBA_ASTC_10x5_KHR;if(i===sR)return s===On?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:a.COMPRESSED_RGBA_ASTC_10x6_KHR;if(i===oR)return s===On?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:a.COMPRESSED_RGBA_ASTC_10x8_KHR;if(i===lR)return s===On?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:a.COMPRESSED_RGBA_ASTC_10x10_KHR;if(i===cR)return s===On?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:a.COMPRESSED_RGBA_ASTC_12x10_KHR;if(i===uR)return s===On?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:a.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(i===dR||i===fR||i===hR)if(a=e.get("EXT_texture_compression_bptc"),a!==null){if(i===dR)return s===On?a.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:a.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(i===fR)return a.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(i===hR)return a.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(i===pR||i===mR||i===gR||i===vR)if(a=e.get("EXT_texture_compression_rgtc"),a!==null){if(i===pR)return a.COMPRESSED_RED_RGTC1_EXT;if(i===mR)return a.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(i===gR)return a.COMPRESSED_RED_GREEN_RGTC2_EXT;if(i===vR)return a.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return i===m0?t.UNSIGNED_INT_24_8:t[i]!==void 0?t[i]:null}return{convert:n}}const Fde=`
  3825. void main() {
  3826. gl_Position = vec4( position, 1.0 );
  3827. }`,zde=`
  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 Bde{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,n){if(this.texture===null){const i=new qG(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 Ql({vertexShader:Fde,fragmentShader:zde,uniforms:{depthColor:{value:this.texture},depthWidth:{value:n.z},depthHeight:{value:n.w}}});this.mesh=new Bo(new qN(20,20),i)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}let jde=class extends Ef{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,p=null,m=null,y=null;const b=typeof XRWebGLBinding<"u",x=new Bde,v={},M=n.getContextAttributes();let w=null,E=null;const T=[],P=[],R=new Qt;let U=null;const N=new Rs;N.viewport=new Bi;const O=new Rs;O.viewport=new Bi;const B=[N,O],I=new roe;let W=null,L=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(me){let be=T[me];return be===void 0&&(be=new sA,T[me]=be),be.getTargetRaySpace()},this.getControllerGrip=function(me){let be=T[me];return be===void 0&&(be=new sA,T[me]=be),be.getGripSpace()},this.getHand=function(me){let be=T[me];return be===void 0&&(be=new sA,T[me]=be),be.getHandSpace()};function $(me){const be=P.indexOf(me.inputSource);if(be===-1)return;const De=T[be];De!==void 0&&(De.update(me.inputSource,me.frame,c||s),De.dispatchEvent({type:me.type,data:me.inputSource}))}function q(){r.removeEventListener("select",$),r.removeEventListener("selectstart",$),r.removeEventListener("selectend",$),r.removeEventListener("squeeze",$),r.removeEventListener("squeezestart",$),r.removeEventListener("squeezeend",$),r.removeEventListener("end",q),r.removeEventListener("inputsourceschange",G);for(let me=0;me<T.length;me++){const be=P[me];be!==null&&(P[me]=null,T[me].disconnect(be))}W=null,L=null,x.reset();for(const me in v)delete v[me];e.setRenderTarget(w),m=null,p=null,f=null,r=null,E=null,ye.stop(),i.isPresenting=!1,e.setPixelRatio(U),e.setSize(R.width,R.height,!1),i.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(me){a=me,i.isPresenting===!0&&Ht("WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(me){o=me,i.isPresenting===!0&&Ht("WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return c||s},this.setReferenceSpace=function(me){c=me},this.getBaseLayer=function(){return p!==null?p:m},this.getBinding=function(){return f===null&&b&&(f=new XRWebGLBinding(r,n)),f},this.getFrame=function(){return y},this.getSession=function(){return r},this.setSession=async function(me){if(r=me,r!==null){if(w=e.getRenderTarget(),r.addEventListener("select",$),r.addEventListener("selectstart",$),r.addEventListener("selectend",$),r.addEventListener("squeeze",$),r.addEventListener("squeezestart",$),r.addEventListener("squeezeend",$),r.addEventListener("end",q),r.addEventListener("inputsourceschange",G),M.xrCompatible!==!0&&await n.makeXRCompatible(),U=e.getPixelRatio(),e.getSize(R),b&&"createProjectionLayer"in XRWebGLBinding.prototype){let De=null,he=null,Ae=null;M.depth&&(Ae=M.stencil?n.DEPTH24_STENCIL8:n.DEPTH_COMPONENT24,De=M.stencil?v0:g0,he=M.stencil?m0:af);const Be={colorFormat:n.RGBA8,depthFormat:Ae,scaleFactor:a};f=this.getBinding(),p=f.createProjectionLayer(Be),r.updateRenderState({layers:[p]}),e.setPixelRatio(1),e.setSize(p.textureWidth,p.textureHeight,!1),E=new of(p.textureWidth,p.textureHeight,{format:lo,type:zo,depthTexture:new WG(p.textureWidth,p.textureHeight,he,void 0,void 0,void 0,void 0,void 0,void 0,De),stencilBuffer:M.stencil,colorSpace:e.outputColorSpace,samples:M.antialias?4:0,resolveDepthBuffer:p.ignoreDepthValues===!1,resolveStencilBuffer:p.ignoreDepthValues===!1})}else{const De={antialias:M.antialias,alpha:!0,depth:M.depth,stencil:M.stencil,framebufferScaleFactor:a};m=new XRWebGLLayer(r,n,De),r.updateRenderState({baseLayer:m}),e.setPixelRatio(1),e.setSize(m.framebufferWidth,m.framebufferHeight,!1),E=new of(m.framebufferWidth,m.framebufferHeight,{format:lo,type:zo,colorSpace:e.outputColorSpace,stencilBuffer:M.stencil,resolveDepthBuffer:m.ignoreDepthValues===!1,resolveStencilBuffer:m.ignoreDepthValues===!1})}E.isXRRenderTarget=!0,this.setFoveation(l),c=null,s=await r.requestReferenceSpace(o),ye.setContext(r),ye.start(),i.isPresenting=!0,i.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(r!==null)return r.environmentBlendMode},this.getDepthTexture=function(){return x.getDepthTexture()};function G(me){for(let be=0;be<me.removed.length;be++){const De=me.removed[be],he=P.indexOf(De);he>=0&&(P[he]=null,T[he].disconnect(De))}for(let be=0;be<me.added.length;be++){const De=me.added[be];let he=P.indexOf(De);if(he===-1){for(let Be=0;Be<T.length;Be++)if(Be>=P.length){P.push(De),he=Be;break}else if(P[Be]===null){P[Be]=De,he=Be;break}if(he===-1)break}const Ae=T[he];Ae&&Ae.connect(De)}}const Y=new Ge,Q=new Ge;function se(me,be,De){Y.setFromMatrixPosition(be.matrixWorld),Q.setFromMatrixPosition(De.matrixWorld);const he=Y.distanceTo(Q),Ae=be.projectionMatrix.elements,Be=De.projectionMatrix.elements,le=Ae[14]/(Ae[10]-1),ut=Ae[14]/(Ae[10]+1),z=(Ae[9]+1)/Ae[5],V=(Ae[9]-1)/Ae[5],ne=(Ae[8]-1)/Ae[0],J=(Be[8]+1)/Be[0],ee=le*ne,ae=le*J,ie=he/(-ne+J),we=ie*-ne;if(be.matrixWorld.decompose(me.position,me.quaternion,me.scale),me.translateX(we),me.translateZ(ie),me.matrixWorld.compose(me.position,me.quaternion,me.scale),me.matrixWorldInverse.copy(me.matrixWorld).invert(),Ae[10]===-1)me.projectionMatrix.copy(be.projectionMatrix),me.projectionMatrixInverse.copy(be.projectionMatrixInverse);else{const ve=le+ie,F=ut+ie,k=ee-we,K=ae+(he-we),pe=z*ut/F*ve,xe=V*ut/F*ve;me.projectionMatrix.makePerspective(k,K,pe,xe,ve,F),me.projectionMatrixInverse.copy(me.projectionMatrix).invert()}}function H(me,be){be===null?me.matrixWorld.copy(me.matrix):me.matrixWorld.multiplyMatrices(be.matrixWorld,me.matrix),me.matrixWorldInverse.copy(me.matrixWorld).invert()}this.updateCamera=function(me){if(r===null)return;let be=me.near,De=me.far;x.texture!==null&&(x.depthNear>0&&(be=x.depthNear),x.depthFar>0&&(De=x.depthFar)),I.near=O.near=N.near=be,I.far=O.far=N.far=De,(W!==I.near||L!==I.far)&&(r.updateRenderState({depthNear:I.near,depthFar:I.far}),W=I.near,L=I.far),I.layers.mask=me.layers.mask|6,N.layers.mask=I.layers.mask&3,O.layers.mask=I.layers.mask&5;const he=me.parent,Ae=I.cameras;H(I,he);for(let Be=0;Be<Ae.length;Be++)H(Ae[Be],he);Ae.length===2?se(I,N,O):I.projectionMatrix.copy(N.projectionMatrix),X(me,I,he)};function X(me,be,De){De===null?me.matrix.copy(be.matrixWorld):(me.matrix.copy(De.matrixWorld),me.matrix.invert(),me.matrix.multiply(be.matrixWorld)),me.matrix.decompose(me.position,me.quaternion,me.scale),me.updateMatrixWorld(!0),me.projectionMatrix.copy(be.projectionMatrix),me.projectionMatrixInverse.copy(be.projectionMatrixInverse),me.isPerspectiveCamera&&(me.fov=xR*2*Math.atan(1/me.projectionMatrix.elements[5]),me.zoom=1)}this.getCamera=function(){return I},this.getFoveation=function(){if(!(p===null&&m===null))return l},this.setFoveation=function(me){l=me,p!==null&&(p.fixedFoveation=me),m!==null&&m.fixedFoveation!==void 0&&(m.fixedFoveation=me)},this.hasDepthSensing=function(){return x.texture!==null},this.getDepthSensingMesh=function(){return x.getMesh(I)},this.getCameraTexture=function(me){return v[me]};let re=null;function ce(me,be){if(d=be.getViewerPose(c||s),y=be,d!==null){const De=d.views;m!==null&&(e.setRenderTargetFramebuffer(E,m.framebuffer),e.setRenderTarget(E));let he=!1;De.length!==I.cameras.length&&(I.cameras.length=0,he=!0);for(let ut=0;ut<De.length;ut++){const z=De[ut];let V=null;if(m!==null)V=m.getViewport(z);else{const J=f.getViewSubImage(p,z);V=J.viewport,ut===0&&(e.setRenderTargetTextures(E,J.colorTexture,J.depthStencilTexture),e.setRenderTarget(E))}let ne=B[ut];ne===void 0&&(ne=new Rs,ne.layers.enable(ut),ne.viewport=new Bi,B[ut]=ne),ne.matrix.fromArray(z.transform.matrix),ne.matrix.decompose(ne.position,ne.quaternion,ne.scale),ne.projectionMatrix.fromArray(z.projectionMatrix),ne.projectionMatrixInverse.copy(ne.projectionMatrix).invert(),ne.viewport.set(V.x,V.y,V.width,V.height),ut===0&&(I.matrix.copy(ne.matrix),I.matrix.decompose(I.position,I.quaternion,I.scale)),he===!0&&I.cameras.push(ne)}const Ae=r.enabledFeatures;if(Ae&&Ae.includes("depth-sensing")&&r.depthUsage=="gpu-optimized"&&b){f=i.getBinding();const ut=f.getDepthInformation(De[0]);ut&&ut.isValid&&ut.texture&&x.init(ut,r.renderState)}if(Ae&&Ae.includes("camera-access")&&b){e.state.unbindTexture(),f=i.getBinding();for(let ut=0;ut<De.length;ut++){const z=De[ut].camera;if(z){let V=v[z];V||(V=new qG,v[z]=V);const ne=f.getCameraImage(z);V.sourceTexture=ne}}}}for(let De=0;De<T.length;De++){const he=P[De],Ae=T[De];he!==null&&Ae!==void 0&&Ae.update(he,be,c||s)}re&&re(me,be),be.detectedPlanes&&i.dispatchEvent({type:"planesdetected",data:be}),y=null}const ye=new ZG;ye.setAnimationLoop(ce),this.setAnimationLoop=function(me){re=me},this.dispose=function(){}}};const hd=new Nu,Hde=new Gi;function Vde(t,e){function n(x,v){x.matrixAutoUpdate===!0&&x.updateMatrix(),v.value.copy(x.matrix)}function i(x,v){v.color.getRGB(x.fogColor.value,HG(t)),v.isFog?(x.fogNear.value=v.near,x.fogFar.value=v.far):v.isFogExp2&&(x.fogDensity.value=v.density)}function r(x,v,M,w,E){v.isMeshBasicMaterial||v.isMeshLambertMaterial?a(x,v):v.isMeshToonMaterial?(a(x,v),f(x,v)):v.isMeshPhongMaterial?(a(x,v),d(x,v)):v.isMeshStandardMaterial?(a(x,v),p(x,v),v.isMeshPhysicalMaterial&&m(x,v,E)):v.isMeshMatcapMaterial?(a(x,v),y(x,v)):v.isMeshDepthMaterial?a(x,v):v.isMeshDistanceMaterial?(a(x,v),b(x,v)):v.isMeshNormalMaterial?a(x,v):v.isLineBasicMaterial?(s(x,v),v.isLineDashedMaterial&&o(x,v)):v.isPointsMaterial?l(x,v,M,w):v.isSpriteMaterial?c(x,v):v.isShadowMaterial?(x.color.value.copy(v.color),x.opacity.value=v.opacity):v.isShaderMaterial&&(v.uniformsNeedUpdate=!1)}function a(x,v){x.opacity.value=v.opacity,v.color&&x.diffuse.value.copy(v.color),v.emissive&&x.emissive.value.copy(v.emissive).multiplyScalar(v.emissiveIntensity),v.map&&(x.map.value=v.map,n(v.map,x.mapTransform)),v.alphaMap&&(x.alphaMap.value=v.alphaMap,n(v.alphaMap,x.alphaMapTransform)),v.bumpMap&&(x.bumpMap.value=v.bumpMap,n(v.bumpMap,x.bumpMapTransform),x.bumpScale.value=v.bumpScale,v.side===Pa&&(x.bumpScale.value*=-1)),v.normalMap&&(x.normalMap.value=v.normalMap,n(v.normalMap,x.normalMapTransform),x.normalScale.value.copy(v.normalScale),v.side===Pa&&x.normalScale.value.negate()),v.displacementMap&&(x.displacementMap.value=v.displacementMap,n(v.displacementMap,x.displacementMapTransform),x.displacementScale.value=v.displacementScale,x.displacementBias.value=v.displacementBias),v.emissiveMap&&(x.emissiveMap.value=v.emissiveMap,n(v.emissiveMap,x.emissiveMapTransform)),v.specularMap&&(x.specularMap.value=v.specularMap,n(v.specularMap,x.specularMapTransform)),v.alphaTest>0&&(x.alphaTest.value=v.alphaTest);const M=e.get(v),w=M.envMap,E=M.envMapRotation;w&&(x.envMap.value=w,hd.copy(E),hd.x*=-1,hd.y*=-1,hd.z*=-1,w.isCubeTexture&&w.isRenderTargetTexture===!1&&(hd.y*=-1,hd.z*=-1),x.envMapRotation.value.setFromMatrix4(Hde.makeRotationFromEuler(hd)),x.flipEnvMap.value=w.isCubeTexture&&w.isRenderTargetTexture===!1?-1:1,x.reflectivity.value=v.reflectivity,x.ior.value=v.ior,x.refractionRatio.value=v.refractionRatio),v.lightMap&&(x.lightMap.value=v.lightMap,x.lightMapIntensity.value=v.lightMapIntensity,n(v.lightMap,x.lightMapTransform)),v.aoMap&&(x.aoMap.value=v.aoMap,x.aoMapIntensity.value=v.aoMapIntensity,n(v.aoMap,x.aoMapTransform))}function s(x,v){x.diffuse.value.copy(v.color),x.opacity.value=v.opacity,v.map&&(x.map.value=v.map,n(v.map,x.mapTransform))}function o(x,v){x.dashSize.value=v.dashSize,x.totalSize.value=v.dashSize+v.gapSize,x.scale.value=v.scale}function l(x,v,M,w){x.diffuse.value.copy(v.color),x.opacity.value=v.opacity,x.size.value=v.size*M,x.scale.value=w*.5,v.map&&(x.map.value=v.map,n(v.map,x.uvTransform)),v.alphaMap&&(x.alphaMap.value=v.alphaMap,n(v.alphaMap,x.alphaMapTransform)),v.alphaTest>0&&(x.alphaTest.value=v.alphaTest)}function c(x,v){x.diffuse.value.copy(v.color),x.opacity.value=v.opacity,x.rotation.value=v.rotation,v.map&&(x.map.value=v.map,n(v.map,x.mapTransform)),v.alphaMap&&(x.alphaMap.value=v.alphaMap,n(v.alphaMap,x.alphaMapTransform)),v.alphaTest>0&&(x.alphaTest.value=v.alphaTest)}function d(x,v){x.specular.value.copy(v.specular),x.shininess.value=Math.max(v.shininess,1e-4)}function f(x,v){v.gradientMap&&(x.gradientMap.value=v.gradientMap)}function p(x,v){x.metalness.value=v.metalness,v.metalnessMap&&(x.metalnessMap.value=v.metalnessMap,n(v.metalnessMap,x.metalnessMapTransform)),x.roughness.value=v.roughness,v.roughnessMap&&(x.roughnessMap.value=v.roughnessMap,n(v.roughnessMap,x.roughnessMapTransform)),v.envMap&&(x.envMapIntensity.value=v.envMapIntensity)}function m(x,v,M){x.ior.value=v.ior,v.sheen>0&&(x.sheenColor.value.copy(v.sheenColor).multiplyScalar(v.sheen),x.sheenRoughness.value=v.sheenRoughness,v.sheenColorMap&&(x.sheenColorMap.value=v.sheenColorMap,n(v.sheenColorMap,x.sheenColorMapTransform)),v.sheenRoughnessMap&&(x.sheenRoughnessMap.value=v.sheenRoughnessMap,n(v.sheenRoughnessMap,x.sheenRoughnessMapTransform))),v.clearcoat>0&&(x.clearcoat.value=v.clearcoat,x.clearcoatRoughness.value=v.clearcoatRoughness,v.clearcoatMap&&(x.clearcoatMap.value=v.clearcoatMap,n(v.clearcoatMap,x.clearcoatMapTransform)),v.clearcoatRoughnessMap&&(x.clearcoatRoughnessMap.value=v.clearcoatRoughnessMap,n(v.clearcoatRoughnessMap,x.clearcoatRoughnessMapTransform)),v.clearcoatNormalMap&&(x.clearcoatNormalMap.value=v.clearcoatNormalMap,n(v.clearcoatNormalMap,x.clearcoatNormalMapTransform),x.clearcoatNormalScale.value.copy(v.clearcoatNormalScale),v.side===Pa&&x.clearcoatNormalScale.value.negate())),v.dispersion>0&&(x.dispersion.value=v.dispersion),v.iridescence>0&&(x.iridescence.value=v.iridescence,x.iridescenceIOR.value=v.iridescenceIOR,x.iridescenceThicknessMinimum.value=v.iridescenceThicknessRange[0],x.iridescenceThicknessMaximum.value=v.iridescenceThicknessRange[1],v.iridescenceMap&&(x.iridescenceMap.value=v.iridescenceMap,n(v.iridescenceMap,x.iridescenceMapTransform)),v.iridescenceThicknessMap&&(x.iridescenceThicknessMap.value=v.iridescenceThicknessMap,n(v.iridescenceThicknessMap,x.iridescenceThicknessMapTransform))),v.transmission>0&&(x.transmission.value=v.transmission,x.transmissionSamplerMap.value=M.texture,x.transmissionSamplerSize.value.set(M.width,M.height),v.transmissionMap&&(x.transmissionMap.value=v.transmissionMap,n(v.transmissionMap,x.transmissionMapTransform)),x.thickness.value=v.thickness,v.thicknessMap&&(x.thicknessMap.value=v.thicknessMap,n(v.thicknessMap,x.thicknessMapTransform)),x.attenuationDistance.value=v.attenuationDistance,x.attenuationColor.value.copy(v.attenuationColor)),v.anisotropy>0&&(x.anisotropyVector.value.set(v.anisotropy*Math.cos(v.anisotropyRotation),v.anisotropy*Math.sin(v.anisotropyRotation)),v.anisotropyMap&&(x.anisotropyMap.value=v.anisotropyMap,n(v.anisotropyMap,x.anisotropyMapTransform))),x.specularIntensity.value=v.specularIntensity,x.specularColor.value.copy(v.specularColor),v.specularColorMap&&(x.specularColorMap.value=v.specularColorMap,n(v.specularColorMap,x.specularColorMapTransform)),v.specularIntensityMap&&(x.specularIntensityMap.value=v.specularIntensityMap,n(v.specularIntensityMap,x.specularIntensityMapTransform))}function y(x,v){v.matcap&&(x.matcap.value=v.matcap)}function b(x,v){const M=e.get(v).light;x.referencePosition.value.setFromMatrixPosition(M.matrixWorld),x.nearDistance.value=M.shadow.camera.near,x.farDistance.value=M.shadow.camera.far}return{refreshFogUniforms:i,refreshMaterialUniforms:r}}function Gde(t,e,n,i){let r={},a={},s=[];const o=t.getParameter(t.MAX_UNIFORM_BUFFER_BINDINGS);function l(M,w){const E=w.program;i.uniformBlockBinding(M,E)}function c(M,w){let E=r[M.id];E===void 0&&(y(M),E=d(M),r[M.id]=E,M.addEventListener("dispose",x));const T=w.program;i.updateUBOMapping(M,T);const P=e.render.frame;a[M.id]!==P&&(p(M),a[M.id]=P)}function d(M){const w=f();M.__bindingPointIndex=w;const E=t.createBuffer(),T=M.__size,P=M.usage;return t.bindBuffer(t.UNIFORM_BUFFER,E),t.bufferData(t.UNIFORM_BUFFER,T,P),t.bindBuffer(t.UNIFORM_BUFFER,null),t.bindBufferBase(t.UNIFORM_BUFFER,w,E),E}function f(){for(let M=0;M<o;M++)if(s.indexOf(M)===-1)return s.push(M),M;return Ci("WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function p(M){const w=r[M.id],E=M.uniforms,T=M.__cache;t.bindBuffer(t.UNIFORM_BUFFER,w);for(let P=0,R=E.length;P<R;P++){const U=Array.isArray(E[P])?E[P]:[E[P]];for(let N=0,O=U.length;N<O;N++){const B=U[N];if(m(B,P,N,T)===!0){const I=B.__offset,W=Array.isArray(B.value)?B.value:[B.value];let L=0;for(let $=0;$<W.length;$++){const q=W[$],G=b(q);typeof q=="number"||typeof q=="boolean"?(B.__data[0]=q,t.bufferSubData(t.UNIFORM_BUFFER,I+L,B.__data)):q.isMatrix3?(B.__data[0]=q.elements[0],B.__data[1]=q.elements[1],B.__data[2]=q.elements[2],B.__data[3]=0,B.__data[4]=q.elements[3],B.__data[5]=q.elements[4],B.__data[6]=q.elements[5],B.__data[7]=0,B.__data[8]=q.elements[6],B.__data[9]=q.elements[7],B.__data[10]=q.elements[8],B.__data[11]=0):(q.toArray(B.__data,L),L+=G.storage/Float32Array.BYTES_PER_ELEMENT)}t.bufferSubData(t.UNIFORM_BUFFER,I,B.__data)}}}t.bindBuffer(t.UNIFORM_BUFFER,null)}function m(M,w,E,T){const P=M.value,R=w+"_"+E;if(T[R]===void 0)return typeof P=="number"||typeof P=="boolean"?T[R]=P:T[R]=P.clone(),!0;{const U=T[R];if(typeof P=="number"||typeof P=="boolean"){if(U!==P)return T[R]=P,!0}else if(U.equals(P)===!1)return U.copy(P),!0}return!1}function y(M){const w=M.uniforms;let E=0;const T=16;for(let R=0,U=w.length;R<U;R++){const N=Array.isArray(w[R])?w[R]:[w[R]];for(let O=0,B=N.length;O<B;O++){const I=N[O],W=Array.isArray(I.value)?I.value:[I.value];for(let L=0,$=W.length;L<$;L++){const q=W[L],G=b(q),Y=E%T,Q=Y%G.boundary,se=Y+Q;E+=Q,se!==0&&T-se<G.storage&&(E+=T-se),I.__data=new Float32Array(G.storage/Float32Array.BYTES_PER_ELEMENT),I.__offset=E,E+=G.storage}}}const P=E%T;return P>0&&(E+=T-P),M.__size=E,M.__cache={},this}function b(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?Ht("WebGLRenderer: Texture samplers can not be part of an uniforms group."):Ht("WebGLRenderer: Unsupported uniform value type.",M),w}function x(M){const w=M.target;w.removeEventListener("dispose",x);const E=s.indexOf(w.__bindingPointIndex);s.splice(E,1),t.deleteBuffer(r[w.id]),delete r[w.id],delete a[w.id]}function v(){for(const M in r)t.deleteBuffer(r[M]);s=[],r={},a={}}return{bind:l,update:c,dispose:v}}const $de=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 yl=null;function Wde(){return yl===null&&(yl=new Wse($de,32,32,zN,Xp),yl.minFilter=Ls,yl.magFilter=Ls,yl.wrapS=Ul,yl.wrapT=Ul,yl.generateMipmaps=!1,yl.needsUpdate=!0),yl}let qde=class{constructor(e={}){const{canvas:n=vse(),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:p=!1}=e;this.isWebGLRenderer=!0;let m;if(i!==null){if(typeof WebGLRenderingContext<"u"&&i instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");m=i.getContextAttributes().alpha}else m=s;const y=new Set([jN,BN,FN]),b=new Set([zo,af,p0,m0,IN,UN]),x=new Uint32Array(4),v=new Int32Array(4);let M=null,w=null;const E=[],T=[];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=bu,this.toneMappingExposure=1,this.transmissionResolutionScale=1;const P=this;let R=!1;this._outputColorSpace=As;let U=0,N=0,O=null,B=-1,I=null;const W=new Bi,L=new Bi;let $=null;const q=new fn(0);let G=0,Y=n.width,Q=n.height,se=1,H=null,X=null;const re=new Bi(0,0,Y,Q),ce=new Bi(0,0,Y,Q);let ye=!1;const me=new WN;let be=!1,De=!1;const he=new Gi,Ae=new Ge,Be=new Bi,le={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let ut=!1;function z(){return O===null?se:1}let V=i;function ne(Z,_e){return n.getContext(Z,_e)}try{const Z={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${ON}`),n.addEventListener("webglcontextlost",Ee,!1),n.addEventListener("webglcontextrestored",ge,!1),n.addEventListener("webglcontextcreationerror",je,!1),V===null){const _e="webgl2";if(V=ne(_e,Z),V===null)throw ne(_e)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(Z){throw Z("WebGLRenderer: "+Z.message),Z}let J,ee,ae,ie,we,ve,F,k,K,pe,xe,fe,Ke,ke,$e,rt,Ue,Pe,dt,et,Qe,st,ue,tt;function de(){J=new tue(V),J.init(),st=new Ude(V,J),ee=new Wce(V,J,e,st),ae=new kde(V,J),ee.reversedDepthBuffer&&p&&ae.buffers.depth.setReversed(!0),ie=new rue(V),we=new Sde,ve=new Ide(V,J,ae,we,ee,st,ie),F=new Xce(P),k=new eue(P),K=new loe(V),ue=new Gce(V,K),pe=new nue(V,K,ie,ue),xe=new sue(V,pe,K,ie),dt=new aue(V,ee,ve),rt=new qce(we),fe=new _de(P,F,k,J,ee,ue,rt),Ke=new Vde(P,we),ke=new Mde,$e=new Nde(J),Pe=new Vce(P,F,k,ae,xe,m,l),Ue=new Ode(P,xe,ee),tt=new Gde(V,ie,ee,ae),et=new $ce(V,J,ie),Qe=new iue(V,J,ie),ie.programs=fe.programs,P.capabilities=ee,P.extensions=J,P.properties=we,P.renderLists=ke,P.shadowMap=Ue,P.state=ae,P.info=ie}de();const Le=new jde(P,V);this.xr=Le,this.getContext=function(){return V},this.getContextAttributes=function(){return V.getContextAttributes()},this.forceContextLoss=function(){const Z=J.get("WEBGL_lose_context");Z&&Z.loseContext()},this.forceContextRestore=function(){const Z=J.get("WEBGL_lose_context");Z&&Z.restoreContext()},this.getPixelRatio=function(){return se},this.setPixelRatio=function(Z){Z!==void 0&&(se=Z,this.setSize(Y,Q,!1))},this.getSize=function(Z){return Z.set(Y,Q)},this.setSize=function(Z,_e,Ne=!0){if(Le.isPresenting){Ht("WebGLRenderer: Can't change size while VR device is presenting.");return}Y=Z,Q=_e,n.width=Math.floor(Z*se),n.height=Math.floor(_e*se),Ne===!0&&(n.style.width=Z+"px",n.style.height=_e+"px"),this.setViewport(0,0,Z,_e)},this.getDrawingBufferSize=function(Z){return Z.set(Y*se,Q*se).floor()},this.setDrawingBufferSize=function(Z,_e,Ne){Y=Z,Q=_e,se=Ne,n.width=Math.floor(Z*Ne),n.height=Math.floor(_e*Ne),this.setViewport(0,0,Z,_e)},this.getCurrentViewport=function(Z){return Z.copy(W)},this.getViewport=function(Z){return Z.copy(re)},this.setViewport=function(Z,_e,Ne,Re){Z.isVector4?re.set(Z.x,Z.y,Z.z,Z.w):re.set(Z,_e,Ne,Re),ae.viewport(W.copy(re).multiplyScalar(se).round())},this.getScissor=function(Z){return Z.copy(ce)},this.setScissor=function(Z,_e,Ne,Re){Z.isVector4?ce.set(Z.x,Z.y,Z.z,Z.w):ce.set(Z,_e,Ne,Re),ae.scissor(L.copy(ce).multiplyScalar(se).round())},this.getScissorTest=function(){return ye},this.setScissorTest=function(Z){ae.setScissorTest(ye=Z)},this.setOpaqueSort=function(Z){H=Z},this.setTransparentSort=function(Z){X=Z},this.getClearColor=function(Z){return Z.copy(Pe.getClearColor())},this.setClearColor=function(){Pe.setClearColor(...arguments)},this.getClearAlpha=function(){return Pe.getClearAlpha()},this.setClearAlpha=function(){Pe.setClearAlpha(...arguments)},this.clear=function(Z=!0,_e=!0,Ne=!0){let Re=0;if(Z){let Me=!1;if(O!==null){const Ze=O.texture.format;Me=y.has(Ze)}if(Me){const Ze=O.texture.type,ot=b.has(Ze),mt=Pe.getClearColor(),pt=Pe.getClearAlpha(),Rt=mt.r,St=mt.g,ft=mt.b;ot?(x[0]=Rt,x[1]=St,x[2]=ft,x[3]=pt,V.clearBufferuiv(V.COLOR,0,x)):(v[0]=Rt,v[1]=St,v[2]=ft,v[3]=pt,V.clearBufferiv(V.COLOR,0,v))}else Re|=V.COLOR_BUFFER_BIT}_e&&(Re|=V.DEPTH_BUFFER_BIT),Ne&&(Re|=V.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),V.clear(Re)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){n.removeEventListener("webglcontextlost",Ee,!1),n.removeEventListener("webglcontextrestored",ge,!1),n.removeEventListener("webglcontextcreationerror",je,!1),Pe.dispose(),ke.dispose(),$e.dispose(),we.dispose(),F.dispose(),k.dispose(),xe.dispose(),ue.dispose(),tt.dispose(),fe.dispose(),Le.dispose(),Le.removeEventListener("sessionstart",zn),Le.removeEventListener("sessionend",ur),Xi.stop()};function Ee(Z){Z.preventDefault(),T4("WebGLRenderer: Context Lost."),R=!0}function ge(){T4("WebGLRenderer: Context Restored."),R=!1;const Z=ie.autoReset,_e=Ue.enabled,Ne=Ue.autoUpdate,Re=Ue.needsUpdate,Me=Ue.type;de(),ie.autoReset=Z,Ue.enabled=_e,Ue.autoUpdate=Ne,Ue.needsUpdate=Re,Ue.type=Me}function je(Z){Ci("WebGLRenderer: A WebGL context could not be created. Reason: ",Z.statusMessage)}function at(Z){const _e=Z.target;_e.removeEventListener("dispose",at),yt(_e)}function yt(Z){Ct(Z),we.remove(Z)}function Ct(Z){const _e=we.get(Z).programs;_e!==void 0&&(_e.forEach(function(Ne){fe.releaseProgram(Ne)}),Z.isShaderMaterial&&fe.releaseShaderCache(Z))}this.renderBufferDirect=function(Z,_e,Ne,Re,Me,Ze){_e===null&&(_e=le);const ot=Me.isMesh&&Me.matrixWorld.determinant()<0,mt=oe(Z,_e,Ne,Re,Me);ae.setMaterial(Re,ot);let pt=Ne.index,Rt=1;if(Re.wireframe===!0){if(pt=pe.getWireframeAttribute(Ne),pt===void 0)return;Rt=2}const St=Ne.drawRange,ft=Ne.attributes.position;let jt=St.start*Rt,Ot=(St.start+St.count)*Rt;Ze!==null&&(jt=Math.max(jt,Ze.start*Rt),Ot=Math.min(Ot,(Ze.start+Ze.count)*Rt)),pt!==null?(jt=Math.max(jt,0),Ot=Math.min(Ot,pt.count)):ft!=null&&(jt=Math.max(jt,0),Ot=Math.min(Ot,ft.count));const Yt=Ot-jt;if(Yt<0||Yt===1/0)return;ue.setup(Me,Re,mt,Ne,pt);let rn,cn=et;if(pt!==null&&(rn=K.get(pt),cn=Qe,cn.setIndex(rn)),Me.isMesh)Re.wireframe===!0?(ae.setLineWidth(Re.wireframeLinewidth*z()),cn.setMode(V.LINES)):cn.setMode(V.TRIANGLES);else if(Me.isLine){let Dt=Re.linewidth;Dt===void 0&&(Dt=1),ae.setLineWidth(Dt*z()),Me.isLineSegments?cn.setMode(V.LINES):Me.isLineLoop?cn.setMode(V.LINE_LOOP):cn.setMode(V.LINE_STRIP)}else Me.isPoints?cn.setMode(V.POINTS):Me.isSprite&&cn.setMode(V.TRIANGLES);if(Me.isBatchedMesh)if(Me._multiDrawInstances!==null)x0("WebGLRenderer: renderMultiDrawInstances has been deprecated and will be removed in r184. Append to renderMultiDraw arguments and use indirection."),cn.renderMultiDrawInstances(Me._multiDrawStarts,Me._multiDrawCounts,Me._multiDrawCount,Me._multiDrawInstances);else if(J.get("WEBGL_multi_draw"))cn.renderMultiDraw(Me._multiDrawStarts,Me._multiDrawCounts,Me._multiDrawCount);else{const Dt=Me._multiDrawStarts,Gt=Me._multiDrawCounts,Wt=Me._multiDrawCount,hi=pt?K.get(pt).bytesPerElement:1,Mi=we.get(Re).currentProgram.getUniforms();for(let Sn=0;Sn<Wt;Sn++)Mi.setValue(V,"_gl_DrawID",Sn),cn.render(Dt[Sn]/hi,Gt[Sn])}else if(Me.isInstancedMesh)cn.renderInstances(jt,Yt,Me.count);else if(Ne.isInstancedBufferGeometry){const Dt=Ne._maxInstanceCount!==void 0?Ne._maxInstanceCount:1/0,Gt=Math.min(Ne.instanceCount,Dt);cn.renderInstances(jt,Yt,Gt)}else cn.render(jt,Yt)};function tn(Z,_e,Ne){Z.transparent===!0&&Z.side===Po&&Z.forceSinglePass===!1?(Z.side=Pa,Z.needsUpdate=!0,wi(Z,_e,Ne),Z.side=Ru,Z.needsUpdate=!0,wi(Z,_e,Ne),Z.side=Po):wi(Z,_e,Ne)}this.compile=function(Z,_e,Ne=null){Ne===null&&(Ne=Z),w=$e.get(Ne),w.init(_e),T.push(w),Ne.traverseVisible(function(Me){Me.isLight&&Me.layers.test(_e.layers)&&(w.pushLight(Me),Me.castShadow&&w.pushShadow(Me))}),Z!==Ne&&Z.traverseVisible(function(Me){Me.isLight&&Me.layers.test(_e.layers)&&(w.pushLight(Me),Me.castShadow&&w.pushShadow(Me))}),w.setupLights();const Re=new Set;return Z.traverse(function(Me){if(!(Me.isMesh||Me.isPoints||Me.isLine||Me.isSprite))return;const Ze=Me.material;if(Ze)if(Array.isArray(Ze))for(let ot=0;ot<Ze.length;ot++){const mt=Ze[ot];tn(mt,Ne,Me),Re.add(mt)}else tn(Ze,Ne,Me),Re.add(Ze)}),w=T.pop(),Re},this.compileAsync=function(Z,_e,Ne=null){const Re=this.compile(Z,_e,Ne);return new Promise(Me=>{function Ze(){if(Re.forEach(function(ot){we.get(ot).currentProgram.isReady()&&Re.delete(ot)}),Re.size===0){Me(Z);return}setTimeout(Ze,10)}J.get("KHR_parallel_shader_compile")!==null?Ze():setTimeout(Ze,10)})};let Pt=null;function wn(Z){Pt&&Pt(Z)}function zn(){Xi.stop()}function ur(){Xi.start()}const Xi=new ZG;Xi.setAnimationLoop(wn),typeof self<"u"&&Xi.setContext(self),this.setAnimationLoop=function(Z){Pt=Z,Le.setAnimationLoop(Z),Z===null?Xi.stop():Xi.start()},Le.addEventListener("sessionstart",zn),Le.addEventListener("sessionend",ur),this.render=function(Z,_e){if(_e!==void 0&&_e.isCamera!==!0){Ci("WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(R===!0)return;if(Z.matrixWorldAutoUpdate===!0&&Z.updateMatrixWorld(),_e.parent===null&&_e.matrixWorldAutoUpdate===!0&&_e.updateMatrixWorld(),Le.enabled===!0&&Le.isPresenting===!0&&(Le.cameraAutoUpdate===!0&&Le.updateCamera(_e),_e=Le.getCamera()),Z.isScene===!0&&Z.onBeforeRender(P,Z,_e,O),w=$e.get(Z,T.length),w.init(_e),T.push(w),he.multiplyMatrices(_e.projectionMatrix,_e.matrixWorldInverse),me.setFromProjectionMatrix(he,Oo,_e.reversedDepth),De=this.localClippingEnabled,be=rt.init(this.clippingPlanes,De),M=ke.get(Z,E.length),M.init(),E.push(M),Le.enabled===!0&&Le.isPresenting===!0){const Ze=P.xr.getDepthSensingMesh();Ze!==null&&dr(Ze,_e,-1/0,P.sortObjects)}dr(Z,_e,0,P.sortObjects),M.finish(),P.sortObjects===!0&&M.sort(H,X),ut=Le.enabled===!1||Le.isPresenting===!1||Le.hasDepthSensing()===!1,ut&&Pe.addToRenderList(M,Z),this.info.render.frame++,be===!0&&rt.beginShadows();const Ne=w.state.shadowsArray;Ue.render(Ne,Z,_e),be===!0&&rt.endShadows(),this.info.autoReset===!0&&this.info.reset();const Re=M.opaque,Me=M.transmissive;if(w.setupLights(),_e.isArrayCamera){const Ze=_e.cameras;if(Me.length>0)for(let ot=0,mt=Ze.length;ot<mt;ot++){const pt=Ze[ot];Vr(Re,Me,Z,pt)}ut&&Pe.render(Z);for(let ot=0,mt=Ze.length;ot<mt;ot++){const pt=Ze[ot];Ar(M,Z,pt,pt.viewport)}}else Me.length>0&&Vr(Re,Me,Z,_e),ut&&Pe.render(Z),Ar(M,Z,_e);O!==null&&N===0&&(ve.updateMultisampleRenderTarget(O),ve.updateRenderTargetMipmap(O)),Z.isScene===!0&&Z.onAfterRender(P,Z,_e),ue.resetDefaultState(),B=-1,I=null,T.pop(),T.length>0?(w=T[T.length-1],be===!0&&rt.setGlobalState(P.clippingPlanes,w.state.camera)):w=null,E.pop(),E.length>0?M=E[E.length-1]:M=null};function dr(Z,_e,Ne,Re){if(Z.visible===!1)return;if(Z.layers.test(_e.layers)){if(Z.isGroup)Ne=Z.renderOrder;else if(Z.isLOD)Z.autoUpdate===!0&&Z.update(_e);else if(Z.isLight)w.pushLight(Z),Z.castShadow&&w.pushShadow(Z);else if(Z.isSprite){if(!Z.frustumCulled||me.intersectsSprite(Z)){Re&&Be.setFromMatrixPosition(Z.matrixWorld).applyMatrix4(he);const ot=xe.update(Z),mt=Z.material;mt.visible&&M.push(Z,ot,mt,Ne,Be.z,null)}}else if((Z.isMesh||Z.isLine||Z.isPoints)&&(!Z.frustumCulled||me.intersectsObject(Z))){const ot=xe.update(Z),mt=Z.material;if(Re&&(Z.boundingSphere!==void 0?(Z.boundingSphere===null&&Z.computeBoundingSphere(),Be.copy(Z.boundingSphere.center)):(ot.boundingSphere===null&&ot.computeBoundingSphere(),Be.copy(ot.boundingSphere.center)),Be.applyMatrix4(Z.matrixWorld).applyMatrix4(he)),Array.isArray(mt)){const pt=ot.groups;for(let Rt=0,St=pt.length;Rt<St;Rt++){const ft=pt[Rt],jt=mt[ft.materialIndex];jt&&jt.visible&&M.push(Z,ot,jt,Ne,Be.z,ft)}}else mt.visible&&M.push(Z,ot,mt,Ne,Be.z,null)}}const Ze=Z.children;for(let ot=0,mt=Ze.length;ot<mt;ot++)dr(Ze[ot],_e,Ne,Re)}function Ar(Z,_e,Ne,Re){const{opaque:Me,transmissive:Ze,transparent:ot}=Z;w.setupLightsView(Ne),be===!0&&rt.setGlobalState(P.clippingPlanes,Ne),Re&&ae.viewport(W.copy(Re)),Me.length>0&&Di(Me,_e,Ne),Ze.length>0&&Di(Ze,_e,Ne),ot.length>0&&Di(ot,_e,Ne),ae.buffers.depth.setTest(!0),ae.buffers.depth.setMask(!0),ae.buffers.color.setMask(!0),ae.setPolygonOffset(!1)}function Vr(Z,_e,Ne,Re){if((Ne.isScene===!0?Ne.overrideMaterial:null)!==null)return;w.state.transmissionRenderTarget[Re.id]===void 0&&(w.state.transmissionRenderTarget[Re.id]=new of(1,1,{generateMipmaps:!0,type:J.has("EXT_color_buffer_half_float")||J.has("EXT_color_buffer_float")?Xp:zo,minFilter:Dd,samples:4,stencilBuffer:a,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:xn.workingColorSpace}));const Ze=w.state.transmissionRenderTarget[Re.id],ot=Re.viewport||W;Ze.setSize(ot.z*P.transmissionResolutionScale,ot.w*P.transmissionResolutionScale);const mt=P.getRenderTarget(),pt=P.getActiveCubeFace(),Rt=P.getActiveMipmapLevel();P.setRenderTarget(Ze),P.getClearColor(q),G=P.getClearAlpha(),G<1&&P.setClearColor(16777215,.5),P.clear(),ut&&Pe.render(Ne);const St=P.toneMapping;P.toneMapping=bu;const ft=Re.viewport;if(Re.viewport!==void 0&&(Re.viewport=void 0),w.setupLightsView(Re),be===!0&&rt.setGlobalState(P.clippingPlanes,Re),Di(Z,Ne,Re),ve.updateMultisampleRenderTarget(Ze),ve.updateRenderTargetMipmap(Ze),J.has("WEBGL_multisampled_render_to_texture")===!1){let jt=!1;for(let Ot=0,Yt=_e.length;Ot<Yt;Ot++){const rn=_e[Ot],{object:cn,geometry:Dt,material:Gt,group:Wt}=rn;if(Gt.side===Po&&cn.layers.test(Re.layers)){const hi=Gt.side;Gt.side=Pa,Gt.needsUpdate=!0,si(cn,Ne,Re,Dt,Gt,Wt),Gt.side=hi,Gt.needsUpdate=!0,jt=!0}}jt===!0&&(ve.updateMultisampleRenderTarget(Ze),ve.updateRenderTargetMipmap(Ze))}P.setRenderTarget(mt,pt,Rt),P.setClearColor(q,G),ft!==void 0&&(Re.viewport=ft),P.toneMapping=St}function Di(Z,_e,Ne){const Re=_e.isScene===!0?_e.overrideMaterial:null;for(let Me=0,Ze=Z.length;Me<Ze;Me++){const ot=Z[Me],{object:mt,geometry:pt,group:Rt}=ot;let St=ot.material;St.allowOverride===!0&&Re!==null&&(St=Re),mt.layers.test(Ne.layers)&&si(mt,_e,Ne,pt,St,Rt)}}function si(Z,_e,Ne,Re,Me,Ze){Z.onBeforeRender(P,_e,Ne,Re,Me,Ze),Z.modelViewMatrix.multiplyMatrices(Ne.matrixWorldInverse,Z.matrixWorld),Z.normalMatrix.getNormalMatrix(Z.modelViewMatrix),Me.onBeforeRender(P,_e,Ne,Re,Z,Ze),Me.transparent===!0&&Me.side===Po&&Me.forceSinglePass===!1?(Me.side=Pa,Me.needsUpdate=!0,P.renderBufferDirect(Ne,_e,Re,Me,Z,Ze),Me.side=Ru,Me.needsUpdate=!0,P.renderBufferDirect(Ne,_e,Re,Me,Z,Ze),Me.side=Po):P.renderBufferDirect(Ne,_e,Re,Me,Z,Ze),Z.onAfterRender(P,_e,Ne,Re,Me,Ze)}function wi(Z,_e,Ne){_e.isScene!==!0&&(_e=le);const Re=we.get(Z),Me=w.state.lights,Ze=w.state.shadowsArray,ot=Me.state.version,mt=fe.getParameters(Z,Me.state,Ze,_e,Ne),pt=fe.getProgramCacheKey(mt);let Rt=Re.programs;Re.environment=Z.isMeshStandardMaterial?_e.environment:null,Re.fog=_e.fog,Re.envMap=(Z.isMeshStandardMaterial?k:F).get(Z.envMap||Re.environment),Re.envMapRotation=Re.environment!==null&&Z.envMap===null?_e.environmentRotation:Z.envMapRotation,Rt===void 0&&(Z.addEventListener("dispose",at),Rt=new Map,Re.programs=Rt);let St=Rt.get(pt);if(St!==void 0){if(Re.currentProgram===St&&Re.lightsStateVersion===ot)return gc(Z,mt),St}else mt.uniforms=fe.getUniforms(Z),Z.onBeforeCompile(mt,P),St=fe.acquireProgram(mt,pt),Rt.set(pt,St),Re.uniforms=mt.uniforms;const ft=Re.uniforms;return(!Z.isShaderMaterial&&!Z.isRawShaderMaterial||Z.clipping===!0)&&(ft.clippingPlanes=rt.uniform),gc(Z,mt),Re.needsLights=qe(Z),Re.lightsStateVersion=ot,Re.needsLights&&(ft.ambientLightColor.value=Me.state.ambient,ft.lightProbe.value=Me.state.probe,ft.directionalLights.value=Me.state.directional,ft.directionalLightShadows.value=Me.state.directionalShadow,ft.spotLights.value=Me.state.spot,ft.spotLightShadows.value=Me.state.spotShadow,ft.rectAreaLights.value=Me.state.rectArea,ft.ltc_1.value=Me.state.rectAreaLTC1,ft.ltc_2.value=Me.state.rectAreaLTC2,ft.pointLights.value=Me.state.point,ft.pointLightShadows.value=Me.state.pointShadow,ft.hemisphereLights.value=Me.state.hemi,ft.directionalShadowMap.value=Me.state.directionalShadowMap,ft.directionalShadowMatrix.value=Me.state.directionalShadowMatrix,ft.spotShadowMap.value=Me.state.spotShadowMap,ft.spotLightMatrix.value=Me.state.spotLightMatrix,ft.spotLightMap.value=Me.state.spotLightMap,ft.pointShadowMap.value=Me.state.pointShadowMap,ft.pointShadowMatrix.value=Me.state.pointShadowMatrix),Re.currentProgram=St,Re.uniformsList=null,St}function $s(Z){if(Z.uniformsList===null){const _e=Z.currentProgram.getUniforms();Z.uniformsList=Ub.seqWithValue(_e.seq,Z.uniforms)}return Z.uniformsList}function gc(Z,_e){const Ne=we.get(Z);Ne.outputColorSpace=_e.outputColorSpace,Ne.batching=_e.batching,Ne.batchingColor=_e.batchingColor,Ne.instancing=_e.instancing,Ne.instancingColor=_e.instancingColor,Ne.instancingMorph=_e.instancingMorph,Ne.skinning=_e.skinning,Ne.morphTargets=_e.morphTargets,Ne.morphNormals=_e.morphNormals,Ne.morphColors=_e.morphColors,Ne.morphTargetsCount=_e.morphTargetsCount,Ne.numClippingPlanes=_e.numClippingPlanes,Ne.numIntersection=_e.numClipIntersection,Ne.vertexAlphas=_e.vertexAlphas,Ne.vertexTangents=_e.vertexTangents,Ne.toneMapping=_e.toneMapping}function oe(Z,_e,Ne,Re,Me){_e.isScene!==!0&&(_e=le),ve.resetTextureUnits();const Ze=_e.fog,ot=Re.isMeshStandardMaterial?_e.environment:null,mt=O===null?P.outputColorSpace:O.isXRRenderTarget===!0?O.texture.colorSpace:bp,pt=(Re.isMeshStandardMaterial?k:F).get(Re.envMap||ot),Rt=Re.vertexColors===!0&&!!Ne.attributes.color&&Ne.attributes.color.itemSize===4,St=!!Ne.attributes.tangent&&(!!Re.normalMap||Re.anisotropy>0),ft=!!Ne.morphAttributes.position,jt=!!Ne.morphAttributes.normal,Ot=!!Ne.morphAttributes.color;let Yt=bu;Re.toneMapped&&(O===null||O.isXRRenderTarget===!0)&&(Yt=P.toneMapping);const rn=Ne.morphAttributes.position||Ne.morphAttributes.normal||Ne.morphAttributes.color,cn=rn!==void 0?rn.length:0,Dt=we.get(Re),Gt=w.state.lights;if(be===!0&&(De===!0||Z!==I)){const hr=Z===I&&Re.id===B;rt.setState(Re,Z,hr)}let Wt=!1;Re.version===Dt.__version?(Dt.needsLights&&Dt.lightsStateVersion!==Gt.state.version||Dt.outputColorSpace!==mt||Me.isBatchedMesh&&Dt.batching===!1||!Me.isBatchedMesh&&Dt.batching===!0||Me.isBatchedMesh&&Dt.batchingColor===!0&&Me.colorTexture===null||Me.isBatchedMesh&&Dt.batchingColor===!1&&Me.colorTexture!==null||Me.isInstancedMesh&&Dt.instancing===!1||!Me.isInstancedMesh&&Dt.instancing===!0||Me.isSkinnedMesh&&Dt.skinning===!1||!Me.isSkinnedMesh&&Dt.skinning===!0||Me.isInstancedMesh&&Dt.instancingColor===!0&&Me.instanceColor===null||Me.isInstancedMesh&&Dt.instancingColor===!1&&Me.instanceColor!==null||Me.isInstancedMesh&&Dt.instancingMorph===!0&&Me.morphTexture===null||Me.isInstancedMesh&&Dt.instancingMorph===!1&&Me.morphTexture!==null||Dt.envMap!==pt||Re.fog===!0&&Dt.fog!==Ze||Dt.numClippingPlanes!==void 0&&(Dt.numClippingPlanes!==rt.numPlanes||Dt.numIntersection!==rt.numIntersection)||Dt.vertexAlphas!==Rt||Dt.vertexTangents!==St||Dt.morphTargets!==ft||Dt.morphNormals!==jt||Dt.morphColors!==Ot||Dt.toneMapping!==Yt||Dt.morphTargetsCount!==cn)&&(Wt=!0):(Wt=!0,Dt.__version=Re.version);let hi=Dt.currentProgram;Wt===!0&&(hi=wi(Re,_e,Me));let Mi=!1,Sn=!1,Ws=!1;const Mn=hi.getUniforms(),fr=Dt.uniforms;if(ae.useProgram(hi.program)&&(Mi=!0,Sn=!0,Ws=!0),Re.id!==B&&(B=Re.id,Sn=!0),Mi||I!==Z){ae.buffers.depth.getReversed()&&Z.reversedDepth!==!0&&(Z._reversedDepth=!0,Z.updateProjectionMatrix()),Mn.setValue(V,"projectionMatrix",Z.projectionMatrix),Mn.setValue(V,"viewMatrix",Z.matrixWorldInverse);const Tr=Mn.map.cameraPosition;Tr!==void 0&&Tr.setValue(V,Ae.setFromMatrixPosition(Z.matrixWorld)),ee.logarithmicDepthBuffer&&Mn.setValue(V,"logDepthBufFC",2/(Math.log(Z.far+1)/Math.LN2)),(Re.isMeshPhongMaterial||Re.isMeshToonMaterial||Re.isMeshLambertMaterial||Re.isMeshBasicMaterial||Re.isMeshStandardMaterial||Re.isShaderMaterial)&&Mn.setValue(V,"isOrthographic",Z.isOrthographicCamera===!0),I!==Z&&(I=Z,Sn=!0,Ws=!0)}if(Me.isSkinnedMesh){Mn.setOptional(V,Me,"bindMatrix"),Mn.setOptional(V,Me,"bindMatrixInverse");const hr=Me.skeleton;hr&&(hr.boneTexture===null&&hr.computeBoneTexture(),Mn.setValue(V,"boneTexture",hr.boneTexture,ve))}Me.isBatchedMesh&&(Mn.setOptional(V,Me,"batchingTexture"),Mn.setValue(V,"batchingTexture",Me._matricesTexture,ve),Mn.setOptional(V,Me,"batchingIdTexture"),Mn.setValue(V,"batchingIdTexture",Me._indirectTexture,ve),Mn.setOptional(V,Me,"batchingColorTexture"),Me._colorsTexture!==null&&Mn.setValue(V,"batchingColorTexture",Me._colorsTexture,ve));const Yi=Ne.morphAttributes;if((Yi.position!==void 0||Yi.normal!==void 0||Yi.color!==void 0)&&dt.update(Me,Ne,hi),(Sn||Dt.receiveShadow!==Me.receiveShadow)&&(Dt.receiveShadow=Me.receiveShadow,Mn.setValue(V,"receiveShadow",Me.receiveShadow)),Re.isMeshGouraudMaterial&&Re.envMap!==null&&(fr.envMap.value=pt,fr.flipEnvMap.value=pt.isCubeTexture&&pt.isRenderTargetTexture===!1?-1:1),Re.isMeshStandardMaterial&&Re.envMap===null&&_e.environment!==null&&(fr.envMapIntensity.value=_e.environmentIntensity),fr.dfgLUT!==void 0&&(fr.dfgLUT.value=Wde()),Sn&&(Mn.setValue(V,"toneMappingExposure",P.toneMappingExposure),Dt.needsLights&&Ie(fr,Ws),Ze&&Re.fog===!0&&Ke.refreshFogUniforms(fr,Ze),Ke.refreshMaterialUniforms(fr,Re,se,Q,w.state.transmissionRenderTarget[Z.id]),Ub.upload(V,$s(Dt),fr,ve)),Re.isShaderMaterial&&Re.uniformsNeedUpdate===!0&&(Ub.upload(V,$s(Dt),fr,ve),Re.uniformsNeedUpdate=!1),Re.isSpriteMaterial&&Mn.setValue(V,"center",Me.center),Mn.setValue(V,"modelViewMatrix",Me.modelViewMatrix),Mn.setValue(V,"normalMatrix",Me.normalMatrix),Mn.setValue(V,"modelMatrix",Me.matrixWorld),Re.isShaderMaterial||Re.isRawShaderMaterial){const hr=Re.uniformsGroups;for(let Tr=0,yo=hr.length;Tr<yo;Tr++){const Ko=hr[Tr];tt.update(Ko,hi),tt.bind(Ko,hi)}}return hi}function Ie(Z,_e){Z.ambientLightColor.needsUpdate=_e,Z.lightProbe.needsUpdate=_e,Z.directionalLights.needsUpdate=_e,Z.directionalLightShadows.needsUpdate=_e,Z.pointLights.needsUpdate=_e,Z.pointLightShadows.needsUpdate=_e,Z.spotLights.needsUpdate=_e,Z.spotLightShadows.needsUpdate=_e,Z.rectAreaLights.needsUpdate=_e,Z.hemisphereLights.needsUpdate=_e}function qe(Z){return Z.isMeshLambertMaterial||Z.isMeshToonMaterial||Z.isMeshPhongMaterial||Z.isMeshStandardMaterial||Z.isShadowMaterial||Z.isShaderMaterial&&Z.lights===!0}this.getActiveCubeFace=function(){return U},this.getActiveMipmapLevel=function(){return N},this.getRenderTarget=function(){return O},this.setRenderTargetTextures=function(Z,_e,Ne){const Re=we.get(Z);Re.__autoAllocateDepthBuffer=Z.resolveDepthBuffer===!1,Re.__autoAllocateDepthBuffer===!1&&(Re.__useRenderToTexture=!1),we.get(Z.texture).__webglTexture=_e,we.get(Z.depthTexture).__webglTexture=Re.__autoAllocateDepthBuffer?void 0:Ne,Re.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(Z,_e){const Ne=we.get(Z);Ne.__webglFramebuffer=_e,Ne.__useDefaultFramebuffer=_e===void 0};const Xe=V.createFramebuffer();this.setRenderTarget=function(Z,_e=0,Ne=0){O=Z,U=_e,N=Ne;let Re=!0,Me=null,Ze=!1,ot=!1;if(Z){const pt=we.get(Z);if(pt.__useDefaultFramebuffer!==void 0)ae.bindFramebuffer(V.FRAMEBUFFER,null),Re=!1;else if(pt.__webglFramebuffer===void 0)ve.setupRenderTarget(Z);else if(pt.__hasExternalTextures)ve.rebindTextures(Z,we.get(Z.texture).__webglTexture,we.get(Z.depthTexture).__webglTexture);else if(Z.depthBuffer){const ft=Z.depthTexture;if(pt.__boundDepthTexture!==ft){if(ft!==null&&we.has(ft)&&(Z.width!==ft.image.width||Z.height!==ft.image.height))throw new Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");ve.setupDepthRenderbuffer(Z)}}const Rt=Z.texture;(Rt.isData3DTexture||Rt.isDataArrayTexture||Rt.isCompressedArrayTexture)&&(ot=!0);const St=we.get(Z).__webglFramebuffer;Z.isWebGLCubeRenderTarget?(Array.isArray(St[_e])?Me=St[_e][Ne]:Me=St[_e],Ze=!0):Z.samples>0&&ve.useMultisampledRTT(Z)===!1?Me=we.get(Z).__webglMultisampledFramebuffer:Array.isArray(St)?Me=St[Ne]:Me=St,W.copy(Z.viewport),L.copy(Z.scissor),$=Z.scissorTest}else W.copy(re).multiplyScalar(se).floor(),L.copy(ce).multiplyScalar(se).floor(),$=ye;if(Ne!==0&&(Me=Xe),ae.bindFramebuffer(V.FRAMEBUFFER,Me)&&Re&&ae.drawBuffers(Z,Me),ae.viewport(W),ae.scissor(L),ae.setScissorTest($),Ze){const pt=we.get(Z.texture);V.framebufferTexture2D(V.FRAMEBUFFER,V.COLOR_ATTACHMENT0,V.TEXTURE_CUBE_MAP_POSITIVE_X+_e,pt.__webglTexture,Ne)}else if(ot){const pt=_e;for(let Rt=0;Rt<Z.textures.length;Rt++){const St=we.get(Z.textures[Rt]);V.framebufferTextureLayer(V.FRAMEBUFFER,V.COLOR_ATTACHMENT0+Rt,St.__webglTexture,Ne,pt)}}else if(Z!==null&&Ne!==0){const pt=we.get(Z.texture);V.framebufferTexture2D(V.FRAMEBUFFER,V.COLOR_ATTACHMENT0,V.TEXTURE_2D,pt.__webglTexture,Ne)}B=-1},this.readRenderTargetPixels=function(Z,_e,Ne,Re,Me,Ze,ot,mt=0){if(!(Z&&Z.isWebGLRenderTarget)){Ci("WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let pt=we.get(Z).__webglFramebuffer;if(Z.isWebGLCubeRenderTarget&&ot!==void 0&&(pt=pt[ot]),pt){ae.bindFramebuffer(V.FRAMEBUFFER,pt);try{const Rt=Z.textures[mt],St=Rt.format,ft=Rt.type;if(!ee.textureFormatReadable(St)){Ci("WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!ee.textureTypeReadable(ft)){Ci("WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}_e>=0&&_e<=Z.width-Re&&Ne>=0&&Ne<=Z.height-Me&&(Z.textures.length>1&&V.readBuffer(V.COLOR_ATTACHMENT0+mt),V.readPixels(_e,Ne,Re,Me,st.convert(St),st.convert(ft),Ze))}finally{const Rt=O!==null?we.get(O).__webglFramebuffer:null;ae.bindFramebuffer(V.FRAMEBUFFER,Rt)}}},this.readRenderTargetPixelsAsync=async function(Z,_e,Ne,Re,Me,Ze,ot,mt=0){if(!(Z&&Z.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let pt=we.get(Z).__webglFramebuffer;if(Z.isWebGLCubeRenderTarget&&ot!==void 0&&(pt=pt[ot]),pt)if(_e>=0&&_e<=Z.width-Re&&Ne>=0&&Ne<=Z.height-Me){ae.bindFramebuffer(V.FRAMEBUFFER,pt);const Rt=Z.textures[mt],St=Rt.format,ft=Rt.type;if(!ee.textureFormatReadable(St))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!ee.textureTypeReadable(ft))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");const jt=V.createBuffer();V.bindBuffer(V.PIXEL_PACK_BUFFER,jt),V.bufferData(V.PIXEL_PACK_BUFFER,Ze.byteLength,V.STREAM_READ),Z.textures.length>1&&V.readBuffer(V.COLOR_ATTACHMENT0+mt),V.readPixels(_e,Ne,Re,Me,st.convert(St),st.convert(ft),0);const Ot=O!==null?we.get(O).__webglFramebuffer:null;ae.bindFramebuffer(V.FRAMEBUFFER,Ot);const Yt=V.fenceSync(V.SYNC_GPU_COMMANDS_COMPLETE,0);return V.flush(),await xse(V,Yt,4),V.bindBuffer(V.PIXEL_PACK_BUFFER,jt),V.getBufferSubData(V.PIXEL_PACK_BUFFER,0,Ze),V.deleteBuffer(jt),V.deleteSync(Yt),Ze}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(Z,_e=null,Ne=0){const Re=Math.pow(2,-Ne),Me=Math.floor(Z.image.width*Re),Ze=Math.floor(Z.image.height*Re),ot=_e!==null?_e.x:0,mt=_e!==null?_e.y:0;ve.setTexture2D(Z,0),V.copyTexSubImage2D(V.TEXTURE_2D,Ne,0,0,ot,mt,Me,Ze),ae.unbindTexture()};const We=V.createFramebuffer(),bt=V.createFramebuffer();this.copyTextureToTexture=function(Z,_e,Ne=null,Re=null,Me=0,Ze=null){Ze===null&&(Me!==0?(x0("WebGLRenderer: copyTextureToTexture function signature has changed to support src and dst mipmap levels."),Ze=Me,Me=0):Ze=0);let ot,mt,pt,Rt,St,ft,jt,Ot,Yt;const rn=Z.isCompressedTexture?Z.mipmaps[Ze]:Z.image;if(Ne!==null)ot=Ne.max.x-Ne.min.x,mt=Ne.max.y-Ne.min.y,pt=Ne.isBox3?Ne.max.z-Ne.min.z:1,Rt=Ne.min.x,St=Ne.min.y,ft=Ne.isBox3?Ne.min.z:0;else{const Yi=Math.pow(2,-Me);ot=Math.floor(rn.width*Yi),mt=Math.floor(rn.height*Yi),Z.isDataArrayTexture?pt=rn.depth:Z.isData3DTexture?pt=Math.floor(rn.depth*Yi):pt=1,Rt=0,St=0,ft=0}Re!==null?(jt=Re.x,Ot=Re.y,Yt=Re.z):(jt=0,Ot=0,Yt=0);const cn=st.convert(_e.format),Dt=st.convert(_e.type);let Gt;_e.isData3DTexture?(ve.setTexture3D(_e,0),Gt=V.TEXTURE_3D):_e.isDataArrayTexture||_e.isCompressedArrayTexture?(ve.setTexture2DArray(_e,0),Gt=V.TEXTURE_2D_ARRAY):(ve.setTexture2D(_e,0),Gt=V.TEXTURE_2D),V.pixelStorei(V.UNPACK_FLIP_Y_WEBGL,_e.flipY),V.pixelStorei(V.UNPACK_PREMULTIPLY_ALPHA_WEBGL,_e.premultiplyAlpha),V.pixelStorei(V.UNPACK_ALIGNMENT,_e.unpackAlignment);const Wt=V.getParameter(V.UNPACK_ROW_LENGTH),hi=V.getParameter(V.UNPACK_IMAGE_HEIGHT),Mi=V.getParameter(V.UNPACK_SKIP_PIXELS),Sn=V.getParameter(V.UNPACK_SKIP_ROWS),Ws=V.getParameter(V.UNPACK_SKIP_IMAGES);V.pixelStorei(V.UNPACK_ROW_LENGTH,rn.width),V.pixelStorei(V.UNPACK_IMAGE_HEIGHT,rn.height),V.pixelStorei(V.UNPACK_SKIP_PIXELS,Rt),V.pixelStorei(V.UNPACK_SKIP_ROWS,St),V.pixelStorei(V.UNPACK_SKIP_IMAGES,ft);const Mn=Z.isDataArrayTexture||Z.isData3DTexture,fr=_e.isDataArrayTexture||_e.isData3DTexture;if(Z.isDepthTexture){const Yi=we.get(Z),hr=we.get(_e),Tr=we.get(Yi.__renderTarget),yo=we.get(hr.__renderTarget);ae.bindFramebuffer(V.READ_FRAMEBUFFER,Tr.__webglFramebuffer),ae.bindFramebuffer(V.DRAW_FRAMEBUFFER,yo.__webglFramebuffer);for(let Ko=0;Ko<pt;Ko++)Mn&&(V.framebufferTextureLayer(V.READ_FRAMEBUFFER,V.COLOR_ATTACHMENT0,we.get(Z).__webglTexture,Me,ft+Ko),V.framebufferTextureLayer(V.DRAW_FRAMEBUFFER,V.COLOR_ATTACHMENT0,we.get(_e).__webglTexture,Ze,Yt+Ko)),V.blitFramebuffer(Rt,St,ot,mt,jt,Ot,ot,mt,V.DEPTH_BUFFER_BIT,V.NEAREST);ae.bindFramebuffer(V.READ_FRAMEBUFFER,null),ae.bindFramebuffer(V.DRAW_FRAMEBUFFER,null)}else if(Me!==0||Z.isRenderTargetTexture||we.has(Z)){const Yi=we.get(Z),hr=we.get(_e);ae.bindFramebuffer(V.READ_FRAMEBUFFER,We),ae.bindFramebuffer(V.DRAW_FRAMEBUFFER,bt);for(let Tr=0;Tr<pt;Tr++)Mn?V.framebufferTextureLayer(V.READ_FRAMEBUFFER,V.COLOR_ATTACHMENT0,Yi.__webglTexture,Me,ft+Tr):V.framebufferTexture2D(V.READ_FRAMEBUFFER,V.COLOR_ATTACHMENT0,V.TEXTURE_2D,Yi.__webglTexture,Me),fr?V.framebufferTextureLayer(V.DRAW_FRAMEBUFFER,V.COLOR_ATTACHMENT0,hr.__webglTexture,Ze,Yt+Tr):V.framebufferTexture2D(V.DRAW_FRAMEBUFFER,V.COLOR_ATTACHMENT0,V.TEXTURE_2D,hr.__webglTexture,Ze),Me!==0?V.blitFramebuffer(Rt,St,ot,mt,jt,Ot,ot,mt,V.COLOR_BUFFER_BIT,V.NEAREST):fr?V.copyTexSubImage3D(Gt,Ze,jt,Ot,Yt+Tr,Rt,St,ot,mt):V.copyTexSubImage2D(Gt,Ze,jt,Ot,Rt,St,ot,mt);ae.bindFramebuffer(V.READ_FRAMEBUFFER,null),ae.bindFramebuffer(V.DRAW_FRAMEBUFFER,null)}else fr?Z.isDataTexture||Z.isData3DTexture?V.texSubImage3D(Gt,Ze,jt,Ot,Yt,ot,mt,pt,cn,Dt,rn.data):_e.isCompressedArrayTexture?V.compressedTexSubImage3D(Gt,Ze,jt,Ot,Yt,ot,mt,pt,cn,rn.data):V.texSubImage3D(Gt,Ze,jt,Ot,Yt,ot,mt,pt,cn,Dt,rn):Z.isDataTexture?V.texSubImage2D(V.TEXTURE_2D,Ze,jt,Ot,ot,mt,cn,Dt,rn.data):Z.isCompressedTexture?V.compressedTexSubImage2D(V.TEXTURE_2D,Ze,jt,Ot,rn.width,rn.height,cn,rn.data):V.texSubImage2D(V.TEXTURE_2D,Ze,jt,Ot,ot,mt,cn,Dt,rn);V.pixelStorei(V.UNPACK_ROW_LENGTH,Wt),V.pixelStorei(V.UNPACK_IMAGE_HEIGHT,hi),V.pixelStorei(V.UNPACK_SKIP_PIXELS,Mi),V.pixelStorei(V.UNPACK_SKIP_ROWS,Sn),V.pixelStorei(V.UNPACK_SKIP_IMAGES,Ws),Ze===0&&_e.generateMipmaps&&V.generateMipmap(Gt),ae.unbindTexture()},this.initRenderTarget=function(Z){we.get(Z).__webglFramebuffer===void 0&&ve.setupRenderTarget(Z)},this.initTexture=function(Z){Z.isCubeTexture?ve.setTextureCube(Z,0):Z.isData3DTexture?ve.setTexture3D(Z,0):Z.isDataArrayTexture||Z.isCompressedArrayTexture?ve.setTexture2DArray(Z,0):ve.setTexture2D(Z,0),ae.unbindTexture()},this.resetState=function(){U=0,N=0,O=null,ae.reset(),ue.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return Oo}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const n=this.getContext();n.drawingBufferColorSpace=xn._getDrawingBufferColorSpace(e),n.unpackColorSpace=xn._getUnpackColorSpace()}};const SF={type:"change"},XN={type:"start"},n$={type:"end"},by=new VN,wF=new tu,Xde=Math.cos(70*bse.DEG2RAD),Zi=new Ge,Aa=2*Math.PI,In={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6},mA=1e-6;class Yde extends soe{constructor(e,n=null){super(e,n),this.state=In.NONE,this.target=new Ge,this.cursor=new Ge,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:rp.ROTATE,MIDDLE:rp.DOLLY,RIGHT:rp.PAN},this.touches={ONE:Jh.ROTATE,TWO:Jh.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this._domElementKeyEvents=null,this._lastPosition=new Ge,this._lastQuaternion=new sf,this._lastTargetPosition=new Ge,this._quat=new sf().setFromUnitVectors(e.up,new Ge(0,1,0)),this._quatInverse=this._quat.clone().invert(),this._spherical=new Z4,this._sphericalDelta=new Z4,this._scale=1,this._panOffset=new Ge,this._rotateStart=new Qt,this._rotateEnd=new Qt,this._rotateDelta=new Qt,this._panStart=new Qt,this._panEnd=new Qt,this._panDelta=new Qt,this._dollyStart=new Qt,this._dollyEnd=new Qt,this._dollyDelta=new Qt,this._dollyDirection=new Ge,this._mouse=new Qt,this._performCursorZoom=!1,this._pointers=[],this._pointerPositions={},this._controlActive=!1,this._onPointerMove=Zde.bind(this),this._onPointerDown=Kde.bind(this),this._onPointerUp=Jde.bind(this),this._onContextMenu=afe.bind(this),this._onMouseWheel=tfe.bind(this),this._onKeyDown=nfe.bind(this),this._onTouchStart=ife.bind(this),this._onTouchMove=rfe.bind(this),this._onMouseDown=Qde.bind(this),this._onMouseMove=efe.bind(this),this._interceptControlDown=sfe.bind(this),this._interceptControlUp=ofe.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(SF),this.update(),this.state=In.NONE}update(e=null){const n=this.object.position;Zi.copy(n).sub(this.target),Zi.applyQuaternion(this._quat),this._spherical.setFromVector3(Zi),this.autoRotate&&this.state===In.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+=Aa:i>Math.PI&&(i-=Aa),r<-Math.PI?r+=Aa:r>Math.PI&&(r-=Aa),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(Zi.setFromSpherical(this._spherical),Zi.applyQuaternion(this._quatInverse),n.copy(this.target).add(Zi),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=Zi.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 Ge(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 Ge(this._mouse.x,this._mouse.y,0);c.unproject(this.object),this.object.position.sub(c).add(o),this.object.updateMatrixWorld(),s=Zi.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):(by.origin.copy(this.object.position),by.direction.set(0,0,-1).transformDirection(this.object.matrix),Math.abs(this.object.up.dot(by.direction))<Xde?this.object.lookAt(this.target):(wF.setFromNormalAndCoplanarPoint(this.object.up,this.target),by.intersectPlane(wF,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)>mA||8*(1-this._lastQuaternion.dot(this.object.quaternion))>mA||this._lastTargetPosition.distanceToSquared(this.target)>mA?(this.dispatchEvent(SF),this._lastPosition.copy(this.object.position),this._lastQuaternion.copy(this.object.quaternion),this._lastTargetPosition.copy(this.target),!0):!1}_getAutoRotationAngle(e){return e!==null?Aa/60*this.autoRotateSpeed*e:Aa/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){Zi.setFromMatrixColumn(n,0),Zi.multiplyScalar(-e),this._panOffset.add(Zi)}_panUp(e,n){this.screenSpacePanning===!0?Zi.setFromMatrixColumn(n,1):(Zi.setFromMatrixColumn(n,0),Zi.crossVectors(this.object.up,Zi)),Zi.multiplyScalar(e),this._panOffset.add(Zi)}_pan(e,n){const i=this.domElement;if(this.object.isPerspectiveCamera){const r=this.object.position;Zi.copy(r).sub(this.target);let a=Zi.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(Aa*this._rotateDelta.x/n.clientHeight),this._rotateUp(Aa*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(Aa*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(-Aa*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(Aa*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(-Aa*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(Aa*this._rotateDelta.x/n.clientHeight),this._rotateUp(Aa*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 Qt,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 Kde(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 Zde(t){this.enabled!==!1&&(t.pointerType==="touch"?this._onTouchMove(t):this._onMouseMove(t))}function Jde(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(n$),this.state=In.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 Qde(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 rp.DOLLY:if(this.enableZoom===!1)return;this._handleMouseDownDolly(t),this.state=In.DOLLY;break;case rp.ROTATE:if(t.ctrlKey||t.metaKey||t.shiftKey){if(this.enablePan===!1)return;this._handleMouseDownPan(t),this.state=In.PAN}else{if(this.enableRotate===!1)return;this._handleMouseDownRotate(t),this.state=In.ROTATE}break;case rp.PAN:if(t.ctrlKey||t.metaKey||t.shiftKey){if(this.enableRotate===!1)return;this._handleMouseDownRotate(t),this.state=In.ROTATE}else{if(this.enablePan===!1)return;this._handleMouseDownPan(t),this.state=In.PAN}break;default:this.state=In.NONE}this.state!==In.NONE&&this.dispatchEvent(XN)}function efe(t){switch(this.state){case In.ROTATE:if(this.enableRotate===!1)return;this._handleMouseMoveRotate(t);break;case In.DOLLY:if(this.enableZoom===!1)return;this._handleMouseMoveDolly(t);break;case In.PAN:if(this.enablePan===!1)return;this._handleMouseMovePan(t);break}}function tfe(t){this.enabled===!1||this.enableZoom===!1||this.state!==In.NONE||(t.preventDefault(),this.dispatchEvent(XN),this._handleMouseWheel(this._customWheelEvent(t)),this.dispatchEvent(n$))}function nfe(t){this.enabled!==!1&&this._handleKeyDown(t)}function ife(t){switch(this._trackPointer(t),this._pointers.length){case 1:switch(this.touches.ONE){case Jh.ROTATE:if(this.enableRotate===!1)return;this._handleTouchStartRotate(t),this.state=In.TOUCH_ROTATE;break;case Jh.PAN:if(this.enablePan===!1)return;this._handleTouchStartPan(t),this.state=In.TOUCH_PAN;break;default:this.state=In.NONE}break;case 2:switch(this.touches.TWO){case Jh.DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchStartDollyPan(t),this.state=In.TOUCH_DOLLY_PAN;break;case Jh.DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchStartDollyRotate(t),this.state=In.TOUCH_DOLLY_ROTATE;break;default:this.state=In.NONE}break;default:this.state=In.NONE}this.state!==In.NONE&&this.dispatchEvent(XN)}function rfe(t){switch(this._trackPointer(t),this.state){case In.TOUCH_ROTATE:if(this.enableRotate===!1)return;this._handleTouchMoveRotate(t),this.update();break;case In.TOUCH_PAN:if(this.enablePan===!1)return;this._handleTouchMovePan(t),this.update();break;case In.TOUCH_DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchMoveDollyPan(t),this.update();break;case In.TOUCH_DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchMoveDollyRotate(t),this.update();break;default:this.state=In.NONE}}function afe(t){this.enabled!==!1&&t.preventDefault()}function sfe(t){t.key==="Control"&&(this._controlActive=!0,this.domElement.getRootNode().addEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}function ofe(t){t.key==="Control"&&(this._controlActive=!1,this.domElement.getRootNode().removeEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}function lfe(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 Yo;let c=0;for(let d=0;d<t.length;++d){const f=t[d];let p=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 m in f.attributes){if(!i.has(m))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+d+'. All geometries must have compatible attributes; make sure "'+m+'" attribute exists among all geometries, or in none of them.'),null;a[m]===void 0&&(a[m]=[]),a[m].push(f.attributes[m]),p++}if(p!==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 m in f.morphAttributes){if(!r.has(m))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+d+". .morphAttributes must be consistent throughout all geometries."),null;s[m]===void 0&&(s[m]=[]),s[m].push(f.morphAttributes[m])}if(e){let m;if(n)m=f.index.count;else if(f.attributes.position!==void 0)m=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,m,d),c+=m}}if(n){let d=0;const f=[];for(let p=0;p<t.length;++p){const m=t[p].index;for(let y=0;y<m.count;++y)f.push(m.getX(y)+d);d+=t[p].attributes.position.count}l.setIndex(f)}for(const d in a){const f=MF(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 p=0;p<f;++p){const m=[];for(let b=0;b<s[d].length;++b)m.push(s[d][b][p]);const y=MF(m);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 MF(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 Is(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 p=0,m=d.count;p<m;p++)for(let y=0;y<n;y++){const b=d.getComponent(p,y);o.setComponent(p+f,y,b)}}else s.set(d.array,l);l+=d.count*n}return r!==void 0&&(o.gpuType=r),o}function _y(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 gA={exports:{}};var EF;function cfe(){return EF||(EF=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 _y=="function"&&_y;if(!d&&f)return f(c,!0);if(o)return o(c,!0);var p=new Error("Cannot find module '"+c+"'");throw p.code="MODULE_NOT_FOUND",p}var m=r[c]={exports:{}};i[c][0].call(m.exports,function(y){var b=i[c][1][y];return s(b||y)},m,m.exports,n,i,r,a)}return r[c].exports}for(var o=typeof _y=="function"&&_y,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,p,m,y,b,x=[],v=0,M=l.length,w=M,E=a.getTypeOf(l)!=="string";v<l.length;)w=M-v,f=E?(c=l[v++],d=v<M?l[v++]:0,v<M?l[v++]:0):(c=l.charCodeAt(v++),d=v<M?l.charCodeAt(v++):0,v<M?l.charCodeAt(v++):0),p=c>>2,m=(3&c)<<4|d>>4,y=1<w?(15&d)<<2|f>>6:64,b=2<w?63&f:64,x.push(o.charAt(p)+o.charAt(m)+o.charAt(y)+o.charAt(b));return x.join("")},r.decode=function(l){var c,d,f,p,m,y,b=0,x=0,v="data:";if(l.substr(0,v.length)===v)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);b<l.length;)c=o.indexOf(l.charAt(b++))<<2|(p=o.indexOf(l.charAt(b++)))>>4,d=(15&p)<<4|(m=o.indexOf(l.charAt(b++)))>>2,f=(3&m)<<6|(y=o.indexOf(l.charAt(b++))),M[x++]=c,m!==64&&(M[x++]=d),y!==64&&(M[x++]=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,p,m,y){this.compressedSize=d,this.uncompressedSize=f,this.crc32=p,this.compression=m,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,p){return d.pipe(new o).pipe(new l("uncompressedSize")).pipe(f.compressWorker(p)).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,p){var m=s,y=p+f;c^=-1;for(var b=p;b<y;b++)c=c>>>8^m[255&(c^d[b])];return-1^c})(0|l,o,o.length,0):(function(c,d,f,p){var m=s,y=p+f;c^=-1;for(var b=p;b<y;b++)c=c>>>8^m[255&(c^d.charCodeAt(b))];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,p){l.call(this,"FlateWorker/"+f),this._pako=null,this._pakoAction=f,this._pakoOptions=p,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(p){f.push({data:p,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(m,y){var b,x="";for(b=0;b<y;b++)x+=String.fromCharCode(255&m),m>>>=8;return x}function s(m,y,b,x,v,M){var w,E,T=m.file,P=m.compression,R=M!==c.utf8encode,U=o.transformTo("string",M(T.name)),N=o.transformTo("string",c.utf8encode(T.name)),O=T.comment,B=o.transformTo("string",M(O)),I=o.transformTo("string",c.utf8encode(O)),W=N.length!==T.name.length,L=I.length!==O.length,$="",q="",G="",Y=T.dir,Q=T.date,se={crc32:0,compressedSize:0,uncompressedSize:0};y&&!b||(se.crc32=m.crc32,se.compressedSize=m.compressedSize,se.uncompressedSize=m.uncompressedSize);var H=0;y&&(H|=8),R||!W&&!L||(H|=2048);var X=0,re=0;Y&&(X|=16),v==="UNIX"?(re=798,X|=(function(ye,me){var be=ye;return ye||(be=me?16893:33204),(65535&be)<<16})(T.unixPermissions,Y)):(re=20,X|=(function(ye){return 63&(ye||0)})(T.dosPermissions)),w=Q.getUTCHours(),w<<=6,w|=Q.getUTCMinutes(),w<<=5,w|=Q.getUTCSeconds()/2,E=Q.getUTCFullYear()-1980,E<<=4,E|=Q.getUTCMonth()+1,E<<=5,E|=Q.getUTCDate(),W&&(q=a(1,1)+a(d(U),4)+N,$+="up"+a(q.length,2)+q),L&&(G=a(1,1)+a(d(B),4)+I,$+="uc"+a(G.length,2)+G);var ce="";return ce+=`
  3839. \0`,ce+=a(H,2),ce+=P.magic,ce+=a(w,2),ce+=a(E,2),ce+=a(se.crc32,4),ce+=a(se.compressedSize,4),ce+=a(se.uncompressedSize,4),ce+=a(U.length,2),ce+=a($.length,2),{fileRecord:f.LOCAL_FILE_HEADER+ce+U+$,dirRecord:f.CENTRAL_FILE_HEADER+a(re,2)+ce+a(B.length,2)+"\0\0\0\0"+a(X,4)+a(x,4)+U+$+B}}var o=n("../utils"),l=n("../stream/GenericWorker"),c=n("../utf8"),d=n("../crc32"),f=n("../signature");function p(m,y,b,x){l.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=y,this.zipPlatform=b,this.encodeFileName=x,this.streamFiles=m,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}o.inherits(p,l),p.prototype.push=function(m){var y=m.meta.percent||0,b=this.entriesCount,x=this._sources.length;this.accumulate?this.contentBuffer.push(m):(this.bytesWritten+=m.data.length,l.prototype.push.call(this,{data:m.data,meta:{currentFile:this.currentFile,percent:b?(y+100*(b-x-1))/b:100}}))},p.prototype.openedSource=function(m){this.currentSourceOffset=this.bytesWritten,this.currentFile=m.file.name;var y=this.streamFiles&&!m.file.dir;if(y){var b=s(m,y,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:b.fileRecord,meta:{percent:0}})}else this.accumulate=!0},p.prototype.closedSource=function(m){this.accumulate=!1;var y=this.streamFiles&&!m.file.dir,b=s(m,y,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(b.dirRecord),y)this.push({data:(function(x){return f.DATA_DESCRIPTOR+a(x.crc32,4)+a(x.compressedSize,4)+a(x.uncompressedSize,4)})(m),meta:{percent:100}});else for(this.push({data:b.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},p.prototype.flush=function(){for(var m=this.bytesWritten,y=0;y<this.dirRecords.length;y++)this.push({data:this.dirRecords[y],meta:{percent:100}});var b=this.bytesWritten-m,x=(function(v,M,w,E,T){var P=o.transformTo("string",T(E));return f.CENTRAL_DIRECTORY_END+"\0\0\0\0"+a(v,2)+a(v,2)+a(M,4)+a(w,4)+a(P.length,2)+P})(this.dirRecords.length,b,m,this.zipComment,this.encodeFileName);this.push({data:x,meta:{percent:100}})},p.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()},p.prototype.registerPrevious=function(m){this._sources.push(m);var y=this;return m.on("data",function(b){y.processChunk(b)}),m.on("end",function(){y.closedSource(y.previous.streamInfo),y._sources.length?y.prepareNextSource():y.end()}),m.on("error",function(b){y.error(b)}),this},p.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))},p.prototype.error=function(m){var y=this._sources;if(!l.prototype.error.call(this,m))return!1;for(var b=0;b<y.length;b++)try{y[b].error(m)}catch{}return!0},p.prototype.lock=function(){l.prototype.lock.call(this);for(var m=this._sources,y=0;y<m.length;y++)m[y].lock()},i.exports=p},{"../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(p,m){f++;var y=(function(M,w){var E=M||w,T=a[E];if(!T)throw new Error(E+" is not a valid compression method !");return T})(m.options.compression,l.compression),b=m.options.compressionOptions||l.compressionOptions||{},x=m.dir,v=m.date;m._compressWorker(y,b).withStreamInfo("file",{name:p,dir:x,date:v,comment:m.comment||"",unixPermissions:m.unixPermissions,dosPermissions:m.dosPermissions}).pipe(d)}),d.entriesCount=f}catch(p){d.error(p)}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(p){return new s.Promise(function(m,y){var b=p.decompressed.getContentWorker().pipe(new c);b.on("error",function(x){y(x)}).on("end",function(){b.streamInfo.crc32!==p.decompressed.crc32?y(new Error("Corrupted zip : CRC32 mismatch")):m()}).resume()})}i.exports=function(p,m){var y=this;return m=a.extend(m||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:o.utf8decode}),d.isNode&&d.isStream(p)?s.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):a.prepareContent("the loaded zip file",p,!0,m.optimizedBinaryString,m.base64).then(function(b){var x=new l(m);return x.load(b),x}).then(function(b){var x=[s.Promise.resolve(b)],v=b.files;if(m.checkCRC32)for(var M=0;M<v.length;M++)x.push(f(v[M]));return s.Promise.all(x)}).then(function(b){for(var x=b.shift(),v=x.files,M=0;M<v.length;M++){var w=v[M],E=w.fileNameStr,T=a.resolve(w.fileNameStr);y.file(T,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:m.createFolders}),w.dir||(y.file(T).unsafeOriginalName=E)}return x.zipComment.length&&(y.comment=x.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,p){d.push(f)||d._helper.pause(),c&&c(p)}).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(T,P,R){var U,N=o.getTypeOf(P),O=o.extend(R||{},d);O.date=O.date||new Date,O.compression!==null&&(O.compression=O.compression.toUpperCase()),typeof O.unixPermissions=="string"&&(O.unixPermissions=parseInt(O.unixPermissions,8)),O.unixPermissions&&16384&O.unixPermissions&&(O.dir=!0),O.dosPermissions&&16&O.dosPermissions&&(O.dir=!0),O.dir&&(T=v(T)),O.createFolders&&(U=x(T))&&M.call(this,U,!0);var B=N==="string"&&O.binary===!1&&O.base64===!1;R&&R.binary!==void 0||(O.binary=!B),(P instanceof f&&P.uncompressedSize===0||O.dir||!P||P.length===0)&&(O.base64=!1,O.binary=!0,P="",O.compression="STORE",N="string");var I=null;I=P instanceof f||P instanceof l?P:y.isNode&&y.isStream(P)?new b(T,P):o.prepareContent(T,P,O.binary,O.optimizedBinaryString,O.base64);var W=new p(T,I,O);this.files[T]=W}var s=n("./utf8"),o=n("./utils"),l=n("./stream/GenericWorker"),c=n("./stream/StreamHelper"),d=n("./defaults"),f=n("./compressedObject"),p=n("./zipObject"),m=n("./generate"),y=n("./nodejsUtils"),b=n("./nodejs/NodejsStreamInputAdapter"),x=function(T){T.slice(-1)==="/"&&(T=T.substring(0,T.length-1));var P=T.lastIndexOf("/");return 0<P?T.substring(0,P):""},v=function(T){return T.slice(-1)!=="/"&&(T+="/"),T},M=function(T,P){return P=P!==void 0?P:d.createFolders,T=v(T),this.files[T]||a.call(this,T,null,{dir:!0,createFolders:P}),this.files[T]};function w(T){return Object.prototype.toString.call(T)==="[object RegExp]"}var E={load:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(T){var P,R,U;for(P in this.files)U=this.files[P],(R=P.slice(this.root.length,P.length))&&P.slice(0,this.root.length)===this.root&&T(R,U)},filter:function(T){var P=[];return this.forEach(function(R,U){T(R,U)&&P.push(U)}),P},file:function(T,P,R){if(arguments.length!==1)return T=this.root+T,a.call(this,T,P,R),this;if(w(T)){var U=T;return this.filter(function(O,B){return!B.dir&&U.test(O)})}var N=this.files[this.root+T];return N&&!N.dir?N:null},folder:function(T){if(!T)return this;if(w(T))return this.filter(function(N,O){return O.dir&&T.test(N)});var P=this.root+T,R=M.call(this,P),U=this.clone();return U.root=R.name,U},remove:function(T){T=this.root+T;var P=this.files[T];if(P||(T.slice(-1)!=="/"&&(T+="/"),P=this.files[T]),P&&!P.dir)delete this.files[T];else for(var R=this.filter(function(N,O){return O.name.slice(0,T.length)===T}),U=0;U<R.length;U++)delete this.files[R[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(T){var P,R={};try{if((R=o.extend(T||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:s.utf8encode})).type=R.type.toLowerCase(),R.compression=R.compression.toUpperCase(),R.type==="binarystring"&&(R.type="string"),!R.type)throw new Error("No output type specified.");o.checkSupport(R.type),R.platform!=="darwin"&&R.platform!=="freebsd"&&R.platform!=="linux"&&R.platform!=="sunos"||(R.platform="UNIX"),R.platform==="win32"&&(R.platform="DOS");var U=R.comment||this.comment||"";P=m.generateWorker(this,R,U)}catch(N){(P=new l("error")).error(N)}return new c(P,R.type||"string",R.mimeType)},generateAsync:function(T,P){return this.generateInternalStream(T).accumulate(P)},generateNodeStream:function(T,P){return(T=T||{}).type||(T.type="nodebuffer"),this.generateInternalStream(T).toNodejsStream(P)}};i.exports=E},{"./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),p=this.length-4;0<=p;--p)if(this.data[p]===l&&this.data[p+1]===c&&this.data[p+2]===d&&this.data[p+3]===f)return p-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),p=this.readData(4);return l===p[0]&&c===p[1]&&d===p[2]&&f===p[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 p=a.getTypeOf(f);return a.checkSupport(p),p!=="string"||s.uint8array?p==="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 p(y,b){return new d.Promise(function(x,v){var M=[],w=y._internalType,E=y._outputType,T=y._mimeType;y.on("data",function(P,R){M.push(P),b&&b(R)}).on("error",function(P){M=[],v(P)}).on("end",function(){try{var P=(function(R,U,N){switch(R){case"blob":return a.newBlob(a.transformTo("arraybuffer",U),N);case"base64":return l.encode(U);default:return a.transformTo(R,U)}})(E,(function(R,U){var N,O=0,B=null,I=0;for(N=0;N<U.length;N++)I+=U[N].length;switch(R){case"string":return U.join("");case"array":return Array.prototype.concat.apply([],U);case"uint8array":for(B=new Uint8Array(I),N=0;N<U.length;N++)B.set(U[N],O),O+=U[N].length;return B;case"nodebuffer":return Buffer.concat(U);default:throw new Error("concat : unsupported type '"+R+"'")}})(w,M),T);x(P)}catch(R){v(R)}M=[]}).resume()})}function m(y,b,x){var v=b;switch(b){case"blob":case"arraybuffer":v="uint8array";break;case"base64":v="string"}try{this._internalType=v,this._outputType=b,this._mimeType=x,a.checkSupport(v),this._worker=y.pipe(new s(v)),y.lock()}catch(M){this._worker=new o("error"),this._worker.error(M)}}m.prototype={accumulate:function(y){return p(this,y)},on:function(y,b){var x=this;return y==="data"?this._worker.on(y,function(v){b.call(x,v.data,v.meta)}):this._worker.on(y,function(){a.delay(b,arguments,x)}),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=m},{"../base64":1,"../external":6,"../nodejs/NodejsStreamOutputAdapter":13,"../support":30,"../utils":32,"./ConvertWorker":24,"./GenericWorker":28}],30:[function(n,i,r){if(r.base64=!0,r.array=!0,r.string=!0,r.arraybuffer=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u",r.nodebuffer=typeof Buffer<"u",r.uint8array=typeof Uint8Array<"u",typeof ArrayBuffer>"u")r.blob=!1;else{var a=new ArrayBuffer(0);try{r.blob=new Blob([a],{type:"application/zip"}).size===0}catch{try{var s=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);s.append(a),r.blob=s.getBlob("application/zip").size===0}catch{r.blob=!1}}}try{r.nodestream=!!n("readable-stream").Readable}catch{r.nodestream=!1}},{"readable-stream":16}],31:[function(n,i,r){for(var a=n("./utils"),s=n("./support"),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 p(){l.call(this,"utf-8 encode")}r.utf8encode=function(m){return s.nodebuffer?o.newBufferFrom(m,"utf-8"):(function(y){var b,x,v,M,w,E=y.length,T=0;for(M=0;M<E;M++)(64512&(x=y.charCodeAt(M)))==55296&&M+1<E&&(64512&(v=y.charCodeAt(M+1)))==56320&&(x=65536+(x-55296<<10)+(v-56320),M++),T+=x<128?1:x<2048?2:x<65536?3:4;for(b=s.uint8array?new Uint8Array(T):new Array(T),M=w=0;w<T;M++)(64512&(x=y.charCodeAt(M)))==55296&&M+1<E&&(64512&(v=y.charCodeAt(M+1)))==56320&&(x=65536+(x-55296<<10)+(v-56320),M++),x<128?b[w++]=x:(x<2048?b[w++]=192|x>>>6:(x<65536?b[w++]=224|x>>>12:(b[w++]=240|x>>>18,b[w++]=128|x>>>12&63),b[w++]=128|x>>>6&63),b[w++]=128|63&x);return b})(m)},r.utf8decode=function(m){return s.nodebuffer?a.transformTo("nodebuffer",m).toString("utf-8"):(function(y){var b,x,v,M,w=y.length,E=new Array(2*w);for(b=x=0;b<w;)if((v=y[b++])<128)E[x++]=v;else if(4<(M=c[v]))E[x++]=65533,b+=M-1;else{for(v&=M===2?31:M===3?15:7;1<M&&b<w;)v=v<<6|63&y[b++],M--;1<M?E[x++]=65533:v<65536?E[x++]=v:(v-=65536,E[x++]=55296|v>>10&1023,E[x++]=56320|1023&v)}return E.length!==x&&(E.subarray?E=E.subarray(0,x):E.length=x),a.applyFromCharCode(E)})(m=a.transformTo(s.uint8array?"uint8array":"array",m))},a.inherits(f,l),f.prototype.processChunk=function(m){var y=a.transformTo(s.uint8array?"uint8array":"array",m.data);if(this.leftOver&&this.leftOver.length){if(s.uint8array){var b=y;(y=new Uint8Array(b.length+this.leftOver.length)).set(this.leftOver,0),y.set(b,this.leftOver.length)}else y=this.leftOver.concat(y);this.leftOver=null}var x=(function(M,w){var E;for((w=w||M.length)>M.length&&(w=M.length),E=w-1;0<=E&&(192&M[E])==128;)E--;return E<0||E===0?w:E+c[M[E]]>w?E:w})(y),v=y;x!==y.length&&(s.uint8array?(v=y.subarray(0,x),this.leftOver=y.subarray(x,y.length)):(v=y.slice(0,x),this.leftOver=y.slice(x,y.length))),this.push({data:r.utf8decode(v),meta:m.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(p,l),p.prototype.processChunk=function(m){this.push({data:r.utf8encode(m.data),meta:m.meta})},r.Utf8EncodeWorker=p},{"./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(b){return b}function d(b,x){for(var v=0;v<b.length;++v)x[v]=255&b.charCodeAt(v);return x}n("setimmediate"),r.newBlob=function(b,x){r.checkSupport("blob");try{return new Blob([b],{type:x})}catch{try{var v=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);return v.append(b),v.getBlob(x)}catch{throw new Error("Bug : can't construct the Blob.")}}};var f={stringifyByChunk:function(b,x,v){var M=[],w=0,E=b.length;if(E<=v)return String.fromCharCode.apply(null,b);for(;w<E;)x==="array"||x==="nodebuffer"?M.push(String.fromCharCode.apply(null,b.slice(w,Math.min(w+v,E)))):M.push(String.fromCharCode.apply(null,b.subarray(w,Math.min(w+v,E)))),w+=v;return M.join("")},stringifyByChar:function(b){for(var x="",v=0;v<b.length;v++)x+=String.fromCharCode(b[v]);return x},applyCanBeUsed:{uint8array:(function(){try{return a.uint8array&&String.fromCharCode.apply(null,new Uint8Array(1)).length===1}catch{return!1}})(),nodebuffer:(function(){try{return a.nodebuffer&&String.fromCharCode.apply(null,o.allocBuffer(1)).length===1}catch{return!1}})()}};function p(b){var x=65536,v=r.getTypeOf(b),M=!0;if(v==="uint8array"?M=f.applyCanBeUsed.uint8array:v==="nodebuffer"&&(M=f.applyCanBeUsed.nodebuffer),M)for(;1<x;)try{return f.stringifyByChunk(b,v,x)}catch{x=Math.floor(x/2)}return f.stringifyByChar(b)}function m(b,x){for(var v=0;v<b.length;v++)x[v]=b[v];return x}r.applyFromCharCode=p;var y={};y.string={string:c,array:function(b){return d(b,new Array(b.length))},arraybuffer:function(b){return y.string.uint8array(b).buffer},uint8array:function(b){return d(b,new Uint8Array(b.length))},nodebuffer:function(b){return d(b,o.allocBuffer(b.length))}},y.array={string:p,array:c,arraybuffer:function(b){return new Uint8Array(b).buffer},uint8array:function(b){return new Uint8Array(b)},nodebuffer:function(b){return o.newBufferFrom(b)}},y.arraybuffer={string:function(b){return p(new Uint8Array(b))},array:function(b){return m(new Uint8Array(b),new Array(b.byteLength))},arraybuffer:c,uint8array:function(b){return new Uint8Array(b)},nodebuffer:function(b){return o.newBufferFrom(new Uint8Array(b))}},y.uint8array={string:p,array:function(b){return m(b,new Array(b.length))},arraybuffer:function(b){return b.buffer},uint8array:c,nodebuffer:function(b){return o.newBufferFrom(b)}},y.nodebuffer={string:p,array:function(b){return m(b,new Array(b.length))},arraybuffer:function(b){return y.nodebuffer.uint8array(b).buffer},uint8array:function(b){return m(b,new Uint8Array(b.length))},nodebuffer:c},r.transformTo=function(b,x){if(x=x||"",!b)return x;r.checkSupport(b);var v=r.getTypeOf(x);return y[v][b](x)},r.resolve=function(b){for(var x=b.split("/"),v=[],M=0;M<x.length;M++){var w=x[M];w==="."||w===""&&M!==0&&M!==x.length-1||(w===".."?v.pop():v.push(w))}return v.join("/")},r.getTypeOf=function(b){return typeof b=="string"?"string":Object.prototype.toString.call(b)==="[object Array]"?"array":a.nodebuffer&&o.isBuffer(b)?"nodebuffer":a.uint8array&&b instanceof Uint8Array?"uint8array":a.arraybuffer&&b instanceof ArrayBuffer?"arraybuffer":void 0},r.checkSupport=function(b){if(!a[b.toLowerCase()])throw new Error(b+" is not supported by this platform")},r.MAX_VALUE_16BITS=65535,r.MAX_VALUE_32BITS=-1,r.pretty=function(b){var x,v,M="";for(v=0;v<(b||"").length;v++)M+="\\x"+((x=b.charCodeAt(v))<16?"0":"")+x.toString(16).toUpperCase();return M},r.delay=function(b,x,v){setImmediate(function(){b.apply(v||null,x||[])})},r.inherits=function(b,x){function v(){}v.prototype=x.prototype,b.prototype=new v},r.extend=function(){var b,x,v={};for(b=0;b<arguments.length;b++)for(x in arguments[b])Object.prototype.hasOwnProperty.call(arguments[b],x)&&v[x]===void 0&&(v[x]=arguments[b][x]);return v},r.prepareContent=function(b,x,v,M,w){return l.Promise.resolve(x).then(function(E){return a.blob&&(E instanceof Blob||["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(E))!==-1)&&typeof FileReader<"u"?new l.Promise(function(T,P){var R=new FileReader;R.onload=function(U){T(U.target.result)},R.onerror=function(U){P(U.target.error)},R.readAsArrayBuffer(E)}):E}).then(function(E){var T=r.getTypeOf(E);return T?(T==="arraybuffer"?E=r.transformTo("uint8array",E):T==="string"&&(w?E=s.decode(E):v&&M!==!0&&(E=(function(P){return d(P,a.uint8array?new Uint8Array(P.length):new Array(P.length))})(E))),E):l.Promise.reject(new Error("Can't read the data of '"+b+"'. 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 p=this.reader.readString(4);throw new Error("Corrupted zip or bug: unexpected signature ("+s.pretty(p)+", expected "+s.pretty(f)+")")}},isSignature:function(f,p){var m=this.reader.index;this.reader.setIndex(f);var y=this.reader.readString(4)===p;return this.reader.setIndex(m),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),p=c.uint8array?"uint8array":"array",m=s.transformTo(p,f);this.zipComment=this.loadOptions.decodeFileName(m)},readBlockZip64EndOfCentral:function(){this.zip64EndOfCentralSize=this.reader.readInt(8),this.reader.skip(4),this.diskNumber=this.reader.readInt(4),this.diskWithCentralDirStart=this.reader.readInt(4),this.centralDirRecordsOnThisDisk=this.reader.readInt(8),this.centralDirRecords=this.reader.readInt(8),this.centralDirSize=this.reader.readInt(8),this.centralDirOffset=this.reader.readInt(8),this.zip64ExtensibleData={};for(var f,p,m,y=this.zip64EndOfCentralSize-44;0<y;)f=this.reader.readInt(2),p=this.reader.readInt(4),m=this.reader.readData(p),this.zip64ExtensibleData[f]={id:f,length:p,value:m}},readBlockZip64EndOfCentralLocator:function(){if(this.diskWithZip64CentralDirStart=this.reader.readInt(4),this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8),this.disksCount=this.reader.readInt(4),1<this.disksCount)throw new Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var f,p;for(f=0;f<this.files.length;f++)p=this.files[f],this.reader.setIndex(p.localHeaderOffset),this.checkSignature(o.LOCAL_FILE_HEADER),p.readLocalPart(this.reader),p.handleUTF8(),p.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 p=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 m=this.centralDirOffset+this.centralDirSize;this.zip64&&(m+=20,m+=12+this.zip64EndOfCentralSize);var y=p-m;if(0<y)this.isSignature(p,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 p(m,y){this.options=m,this.loadOptions=y}p.prototype={isEncrypted:function(){return(1&this.bitFlag)==1},useUTF8:function(){return(2048&this.bitFlag)==2048},readLocalPart:function(m){var y,b;if(m.skip(22),this.fileNameLength=m.readInt(2),b=m.readInt(2),this.fileName=m.readData(this.fileNameLength),m.skip(b),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(x){for(var v in d)if(Object.prototype.hasOwnProperty.call(d,v)&&d[v].magic===x)return d[v];return null})(this.compressionMethod))===null)throw new Error("Corrupted zip : compression "+s.pretty(this.compressionMethod)+" unknown (inner file : "+s.transformTo("string",this.fileName)+")");this.decompressed=new o(this.compressedSize,this.uncompressedSize,this.crc32,y,m.readData(this.compressedSize))},readCentralPart:function(m){this.versionMadeBy=m.readInt(2),m.skip(2),this.bitFlag=m.readInt(2),this.compressionMethod=m.readString(2),this.date=m.readDate(),this.crc32=m.readInt(4),this.compressedSize=m.readInt(4),this.uncompressedSize=m.readInt(4);var y=m.readInt(2);if(this.extraFieldsLength=m.readInt(2),this.fileCommentLength=m.readInt(2),this.diskNumberStart=m.readInt(2),this.internalFileAttributes=m.readInt(2),this.externalFileAttributes=m.readInt(4),this.localHeaderOffset=m.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");m.skip(y),this.readExtraFields(m),this.parseZIP64ExtraField(m),this.fileComment=m.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var m=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),m==0&&(this.dosPermissions=63&this.externalFileAttributes),m==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var m=a(this.extraFields[1].value);this.uncompressedSize===s.MAX_VALUE_32BITS&&(this.uncompressedSize=m.readInt(8)),this.compressedSize===s.MAX_VALUE_32BITS&&(this.compressedSize=m.readInt(8)),this.localHeaderOffset===s.MAX_VALUE_32BITS&&(this.localHeaderOffset=m.readInt(8)),this.diskNumberStart===s.MAX_VALUE_32BITS&&(this.diskNumberStart=m.readInt(4))}},readExtraFields:function(m){var y,b,x,v=m.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});m.index+4<v;)y=m.readInt(2),b=m.readInt(2),x=m.readData(b),this.extraFields[y]={id:y,length:b,value:x};m.setIndex(v)},handleUTF8:function(){var m=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 b=s.transformTo(m,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(b)}var x=this.findExtraFieldUnicodeComment();if(x!==null)this.fileCommentStr=x;else{var v=s.transformTo(m,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(v)}}},findExtraFieldUnicodePath:function(){var m=this.extraFields[28789];if(m){var y=a(m.value);return y.readInt(1)!==1||l(this.fileName)!==y.readInt(4)?null:c.utf8decode(y.readData(m.length-5))}return null},findExtraFieldUnicodeComment:function(){var m=this.extraFields[25461];if(m){var y=a(m.value);return y.readInt(1)!==1||l(this.fileComment)!==y.readInt(4)?null:c.utf8decode(y.readData(m.length-5))}return null}},i.exports=p},{"./compressedObject":2,"./compressions":3,"./crc32":4,"./reader/readerFor":22,"./support":30,"./utf8":31,"./utils":32}],35:[function(n,i,r){function a(y,b,x){this.name=y,this.dir=x.dir,this.date=x.date,this.comment=x.comment,this.unixPermissions=x.unixPermissions,this.dosPermissions=x.dosPermissions,this._data=b,this._dataBinary=x.binary,this.options={compression:x.compression,compressionOptions:x.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 b=null,x="string";try{if(!y)throw new Error("No output type specified.");var v=(x=y.toLowerCase())==="string"||x==="text";x!=="binarystring"&&x!=="text"||(x="string"),b=this._decompressWorker();var M=!this._dataBinary;M&&!v&&(b=b.pipe(new l.Utf8EncodeWorker)),!M&&v&&(b=b.pipe(new l.Utf8DecodeWorker))}catch(w){(b=new d("error")).error(w)}return new s(b,x,"")},async:function(y,b){return this.internalStream(y).accumulate(b)},nodeStream:function(y,b){return this.internalStream(y||"nodebuffer").toNodejsStream(b)},_compressWorker:function(y,b){if(this._data instanceof c&&this._data.compression.magic===y.magic)return this._data.getCompressedWorker();var x=this._decompressWorker();return this._dataBinary||(x=x.pipe(new l.Utf8EncodeWorker)),c.createWorkerFrom(x,y,b)},_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"],p=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},m=0;m<f.length;m++)a.prototype[f[m]]=p;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 b=a.document.createElement("script");b.onreadystatechange=function(){y(),b.onreadystatechange=null,b.parentNode.removeChild(b),b=null},a.document.documentElement.appendChild(b)}:function(){setTimeout(y,0)};else{var p=new a.MessageChannel;p.port1.onmessage=y,s=function(){p.port2.postMessage(0)}}var m=[];function y(){var b,x;o=!0;for(var v=m.length;v;){for(x=m,m=[],b=-1;++b<v;)x[b]();v=m.length}o=!1}i.exports=function(b){m.push(b)!==1||o||s()}}).call(this,typeof Yx<"u"?Yx: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(v){if(typeof v!="function")throw new TypeError("resolver must be a function");this.state=d,this.queue=[],this.outcome=void 0,v!==s&&b(this,v)}function p(v,M,w){this.promise=v,typeof M=="function"&&(this.onFulfilled=M,this.callFulfilled=this.otherCallFulfilled),typeof w=="function"&&(this.onRejected=w,this.callRejected=this.otherCallRejected)}function m(v,M,w){a(function(){var E;try{E=M(w)}catch(T){return o.reject(v,T)}E===v?o.reject(v,new TypeError("Cannot resolve promise with itself")):o.resolve(v,E)})}function y(v){var M=v&&v.then;if(v&&(typeof v=="object"||typeof v=="function")&&typeof M=="function")return function(){M.apply(v,arguments)}}function b(v,M){var w=!1;function E(R){w||(w=!0,o.reject(v,R))}function T(R){w||(w=!0,o.resolve(v,R))}var P=x(function(){M(T,E)});P.status==="error"&&E(P.value)}function x(v,M){var w={};try{w.value=v(M),w.status="success"}catch(E){w.status="error",w.value=E}return w}(i.exports=f).prototype.finally=function(v){if(typeof v!="function")return this;var M=this.constructor;return this.then(function(w){return M.resolve(v()).then(function(){return w})},function(w){return M.resolve(v()).then(function(){throw w})})},f.prototype.catch=function(v){return this.then(null,v)},f.prototype.then=function(v,M){if(typeof v!="function"&&this.state===c||typeof M!="function"&&this.state===l)return this;var w=new this.constructor(s);return this.state!==d?m(w,this.state===c?v:M,this.outcome):this.queue.push(new p(w,v,M)),w},p.prototype.callFulfilled=function(v){o.resolve(this.promise,v)},p.prototype.otherCallFulfilled=function(v){m(this.promise,this.onFulfilled,v)},p.prototype.callRejected=function(v){o.reject(this.promise,v)},p.prototype.otherCallRejected=function(v){m(this.promise,this.onRejected,v)},o.resolve=function(v,M){var w=x(y,M);if(w.status==="error")return o.reject(v,w.value);var E=w.value;if(E)b(v,E);else{v.state=c,v.outcome=M;for(var T=-1,P=v.queue.length;++T<P;)v.queue[T].callFulfilled(M)}return v},o.reject=function(v,M){v.state=l,v.outcome=M;for(var w=-1,E=v.queue.length;++w<E;)v.queue[w].callRejected(M);return v},f.resolve=function(v){return v instanceof this?v:o.resolve(new this(s),v)},f.reject=function(v){var M=new this(s);return o.reject(M,v)},f.all=function(v){var M=this;if(Object.prototype.toString.call(v)!=="[object Array]")return this.reject(new TypeError("must be an array"));var w=v.length,E=!1;if(!w)return this.resolve([]);for(var T=new Array(w),P=0,R=-1,U=new this(s);++R<w;)N(v[R],R);return U;function N(O,B){M.resolve(O).then(function(I){T[B]=I,++P!==w||E||(E=!0,o.resolve(U,T))},function(I){E||(E=!0,o.reject(U,I))})}},f.race=function(v){var M=this;if(Object.prototype.toString.call(v)!=="[object Array]")return this.reject(new TypeError("must be an array"));var w=v.length,E=!1;if(!w)return this.resolve([]);for(var T=-1,P=new this(s);++T<w;)R=v[T],M.resolve(R).then(function(U){E||(E=!0,o.resolve(P,U))},function(U){E||(E=!0,o.reject(P,U))});var R;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,p=-1,m=0,y=8;function b(v){if(!(this instanceof b))return new b(v);this.options=s.assign({level:p,method:y,chunkSize:16384,windowBits:15,memLevel:8,strategy:m,to:""},v||{});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 E;if(E=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,E))!==f)throw new Error(l[w]);this._dict_set=!0}}function x(v,M){var w=new b(M);if(w.push(v,!0),w.err)throw w.msg||l[w.err];return w.result}b.prototype.push=function(v,M){var w,E,T=this.strm,P=this.options.chunkSize;if(this.ended)return!1;E=M===~~M?M:M===!0?4:0,typeof v=="string"?T.input=o.string2buf(v):d.call(v)==="[object ArrayBuffer]"?T.input=new Uint8Array(v):T.input=v,T.next_in=0,T.avail_in=T.input.length;do{if(T.avail_out===0&&(T.output=new s.Buf8(P),T.next_out=0,T.avail_out=P),(w=a.deflate(T,E))!==1&&w!==f)return this.onEnd(w),!(this.ended=!0);T.avail_out!==0&&(T.avail_in!==0||E!==4&&E!==2)||(this.options.to==="string"?this.onData(o.buf2binstring(s.shrinkBuf(T.output,T.next_out))):this.onData(s.shrinkBuf(T.output,T.next_out)))}while((0<T.avail_in||T.avail_out===0)&&w!==1);return E===4?(w=a.deflateEnd(this.strm),this.onEnd(w),this.ended=!0,w===f):E!==2||(this.onEnd(f),!(T.avail_out=0))},b.prototype.onData=function(v){this.chunks.push(v)},b.prototype.onEnd=function(v){v===f&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=s.flattenChunks(this.chunks)),this.chunks=[],this.err=v,this.msg=this.strm.msg},r.Deflate=b,r.deflate=x,r.deflateRaw=function(v,M){return(M=M||{}).raw=!0,x(v,M)},r.gzip=function(v,M){return(M=M||{}).gzip=!0,x(v,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"),p=Object.prototype.toString;function m(b){if(!(this instanceof m))return new m(b);this.options=s.assign({chunkSize:16384,windowBits:0,to:""},b||{});var x=this.options;x.raw&&0<=x.windowBits&&x.windowBits<16&&(x.windowBits=-x.windowBits,x.windowBits===0&&(x.windowBits=-15)),!(0<=x.windowBits&&x.windowBits<16)||b&&b.windowBits||(x.windowBits+=32),15<x.windowBits&&x.windowBits<48&&(15&x.windowBits)==0&&(x.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new d,this.strm.avail_out=0;var v=a.inflateInit2(this.strm,x.windowBits);if(v!==l.Z_OK)throw new Error(c[v]);this.header=new f,a.inflateGetHeader(this.strm,this.header)}function y(b,x){var v=new m(x);if(v.push(b,!0),v.err)throw v.msg||c[v.err];return v.result}m.prototype.push=function(b,x){var v,M,w,E,T,P,R=this.strm,U=this.options.chunkSize,N=this.options.dictionary,O=!1;if(this.ended)return!1;M=x===~~x?x:x===!0?l.Z_FINISH:l.Z_NO_FLUSH,typeof b=="string"?R.input=o.binstring2buf(b):p.call(b)==="[object ArrayBuffer]"?R.input=new Uint8Array(b):R.input=b,R.next_in=0,R.avail_in=R.input.length;do{if(R.avail_out===0&&(R.output=new s.Buf8(U),R.next_out=0,R.avail_out=U),(v=a.inflate(R,l.Z_NO_FLUSH))===l.Z_NEED_DICT&&N&&(P=typeof N=="string"?o.string2buf(N):p.call(N)==="[object ArrayBuffer]"?new Uint8Array(N):N,v=a.inflateSetDictionary(this.strm,P)),v===l.Z_BUF_ERROR&&O===!0&&(v=l.Z_OK,O=!1),v!==l.Z_STREAM_END&&v!==l.Z_OK)return this.onEnd(v),!(this.ended=!0);R.next_out&&(R.avail_out!==0&&v!==l.Z_STREAM_END&&(R.avail_in!==0||M!==l.Z_FINISH&&M!==l.Z_SYNC_FLUSH)||(this.options.to==="string"?(w=o.utf8border(R.output,R.next_out),E=R.next_out-w,T=o.buf2string(R.output,w),R.next_out=E,R.avail_out=U-E,E&&s.arraySet(R.output,R.output,w,E,0),this.onData(T)):this.onData(s.shrinkBuf(R.output,R.next_out)))),R.avail_in===0&&R.avail_out===0&&(O=!0)}while((0<R.avail_in||R.avail_out===0)&&v!==l.Z_STREAM_END);return v===l.Z_STREAM_END&&(M=l.Z_FINISH),M===l.Z_FINISH?(v=a.inflateEnd(this.strm),this.onEnd(v),this.ended=!0,v===l.Z_OK):M!==l.Z_SYNC_FLUSH||(this.onEnd(l.Z_OK),!(R.avail_out=0))},m.prototype.onData=function(b){this.chunks.push(b)},m.prototype.onEnd=function(b){b===l.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=s.flattenChunks(this.chunks)),this.chunks=[],this.err=b,this.msg=this.strm.msg},r.Inflate=m,r.inflate=y,r.inflateRaw=function(b,x){return(x=x||{}).raw=!0,y(b,x)},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,p){if(c.subarray&&l.subarray)l.set(c.subarray(d,d+f),p);else for(var m=0;m<f;m++)l[p+m]=c[d+m]},flattenChunks:function(l){var c,d,f,p,m,y;for(c=f=0,d=l.length;c<d;c++)f+=l[c].length;for(y=new Uint8Array(f),c=p=0,d=l.length;c<d;c++)m=l[c],y.set(m,p),p+=m.length;return y}},o={arraySet:function(l,c,d,f,p){for(var m=0;m<f;m++)l[p+m]=c[d+m]},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,p){if(p<65537&&(f.subarray&&o||!f.subarray&&s))return String.fromCharCode.apply(null,a.shrinkBuf(f,p));for(var m="",y=0;y<p;y++)m+=String.fromCharCode(f[y]);return m}l[254]=l[254]=1,r.string2buf=function(f){var p,m,y,b,x,v=f.length,M=0;for(b=0;b<v;b++)(64512&(m=f.charCodeAt(b)))==55296&&b+1<v&&(64512&(y=f.charCodeAt(b+1)))==56320&&(m=65536+(m-55296<<10)+(y-56320),b++),M+=m<128?1:m<2048?2:m<65536?3:4;for(p=new a.Buf8(M),b=x=0;x<M;b++)(64512&(m=f.charCodeAt(b)))==55296&&b+1<v&&(64512&(y=f.charCodeAt(b+1)))==56320&&(m=65536+(m-55296<<10)+(y-56320),b++),m<128?p[x++]=m:(m<2048?p[x++]=192|m>>>6:(m<65536?p[x++]=224|m>>>12:(p[x++]=240|m>>>18,p[x++]=128|m>>>12&63),p[x++]=128|m>>>6&63),p[x++]=128|63&m);return p},r.buf2binstring=function(f){return d(f,f.length)},r.binstring2buf=function(f){for(var p=new a.Buf8(f.length),m=0,y=p.length;m<y;m++)p[m]=f.charCodeAt(m);return p},r.buf2string=function(f,p){var m,y,b,x,v=p||f.length,M=new Array(2*v);for(m=y=0;m<v;)if((b=f[m++])<128)M[y++]=b;else if(4<(x=l[b]))M[y++]=65533,m+=x-1;else{for(b&=x===2?31:x===3?15:7;1<x&&m<v;)b=b<<6|63&f[m++],x--;1<x?M[y++]=65533:b<65536?M[y++]=b:(b-=65536,M[y++]=55296|b>>10&1023,M[y++]=56320|1023&b)}return d(M,y)},r.utf8border=function(f,p){var m;for((p=p||f.length)>f.length&&(p=f.length),m=p-1;0<=m&&(192&f[m])==128;)m--;return m<0||m===0?p:m+l[f[m]]>p?m:p}},{"./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 p=c;p<f;p++)s=s>>>8^d[255&(s^o[p])];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,p=4,m=0,y=-2,b=-1,x=4,v=2,M=8,w=9,E=286,T=30,P=19,R=2*E+1,U=15,N=3,O=258,B=O+N+1,I=42,W=113,L=1,$=2,q=3,G=4;function Y(z,V){return z.msg=d[V],V}function Q(z){return(z<<1)-(4<z?9:0)}function se(z){for(var V=z.length;0<=--V;)z[V]=0}function H(z){var V=z.state,ne=V.pending;ne>z.avail_out&&(ne=z.avail_out),ne!==0&&(s.arraySet(z.output,V.pending_buf,V.pending_out,ne,z.next_out),z.next_out+=ne,V.pending_out+=ne,z.total_out+=ne,z.avail_out-=ne,V.pending-=ne,V.pending===0&&(V.pending_out=0))}function X(z,V){o._tr_flush_block(z,0<=z.block_start?z.block_start:-1,z.strstart-z.block_start,V),z.block_start=z.strstart,H(z.strm)}function re(z,V){z.pending_buf[z.pending++]=V}function ce(z,V){z.pending_buf[z.pending++]=V>>>8&255,z.pending_buf[z.pending++]=255&V}function ye(z,V){var ne,J,ee=z.max_chain_length,ae=z.strstart,ie=z.prev_length,we=z.nice_match,ve=z.strstart>z.w_size-B?z.strstart-(z.w_size-B):0,F=z.window,k=z.w_mask,K=z.prev,pe=z.strstart+O,xe=F[ae+ie-1],fe=F[ae+ie];z.prev_length>=z.good_match&&(ee>>=2),we>z.lookahead&&(we=z.lookahead);do if(F[(ne=V)+ie]===fe&&F[ne+ie-1]===xe&&F[ne]===F[ae]&&F[++ne]===F[ae+1]){ae+=2,ne++;do;while(F[++ae]===F[++ne]&&F[++ae]===F[++ne]&&F[++ae]===F[++ne]&&F[++ae]===F[++ne]&&F[++ae]===F[++ne]&&F[++ae]===F[++ne]&&F[++ae]===F[++ne]&&F[++ae]===F[++ne]&&ae<pe);if(J=O-(pe-ae),ae=pe-O,ie<J){if(z.match_start=V,we<=(ie=J))break;xe=F[ae+ie-1],fe=F[ae+ie]}}while((V=K[V&k])>ve&&--ee!=0);return ie<=z.lookahead?ie:z.lookahead}function me(z){var V,ne,J,ee,ae,ie,we,ve,F,k,K=z.w_size;do{if(ee=z.window_size-z.lookahead-z.strstart,z.strstart>=K+(K-B)){for(s.arraySet(z.window,z.window,K,K,0),z.match_start-=K,z.strstart-=K,z.block_start-=K,V=ne=z.hash_size;J=z.head[--V],z.head[V]=K<=J?J-K:0,--ne;);for(V=ne=K;J=z.prev[--V],z.prev[V]=K<=J?J-K:0,--ne;);ee+=K}if(z.strm.avail_in===0)break;if(ie=z.strm,we=z.window,ve=z.strstart+z.lookahead,F=ee,k=void 0,k=ie.avail_in,F<k&&(k=F),ne=k===0?0:(ie.avail_in-=k,s.arraySet(we,ie.input,ie.next_in,k,ve),ie.state.wrap===1?ie.adler=l(ie.adler,we,k,ve):ie.state.wrap===2&&(ie.adler=c(ie.adler,we,k,ve)),ie.next_in+=k,ie.total_in+=k,k),z.lookahead+=ne,z.lookahead+z.insert>=N)for(ae=z.strstart-z.insert,z.ins_h=z.window[ae],z.ins_h=(z.ins_h<<z.hash_shift^z.window[ae+1])&z.hash_mask;z.insert&&(z.ins_h=(z.ins_h<<z.hash_shift^z.window[ae+N-1])&z.hash_mask,z.prev[ae&z.w_mask]=z.head[z.ins_h],z.head[z.ins_h]=ae,ae++,z.insert--,!(z.lookahead+z.insert<N)););}while(z.lookahead<B&&z.strm.avail_in!==0)}function be(z,V){for(var ne,J;;){if(z.lookahead<B){if(me(z),z.lookahead<B&&V===f)return L;if(z.lookahead===0)break}if(ne=0,z.lookahead>=N&&(z.ins_h=(z.ins_h<<z.hash_shift^z.window[z.strstart+N-1])&z.hash_mask,ne=z.prev[z.strstart&z.w_mask]=z.head[z.ins_h],z.head[z.ins_h]=z.strstart),ne!==0&&z.strstart-ne<=z.w_size-B&&(z.match_length=ye(z,ne)),z.match_length>=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,ne=z.prev[z.strstart&z.w_mask]=z.head[z.ins_h],z.head[z.ins_h]=z.strstart,--z.match_length!=0;);z.strstart++}else z.strstart+=z.match_length,z.match_length=0,z.ins_h=z.window[z.strstart],z.ins_h=(z.ins_h<<z.hash_shift^z.window[z.strstart+1])&z.hash_mask;else 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 L}return z.insert=z.strstart<N-1?z.strstart:N-1,V===p?(X(z,!0),z.strm.avail_out===0?q:G):z.last_lit&&(X(z,!1),z.strm.avail_out===0)?L:$}function De(z,V){for(var ne,J,ee;;){if(z.lookahead<B){if(me(z),z.lookahead<B&&V===f)return L;if(z.lookahead===0)break}if(ne=0,z.lookahead>=N&&(z.ins_h=(z.ins_h<<z.hash_shift^z.window[z.strstart+N-1])&z.hash_mask,ne=z.prev[z.strstart&z.w_mask]=z.head[z.ins_h],z.head[z.ins_h]=z.strstart),z.prev_length=z.match_length,z.prev_match=z.match_start,z.match_length=N-1,ne!==0&&z.prev_length<z.max_lazy_match&&z.strstart-ne<=z.w_size-B&&(z.match_length=ye(z,ne),z.match_length<=5&&(z.strategy===1||z.match_length===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,ne=z.prev[z.strstart&z.w_mask]=z.head[z.ins_h],z.head[z.ins_h]=z.strstart),--z.prev_length!=0;);if(z.match_available=0,z.match_length=N-1,z.strstart++,J&&(X(z,!1),z.strm.avail_out===0))return L}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 L}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,V===p?(X(z,!0),z.strm.avail_out===0?q:G):z.last_lit&&(X(z,!1),z.strm.avail_out===0)?L:$}function he(z,V,ne,J,ee){this.good_length=z,this.max_lazy=V,this.nice_length=ne,this.max_chain=J,this.func=ee}function Ae(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=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*R),this.dyn_dtree=new s.Buf16(2*(2*T+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*E+1),se(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new s.Buf16(2*E+1),se(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function Be(z){var V;return z&&z.state?(z.total_in=z.total_out=0,z.data_type=v,(V=z.state).pending=0,V.pending_out=0,V.wrap<0&&(V.wrap=-V.wrap),V.status=V.wrap?I:W,z.adler=V.wrap===2?0:1,V.last_flush=f,o._tr_init(V),m):Y(z,y)}function le(z){var V=Be(z);return V===m&&(function(ne){ne.window_size=2*ne.w_size,se(ne.head),ne.max_lazy_match=a[ne.level].max_lazy,ne.good_match=a[ne.level].good_length,ne.nice_match=a[ne.level].nice_length,ne.max_chain_length=a[ne.level].max_chain,ne.strstart=0,ne.block_start=0,ne.lookahead=0,ne.insert=0,ne.match_length=ne.prev_length=N-1,ne.match_available=0,ne.ins_h=0})(z.state),V}function ut(z,V,ne,J,ee,ae){if(!z)return y;var ie=1;if(V===b&&(V=6),J<0?(ie=0,J=-J):15<J&&(ie=2,J-=16),ee<1||w<ee||ne!==M||J<8||15<J||V<0||9<V||ae<0||x<ae)return Y(z,y);J===8&&(J=9);var we=new Ae;return(z.state=we).strm=z,we.wrap=ie,we.gzhead=null,we.w_bits=J,we.w_size=1<<we.w_bits,we.w_mask=we.w_size-1,we.hash_bits=ee+7,we.hash_size=1<<we.hash_bits,we.hash_mask=we.hash_size-1,we.hash_shift=~~((we.hash_bits+N-1)/N),we.window=new s.Buf8(2*we.w_size),we.head=new s.Buf16(we.hash_size),we.prev=new s.Buf16(we.w_size),we.lit_bufsize=1<<ee+6,we.pending_buf_size=4*we.lit_bufsize,we.pending_buf=new s.Buf8(we.pending_buf_size),we.d_buf=1*we.lit_bufsize,we.l_buf=3*we.lit_bufsize,we.level=V,we.strategy=ae,we.method=ne,le(z)}a=[new he(0,0,0,0,function(z,V){var ne=65535;for(ne>z.pending_buf_size-5&&(ne=z.pending_buf_size-5);;){if(z.lookahead<=1){if(me(z),z.lookahead===0&&V===f)return L;if(z.lookahead===0)break}z.strstart+=z.lookahead,z.lookahead=0;var J=z.block_start+ne;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-B&&(X(z,!1),z.strm.avail_out===0))return L}return z.insert=0,V===p?(X(z,!0),z.strm.avail_out===0?q:G):(z.strstart>z.block_start&&(X(z,!1),z.strm.avail_out),L)}),new he(4,4,8,4,be),new he(4,5,16,8,be),new he(4,6,32,32,be),new he(4,4,16,16,De),new he(8,16,32,32,De),new he(8,16,128,128,De),new he(8,32,128,256,De),new he(32,128,258,1024,De),new he(32,258,258,4096,De)],r.deflateInit=function(z,V){return ut(z,V,M,15,8,0)},r.deflateInit2=ut,r.deflateReset=le,r.deflateResetKeep=Be,r.deflateSetHeader=function(z,V){return z&&z.state?z.state.wrap!==2?y:(z.state.gzhead=V,m):y},r.deflate=function(z,V){var ne,J,ee,ae;if(!z||!z.state||5<V||V<0)return z?Y(z,y):y;if(J=z.state,!z.output||!z.input&&z.avail_in!==0||J.status===666&&V!==p)return Y(z,z.avail_out===0?-5:y);if(J.strm=z,ne=J.last_flush,J.last_flush=V,J.status===I)if(J.wrap===2)z.adler=0,re(J,31),re(J,139),re(J,8),J.gzhead?(re(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)),re(J,255&J.gzhead.time),re(J,J.gzhead.time>>8&255),re(J,J.gzhead.time>>16&255),re(J,J.gzhead.time>>24&255),re(J,J.level===9?2:2<=J.strategy||J.level<2?4:0),re(J,255&J.gzhead.os),J.gzhead.extra&&J.gzhead.extra.length&&(re(J,255&J.gzhead.extra.length),re(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):(re(J,0),re(J,0),re(J,0),re(J,0),re(J,0),re(J,J.level===9?2:2<=J.strategy||J.level<2?4:0),re(J,3),J.status=W);else{var ie=M+(J.w_bits-8<<4)<<8;ie|=(2<=J.strategy||J.level<2?0:J.level<6?1:J.level===6?2:3)<<6,J.strstart!==0&&(ie|=32),ie+=31-ie%31,J.status=W,ce(J,ie),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)),H(z),ee=J.pending,J.pending!==J.pending_buf_size));)re(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)),H(z),ee=J.pending,J.pending===J.pending_buf_size)){ae=1;break}ae=J.gzindex<J.gzhead.name.length?255&J.gzhead.name.charCodeAt(J.gzindex++):0,re(J,ae)}while(ae!==0);J.gzhead.hcrc&&J.pending>ee&&(z.adler=c(z.adler,J.pending_buf,J.pending-ee,ee)),ae===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)),H(z),ee=J.pending,J.pending===J.pending_buf_size)){ae=1;break}ae=J.gzindex<J.gzhead.comment.length?255&J.gzhead.comment.charCodeAt(J.gzindex++):0,re(J,ae)}while(ae!==0);J.gzhead.hcrc&&J.pending>ee&&(z.adler=c(z.adler,J.pending_buf,J.pending-ee,ee)),ae===0&&(J.status=103)}else J.status=103;if(J.status===103&&(J.gzhead.hcrc?(J.pending+2>J.pending_buf_size&&H(z),J.pending+2<=J.pending_buf_size&&(re(J,255&z.adler),re(J,z.adler>>8&255),z.adler=0,J.status=W)):J.status=W),J.pending!==0){if(H(z),z.avail_out===0)return J.last_flush=-1,m}else if(z.avail_in===0&&Q(V)<=Q(ne)&&V!==p)return Y(z,-5);if(J.status===666&&z.avail_in!==0)return Y(z,-5);if(z.avail_in!==0||J.lookahead!==0||V!==f&&J.status!==666){var we=J.strategy===2?(function(ve,F){for(var k;;){if(ve.lookahead===0&&(me(ve),ve.lookahead===0)){if(F===f)return L;break}if(ve.match_length=0,k=o._tr_tally(ve,0,ve.window[ve.strstart]),ve.lookahead--,ve.strstart++,k&&(X(ve,!1),ve.strm.avail_out===0))return L}return ve.insert=0,F===p?(X(ve,!0),ve.strm.avail_out===0?q:G):ve.last_lit&&(X(ve,!1),ve.strm.avail_out===0)?L:$})(J,V):J.strategy===3?(function(ve,F){for(var k,K,pe,xe,fe=ve.window;;){if(ve.lookahead<=O){if(me(ve),ve.lookahead<=O&&F===f)return L;if(ve.lookahead===0)break}if(ve.match_length=0,ve.lookahead>=N&&0<ve.strstart&&(K=fe[pe=ve.strstart-1])===fe[++pe]&&K===fe[++pe]&&K===fe[++pe]){xe=ve.strstart+O;do;while(K===fe[++pe]&&K===fe[++pe]&&K===fe[++pe]&&K===fe[++pe]&&K===fe[++pe]&&K===fe[++pe]&&K===fe[++pe]&&K===fe[++pe]&&pe<xe);ve.match_length=O-(xe-pe),ve.match_length>ve.lookahead&&(ve.match_length=ve.lookahead)}if(ve.match_length>=N?(k=o._tr_tally(ve,1,ve.match_length-N),ve.lookahead-=ve.match_length,ve.strstart+=ve.match_length,ve.match_length=0):(k=o._tr_tally(ve,0,ve.window[ve.strstart]),ve.lookahead--,ve.strstart++),k&&(X(ve,!1),ve.strm.avail_out===0))return L}return ve.insert=0,F===p?(X(ve,!0),ve.strm.avail_out===0?q:G):ve.last_lit&&(X(ve,!1),ve.strm.avail_out===0)?L:$})(J,V):a[J.level].func(J,V);if(we!==q&&we!==G||(J.status=666),we===L||we===q)return z.avail_out===0&&(J.last_flush=-1),m;if(we===$&&(V===1?o._tr_align(J):V!==5&&(o._tr_stored_block(J,0,0,!1),V===3&&(se(J.head),J.lookahead===0&&(J.strstart=0,J.block_start=0,J.insert=0))),H(z),z.avail_out===0))return J.last_flush=-1,m}return V!==p?m:J.wrap<=0?1:(J.wrap===2?(re(J,255&z.adler),re(J,z.adler>>8&255),re(J,z.adler>>16&255),re(J,z.adler>>24&255),re(J,255&z.total_in),re(J,z.total_in>>8&255),re(J,z.total_in>>16&255),re(J,z.total_in>>24&255)):(ce(J,z.adler>>>16),ce(J,65535&z.adler)),H(z),0<J.wrap&&(J.wrap=-J.wrap),J.pending!==0?m:1)},r.deflateEnd=function(z){var V;return z&&z.state?(V=z.state.status)!==I&&V!==69&&V!==73&&V!==91&&V!==103&&V!==W&&V!==666?Y(z,y):(z.state=null,V===W?Y(z,-3):m):y},r.deflateSetDictionary=function(z,V){var ne,J,ee,ae,ie,we,ve,F,k=V.length;if(!z||!z.state||(ae=(ne=z.state).wrap)===2||ae===1&&ne.status!==I||ne.lookahead)return y;for(ae===1&&(z.adler=l(z.adler,V,k,0)),ne.wrap=0,k>=ne.w_size&&(ae===0&&(se(ne.head),ne.strstart=0,ne.block_start=0,ne.insert=0),F=new s.Buf8(ne.w_size),s.arraySet(F,V,k-ne.w_size,ne.w_size,0),V=F,k=ne.w_size),ie=z.avail_in,we=z.next_in,ve=z.input,z.avail_in=k,z.next_in=0,z.input=V,me(ne);ne.lookahead>=N;){for(J=ne.strstart,ee=ne.lookahead-(N-1);ne.ins_h=(ne.ins_h<<ne.hash_shift^ne.window[J+N-1])&ne.hash_mask,ne.prev[J&ne.w_mask]=ne.head[ne.ins_h],ne.head[ne.ins_h]=J,J++,--ee;);ne.strstart=J,ne.lookahead=N-1,me(ne)}return ne.strstart+=ne.lookahead,ne.block_start=ne.strstart,ne.insert=ne.lookahead,ne.lookahead=0,ne.match_length=ne.prev_length=N-1,ne.match_available=0,z.next_in=we,z.input=ve,z.avail_in=ie,ne.wrap=ae,m},r.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./messages":51,"./trees":52}],47:[function(n,i,r){i.exports=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}},{}],48:[function(n,i,r){i.exports=function(a,s){var o,l,c,d,f,p,m,y,b,x,v,M,w,E,T,P,R,U,N,O,B,I,W,L,$;o=a.state,l=a.next_in,L=a.input,c=l+(a.avail_in-5),d=a.next_out,$=a.output,f=d-(s-a.avail_out),p=d+(a.avail_out-257),m=o.dmax,y=o.wsize,b=o.whave,x=o.wnext,v=o.window,M=o.hold,w=o.bits,E=o.lencode,T=o.distcode,P=(1<<o.lenbits)-1,R=(1<<o.distbits)-1;e:do{w<15&&(M+=L[l++]<<w,w+=8,M+=L[l++]<<w,w+=8),U=E[M&P];t:for(;;){if(M>>>=N=U>>>24,w-=N,(N=U>>>16&255)===0)$[d++]=65535&U;else{if(!(16&N)){if((64&N)==0){U=E[(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}O=65535&U,(N&=15)&&(w<N&&(M+=L[l++]<<w,w+=8),O+=M&(1<<N)-1,M>>>=N,w-=N),w<15&&(M+=L[l++]<<w,w+=8,M+=L[l++]<<w,w+=8),U=T[M&R];n:for(;;){if(M>>>=N=U>>>24,w-=N,!(16&(N=U>>>16&255))){if((64&N)==0){U=T[(65535&U)+(M&(1<<N)-1)];continue n}a.msg="invalid distance code",o.mode=30;break e}if(B=65535&U,w<(N&=15)&&(M+=L[l++]<<w,(w+=8)<N&&(M+=L[l++]<<w,w+=8)),m<(B+=M&(1<<N)-1)){a.msg="invalid distance too far back",o.mode=30;break e}if(M>>>=N,w-=N,(N=d-f)<B){if(b<(N=B-N)&&o.sane){a.msg="invalid distance too far back",o.mode=30;break e}if(W=v,(I=0)===x){if(I+=y-N,N<O){for(O-=N;$[d++]=v[I++],--N;);I=d-B,W=$}}else if(x<N){if(I+=y+x-N,(N-=x)<O){for(O-=N;$[d++]=v[I++],--N;);if(I=0,x<O){for(O-=N=x;$[d++]=v[I++],--N;);I=d-B,W=$}}}else if(I+=x-N,N<O){for(O-=N;$[d++]=v[I++],--N;);I=d-B,W=$}for(;2<O;)$[d++]=W[I++],$[d++]=W[I++],$[d++]=W[I++],O-=3;O&&($[d++]=W[I++],1<O&&($[d++]=W[I++]))}else{for(I=d-B;$[d++]=$[I++],$[d++]=$[I++],$[d++]=$[I++],2<(O-=3););O&&($[d++]=$[I++],1<O&&($[d++]=$[I++]))}break}}break}}while(l<c&&d<p);l-=O=w>>3,M&=(1<<(w-=O<<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<p?p-d+257:257-(d-p),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,p=0,m=-2,y=1,b=852,x=592;function v(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(b),W.distcode=W.distdyn=new a.Buf32(x),W.sane=1,W.back=-1,p):m}function E(I){var W;return I&&I.state?((W=I.state).wsize=0,W.whave=0,W.wnext=0,w(I)):m}function T(I,W){var L,$;return I&&I.state?($=I.state,W<0?(L=0,W=-W):(L=1+(W>>4),W<48&&(W&=15)),W&&(W<8||15<W)?m:($.window!==null&&$.wbits!==W&&($.window=null),$.wrap=L,$.wbits=W,E(I))):m}function P(I,W){var L,$;return I?($=new M,(I.state=$).window=null,(L=T(I,W))!==p&&(I.state=null),L):m}var R,U,N=!0;function O(I){if(N){var W;for(R=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,R,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=R,I.lenbits=9,I.distcode=U,I.distbits=5}function B(I,W,L,$){var q,G=I.state;return G.window===null&&(G.wsize=1<<G.wbits,G.wnext=0,G.whave=0,G.window=new a.Buf8(G.wsize)),$>=G.wsize?(a.arraySet(G.window,W,L-G.wsize,G.wsize,0),G.wnext=0,G.whave=G.wsize):($<(q=G.wsize-G.wnext)&&(q=$),a.arraySet(G.window,W,L-$,q,G.wnext),($-=q)?(a.arraySet(G.window,W,L-$,$,0),G.wnext=$,G.whave=G.wsize):(G.wnext+=q,G.wnext===G.wsize&&(G.wnext=0),G.whave<G.wsize&&(G.whave+=q))),0}r.inflateReset=E,r.inflateReset2=T,r.inflateResetKeep=w,r.inflateInit=function(I){return P(I,15)},r.inflateInit2=P,r.inflate=function(I,W){var L,$,q,G,Y,Q,se,H,X,re,ce,ye,me,be,De,he,Ae,Be,le,ut,z,V,ne,J,ee=0,ae=new a.Buf8(4),ie=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!I||!I.state||!I.output||!I.input&&I.avail_in!==0)return m;(L=I.state).mode===12&&(L.mode=13),Y=I.next_out,q=I.output,se=I.avail_out,G=I.next_in,$=I.input,Q=I.avail_in,H=L.hold,X=L.bits,re=Q,ce=se,V=p;e:for(;;)switch(L.mode){case y:if(L.wrap===0){L.mode=13;break}for(;X<16;){if(Q===0)break e;Q--,H+=$[G++]<<X,X+=8}if(2&L.wrap&&H===35615){ae[L.check=0]=255&H,ae[1]=H>>>8&255,L.check=o(L.check,ae,2,0),X=H=0,L.mode=2;break}if(L.flags=0,L.head&&(L.head.done=!1),!(1&L.wrap)||(((255&H)<<8)+(H>>8))%31){I.msg="incorrect header check",L.mode=30;break}if((15&H)!=8){I.msg="unknown compression method",L.mode=30;break}if(X-=4,z=8+(15&(H>>>=4)),L.wbits===0)L.wbits=z;else if(z>L.wbits){I.msg="invalid window size",L.mode=30;break}L.dmax=1<<z,I.adler=L.check=1,L.mode=512&H?10:12,X=H=0;break;case 2:for(;X<16;){if(Q===0)break e;Q--,H+=$[G++]<<X,X+=8}if(L.flags=H,(255&L.flags)!=8){I.msg="unknown compression method",L.mode=30;break}if(57344&L.flags){I.msg="unknown header flags set",L.mode=30;break}L.head&&(L.head.text=H>>8&1),512&L.flags&&(ae[0]=255&H,ae[1]=H>>>8&255,L.check=o(L.check,ae,2,0)),X=H=0,L.mode=3;case 3:for(;X<32;){if(Q===0)break e;Q--,H+=$[G++]<<X,X+=8}L.head&&(L.head.time=H),512&L.flags&&(ae[0]=255&H,ae[1]=H>>>8&255,ae[2]=H>>>16&255,ae[3]=H>>>24&255,L.check=o(L.check,ae,4,0)),X=H=0,L.mode=4;case 4:for(;X<16;){if(Q===0)break e;Q--,H+=$[G++]<<X,X+=8}L.head&&(L.head.xflags=255&H,L.head.os=H>>8),512&L.flags&&(ae[0]=255&H,ae[1]=H>>>8&255,L.check=o(L.check,ae,2,0)),X=H=0,L.mode=5;case 5:if(1024&L.flags){for(;X<16;){if(Q===0)break e;Q--,H+=$[G++]<<X,X+=8}L.length=H,L.head&&(L.head.extra_len=H),512&L.flags&&(ae[0]=255&H,ae[1]=H>>>8&255,L.check=o(L.check,ae,2,0)),X=H=0}else L.head&&(L.head.extra=null);L.mode=6;case 6:if(1024&L.flags&&(Q<(ye=L.length)&&(ye=Q),ye&&(L.head&&(z=L.head.extra_len-L.length,L.head.extra||(L.head.extra=new Array(L.head.extra_len)),a.arraySet(L.head.extra,$,G,ye,z)),512&L.flags&&(L.check=o(L.check,$,ye,G)),Q-=ye,G+=ye,L.length-=ye),L.length))break e;L.length=0,L.mode=7;case 7:if(2048&L.flags){if(Q===0)break e;for(ye=0;z=$[G+ye++],L.head&&z&&L.length<65536&&(L.head.name+=String.fromCharCode(z)),z&&ye<Q;);if(512&L.flags&&(L.check=o(L.check,$,ye,G)),Q-=ye,G+=ye,z)break e}else L.head&&(L.head.name=null);L.length=0,L.mode=8;case 8:if(4096&L.flags){if(Q===0)break e;for(ye=0;z=$[G+ye++],L.head&&z&&L.length<65536&&(L.head.comment+=String.fromCharCode(z)),z&&ye<Q;);if(512&L.flags&&(L.check=o(L.check,$,ye,G)),Q-=ye,G+=ye,z)break e}else L.head&&(L.head.comment=null);L.mode=9;case 9:if(512&L.flags){for(;X<16;){if(Q===0)break e;Q--,H+=$[G++]<<X,X+=8}if(H!==(65535&L.check)){I.msg="header crc mismatch",L.mode=30;break}X=H=0}L.head&&(L.head.hcrc=L.flags>>9&1,L.head.done=!0),I.adler=L.check=0,L.mode=12;break;case 10:for(;X<32;){if(Q===0)break e;Q--,H+=$[G++]<<X,X+=8}I.adler=L.check=v(H),X=H=0,L.mode=11;case 11:if(L.havedict===0)return I.next_out=Y,I.avail_out=se,I.next_in=G,I.avail_in=Q,L.hold=H,L.bits=X,2;I.adler=L.check=1,L.mode=12;case 12:if(W===5||W===6)break e;case 13:if(L.last){H>>>=7&X,X-=7&X,L.mode=27;break}for(;X<3;){if(Q===0)break e;Q--,H+=$[G++]<<X,X+=8}switch(L.last=1&H,X-=1,3&(H>>>=1)){case 0:L.mode=14;break;case 1:if(O(L),L.mode=20,W!==6)break;H>>>=2,X-=2;break e;case 2:L.mode=17;break;case 3:I.msg="invalid block type",L.mode=30}H>>>=2,X-=2;break;case 14:for(H>>>=7&X,X-=7&X;X<32;){if(Q===0)break e;Q--,H+=$[G++]<<X,X+=8}if((65535&H)!=(H>>>16^65535)){I.msg="invalid stored block lengths",L.mode=30;break}if(L.length=65535&H,X=H=0,L.mode=15,W===6)break e;case 15:L.mode=16;case 16:if(ye=L.length){if(Q<ye&&(ye=Q),se<ye&&(ye=se),ye===0)break e;a.arraySet(q,$,G,ye,Y),Q-=ye,G+=ye,se-=ye,Y+=ye,L.length-=ye;break}L.mode=12;break;case 17:for(;X<14;){if(Q===0)break e;Q--,H+=$[G++]<<X,X+=8}if(L.nlen=257+(31&H),H>>>=5,X-=5,L.ndist=1+(31&H),H>>>=5,X-=5,L.ncode=4+(15&H),H>>>=4,X-=4,286<L.nlen||30<L.ndist){I.msg="too many length or distance symbols",L.mode=30;break}L.have=0,L.mode=18;case 18:for(;L.have<L.ncode;){for(;X<3;){if(Q===0)break e;Q--,H+=$[G++]<<X,X+=8}L.lens[ie[L.have++]]=7&H,H>>>=3,X-=3}for(;L.have<19;)L.lens[ie[L.have++]]=0;if(L.lencode=L.lendyn,L.lenbits=7,ne={bits:L.lenbits},V=c(0,L.lens,0,19,L.lencode,0,L.work,ne),L.lenbits=ne.bits,V){I.msg="invalid code lengths set",L.mode=30;break}L.have=0,L.mode=19;case 19:for(;L.have<L.nlen+L.ndist;){for(;he=(ee=L.lencode[H&(1<<L.lenbits)-1])>>>16&255,Ae=65535&ee,!((De=ee>>>24)<=X);){if(Q===0)break e;Q--,H+=$[G++]<<X,X+=8}if(Ae<16)H>>>=De,X-=De,L.lens[L.have++]=Ae;else{if(Ae===16){for(J=De+2;X<J;){if(Q===0)break e;Q--,H+=$[G++]<<X,X+=8}if(H>>>=De,X-=De,L.have===0){I.msg="invalid bit length repeat",L.mode=30;break}z=L.lens[L.have-1],ye=3+(3&H),H>>>=2,X-=2}else if(Ae===17){for(J=De+3;X<J;){if(Q===0)break e;Q--,H+=$[G++]<<X,X+=8}X-=De,z=0,ye=3+(7&(H>>>=De)),H>>>=3,X-=3}else{for(J=De+7;X<J;){if(Q===0)break e;Q--,H+=$[G++]<<X,X+=8}X-=De,z=0,ye=11+(127&(H>>>=De)),H>>>=7,X-=7}if(L.have+ye>L.nlen+L.ndist){I.msg="invalid bit length repeat",L.mode=30;break}for(;ye--;)L.lens[L.have++]=z}}if(L.mode===30)break;if(L.lens[256]===0){I.msg="invalid code -- missing end-of-block",L.mode=30;break}if(L.lenbits=9,ne={bits:L.lenbits},V=c(d,L.lens,0,L.nlen,L.lencode,0,L.work,ne),L.lenbits=ne.bits,V){I.msg="invalid literal/lengths set",L.mode=30;break}if(L.distbits=6,L.distcode=L.distdyn,ne={bits:L.distbits},V=c(f,L.lens,L.nlen,L.ndist,L.distcode,0,L.work,ne),L.distbits=ne.bits,V){I.msg="invalid distances set",L.mode=30;break}if(L.mode=20,W===6)break e;case 20:L.mode=21;case 21:if(6<=Q&&258<=se){I.next_out=Y,I.avail_out=se,I.next_in=G,I.avail_in=Q,L.hold=H,L.bits=X,l(I,ce),Y=I.next_out,q=I.output,se=I.avail_out,G=I.next_in,$=I.input,Q=I.avail_in,H=L.hold,X=L.bits,L.mode===12&&(L.back=-1);break}for(L.back=0;he=(ee=L.lencode[H&(1<<L.lenbits)-1])>>>16&255,Ae=65535&ee,!((De=ee>>>24)<=X);){if(Q===0)break e;Q--,H+=$[G++]<<X,X+=8}if(he&&(240&he)==0){for(Be=De,le=he,ut=Ae;he=(ee=L.lencode[ut+((H&(1<<Be+le)-1)>>Be)])>>>16&255,Ae=65535&ee,!(Be+(De=ee>>>24)<=X);){if(Q===0)break e;Q--,H+=$[G++]<<X,X+=8}H>>>=Be,X-=Be,L.back+=Be}if(H>>>=De,X-=De,L.back+=De,L.length=Ae,he===0){L.mode=26;break}if(32&he){L.back=-1,L.mode=12;break}if(64&he){I.msg="invalid literal/length code",L.mode=30;break}L.extra=15&he,L.mode=22;case 22:if(L.extra){for(J=L.extra;X<J;){if(Q===0)break e;Q--,H+=$[G++]<<X,X+=8}L.length+=H&(1<<L.extra)-1,H>>>=L.extra,X-=L.extra,L.back+=L.extra}L.was=L.length,L.mode=23;case 23:for(;he=(ee=L.distcode[H&(1<<L.distbits)-1])>>>16&255,Ae=65535&ee,!((De=ee>>>24)<=X);){if(Q===0)break e;Q--,H+=$[G++]<<X,X+=8}if((240&he)==0){for(Be=De,le=he,ut=Ae;he=(ee=L.distcode[ut+((H&(1<<Be+le)-1)>>Be)])>>>16&255,Ae=65535&ee,!(Be+(De=ee>>>24)<=X);){if(Q===0)break e;Q--,H+=$[G++]<<X,X+=8}H>>>=Be,X-=Be,L.back+=Be}if(H>>>=De,X-=De,L.back+=De,64&he){I.msg="invalid distance code",L.mode=30;break}L.offset=Ae,L.extra=15&he,L.mode=24;case 24:if(L.extra){for(J=L.extra;X<J;){if(Q===0)break e;Q--,H+=$[G++]<<X,X+=8}L.offset+=H&(1<<L.extra)-1,H>>>=L.extra,X-=L.extra,L.back+=L.extra}if(L.offset>L.dmax){I.msg="invalid distance too far back",L.mode=30;break}L.mode=25;case 25:if(se===0)break e;if(ye=ce-se,L.offset>ye){if((ye=L.offset-ye)>L.whave&&L.sane){I.msg="invalid distance too far back",L.mode=30;break}me=ye>L.wnext?(ye-=L.wnext,L.wsize-ye):L.wnext-ye,ye>L.length&&(ye=L.length),be=L.window}else be=q,me=Y-L.offset,ye=L.length;for(se<ye&&(ye=se),se-=ye,L.length-=ye;q[Y++]=be[me++],--ye;);L.length===0&&(L.mode=21);break;case 26:if(se===0)break e;q[Y++]=L.length,se--,L.mode=21;break;case 27:if(L.wrap){for(;X<32;){if(Q===0)break e;Q--,H|=$[G++]<<X,X+=8}if(ce-=se,I.total_out+=ce,L.total+=ce,ce&&(I.adler=L.check=L.flags?o(L.check,q,ce,Y-ce):s(L.check,q,ce,Y-ce)),ce=se,(L.flags?H:v(H))!==L.check){I.msg="incorrect data check",L.mode=30;break}X=H=0}L.mode=28;case 28:if(L.wrap&&L.flags){for(;X<32;){if(Q===0)break e;Q--,H+=$[G++]<<X,X+=8}if(H!==(4294967295&L.total)){I.msg="incorrect length check",L.mode=30;break}X=H=0}L.mode=29;case 29:V=1;break e;case 30:V=-3;break e;case 31:return-4;case 32:default:return m}return I.next_out=Y,I.avail_out=se,I.next_in=G,I.avail_in=Q,L.hold=H,L.bits=X,(L.wsize||ce!==I.avail_out&&L.mode<30&&(L.mode<27||W!==4))&&B(I,I.output,I.next_out,ce-I.avail_out)?(L.mode=31,-4):(re-=I.avail_in,ce-=I.avail_out,I.total_in+=re,I.total_out+=ce,L.total+=ce,L.wrap&&ce&&(I.adler=L.check=L.flags?o(L.check,q,ce,I.next_out-ce):s(L.check,q,ce,I.next_out-ce)),I.data_type=L.bits+(L.last?64:0)+(L.mode===12?128:0)+(L.mode===20||L.mode===15?256:0),(re==0&&ce===0||W===4)&&V===p&&(V=-5),V)},r.inflateEnd=function(I){if(!I||!I.state)return m;var W=I.state;return W.window&&(W.window=null),I.state=null,p},r.inflateGetHeader=function(I,W){var L;return I&&I.state?(2&(L=I.state).wrap)==0?m:((L.head=W).done=!1,p):m},r.inflateSetDictionary=function(I,W){var L,$=W.length;return I&&I.state?(L=I.state).wrap!==0&&L.mode!==11?m:L.mode===11&&s(1,W,$,0)!==L.check?-3:B(I,W,$,$)?(L.mode=31,-4):(L.havedict=1,p):m},r.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./inffast":48,"./inftrees":50}],50:[function(n,i,r){var a=n("../utils/common"),s=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],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,p,m,y,b,x,v){var M,w,E,T,P,R,U,N,O,B=v.bits,I=0,W=0,L=0,$=0,q=0,G=0,Y=0,Q=0,se=0,H=0,X=null,re=0,ce=new a.Buf16(16),ye=new a.Buf16(16),me=null,be=0;for(I=0;I<=15;I++)ce[I]=0;for(W=0;W<m;W++)ce[f[p+W]]++;for(q=B,$=15;1<=$&&ce[$]===0;$--);if($<q&&(q=$),$===0)return y[b++]=20971520,y[b++]=20971520,v.bits=1,0;for(L=1;L<$&&ce[L]===0;L++);for(q<L&&(q=L),I=Q=1;I<=15;I++)if(Q<<=1,(Q-=ce[I])<0)return-1;if(0<Q&&(d===0||$!==1))return-1;for(ye[1]=0,I=1;I<15;I++)ye[I+1]=ye[I]+ce[I];for(W=0;W<m;W++)f[p+W]!==0&&(x[ye[f[p+W]]++]=W);if(R=d===0?(X=me=x,19):d===1?(X=s,re-=257,me=o,be-=257,256):(X=l,me=c,-1),I=L,P=b,Y=W=H=0,E=-1,T=(se=1<<(G=q))-1,d===1&&852<se||d===2&&592<se)return 1;for(;;){for(U=I-Y,O=x[W]<R?(N=0,x[W]):x[W]>R?(N=me[be+x[W]],X[re+x[W]]):(N=96,0),M=1<<I-Y,L=w=1<<G;y[P+(H>>Y)+(w-=M)]=U<<24|N<<16|O|0,w!==0;);for(M=1<<I-1;H&M;)M>>=1;if(M!==0?(H&=M-1,H+=M):H=0,W++,--ce[I]==0){if(I===$)break;I=f[p+x[W]]}if(q<I&&(H&T)!==E){for(Y===0&&(Y=q),P+=L,Q=1<<(G=I-Y);G+Y<$&&!((Q-=ce[G+Y])<=0);)G++,Q<<=1;if(se+=1<<G,d===1&&852<se||d===2&&592<se)return 1;y[E=H&T]=q<<24|G<<16|P-b|0}}return H!==0&&(y[P+H]=I-Y<<24|64<<16|0),v.bits=q,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 ae=ee.length;0<=--ae;)ee[ae]=0}var c=0,d=29,f=256,p=f+1+d,m=30,y=19,b=2*p+1,x=15,v=16,M=7,w=256,E=16,T=17,P=18,R=[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],O=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],B=new Array(2*(p+2));l(B);var I=new Array(2*m);l(I);var W=new Array(512);l(W);var L=new Array(256);l(L);var $=new Array(d);l($);var q,G,Y,Q=new Array(m);function se(ee,ae,ie,we,ve){this.static_tree=ee,this.extra_bits=ae,this.extra_base=ie,this.elems=we,this.max_length=ve,this.has_stree=ee&&ee.length}function H(ee,ae){this.dyn_tree=ee,this.max_code=0,this.stat_desc=ae}function X(ee){return ee<256?W[ee]:W[256+(ee>>>7)]}function re(ee,ae){ee.pending_buf[ee.pending++]=255&ae,ee.pending_buf[ee.pending++]=ae>>>8&255}function ce(ee,ae,ie){ee.bi_valid>v-ie?(ee.bi_buf|=ae<<ee.bi_valid&65535,re(ee,ee.bi_buf),ee.bi_buf=ae>>v-ee.bi_valid,ee.bi_valid+=ie-v):(ee.bi_buf|=ae<<ee.bi_valid&65535,ee.bi_valid+=ie)}function ye(ee,ae,ie){ce(ee,ie[2*ae],ie[2*ae+1])}function me(ee,ae){for(var ie=0;ie|=1&ee,ee>>>=1,ie<<=1,0<--ae;);return ie>>>1}function be(ee,ae,ie){var we,ve,F=new Array(x+1),k=0;for(we=1;we<=x;we++)F[we]=k=k+ie[we-1]<<1;for(ve=0;ve<=ae;ve++){var K=ee[2*ve+1];K!==0&&(ee[2*ve]=me(F[K]++,K))}}function De(ee){var ae;for(ae=0;ae<p;ae++)ee.dyn_ltree[2*ae]=0;for(ae=0;ae<m;ae++)ee.dyn_dtree[2*ae]=0;for(ae=0;ae<y;ae++)ee.bl_tree[2*ae]=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?re(ee,ee.bi_buf):0<ee.bi_valid&&(ee.pending_buf[ee.pending++]=ee.bi_buf),ee.bi_buf=0,ee.bi_valid=0}function Ae(ee,ae,ie,we){var ve=2*ae,F=2*ie;return ee[ve]<ee[F]||ee[ve]===ee[F]&&we[ae]<=we[ie]}function Be(ee,ae,ie){for(var we=ee.heap[ie],ve=ie<<1;ve<=ee.heap_len&&(ve<ee.heap_len&&Ae(ae,ee.heap[ve+1],ee.heap[ve],ee.depth)&&ve++,!Ae(ae,we,ee.heap[ve],ee.depth));)ee.heap[ie]=ee.heap[ve],ie=ve,ve<<=1;ee.heap[ie]=we}function le(ee,ae,ie){var we,ve,F,k,K=0;if(ee.last_lit!==0)for(;we=ee.pending_buf[ee.d_buf+2*K]<<8|ee.pending_buf[ee.d_buf+2*K+1],ve=ee.pending_buf[ee.l_buf+K],K++,we===0?ye(ee,ve,ae):(ye(ee,(F=L[ve])+f+1,ae),(k=R[F])!==0&&ce(ee,ve-=$[F],k),ye(ee,F=X(--we),ie),(k=U[F])!==0&&ce(ee,we-=Q[F],k)),K<ee.last_lit;);ye(ee,w,ae)}function ut(ee,ae){var ie,we,ve,F=ae.dyn_tree,k=ae.stat_desc.static_tree,K=ae.stat_desc.has_stree,pe=ae.stat_desc.elems,xe=-1;for(ee.heap_len=0,ee.heap_max=b,ie=0;ie<pe;ie++)F[2*ie]!==0?(ee.heap[++ee.heap_len]=xe=ie,ee.depth[ie]=0):F[2*ie+1]=0;for(;ee.heap_len<2;)F[2*(ve=ee.heap[++ee.heap_len]=xe<2?++xe:0)]=1,ee.depth[ve]=0,ee.opt_len--,K&&(ee.static_len-=k[2*ve+1]);for(ae.max_code=xe,ie=ee.heap_len>>1;1<=ie;ie--)Be(ee,F,ie);for(ve=pe;ie=ee.heap[1],ee.heap[1]=ee.heap[ee.heap_len--],Be(ee,F,1),we=ee.heap[1],ee.heap[--ee.heap_max]=ie,ee.heap[--ee.heap_max]=we,F[2*ve]=F[2*ie]+F[2*we],ee.depth[ve]=(ee.depth[ie]>=ee.depth[we]?ee.depth[ie]:ee.depth[we])+1,F[2*ie+1]=F[2*we+1]=ve,ee.heap[1]=ve++,Be(ee,F,1),2<=ee.heap_len;);ee.heap[--ee.heap_max]=ee.heap[1],(function(fe,Ke){var ke,$e,rt,Ue,Pe,dt,et=Ke.dyn_tree,Qe=Ke.max_code,st=Ke.stat_desc.static_tree,ue=Ke.stat_desc.has_stree,tt=Ke.stat_desc.extra_bits,de=Ke.stat_desc.extra_base,Le=Ke.stat_desc.max_length,Ee=0;for(Ue=0;Ue<=x;Ue++)fe.bl_count[Ue]=0;for(et[2*fe.heap[fe.heap_max]+1]=0,ke=fe.heap_max+1;ke<b;ke++)Le<(Ue=et[2*et[2*($e=fe.heap[ke])+1]+1]+1)&&(Ue=Le,Ee++),et[2*$e+1]=Ue,Qe<$e||(fe.bl_count[Ue]++,Pe=0,de<=$e&&(Pe=tt[$e-de]),dt=et[2*$e],fe.opt_len+=dt*(Ue+Pe),ue&&(fe.static_len+=dt*(st[2*$e+1]+Pe)));if(Ee!==0){do{for(Ue=Le-1;fe.bl_count[Ue]===0;)Ue--;fe.bl_count[Ue]--,fe.bl_count[Ue+1]+=2,fe.bl_count[Le]--,Ee-=2}while(0<Ee);for(Ue=Le;Ue!==0;Ue--)for($e=fe.bl_count[Ue];$e!==0;)Qe<(rt=fe.heap[--ke])||(et[2*rt+1]!==Ue&&(fe.opt_len+=(Ue-et[2*rt+1])*et[2*rt],et[2*rt+1]=Ue),$e--)}})(ee,ae),be(F,xe,ee.bl_count)}function z(ee,ae,ie){var we,ve,F=-1,k=ae[1],K=0,pe=7,xe=4;for(k===0&&(pe=138,xe=3),ae[2*(ie+1)+1]=65535,we=0;we<=ie;we++)ve=k,k=ae[2*(we+1)+1],++K<pe&&ve===k||(K<xe?ee.bl_tree[2*ve]+=K:ve!==0?(ve!==F&&ee.bl_tree[2*ve]++,ee.bl_tree[2*E]++):K<=10?ee.bl_tree[2*T]++:ee.bl_tree[2*P]++,F=ve,xe=(K=0)===k?(pe=138,3):ve===k?(pe=6,3):(pe=7,4))}function V(ee,ae,ie){var we,ve,F=-1,k=ae[1],K=0,pe=7,xe=4;for(k===0&&(pe=138,xe=3),we=0;we<=ie;we++)if(ve=k,k=ae[2*(we+1)+1],!(++K<pe&&ve===k)){if(K<xe)for(;ye(ee,ve,ee.bl_tree),--K!=0;);else ve!==0?(ve!==F&&(ye(ee,ve,ee.bl_tree),K--),ye(ee,E,ee.bl_tree),ce(ee,K-3,2)):K<=10?(ye(ee,T,ee.bl_tree),ce(ee,K-3,3)):(ye(ee,P,ee.bl_tree),ce(ee,K-11,7));F=ve,xe=(K=0)===k?(pe=138,3):ve===k?(pe=6,3):(pe=7,4)}}l(Q);var ne=!1;function J(ee,ae,ie,we){ce(ee,(c<<1)+(we?1:0),3),(function(ve,F,k,K){he(ve),re(ve,k),re(ve,~k),a.arraySet(ve.pending_buf,ve.window,F,k,ve.pending),ve.pending+=k})(ee,ae,ie)}r._tr_init=function(ee){ne||((function(){var ae,ie,we,ve,F,k=new Array(x+1);for(ve=we=0;ve<d-1;ve++)for($[ve]=we,ae=0;ae<1<<R[ve];ae++)L[we++]=ve;for(L[we-1]=ve,ve=F=0;ve<16;ve++)for(Q[ve]=F,ae=0;ae<1<<U[ve];ae++)W[F++]=ve;for(F>>=7;ve<m;ve++)for(Q[ve]=F<<7,ae=0;ae<1<<U[ve]-7;ae++)W[256+F++]=ve;for(ie=0;ie<=x;ie++)k[ie]=0;for(ae=0;ae<=143;)B[2*ae+1]=8,ae++,k[8]++;for(;ae<=255;)B[2*ae+1]=9,ae++,k[9]++;for(;ae<=279;)B[2*ae+1]=7,ae++,k[7]++;for(;ae<=287;)B[2*ae+1]=8,ae++,k[8]++;for(be(B,p+1,k),ae=0;ae<m;ae++)I[2*ae+1]=5,I[2*ae]=me(ae,5);q=new se(B,R,f+1,p,x),G=new se(I,U,0,m,x),Y=new se(new Array(0),N,0,y,M)})(),ne=!0),ee.l_desc=new H(ee.dyn_ltree,q),ee.d_desc=new H(ee.dyn_dtree,G),ee.bl_desc=new H(ee.bl_tree,Y),ee.bi_buf=0,ee.bi_valid=0,De(ee)},r._tr_stored_block=J,r._tr_flush_block=function(ee,ae,ie,we){var ve,F,k=0;0<ee.level?(ee.strm.data_type===2&&(ee.strm.data_type=(function(K){var pe,xe=4093624447;for(pe=0;pe<=31;pe++,xe>>>=1)if(1&xe&&K.dyn_ltree[2*pe]!==0)return s;if(K.dyn_ltree[18]!==0||K.dyn_ltree[20]!==0||K.dyn_ltree[26]!==0)return o;for(pe=32;pe<f;pe++)if(K.dyn_ltree[2*pe]!==0)return o;return s})(ee)),ut(ee,ee.l_desc),ut(ee,ee.d_desc),k=(function(K){var pe;for(z(K,K.dyn_ltree,K.l_desc.max_code),z(K,K.dyn_dtree,K.d_desc.max_code),ut(K,K.bl_desc),pe=y-1;3<=pe&&K.bl_tree[2*O[pe]+1]===0;pe--);return K.opt_len+=3*(pe+1)+5+5+4,pe})(ee),ve=ee.opt_len+3+7>>>3,(F=ee.static_len+3+7>>>3)<=ve&&(ve=F)):ve=F=ie+5,ie+4<=ve&&ae!==-1?J(ee,ae,ie,we):ee.strategy===4||F===ve?(ce(ee,2+(we?1:0),3),le(ee,B,I)):(ce(ee,4+(we?1:0),3),(function(K,pe,xe,fe){var Ke;for(ce(K,pe-257,5),ce(K,xe-1,5),ce(K,fe-4,4),Ke=0;Ke<fe;Ke++)ce(K,K.bl_tree[2*O[Ke]+1],3);V(K,K.dyn_ltree,pe-1),V(K,K.dyn_dtree,xe-1)})(ee,ee.l_desc.max_code+1,ee.d_desc.max_code+1,k+1),le(ee,ee.dyn_ltree,ee.dyn_dtree)),De(ee),we&&he(ee)},r._tr_tally=function(ee,ae,ie){return ee.pending_buf[ee.d_buf+2*ee.last_lit]=ae>>>8&255,ee.pending_buf[ee.d_buf+2*ee.last_lit+1]=255&ae,ee.pending_buf[ee.l_buf+ee.last_lit]=255&ie,ee.last_lit++,ae===0?ee.dyn_ltree[2*ie]++:(ee.matches++,ae--,ee.dyn_ltree[2*(L[ie]+f+1)]++,ee.dyn_dtree[2*X(ae)]++),ee.last_lit===ee.lit_bufsize-1},r._tr_align=function(ee){ce(ee,2,3),ye(ee,w,B),(function(ae){ae.bi_valid===16?(re(ae,ae.bi_buf),ae.bi_buf=0,ae.bi_valid=0):8<=ae.bi_valid&&(ae.pending_buf[ae.pending++]=255&ae.bi_buf,ae.bi_buf>>=8,ae.bi_valid-=8)})(ee)}},{"../utils/common":41}],53:[function(n,i,r){i.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(n,i,r){(function(a){(function(s,o){if(!s.setImmediate){var l,c,d,f,p=1,m={},y=!1,b=s.document,x=Object.getPrototypeOf&&Object.getPrototypeOf(s);x=x&&x.setTimeout?x:s,l={}.toString.call(s.process)==="[object process]"?function(E){process.nextTick(function(){M(E)})}:(function(){if(s.postMessage&&!s.importScripts){var E=!0,T=s.onmessage;return s.onmessage=function(){E=!1},s.postMessage("","*"),s.onmessage=T,E}})()?(f="setImmediate$"+Math.random()+"$",s.addEventListener?s.addEventListener("message",w,!1):s.attachEvent("onmessage",w),function(E){s.postMessage(f+E,"*")}):s.MessageChannel?((d=new MessageChannel).port1.onmessage=function(E){M(E.data)},function(E){d.port2.postMessage(E)}):b&&"onreadystatechange"in b.createElement("script")?(c=b.documentElement,function(E){var T=b.createElement("script");T.onreadystatechange=function(){M(E),T.onreadystatechange=null,c.removeChild(T),T=null},c.appendChild(T)}):function(E){setTimeout(M,0,E)},x.setImmediate=function(E){typeof E!="function"&&(E=new Function(""+E));for(var T=new Array(arguments.length-1),P=0;P<T.length;P++)T[P]=arguments[P+1];var R={callback:E,args:T};return m[p]=R,l(p),p++},x.clearImmediate=v}function v(E){delete m[E]}function M(E){if(y)setTimeout(M,0,E);else{var T=m[E];if(T){y=!0;try{(function(P){var R=P.callback,U=P.args;switch(U.length){case 0:R();break;case 1:R(U[0]);break;case 2:R(U[0],U[1]);break;case 3:R(U[0],U[1],U[2]);break;default:R.apply(o,U)}})(T)}finally{v(E),y=!1}}}}function w(E){E.source===s&&typeof E.data=="string"&&E.data.indexOf(f)===0&&M(+E.data.slice(f.length))}})(typeof self>"u"?a===void 0?this:a:self)}).call(this,typeof Yx<"u"?Yx:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})(gA)),gA.exports}var ufe=cfe();const dfe=Vs(ufe);function ffe(t){const e=new Gi;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 AF=ffe;async function TF(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 hfe(t){const e=await dfe.loadAsync(t),n=new Map,i=[],r=new DOMParser;async function a(d){const f=d.startsWith("/")?d.slice(1):d,p=e.files[f];if(!p)return null;const m=await p.async("string");return r.parseFromString(m,"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 p=await TF(f);p.length>0&&n.set("1",{id:"1",meshes:p})}}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],p=f.getAttribute("id");if(!p)continue;const m=[],y=f.getElementsByTagName("mesh");for(let x=0;x<y.length;x++){const v=y[x],M=[],w=[],E=v.getElementsByTagName("vertex");for(let P=0;P<E.length;P++){const R=E[P];M.push(parseFloat(R.getAttribute("x")||"0"),parseFloat(R.getAttribute("y")||"0"),parseFloat(R.getAttribute("z")||"0"))}const T=v.getElementsByTagName("triangle");for(let P=0;P<T.length;P++){const R=T[P];w.push(parseInt(R.getAttribute("v1")||"0"),parseInt(R.getAttribute("v2")||"0"),parseInt(R.getAttribute("v3")||"0"))}M.length>0&&w.length>0&&m.push({vertices:M,triangles:w})}const b=f.getElementsByTagName("component");for(let x=0;x<b.length;x++){const v=b[x],M=v.getAttribute("p:path")||v.getAttributeNS("http://schemas.microsoft.com/3dmanufacturing/production/2015/06","path");if(M){const w=await a(M);if(w){const E=await TF(w),T=v.getAttribute("transform"),P=AF(T);for(const R of E)if(T){const U=[];for(let N=0;N<R.vertices.length;N+=3){const O=new Ge(R.vertices[N],R.vertices[N+1],R.vertices[N+2]);O.applyMatrix4(P),U.push(O.x,O.y,O.z)}m.push({vertices:U,triangles:R.triangles})}else m.push(R)}}}m.length>0&&n.set(p,{id:p,meshes:m})}const c=o.getElementsByTagName("build");if(c.length>0){const d=c[0].getElementsByTagName("item");for(let f=0;f<d.length;f++){const p=d[f],m=p.getAttribute("objectid");if(!m)continue;const y=AF(p.getAttribute("transform"));i.push({objectId:m,transform:y})}}return{objects:n,buildItems:i}}function CF(t){const e=new Yo,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 Is(n,3)),e.setIndex(t.triangles),e.computeVertexNormals(),e}function pfe({url:t,buildVolume:e={x:256,y:256,z:256},className:n=""}){const i=C.useRef(null),r=C.useRef(null),a=C.useRef(null),s=C.useRef(null),o=C.useRef(null),[l,c]=C.useState(!0),[d,f]=C.useState(null);C.useEffect(()=>{if(!i.current)return;const y=i.current,b=y.clientWidth,x=y.clientHeight,v=new $se;v.background=new fn(1710618),a.current=v;const M=new Rs(45,b/x,.1,1e4);M.position.set(150,150,150),s.current=M;const w=new qde({antialias:!0});w.setSize(b,x),w.setPixelRatio(window.devicePixelRatio),y.appendChild(w.domElement),r.current=w;const E=new Yde(M,w.domElement);E.enableDamping=!0,E.dampingFactor=.05,o.current=E;const T=new ioe(16777215,.6);v.add(T);const P=new K4(16777215,.8);P.position.set(100,100,100),v.add(P);const R=new K4(16777215,.4);R.position.set(-100,50,-100),v.add(R);const U=Math.max(e.x,e.y),N=Math.ceil(U/16),O=new aoe(U,N,4473924,3355443);v.add(O);const B=new qN(e.x,e.y),I=new GN({color:44610,transparent:!0,opacity:.15,side:Po}),W=new Bo(B,I);W.rotation.x=-Math.PI/2,W.position.y=-.5,v.add(W);let L;const $=()=>{L=requestAnimationFrame($),E.update(),w.render(v,M)};$(),fetch(t).then(G=>{if(!G.ok)throw new Error("Failed to load file");return G.arrayBuffer()}).then(hfe).then(({objects:G,buildItems:Y})=>{if(G.size===0)throw new Error("No meshes found in 3MF file");const Q=new Jse({color:44610,shininess:30,flatShading:!1}),se=new Pg,H=[];if(Y.length>0)for(const he of Y){const Ae=G.get(he.objectId);if(Ae)for(const Be of Ae.meshes){const le=[];for(let z=0;z<Be.vertices.length;z+=3){const V=new Ge(Be.vertices[z],Be.vertices[z+1],Be.vertices[z+2]);V.applyMatrix4(he.transform),le.push(V.x,V.y,V.z)}const ut=CF({vertices:le,triangles:Be.triangles});H.push(ut)}}else for(const he of G.values())for(const Ae of he.meshes){const Be=CF(Ae);H.push(Be)}if(H.length>0){const he=H.length===1?H[0]:lfe(H,!1);if(he){const Ae=new Bo(he,Q);se.add(Ae)}if(H.length>1)for(const Ae of H)Ae.dispose()}const X=new lf().setFromObject(se),re=X.getCenter(new Ge);se.position.y=-X.min.y,Y.length===0&&(se.position.x=-re.x,se.position.z=-re.z),v.add(se);const ce=new lf().setFromObject(se),ye=ce.getCenter(new Ge),me=ce.getSize(new Ge),De=Math.max(me.x,me.y,me.z)*1.8;M.position.set(ye.x+De*.7,ye.y+De*.5,ye.z+De*.7),E.target.copy(ye),E.update(),c(!1)}).catch(G=>{f(G.message),c(!1)});const q=()=>{if(!y)return;const G=y.clientWidth,Y=y.clientHeight;M.aspect=G/Y,M.updateProjectionMatrix(),w.setSize(G,Y)};return window.addEventListener("resize",q),()=>{window.removeEventListener("resize",q),cancelAnimationFrame(L),E.dispose(),w.dispose(),y.removeChild(w.domElement)}},[t,e]);const p=()=>{s.current&&o.current&&(s.current.position.set(150,150,150),o.current.target.set(0,50,0),o.current.update())},m=y=>{s.current&&s.current.position.multiplyScalar(y)};return S.jsxs("div",{className:`relative ${n}`,children:[S.jsx("div",{ref:i,className:"w-full h-full min-h-[400px]"}),l&&S.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-bambu-dark/80",children:S.jsx(ci,{className:"w-8 h-8 text-bambu-green animate-spin"})}),d&&S.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-bambu-dark/80",children:S.jsx("p",{className:"text-red-400",children:d})}),!l&&!d&&S.jsxs("div",{className:"absolute bottom-4 right-4 flex gap-2",children:[S.jsx(xt,{variant:"secondary",size:"sm",onClick:()=>m(.8),children:S.jsx(lae,{className:"w-4 h-4"})}),S.jsx(xt,{variant:"secondary",size:"sm",onClick:()=>m(1.25),children:S.jsx(uae,{className:"w-4 h-4"})}),S.jsx(xt,{variant:"secondary",size:"sm",onClick:p,children:S.jsx(fG,{className:"w-4 h-4"})})]})]})}const dS="159",_h={ROTATE:0,DOLLY:1,PAN:2},Sh={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},mfe=0,RF=1,gfe=2,i$=1,vfe=2,Rl=3,Pu=0,Da=1,Ol=2,_u=0,op=1,NF=2,PF=3,DF=4,xfe=5,Td=100,yfe=101,bfe=102,OF=103,LF=104,_fe=200,Sfe=201,wfe=202,Mfe=203,_R=204,SR=205,Efe=206,Afe=207,Tfe=208,Cfe=209,Rfe=210,Nfe=211,Pfe=212,Dfe=213,Ofe=214,Lfe=0,kfe=1,Ife=2,l_=3,Ufe=4,Ffe=5,zfe=6,Bfe=7,YN=0,jfe=1,Hfe=2,Su=0,Vfe=1,Gfe=2,$fe=3,Wfe=4,qfe=5,r$=300,Sp=301,wp=302,wR=303,MR=304,fS=306,ER=1e3,io=1001,AR=1002,Ur=1003,kF=1004,vA=1005,Ns=1006,Xfe=1007,y0=1008,wu=1009,Yfe=1010,Kfe=1011,KN=1012,a$=1013,pu=1014,zl=1015,b0=1016,s$=1017,o$=1018,Bd=1020,Zfe=1021,Ps=1023,Jfe=1024,Qfe=1025,jd=1026,Mp=1027,ehe=1028,l$=1029,the=1030,c$=1031,u$=1033,xA=33776,yA=33777,bA=33778,_A=33779,IF=35840,UF=35841,FF=35842,zF=35843,d$=36196,BF=37492,jF=37496,HF=37808,VF=37809,GF=37810,$F=37811,WF=37812,qF=37813,XF=37814,YF=37815,KF=37816,ZF=37817,JF=37818,QF=37819,ez=37820,tz=37821,SA=36492,nz=36494,iz=36495,nhe=36283,rz=36284,az=36285,sz=36286,f$=3e3,Hd=3001,ihe=3200,rhe=3201,h$=0,ahe=1,Ds="",Fr="srgb",ec="srgb-linear",ZN="display-p3",hS="display-p3-linear",c_="linear",Kn="srgb",u_="rec709",d_="p3",wh=7680,oz=519,she=512,ohe=513,lhe=514,p$=515,che=516,uhe=517,dhe=518,fhe=519,TR=35044,lz="300 es",CR=1035,Lo=2e3,_0=2001;class Af{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 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"];let cz=1234567;const jg=Math.PI/180,S0=180/Math.PI;function Wl(){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 zr(t,e,n){return Math.max(e,Math.min(n,t))}function JN(t,e){return(t%e+e)%e}function hhe(t,e,n,i,r){return i+(t-e)*(r-i)/(n-e)}function phe(t,e,n){return t!==e?(n-t)/(e-t):0}function Hg(t,e,n){return(1-n)*t+n*e}function mhe(t,e,n,i){return Hg(t,e,1-Math.exp(-n*i))}function ghe(t,e=1){return e-Math.abs(JN(t,e*2)-e)}function vhe(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e),t*t*(3-2*t))}function xhe(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e),t*t*t*(t*(t*6-15)+10))}function yhe(t,e){return t+Math.floor(Math.random()*(e-t+1))}function bhe(t,e){return t+Math.random()*(e-t)}function _he(t){return t*(.5-Math.random())}function She(t){t!==void 0&&(cz=t);let e=cz+=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 whe(t){return t*jg}function Mhe(t){return t*S0}function RR(t){return(t&t-1)===0&&t!==0}function Ehe(t){return Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))}function f_(t){return Math.pow(2,Math.floor(Math.log(t)/Math.LN2))}function Ahe(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),p=s((e-i)/2),m=a((i-e)/2),y=s((i-e)/2);switch(r){case"XYX":t.set(o*d,l*f,l*p,o*c);break;case"YZY":t.set(l*p,o*d,l*f,o*c);break;case"ZXZ":t.set(l*f,l*p,o*d,o*c);break;case"XZX":t.set(o*d,l*y,l*m,o*c);break;case"YXY":t.set(l*m,o*d,l*y,o*c);break;case"ZYZ":t.set(l*y,l*m,o*d,o*c);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}}function Do(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 Ln(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 m$={DEG2RAD:jg,RAD2DEG:S0,generateUUID:Wl,clamp:zr,euclideanModulo:JN,mapLinear:hhe,inverseLerp:phe,lerp:Hg,damp:mhe,pingpong:ghe,smoothstep:vhe,smootherstep:xhe,randInt:yhe,randFloat:bhe,randFloatSpread:_he,seededRandom:She,degToRad:whe,radToDeg:Mhe,isPowerOfTwo:RR,ceilPowerOfTwo:Ehe,floorPowerOfTwo:f_,setQuaternionFromProperEuler:Ahe,normalize:Ln,denormalize:Do};class Vt{constructor(e=0,n=0){Vt.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(zr(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 an{constructor(e,n,i,r,a,s,o,l,c){an.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],p=i[2],m=i[5],y=i[8],b=r[0],x=r[3],v=r[6],M=r[1],w=r[4],E=r[7],T=r[2],P=r[5],R=r[8];return a[0]=s*b+o*M+l*T,a[3]=s*x+o*w+l*P,a[6]=s*v+o*E+l*R,a[1]=c*b+d*M+f*T,a[4]=c*x+d*w+f*P,a[7]=c*v+d*E+f*R,a[2]=p*b+m*M+y*T,a[5]=p*x+m*w+y*P,a[8]=p*v+m*E+y*R,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,p=o*l-d*a,m=c*a-s*l,y=n*f+i*p+r*m;if(y===0)return this.set(0,0,0,0,0,0,0,0,0);const b=1/y;return e[0]=f*b,e[1]=(r*c-d*i)*b,e[2]=(o*i-r*s)*b,e[3]=p*b,e[4]=(d*n-r*l)*b,e[5]=(r*a-o*n)*b,e[6]=m*b,e[7]=(i*l-c*n)*b,e[8]=(s*n-i*a)*b,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(wA.makeScale(e,n)),this}rotate(e){return this.premultiply(wA.makeRotation(-e)),this}translate(e,n){return this.premultiply(wA.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 wA=new an;function g$(t){for(let e=t.length-1;e>=0;--e)if(t[e]>=65535)return!0;return!1}function h_(t){return document.createElementNS("http://www.w3.org/1999/xhtml",t)}function The(){const t=h_("canvas");return t.style.display="block",t}const uz={};function Vg(t){t in uz||(uz[t]=!0,console.warn(t))}const dz=new an().set(.8224621,.177538,0,.0331941,.9668058,0,.0170827,.0723974,.9105199),fz=new an().set(1.2249401,-.2249404,0,-.0420569,1.0420571,0,-.0196376,-.0786361,1.0982735),Sy={[ec]:{transfer:c_,primaries:u_,toReference:t=>t,fromReference:t=>t},[Fr]:{transfer:Kn,primaries:u_,toReference:t=>t.convertSRGBToLinear(),fromReference:t=>t.convertLinearToSRGB()},[hS]:{transfer:c_,primaries:d_,toReference:t=>t.applyMatrix3(fz),fromReference:t=>t.applyMatrix3(dz)},[ZN]:{transfer:Kn,primaries:d_,toReference:t=>t.convertSRGBToLinear().applyMatrix3(fz),fromReference:t=>t.applyMatrix3(dz).convertLinearToSRGB()}},Che=new Set([ec,hS]),kn={enabled:!0,_workingColorSpace:ec,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(!Che.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=Sy[e].toReference,r=Sy[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 Sy[t].primaries},getTransfer:function(t){return t===Ds?c_:Sy[t].transfer}};function lp(t){return t<.04045?t*.0773993808:Math.pow(t*.9478672986+.0521327014,2.4)}function MA(t){return t<.0031308?t*12.92:1.055*Math.pow(t,.41666)-.055}let Mh;class v${static getDataURL(e){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let n;if(e instanceof HTMLCanvasElement)n=e;else{Mh===void 0&&(Mh=h_("canvas")),Mh.width=e.width,Mh.height=e.height;const i=Mh.getContext("2d");e instanceof ImageData?i.putImageData(e,0,0):i.drawImage(e,0,0,e.width,e.height),n=Mh}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=h_("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]=lp(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(lp(n[i]/255)*255):n[i]=lp(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 Rhe=0;class x${constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:Rhe++}),this.uuid=Wl(),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(EA(r[s].image)):a.push(EA(r[s]))}else a=EA(r);i.url=a}return n||(e.images[this.uuid]=i),i}}function EA(t){return typeof HTMLImageElement<"u"&&t instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&t instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&t instanceof ImageBitmap?v$.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 Nhe=0;class Oa extends Af{constructor(e=Oa.DEFAULT_IMAGE,n=Oa.DEFAULT_MAPPING,i=io,r=io,a=Ns,s=y0,o=Ps,l=wu,c=Oa.DEFAULT_ANISOTROPY,d=Ds){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:Nhe++}),this.uuid=Wl(),this.name="",this.source=new x$(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 Vt(0,0),this.repeat=new Vt(1,1),this.center=new Vt(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new an,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,typeof d=="string"?this.colorSpace=d:(Vg("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace=d===Hd?Fr:Ds),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!==r$)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case ER:e.x=e.x-Math.floor(e.x);break;case io:e.x=e.x<0?0:1;break;case AR: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 ER:e.y=e.y-Math.floor(e.y);break;case io:e.y=e.y<0?0:1;break;case AR: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 Vg("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace===Fr?Hd:f$}set encoding(e){Vg("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace=e===Hd?Fr:Ds}}Oa.DEFAULT_IMAGE=null;Oa.DEFAULT_MAPPING=r$;Oa.DEFAULT_ANISOTROPY=1;class Un{constructor(e=0,n=0,i=0,r=1){Un.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],p=l[1],m=l[5],y=l[9],b=l[2],x=l[6],v=l[10];if(Math.abs(d-p)<.01&&Math.abs(f-b)<.01&&Math.abs(y-x)<.01){if(Math.abs(d+p)<.1&&Math.abs(f+b)<.1&&Math.abs(y+x)<.1&&Math.abs(c+m+v-3)<.1)return this.set(1,0,0,0),this;n=Math.PI;const w=(c+1)/2,E=(m+1)/2,T=(v+1)/2,P=(d+p)/4,R=(f+b)/4,U=(y+x)/4;return w>E&&w>T?w<.01?(i=0,r=.707106781,a=.707106781):(i=Math.sqrt(w),r=P/i,a=R/i):E>T?E<.01?(i=.707106781,r=0,a=.707106781):(r=Math.sqrt(E),i=P/r,a=U/r):T<.01?(i=.707106781,r=.707106781,a=0):(a=Math.sqrt(T),i=R/a,r=U/a),this.set(i,r,a,n),this}let M=Math.sqrt((x-y)*(x-y)+(f-b)*(f-b)+(p-d)*(p-d));return Math.abs(M)<.001&&(M=1),this.x=(x-y)/M,this.y=(f-b)/M,this.z=(p-d)/M,this.w=Math.acos((c+m+v-1)/2),this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,n){return this.x=Math.max(e.x,Math.min(n.x,this.x)),this.y=Math.max(e.y,Math.min(n.y,this.y)),this.z=Math.max(e.z,Math.min(n.z,this.z)),this.w=Math.max(e.w,Math.min(n.w,this.w)),this}clampScalar(e,n){return this.x=Math.max(e,Math.min(n,this.x)),this.y=Math.max(e,Math.min(n,this.y)),this.z=Math.max(e,Math.min(n,this.z)),this.w=Math.max(e,Math.min(n,this.w)),this}clampLength(e,n){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(n,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,n){return this.x+=(e.x-this.x)*n,this.y+=(e.y-this.y)*n,this.z+=(e.z-this.z)*n,this.w+=(e.w-this.w)*n,this}lerpVectors(e,n,i){return this.x=e.x+(n.x-e.x)*i,this.y=e.y+(n.y-e.y)*i,this.z=e.z+(n.z-e.z)*i,this.w=e.w+(n.w-e.w)*i,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,n=0){return this.x=e[n],this.y=e[n+1],this.z=e[n+2],this.w=e[n+3],this}toArray(e=[],n=0){return e[n]=this.x,e[n+1]=this.y,e[n+2]=this.z,e[n+3]=this.w,e}fromBufferAttribute(e,n){return this.x=e.getX(n),this.y=e.getY(n),this.z=e.getZ(n),this.w=e.getW(n),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class Phe extends Af{constructor(e=1,n=1,i={}){super(),this.isRenderTarget=!0,this.width=e,this.height=n,this.depth=1,this.scissor=new Un(0,0,e,n),this.scissorTest=!1,this.viewport=new Un(0,0,e,n);const r={width:e,height:n,depth:1};i.encoding!==void 0&&(Vg("THREE.WebGLRenderTarget: option.encoding has been replaced by option.colorSpace."),i.colorSpace=i.encoding===Hd?Fr:Ds),i=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:Ns,depthBuffer:!0,stencilBuffer:!1,depthTexture:null,samples:0},i),this.texture=new Oa(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 x$(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 cf extends Phe{constructor(e=1,n=1,i={}){super(e,n,i),this.isWebGLRenderTarget=!0}}class y$ extends Oa{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=Ur,this.minFilter=Ur,this.wrapR=io,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class Dhe extends Oa{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=Ur,this.minFilter=Ur,this.wrapR=io,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class uf{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 p=a[s+0],m=a[s+1],y=a[s+2],b=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]=p,e[n+1]=m,e[n+2]=y,e[n+3]=b;return}if(f!==b||l!==p||c!==m||d!==y){let x=1-o;const v=l*p+c*m+d*y+f*b,M=v>=0?1:-1,w=1-v*v;if(w>Number.EPSILON){const T=Math.sqrt(w),P=Math.atan2(T,v*M);x=Math.sin(x*P)/T,o=Math.sin(o*P)/T}const E=o*M;if(l=l*x+p*E,c=c*x+m*E,d=d*x+y*E,f=f*x+b*E,x===1-o){const T=1/Math.sqrt(l*l+c*c+d*d+f*f);l*=T,c*=T,d*=T,f*=T}}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],p=a[s+1],m=a[s+2],y=a[s+3];return e[n]=o*y+d*f+l*m-c*p,e[n+1]=l*y+d*p+c*f-o*m,e[n+2]=c*y+d*m+o*p-l*f,e[n+3]=d*y-o*f-l*p-c*m,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,n,i,r){return this._x=e,this._y=n,this._z=i,this._w=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,n){const i=e._x,r=e._y,a=e._z,s=e._order,o=Math.cos,l=Math.sin,c=o(i/2),d=o(r/2),f=o(a/2),p=l(i/2),m=l(r/2),y=l(a/2);switch(s){case"XYZ":this._x=p*d*f+c*m*y,this._y=c*m*f-p*d*y,this._z=c*d*y+p*m*f,this._w=c*d*f-p*m*y;break;case"YXZ":this._x=p*d*f+c*m*y,this._y=c*m*f-p*d*y,this._z=c*d*y-p*m*f,this._w=c*d*f+p*m*y;break;case"ZXY":this._x=p*d*f-c*m*y,this._y=c*m*f+p*d*y,this._z=c*d*y+p*m*f,this._w=c*d*f-p*m*y;break;case"ZYX":this._x=p*d*f-c*m*y,this._y=c*m*f+p*d*y,this._z=c*d*y-p*m*f,this._w=c*d*f+p*m*y;break;case"YZX":this._x=p*d*f+c*m*y,this._y=c*m*f+p*d*y,this._z=c*d*y-p*m*f,this._w=c*d*f-p*m*y;break;case"XZY":this._x=p*d*f-c*m*y,this._y=c*m*f-p*d*y,this._z=c*d*y+p*m*f,this._w=c*d*f+p*m*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],p=i+o+f;if(p>0){const m=.5/Math.sqrt(p+1);this._w=.25/m,this._x=(d-l)*m,this._y=(a-c)*m,this._z=(s-r)*m}else if(i>o&&i>f){const m=2*Math.sqrt(1+i-o-f);this._w=(d-l)/m,this._x=.25*m,this._y=(r+s)/m,this._z=(a+c)/m}else if(o>f){const m=2*Math.sqrt(1+o-i-f);this._w=(a-c)/m,this._x=(r+s)/m,this._y=.25*m,this._z=(l+d)/m}else{const m=2*Math.sqrt(1+f-i-o);this._w=(s-r)/m,this._x=(a+c)/m,this._y=(l+d)/m,this._z=.25*m}return this._onChangeCallback(),this}setFromUnitVectors(e,n){let i=e.dot(n)+1;return i<Number.EPSILON?(i=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=i):(this._x=0,this._y=-e.z,this._z=e.y,this._w=i)):(this._x=e.y*n.z-e.z*n.y,this._y=e.z*n.x-e.x*n.z,this._z=e.x*n.y-e.y*n.x,this._w=i),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(zr(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 m=1-n;return this._w=m*s+n*this._w,this._x=m*i+n*this._x,this._y=m*r+n*this._y,this._z=m*a+n*this._z,this.normalize(),this._onChangeCallback(),this}const c=Math.sqrt(l),d=Math.atan2(c,o),f=Math.sin((1-n)*d)/c,p=Math.sin(n*d)/c;return this._w=s*f+this._w*p,this._x=i*f+this._x*p,this._y=r*f+this._y*p,this._z=a*f+this._z*p,this._onChangeCallback(),this}slerpQuaternions(e,n,i){return this.copy(e).slerp(n,i)}random(){const e=Math.random(),n=Math.sqrt(1-e),i=Math.sqrt(e),r=2*Math.PI*Math.random(),a=2*Math.PI*Math.random();return this.set(n*Math.cos(r),i*Math.sin(a),i*Math.cos(a),n*Math.sin(r))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,n=0){return this._x=e[n],this._y=e[n+1],this._z=e[n+2],this._w=e[n+3],this._onChangeCallback(),this}toArray(e=[],n=0){return e[n]=this._x,e[n+1]=this._y,e[n+2]=this._z,e[n+3]=this._w,e}fromBufferAttribute(e,n){return this._x=e.getX(n),this._y=e.getY(n),this._z=e.getZ(n),this._w=e.getW(n),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class Ce{constructor(e=0,n=0,i=0){Ce.prototype.isVector3=!0,this.x=e,this.y=n,this.z=i}set(e,n,i){return i===void 0&&(i=this.z),this.x=e,this.y=n,this.z=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,n){switch(e){case 0:this.x=n;break;case 1:this.y=n;break;case 2:this.z=n;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,n){return this.x=e.x+n.x,this.y=e.y+n.y,this.z=e.z+n.z,this}addScaledVector(e,n){return this.x+=e.x*n,this.y+=e.y*n,this.z+=e.z*n,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,n){return this.x=e.x-n.x,this.y=e.y-n.y,this.z=e.z-n.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,n){return this.x=e.x*n.x,this.y=e.y*n.y,this.z=e.z*n.z,this}applyEuler(e){return this.applyQuaternion(hz.setFromEuler(e))}applyAxisAngle(e,n){return this.applyQuaternion(hz.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 AA.copy(this).projectOnVector(e),this.sub(AA)}reflect(e){return this.sub(AA.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(zr(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 AA=new Ce,hz=new uf;class Us{constructor(e=new Ce(1/0,1/0,1/0),n=new Ce(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=n}set(e,n){return this.min.copy(e),this.max.copy(n),this}setFromArray(e){this.makeEmpty();for(let n=0,i=e.length;n<i;n+=3)this.expandByPoint(Qs.fromArray(e,n));return this}setFromBufferAttribute(e){this.makeEmpty();for(let n=0,i=e.count;n<i;n++)this.expandByPoint(Qs.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=Qs.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,Qs):Qs.fromBufferAttribute(a,s),Qs.applyMatrix4(e.matrixWorld),this.expandByPoint(Qs);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),wy.copy(e.boundingBox)):(i.boundingBox===null&&i.computeBoundingBox(),wy.copy(i.boundingBox)),wy.applyMatrix4(e.matrixWorld),this.union(wy)}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,Qs),Qs.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(hg),My.subVectors(this.max,hg),Eh.subVectors(e.a,hg),Ah.subVectors(e.b,hg),Th.subVectors(e.c,hg),Wc.subVectors(Ah,Eh),qc.subVectors(Th,Ah),pd.subVectors(Eh,Th);let n=[0,-Wc.z,Wc.y,0,-qc.z,qc.y,0,-pd.z,pd.y,Wc.z,0,-Wc.x,qc.z,0,-qc.x,pd.z,0,-pd.x,-Wc.y,Wc.x,0,-qc.y,qc.x,0,-pd.y,pd.x,0];return!TA(n,Eh,Ah,Th,My)||(n=[1,0,0,0,1,0,0,0,1],!TA(n,Eh,Ah,Th,My))?!1:(Ey.crossVectors(Wc,qc),n=[Ey.x,Ey.y,Ey.z],TA(n,Eh,Ah,Th,My))}clampPoint(e,n){return n.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Qs).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(Qs).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:(bl[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),bl[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),bl[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),bl[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),bl[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),bl[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),bl[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),bl[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(bl),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 bl=[new Ce,new Ce,new Ce,new Ce,new Ce,new Ce,new Ce,new Ce],Qs=new Ce,wy=new Us,Eh=new Ce,Ah=new Ce,Th=new Ce,Wc=new Ce,qc=new Ce,pd=new Ce,hg=new Ce,My=new Ce,Ey=new Ce,md=new Ce;function TA(t,e,n,i,r){for(let a=0,s=t.length-3;a<=s;a+=3){md.fromArray(t,a);const o=r.x*Math.abs(md.x)+r.y*Math.abs(md.y)+r.z*Math.abs(md.z),l=e.dot(md),c=n.dot(md),d=i.dot(md);if(Math.max(-Math.max(l,c,d),Math.min(l,c,d))>o)return!1}return!0}const Ohe=new Us,pg=new Ce,CA=new Ce;class Io{constructor(e=new Ce,n=-1){this.center=e,this.radius=n}set(e,n){return this.center.copy(e),this.radius=n,this}setFromPoints(e,n){const i=this.center;n!==void 0?i.copy(n):Ohe.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;pg.subVectors(e,this.center);const n=pg.lengthSq();if(n>this.radius*this.radius){const i=Math.sqrt(n),r=(i-this.radius)*.5;this.center.addScaledVector(pg,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):(CA.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(pg.copy(e.center).add(CA)),this.expandByPoint(pg.copy(e.center).sub(CA))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}}const _l=new Ce,RA=new Ce,Ay=new Ce,Xc=new Ce,NA=new Ce,Ty=new Ce,PA=new Ce;class QN{constructor(e=new Ce,n=new Ce(0,0,-1)){this.origin=e,this.direction=n}set(e,n){return this.origin.copy(e),this.direction.copy(n),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,n){return n.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,_l)),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=_l.subVectors(e,this.origin).dot(this.direction);return n<0?this.origin.distanceToSquared(e):(_l.copy(this.origin).addScaledVector(this.direction,n),_l.distanceToSquared(e))}distanceSqToSegment(e,n,i,r){RA.copy(e).add(n).multiplyScalar(.5),Ay.copy(n).sub(e).normalize(),Xc.copy(this.origin).sub(RA);const a=e.distanceTo(n)*.5,s=-this.direction.dot(Ay),o=Xc.dot(this.direction),l=-Xc.dot(Ay),c=Xc.lengthSq(),d=Math.abs(1-s*s);let f,p,m,y;if(d>0)if(f=s*l-o,p=s*o-l,y=a*d,f>=0)if(p>=-y)if(p<=y){const b=1/d;f*=b,p*=b,m=f*(f+s*p+2*o)+p*(s*f+p+2*l)+c}else p=a,f=Math.max(0,-(s*p+o)),m=-f*f+p*(p+2*l)+c;else p=-a,f=Math.max(0,-(s*p+o)),m=-f*f+p*(p+2*l)+c;else p<=-y?(f=Math.max(0,-(-s*a+o)),p=f>0?-a:Math.min(Math.max(-a,-l),a),m=-f*f+p*(p+2*l)+c):p<=y?(f=0,p=Math.min(Math.max(-a,-l),a),m=p*(p+2*l)+c):(f=Math.max(0,-(s*a+o)),p=f>0?a:Math.min(Math.max(-a,-l),a),m=-f*f+p*(p+2*l)+c);else p=s>0?-a:a,f=Math.max(0,-(s*p+o)),m=-f*f+p*(p+2*l)+c;return i&&i.copy(this.origin).addScaledVector(this.direction,f),r&&r.copy(RA).addScaledVector(Ay,p),m}intersectSphere(e,n){_l.subVectors(e.center,this.origin);const i=_l.dot(this.direction),r=_l.dot(_l)-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,p=this.origin;return c>=0?(i=(e.min.x-p.x)*c,r=(e.max.x-p.x)*c):(i=(e.max.x-p.x)*c,r=(e.min.x-p.x)*c),d>=0?(a=(e.min.y-p.y)*d,s=(e.max.y-p.y)*d):(a=(e.max.y-p.y)*d,s=(e.min.y-p.y)*d),i>s||a>r||((a>i||isNaN(i))&&(i=a),(s<r||isNaN(r))&&(r=s),f>=0?(o=(e.min.z-p.z)*f,l=(e.max.z-p.z)*f):(o=(e.max.z-p.z)*f,l=(e.min.z-p.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,_l)!==null}intersectTriangle(e,n,i,r,a){NA.subVectors(n,e),Ty.subVectors(i,e),PA.crossVectors(NA,Ty);let s=this.direction.dot(PA),o;if(s>0){if(r)return null;o=1}else if(s<0)o=-1,s=-s;else return null;Xc.subVectors(this.origin,e);const l=o*this.direction.dot(Ty.crossVectors(Xc,Ty));if(l<0)return null;const c=o*this.direction.dot(NA.cross(Xc));if(c<0||l+c>s)return null;const d=-o*Xc.dot(PA);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 Wn{constructor(e,n,i,r,a,s,o,l,c,d,f,p,m,y,b,x){Wn.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,p,m,y,b,x)}set(e,n,i,r,a,s,o,l,c,d,f,p,m,y,b,x){const v=this.elements;return v[0]=e,v[4]=n,v[8]=i,v[12]=r,v[1]=a,v[5]=s,v[9]=o,v[13]=l,v[2]=c,v[6]=d,v[10]=f,v[14]=p,v[3]=m,v[7]=y,v[11]=b,v[15]=x,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new Wn().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/Ch.setFromMatrixColumn(e,0).length(),a=1/Ch.setFromMatrixColumn(e,1).length(),s=1/Ch.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 p=s*d,m=s*f,y=o*d,b=o*f;n[0]=l*d,n[4]=-l*f,n[8]=c,n[1]=m+y*c,n[5]=p-b*c,n[9]=-o*l,n[2]=b-p*c,n[6]=y+m*c,n[10]=s*l}else if(e.order==="YXZ"){const p=l*d,m=l*f,y=c*d,b=c*f;n[0]=p+b*o,n[4]=y*o-m,n[8]=s*c,n[1]=s*f,n[5]=s*d,n[9]=-o,n[2]=m*o-y,n[6]=b+p*o,n[10]=s*l}else if(e.order==="ZXY"){const p=l*d,m=l*f,y=c*d,b=c*f;n[0]=p-b*o,n[4]=-s*f,n[8]=y+m*o,n[1]=m+y*o,n[5]=s*d,n[9]=b-p*o,n[2]=-s*c,n[6]=o,n[10]=s*l}else if(e.order==="ZYX"){const p=s*d,m=s*f,y=o*d,b=o*f;n[0]=l*d,n[4]=y*c-m,n[8]=p*c+b,n[1]=l*f,n[5]=b*c+p,n[9]=m*c-y,n[2]=-c,n[6]=o*l,n[10]=s*l}else if(e.order==="YZX"){const p=s*l,m=s*c,y=o*l,b=o*c;n[0]=l*d,n[4]=b-p*f,n[8]=y*f+m,n[1]=f,n[5]=s*d,n[9]=-o*d,n[2]=-c*d,n[6]=m*f+y,n[10]=p-b*f}else if(e.order==="XZY"){const p=s*l,m=s*c,y=o*l,b=o*c;n[0]=l*d,n[4]=-f,n[8]=c*d,n[1]=p*f+b,n[5]=s*d,n[9]=m*f-y,n[2]=y*f-m,n[6]=o*d,n[10]=b*f+p}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(Lhe,e,khe)}lookAt(e,n,i){const r=this.elements;return Ya.subVectors(e,n),Ya.lengthSq()===0&&(Ya.z=1),Ya.normalize(),Yc.crossVectors(i,Ya),Yc.lengthSq()===0&&(Math.abs(i.z)===1?Ya.x+=1e-4:Ya.z+=1e-4,Ya.normalize(),Yc.crossVectors(i,Ya)),Yc.normalize(),Cy.crossVectors(Ya,Yc),r[0]=Yc.x,r[4]=Cy.x,r[8]=Ya.x,r[1]=Yc.y,r[5]=Cy.y,r[9]=Ya.y,r[2]=Yc.z,r[6]=Cy.z,r[10]=Ya.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],p=i[9],m=i[13],y=i[2],b=i[6],x=i[10],v=i[14],M=i[3],w=i[7],E=i[11],T=i[15],P=r[0],R=r[4],U=r[8],N=r[12],O=r[1],B=r[5],I=r[9],W=r[13],L=r[2],$=r[6],q=r[10],G=r[14],Y=r[3],Q=r[7],se=r[11],H=r[15];return a[0]=s*P+o*O+l*L+c*Y,a[4]=s*R+o*B+l*$+c*Q,a[8]=s*U+o*I+l*q+c*se,a[12]=s*N+o*W+l*G+c*H,a[1]=d*P+f*O+p*L+m*Y,a[5]=d*R+f*B+p*$+m*Q,a[9]=d*U+f*I+p*q+m*se,a[13]=d*N+f*W+p*G+m*H,a[2]=y*P+b*O+x*L+v*Y,a[6]=y*R+b*B+x*$+v*Q,a[10]=y*U+b*I+x*q+v*se,a[14]=y*N+b*W+x*G+v*H,a[3]=M*P+w*O+E*L+T*Y,a[7]=M*R+w*B+E*$+T*Q,a[11]=M*U+w*I+E*q+T*se,a[15]=M*N+w*W+E*G+T*H,this}multiplyScalar(e){const n=this.elements;return n[0]*=e,n[4]*=e,n[8]*=e,n[12]*=e,n[1]*=e,n[5]*=e,n[9]*=e,n[13]*=e,n[2]*=e,n[6]*=e,n[10]*=e,n[14]*=e,n[3]*=e,n[7]*=e,n[11]*=e,n[15]*=e,this}determinant(){const e=this.elements,n=e[0],i=e[4],r=e[8],a=e[12],s=e[1],o=e[5],l=e[9],c=e[13],d=e[2],f=e[6],p=e[10],m=e[14],y=e[3],b=e[7],x=e[11],v=e[15];return y*(+a*l*f-r*c*f-a*o*p+i*c*p+r*o*m-i*l*m)+b*(+n*l*m-n*c*p+a*s*p-r*s*m+r*c*d-a*l*d)+x*(+n*c*f-n*o*m-a*s*f+i*s*m+a*o*d-i*c*d)+v*(-r*o*d-n*l*f+n*o*p+r*s*f-i*s*p+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],p=e[10],m=e[11],y=e[12],b=e[13],x=e[14],v=e[15],M=f*x*c-b*p*c+b*l*m-o*x*m-f*l*v+o*p*v,w=y*p*c-d*x*c-y*l*m+s*x*m+d*l*v-s*p*v,E=d*b*c-y*f*c+y*o*m-s*b*m-d*o*v+s*f*v,T=y*f*l-d*b*l-y*o*p+s*b*p+d*o*x-s*f*x,P=n*M+i*w+r*E+a*T;if(P===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const R=1/P;return e[0]=M*R,e[1]=(b*p*a-f*x*a-b*r*m+i*x*m+f*r*v-i*p*v)*R,e[2]=(o*x*a-b*l*a+b*r*c-i*x*c-o*r*v+i*l*v)*R,e[3]=(f*l*a-o*p*a-f*r*c+i*p*c+o*r*m-i*l*m)*R,e[4]=w*R,e[5]=(d*x*a-y*p*a+y*r*m-n*x*m-d*r*v+n*p*v)*R,e[6]=(y*l*a-s*x*a-y*r*c+n*x*c+s*r*v-n*l*v)*R,e[7]=(s*p*a-d*l*a+d*r*c-n*p*c-s*r*m+n*l*m)*R,e[8]=E*R,e[9]=(y*f*a-d*b*a-y*i*m+n*b*m+d*i*v-n*f*v)*R,e[10]=(s*b*a-y*o*a+y*i*c-n*b*c-s*i*v+n*o*v)*R,e[11]=(d*o*a-s*f*a-d*i*c+n*f*c+s*i*m-n*o*m)*R,e[12]=T*R,e[13]=(d*b*r-y*f*r+y*i*p-n*b*p-d*i*x+n*f*x)*R,e[14]=(y*o*r-s*b*r-y*i*l+n*b*l+s*i*x-n*o*x)*R,e[15]=(s*f*r-d*o*r+d*i*l-n*f*l-s*i*p+n*o*p)*R,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,p=a*c,m=a*d,y=a*f,b=s*d,x=s*f,v=o*f,M=l*c,w=l*d,E=l*f,T=i.x,P=i.y,R=i.z;return r[0]=(1-(b+v))*T,r[1]=(m+E)*T,r[2]=(y-w)*T,r[3]=0,r[4]=(m-E)*P,r[5]=(1-(p+v))*P,r[6]=(x+M)*P,r[7]=0,r[8]=(y+w)*R,r[9]=(x-M)*R,r[10]=(1-(p+b))*R,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=Ch.set(r[0],r[1],r[2]).length();const s=Ch.set(r[4],r[5],r[6]).length(),o=Ch.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],eo.copy(this);const c=1/a,d=1/s,f=1/o;return eo.elements[0]*=c,eo.elements[1]*=c,eo.elements[2]*=c,eo.elements[4]*=d,eo.elements[5]*=d,eo.elements[6]*=d,eo.elements[8]*=f,eo.elements[9]*=f,eo.elements[10]*=f,n.setFromRotationMatrix(eo),i.x=a,i.y=s,i.z=o,this}makePerspective(e,n,i,r,a,s,o=Lo){const l=this.elements,c=2*a/(n-e),d=2*a/(i-r),f=(n+e)/(n-e),p=(i+r)/(i-r);let m,y;if(o===Lo)m=-(s+a)/(s-a),y=-2*s*a/(s-a);else if(o===_0)m=-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]=p,l[13]=0,l[2]=0,l[6]=0,l[10]=m,l[14]=y,l[3]=0,l[7]=0,l[11]=-1,l[15]=0,this}makeOrthographic(e,n,i,r,a,s,o=Lo){const l=this.elements,c=1/(n-e),d=1/(i-r),f=1/(s-a),p=(n+e)*c,m=(i+r)*d;let y,b;if(o===Lo)y=(s+a)*f,b=-2*f;else if(o===_0)y=a*f,b=-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]=-p,l[1]=0,l[5]=2*d,l[9]=0,l[13]=-m,l[2]=0,l[6]=0,l[10]=b,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 Ch=new Ce,eo=new Wn,Lhe=new Ce(0,0,0),khe=new Ce(1,1,1),Yc=new Ce,Cy=new Ce,Ya=new Ce,pz=new Wn,mz=new uf;class rv{constructor(e=0,n=0,i=0,r=rv.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],p=r[6],m=r[10];switch(n){case"XYZ":this._y=Math.asin(zr(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-d,m),this._z=Math.atan2(-s,a)):(this._x=Math.atan2(p,c),this._z=0);break;case"YXZ":this._x=Math.asin(-zr(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(o,m),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-f,a),this._z=0);break;case"ZXY":this._x=Math.asin(zr(p,-1,1)),Math.abs(p)<.9999999?(this._y=Math.atan2(-f,m),this._z=Math.atan2(-s,c)):(this._y=0,this._z=Math.atan2(l,a));break;case"ZYX":this._y=Math.asin(-zr(f,-1,1)),Math.abs(f)<.9999999?(this._x=Math.atan2(p,m),this._z=Math.atan2(l,a)):(this._x=0,this._z=Math.atan2(-s,c));break;case"YZX":this._z=Math.asin(zr(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,m));break;case"XZY":this._z=Math.asin(-zr(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(p,c),this._y=Math.atan2(o,a)):(this._x=Math.atan2(-d,m),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+n)}return this._order=n,i===!0&&this._onChangeCallback(),this}setFromQuaternion(e,n,i){return pz.makeRotationFromQuaternion(e),this.setFromRotationMatrix(pz,n,i)}setFromVector3(e,n=this._order){return this.set(e.x,e.y,e.z,n)}reorder(e){return mz.setFromEuler(this),this.setFromQuaternion(mz,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}}rv.DEFAULT_ORDER="XYZ";class b${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 Ihe=0;const gz=new Ce,Rh=new uf,Sl=new Wn,Ry=new Ce,mg=new Ce,Uhe=new Ce,Fhe=new uf,vz=new Ce(1,0,0),xz=new Ce(0,1,0),yz=new Ce(0,0,1),zhe={type:"added"},Bhe={type:"removed"};class ha extends Af{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:Ihe++}),this.uuid=Wl(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=ha.DEFAULT_UP.clone();const e=new Ce,n=new rv,i=new uf,r=new Ce(1,1,1);function a(){i.setFromEuler(n,!1)}function s(){n.setFromQuaternion(i,void 0,!1)}n._onChange(a),i._onChange(s),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:n},quaternion:{configurable:!0,enumerable:!0,value:i},scale:{configurable:!0,enumerable:!0,value:r},modelViewMatrix:{value:new Wn},normalMatrix:{value:new an}}),this.matrix=new Wn,this.matrixWorld=new Wn,this.matrixAutoUpdate=ha.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=ha.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new b$,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 Rh.setFromAxisAngle(e,n),this.quaternion.multiply(Rh),this}rotateOnWorldAxis(e,n){return Rh.setFromAxisAngle(e,n),this.quaternion.premultiply(Rh),this}rotateX(e){return this.rotateOnAxis(vz,e)}rotateY(e){return this.rotateOnAxis(xz,e)}rotateZ(e){return this.rotateOnAxis(yz,e)}translateOnAxis(e,n){return gz.copy(e).applyQuaternion(this.quaternion),this.position.add(gz.multiplyScalar(n)),this}translateX(e){return this.translateOnAxis(vz,e)}translateY(e){return this.translateOnAxis(xz,e)}translateZ(e){return this.translateOnAxis(yz,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(Sl.copy(this.matrixWorld).invert())}lookAt(e,n,i){e.isVector3?Ry.copy(e):Ry.set(e,n,i);const r=this.parent;this.updateWorldMatrix(!0,!1),mg.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Sl.lookAt(mg,Ry,this.up):Sl.lookAt(Ry,mg,this.up),this.quaternion.setFromRotationMatrix(Sl),r&&(Sl.extractRotation(r.matrixWorld),Rh.setFromRotationMatrix(Sl),this.quaternion.premultiply(Rh.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(zhe)):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(Bhe)),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),Sl.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),Sl.multiply(e.parent.matrixWorld)),e.applyMatrix4(Sl),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(mg,e,Uhe),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(mg,Fhe,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),p=s(e.skeletons),m=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),p.length>0&&(i.skeletons=p),m.length>0&&(i.animations=m),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}}ha.DEFAULT_UP=new Ce(0,1,0);ha.DEFAULT_MATRIX_AUTO_UPDATE=!0;ha.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;const to=new Ce,wl=new Ce,DA=new Ce,Ml=new Ce,Nh=new Ce,Ph=new Ce,bz=new Ce,OA=new Ce,LA=new Ce,kA=new Ce;let Ny=!1;class no{constructor(e=new Ce,n=new Ce,i=new Ce){this.a=e,this.b=n,this.c=i}static getNormal(e,n,i,r){r.subVectors(i,n),to.subVectors(e,n),r.cross(to);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){to.subVectors(r,n),wl.subVectors(i,n),DA.subVectors(e,n);const s=to.dot(to),o=to.dot(wl),l=to.dot(DA),c=wl.dot(wl),d=wl.dot(DA),f=s*c-o*o;if(f===0)return a.set(-2,-1,-1);const p=1/f,m=(c*l-o*d)*p,y=(s*d-o*l)*p;return a.set(1-m-y,y,m)}static containsPoint(e,n,i,r){return this.getBarycoord(e,n,i,r,Ml),Ml.x>=0&&Ml.y>=0&&Ml.x+Ml.y<=1}static getUV(e,n,i,r,a,s,o,l){return Ny===!1&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."),Ny=!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,Ml),l.setScalar(0),l.addScaledVector(a,Ml.x),l.addScaledVector(s,Ml.y),l.addScaledVector(o,Ml.z),l}static isFrontFacing(e,n,i,r){return to.subVectors(i,n),wl.subVectors(e,n),to.cross(wl).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 to.subVectors(this.c,this.b),wl.subVectors(this.a,this.b),to.cross(wl).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return no.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,n){return no.getBarycoord(e,this.a,this.b,this.c,n)}getUV(e,n,i,r,a){return Ny===!1&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."),Ny=!0),no.getInterpolation(e,this.a,this.b,this.c,n,i,r,a)}getInterpolation(e,n,i,r,a){return no.getInterpolation(e,this.a,this.b,this.c,n,i,r,a)}containsPoint(e){return no.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return no.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;Nh.subVectors(r,i),Ph.subVectors(a,i),OA.subVectors(e,i);const l=Nh.dot(OA),c=Ph.dot(OA);if(l<=0&&c<=0)return n.copy(i);LA.subVectors(e,r);const d=Nh.dot(LA),f=Ph.dot(LA);if(d>=0&&f<=d)return n.copy(r);const p=l*f-d*c;if(p<=0&&l>=0&&d<=0)return s=l/(l-d),n.copy(i).addScaledVector(Nh,s);kA.subVectors(e,a);const m=Nh.dot(kA),y=Ph.dot(kA);if(y>=0&&m<=y)return n.copy(a);const b=m*c-l*y;if(b<=0&&c>=0&&y<=0)return o=c/(c-y),n.copy(i).addScaledVector(Ph,o);const x=d*y-m*f;if(x<=0&&f-d>=0&&m-y>=0)return bz.subVectors(a,r),o=(f-d)/(f-d+(m-y)),n.copy(r).addScaledVector(bz,o);const v=1/(x+b+p);return s=b*v,o=p*v,n.copy(i).addScaledVector(Nh,s).addScaledVector(Ph,o)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}const _$={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},Kc={h:0,s:0,l:0},Py={h:0,s:0,l:0};function IA(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 Ut=class{constructor(e,n,i){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,n,i)}set(e,n,i){if(n===void 0&&i===void 0){const r=e;r&&r.isColor?this.copy(r):typeof r=="number"?this.setHex(r):typeof r=="string"&&this.setStyle(r)}else this.setRGB(e,n,i);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,n=Fr){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,kn.toWorkingColorSpace(this,n),this}setRGB(e,n,i,r=kn.workingColorSpace){return this.r=e,this.g=n,this.b=i,kn.toWorkingColorSpace(this,r),this}setHSL(e,n,i,r=kn.workingColorSpace){if(e=JN(e,1),n=zr(n,0,1),i=zr(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=IA(s,a,e+1/3),this.g=IA(s,a,e),this.b=IA(s,a,e-1/3)}return kn.toWorkingColorSpace(this,r),this}setStyle(e,n=Fr){function i(a){a!==void 0&&parseFloat(a)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let r;if(r=/^(\w+)\(([^\)]*)\)/.exec(e)){let a;const s=r[1],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=Fr){const i=_$[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=lp(e.r),this.g=lp(e.g),this.b=lp(e.b),this}copyLinearToSRGB(e){return this.r=MA(e.r),this.g=MA(e.g),this.b=MA(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Fr){return kn.fromWorkingColorSpace(Xr.copy(this),e),Math.round(zr(Xr.r*255,0,255))*65536+Math.round(zr(Xr.g*255,0,255))*256+Math.round(zr(Xr.b*255,0,255))}getHexString(e=Fr){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,n=kn.workingColorSpace){kn.fromWorkingColorSpace(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=kn.workingColorSpace){return kn.fromWorkingColorSpace(Xr.copy(this),n),e.r=Xr.r,e.g=Xr.g,e.b=Xr.b,e}getStyle(e=Fr){kn.fromWorkingColorSpace(Xr.copy(this),e);const n=Xr.r,i=Xr.g,r=Xr.b;return e!==Fr?`color(${e} ${n.toFixed(3)} ${i.toFixed(3)} ${r.toFixed(3)})`:`rgb(${Math.round(n*255)},${Math.round(i*255)},${Math.round(r*255)})`}offsetHSL(e,n,i){return this.getHSL(Kc),this.setHSL(Kc.h+e,Kc.s+n,Kc.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(Kc),e.getHSL(Py);const i=Hg(Kc.h,Py.h,n),r=Hg(Kc.s,Py.s,n),a=Hg(Kc.l,Py.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 Ut;Ut.NAMES=_$;let jhe=0;class Zp extends Af{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:jhe++}),this.uuid=Wl(),this.name="",this.type="Material",this.blending=op,this.side=Pu,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=_R,this.blendDst=SR,this.blendEquation=Td,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new Ut(0,0,0),this.blendAlpha=0,this.depthFunc=l_,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=oz,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=wh,this.stencilZFail=wh,this.stencilZPass=wh,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!==op&&(i.blending=this.blending),this.side!==Pu&&(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!==_R&&(i.blendSrc=this.blendSrc),this.blendDst!==SR&&(i.blendDst=this.blendDst),this.blendEquation!==Td&&(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!==l_&&(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!==oz&&(i.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(i.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(i.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==wh&&(i.stencilFail=this.stencilFail),this.stencilZFail!==wh&&(i.stencilZFail=this.stencilZFail),this.stencilZPass!==wh&&(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 S$ extends Zp{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Ut(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=YN,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 Fi=new Ce,Dy=new Vt;class is{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=TR,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++)Dy.fromBufferAttribute(this,n),Dy.applyMatrix3(e),this.setXY(n,Dy.x,Dy.y);else if(this.itemSize===3)for(let n=0,i=this.count;n<i;n++)Fi.fromBufferAttribute(this,n),Fi.applyMatrix3(e),this.setXYZ(n,Fi.x,Fi.y,Fi.z);return this}applyMatrix4(e){for(let n=0,i=this.count;n<i;n++)Fi.fromBufferAttribute(this,n),Fi.applyMatrix4(e),this.setXYZ(n,Fi.x,Fi.y,Fi.z);return this}applyNormalMatrix(e){for(let n=0,i=this.count;n<i;n++)Fi.fromBufferAttribute(this,n),Fi.applyNormalMatrix(e),this.setXYZ(n,Fi.x,Fi.y,Fi.z);return this}transformDirection(e){for(let n=0,i=this.count;n<i;n++)Fi.fromBufferAttribute(this,n),Fi.transformDirection(e),this.setXYZ(n,Fi.x,Fi.y,Fi.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=Do(i,this.array)),i}setComponent(e,n,i){return this.normalized&&(i=Ln(i,this.array)),this.array[e*this.itemSize+n]=i,this}getX(e){let n=this.array[e*this.itemSize];return this.normalized&&(n=Do(n,this.array)),n}setX(e,n){return this.normalized&&(n=Ln(n,this.array)),this.array[e*this.itemSize]=n,this}getY(e){let n=this.array[e*this.itemSize+1];return this.normalized&&(n=Do(n,this.array)),n}setY(e,n){return this.normalized&&(n=Ln(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=Do(n,this.array)),n}setZ(e,n){return this.normalized&&(n=Ln(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=Do(n,this.array)),n}setW(e,n){return this.normalized&&(n=Ln(n,this.array)),this.array[e*this.itemSize+3]=n,this}setXY(e,n,i){return e*=this.itemSize,this.normalized&&(n=Ln(n,this.array),i=Ln(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=Ln(n,this.array),i=Ln(i,this.array),r=Ln(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=Ln(n,this.array),i=Ln(i,this.array),r=Ln(r,this.array),a=Ln(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!==TR&&(e.usage=this.usage),e}}class w$ extends is{constructor(e,n,i){super(new Uint16Array(e),n,i)}}class M$ extends is{constructor(e,n,i){super(new Uint32Array(e),n,i)}}class Ni extends is{constructor(e,n,i){super(new Float32Array(e),n,i)}}let Hhe=0;const xs=new Wn,UA=new ha,Dh=new Ce,Ka=new Us,gg=new Us,gr=new Ce;class na extends Af{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:Hhe++}),this.uuid=Wl(),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(g$(e)?M$:w$)(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 an().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 xs.makeRotationFromQuaternion(e),this.applyMatrix4(xs),this}rotateX(e){return xs.makeRotationX(e),this.applyMatrix4(xs),this}rotateY(e){return xs.makeRotationY(e),this.applyMatrix4(xs),this}rotateZ(e){return xs.makeRotationZ(e),this.applyMatrix4(xs),this}translate(e,n,i){return xs.makeTranslation(e,n,i),this.applyMatrix4(xs),this}scale(e,n,i){return xs.makeScale(e,n,i),this.applyMatrix4(xs),this}lookAt(e){return UA.lookAt(e),UA.updateMatrix(),this.applyMatrix4(UA.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Dh).negate(),this.translate(Dh.x,Dh.y,Dh.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 Ni(n,3)),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Us);const e=this.attributes.position,n=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error('THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box. Alternatively set "mesh.frustumCulled" to "false".',this),this.boundingBox.set(new Ce(-1/0,-1/0,-1/0),new Ce(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),n)for(let i=0,r=n.length;i<r;i++){const a=n[i];Ka.setFromBufferAttribute(a),this.morphTargetsRelative?(gr.addVectors(this.boundingBox.min,Ka.min),this.boundingBox.expandByPoint(gr),gr.addVectors(this.boundingBox.max,Ka.max),this.boundingBox.expandByPoint(gr)):(this.boundingBox.expandByPoint(Ka.min),this.boundingBox.expandByPoint(Ka.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 Io);const e=this.attributes.position,n=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error('THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere. Alternatively set "mesh.frustumCulled" to "false".',this),this.boundingSphere.set(new Ce,1/0);return}if(e){const i=this.boundingSphere.center;if(Ka.setFromBufferAttribute(e),n)for(let a=0,s=n.length;a<s;a++){const o=n[a];gg.setFromBufferAttribute(o),this.morphTargetsRelative?(gr.addVectors(Ka.min,gg.min),Ka.expandByPoint(gr),gr.addVectors(Ka.max,gg.max),Ka.expandByPoint(gr)):(Ka.expandByPoint(gg.min),Ka.expandByPoint(gg.max))}Ka.getCenter(i);let r=0;for(let a=0,s=e.count;a<s;a++)gr.fromBufferAttribute(e,a),r=Math.max(r,i.distanceToSquared(gr));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++)gr.fromBufferAttribute(o,c),l&&(Dh.fromBufferAttribute(e,c),gr.add(Dh)),r=Math.max(r,i.distanceToSquared(gr))}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 is(new Float32Array(4*o),4));const l=this.getAttribute("tangent").array,c=[],d=[];for(let O=0;O<o;O++)c[O]=new Ce,d[O]=new Ce;const f=new Ce,p=new Ce,m=new Ce,y=new Vt,b=new Vt,x=new Vt,v=new Ce,M=new Ce;function w(O,B,I){f.fromArray(r,O*3),p.fromArray(r,B*3),m.fromArray(r,I*3),y.fromArray(s,O*2),b.fromArray(s,B*2),x.fromArray(s,I*2),p.sub(f),m.sub(f),b.sub(y),x.sub(y);const W=1/(b.x*x.y-x.x*b.y);isFinite(W)&&(v.copy(p).multiplyScalar(x.y).addScaledVector(m,-b.y).multiplyScalar(W),M.copy(m).multiplyScalar(b.x).addScaledVector(p,-x.x).multiplyScalar(W),c[O].add(v),c[B].add(v),c[I].add(v),d[O].add(M),d[B].add(M),d[I].add(M))}let E=this.groups;E.length===0&&(E=[{start:0,count:i.length}]);for(let O=0,B=E.length;O<B;++O){const I=E[O],W=I.start,L=I.count;for(let $=W,q=W+L;$<q;$+=3)w(i[$+0],i[$+1],i[$+2])}const T=new Ce,P=new Ce,R=new Ce,U=new Ce;function N(O){R.fromArray(a,O*3),U.copy(R);const B=c[O];T.copy(B),T.sub(R.multiplyScalar(R.dot(B))).normalize(),P.crossVectors(U,B);const W=P.dot(d[O])<0?-1:1;l[O*4]=T.x,l[O*4+1]=T.y,l[O*4+2]=T.z,l[O*4+3]=W}for(let O=0,B=E.length;O<B;++O){const I=E[O],W=I.start,L=I.count;for(let $=W,q=W+L;$<q;$+=3)N(i[$+0]),N(i[$+1]),N(i[$+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 is(new Float32Array(n.count*3),3),this.setAttribute("normal",i);else for(let p=0,m=i.count;p<m;p++)i.setXYZ(p,0,0,0);const r=new Ce,a=new Ce,s=new Ce,o=new Ce,l=new Ce,c=new Ce,d=new Ce,f=new Ce;if(e)for(let p=0,m=e.count;p<m;p+=3){const y=e.getX(p+0),b=e.getX(p+1),x=e.getX(p+2);r.fromBufferAttribute(n,y),a.fromBufferAttribute(n,b),s.fromBufferAttribute(n,x),d.subVectors(s,a),f.subVectors(r,a),d.cross(f),o.fromBufferAttribute(i,y),l.fromBufferAttribute(i,b),c.fromBufferAttribute(i,x),o.add(d),l.add(d),c.add(d),i.setXYZ(y,o.x,o.y,o.z),i.setXYZ(b,l.x,l.y,l.z),i.setXYZ(x,c.x,c.y,c.z)}else for(let p=0,m=n.count;p<m;p+=3)r.fromBufferAttribute(n,p+0),a.fromBufferAttribute(n,p+1),s.fromBufferAttribute(n,p+2),d.subVectors(s,a),f.subVectors(r,a),d.cross(f),i.setXYZ(p+0,d.x,d.y,d.z),i.setXYZ(p+1,d.x,d.y,d.z),i.setXYZ(p+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++)gr.fromBufferAttribute(e,n),gr.normalize(),e.setXYZ(n,gr.x,gr.y,gr.z)}toNonIndexed(){function e(o,l){const c=o.array,d=o.itemSize,f=o.normalized,p=new c.constructor(l.length*d);let m=0,y=0;for(let b=0,x=l.length;b<x;b++){o.isInterleavedBufferAttribute?m=l[b]*o.data.stride+o.offset:m=l[b]*d;for(let v=0;v<d;v++)p[y++]=c[m++]}return new is(p,d,f)}if(this.index===null)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const n=new na,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 p=c[d],m=e(p,i);l.push(m)}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,p=c.length;f<p;f++){const m=c[f];d.push(m.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 p=0,m=f.length;p<m;p++)d.push(f[p].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 _z=new Wn,gd=new QN,Oy=new Io,Sz=new Ce,Oh=new Ce,Lh=new Ce,kh=new Ce,FA=new Ce,Ly=new Ce,ky=new Vt,Iy=new Vt,Uy=new Vt,wz=new Ce,Mz=new Ce,Ez=new Ce,Fy=new Ce,zy=new Ce;class co extends ha{constructor(e=new na,n=new S$){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){Ly.set(0,0,0);for(let l=0,c=a.length;l<c;l++){const d=o[l],f=a[l];d!==0&&(FA.fromBufferAttribute(f,e),s?Ly.addScaledVector(FA,d):Ly.addScaledVector(FA.sub(n),d))}n.add(Ly)}return n}raycast(e,n){const i=this.geometry,r=this.material,a=this.matrixWorld;r!==void 0&&(i.boundingSphere===null&&i.computeBoundingSphere(),Oy.copy(i.boundingSphere),Oy.applyMatrix4(a),gd.copy(e.ray).recast(e.near),!(Oy.containsPoint(gd.origin)===!1&&(gd.intersectSphere(Oy,Sz)===null||gd.origin.distanceToSquared(Sz)>(e.far-e.near)**2))&&(_z.copy(a).invert(),gd.copy(e.ray).applyMatrix4(_z),!(i.boundingBox!==null&&gd.intersectsBox(i.boundingBox)===!1)&&this._computeIntersections(e,n,gd)))}_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,p=a.groups,m=a.drawRange;if(o!==null)if(Array.isArray(s))for(let y=0,b=p.length;y<b;y++){const x=p[y],v=s[x.materialIndex],M=Math.max(x.start,m.start),w=Math.min(o.count,Math.min(x.start+x.count,m.start+m.count));for(let E=M,T=w;E<T;E+=3){const P=o.getX(E),R=o.getX(E+1),U=o.getX(E+2);r=By(this,v,e,i,c,d,f,P,R,U),r&&(r.faceIndex=Math.floor(E/3),r.face.materialIndex=x.materialIndex,n.push(r))}}else{const y=Math.max(0,m.start),b=Math.min(o.count,m.start+m.count);for(let x=y,v=b;x<v;x+=3){const M=o.getX(x),w=o.getX(x+1),E=o.getX(x+2);r=By(this,s,e,i,c,d,f,M,w,E),r&&(r.faceIndex=Math.floor(x/3),n.push(r))}}else if(l!==void 0)if(Array.isArray(s))for(let y=0,b=p.length;y<b;y++){const x=p[y],v=s[x.materialIndex],M=Math.max(x.start,m.start),w=Math.min(l.count,Math.min(x.start+x.count,m.start+m.count));for(let E=M,T=w;E<T;E+=3){const P=E,R=E+1,U=E+2;r=By(this,v,e,i,c,d,f,P,R,U),r&&(r.faceIndex=Math.floor(E/3),r.face.materialIndex=x.materialIndex,n.push(r))}}else{const y=Math.max(0,m.start),b=Math.min(l.count,m.start+m.count);for(let x=y,v=b;x<v;x+=3){const M=x,w=x+1,E=x+2;r=By(this,s,e,i,c,d,f,M,w,E),r&&(r.faceIndex=Math.floor(x/3),n.push(r))}}}}function Vhe(t,e,n,i,r,a,s,o){let l;if(e.side===Da?l=i.intersectTriangle(s,a,r,!0,o):l=i.intersectTriangle(r,a,s,e.side===Pu,o),l===null)return null;zy.copy(o),zy.applyMatrix4(t.matrixWorld);const c=n.ray.origin.distanceTo(zy);return c<n.near||c>n.far?null:{distance:c,point:zy.clone(),object:t}}function By(t,e,n,i,r,a,s,o,l,c){t.getVertexPosition(o,Oh),t.getVertexPosition(l,Lh),t.getVertexPosition(c,kh);const d=Vhe(t,e,n,i,Oh,Lh,kh,Fy);if(d){r&&(ky.fromBufferAttribute(r,o),Iy.fromBufferAttribute(r,l),Uy.fromBufferAttribute(r,c),d.uv=no.getInterpolation(Fy,Oh,Lh,kh,ky,Iy,Uy,new Vt)),a&&(ky.fromBufferAttribute(a,o),Iy.fromBufferAttribute(a,l),Uy.fromBufferAttribute(a,c),d.uv1=no.getInterpolation(Fy,Oh,Lh,kh,ky,Iy,Uy,new Vt),d.uv2=d.uv1),s&&(wz.fromBufferAttribute(s,o),Mz.fromBufferAttribute(s,l),Ez.fromBufferAttribute(s,c),d.normal=no.getInterpolation(Fy,Oh,Lh,kh,wz,Mz,Ez,new Ce),d.normal.dot(i.direction)>0&&d.normal.multiplyScalar(-1));const f={a:o,b:l,c,normal:new Ce,materialIndex:0};no.getNormal(Oh,Lh,kh,f.normal),d.face=f}return d}class av extends na{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 p=0,m=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 Ni(c,3)),this.setAttribute("normal",new Ni(d,3)),this.setAttribute("uv",new Ni(f,2));function y(b,x,v,M,w,E,T,P,R,U,N){const O=E/R,B=T/U,I=E/2,W=T/2,L=P/2,$=R+1,q=U+1;let G=0,Y=0;const Q=new Ce;for(let se=0;se<q;se++){const H=se*B-W;for(let X=0;X<$;X++){const re=X*O-I;Q[b]=re*M,Q[x]=H*w,Q[v]=L,c.push(Q.x,Q.y,Q.z),Q[b]=0,Q[x]=0,Q[v]=P>0?1:-1,d.push(Q.x,Q.y,Q.z),f.push(X/R),f.push(1-se/U),G+=1}}for(let se=0;se<U;se++)for(let H=0;H<R;H++){const X=p+H+$*se,re=p+H+$*(se+1),ce=p+(H+1)+$*(se+1),ye=p+(H+1)+$*se;l.push(X,re,ye),l.push(re,ce,ye),Y+=6}o.addGroup(m,Y,N),m+=Y,p+=G}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new av(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}function Ep(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 la(t){const e={};for(let n=0;n<t.length;n++){const i=Ep(t[n]);for(const r in i)e[r]=i[r]}return e}function Ghe(t){const e=[];for(let n=0;n<t.length;n++)e.push(t[n].clone());return e}function E$(t){return t.getRenderTarget()===null?t.outputColorSpace:kn.workingColorSpace}const eP={clone:Ep,merge:la};var $he=`void main() {
  3840. gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
  3841. }`,Whe=`void main() {
  3842. gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
  3843. }`;class Du extends Zp{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=$he,this.fragmentShader=Whe,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=Ep(e.uniforms),this.uniformsGroups=Ghe(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 A$ extends ha{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new Wn,this.projectionMatrix=new Wn,this.projectionMatrixInverse=new Wn,this.coordinateSystem=Lo}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 Ja extends A${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=S0*2*Math.atan(n),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(jg*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return S0*2*Math.atan(Math.tan(jg*.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(jg*.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 Ih=-90,Uh=1;class qhe extends ha{constructor(e,n,i){super(),this.type="CubeCamera",this.renderTarget=i,this.coordinateSystem=null,this.activeMipmapLevel=0;const r=new Ja(Ih,Uh,e,n);r.layers=this.layers,this.add(r);const a=new Ja(Ih,Uh,e,n);a.layers=this.layers,this.add(a);const s=new Ja(Ih,Uh,e,n);s.layers=this.layers,this.add(s);const o=new Ja(Ih,Uh,e,n);o.layers=this.layers,this.add(o);const l=new Ja(Ih,Uh,e,n);l.layers=this.layers,this.add(l);const c=new Ja(Ih,Uh,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===Lo)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===_0)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(),p=e.getActiveCubeFace(),m=e.getActiveMipmapLevel(),y=e.xr.enabled;e.xr.enabled=!1;const b=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=b,e.setRenderTarget(i,5,r),e.render(n,d),e.setRenderTarget(f,p,m),e.xr.enabled=y,i.texture.needsPMREMUpdate=!0}}class T$ extends Oa{constructor(e,n,i,r,a,s,o,l,c,d){e=e!==void 0?e:[],n=n!==void 0?n:Sp,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 Xhe extends cf{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&&(Vg("THREE.WebGLCubeRenderTarget: option.encoding has been replaced by option.colorSpace."),n.colorSpace=n.encoding===Hd?Fr:Ds),this.texture=new T$(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:Ns}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 av(5,5,5),a=new Du({name:"CubemapFromEquirect",uniforms:Ep(i.uniforms),vertexShader:i.vertexShader,fragmentShader:i.fragmentShader,side:Da,blending:_u});a.uniforms.tEquirect.value=n;const s=new co(r,a),o=n.minFilter;return n.minFilter===y0&&(n.minFilter=Ns),new qhe(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 zA=new Ce,Yhe=new Ce,Khe=new an;class nu{constructor(e=new Ce(1,0,0),n=0){this.isPlane=!0,this.normal=e,this.constant=n}set(e,n){return this.normal.copy(e),this.constant=n,this}setComponents(e,n,i,r){return this.normal.set(e,n,i),this.constant=r,this}setFromNormalAndCoplanarPoint(e,n){return this.normal.copy(e),this.constant=-n.dot(this.normal),this}setFromCoplanarPoints(e,n,i){const r=zA.subVectors(i,n).cross(Yhe.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(zA),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||Khe.getNormalMatrix(e),r=this.coplanarPoint(zA).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 vd=new Io,jy=new Ce;class pS{constructor(e=new nu,n=new nu,i=new nu,r=new nu,a=new nu,s=new nu){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=Lo){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],p=r[7],m=r[8],y=r[9],b=r[10],x=r[11],v=r[12],M=r[13],w=r[14],E=r[15];if(i[0].setComponents(l-a,p-c,x-m,E-v).normalize(),i[1].setComponents(l+a,p+c,x+m,E+v).normalize(),i[2].setComponents(l+s,p+d,x+y,E+M).normalize(),i[3].setComponents(l-s,p-d,x-y,E-M).normalize(),i[4].setComponents(l-o,p-f,x-b,E-w).normalize(),n===Lo)i[5].setComponents(l+o,p+f,x+b,E+w).normalize();else if(n===_0)i[5].setComponents(o,f,b,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(),vd.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const n=e.geometry;n.boundingSphere===null&&n.computeBoundingSphere(),vd.copy(n.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(vd)}intersectsSprite(e){return vd.center.set(0,0,0),vd.radius=.7071067811865476,vd.applyMatrix4(e.matrixWorld),this.intersectsSphere(vd)}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(jy.x=r.normal.x>0?e.max.x:e.min.x,jy.y=r.normal.y>0?e.max.y:e.min.y,jy.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(jy)<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 C$(){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 Zhe(t,e){const n=e.isWebGL2,i=new WeakMap;function r(c,d){const f=c.array,p=c.usage,m=f.byteLength,y=t.createBuffer();t.bindBuffer(d,y),t.bufferData(d,f,p),c.onUploadCallback();let b;if(f instanceof Float32Array)b=t.FLOAT;else if(f instanceof Uint16Array)if(c.isFloat16BufferAttribute)if(n)b=t.HALF_FLOAT;else throw new Error("THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2.");else b=t.UNSIGNED_SHORT;else if(f instanceof Int16Array)b=t.SHORT;else if(f instanceof Uint32Array)b=t.UNSIGNED_INT;else if(f instanceof Int32Array)b=t.INT;else if(f instanceof Int8Array)b=t.BYTE;else if(f instanceof Uint8Array)b=t.UNSIGNED_BYTE;else if(f instanceof Uint8ClampedArray)b=t.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+f);return{buffer:y,type:b,bytesPerElement:f.BYTES_PER_ELEMENT,version:c.version,size:m}}function a(c,d,f){const p=d.array,m=d._updateRange,y=d.updateRanges;if(t.bindBuffer(f,c),m.count===-1&&y.length===0&&t.bufferSubData(f,0,p),y.length!==0){for(let b=0,x=y.length;b<x;b++){const v=y[b];n?t.bufferSubData(f,v.start*p.BYTES_PER_ELEMENT,p,v.start,v.count):t.bufferSubData(f,v.start*p.BYTES_PER_ELEMENT,p.subarray(v.start,v.start+v.count))}d.clearUpdateRanges()}m.count!==-1&&(n?t.bufferSubData(f,m.offset*p.BYTES_PER_ELEMENT,p,m.offset,m.count):t.bufferSubData(f,m.offset*p.BYTES_PER_ELEMENT,p.subarray(m.offset,m.offset+m.count)),m.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 p=i.get(c);(!p||p.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 tP extends na{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,p=n/l,m=[],y=[],b=[],x=[];for(let v=0;v<d;v++){const M=v*p-s;for(let w=0;w<c;w++){const E=w*f-a;y.push(E,-M,0),b.push(0,0,1),x.push(w/o),x.push(1-v/l)}}for(let v=0;v<l;v++)for(let M=0;M<o;M++){const w=M+c*v,E=M+c*(v+1),T=M+1+c*(v+1),P=M+1+c*v;m.push(w,E,P),m.push(E,T,P)}this.setIndex(m),this.setAttribute("position",new Ni(y,3)),this.setAttribute("normal",new Ni(b,3)),this.setAttribute("uv",new Ni(x,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new tP(e.width,e.height,e.widthSegments,e.heightSegments)}}var Jhe=`#ifdef USE_ALPHAHASH
  3863. if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;
  3864. #endif`,Qhe=`#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`,epe=`#ifdef USE_ALPHAMAP
  3900. diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;
  3901. #endif`,tpe=`#ifdef USE_ALPHAMAP
  3902. uniform sampler2D alphaMap;
  3903. #endif`,npe=`#ifdef USE_ALPHATEST
  3904. if ( diffuseColor.a < alphaTest ) discard;
  3905. #endif`,ipe=`#ifdef USE_ALPHATEST
  3906. uniform float alphaTest;
  3907. #endif`,rpe=`#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`,ape=`#ifdef USE_AOMAP
  3921. uniform sampler2D aoMap;
  3922. uniform float aoMapIntensity;
  3923. #endif`,spe=`#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`,ope=`#ifdef USE_BATCHING
  3938. mat4 batchingMatrix = getBatchingMatrix( batchId );
  3939. #endif`,lpe=`vec3 transformed = vec3( position );
  3940. #ifdef USE_ALPHAHASH
  3941. vPosition = vec3( position );
  3942. #endif`,cpe=`vec3 objectNormal = vec3( normal );
  3943. #ifdef USE_TANGENT
  3944. vec3 objectTangent = vec3( tangent.xyz );
  3945. #endif`,upe=`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`,dpe=`#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`,fpe=`#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`,hpe=`#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`,ppe=`#if NUM_CLIPPING_PLANES > 0
  4062. varying vec3 vClipPosition;
  4063. uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];
  4064. #endif`,mpe=`#if NUM_CLIPPING_PLANES > 0
  4065. varying vec3 vClipPosition;
  4066. #endif`,gpe=`#if NUM_CLIPPING_PLANES > 0
  4067. vClipPosition = - mvPosition.xyz;
  4068. #endif`,vpe=`#if defined( USE_COLOR_ALPHA )
  4069. diffuseColor *= vColor;
  4070. #elif defined( USE_COLOR )
  4071. diffuseColor.rgb *= vColor;
  4072. #endif`,xpe=`#if defined( USE_COLOR_ALPHA )
  4073. varying vec4 vColor;
  4074. #elif defined( USE_COLOR )
  4075. varying vec3 vColor;
  4076. #endif`,ype=`#if defined( USE_COLOR_ALPHA )
  4077. varying vec4 vColor;
  4078. #elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )
  4079. varying vec3 vColor;
  4080. #endif`,bpe=`#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`,_pe=`#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`,Spe=`#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`,wpe=`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`,Mpe=`#ifdef USE_DISPLACEMENTMAP
  4296. uniform sampler2D displacementMap;
  4297. uniform float displacementScale;
  4298. uniform float displacementBias;
  4299. #endif`,Epe=`#ifdef USE_DISPLACEMENTMAP
  4300. transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );
  4301. #endif`,Ape=`#ifdef USE_EMISSIVEMAP
  4302. vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );
  4303. totalEmissiveRadiance *= emissiveColor.rgb;
  4304. #endif`,Tpe=`#ifdef USE_EMISSIVEMAP
  4305. uniform sampler2D emissiveMap;
  4306. #endif`,Cpe="gl_FragColor = linearToOutputTexel( gl_FragColor );",Rpe=`
  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. }`,Npe=`#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`,Ppe=`#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`,Dpe=`#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`,Ope=`#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`,Lpe=`#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`,kpe=`#ifdef USE_FOG
  4410. vFogDepth = - mvPosition.z;
  4411. #endif`,Ipe=`#ifdef USE_FOG
  4412. varying float vFogDepth;
  4413. #endif`,Upe=`#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`,Fpe=`#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`,zpe=`#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. }`,Bpe=`#ifdef USE_LIGHTMAP
  4442. vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
  4443. vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;
  4444. reflectedLight.indirectDiffuse += lightMapIrradiance;
  4445. #endif`,jpe=`#ifdef USE_LIGHTMAP
  4446. uniform sampler2D lightMap;
  4447. uniform float lightMapIntensity;
  4448. #endif`,Hpe=`LambertMaterial material;
  4449. material.diffuseColor = diffuseColor.rgb;
  4450. material.specularStrength = specularStrength;`,Vpe=`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`,Gpe=`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`,$pe=`#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`,Wpe=`ToonMaterial material;
  4621. material.diffuseColor = diffuseColor.rgb;`,qpe=`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`,Xpe=`BlinnPhongMaterial material;
  4634. material.diffuseColor = diffuseColor.rgb;
  4635. material.specularColor = specular;
  4636. material.specularShininess = shininess;
  4637. material.specularStrength = specularStrength;`,Ype=`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`,Kpe=`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`,Zpe=`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. }`,Jpe=`
  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`,Qpe=`#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`,eme=`#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`,tme=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )
  5177. gl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;
  5178. #endif`,nme=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )
  5179. uniform float logDepthBufFC;
  5180. varying float vFragDepth;
  5181. varying float vIsPerspective;
  5182. #endif`,ime=`#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`,rme=`#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`,ame=`#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`,sme=`#ifdef USE_MAP
  5206. uniform sampler2D map;
  5207. #endif`,ome=`#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`,lme=`#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`,cme=`float metalnessFactor = metalness;
  5232. #ifdef USE_METALNESSMAP
  5233. vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );
  5234. metalnessFactor *= texelMetalness.b;
  5235. #endif`,ume=`#ifdef USE_METALNESSMAP
  5236. uniform sampler2D metalnessMap;
  5237. #endif`,dme=`#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`,fme=`#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`,hme=`#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`,pme=`#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`,mme=`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;`,gme=`#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`,vme=`#ifndef FLAT_SHADED
  5353. varying vec3 vNormal;
  5354. #ifdef USE_TANGENT
  5355. varying vec3 vTangent;
  5356. varying vec3 vBitangent;
  5357. #endif
  5358. #endif`,xme=`#ifndef FLAT_SHADED
  5359. varying vec3 vNormal;
  5360. #ifdef USE_TANGENT
  5361. varying vec3 vTangent;
  5362. varying vec3 vBitangent;
  5363. #endif
  5364. #endif`,yme=`#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`,bme=`#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`,_me=`#ifdef USE_CLEARCOAT
  5393. vec3 clearcoatNormal = nonPerturbedNormal;
  5394. #endif`,Sme=`#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`,wme=`#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`,Mme=`#ifdef USE_IRIDESCENCEMAP
  5408. uniform sampler2D iridescenceMap;
  5409. #endif
  5410. #ifdef USE_IRIDESCENCE_THICKNESSMAP
  5411. uniform sampler2D iridescenceThicknessMap;
  5412. #endif`,Eme=`#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 );`,Ame=`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. }`,Tme=`#ifdef PREMULTIPLIED_ALPHA
  5460. gl_FragColor.rgb *= gl_FragColor.a;
  5461. #endif`,Cme=`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;`,Rme=`#ifdef DITHERING
  5470. gl_FragColor.rgb = dithering( gl_FragColor.rgb );
  5471. #endif`,Nme=`#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`,Pme=`float roughnessFactor = roughness;
  5479. #ifdef USE_ROUGHNESSMAP
  5480. vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );
  5481. roughnessFactor *= texelRoughness.g;
  5482. #endif`,Dme=`#ifdef USE_ROUGHNESSMAP
  5483. uniform sampler2D roughnessMap;
  5484. #endif`,Ome=`#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`,Lme=`#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`,kme=`#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`,Ime=`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. }`,Ume=`#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`,Fme=`#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`,zme=`#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`,Bme=`#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`,jme=`float specularStrength;
  5803. #ifdef USE_SPECULARMAP
  5804. vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );
  5805. specularStrength = texelSpecular.r;
  5806. #else
  5807. specularStrength = 1.0;
  5808. #endif`,Hme=`#ifdef USE_SPECULARMAP
  5809. uniform sampler2D specularMap;
  5810. #endif`,Vme=`#if defined( TONE_MAPPING )
  5811. gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );
  5812. #endif`,Gme=`#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; }`,$me=`#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`,Wme=`#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`,qme=`#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`,Xme=`#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`,Yme=`#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`,Kme=`#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 Zme=`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. }`,Jme=`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. }`,Qme=`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. }`,ege=`#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. }`,tge=`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. }`,nge=`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. }`,ige=`#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. }`,rge=`#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. }`,age=`#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. }`,sge=`#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. }`,oge=`varying vec3 vWorldDirection;
  6389. #include <common>
  6390. void main() {
  6391. vWorldDirection = transformDirection( position, modelMatrix );
  6392. #include <begin_vertex>
  6393. #include <project_vertex>
  6394. }`,lge=`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. }`,cge=`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. }`,uge=`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. }`,dge=`#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. }`,fge=`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. }`,hge=`#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. }`,pge=`#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. }`,mge=`#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. }`,gge=`#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. }`,vge=`#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. }`,xge=`#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. }`,yge=`#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. }`,bge=`#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. }`,_ge=`#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. }`,Sge=`#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. }`,wge=`#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. }`,Mge=`#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. }`,Ege=`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. }`,Age=`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. }`,Tge=`#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. }`,Cge=`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. }`,Rge=`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. }`,Nge=`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. }`,Jt={alphahash_fragment:Jhe,alphahash_pars_fragment:Qhe,alphamap_fragment:epe,alphamap_pars_fragment:tpe,alphatest_fragment:npe,alphatest_pars_fragment:ipe,aomap_fragment:rpe,aomap_pars_fragment:ape,batching_pars_vertex:spe,batching_vertex:ope,begin_vertex:lpe,beginnormal_vertex:cpe,bsdfs:upe,iridescence_fragment:dpe,bumpmap_pars_fragment:fpe,clipping_planes_fragment:hpe,clipping_planes_pars_fragment:ppe,clipping_planes_pars_vertex:mpe,clipping_planes_vertex:gpe,color_fragment:vpe,color_pars_fragment:xpe,color_pars_vertex:ype,color_vertex:bpe,common:_pe,cube_uv_reflection_fragment:Spe,defaultnormal_vertex:wpe,displacementmap_pars_vertex:Mpe,displacementmap_vertex:Epe,emissivemap_fragment:Ape,emissivemap_pars_fragment:Tpe,colorspace_fragment:Cpe,colorspace_pars_fragment:Rpe,envmap_fragment:Npe,envmap_common_pars_fragment:Ppe,envmap_pars_fragment:Dpe,envmap_pars_vertex:Ope,envmap_physical_pars_fragment:$pe,envmap_vertex:Lpe,fog_vertex:kpe,fog_pars_vertex:Ipe,fog_fragment:Upe,fog_pars_fragment:Fpe,gradientmap_pars_fragment:zpe,lightmap_fragment:Bpe,lightmap_pars_fragment:jpe,lights_lambert_fragment:Hpe,lights_lambert_pars_fragment:Vpe,lights_pars_begin:Gpe,lights_toon_fragment:Wpe,lights_toon_pars_fragment:qpe,lights_phong_fragment:Xpe,lights_phong_pars_fragment:Ype,lights_physical_fragment:Kpe,lights_physical_pars_fragment:Zpe,lights_fragment_begin:Jpe,lights_fragment_maps:Qpe,lights_fragment_end:eme,logdepthbuf_fragment:tme,logdepthbuf_pars_fragment:nme,logdepthbuf_pars_vertex:ime,logdepthbuf_vertex:rme,map_fragment:ame,map_pars_fragment:sme,map_particle_fragment:ome,map_particle_pars_fragment:lme,metalnessmap_fragment:cme,metalnessmap_pars_fragment:ume,morphcolor_vertex:dme,morphnormal_vertex:fme,morphtarget_pars_vertex:hme,morphtarget_vertex:pme,normal_fragment_begin:mme,normal_fragment_maps:gme,normal_pars_fragment:vme,normal_pars_vertex:xme,normal_vertex:yme,normalmap_pars_fragment:bme,clearcoat_normal_fragment_begin:_me,clearcoat_normal_fragment_maps:Sme,clearcoat_pars_fragment:wme,iridescence_pars_fragment:Mme,opaque_fragment:Eme,packing:Ame,premultiplied_alpha_fragment:Tme,project_vertex:Cme,dithering_fragment:Rme,dithering_pars_fragment:Nme,roughnessmap_fragment:Pme,roughnessmap_pars_fragment:Dme,shadowmap_pars_fragment:Ome,shadowmap_pars_vertex:Lme,shadowmap_vertex:kme,shadowmask_pars_fragment:Ime,skinbase_vertex:Ume,skinning_pars_vertex:Fme,skinning_vertex:zme,skinnormal_vertex:Bme,specularmap_fragment:jme,specularmap_pars_fragment:Hme,tonemapping_fragment:Vme,tonemapping_pars_fragment:Gme,transmission_fragment:$me,transmission_pars_fragment:Wme,uv_pars_fragment:qme,uv_pars_vertex:Xme,uv_vertex:Yme,worldpos_vertex:Kme,background_vert:Zme,background_frag:Jme,backgroundCube_vert:Qme,backgroundCube_frag:ege,cube_vert:tge,cube_frag:nge,depth_vert:ige,depth_frag:rge,distanceRGBA_vert:age,distanceRGBA_frag:sge,equirect_vert:oge,equirect_frag:lge,linedashed_vert:cge,linedashed_frag:uge,meshbasic_vert:dge,meshbasic_frag:fge,meshlambert_vert:hge,meshlambert_frag:pge,meshmatcap_vert:mge,meshmatcap_frag:gge,meshnormal_vert:vge,meshnormal_frag:xge,meshphong_vert:yge,meshphong_frag:bge,meshphysical_vert:_ge,meshphysical_frag:Sge,meshtoon_vert:wge,meshtoon_frag:Mge,points_vert:Ege,points_frag:Age,shadow_vert:Tge,shadow_frag:Cge,sprite_vert:Rge,sprite_frag:Nge},gt={common:{diffuse:{value:new Ut(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new an},alphaMap:{value:null},alphaMapTransform:{value:new an},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new an}},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 an}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new an}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new an},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new an},normalScale:{value:new Vt(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new an},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new an}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new an}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new an}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Ut(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 Ut(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new an},alphaTest:{value:0},uvTransform:{value:new an}},sprite:{diffuse:{value:new Ut(16777215)},opacity:{value:1},center:{value:new Vt(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new an},alphaMap:{value:null},alphaMapTransform:{value:new an},alphaTest:{value:0}}},Ca={basic:{uniforms:la([gt.common,gt.specularmap,gt.envmap,gt.aomap,gt.lightmap,gt.fog]),vertexShader:Jt.meshbasic_vert,fragmentShader:Jt.meshbasic_frag},lambert:{uniforms:la([gt.common,gt.specularmap,gt.envmap,gt.aomap,gt.lightmap,gt.emissivemap,gt.bumpmap,gt.normalmap,gt.displacementmap,gt.fog,gt.lights,{emissive:{value:new Ut(0)}}]),vertexShader:Jt.meshlambert_vert,fragmentShader:Jt.meshlambert_frag},phong:{uniforms:la([gt.common,gt.specularmap,gt.envmap,gt.aomap,gt.lightmap,gt.emissivemap,gt.bumpmap,gt.normalmap,gt.displacementmap,gt.fog,gt.lights,{emissive:{value:new Ut(0)},specular:{value:new Ut(1118481)},shininess:{value:30}}]),vertexShader:Jt.meshphong_vert,fragmentShader:Jt.meshphong_frag},standard:{uniforms:la([gt.common,gt.envmap,gt.aomap,gt.lightmap,gt.emissivemap,gt.bumpmap,gt.normalmap,gt.displacementmap,gt.roughnessmap,gt.metalnessmap,gt.fog,gt.lights,{emissive:{value:new Ut(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Jt.meshphysical_vert,fragmentShader:Jt.meshphysical_frag},toon:{uniforms:la([gt.common,gt.aomap,gt.lightmap,gt.emissivemap,gt.bumpmap,gt.normalmap,gt.displacementmap,gt.gradientmap,gt.fog,gt.lights,{emissive:{value:new Ut(0)}}]),vertexShader:Jt.meshtoon_vert,fragmentShader:Jt.meshtoon_frag},matcap:{uniforms:la([gt.common,gt.bumpmap,gt.normalmap,gt.displacementmap,gt.fog,{matcap:{value:null}}]),vertexShader:Jt.meshmatcap_vert,fragmentShader:Jt.meshmatcap_frag},points:{uniforms:la([gt.points,gt.fog]),vertexShader:Jt.points_vert,fragmentShader:Jt.points_frag},dashed:{uniforms:la([gt.common,gt.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Jt.linedashed_vert,fragmentShader:Jt.linedashed_frag},depth:{uniforms:la([gt.common,gt.displacementmap]),vertexShader:Jt.depth_vert,fragmentShader:Jt.depth_frag},normal:{uniforms:la([gt.common,gt.bumpmap,gt.normalmap,gt.displacementmap,{opacity:{value:1}}]),vertexShader:Jt.meshnormal_vert,fragmentShader:Jt.meshnormal_frag},sprite:{uniforms:la([gt.sprite,gt.fog]),vertexShader:Jt.sprite_vert,fragmentShader:Jt.sprite_frag},background:{uniforms:{uvTransform:{value:new an},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Jt.background_vert,fragmentShader:Jt.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1}},vertexShader:Jt.backgroundCube_vert,fragmentShader:Jt.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Jt.cube_vert,fragmentShader:Jt.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Jt.equirect_vert,fragmentShader:Jt.equirect_frag},distanceRGBA:{uniforms:la([gt.common,gt.displacementmap,{referencePosition:{value:new Ce},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Jt.distanceRGBA_vert,fragmentShader:Jt.distanceRGBA_frag},shadow:{uniforms:la([gt.lights,gt.fog,{color:{value:new Ut(0)},opacity:{value:1}}]),vertexShader:Jt.shadow_vert,fragmentShader:Jt.shadow_frag}};Ca.physical={uniforms:la([Ca.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new an},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new an},clearcoatNormalScale:{value:new Vt(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new an},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new an},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new an},sheen:{value:0},sheenColor:{value:new Ut(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new an},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new an},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new an},transmissionSamplerSize:{value:new Vt},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new an},attenuationDistance:{value:0},attenuationColor:{value:new Ut(0)},specularColor:{value:new Ut(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new an},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new an},anisotropyVector:{value:new Vt},anisotropyMap:{value:null},anisotropyMapTransform:{value:new an}}]),vertexShader:Jt.meshphysical_vert,fragmentShader:Jt.meshphysical_frag};const Hy={r:0,b:0,g:0};function Pge(t,e,n,i,r,a,s){const o=new Ut(0);let l=a===!0?0:1,c,d,f=null,p=0,m=null;function y(x,v){let M=!1,w=v.isScene===!0?v.background:null;w&&w.isTexture&&(w=(v.backgroundBlurriness>0?n:e).get(w)),w===null?b(o,l):w&&w.isColor&&(b(w,1),M=!0);const E=t.xr.getEnvironmentBlendMode();E==="additive"?i.buffers.color.setClear(0,0,0,1,s):E==="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===fS)?(d===void 0&&(d=new co(new av(1,1,1),new Du({name:"BackgroundCubeMaterial",uniforms:Ep(Ca.backgroundCube.uniforms),vertexShader:Ca.backgroundCube.vertexShader,fragmentShader:Ca.backgroundCube.fragmentShader,side:Da,depthTest:!1,depthWrite:!1,fog:!1})),d.geometry.deleteAttribute("normal"),d.geometry.deleteAttribute("uv"),d.onBeforeRender=function(T,P,R){this.matrixWorld.copyPosition(R.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=v.backgroundBlurriness,d.material.uniforms.backgroundIntensity.value=v.backgroundIntensity,d.material.toneMapped=kn.getTransfer(w.colorSpace)!==Kn,(f!==w||p!==w.version||m!==t.toneMapping)&&(d.material.needsUpdate=!0,f=w,p=w.version,m=t.toneMapping),d.layers.enableAll(),x.unshift(d,d.geometry,d.material,0,0,null)):w&&w.isTexture&&(c===void 0&&(c=new co(new tP(2,2),new Du({name:"BackgroundMaterial",uniforms:Ep(Ca.background.uniforms),vertexShader:Ca.background.vertexShader,fragmentShader:Ca.background.fragmentShader,side:Pu,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=v.backgroundIntensity,c.material.toneMapped=kn.getTransfer(w.colorSpace)!==Kn,w.matrixAutoUpdate===!0&&w.updateMatrix(),c.material.uniforms.uvTransform.value.copy(w.matrix),(f!==w||p!==w.version||m!==t.toneMapping)&&(c.material.needsUpdate=!0,f=w,p=w.version,m=t.toneMapping),c.layers.enableAll(),x.unshift(c,c.geometry,c.material,0,0,null))}function b(x,v){x.getRGB(Hy,E$(t)),i.buffers.color.setClear(Hy.r,Hy.g,Hy.b,v,s)}return{getClearColor:function(){return o},setClearColor:function(x,v=1){o.set(x),l=v,b(o,l)},getClearAlpha:function(){return l},setClearAlpha:function(x){l=x,b(o,l)},render:y}}function Dge(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=x(null);let c=l,d=!1;function f(L,$,q,G,Y){let Q=!1;if(s){const se=b(G,q,$);c!==se&&(c=se,m(c.object)),Q=v(L,G,q,Y),Q&&M(L,G,q,Y)}else{const se=$.wireframe===!0;(c.geometry!==G.id||c.program!==q.id||c.wireframe!==se)&&(c.geometry=G.id,c.program=q.id,c.wireframe=se,Q=!0)}Y!==null&&n.update(Y,t.ELEMENT_ARRAY_BUFFER),(Q||d)&&(d=!1,U(L,$,q,G),Y!==null&&t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,n.get(Y).buffer))}function p(){return i.isWebGL2?t.createVertexArray():a.createVertexArrayOES()}function m(L){return i.isWebGL2?t.bindVertexArray(L):a.bindVertexArrayOES(L)}function y(L){return i.isWebGL2?t.deleteVertexArray(L):a.deleteVertexArrayOES(L)}function b(L,$,q){const G=q.wireframe===!0;let Y=o[L.id];Y===void 0&&(Y={},o[L.id]=Y);let Q=Y[$.id];Q===void 0&&(Q={},Y[$.id]=Q);let se=Q[G];return se===void 0&&(se=x(p()),Q[G]=se),se}function x(L){const $=[],q=[],G=[];for(let Y=0;Y<r;Y++)$[Y]=0,q[Y]=0,G[Y]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:$,enabledAttributes:q,attributeDivisors:G,object:L,attributes:{},index:null}}function v(L,$,q,G){const Y=c.attributes,Q=$.attributes;let se=0;const H=q.getAttributes();for(const X in H)if(H[X].location>=0){const ce=Y[X];let ye=Q[X];if(ye===void 0&&(X==="instanceMatrix"&&L.instanceMatrix&&(ye=L.instanceMatrix),X==="instanceColor"&&L.instanceColor&&(ye=L.instanceColor)),ce===void 0||ce.attribute!==ye||ye&&ce.data!==ye.data)return!0;se++}return c.attributesNum!==se||c.index!==G}function M(L,$,q,G){const Y={},Q=$.attributes;let se=0;const H=q.getAttributes();for(const X in H)if(H[X].location>=0){let ce=Q[X];ce===void 0&&(X==="instanceMatrix"&&L.instanceMatrix&&(ce=L.instanceMatrix),X==="instanceColor"&&L.instanceColor&&(ce=L.instanceColor));const ye={};ye.attribute=ce,ce&&ce.data&&(ye.data=ce.data),Y[X]=ye,se++}c.attributes=Y,c.attributesNum=se,c.index=G}function w(){const L=c.newAttributes;for(let $=0,q=L.length;$<q;$++)L[$]=0}function E(L){T(L,0)}function T(L,$){const q=c.newAttributes,G=c.enabledAttributes,Y=c.attributeDivisors;q[L]=1,G[L]===0&&(t.enableVertexAttribArray(L),G[L]=1),Y[L]!==$&&((i.isWebGL2?t:e.get("ANGLE_instanced_arrays"))[i.isWebGL2?"vertexAttribDivisor":"vertexAttribDivisorANGLE"](L,$),Y[L]=$)}function P(){const L=c.newAttributes,$=c.enabledAttributes;for(let q=0,G=$.length;q<G;q++)$[q]!==L[q]&&(t.disableVertexAttribArray(q),$[q]=0)}function R(L,$,q,G,Y,Q,se){se===!0?t.vertexAttribIPointer(L,$,q,Y,Q):t.vertexAttribPointer(L,$,q,G,Y,Q)}function U(L,$,q,G){if(i.isWebGL2===!1&&(L.isInstancedMesh||G.isInstancedBufferGeometry)&&e.get("ANGLE_instanced_arrays")===null)return;w();const Y=G.attributes,Q=q.getAttributes(),se=$.defaultAttributeValues;for(const H in Q){const X=Q[H];if(X.location>=0){let re=Y[H];if(re===void 0&&(H==="instanceMatrix"&&L.instanceMatrix&&(re=L.instanceMatrix),H==="instanceColor"&&L.instanceColor&&(re=L.instanceColor)),re!==void 0){const ce=re.normalized,ye=re.itemSize,me=n.get(re);if(me===void 0)continue;const be=me.buffer,De=me.type,he=me.bytesPerElement,Ae=i.isWebGL2===!0&&(De===t.INT||De===t.UNSIGNED_INT||re.gpuType===a$);if(re.isInterleavedBufferAttribute){const Be=re.data,le=Be.stride,ut=re.offset;if(Be.isInstancedInterleavedBuffer){for(let z=0;z<X.locationSize;z++)T(X.location+z,Be.meshPerAttribute);L.isInstancedMesh!==!0&&G._maxInstanceCount===void 0&&(G._maxInstanceCount=Be.meshPerAttribute*Be.count)}else for(let z=0;z<X.locationSize;z++)E(X.location+z);t.bindBuffer(t.ARRAY_BUFFER,be);for(let z=0;z<X.locationSize;z++)R(X.location+z,ye/X.locationSize,De,ce,le*he,(ut+ye/X.locationSize*z)*he,Ae)}else{if(re.isInstancedBufferAttribute){for(let Be=0;Be<X.locationSize;Be++)T(X.location+Be,re.meshPerAttribute);L.isInstancedMesh!==!0&&G._maxInstanceCount===void 0&&(G._maxInstanceCount=re.meshPerAttribute*re.count)}else for(let Be=0;Be<X.locationSize;Be++)E(X.location+Be);t.bindBuffer(t.ARRAY_BUFFER,be);for(let Be=0;Be<X.locationSize;Be++)R(X.location+Be,ye/X.locationSize,De,ce,ye*he,ye/X.locationSize*Be*he,Ae)}}else if(se!==void 0){const ce=se[H];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 L in o){const $=o[L];for(const q in $){const G=$[q];for(const Y in G)y(G[Y].object),delete G[Y];delete $[q]}delete o[L]}}function O(L){if(o[L.id]===void 0)return;const $=o[L.id];for(const q in $){const G=$[q];for(const Y in G)y(G[Y].object),delete G[Y];delete $[q]}delete o[L.id]}function B(L){for(const $ in o){const q=o[$];if(q[L.id]===void 0)continue;const G=q[L.id];for(const Y in G)y(G[Y].object),delete G[Y];delete q[L.id]}}function I(){W(),d=!0,c!==l&&(c=l,m(c.object))}function W(){l.geometry=null,l.program=null,l.wireframe=!1}return{setup:f,reset:I,resetDefaultState:W,dispose:N,releaseStatesOfGeometry:O,releaseStatesOfProgram:B,initAttributes:w,enableAttribute:E,disableUnusedAttributes:P}}function Oge(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,p){if(p===0)return;let m,y;if(r)m=t,y="drawArraysInstanced";else if(m=e.get("ANGLE_instanced_arrays"),y="drawArraysInstancedANGLE",m===null){console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");return}m[y](a,d,f,p),n.update(f,a,p)}function c(d,f,p){if(p===0)return;const m=e.get("WEBGL_multi_draw");if(m===null)for(let y=0;y<p;y++)this.render(d[y],f[y]);else{m.multiDrawArraysWEBGL(a,d,0,f,0,p);let y=0;for(let b=0;b<p;b++)y+=f[b];n.update(y,a,1)}}this.setMode=s,this.render=o,this.renderInstances=l,this.renderMultiDraw=c}function Lge(t,e,n){let i;function r(){if(i!==void 0)return i;if(e.has("EXT_texture_filter_anisotropic")===!0){const R=e.get("EXT_texture_filter_anisotropic");i=t.getParameter(R.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else i=0;return i}function a(R){if(R==="highp"){if(t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.HIGH_FLOAT).precision>0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.HIGH_FLOAT).precision>0)return"highp";R="mediump"}return R==="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),p=t.getParameter(t.MAX_VERTEX_TEXTURE_IMAGE_UNITS),m=t.getParameter(t.MAX_TEXTURE_SIZE),y=t.getParameter(t.MAX_CUBE_MAP_TEXTURE_SIZE),b=t.getParameter(t.MAX_VERTEX_ATTRIBS),x=t.getParameter(t.MAX_VERTEX_UNIFORM_VECTORS),v=t.getParameter(t.MAX_VARYING_VECTORS),M=t.getParameter(t.MAX_FRAGMENT_UNIFORM_VECTORS),w=p>0,E=s||e.has("OES_texture_float"),T=w&&E,P=s?t.getParameter(t.MAX_SAMPLES):0;return{isWebGL2:s,drawBuffers:c,getMaxAnisotropy:r,getMaxPrecision:a,precision:o,logarithmicDepthBuffer:d,maxTextures:f,maxVertexTextures:p,maxTextureSize:m,maxCubemapSize:y,maxAttributes:b,maxVertexUniforms:x,maxVaryings:v,maxFragmentUniforms:M,vertexTextures:w,floatFragmentTextures:E,floatVertexTextures:T,maxSamples:P}}function kge(t){const e=this;let n=null,i=0,r=!1,a=!1;const s=new nu,o=new an,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(f,p){const m=f.length!==0||p||i!==0||r;return r=p,i=f.length,m},this.beginShadows=function(){a=!0,d(null)},this.endShadows=function(){a=!1},this.setGlobalState=function(f,p){n=d(f,p,0)},this.setState=function(f,p,m){const y=f.clippingPlanes,b=f.clipIntersection,x=f.clipShadows,v=t.get(f);if(!r||y===null||y.length===0||a&&!x)a?d(null):c();else{const M=a?0:i,w=M*4;let E=v.clippingState||null;l.value=E,E=d(y,p,w,m);for(let T=0;T!==w;++T)E[T]=n[T];v.clippingState=E,this.numIntersection=b?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,p,m,y){const b=f!==null?f.length:0;let x=null;if(b!==0){if(x=l.value,y!==!0||x===null){const v=m+b*4,M=p.matrixWorldInverse;o.getNormalMatrix(M),(x===null||x.length<v)&&(x=new Float32Array(v));for(let w=0,E=m;w!==b;++w,E+=4)s.copy(f[w]).applyMatrix4(M,o),s.normal.toArray(x,E),x[E+3]=s.constant}l.value=x,l.needsUpdate=!0}return e.numPlanes=b,e.numIntersection=0,x}}function Ige(t){let e=new WeakMap;function n(s,o){return o===wR?s.mapping=Sp:o===MR&&(s.mapping=wp),s}function i(s){if(s&&s.isTexture){const o=s.mapping;if(o===wR||o===MR)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 Xhe(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 Uge extends A${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 Qh=4,Az=[.125,.215,.35,.446,.526,.582],Cd=20,BA=new Uge,Tz=new Ut;let jA=null,HA=0,VA=0;const _d=(1+Math.sqrt(5))/2,Fh=1/_d,Cz=[new Ce(1,1,1),new Ce(-1,1,1),new Ce(1,1,-1),new Ce(-1,1,-1),new Ce(0,_d,Fh),new Ce(0,_d,-Fh),new Ce(Fh,0,_d),new Ce(-Fh,0,_d),new Ce(_d,Fh,0),new Ce(-_d,Fh,0)];class Rz{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){jA=this._renderer.getRenderTarget(),HA=this._renderer.getActiveCubeFace(),VA=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=Dz(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=Pz(),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(jA,HA,VA),e.scissorTest=!1,Vy(e,0,0,e.width,e.height)}_fromTexture(e,n){e.mapping===Sp||e.mapping===wp?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),jA=this._renderer.getRenderTarget(),HA=this._renderer.getActiveCubeFace(),VA=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:Ns,minFilter:Ns,generateMipmaps:!1,type:b0,format:Ps,colorSpace:ec,depthBuffer:!1},r=Nz(e,n,i);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==n){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=Nz(e,n,i);const{_lodMax:a}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=Fge(a)),this._blurMaterial=zge(a,e,n)}return r}_compileMaterial(e){const n=new co(this._lodPlanes[0],e);this._renderer.compile(n,BA)}_sceneToCubeUV(e,n,i,r){const o=new Ja(90,1,n,i),l=[1,-1,1,1,1,1],c=[1,1,1,-1,-1,-1],d=this._renderer,f=d.autoClear,p=d.toneMapping;d.getClearColor(Tz),d.toneMapping=Su,d.autoClear=!1;const m=new S$({name:"PMREM.Background",side:Da,depthWrite:!1,depthTest:!1}),y=new co(new av,m);let b=!1;const x=e.background;x?x.isColor&&(m.color.copy(x),e.background=null,b=!0):(m.color.copy(Tz),b=!0);for(let v=0;v<6;v++){const M=v%3;M===0?(o.up.set(0,l[v],0),o.lookAt(c[v],0,0)):M===1?(o.up.set(0,0,l[v]),o.lookAt(0,c[v],0)):(o.up.set(0,l[v],0),o.lookAt(0,0,c[v]));const w=this._cubeSize;Vy(r,M*w,v>2?w:0,w,w),d.setRenderTarget(r),b&&d.render(y,o),d.render(e,o)}y.geometry.dispose(),y.material.dispose(),d.toneMapping=p,d.autoClear=f,e.background=x}_textureToCubeUV(e,n){const i=this._renderer,r=e.mapping===Sp||e.mapping===wp;r?(this._cubemapMaterial===null&&(this._cubemapMaterial=Dz()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=Pz());const a=r?this._cubemapMaterial:this._equirectMaterial,s=new co(this._lodPlanes[0],a),o=a.uniforms;o.envMap.value=e;const l=this._cubeSize;Vy(n,0,0,3*l,2*l),i.setRenderTarget(n),i.render(s,BA)}_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=Cz[(r-1)%Cz.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 co(this._lodPlanes[r],c),p=c.uniforms,m=this._sizeLods[i]-1,y=isFinite(a)?Math.PI/(2*m):2*Math.PI/(2*Cd-1),b=a/y,x=isFinite(a)?1+Math.floor(d*b):Cd;x>Cd&&console.warn(`sigmaRadians, ${a}, is too large and will clip, as it requested ${x} samples when the maximum is set to ${Cd}`);const v=[];let M=0;for(let R=0;R<Cd;++R){const U=R/b,N=Math.exp(-U*U/2);v.push(N),R===0?M+=N:R<x&&(M+=2*N)}for(let R=0;R<v.length;R++)v[R]=v[R]/M;p.envMap.value=e.texture,p.samples.value=x,p.weights.value=v,p.latitudinal.value=s==="latitudinal",o&&(p.poleAxis.value=o);const{_lodMax:w}=this;p.dTheta.value=y,p.mipInt.value=w-i;const E=this._sizeLods[r],T=3*E*(r>w-Qh?r-w+Qh:0),P=4*(this._cubeSize-E);Vy(n,T,P,3*E,2*E),l.setRenderTarget(n),l.render(f,BA)}}function Fge(t){const e=[],n=[],i=[];let r=t;const a=t-Qh+1+Az.length;for(let s=0;s<a;s++){const o=Math.pow(2,r);n.push(o);let l=1/o;s>t-Qh?l=Az[s-t+Qh-1]:s===0&&(l=0),i.push(l);const c=1/(o-2),d=-c,f=1+c,p=[d,d,f,d,f,f,d,d,f,f,d,f],m=6,y=6,b=3,x=2,v=1,M=new Float32Array(b*y*m),w=new Float32Array(x*y*m),E=new Float32Array(v*y*m);for(let P=0;P<m;P++){const R=P%3*2/3-1,U=P>2?0:-1,N=[R,U,0,R+2/3,U,0,R+2/3,U+1,0,R,U,0,R+2/3,U+1,0,R,U+1,0];M.set(N,b*y*P),w.set(p,x*y*P);const O=[P,P,P,P,P,P];E.set(O,v*y*P)}const T=new na;T.setAttribute("position",new is(M,b)),T.setAttribute("uv",new is(w,x)),T.setAttribute("faceIndex",new is(E,v)),e.push(T),r>Qh&&r--}return{lodPlanes:e,sizeLods:n,sigmas:i}}function Nz(t,e,n){const i=new cf(t,e,n);return i.texture.mapping=fS,i.texture.name="PMREM.cubeUv",i.scissorTest=!0,i}function Vy(t,e,n,i,r){t.viewport.set(e,n,i,r),t.scissor.set(e,n,i,r)}function zge(t,e,n){const i=new Float32Array(Cd),r=new Ce(0,1,0);return new Du({name:"SphericalGaussianBlur",defines:{n:Cd,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:nP(),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:_u,depthTest:!1,depthWrite:!1})}function Pz(){return new Du({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:nP(),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:_u,depthTest:!1,depthWrite:!1})}function Dz(){return new Du({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:nP(),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:_u,depthTest:!1,depthWrite:!1})}function nP(){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 Bge(t){let e=new WeakMap,n=null;function i(o){if(o&&o.isTexture){const l=o.mapping,c=l===wR||l===MR,d=l===Sp||l===wp;if(c||d)if(o.isRenderTargetTexture&&o.needsPMREMUpdate===!0){o.needsPMREMUpdate=!1;let f=e.get(o);return n===null&&(n=new Rz(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 Rz(t));const p=c?n.fromEquirectangular(o):n.fromCubemap(o);return e.set(o,p),o.addEventListener("dispose",a),p.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 jge(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 Hge(t,e,n,i){const r={},a=new WeakMap;function s(f){const p=f.target;p.index!==null&&e.remove(p.index);for(const y in p.attributes)e.remove(p.attributes[y]);for(const y in p.morphAttributes){const b=p.morphAttributes[y];for(let x=0,v=b.length;x<v;x++)e.remove(b[x])}p.removeEventListener("dispose",s),delete r[p.id];const m=a.get(p);m&&(e.remove(m),a.delete(p)),i.releaseStatesOfGeometry(p),p.isInstancedBufferGeometry===!0&&delete p._maxInstanceCount,n.memory.geometries--}function o(f,p){return r[p.id]===!0||(p.addEventListener("dispose",s),r[p.id]=!0,n.memory.geometries++),p}function l(f){const p=f.attributes;for(const y in p)e.update(p[y],t.ARRAY_BUFFER);const m=f.morphAttributes;for(const y in m){const b=m[y];for(let x=0,v=b.length;x<v;x++)e.update(b[x],t.ARRAY_BUFFER)}}function c(f){const p=[],m=f.index,y=f.attributes.position;let b=0;if(m!==null){const M=m.array;b=m.version;for(let w=0,E=M.length;w<E;w+=3){const T=M[w+0],P=M[w+1],R=M[w+2];p.push(T,P,P,R,R,T)}}else if(y!==void 0){const M=y.array;b=y.version;for(let w=0,E=M.length/3-1;w<E;w+=3){const T=w+0,P=w+1,R=w+2;p.push(T,P,P,R,R,T)}}else return;const x=new(g$(p)?M$:w$)(p,1);x.version=b;const v=a.get(f);v&&e.remove(v),a.set(f,x)}function d(f){const p=a.get(f);if(p){const m=f.index;m!==null&&p.version<m.version&&c(f)}else c(f);return a.get(f)}return{get:o,update:l,getWireframeAttribute:d}}function Vge(t,e,n,i){const r=i.isWebGL2;let a;function s(m){a=m}let o,l;function c(m){o=m.type,l=m.bytesPerElement}function d(m,y){t.drawElements(a,y,o,m*l),n.update(y,a,1)}function f(m,y,b){if(b===0)return;let x,v;if(r)x=t,v="drawElementsInstanced";else if(x=e.get("ANGLE_instanced_arrays"),v="drawElementsInstancedANGLE",x===null){console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");return}x[v](a,y,o,m*l,b),n.update(y,a,b)}function p(m,y,b){if(b===0)return;const x=e.get("WEBGL_multi_draw");if(x===null)for(let v=0;v<b;v++)this.render(m[v]/l,y[v]);else{x.multiDrawElementsWEBGL(a,y,0,o,m,0,b);let v=0;for(let M=0;M<b;M++)v+=y[M];n.update(v,a,1)}}this.setMode=s,this.setIndex=c,this.render=d,this.renderInstances=f,this.renderMultiDraw=p}function Gge(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 $ge(t,e){return t[0]-e[0]}function Wge(t,e){return Math.abs(e[1])-Math.abs(t[1])}function qge(t,e,n){const i={},r=new Float32Array(8),a=new WeakMap,s=new Un,o=[];for(let c=0;c<8;c++)o[c]=[c,0];function l(c,d,f){const p=c.morphTargetInfluences;if(e.isWebGL2===!0){const y=d.morphAttributes.position||d.morphAttributes.normal||d.morphAttributes.color,b=y!==void 0?y.length:0;let x=a.get(d);if(x===void 0||x.count!==b){let $=function(){W.dispose(),a.delete(d),d.removeEventListener("dispose",$)};var m=$;x!==void 0&&x.texture.dispose();const w=d.morphAttributes.position!==void 0,E=d.morphAttributes.normal!==void 0,T=d.morphAttributes.color!==void 0,P=d.morphAttributes.position||[],R=d.morphAttributes.normal||[],U=d.morphAttributes.color||[];let N=0;w===!0&&(N=1),E===!0&&(N=2),T===!0&&(N=3);let O=d.attributes.position.count*N,B=1;O>e.maxTextureSize&&(B=Math.ceil(O/e.maxTextureSize),O=e.maxTextureSize);const I=new Float32Array(O*B*4*b),W=new y$(I,O,B,b);W.type=zl,W.needsUpdate=!0;const L=N*4;for(let q=0;q<b;q++){const G=P[q],Y=R[q],Q=U[q],se=O*B*4*q;for(let H=0;H<G.count;H++){const X=H*L;w===!0&&(s.fromBufferAttribute(G,H),I[se+X+0]=s.x,I[se+X+1]=s.y,I[se+X+2]=s.z,I[se+X+3]=0),E===!0&&(s.fromBufferAttribute(Y,H),I[se+X+4]=s.x,I[se+X+5]=s.y,I[se+X+6]=s.z,I[se+X+7]=0),T===!0&&(s.fromBufferAttribute(Q,H),I[se+X+8]=s.x,I[se+X+9]=s.y,I[se+X+10]=s.z,I[se+X+11]=Q.itemSize===4?s.w:1)}}x={count:b,texture:W,size:new Vt(O,B)},a.set(d,x),d.addEventListener("dispose",$)}let v=0;for(let w=0;w<p.length;w++)v+=p[w];const M=d.morphTargetsRelative?1:1-v;f.getUniforms().setValue(t,"morphTargetBaseInfluence",M),f.getUniforms().setValue(t,"morphTargetInfluences",p),f.getUniforms().setValue(t,"morphTargetsTexture",x.texture,n),f.getUniforms().setValue(t,"morphTargetsTextureSize",x.size)}else{const y=p===void 0?0:p.length;let b=i[d.id];if(b===void 0||b.length!==y){b=[];for(let E=0;E<y;E++)b[E]=[E,0];i[d.id]=b}for(let E=0;E<y;E++){const T=b[E];T[0]=E,T[1]=p[E]}b.sort(Wge);for(let E=0;E<8;E++)E<y&&b[E][1]?(o[E][0]=b[E][0],o[E][1]=b[E][1]):(o[E][0]=Number.MAX_SAFE_INTEGER,o[E][1]=0);o.sort($ge);const x=d.morphAttributes.position,v=d.morphAttributes.normal;let M=0;for(let E=0;E<8;E++){const T=o[E],P=T[0],R=T[1];P!==Number.MAX_SAFE_INTEGER&&R?(x&&d.getAttribute("morphTarget"+E)!==x[P]&&d.setAttribute("morphTarget"+E,x[P]),v&&d.getAttribute("morphNormal"+E)!==v[P]&&d.setAttribute("morphNormal"+E,v[P]),r[E]=R,M+=R):(x&&d.hasAttribute("morphTarget"+E)===!0&&d.deleteAttribute("morphTarget"+E),v&&d.hasAttribute("morphNormal"+E)===!0&&d.deleteAttribute("morphNormal"+E),r[E]=0)}const w=d.morphTargetsRelative?1:1-M;f.getUniforms().setValue(t,"morphTargetBaseInfluence",w),f.getUniforms().setValue(t,"morphTargetInfluences",r)}}return{update:l}}function Xge(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 p=l.skeleton;r.get(p)!==c&&(p.update(),r.set(p,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 R$ extends Oa{constructor(e,n,i,r,a,s,o,l,c,d){if(d=d!==void 0?d:jd,d!==jd&&d!==Mp)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");i===void 0&&d===jd&&(i=pu),i===void 0&&d===Mp&&(i=Bd),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:Ur,this.minFilter=l!==void 0?l:Ur,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 N$=new Oa,P$=new R$(1,1);P$.compareFunction=p$;const D$=new y$,O$=new Dhe,L$=new T$,Oz=[],Lz=[],kz=new Float32Array(16),Iz=new Float32Array(9),Uz=new Float32Array(4);function Jp(t,e,n){const i=t[0];if(i<=0||i>0)return t;const r=e*n;let a=Oz[r];if(a===void 0&&(a=new Float32Array(r),Oz[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 ir(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 rr(t,e){for(let n=0,i=e.length;n<i;n++)t[n]=e[n]}function mS(t,e){let n=Lz[e];n===void 0&&(n=new Int32Array(e),Lz[e]=n);for(let i=0;i!==e;++i)n[i]=t.allocateTextureUnit();return n}function Yge(t,e){const n=this.cache;n[0]!==e&&(t.uniform1f(this.addr,e),n[0]=e)}function Kge(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(ir(n,e))return;t.uniform2fv(this.addr,e),rr(n,e)}}function Zge(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(ir(n,e))return;t.uniform3fv(this.addr,e),rr(n,e)}}function Jge(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(ir(n,e))return;t.uniform4fv(this.addr,e),rr(n,e)}}function Qge(t,e){const n=this.cache,i=e.elements;if(i===void 0){if(ir(n,e))return;t.uniformMatrix2fv(this.addr,!1,e),rr(n,e)}else{if(ir(n,i))return;Uz.set(i),t.uniformMatrix2fv(this.addr,!1,Uz),rr(n,i)}}function e0e(t,e){const n=this.cache,i=e.elements;if(i===void 0){if(ir(n,e))return;t.uniformMatrix3fv(this.addr,!1,e),rr(n,e)}else{if(ir(n,i))return;Iz.set(i),t.uniformMatrix3fv(this.addr,!1,Iz),rr(n,i)}}function t0e(t,e){const n=this.cache,i=e.elements;if(i===void 0){if(ir(n,e))return;t.uniformMatrix4fv(this.addr,!1,e),rr(n,e)}else{if(ir(n,i))return;kz.set(i),t.uniformMatrix4fv(this.addr,!1,kz),rr(n,i)}}function n0e(t,e){const n=this.cache;n[0]!==e&&(t.uniform1i(this.addr,e),n[0]=e)}function i0e(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(ir(n,e))return;t.uniform2iv(this.addr,e),rr(n,e)}}function r0e(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(ir(n,e))return;t.uniform3iv(this.addr,e),rr(n,e)}}function a0e(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(ir(n,e))return;t.uniform4iv(this.addr,e),rr(n,e)}}function s0e(t,e){const n=this.cache;n[0]!==e&&(t.uniform1ui(this.addr,e),n[0]=e)}function o0e(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(ir(n,e))return;t.uniform2uiv(this.addr,e),rr(n,e)}}function l0e(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(ir(n,e))return;t.uniform3uiv(this.addr,e),rr(n,e)}}function c0e(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(ir(n,e))return;t.uniform4uiv(this.addr,e),rr(n,e)}}function u0e(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?P$:N$;n.setTexture2D(e||a,r)}function d0e(t,e,n){const i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(t.uniform1i(this.addr,r),i[0]=r),n.setTexture3D(e||O$,r)}function f0e(t,e,n){const i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(t.uniform1i(this.addr,r),i[0]=r),n.setTextureCube(e||L$,r)}function h0e(t,e,n){const i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(t.uniform1i(this.addr,r),i[0]=r),n.setTexture2DArray(e||D$,r)}function p0e(t){switch(t){case 5126:return Yge;case 35664:return Kge;case 35665:return Zge;case 35666:return Jge;case 35674:return Qge;case 35675:return e0e;case 35676:return t0e;case 5124:case 35670:return n0e;case 35667:case 35671:return i0e;case 35668:case 35672:return r0e;case 35669:case 35673:return a0e;case 5125:return s0e;case 36294:return o0e;case 36295:return l0e;case 36296:return c0e;case 35678:case 36198:case 36298:case 36306:case 35682:return u0e;case 35679:case 36299:case 36307:return d0e;case 35680:case 36300:case 36308:case 36293:return f0e;case 36289:case 36303:case 36311:case 36292:return h0e}}function m0e(t,e){t.uniform1fv(this.addr,e)}function g0e(t,e){const n=Jp(e,this.size,2);t.uniform2fv(this.addr,n)}function v0e(t,e){const n=Jp(e,this.size,3);t.uniform3fv(this.addr,n)}function x0e(t,e){const n=Jp(e,this.size,4);t.uniform4fv(this.addr,n)}function y0e(t,e){const n=Jp(e,this.size,4);t.uniformMatrix2fv(this.addr,!1,n)}function b0e(t,e){const n=Jp(e,this.size,9);t.uniformMatrix3fv(this.addr,!1,n)}function _0e(t,e){const n=Jp(e,this.size,16);t.uniformMatrix4fv(this.addr,!1,n)}function S0e(t,e){t.uniform1iv(this.addr,e)}function w0e(t,e){t.uniform2iv(this.addr,e)}function M0e(t,e){t.uniform3iv(this.addr,e)}function E0e(t,e){t.uniform4iv(this.addr,e)}function A0e(t,e){t.uniform1uiv(this.addr,e)}function T0e(t,e){t.uniform2uiv(this.addr,e)}function C0e(t,e){t.uniform3uiv(this.addr,e)}function R0e(t,e){t.uniform4uiv(this.addr,e)}function N0e(t,e,n){const i=this.cache,r=e.length,a=mS(n,r);ir(i,a)||(t.uniform1iv(this.addr,a),rr(i,a));for(let s=0;s!==r;++s)n.setTexture2D(e[s]||N$,a[s])}function P0e(t,e,n){const i=this.cache,r=e.length,a=mS(n,r);ir(i,a)||(t.uniform1iv(this.addr,a),rr(i,a));for(let s=0;s!==r;++s)n.setTexture3D(e[s]||O$,a[s])}function D0e(t,e,n){const i=this.cache,r=e.length,a=mS(n,r);ir(i,a)||(t.uniform1iv(this.addr,a),rr(i,a));for(let s=0;s!==r;++s)n.setTextureCube(e[s]||L$,a[s])}function O0e(t,e,n){const i=this.cache,r=e.length,a=mS(n,r);ir(i,a)||(t.uniform1iv(this.addr,a),rr(i,a));for(let s=0;s!==r;++s)n.setTexture2DArray(e[s]||D$,a[s])}function L0e(t){switch(t){case 5126:return m0e;case 35664:return g0e;case 35665:return v0e;case 35666:return x0e;case 35674:return y0e;case 35675:return b0e;case 35676:return _0e;case 5124:case 35670:return S0e;case 35667:case 35671:return w0e;case 35668:case 35672:return M0e;case 35669:case 35673:return E0e;case 5125:return A0e;case 36294:return T0e;case 36295:return C0e;case 36296:return R0e;case 35678:case 36198:case 36298:case 36306:case 35682:return N0e;case 35679:case 36299:case 36307:return P0e;case 35680:case 36300:case 36308:case 36293:return D0e;case 36289:case 36303:case 36311:case 36292:return O0e}}class k0e{constructor(e,n,i){this.id=e,this.addr=i,this.cache=[],this.type=n.type,this.setValue=p0e(n.type)}}class I0e{constructor(e,n,i){this.id=e,this.addr=i,this.cache=[],this.type=n.type,this.size=n.size,this.setValue=L0e(n.type)}}class U0e{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 GA=/(\w+)(\])?(\[|\.)?/g;function Fz(t,e){t.seq.push(e),t.map[e.id]=e}function F0e(t,e,n){const i=t.name,r=i.length;for(GA.lastIndex=0;;){const a=GA.exec(i),s=GA.lastIndex;let o=a[1];const l=a[2]==="]",c=a[3];if(l&&(o=o|0),c===void 0||c==="["&&s+2===r){Fz(n,c===void 0?new k0e(o,t,e):new I0e(o,t,e));break}else{let f=n.map[o];f===void 0&&(f=new U0e(o),Fz(n,f)),n=f}}}class Fb{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);F0e(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 zz(t,e,n){const i=t.createShader(e);return t.shaderSource(i,n),t.compileShader(i),i}const z0e=37297;let B0e=0;function j0e(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 H0e(t){const e=kn.getPrimaries(kn.workingColorSpace),n=kn.getPrimaries(t);let i;switch(e===n?i="":e===d_&&n===u_?i="LinearDisplayP3ToLinearSRGB":e===u_&&n===d_&&(i="LinearSRGBToLinearDisplayP3"),t){case ec:case hS:return[i,"LinearTransferOETF"];case Fr:case ZN:return[i,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space:",t),[i,"LinearTransferOETF"]}}function Bz(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. `+j0e(t.getShaderSource(e),s)}else return r}function V0e(t,e){const n=H0e(e);return`vec4 ${t}( vec4 value ) { return ${n[0]}( ${n[1]}( value ) ); }`}function G0e(t,e){let n;switch(e){case Vfe:n="Linear";break;case Gfe:n="Reinhard";break;case $fe:n="OptimizedCineon";break;case Wfe:n="ACESFilmic";break;case qfe:n="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),n="Linear"}return"vec3 "+t+"( vec3 color ) { return "+n+"ToneMapping( color ); }"}function $0e(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(Og).join(`
  7346. `)}function W0e(t){const e=[];for(const n in t){const i=t[n];i!==!1&&e.push("#define "+n+" "+i)}return e.join(`
  7347. `)}function q0e(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 Og(t){return t!==""}function jz(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 Hz(t,e){return t.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const X0e=/^[ \t]*#include +<([\w\d./]+)>/gm;function NR(t){return t.replace(X0e,K0e)}const Y0e=new Map([["encodings_fragment","colorspace_fragment"],["encodings_pars_fragment","colorspace_pars_fragment"],["output_fragment","opaque_fragment"]]);function K0e(t,e){let n=Jt[e];if(n===void 0){const i=Y0e.get(e);if(i!==void 0)n=Jt[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 NR(n)}const Z0e=/#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 Vz(t){return t.replace(Z0e,J0e)}function J0e(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 Gz(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 Q0e(t){let e="SHADOWMAP_TYPE_BASIC";return t.shadowMapType===i$?e="SHADOWMAP_TYPE_PCF":t.shadowMapType===vfe?e="SHADOWMAP_TYPE_PCF_SOFT":t.shadowMapType===Rl&&(e="SHADOWMAP_TYPE_VSM"),e}function eve(t){let e="ENVMAP_TYPE_CUBE";if(t.envMap)switch(t.envMapMode){case Sp:case wp:e="ENVMAP_TYPE_CUBE";break;case fS:e="ENVMAP_TYPE_CUBE_UV";break}return e}function tve(t){let e="ENVMAP_MODE_REFLECTION";if(t.envMap)switch(t.envMapMode){case wp:e="ENVMAP_MODE_REFRACTION";break}return e}function nve(t){let e="ENVMAP_BLENDING_NONE";if(t.envMap)switch(t.combine){case YN:e="ENVMAP_BLENDING_MULTIPLY";break;case jfe:e="ENVMAP_BLENDING_MIX";break;case Hfe:e="ENVMAP_BLENDING_ADD";break}return e}function ive(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 rve(t,e,n,i){const r=t.getContext(),a=n.defines;let s=n.vertexShader,o=n.fragmentShader;const l=Q0e(n),c=eve(n),d=tve(n),f=nve(n),p=ive(n),m=n.isWebGL2?"":$0e(n),y=W0e(a),b=r.createProgram();let x,v,M=n.glslVersion?"#version "+n.glslVersion+`
  7352. `:"";n.isRawShaderMaterial?(x=["#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,y].filter(Og).join(`
  7353. `),x.length>0&&(x+=`
  7354. `),v=[m,"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,y].filter(Og).join(`
  7355. `),v.length>0&&(v+=`
  7356. `)):(x=[Gz(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(Og).join(`
  7358. `),v=[m,Gz(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:"",p?"#define CUBEUV_TEXEL_WIDTH "+p.texelWidth:"",p?"#define CUBEUV_TEXEL_HEIGHT "+p.texelHeight:"",p?"#define CUBEUV_MAX_MIP "+p.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!==Su?"#define TONE_MAPPING":"",n.toneMapping!==Su?Jt.tonemapping_pars_fragment:"",n.toneMapping!==Su?G0e("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",n.opaque?"#define OPAQUE":"",Jt.colorspace_pars_fragment,V0e("linearToOutputTexel",n.outputColorSpace),n.useDepthPacking?"#define DEPTH_PACKING "+n.depthPacking:"",`
  7359. `].filter(Og).join(`
  7360. `)),s=NR(s),s=jz(s,n),s=Hz(s,n),o=NR(o),o=jz(o,n),o=Hz(o,n),s=Vz(s),o=Vz(o),n.isWebGL2&&n.isRawShaderMaterial!==!0&&(M=`#version 300 es
  7361. `,x=["precision mediump sampler2DArray;","#define attribute in","#define varying out","#define texture2D texture"].join(`
  7362. `)+`
  7363. `+x,v=["precision mediump sampler2DArray;","#define varying in",n.glslVersion===lz?"":"layout(location = 0) out highp vec4 pc_fragColor;",n.glslVersion===lz?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join(`
  7364. `)+`
  7365. `+v);const w=M+x+s,E=M+v+o,T=zz(r,r.VERTEX_SHADER,w),P=zz(r,r.FRAGMENT_SHADER,E);r.attachShader(b,T),r.attachShader(b,P),n.index0AttributeName!==void 0?r.bindAttribLocation(b,0,n.index0AttributeName):n.morphTargets===!0&&r.bindAttribLocation(b,0,"position"),r.linkProgram(b);function R(B){if(t.debug.checkShaderErrors){const I=r.getProgramInfoLog(b).trim(),W=r.getShaderInfoLog(T).trim(),L=r.getShaderInfoLog(P).trim();let $=!0,q=!0;if(r.getProgramParameter(b,r.LINK_STATUS)===!1)if($=!1,typeof t.debug.onShaderError=="function")t.debug.onShaderError(r,b,T,P);else{const G=Bz(r,T,"vertex"),Y=Bz(r,P,"fragment");console.error("THREE.WebGLProgram: Shader Error "+r.getError()+" - VALIDATE_STATUS "+r.getProgramParameter(b,r.VALIDATE_STATUS)+`
  7366. Program Info Log: `+I+`
  7367. `+G+`
  7368. `+Y)}else I!==""?console.warn("THREE.WebGLProgram: Program Info Log:",I):(W===""||L==="")&&(q=!1);q&&(B.diagnostics={runnable:$,programLog:I,vertexShader:{log:W,prefix:x},fragmentShader:{log:L,prefix:v}})}r.deleteShader(T),r.deleteShader(P),U=new Fb(r,b),N=q0e(r,b)}let U;this.getUniforms=function(){return U===void 0&&R(this),U};let N;this.getAttributes=function(){return N===void 0&&R(this),N};let O=n.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return O===!1&&(O=r.getProgramParameter(b,z0e)),O},this.destroy=function(){i.releaseStatesOfProgram(this),r.deleteProgram(b),this.program=void 0},this.type=n.shaderType,this.name=n.shaderName,this.id=B0e++,this.cacheKey=e,this.usedTimes=1,this.program=b,this.vertexShader=T,this.fragmentShader=P,this}let ave=0;class sve{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 ove(e),n.set(e,i)),i}}class ove{constructor(e){this.id=ave++,this.code=e,this.usedTimes=0}}function lve(t,e,n,i,r,a,s){const o=new b$,l=new sve,c=[],d=r.isWebGL2,f=r.logarithmicDepthBuffer,p=r.vertexTextures;let m=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 b(N){return N===0?"uv":`uv${N}`}function x(N,O,B,I,W){const L=I.fog,$=W.geometry,q=N.isMeshStandardMaterial?I.environment:null,G=(N.isMeshStandardMaterial?n:e).get(N.envMap||q),Y=G&&G.mapping===fS?G.image.height:null,Q=y[N.type];N.precision!==null&&(m=r.getMaxPrecision(N.precision),m!==N.precision&&console.warn("THREE.WebGLProgram.getParameters:",N.precision,"not supported, using",m,"instead."));const se=$.morphAttributes.position||$.morphAttributes.normal||$.morphAttributes.color,H=se!==void 0?se.length:0;let X=0;$.morphAttributes.position!==void 0&&(X=1),$.morphAttributes.normal!==void 0&&(X=2),$.morphAttributes.color!==void 0&&(X=3);let re,ce,ye,me;if(Q){const tn=Ca[Q];re=tn.vertexShader,ce=tn.fragmentShader}else re=N.vertexShader,ce=N.fragmentShader,l.update(N),ye=l.getVertexShaderID(N),me=l.getFragmentShaderID(N);const be=t.getRenderTarget(),De=W.isInstancedMesh===!0,he=W.isBatchedMesh===!0,Ae=!!N.map,Be=!!N.matcap,le=!!G,ut=!!N.aoMap,z=!!N.lightMap,V=!!N.bumpMap,ne=!!N.normalMap,J=!!N.displacementMap,ee=!!N.emissiveMap,ae=!!N.metalnessMap,ie=!!N.roughnessMap,we=N.anisotropy>0,ve=N.clearcoat>0,F=N.iridescence>0,k=N.sheen>0,K=N.transmission>0,pe=we&&!!N.anisotropyMap,xe=ve&&!!N.clearcoatMap,fe=ve&&!!N.clearcoatNormalMap,Ke=ve&&!!N.clearcoatRoughnessMap,ke=F&&!!N.iridescenceMap,$e=F&&!!N.iridescenceThicknessMap,rt=k&&!!N.sheenColorMap,Ue=k&&!!N.sheenRoughnessMap,Pe=!!N.specularMap,dt=!!N.specularColorMap,et=!!N.specularIntensityMap,Qe=K&&!!N.transmissionMap,st=K&&!!N.thicknessMap,ue=!!N.gradientMap,tt=!!N.alphaMap,de=N.alphaTest>0,Le=!!N.alphaHash,Ee=!!N.extensions,ge=!!$.attributes.uv1,je=!!$.attributes.uv2,at=!!$.attributes.uv3;let yt=Su;return N.toneMapped&&(be===null||be.isXRRenderTarget===!0)&&(yt=t.toneMapping),{isWebGL2:d,shaderID:Q,shaderType:N.type,shaderName:N.name,vertexShader:re,fragmentShader:ce,defines:N.defines,customVertexShaderID:ye,customFragmentShaderID:me,isRawShaderMaterial:N.isRawShaderMaterial===!0,glslVersion:N.glslVersion,precision:m,batching:he,instancing:De,instancingColor:De&&W.instanceColor!==null,supportsVertexTextures:p,outputColorSpace:be===null?t.outputColorSpace:be.isXRRenderTarget===!0?be.texture.colorSpace:ec,map:Ae,matcap:Be,envMap:le,envMapMode:le&&G.mapping,envMapCubeUVHeight:Y,aoMap:ut,lightMap:z,bumpMap:V,normalMap:ne,displacementMap:p&&J,emissiveMap:ee,normalMapObjectSpace:ne&&N.normalMapType===ahe,normalMapTangentSpace:ne&&N.normalMapType===h$,metalnessMap:ae,roughnessMap:ie,anisotropy:we,anisotropyMap:pe,clearcoat:ve,clearcoatMap:xe,clearcoatNormalMap:fe,clearcoatRoughnessMap:Ke,iridescence:F,iridescenceMap:ke,iridescenceThicknessMap:$e,sheen:k,sheenColorMap:rt,sheenRoughnessMap:Ue,specularMap:Pe,specularColorMap:dt,specularIntensityMap:et,transmission:K,transmissionMap:Qe,thicknessMap:st,gradientMap:ue,opaque:N.transparent===!1&&N.blending===op,alphaMap:tt,alphaTest:de,alphaHash:Le,combine:N.combine,mapUv:Ae&&b(N.map.channel),aoMapUv:ut&&b(N.aoMap.channel),lightMapUv:z&&b(N.lightMap.channel),bumpMapUv:V&&b(N.bumpMap.channel),normalMapUv:ne&&b(N.normalMap.channel),displacementMapUv:J&&b(N.displacementMap.channel),emissiveMapUv:ee&&b(N.emissiveMap.channel),metalnessMapUv:ae&&b(N.metalnessMap.channel),roughnessMapUv:ie&&b(N.roughnessMap.channel),anisotropyMapUv:pe&&b(N.anisotropyMap.channel),clearcoatMapUv:xe&&b(N.clearcoatMap.channel),clearcoatNormalMapUv:fe&&b(N.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:Ke&&b(N.clearcoatRoughnessMap.channel),iridescenceMapUv:ke&&b(N.iridescenceMap.channel),iridescenceThicknessMapUv:$e&&b(N.iridescenceThicknessMap.channel),sheenColorMapUv:rt&&b(N.sheenColorMap.channel),sheenRoughnessMapUv:Ue&&b(N.sheenRoughnessMap.channel),specularMapUv:Pe&&b(N.specularMap.channel),specularColorMapUv:dt&&b(N.specularColorMap.channel),specularIntensityMapUv:et&&b(N.specularIntensityMap.channel),transmissionMapUv:Qe&&b(N.transmissionMap.channel),thicknessMapUv:st&&b(N.thicknessMap.channel),alphaMapUv:tt&&b(N.alphaMap.channel),vertexTangents:!!$.attributes.tangent&&(ne||we),vertexColors:N.vertexColors,vertexAlphas:N.vertexColors===!0&&!!$.attributes.color&&$.attributes.color.itemSize===4,vertexUv1s:ge,vertexUv2s:je,vertexUv3s:at,pointsUvs:W.isPoints===!0&&!!$.attributes.uv&&(Ae||tt),fog:!!L,useFog:N.fog===!0,fogExp2:L&&L.isFogExp2,flatShading:N.flatShading===!0,sizeAttenuation:N.sizeAttenuation===!0,logarithmicDepthBuffer:f,skinning:W.isSkinnedMesh===!0,morphTargets:$.morphAttributes.position!==void 0,morphNormals:$.morphAttributes.normal!==void 0,morphColors:$.morphAttributes.color!==void 0,morphTargetsCount:H,morphTextureStride:X,numDirLights:O.directional.length,numPointLights:O.point.length,numSpotLights:O.spot.length,numSpotLightMaps:O.spotLightMap.length,numRectAreaLights:O.rectArea.length,numHemiLights:O.hemi.length,numDirLightShadows:O.directionalShadowMap.length,numPointLightShadows:O.pointShadowMap.length,numSpotLightShadows:O.spotShadowMap.length,numSpotLightShadowsWithMaps:O.numSpotLightShadowsWithMaps,numLightProbes:O.numLightProbes,numClippingPlanes:s.numPlanes,numClipIntersection:s.numIntersection,dithering:N.dithering,shadowMapEnabled:t.shadowMap.enabled&&B.length>0,shadowMapType:t.shadowMap.type,toneMapping:yt,useLegacyLights:t._useLegacyLights,decodeVideoTexture:Ae&&N.map.isVideoTexture===!0&&kn.getTransfer(N.map.colorSpace)===Kn,premultipliedAlpha:N.premultipliedAlpha,doubleSided:N.side===Ol,flipSided:N.side===Da,useDepthPacking:N.depthPacking>=0,depthPacking:N.depthPacking||0,index0AttributeName:N.index0AttributeName,extensionDerivatives:Ee&&N.extensions.derivatives===!0,extensionFragDepth:Ee&&N.extensions.fragDepth===!0,extensionDrawBuffers:Ee&&N.extensions.drawBuffers===!0,extensionShaderTextureLOD:Ee&&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 v(N){const O=[];if(N.shaderID?O.push(N.shaderID):(O.push(N.customVertexShaderID),O.push(N.customFragmentShaderID)),N.defines!==void 0)for(const B in N.defines)O.push(B),O.push(N.defines[B]);return N.isRawShaderMaterial===!1&&(M(O,N),w(O,N),O.push(t.outputColorSpace)),O.push(N.customProgramCacheKey),O.join()}function M(N,O){N.push(O.precision),N.push(O.outputColorSpace),N.push(O.envMapMode),N.push(O.envMapCubeUVHeight),N.push(O.mapUv),N.push(O.alphaMapUv),N.push(O.lightMapUv),N.push(O.aoMapUv),N.push(O.bumpMapUv),N.push(O.normalMapUv),N.push(O.displacementMapUv),N.push(O.emissiveMapUv),N.push(O.metalnessMapUv),N.push(O.roughnessMapUv),N.push(O.anisotropyMapUv),N.push(O.clearcoatMapUv),N.push(O.clearcoatNormalMapUv),N.push(O.clearcoatRoughnessMapUv),N.push(O.iridescenceMapUv),N.push(O.iridescenceThicknessMapUv),N.push(O.sheenColorMapUv),N.push(O.sheenRoughnessMapUv),N.push(O.specularMapUv),N.push(O.specularColorMapUv),N.push(O.specularIntensityMapUv),N.push(O.transmissionMapUv),N.push(O.thicknessMapUv),N.push(O.combine),N.push(O.fogExp2),N.push(O.sizeAttenuation),N.push(O.morphTargetsCount),N.push(O.morphAttributeCount),N.push(O.numDirLights),N.push(O.numPointLights),N.push(O.numSpotLights),N.push(O.numSpotLightMaps),N.push(O.numHemiLights),N.push(O.numRectAreaLights),N.push(O.numDirLightShadows),N.push(O.numPointLightShadows),N.push(O.numSpotLightShadows),N.push(O.numSpotLightShadowsWithMaps),N.push(O.numLightProbes),N.push(O.shadowMapType),N.push(O.toneMapping),N.push(O.numClippingPlanes),N.push(O.numClipIntersection),N.push(O.depthPacking)}function w(N,O){o.disableAll(),O.isWebGL2&&o.enable(0),O.supportsVertexTextures&&o.enable(1),O.instancing&&o.enable(2),O.instancingColor&&o.enable(3),O.matcap&&o.enable(4),O.envMap&&o.enable(5),O.normalMapObjectSpace&&o.enable(6),O.normalMapTangentSpace&&o.enable(7),O.clearcoat&&o.enable(8),O.iridescence&&o.enable(9),O.alphaTest&&o.enable(10),O.vertexColors&&o.enable(11),O.vertexAlphas&&o.enable(12),O.vertexUv1s&&o.enable(13),O.vertexUv2s&&o.enable(14),O.vertexUv3s&&o.enable(15),O.vertexTangents&&o.enable(16),O.anisotropy&&o.enable(17),O.alphaHash&&o.enable(18),O.batching&&o.enable(19),N.push(o.mask),o.disableAll(),O.fog&&o.enable(0),O.useFog&&o.enable(1),O.flatShading&&o.enable(2),O.logarithmicDepthBuffer&&o.enable(3),O.skinning&&o.enable(4),O.morphTargets&&o.enable(5),O.morphNormals&&o.enable(6),O.morphColors&&o.enable(7),O.premultipliedAlpha&&o.enable(8),O.shadowMapEnabled&&o.enable(9),O.useLegacyLights&&o.enable(10),O.doubleSided&&o.enable(11),O.flipSided&&o.enable(12),O.useDepthPacking&&o.enable(13),O.dithering&&o.enable(14),O.transmission&&o.enable(15),O.sheen&&o.enable(16),O.opaque&&o.enable(17),O.pointsUvs&&o.enable(18),O.decodeVideoTexture&&o.enable(19),N.push(o.mask)}function E(N){const O=y[N.type];let B;if(O){const I=Ca[O];B=eP.clone(I.uniforms)}else B=N.uniforms;return B}function T(N,O){let B;for(let I=0,W=c.length;I<W;I++){const L=c[I];if(L.cacheKey===O){B=L,++B.usedTimes;break}}return B===void 0&&(B=new rve(t,O,N,a),c.push(B)),B}function P(N){if(--N.usedTimes===0){const O=c.indexOf(N);c[O]=c[c.length-1],c.pop(),N.destroy()}}function R(N){l.remove(N)}function U(){l.dispose()}return{getParameters:x,getProgramCacheKey:v,getUniforms:E,acquireProgram:T,releaseProgram:P,releaseShaderCache:R,programs:c,dispose:U}}function cve(){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 uve(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 $z(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 Wz(){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,p,m,y,b,x){let v=t[e];return v===void 0?(v={id:f.id,object:f,geometry:p,material:m,groupOrder:y,renderOrder:f.renderOrder,z:b,group:x},t[e]=v):(v.id=f.id,v.object=f,v.geometry=p,v.material=m,v.groupOrder=y,v.renderOrder=f.renderOrder,v.z=b,v.group=x),e++,v}function o(f,p,m,y,b,x){const v=s(f,p,m,y,b,x);m.transmission>0?i.push(v):m.transparent===!0?r.push(v):n.push(v)}function l(f,p,m,y,b,x){const v=s(f,p,m,y,b,x);m.transmission>0?i.unshift(v):m.transparent===!0?r.unshift(v):n.unshift(v)}function c(f,p){n.length>1&&n.sort(f||uve),i.length>1&&i.sort(p||$z),r.length>1&&r.sort(p||$z)}function d(){for(let f=e,p=t.length;f<p;f++){const m=t[f];if(m.id===null)break;m.id=null,m.object=null,m.geometry=null,m.material=null,m.group=null}}return{opaque:n,transmissive:i,transparent:r,init:a,push:o,unshift:l,finish:d,sort:c}}function dve(){let t=new WeakMap;function e(i,r){const a=t.get(i);let s;return a===void 0?(s=new Wz,t.set(i,[s])):r>=a.length?(s=new Wz,a.push(s)):s=a[r],s}function n(){t=new WeakMap}return{get:e,dispose:n}}function fve(){const t={};return{get:function(e){if(t[e.id]!==void 0)return t[e.id];let n;switch(e.type){case"DirectionalLight":n={direction:new Ce,color:new Ut};break;case"SpotLight":n={position:new Ce,direction:new Ce,color:new Ut,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new Ce,color:new Ut,distance:0,decay:0};break;case"HemisphereLight":n={direction:new Ce,skyColor:new Ut,groundColor:new Ut};break;case"RectAreaLight":n={color:new Ut,position:new Ce,halfWidth:new Ce,halfHeight:new Ce};break}return t[e.id]=n,n}}}function hve(){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 Vt};break;case"SpotLight":n={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Vt};break;case"PointLight":n={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Vt,shadowCameraNear:1,shadowCameraFar:1e3};break}return t[e.id]=n,n}}}let pve=0;function mve(t,e){return(e.castShadow?2:0)-(t.castShadow?2:0)+(e.map?1:0)-(t.map?1:0)}function gve(t,e){const n=new fve,i=hve(),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 Ce);const a=new Ce,s=new Wn,o=new Wn;function l(d,f){let p=0,m=0,y=0;for(let I=0;I<9;I++)r.probe[I].set(0,0,0);let b=0,x=0,v=0,M=0,w=0,E=0,T=0,P=0,R=0,U=0,N=0;d.sort(mve);const O=f===!0?Math.PI:1;for(let I=0,W=d.length;I<W;I++){const L=d[I],$=L.color,q=L.intensity,G=L.distance,Y=L.shadow&&L.shadow.map?L.shadow.map.texture:null;if(L.isAmbientLight)p+=$.r*q*O,m+=$.g*q*O,y+=$.b*q*O;else if(L.isLightProbe){for(let Q=0;Q<9;Q++)r.probe[Q].addScaledVector(L.sh.coefficients[Q],q);N++}else if(L.isDirectionalLight){const Q=n.get(L);if(Q.color.copy(L.color).multiplyScalar(L.intensity*O),L.castShadow){const se=L.shadow,H=i.get(L);H.shadowBias=se.bias,H.shadowNormalBias=se.normalBias,H.shadowRadius=se.radius,H.shadowMapSize=se.mapSize,r.directionalShadow[b]=H,r.directionalShadowMap[b]=Y,r.directionalShadowMatrix[b]=L.shadow.matrix,E++}r.directional[b]=Q,b++}else if(L.isSpotLight){const Q=n.get(L);Q.position.setFromMatrixPosition(L.matrixWorld),Q.color.copy($).multiplyScalar(q*O),Q.distance=G,Q.coneCos=Math.cos(L.angle),Q.penumbraCos=Math.cos(L.angle*(1-L.penumbra)),Q.decay=L.decay,r.spot[v]=Q;const se=L.shadow;if(L.map&&(r.spotLightMap[R]=L.map,R++,se.updateMatrices(L),L.castShadow&&U++),r.spotLightMatrix[v]=se.matrix,L.castShadow){const H=i.get(L);H.shadowBias=se.bias,H.shadowNormalBias=se.normalBias,H.shadowRadius=se.radius,H.shadowMapSize=se.mapSize,r.spotShadow[v]=H,r.spotShadowMap[v]=Y,P++}v++}else if(L.isRectAreaLight){const Q=n.get(L);Q.color.copy($).multiplyScalar(q),Q.halfWidth.set(L.width*.5,0,0),Q.halfHeight.set(0,L.height*.5,0),r.rectArea[M]=Q,M++}else if(L.isPointLight){const Q=n.get(L);if(Q.color.copy(L.color).multiplyScalar(L.intensity*O),Q.distance=L.distance,Q.decay=L.decay,L.castShadow){const se=L.shadow,H=i.get(L);H.shadowBias=se.bias,H.shadowNormalBias=se.normalBias,H.shadowRadius=se.radius,H.shadowMapSize=se.mapSize,H.shadowCameraNear=se.camera.near,H.shadowCameraFar=se.camera.far,r.pointShadow[x]=H,r.pointShadowMap[x]=Y,r.pointShadowMatrix[x]=L.shadow.matrix,T++}r.point[x]=Q,x++}else if(L.isHemisphereLight){const Q=n.get(L);Q.skyColor.copy(L.color).multiplyScalar(q*O),Q.groundColor.copy(L.groundColor).multiplyScalar(q*O),r.hemi[w]=Q,w++}}M>0&&(e.isWebGL2||t.has("OES_texture_float_linear")===!0?(r.rectAreaLTC1=gt.LTC_FLOAT_1,r.rectAreaLTC2=gt.LTC_FLOAT_2):t.has("OES_texture_half_float_linear")===!0?(r.rectAreaLTC1=gt.LTC_HALF_1,r.rectAreaLTC2=gt.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),r.ambient[0]=p,r.ambient[1]=m,r.ambient[2]=y;const B=r.hash;(B.directionalLength!==b||B.pointLength!==x||B.spotLength!==v||B.rectAreaLength!==M||B.hemiLength!==w||B.numDirectionalShadows!==E||B.numPointShadows!==T||B.numSpotShadows!==P||B.numSpotMaps!==R||B.numLightProbes!==N)&&(r.directional.length=b,r.spot.length=v,r.rectArea.length=M,r.point.length=x,r.hemi.length=w,r.directionalShadow.length=E,r.directionalShadowMap.length=E,r.pointShadow.length=T,r.pointShadowMap.length=T,r.spotShadow.length=P,r.spotShadowMap.length=P,r.directionalShadowMatrix.length=E,r.pointShadowMatrix.length=T,r.spotLightMatrix.length=P+R-U,r.spotLightMap.length=R,r.numSpotLightShadowsWithMaps=U,r.numLightProbes=N,B.directionalLength=b,B.pointLength=x,B.spotLength=v,B.rectAreaLength=M,B.hemiLength=w,B.numDirectionalShadows=E,B.numPointShadows=T,B.numSpotShadows=P,B.numSpotMaps=R,B.numLightProbes=N,r.version=pve++)}function c(d,f){let p=0,m=0,y=0,b=0,x=0;const v=f.matrixWorldInverse;for(let M=0,w=d.length;M<w;M++){const E=d[M];if(E.isDirectionalLight){const T=r.directional[p];T.direction.setFromMatrixPosition(E.matrixWorld),a.setFromMatrixPosition(E.target.matrixWorld),T.direction.sub(a),T.direction.transformDirection(v),p++}else if(E.isSpotLight){const T=r.spot[y];T.position.setFromMatrixPosition(E.matrixWorld),T.position.applyMatrix4(v),T.direction.setFromMatrixPosition(E.matrixWorld),a.setFromMatrixPosition(E.target.matrixWorld),T.direction.sub(a),T.direction.transformDirection(v),y++}else if(E.isRectAreaLight){const T=r.rectArea[b];T.position.setFromMatrixPosition(E.matrixWorld),T.position.applyMatrix4(v),o.identity(),s.copy(E.matrixWorld),s.premultiply(v),o.extractRotation(s),T.halfWidth.set(E.width*.5,0,0),T.halfHeight.set(0,E.height*.5,0),T.halfWidth.applyMatrix4(o),T.halfHeight.applyMatrix4(o),b++}else if(E.isPointLight){const T=r.point[m];T.position.setFromMatrixPosition(E.matrixWorld),T.position.applyMatrix4(v),m++}else if(E.isHemisphereLight){const T=r.hemi[x];T.direction.setFromMatrixPosition(E.matrixWorld),T.direction.transformDirection(v),x++}}}return{setup:l,setupView:c,state:r}}function qz(t,e){const n=new gve(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 vve(t,e){let n=new WeakMap;function i(a,s=0){const o=n.get(a);let l;return o===void 0?(l=new qz(t,e),n.set(a,[l])):s>=o.length?(l=new qz(t,e),o.push(l)):l=o[s],l}function r(){n=new WeakMap}return{get:i,dispose:r}}class xve extends Zp{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=ihe,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 yve extends Zp{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 bve=`void main() {
  7369. gl_Position = vec4( position, 1.0 );
  7370. }`,_ve=`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 Sve(t,e,n){let i=new pS;const r=new Vt,a=new Vt,s=new Un,o=new xve({depthPacking:rhe}),l=new yve,c={},d=n.maxTextureSize,f={[Pu]:Da,[Da]:Pu,[Ol]:Ol},p=new Du({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Vt},radius:{value:4}},vertexShader:bve,fragmentShader:_ve}),m=p.clone();m.defines.HORIZONTAL_PASS=1;const y=new na;y.setAttribute("position",new is(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const b=new co(y,p),x=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=i$;let v=this.type;this.render=function(T,P,R){if(x.enabled===!1||x.autoUpdate===!1&&x.needsUpdate===!1||T.length===0)return;const U=t.getRenderTarget(),N=t.getActiveCubeFace(),O=t.getActiveMipmapLevel(),B=t.state;B.setBlending(_u),B.buffers.color.setClear(1,1,1,1),B.buffers.depth.setTest(!0),B.setScissorTest(!1);const I=v!==Rl&&this.type===Rl,W=v===Rl&&this.type!==Rl;for(let L=0,$=T.length;L<$;L++){const q=T[L],G=q.shadow;if(G===void 0){console.warn("THREE.WebGLShadowMap:",q,"has no shadow.");continue}if(G.autoUpdate===!1&&G.needsUpdate===!1)continue;r.copy(G.mapSize);const Y=G.getFrameExtents();if(r.multiply(Y),a.copy(G.mapSize),(r.x>d||r.y>d)&&(r.x>d&&(a.x=Math.floor(d/Y.x),r.x=a.x*Y.x,G.mapSize.x=a.x),r.y>d&&(a.y=Math.floor(d/Y.y),r.y=a.y*Y.y,G.mapSize.y=a.y)),G.map===null||I===!0||W===!0){const se=this.type!==Rl?{minFilter:Ur,magFilter:Ur}:{};G.map!==null&&G.map.dispose(),G.map=new cf(r.x,r.y,se),G.map.texture.name=q.name+".shadowMap",G.camera.updateProjectionMatrix()}t.setRenderTarget(G.map),t.clear();const Q=G.getViewportCount();for(let se=0;se<Q;se++){const H=G.getViewport(se);s.set(a.x*H.x,a.y*H.y,a.x*H.z,a.y*H.w),B.viewport(s),G.updateMatrices(q,se),i=G.getFrustum(),E(P,R,G.camera,q,this.type)}G.isPointLightShadow!==!0&&this.type===Rl&&M(G,R),G.needsUpdate=!1}v=this.type,x.needsUpdate=!1,t.setRenderTarget(U,N,O)};function M(T,P){const R=e.update(b);p.defines.VSM_SAMPLES!==T.blurSamples&&(p.defines.VSM_SAMPLES=T.blurSamples,m.defines.VSM_SAMPLES=T.blurSamples,p.needsUpdate=!0,m.needsUpdate=!0),T.mapPass===null&&(T.mapPass=new cf(r.x,r.y)),p.uniforms.shadow_pass.value=T.map.texture,p.uniforms.resolution.value=T.mapSize,p.uniforms.radius.value=T.radius,t.setRenderTarget(T.mapPass),t.clear(),t.renderBufferDirect(P,null,R,p,b,null),m.uniforms.shadow_pass.value=T.mapPass.texture,m.uniforms.resolution.value=T.mapSize,m.uniforms.radius.value=T.radius,t.setRenderTarget(T.map),t.clear(),t.renderBufferDirect(P,null,R,m,b,null)}function w(T,P,R,U){let N=null;const O=R.isPointLight===!0?T.customDistanceMaterial:T.customDepthMaterial;if(O!==void 0)N=O;else if(N=R.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 B=N.uuid,I=P.uuid;let W=c[B];W===void 0&&(W={},c[B]=W);let L=W[I];L===void 0&&(L=N.clone(),W[I]=L),N=L}if(N.visible=P.visible,N.wireframe=P.wireframe,U===Rl?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,R.isPointLight===!0&&N.isMeshDistanceMaterial===!0){const B=t.properties.get(N);B.light=R}return N}function E(T,P,R,U,N){if(T.visible===!1)return;if(T.layers.test(P.layers)&&(T.isMesh||T.isLine||T.isPoints)&&(T.castShadow||T.receiveShadow&&N===Rl)&&(!T.frustumCulled||i.intersectsObject(T))){T.modelViewMatrix.multiplyMatrices(R.matrixWorldInverse,T.matrixWorld);const I=e.update(T),W=T.material;if(Array.isArray(W)){const L=I.groups;for(let $=0,q=L.length;$<q;$++){const G=L[$],Y=W[G.materialIndex];if(Y&&Y.visible){const Q=w(T,Y,U,N);T.onBeforeShadow(t,T,P,R,I,Q,G),t.renderBufferDirect(R,null,I,Q,T,G),T.onAfterShadow(t,T,P,R,I,Q,G)}}}else if(W.visible){const L=w(T,W,U,N);T.onBeforeShadow(t,T,P,R,I,L,null),t.renderBufferDirect(R,null,I,L,T,null),T.onAfterShadow(t,T,P,R,I,L,null)}}const B=T.children;for(let I=0,W=B.length;I<W;I++)E(B[I],P,R,U,N)}}function wve(t,e,n){const i=n.isWebGL2;function r(){let de=!1;const Le=new Un;let Ee=null;const ge=new Un(0,0,0,0);return{setMask:function(je){Ee!==je&&!de&&(t.colorMask(je,je,je,je),Ee=je)},setLocked:function(je){de=je},setClear:function(je,at,yt,Ct,tn){tn===!0&&(je*=Ct,at*=Ct,yt*=Ct),Le.set(je,at,yt,Ct),ge.equals(Le)===!1&&(t.clearColor(je,at,yt,Ct),ge.copy(Le))},reset:function(){de=!1,Ee=null,ge.set(-1,0,0,0)}}}function a(){let de=!1,Le=null,Ee=null,ge=null;return{setTest:function(je){je?he(t.DEPTH_TEST):Ae(t.DEPTH_TEST)},setMask:function(je){Le!==je&&!de&&(t.depthMask(je),Le=je)},setFunc:function(je){if(Ee!==je){switch(je){case Lfe:t.depthFunc(t.NEVER);break;case kfe:t.depthFunc(t.ALWAYS);break;case Ife:t.depthFunc(t.LESS);break;case l_:t.depthFunc(t.LEQUAL);break;case Ufe:t.depthFunc(t.EQUAL);break;case Ffe:t.depthFunc(t.GEQUAL);break;case zfe:t.depthFunc(t.GREATER);break;case Bfe:t.depthFunc(t.NOTEQUAL);break;default:t.depthFunc(t.LEQUAL)}Ee=je}},setLocked:function(je){de=je},setClear:function(je){ge!==je&&(t.clearDepth(je),ge=je)},reset:function(){de=!1,Le=null,Ee=null,ge=null}}}function s(){let de=!1,Le=null,Ee=null,ge=null,je=null,at=null,yt=null,Ct=null,tn=null;return{setTest:function(Pt){de||(Pt?he(t.STENCIL_TEST):Ae(t.STENCIL_TEST))},setMask:function(Pt){Le!==Pt&&!de&&(t.stencilMask(Pt),Le=Pt)},setFunc:function(Pt,wn,zn){(Ee!==Pt||ge!==wn||je!==zn)&&(t.stencilFunc(Pt,wn,zn),Ee=Pt,ge=wn,je=zn)},setOp:function(Pt,wn,zn){(at!==Pt||yt!==wn||Ct!==zn)&&(t.stencilOp(Pt,wn,zn),at=Pt,yt=wn,Ct=zn)},setLocked:function(Pt){de=Pt},setClear:function(Pt){tn!==Pt&&(t.clearStencil(Pt),tn=Pt)},reset:function(){de=!1,Le=null,Ee=null,ge=null,je=null,at=null,yt=null,Ct=null,tn=null}}}const o=new r,l=new a,c=new s,d=new WeakMap,f=new WeakMap;let p={},m={},y=new WeakMap,b=[],x=null,v=!1,M=null,w=null,E=null,T=null,P=null,R=null,U=null,N=new Ut(0,0,0),O=0,B=!1,I=null,W=null,L=null,$=null,q=null;const G=t.getParameter(t.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let Y=!1,Q=0;const se=t.getParameter(t.VERSION);se.indexOf("WebGL")!==-1?(Q=parseFloat(/^WebGL (\d)/.exec(se)[1]),Y=Q>=1):se.indexOf("OpenGL ES")!==-1&&(Q=parseFloat(/^OpenGL ES (\d)/.exec(se)[1]),Y=Q>=2);let H=null,X={};const re=t.getParameter(t.SCISSOR_BOX),ce=t.getParameter(t.VIEWPORT),ye=new Un().fromArray(re),me=new Un().fromArray(ce);function be(de,Le,Ee,ge){const je=new Uint8Array(4),at=t.createTexture();t.bindTexture(de,at),t.texParameteri(de,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(de,t.TEXTURE_MAG_FILTER,t.NEAREST);for(let yt=0;yt<Ee;yt++)i&&(de===t.TEXTURE_3D||de===t.TEXTURE_2D_ARRAY)?t.texImage3D(Le,0,t.RGBA,1,1,ge,0,t.RGBA,t.UNSIGNED_BYTE,je):t.texImage2D(Le+yt,0,t.RGBA,1,1,0,t.RGBA,t.UNSIGNED_BYTE,je);return at}const De={};De[t.TEXTURE_2D]=be(t.TEXTURE_2D,t.TEXTURE_2D,1),De[t.TEXTURE_CUBE_MAP]=be(t.TEXTURE_CUBE_MAP,t.TEXTURE_CUBE_MAP_POSITIVE_X,6),i&&(De[t.TEXTURE_2D_ARRAY]=be(t.TEXTURE_2D_ARRAY,t.TEXTURE_2D_ARRAY,1,1),De[t.TEXTURE_3D]=be(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(l_),ee(!1),ae(RF),he(t.CULL_FACE),ne(_u);function he(de){p[de]!==!0&&(t.enable(de),p[de]=!0)}function Ae(de){p[de]!==!1&&(t.disable(de),p[de]=!1)}function Be(de,Le){return m[de]!==Le?(t.bindFramebuffer(de,Le),m[de]=Le,i&&(de===t.DRAW_FRAMEBUFFER&&(m[t.FRAMEBUFFER]=Le),de===t.FRAMEBUFFER&&(m[t.DRAW_FRAMEBUFFER]=Le)),!0):!1}function le(de,Le){let Ee=b,ge=!1;if(de)if(Ee=y.get(Le),Ee===void 0&&(Ee=[],y.set(Le,Ee)),de.isWebGLMultipleRenderTargets){const je=de.texture;if(Ee.length!==je.length||Ee[0]!==t.COLOR_ATTACHMENT0){for(let at=0,yt=je.length;at<yt;at++)Ee[at]=t.COLOR_ATTACHMENT0+at;Ee.length=je.length,ge=!0}}else Ee[0]!==t.COLOR_ATTACHMENT0&&(Ee[0]=t.COLOR_ATTACHMENT0,ge=!0);else Ee[0]!==t.BACK&&(Ee[0]=t.BACK,ge=!0);ge&&(n.isWebGL2?t.drawBuffers(Ee):e.get("WEBGL_draw_buffers").drawBuffersWEBGL(Ee))}function ut(de){return x!==de?(t.useProgram(de),x=de,!0):!1}const z={[Td]:t.FUNC_ADD,[yfe]:t.FUNC_SUBTRACT,[bfe]:t.FUNC_REVERSE_SUBTRACT};if(i)z[OF]=t.MIN,z[LF]=t.MAX;else{const de=e.get("EXT_blend_minmax");de!==null&&(z[OF]=de.MIN_EXT,z[LF]=de.MAX_EXT)}const V={[_fe]:t.ZERO,[Sfe]:t.ONE,[wfe]:t.SRC_COLOR,[_R]:t.SRC_ALPHA,[Rfe]:t.SRC_ALPHA_SATURATE,[Tfe]:t.DST_COLOR,[Efe]:t.DST_ALPHA,[Mfe]:t.ONE_MINUS_SRC_COLOR,[SR]:t.ONE_MINUS_SRC_ALPHA,[Cfe]:t.ONE_MINUS_DST_COLOR,[Afe]:t.ONE_MINUS_DST_ALPHA,[Nfe]:t.CONSTANT_COLOR,[Pfe]:t.ONE_MINUS_CONSTANT_COLOR,[Dfe]:t.CONSTANT_ALPHA,[Ofe]:t.ONE_MINUS_CONSTANT_ALPHA};function ne(de,Le,Ee,ge,je,at,yt,Ct,tn,Pt){if(de===_u){v===!0&&(Ae(t.BLEND),v=!1);return}if(v===!1&&(he(t.BLEND),v=!0),de!==xfe){if(de!==M||Pt!==B){if((w!==Td||P!==Td)&&(t.blendEquation(t.FUNC_ADD),w=Td,P=Td),Pt)switch(de){case op:t.blendFuncSeparate(t.ONE,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA);break;case NF:t.blendFunc(t.ONE,t.ONE);break;case PF:t.blendFuncSeparate(t.ZERO,t.ONE_MINUS_SRC_COLOR,t.ZERO,t.ONE);break;case DF:t.blendFuncSeparate(t.ZERO,t.SRC_COLOR,t.ZERO,t.SRC_ALPHA);break;default:console.error("THREE.WebGLState: Invalid blending: ",de);break}else switch(de){case op:t.blendFuncSeparate(t.SRC_ALPHA,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA);break;case NF:t.blendFunc(t.SRC_ALPHA,t.ONE);break;case PF:t.blendFuncSeparate(t.ZERO,t.ONE_MINUS_SRC_COLOR,t.ZERO,t.ONE);break;case DF:t.blendFunc(t.ZERO,t.SRC_COLOR);break;default:console.error("THREE.WebGLState: Invalid blending: ",de);break}E=null,T=null,R=null,U=null,N.set(0,0,0),O=0,M=de,B=Pt}return}je=je||Le,at=at||Ee,yt=yt||ge,(Le!==w||je!==P)&&(t.blendEquationSeparate(z[Le],z[je]),w=Le,P=je),(Ee!==E||ge!==T||at!==R||yt!==U)&&(t.blendFuncSeparate(V[Ee],V[ge],V[at],V[yt]),E=Ee,T=ge,R=at,U=yt),(Ct.equals(N)===!1||tn!==O)&&(t.blendColor(Ct.r,Ct.g,Ct.b,tn),N.copy(Ct),O=tn),M=de,B=!1}function J(de,Le){de.side===Ol?Ae(t.CULL_FACE):he(t.CULL_FACE);let Ee=de.side===Da;Le&&(Ee=!Ee),ee(Ee),de.blending===op&&de.transparent===!1?ne(_u):ne(de.blending,de.blendEquation,de.blendSrc,de.blendDst,de.blendEquationAlpha,de.blendSrcAlpha,de.blendDstAlpha,de.blendColor,de.blendAlpha,de.premultipliedAlpha),l.setFunc(de.depthFunc),l.setTest(de.depthTest),l.setMask(de.depthWrite),o.setMask(de.colorWrite);const ge=de.stencilWrite;c.setTest(ge),ge&&(c.setMask(de.stencilWriteMask),c.setFunc(de.stencilFunc,de.stencilRef,de.stencilFuncMask),c.setOp(de.stencilFail,de.stencilZFail,de.stencilZPass)),we(de.polygonOffset,de.polygonOffsetFactor,de.polygonOffsetUnits),de.alphaToCoverage===!0?he(t.SAMPLE_ALPHA_TO_COVERAGE):Ae(t.SAMPLE_ALPHA_TO_COVERAGE)}function ee(de){I!==de&&(de?t.frontFace(t.CW):t.frontFace(t.CCW),I=de)}function ae(de){de!==mfe?(he(t.CULL_FACE),de!==W&&(de===RF?t.cullFace(t.BACK):de===gfe?t.cullFace(t.FRONT):t.cullFace(t.FRONT_AND_BACK))):Ae(t.CULL_FACE),W=de}function ie(de){de!==L&&(Y&&t.lineWidth(de),L=de)}function we(de,Le,Ee){de?(he(t.POLYGON_OFFSET_FILL),($!==Le||q!==Ee)&&(t.polygonOffset(Le,Ee),$=Le,q=Ee)):Ae(t.POLYGON_OFFSET_FILL)}function ve(de){de?he(t.SCISSOR_TEST):Ae(t.SCISSOR_TEST)}function F(de){de===void 0&&(de=t.TEXTURE0+G-1),H!==de&&(t.activeTexture(de),H=de)}function k(de,Le,Ee){Ee===void 0&&(H===null?Ee=t.TEXTURE0+G-1:Ee=H);let ge=X[Ee];ge===void 0&&(ge={type:void 0,texture:void 0},X[Ee]=ge),(ge.type!==de||ge.texture!==Le)&&(H!==Ee&&(t.activeTexture(Ee),H=Ee),t.bindTexture(de,Le||De[de]),ge.type=de,ge.texture=Le)}function K(){const de=X[H];de!==void 0&&de.type!==void 0&&(t.bindTexture(de.type,null),de.type=void 0,de.texture=void 0)}function pe(){try{t.compressedTexImage2D.apply(t,arguments)}catch(de){console.error("THREE.WebGLState:",de)}}function xe(){try{t.compressedTexImage3D.apply(t,arguments)}catch(de){console.error("THREE.WebGLState:",de)}}function fe(){try{t.texSubImage2D.apply(t,arguments)}catch(de){console.error("THREE.WebGLState:",de)}}function Ke(){try{t.texSubImage3D.apply(t,arguments)}catch(de){console.error("THREE.WebGLState:",de)}}function ke(){try{t.compressedTexSubImage2D.apply(t,arguments)}catch(de){console.error("THREE.WebGLState:",de)}}function $e(){try{t.compressedTexSubImage3D.apply(t,arguments)}catch(de){console.error("THREE.WebGLState:",de)}}function rt(){try{t.texStorage2D.apply(t,arguments)}catch(de){console.error("THREE.WebGLState:",de)}}function Ue(){try{t.texStorage3D.apply(t,arguments)}catch(de){console.error("THREE.WebGLState:",de)}}function Pe(){try{t.texImage2D.apply(t,arguments)}catch(de){console.error("THREE.WebGLState:",de)}}function dt(){try{t.texImage3D.apply(t,arguments)}catch(de){console.error("THREE.WebGLState:",de)}}function et(de){ye.equals(de)===!1&&(t.scissor(de.x,de.y,de.z,de.w),ye.copy(de))}function Qe(de){me.equals(de)===!1&&(t.viewport(de.x,de.y,de.z,de.w),me.copy(de))}function st(de,Le){let Ee=f.get(Le);Ee===void 0&&(Ee=new WeakMap,f.set(Le,Ee));let ge=Ee.get(de);ge===void 0&&(ge=t.getUniformBlockIndex(Le,de.name),Ee.set(de,ge))}function ue(de,Le){const ge=f.get(Le).get(de);d.get(Le)!==ge&&(t.uniformBlockBinding(Le,ge,de.__bindingPointIndex),d.set(Le,ge))}function tt(){t.disable(t.BLEND),t.disable(t.CULL_FACE),t.disable(t.DEPTH_TEST),t.disable(t.POLYGON_OFFSET_FILL),t.disable(t.SCISSOR_TEST),t.disable(t.STENCIL_TEST),t.disable(t.SAMPLE_ALPHA_TO_COVERAGE),t.blendEquation(t.FUNC_ADD),t.blendFunc(t.ONE,t.ZERO),t.blendFuncSeparate(t.ONE,t.ZERO,t.ONE,t.ZERO),t.blendColor(0,0,0,0),t.colorMask(!0,!0,!0,!0),t.clearColor(0,0,0,0),t.depthMask(!0),t.depthFunc(t.LESS),t.clearDepth(1),t.stencilMask(4294967295),t.stencilFunc(t.ALWAYS,0,4294967295),t.stencilOp(t.KEEP,t.KEEP,t.KEEP),t.clearStencil(0),t.cullFace(t.BACK),t.frontFace(t.CCW),t.polygonOffset(0,0),t.activeTexture(t.TEXTURE0),t.bindFramebuffer(t.FRAMEBUFFER,null),i===!0&&(t.bindFramebuffer(t.DRAW_FRAMEBUFFER,null),t.bindFramebuffer(t.READ_FRAMEBUFFER,null)),t.useProgram(null),t.lineWidth(1),t.scissor(0,0,t.canvas.width,t.canvas.height),t.viewport(0,0,t.canvas.width,t.canvas.height),p={},H=null,X={},m={},y=new WeakMap,b=[],x=null,v=!1,M=null,w=null,E=null,T=null,P=null,R=null,U=null,N=new Ut(0,0,0),O=0,B=!1,I=null,W=null,L=null,$=null,q=null,ye.set(0,0,t.canvas.width,t.canvas.height),me.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:Ae,bindFramebuffer:Be,drawBuffers:le,useProgram:ut,setBlending:ne,setMaterial:J,setFlipSided:ee,setCullFace:ae,setLineWidth:ie,setPolygonOffset:we,setScissorTest:ve,activeTexture:F,bindTexture:k,unbindTexture:K,compressedTexImage2D:pe,compressedTexImage3D:xe,texImage2D:Pe,texImage3D:dt,updateUBOMapping:st,uniformBlockBinding:ue,texStorage2D:rt,texStorage3D:Ue,texSubImage2D:fe,texSubImage3D:Ke,compressedTexSubImage2D:ke,compressedTexSubImage3D:$e,scissor:et,viewport:Qe,reset:tt}}function Mve(t,e,n,i,r,a,s){const o=r.isWebGL2,l=r.maxTextures,c=r.maxCubemapSize,d=r.maxTextureSize,f=r.maxSamples,p=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,m=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),y=new WeakMap;let b;const x=new WeakMap;let v=!1;try{v=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function M(F,k){return v?new OffscreenCanvas(F,k):h_("canvas")}function w(F,k,K,pe){let xe=1;if((F.width>pe||F.height>pe)&&(xe=pe/Math.max(F.width,F.height)),xe<1||k===!0)if(typeof HTMLImageElement<"u"&&F instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&F instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&F instanceof ImageBitmap){const fe=k?f_:Math.floor,Ke=fe(xe*F.width),ke=fe(xe*F.height);b===void 0&&(b=M(Ke,ke));const $e=K?M(Ke,ke):b;return $e.width=Ke,$e.height=ke,$e.getContext("2d").drawImage(F,0,0,Ke,ke),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+F.width+"x"+F.height+") to ("+Ke+"x"+ke+")."),$e}else return"data"in F&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+F.width+"x"+F.height+")."),F;return F}function E(F){return RR(F.width)&&RR(F.height)}function T(F){return o?!1:F.wrapS!==io||F.wrapT!==io||F.minFilter!==Ur&&F.minFilter!==Ns}function P(F,k){return F.generateMipmaps&&k&&F.minFilter!==Ur&&F.minFilter!==Ns}function R(F){t.generateMipmap(F)}function U(F,k,K,pe,xe=!1){if(o===!1)return k;if(F!==null){if(t[F]!==void 0)return t[F];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+F+"'")}let fe=k;if(k===t.RED&&(K===t.FLOAT&&(fe=t.R32F),K===t.HALF_FLOAT&&(fe=t.R16F),K===t.UNSIGNED_BYTE&&(fe=t.R8)),k===t.RED_INTEGER&&(K===t.UNSIGNED_BYTE&&(fe=t.R8UI),K===t.UNSIGNED_SHORT&&(fe=t.R16UI),K===t.UNSIGNED_INT&&(fe=t.R32UI),K===t.BYTE&&(fe=t.R8I),K===t.SHORT&&(fe=t.R16I),K===t.INT&&(fe=t.R32I)),k===t.RG&&(K===t.FLOAT&&(fe=t.RG32F),K===t.HALF_FLOAT&&(fe=t.RG16F),K===t.UNSIGNED_BYTE&&(fe=t.RG8)),k===t.RGBA){const Ke=xe?c_:kn.getTransfer(pe);K===t.FLOAT&&(fe=t.RGBA32F),K===t.HALF_FLOAT&&(fe=t.RGBA16F),K===t.UNSIGNED_BYTE&&(fe=Ke===Kn?t.SRGB8_ALPHA8:t.RGBA8),K===t.UNSIGNED_SHORT_4_4_4_4&&(fe=t.RGBA4),K===t.UNSIGNED_SHORT_5_5_5_1&&(fe=t.RGB5_A1)}return(fe===t.R16F||fe===t.R32F||fe===t.RG16F||fe===t.RG32F||fe===t.RGBA16F||fe===t.RGBA32F)&&e.get("EXT_color_buffer_float"),fe}function N(F,k,K){return P(F,K)===!0||F.isFramebufferTexture&&F.minFilter!==Ur&&F.minFilter!==Ns?Math.log2(Math.max(k.width,k.height))+1:F.mipmaps!==void 0&&F.mipmaps.length>0?F.mipmaps.length:F.isCompressedTexture&&Array.isArray(F.image)?k.mipmaps.length:1}function O(F){return F===Ur||F===kF||F===vA?t.NEAREST:t.LINEAR}function B(F){const k=F.target;k.removeEventListener("dispose",B),W(k),k.isVideoTexture&&y.delete(k)}function I(F){const k=F.target;k.removeEventListener("dispose",I),$(k)}function W(F){const k=i.get(F);if(k.__webglInit===void 0)return;const K=F.source,pe=x.get(K);if(pe){const xe=pe[k.__cacheKey];xe.usedTimes--,xe.usedTimes===0&&L(F),Object.keys(pe).length===0&&x.delete(K)}i.remove(F)}function L(F){const k=i.get(F);t.deleteTexture(k.__webglTexture);const K=F.source,pe=x.get(K);delete pe[k.__cacheKey],s.memory.textures--}function $(F){const k=F.texture,K=i.get(F),pe=i.get(k);if(pe.__webglTexture!==void 0&&(t.deleteTexture(pe.__webglTexture),s.memory.textures--),F.depthTexture&&F.depthTexture.dispose(),F.isWebGLCubeRenderTarget)for(let xe=0;xe<6;xe++){if(Array.isArray(K.__webglFramebuffer[xe]))for(let fe=0;fe<K.__webglFramebuffer[xe].length;fe++)t.deleteFramebuffer(K.__webglFramebuffer[xe][fe]);else t.deleteFramebuffer(K.__webglFramebuffer[xe]);K.__webglDepthbuffer&&t.deleteRenderbuffer(K.__webglDepthbuffer[xe])}else{if(Array.isArray(K.__webglFramebuffer))for(let xe=0;xe<K.__webglFramebuffer.length;xe++)t.deleteFramebuffer(K.__webglFramebuffer[xe]);else t.deleteFramebuffer(K.__webglFramebuffer);if(K.__webglDepthbuffer&&t.deleteRenderbuffer(K.__webglDepthbuffer),K.__webglMultisampledFramebuffer&&t.deleteFramebuffer(K.__webglMultisampledFramebuffer),K.__webglColorRenderbuffer)for(let xe=0;xe<K.__webglColorRenderbuffer.length;xe++)K.__webglColorRenderbuffer[xe]&&t.deleteRenderbuffer(K.__webglColorRenderbuffer[xe]);K.__webglDepthRenderbuffer&&t.deleteRenderbuffer(K.__webglDepthRenderbuffer)}if(F.isWebGLMultipleRenderTargets)for(let xe=0,fe=k.length;xe<fe;xe++){const Ke=i.get(k[xe]);Ke.__webglTexture&&(t.deleteTexture(Ke.__webglTexture),s.memory.textures--),i.remove(k[xe])}i.remove(k),i.remove(F)}let q=0;function G(){q=0}function Y(){const F=q;return F>=l&&console.warn("THREE.WebGLTextures: Trying to use "+F+" texture units while this GPU supports only "+l),q+=1,F}function Q(F){const k=[];return k.push(F.wrapS),k.push(F.wrapT),k.push(F.wrapR||0),k.push(F.magFilter),k.push(F.minFilter),k.push(F.anisotropy),k.push(F.internalFormat),k.push(F.format),k.push(F.type),k.push(F.generateMipmaps),k.push(F.premultiplyAlpha),k.push(F.flipY),k.push(F.unpackAlignment),k.push(F.colorSpace),k.join()}function se(F,k){const K=i.get(F);if(F.isVideoTexture&&we(F),F.isRenderTargetTexture===!1&&F.version>0&&K.__version!==F.version){const pe=F.image;if(pe===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(pe.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{he(K,F,k);return}}n.bindTexture(t.TEXTURE_2D,K.__webglTexture,t.TEXTURE0+k)}function H(F,k){const K=i.get(F);if(F.version>0&&K.__version!==F.version){he(K,F,k);return}n.bindTexture(t.TEXTURE_2D_ARRAY,K.__webglTexture,t.TEXTURE0+k)}function X(F,k){const K=i.get(F);if(F.version>0&&K.__version!==F.version){he(K,F,k);return}n.bindTexture(t.TEXTURE_3D,K.__webglTexture,t.TEXTURE0+k)}function re(F,k){const K=i.get(F);if(F.version>0&&K.__version!==F.version){Ae(K,F,k);return}n.bindTexture(t.TEXTURE_CUBE_MAP,K.__webglTexture,t.TEXTURE0+k)}const ce={[ER]:t.REPEAT,[io]:t.CLAMP_TO_EDGE,[AR]:t.MIRRORED_REPEAT},ye={[Ur]:t.NEAREST,[kF]:t.NEAREST_MIPMAP_NEAREST,[vA]:t.NEAREST_MIPMAP_LINEAR,[Ns]:t.LINEAR,[Xfe]:t.LINEAR_MIPMAP_NEAREST,[y0]:t.LINEAR_MIPMAP_LINEAR},me={[she]:t.NEVER,[fhe]:t.ALWAYS,[ohe]:t.LESS,[p$]:t.LEQUAL,[lhe]:t.EQUAL,[dhe]:t.GEQUAL,[che]:t.GREATER,[uhe]:t.NOTEQUAL};function be(F,k,K){if(K?(t.texParameteri(F,t.TEXTURE_WRAP_S,ce[k.wrapS]),t.texParameteri(F,t.TEXTURE_WRAP_T,ce[k.wrapT]),(F===t.TEXTURE_3D||F===t.TEXTURE_2D_ARRAY)&&t.texParameteri(F,t.TEXTURE_WRAP_R,ce[k.wrapR]),t.texParameteri(F,t.TEXTURE_MAG_FILTER,ye[k.magFilter]),t.texParameteri(F,t.TEXTURE_MIN_FILTER,ye[k.minFilter])):(t.texParameteri(F,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(F,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),(F===t.TEXTURE_3D||F===t.TEXTURE_2D_ARRAY)&&t.texParameteri(F,t.TEXTURE_WRAP_R,t.CLAMP_TO_EDGE),(k.wrapS!==io||k.wrapT!==io)&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),t.texParameteri(F,t.TEXTURE_MAG_FILTER,O(k.magFilter)),t.texParameteri(F,t.TEXTURE_MIN_FILTER,O(k.minFilter)),k.minFilter!==Ur&&k.minFilter!==Ns&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),k.compareFunction&&(t.texParameteri(F,t.TEXTURE_COMPARE_MODE,t.COMPARE_REF_TO_TEXTURE),t.texParameteri(F,t.TEXTURE_COMPARE_FUNC,me[k.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){const pe=e.get("EXT_texture_filter_anisotropic");if(k.magFilter===Ur||k.minFilter!==vA&&k.minFilter!==y0||k.type===zl&&e.has("OES_texture_float_linear")===!1||o===!1&&k.type===b0&&e.has("OES_texture_half_float_linear")===!1)return;(k.anisotropy>1||i.get(k).__currentAnisotropy)&&(t.texParameterf(F,pe.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(k.anisotropy,r.getMaxAnisotropy())),i.get(k).__currentAnisotropy=k.anisotropy)}}function De(F,k){let K=!1;F.__webglInit===void 0&&(F.__webglInit=!0,k.addEventListener("dispose",B));const pe=k.source;let xe=x.get(pe);xe===void 0&&(xe={},x.set(pe,xe));const fe=Q(k);if(fe!==F.__cacheKey){xe[fe]===void 0&&(xe[fe]={texture:t.createTexture(),usedTimes:0},s.memory.textures++,K=!0),xe[fe].usedTimes++;const Ke=xe[F.__cacheKey];Ke!==void 0&&(xe[F.__cacheKey].usedTimes--,Ke.usedTimes===0&&L(k)),F.__cacheKey=fe,F.__webglTexture=xe[fe].texture}return K}function he(F,k,K){let pe=t.TEXTURE_2D;(k.isDataArrayTexture||k.isCompressedArrayTexture)&&(pe=t.TEXTURE_2D_ARRAY),k.isData3DTexture&&(pe=t.TEXTURE_3D);const xe=De(F,k),fe=k.source;n.bindTexture(pe,F.__webglTexture,t.TEXTURE0+K);const Ke=i.get(fe);if(fe.version!==Ke.__version||xe===!0){n.activeTexture(t.TEXTURE0+K);const ke=kn.getPrimaries(kn.workingColorSpace),$e=k.colorSpace===Ds?null:kn.getPrimaries(k.colorSpace),rt=k.colorSpace===Ds||ke===$e?t.NONE:t.BROWSER_DEFAULT_WEBGL;t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,k.flipY),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,k.premultiplyAlpha),t.pixelStorei(t.UNPACK_ALIGNMENT,k.unpackAlignment),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,rt);const Ue=T(k)&&E(k.image)===!1;let Pe=w(k.image,Ue,!1,d);Pe=ve(k,Pe);const dt=E(Pe)||o,et=a.convert(k.format,k.colorSpace);let Qe=a.convert(k.type),st=U(k.internalFormat,et,Qe,k.colorSpace,k.isVideoTexture);be(pe,k,dt);let ue;const tt=k.mipmaps,de=o&&k.isVideoTexture!==!0&&st!==d$,Le=Ke.__version===void 0||xe===!0,Ee=N(k,Pe,dt);if(k.isDepthTexture)st=t.DEPTH_COMPONENT,o?k.type===zl?st=t.DEPTH_COMPONENT32F:k.type===pu?st=t.DEPTH_COMPONENT24:k.type===Bd?st=t.DEPTH24_STENCIL8:st=t.DEPTH_COMPONENT16:k.type===zl&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),k.format===jd&&st===t.DEPTH_COMPONENT&&k.type!==KN&&k.type!==pu&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),k.type=pu,Qe=a.convert(k.type)),k.format===Mp&&st===t.DEPTH_COMPONENT&&(st=t.DEPTH_STENCIL,k.type!==Bd&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),k.type=Bd,Qe=a.convert(k.type))),Le&&(de?n.texStorage2D(t.TEXTURE_2D,1,st,Pe.width,Pe.height):n.texImage2D(t.TEXTURE_2D,0,st,Pe.width,Pe.height,0,et,Qe,null));else if(k.isDataTexture)if(tt.length>0&&dt){de&&Le&&n.texStorage2D(t.TEXTURE_2D,Ee,st,tt[0].width,tt[0].height);for(let ge=0,je=tt.length;ge<je;ge++)ue=tt[ge],de?n.texSubImage2D(t.TEXTURE_2D,ge,0,0,ue.width,ue.height,et,Qe,ue.data):n.texImage2D(t.TEXTURE_2D,ge,st,ue.width,ue.height,0,et,Qe,ue.data);k.generateMipmaps=!1}else de?(Le&&n.texStorage2D(t.TEXTURE_2D,Ee,st,Pe.width,Pe.height),n.texSubImage2D(t.TEXTURE_2D,0,0,0,Pe.width,Pe.height,et,Qe,Pe.data)):n.texImage2D(t.TEXTURE_2D,0,st,Pe.width,Pe.height,0,et,Qe,Pe.data);else if(k.isCompressedTexture)if(k.isCompressedArrayTexture){de&&Le&&n.texStorage3D(t.TEXTURE_2D_ARRAY,Ee,st,tt[0].width,tt[0].height,Pe.depth);for(let ge=0,je=tt.length;ge<je;ge++)ue=tt[ge],k.format!==Ps?et!==null?de?n.compressedTexSubImage3D(t.TEXTURE_2D_ARRAY,ge,0,0,0,ue.width,ue.height,Pe.depth,et,ue.data,0,0):n.compressedTexImage3D(t.TEXTURE_2D_ARRAY,ge,st,ue.width,ue.height,Pe.depth,0,ue.data,0,0):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):de?n.texSubImage3D(t.TEXTURE_2D_ARRAY,ge,0,0,0,ue.width,ue.height,Pe.depth,et,Qe,ue.data):n.texImage3D(t.TEXTURE_2D_ARRAY,ge,st,ue.width,ue.height,Pe.depth,0,et,Qe,ue.data)}else{de&&Le&&n.texStorage2D(t.TEXTURE_2D,Ee,st,tt[0].width,tt[0].height);for(let ge=0,je=tt.length;ge<je;ge++)ue=tt[ge],k.format!==Ps?et!==null?de?n.compressedTexSubImage2D(t.TEXTURE_2D,ge,0,0,ue.width,ue.height,et,ue.data):n.compressedTexImage2D(t.TEXTURE_2D,ge,st,ue.width,ue.height,0,ue.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):de?n.texSubImage2D(t.TEXTURE_2D,ge,0,0,ue.width,ue.height,et,Qe,ue.data):n.texImage2D(t.TEXTURE_2D,ge,st,ue.width,ue.height,0,et,Qe,ue.data)}else if(k.isDataArrayTexture)de?(Le&&n.texStorage3D(t.TEXTURE_2D_ARRAY,Ee,st,Pe.width,Pe.height,Pe.depth),n.texSubImage3D(t.TEXTURE_2D_ARRAY,0,0,0,0,Pe.width,Pe.height,Pe.depth,et,Qe,Pe.data)):n.texImage3D(t.TEXTURE_2D_ARRAY,0,st,Pe.width,Pe.height,Pe.depth,0,et,Qe,Pe.data);else if(k.isData3DTexture)de?(Le&&n.texStorage3D(t.TEXTURE_3D,Ee,st,Pe.width,Pe.height,Pe.depth),n.texSubImage3D(t.TEXTURE_3D,0,0,0,0,Pe.width,Pe.height,Pe.depth,et,Qe,Pe.data)):n.texImage3D(t.TEXTURE_3D,0,st,Pe.width,Pe.height,Pe.depth,0,et,Qe,Pe.data);else if(k.isFramebufferTexture){if(Le)if(de)n.texStorage2D(t.TEXTURE_2D,Ee,st,Pe.width,Pe.height);else{let ge=Pe.width,je=Pe.height;for(let at=0;at<Ee;at++)n.texImage2D(t.TEXTURE_2D,at,st,ge,je,0,et,Qe,null),ge>>=1,je>>=1}}else if(tt.length>0&&dt){de&&Le&&n.texStorage2D(t.TEXTURE_2D,Ee,st,tt[0].width,tt[0].height);for(let ge=0,je=tt.length;ge<je;ge++)ue=tt[ge],de?n.texSubImage2D(t.TEXTURE_2D,ge,0,0,et,Qe,ue):n.texImage2D(t.TEXTURE_2D,ge,st,et,Qe,ue);k.generateMipmaps=!1}else de?(Le&&n.texStorage2D(t.TEXTURE_2D,Ee,st,Pe.width,Pe.height),n.texSubImage2D(t.TEXTURE_2D,0,0,0,et,Qe,Pe)):n.texImage2D(t.TEXTURE_2D,0,st,et,Qe,Pe);P(k,dt)&&R(pe),Ke.__version=fe.version,k.onUpdate&&k.onUpdate(k)}F.__version=k.version}function Ae(F,k,K){if(k.image.length!==6)return;const pe=De(F,k),xe=k.source;n.bindTexture(t.TEXTURE_CUBE_MAP,F.__webglTexture,t.TEXTURE0+K);const fe=i.get(xe);if(xe.version!==fe.__version||pe===!0){n.activeTexture(t.TEXTURE0+K);const Ke=kn.getPrimaries(kn.workingColorSpace),ke=k.colorSpace===Ds?null:kn.getPrimaries(k.colorSpace),$e=k.colorSpace===Ds||Ke===ke?t.NONE:t.BROWSER_DEFAULT_WEBGL;t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,k.flipY),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,k.premultiplyAlpha),t.pixelStorei(t.UNPACK_ALIGNMENT,k.unpackAlignment),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,$e);const rt=k.isCompressedTexture||k.image[0].isCompressedTexture,Ue=k.image[0]&&k.image[0].isDataTexture,Pe=[];for(let ge=0;ge<6;ge++)!rt&&!Ue?Pe[ge]=w(k.image[ge],!1,!0,c):Pe[ge]=Ue?k.image[ge].image:k.image[ge],Pe[ge]=ve(k,Pe[ge]);const dt=Pe[0],et=E(dt)||o,Qe=a.convert(k.format,k.colorSpace),st=a.convert(k.type),ue=U(k.internalFormat,Qe,st,k.colorSpace),tt=o&&k.isVideoTexture!==!0,de=fe.__version===void 0||pe===!0;let Le=N(k,dt,et);be(t.TEXTURE_CUBE_MAP,k,et);let Ee;if(rt){tt&&de&&n.texStorage2D(t.TEXTURE_CUBE_MAP,Le,ue,dt.width,dt.height);for(let ge=0;ge<6;ge++){Ee=Pe[ge].mipmaps;for(let je=0;je<Ee.length;je++){const at=Ee[je];k.format!==Ps?Qe!==null?tt?n.compressedTexSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+ge,je,0,0,at.width,at.height,Qe,at.data):n.compressedTexImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+ge,je,ue,at.width,at.height,0,at.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):tt?n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+ge,je,0,0,at.width,at.height,Qe,st,at.data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+ge,je,ue,at.width,at.height,0,Qe,st,at.data)}}}else{Ee=k.mipmaps,tt&&de&&(Ee.length>0&&Le++,n.texStorage2D(t.TEXTURE_CUBE_MAP,Le,ue,Pe[0].width,Pe[0].height));for(let ge=0;ge<6;ge++)if(Ue){tt?n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+ge,0,0,0,Pe[ge].width,Pe[ge].height,Qe,st,Pe[ge].data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+ge,0,ue,Pe[ge].width,Pe[ge].height,0,Qe,st,Pe[ge].data);for(let je=0;je<Ee.length;je++){const yt=Ee[je].image[ge].image;tt?n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+ge,je+1,0,0,yt.width,yt.height,Qe,st,yt.data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+ge,je+1,ue,yt.width,yt.height,0,Qe,st,yt.data)}}else{tt?n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+ge,0,0,0,Qe,st,Pe[ge]):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+ge,0,ue,Qe,st,Pe[ge]);for(let je=0;je<Ee.length;je++){const at=Ee[je];tt?n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+ge,je+1,0,0,Qe,st,at.image[ge]):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+ge,je+1,ue,Qe,st,at.image[ge])}}}P(k,et)&&R(t.TEXTURE_CUBE_MAP),fe.__version=xe.version,k.onUpdate&&k.onUpdate(k)}F.__version=k.version}function Be(F,k,K,pe,xe,fe){const Ke=a.convert(K.format,K.colorSpace),ke=a.convert(K.type),$e=U(K.internalFormat,Ke,ke,K.colorSpace);if(!i.get(k).__hasExternalTextures){const Ue=Math.max(1,k.width>>fe),Pe=Math.max(1,k.height>>fe);xe===t.TEXTURE_3D||xe===t.TEXTURE_2D_ARRAY?n.texImage3D(xe,fe,$e,Ue,Pe,k.depth,0,Ke,ke,null):n.texImage2D(xe,fe,$e,Ue,Pe,0,Ke,ke,null)}n.bindFramebuffer(t.FRAMEBUFFER,F),ie(k)?p.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,pe,xe,i.get(K).__webglTexture,0,ae(k)):(xe===t.TEXTURE_2D||xe>=t.TEXTURE_CUBE_MAP_POSITIVE_X&&xe<=t.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&t.framebufferTexture2D(t.FRAMEBUFFER,pe,xe,i.get(K).__webglTexture,fe),n.bindFramebuffer(t.FRAMEBUFFER,null)}function le(F,k,K){if(t.bindRenderbuffer(t.RENDERBUFFER,F),k.depthBuffer&&!k.stencilBuffer){let pe=o===!0?t.DEPTH_COMPONENT24:t.DEPTH_COMPONENT16;if(K||ie(k)){const xe=k.depthTexture;xe&&xe.isDepthTexture&&(xe.type===zl?pe=t.DEPTH_COMPONENT32F:xe.type===pu&&(pe=t.DEPTH_COMPONENT24));const fe=ae(k);ie(k)?p.renderbufferStorageMultisampleEXT(t.RENDERBUFFER,fe,pe,k.width,k.height):t.renderbufferStorageMultisample(t.RENDERBUFFER,fe,pe,k.width,k.height)}else t.renderbufferStorage(t.RENDERBUFFER,pe,k.width,k.height);t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.RENDERBUFFER,F)}else if(k.depthBuffer&&k.stencilBuffer){const pe=ae(k);K&&ie(k)===!1?t.renderbufferStorageMultisample(t.RENDERBUFFER,pe,t.DEPTH24_STENCIL8,k.width,k.height):ie(k)?p.renderbufferStorageMultisampleEXT(t.RENDERBUFFER,pe,t.DEPTH24_STENCIL8,k.width,k.height):t.renderbufferStorage(t.RENDERBUFFER,t.DEPTH_STENCIL,k.width,k.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.RENDERBUFFER,F)}else{const pe=k.isWebGLMultipleRenderTargets===!0?k.texture:[k.texture];for(let xe=0;xe<pe.length;xe++){const fe=pe[xe],Ke=a.convert(fe.format,fe.colorSpace),ke=a.convert(fe.type),$e=U(fe.internalFormat,Ke,ke,fe.colorSpace),rt=ae(k);K&&ie(k)===!1?t.renderbufferStorageMultisample(t.RENDERBUFFER,rt,$e,k.width,k.height):ie(k)?p.renderbufferStorageMultisampleEXT(t.RENDERBUFFER,rt,$e,k.width,k.height):t.renderbufferStorage(t.RENDERBUFFER,$e,k.width,k.height)}}t.bindRenderbuffer(t.RENDERBUFFER,null)}function ut(F,k){if(k&&k.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(n.bindFramebuffer(t.FRAMEBUFFER,F),!(k.depthTexture&&k.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");(!i.get(k.depthTexture).__webglTexture||k.depthTexture.image.width!==k.width||k.depthTexture.image.height!==k.height)&&(k.depthTexture.image.width=k.width,k.depthTexture.image.height=k.height,k.depthTexture.needsUpdate=!0),se(k.depthTexture,0);const pe=i.get(k.depthTexture).__webglTexture,xe=ae(k);if(k.depthTexture.format===jd)ie(k)?p.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.TEXTURE_2D,pe,0,xe):t.framebufferTexture2D(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.TEXTURE_2D,pe,0);else if(k.depthTexture.format===Mp)ie(k)?p.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.TEXTURE_2D,pe,0,xe):t.framebufferTexture2D(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.TEXTURE_2D,pe,0);else throw new Error("Unknown depthTexture format")}function z(F){const k=i.get(F),K=F.isWebGLCubeRenderTarget===!0;if(F.depthTexture&&!k.__autoAllocateDepthBuffer){if(K)throw new Error("target.depthTexture not supported in Cube render targets");ut(k.__webglFramebuffer,F)}else if(K){k.__webglDepthbuffer=[];for(let pe=0;pe<6;pe++)n.bindFramebuffer(t.FRAMEBUFFER,k.__webglFramebuffer[pe]),k.__webglDepthbuffer[pe]=t.createRenderbuffer(),le(k.__webglDepthbuffer[pe],F,!1)}else n.bindFramebuffer(t.FRAMEBUFFER,k.__webglFramebuffer),k.__webglDepthbuffer=t.createRenderbuffer(),le(k.__webglDepthbuffer,F,!1);n.bindFramebuffer(t.FRAMEBUFFER,null)}function V(F,k,K){const pe=i.get(F);k!==void 0&&Be(pe.__webglFramebuffer,F,F.texture,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,0),K!==void 0&&z(F)}function ne(F){const k=F.texture,K=i.get(F),pe=i.get(k);F.addEventListener("dispose",I),F.isWebGLMultipleRenderTargets!==!0&&(pe.__webglTexture===void 0&&(pe.__webglTexture=t.createTexture()),pe.__version=k.version,s.memory.textures++);const xe=F.isWebGLCubeRenderTarget===!0,fe=F.isWebGLMultipleRenderTargets===!0,Ke=E(F)||o;if(xe){K.__webglFramebuffer=[];for(let ke=0;ke<6;ke++)if(o&&k.mipmaps&&k.mipmaps.length>0){K.__webglFramebuffer[ke]=[];for(let $e=0;$e<k.mipmaps.length;$e++)K.__webglFramebuffer[ke][$e]=t.createFramebuffer()}else K.__webglFramebuffer[ke]=t.createFramebuffer()}else{if(o&&k.mipmaps&&k.mipmaps.length>0){K.__webglFramebuffer=[];for(let ke=0;ke<k.mipmaps.length;ke++)K.__webglFramebuffer[ke]=t.createFramebuffer()}else K.__webglFramebuffer=t.createFramebuffer();if(fe)if(r.drawBuffers){const ke=F.texture;for(let $e=0,rt=ke.length;$e<rt;$e++){const Ue=i.get(ke[$e]);Ue.__webglTexture===void 0&&(Ue.__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&&F.samples>0&&ie(F)===!1){const ke=fe?k:[k];K.__webglMultisampledFramebuffer=t.createFramebuffer(),K.__webglColorRenderbuffer=[],n.bindFramebuffer(t.FRAMEBUFFER,K.__webglMultisampledFramebuffer);for(let $e=0;$e<ke.length;$e++){const rt=ke[$e];K.__webglColorRenderbuffer[$e]=t.createRenderbuffer(),t.bindRenderbuffer(t.RENDERBUFFER,K.__webglColorRenderbuffer[$e]);const Ue=a.convert(rt.format,rt.colorSpace),Pe=a.convert(rt.type),dt=U(rt.internalFormat,Ue,Pe,rt.colorSpace,F.isXRRenderTarget===!0),et=ae(F);t.renderbufferStorageMultisample(t.RENDERBUFFER,et,dt,F.width,F.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+$e,t.RENDERBUFFER,K.__webglColorRenderbuffer[$e])}t.bindRenderbuffer(t.RENDERBUFFER,null),F.depthBuffer&&(K.__webglDepthRenderbuffer=t.createRenderbuffer(),le(K.__webglDepthRenderbuffer,F,!0)),n.bindFramebuffer(t.FRAMEBUFFER,null)}}if(xe){n.bindTexture(t.TEXTURE_CUBE_MAP,pe.__webglTexture),be(t.TEXTURE_CUBE_MAP,k,Ke);for(let ke=0;ke<6;ke++)if(o&&k.mipmaps&&k.mipmaps.length>0)for(let $e=0;$e<k.mipmaps.length;$e++)Be(K.__webglFramebuffer[ke][$e],F,k,t.COLOR_ATTACHMENT0,t.TEXTURE_CUBE_MAP_POSITIVE_X+ke,$e);else Be(K.__webglFramebuffer[ke],F,k,t.COLOR_ATTACHMENT0,t.TEXTURE_CUBE_MAP_POSITIVE_X+ke,0);P(k,Ke)&&R(t.TEXTURE_CUBE_MAP),n.unbindTexture()}else if(fe){const ke=F.texture;for(let $e=0,rt=ke.length;$e<rt;$e++){const Ue=ke[$e],Pe=i.get(Ue);n.bindTexture(t.TEXTURE_2D,Pe.__webglTexture),be(t.TEXTURE_2D,Ue,Ke),Be(K.__webglFramebuffer,F,Ue,t.COLOR_ATTACHMENT0+$e,t.TEXTURE_2D,0),P(Ue,Ke)&&R(t.TEXTURE_2D)}n.unbindTexture()}else{let ke=t.TEXTURE_2D;if((F.isWebGL3DRenderTarget||F.isWebGLArrayRenderTarget)&&(o?ke=F.isWebGL3DRenderTarget?t.TEXTURE_3D:t.TEXTURE_2D_ARRAY:console.error("THREE.WebGLTextures: THREE.Data3DTexture and THREE.DataArrayTexture only supported with WebGL2.")),n.bindTexture(ke,pe.__webglTexture),be(ke,k,Ke),o&&k.mipmaps&&k.mipmaps.length>0)for(let $e=0;$e<k.mipmaps.length;$e++)Be(K.__webglFramebuffer[$e],F,k,t.COLOR_ATTACHMENT0,ke,$e);else Be(K.__webglFramebuffer,F,k,t.COLOR_ATTACHMENT0,ke,0);P(k,Ke)&&R(ke),n.unbindTexture()}F.depthBuffer&&z(F)}function J(F){const k=E(F)||o,K=F.isWebGLMultipleRenderTargets===!0?F.texture:[F.texture];for(let pe=0,xe=K.length;pe<xe;pe++){const fe=K[pe];if(P(fe,k)){const Ke=F.isWebGLCubeRenderTarget?t.TEXTURE_CUBE_MAP:t.TEXTURE_2D,ke=i.get(fe).__webglTexture;n.bindTexture(Ke,ke),R(Ke),n.unbindTexture()}}}function ee(F){if(o&&F.samples>0&&ie(F)===!1){const k=F.isWebGLMultipleRenderTargets?F.texture:[F.texture],K=F.width,pe=F.height;let xe=t.COLOR_BUFFER_BIT;const fe=[],Ke=F.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,ke=i.get(F),$e=F.isWebGLMultipleRenderTargets===!0;if($e)for(let rt=0;rt<k.length;rt++)n.bindFramebuffer(t.FRAMEBUFFER,ke.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+rt,t.RENDERBUFFER,null),n.bindFramebuffer(t.FRAMEBUFFER,ke.__webglFramebuffer),t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0+rt,t.TEXTURE_2D,null,0);n.bindFramebuffer(t.READ_FRAMEBUFFER,ke.__webglMultisampledFramebuffer),n.bindFramebuffer(t.DRAW_FRAMEBUFFER,ke.__webglFramebuffer);for(let rt=0;rt<k.length;rt++){fe.push(t.COLOR_ATTACHMENT0+rt),F.depthBuffer&&fe.push(Ke);const Ue=ke.__ignoreDepthValues!==void 0?ke.__ignoreDepthValues:!1;if(Ue===!1&&(F.depthBuffer&&(xe|=t.DEPTH_BUFFER_BIT),F.stencilBuffer&&(xe|=t.STENCIL_BUFFER_BIT)),$e&&t.framebufferRenderbuffer(t.READ_FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.RENDERBUFFER,ke.__webglColorRenderbuffer[rt]),Ue===!0&&(t.invalidateFramebuffer(t.READ_FRAMEBUFFER,[Ke]),t.invalidateFramebuffer(t.DRAW_FRAMEBUFFER,[Ke])),$e){const Pe=i.get(k[rt]).__webglTexture;t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,Pe,0)}t.blitFramebuffer(0,0,K,pe,0,0,K,pe,xe,t.NEAREST),m&&t.invalidateFramebuffer(t.READ_FRAMEBUFFER,fe)}if(n.bindFramebuffer(t.READ_FRAMEBUFFER,null),n.bindFramebuffer(t.DRAW_FRAMEBUFFER,null),$e)for(let rt=0;rt<k.length;rt++){n.bindFramebuffer(t.FRAMEBUFFER,ke.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+rt,t.RENDERBUFFER,ke.__webglColorRenderbuffer[rt]);const Ue=i.get(k[rt]).__webglTexture;n.bindFramebuffer(t.FRAMEBUFFER,ke.__webglFramebuffer),t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0+rt,t.TEXTURE_2D,Ue,0)}n.bindFramebuffer(t.DRAW_FRAMEBUFFER,ke.__webglMultisampledFramebuffer)}}function ae(F){return Math.min(f,F.samples)}function ie(F){const k=i.get(F);return o&&F.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&k.__useRenderToTexture!==!1}function we(F){const k=s.render.frame;y.get(F)!==k&&(y.set(F,k),F.update())}function ve(F,k){const K=F.colorSpace,pe=F.format,xe=F.type;return F.isCompressedTexture===!0||F.isVideoTexture===!0||F.format===CR||K!==ec&&K!==Ds&&(kn.getTransfer(K)===Kn?o===!1?e.has("EXT_sRGB")===!0&&pe===Ps?(F.format=CR,F.minFilter=Ns,F.generateMipmaps=!1):k=v$.sRGBToLinear(k):(pe!==Ps||xe!==wu)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",K)),k}this.allocateTextureUnit=Y,this.resetTextureUnits=G,this.setTexture2D=se,this.setTexture2DArray=H,this.setTexture3D=X,this.setTextureCube=re,this.rebindTextures=V,this.setupRenderTarget=ne,this.updateRenderTargetMipmap=J,this.updateMultisampleRenderTarget=ee,this.setupDepthRenderbuffer=z,this.setupFrameBufferTexture=Be,this.useMultisampledRTT=ie}function Eve(t,e,n){const i=n.isWebGL2;function r(a,s=Ds){let o;const l=kn.getTransfer(s);if(a===wu)return t.UNSIGNED_BYTE;if(a===s$)return t.UNSIGNED_SHORT_4_4_4_4;if(a===o$)return t.UNSIGNED_SHORT_5_5_5_1;if(a===Yfe)return t.BYTE;if(a===Kfe)return t.SHORT;if(a===KN)return t.UNSIGNED_SHORT;if(a===a$)return t.INT;if(a===pu)return t.UNSIGNED_INT;if(a===zl)return t.FLOAT;if(a===b0)return i?t.HALF_FLOAT:(o=e.get("OES_texture_half_float"),o!==null?o.HALF_FLOAT_OES:null);if(a===Zfe)return t.ALPHA;if(a===Ps)return t.RGBA;if(a===Jfe)return t.LUMINANCE;if(a===Qfe)return t.LUMINANCE_ALPHA;if(a===jd)return t.DEPTH_COMPONENT;if(a===Mp)return t.DEPTH_STENCIL;if(a===CR)return o=e.get("EXT_sRGB"),o!==null?o.SRGB_ALPHA_EXT:null;if(a===ehe)return t.RED;if(a===l$)return t.RED_INTEGER;if(a===the)return t.RG;if(a===c$)return t.RG_INTEGER;if(a===u$)return t.RGBA_INTEGER;if(a===xA||a===yA||a===bA||a===_A)if(l===Kn)if(o=e.get("WEBGL_compressed_texture_s3tc_srgb"),o!==null){if(a===xA)return o.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(a===yA)return o.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(a===bA)return o.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(a===_A)return o.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(o=e.get("WEBGL_compressed_texture_s3tc"),o!==null){if(a===xA)return o.COMPRESSED_RGB_S3TC_DXT1_EXT;if(a===yA)return o.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(a===bA)return o.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(a===_A)return o.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(a===IF||a===UF||a===FF||a===zF)if(o=e.get("WEBGL_compressed_texture_pvrtc"),o!==null){if(a===IF)return o.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(a===UF)return o.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(a===FF)return o.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(a===zF)return o.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(a===d$)return o=e.get("WEBGL_compressed_texture_etc1"),o!==null?o.COMPRESSED_RGB_ETC1_WEBGL:null;if(a===BF||a===jF)if(o=e.get("WEBGL_compressed_texture_etc"),o!==null){if(a===BF)return l===Kn?o.COMPRESSED_SRGB8_ETC2:o.COMPRESSED_RGB8_ETC2;if(a===jF)return l===Kn?o.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:o.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(a===HF||a===VF||a===GF||a===$F||a===WF||a===qF||a===XF||a===YF||a===KF||a===ZF||a===JF||a===QF||a===ez||a===tz)if(o=e.get("WEBGL_compressed_texture_astc"),o!==null){if(a===HF)return l===Kn?o.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:o.COMPRESSED_RGBA_ASTC_4x4_KHR;if(a===VF)return l===Kn?o.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:o.COMPRESSED_RGBA_ASTC_5x4_KHR;if(a===GF)return l===Kn?o.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:o.COMPRESSED_RGBA_ASTC_5x5_KHR;if(a===$F)return l===Kn?o.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:o.COMPRESSED_RGBA_ASTC_6x5_KHR;if(a===WF)return l===Kn?o.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:o.COMPRESSED_RGBA_ASTC_6x6_KHR;if(a===qF)return l===Kn?o.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:o.COMPRESSED_RGBA_ASTC_8x5_KHR;if(a===XF)return l===Kn?o.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:o.COMPRESSED_RGBA_ASTC_8x6_KHR;if(a===YF)return l===Kn?o.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:o.COMPRESSED_RGBA_ASTC_8x8_KHR;if(a===KF)return l===Kn?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:o.COMPRESSED_RGBA_ASTC_10x5_KHR;if(a===ZF)return l===Kn?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:o.COMPRESSED_RGBA_ASTC_10x6_KHR;if(a===JF)return l===Kn?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:o.COMPRESSED_RGBA_ASTC_10x8_KHR;if(a===QF)return l===Kn?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:o.COMPRESSED_RGBA_ASTC_10x10_KHR;if(a===ez)return l===Kn?o.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:o.COMPRESSED_RGBA_ASTC_12x10_KHR;if(a===tz)return l===Kn?o.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:o.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(a===SA||a===nz||a===iz)if(o=e.get("EXT_texture_compression_bptc"),o!==null){if(a===SA)return l===Kn?o.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:o.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(a===nz)return o.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(a===iz)return o.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(a===nhe||a===rz||a===az||a===sz)if(o=e.get("EXT_texture_compression_rgtc"),o!==null){if(a===SA)return o.COMPRESSED_RED_RGTC1_EXT;if(a===rz)return o.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(a===az)return o.COMPRESSED_RED_GREEN_RGTC2_EXT;if(a===sz)return o.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return a===Bd?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 Ave extends Ja{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}}class Lg extends ha{constructor(){super(),this.isGroup=!0,this.type="Group"}}const Tve={type:"move"};class $A{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Lg,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 Lg,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new Ce,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new Ce),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new Lg,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new Ce,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new Ce),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){const n=this._hand;if(n)for(const i of e.hand.values())this._getHandJoint(n,i)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,n,i){let r=null,a=null,s=null;const o=this._targetRay,l=this._grip,c=this._hand;if(e&&n.session.visibilityState!=="visible-blurred"){if(c&&e.hand){s=!0;for(const b of e.hand.values()){const x=n.getJointPose(b,i),v=this._getHandJoint(c,b);x!==null&&(v.matrix.fromArray(x.transform.matrix),v.matrix.decompose(v.position,v.rotation,v.scale),v.matrixWorldNeedsUpdate=!0,v.jointRadius=x.radius),v.visible=x!==null}const d=c.joints["index-finger-tip"],f=c.joints["thumb-tip"],p=d.position.distanceTo(f.position),m=.02,y=.005;c.inputState.pinching&&p>m+y?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&p<=m-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(Tve)))}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 Lg;i.matrixAutoUpdate=!1,i.visible=!1,e.joints[n.jointName]=i,e.add(i)}return e.joints[n.jointName]}}class Cve extends Af{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,p=null,m=null,y=null;const b=n.getContextAttributes();let x=null,v=null;const M=[],w=[],E=new Vt;let T=null;const P=new Ja;P.layers.enable(1),P.viewport=new Un;const R=new Ja;R.layers.enable(2),R.viewport=new Un;const U=[P,R],N=new Ave;N.layers.enable(1),N.layers.enable(2);let O=null,B=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(re){let ce=M[re];return ce===void 0&&(ce=new $A,M[re]=ce),ce.getTargetRaySpace()},this.getControllerGrip=function(re){let ce=M[re];return ce===void 0&&(ce=new $A,M[re]=ce),ce.getGripSpace()},this.getHand=function(re){let ce=M[re];return ce===void 0&&(ce=new $A,M[re]=ce),ce.getHandSpace()};function I(re){const ce=w.indexOf(re.inputSource);if(ce===-1)return;const ye=M[ce];ye!==void 0&&(ye.update(re.inputSource,re.frame,c||s),ye.dispatchEvent({type:re.type,data:re.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",L);for(let re=0;re<M.length;re++){const ce=w[re];ce!==null&&(w[re]=null,M[re].disconnect(ce))}O=null,B=null,e.setRenderTarget(x),m=null,p=null,f=null,r=null,v=null,X.stop(),i.isPresenting=!1,e.setPixelRatio(T),e.setSize(E.width,E.height,!1),i.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(re){a=re,i.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(re){o=re,i.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return c||s},this.setReferenceSpace=function(re){c=re},this.getBaseLayer=function(){return p!==null?p:m},this.getBinding=function(){return f},this.getFrame=function(){return y},this.getSession=function(){return r},this.setSession=async function(re){if(r=re,r!==null){if(x=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",L),b.xrCompatible!==!0&&await n.makeXRCompatible(),T=e.getPixelRatio(),e.getSize(E),r.renderState.layers===void 0||e.capabilities.isWebGL2===!1){const ce={antialias:r.renderState.layers===void 0?b.antialias:!0,alpha:!0,depth:b.depth,stencil:b.stencil,framebufferScaleFactor:a};m=new XRWebGLLayer(r,n,ce),r.updateRenderState({baseLayer:m}),e.setPixelRatio(1),e.setSize(m.framebufferWidth,m.framebufferHeight,!1),v=new cf(m.framebufferWidth,m.framebufferHeight,{format:Ps,type:wu,colorSpace:e.outputColorSpace,stencilBuffer:b.stencil})}else{let ce=null,ye=null,me=null;b.depth&&(me=b.stencil?n.DEPTH24_STENCIL8:n.DEPTH_COMPONENT24,ce=b.stencil?Mp:jd,ye=b.stencil?Bd:pu);const be={colorFormat:n.RGBA8,depthFormat:me,scaleFactor:a};f=new XRWebGLBinding(r,n),p=f.createProjectionLayer(be),r.updateRenderState({layers:[p]}),e.setPixelRatio(1),e.setSize(p.textureWidth,p.textureHeight,!1),v=new cf(p.textureWidth,p.textureHeight,{format:Ps,type:wu,depthTexture:new R$(p.textureWidth,p.textureHeight,ye,void 0,void 0,void 0,void 0,void 0,void 0,ce),stencilBuffer:b.stencil,colorSpace:e.outputColorSpace,samples:b.antialias?4:0});const De=e.properties.get(v);De.__ignoreDepthValues=p.ignoreDepthValues}v.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 L(re){for(let ce=0;ce<re.removed.length;ce++){const ye=re.removed[ce],me=w.indexOf(ye);me>=0&&(w[me]=null,M[me].disconnect(ye))}for(let ce=0;ce<re.added.length;ce++){const ye=re.added[ce];let me=w.indexOf(ye);if(me===-1){for(let De=0;De<M.length;De++)if(De>=w.length){w.push(ye),me=De;break}else if(w[De]===null){w[De]=ye,me=De;break}if(me===-1)break}const be=M[me];be&&be.connect(ye)}}const $=new Ce,q=new Ce;function G(re,ce,ye){$.setFromMatrixPosition(ce.matrixWorld),q.setFromMatrixPosition(ye.matrixWorld);const me=$.distanceTo(q),be=ce.projectionMatrix.elements,De=ye.projectionMatrix.elements,he=be[14]/(be[10]-1),Ae=be[14]/(be[10]+1),Be=(be[9]+1)/be[5],le=(be[9]-1)/be[5],ut=(be[8]-1)/be[0],z=(De[8]+1)/De[0],V=he*ut,ne=he*z,J=me/(-ut+z),ee=J*-ut;ce.matrixWorld.decompose(re.position,re.quaternion,re.scale),re.translateX(ee),re.translateZ(J),re.matrixWorld.compose(re.position,re.quaternion,re.scale),re.matrixWorldInverse.copy(re.matrixWorld).invert();const ae=he+J,ie=Ae+J,we=V-ee,ve=ne+(me-ee),F=Be*Ae/ie*ae,k=le*Ae/ie*ae;re.projectionMatrix.makePerspective(we,ve,F,k,ae,ie),re.projectionMatrixInverse.copy(re.projectionMatrix).invert()}function Y(re,ce){ce===null?re.matrixWorld.copy(re.matrix):re.matrixWorld.multiplyMatrices(ce.matrixWorld,re.matrix),re.matrixWorldInverse.copy(re.matrixWorld).invert()}this.updateCamera=function(re){if(r===null)return;N.near=R.near=P.near=re.near,N.far=R.far=P.far=re.far,(O!==N.near||B!==N.far)&&(r.updateRenderState({depthNear:N.near,depthFar:N.far}),O=N.near,B=N.far);const ce=re.parent,ye=N.cameras;Y(N,ce);for(let me=0;me<ye.length;me++)Y(ye[me],ce);ye.length===2?G(N,P,R):N.projectionMatrix.copy(P.projectionMatrix),Q(re,N,ce)};function Q(re,ce,ye){ye===null?re.matrix.copy(ce.matrixWorld):(re.matrix.copy(ye.matrixWorld),re.matrix.invert(),re.matrix.multiply(ce.matrixWorld)),re.matrix.decompose(re.position,re.quaternion,re.scale),re.updateMatrixWorld(!0),re.projectionMatrix.copy(ce.projectionMatrix),re.projectionMatrixInverse.copy(ce.projectionMatrixInverse),re.isPerspectiveCamera&&(re.fov=S0*2*Math.atan(1/re.projectionMatrix.elements[5]),re.zoom=1)}this.getCamera=function(){return N},this.getFoveation=function(){if(!(p===null&&m===null))return l},this.setFoveation=function(re){l=re,p!==null&&(p.fixedFoveation=re),m!==null&&m.fixedFoveation!==void 0&&(m.fixedFoveation=re)};let se=null;function H(re,ce){if(d=ce.getViewerPose(c||s),y=ce,d!==null){const ye=d.views;m!==null&&(e.setRenderTargetFramebuffer(v,m.framebuffer),e.setRenderTarget(v));let me=!1;ye.length!==N.cameras.length&&(N.cameras.length=0,me=!0);for(let be=0;be<ye.length;be++){const De=ye[be];let he=null;if(m!==null)he=m.getViewport(De);else{const Be=f.getViewSubImage(p,De);he=Be.viewport,be===0&&(e.setRenderTargetTextures(v,Be.colorTexture,p.ignoreDepthValues?void 0:Be.depthStencilTexture),e.setRenderTarget(v))}let Ae=U[be];Ae===void 0&&(Ae=new Ja,Ae.layers.enable(be),Ae.viewport=new Un,U[be]=Ae),Ae.matrix.fromArray(De.transform.matrix),Ae.matrix.decompose(Ae.position,Ae.quaternion,Ae.scale),Ae.projectionMatrix.fromArray(De.projectionMatrix),Ae.projectionMatrixInverse.copy(Ae.projectionMatrix).invert(),Ae.viewport.set(he.x,he.y,he.width,he.height),be===0&&(N.matrix.copy(Ae.matrix),N.matrix.decompose(N.position,N.quaternion,N.scale)),me===!0&&N.cameras.push(Ae)}}for(let ye=0;ye<M.length;ye++){const me=w[ye],be=M[ye];me!==null&&be!==void 0&&be.update(me,ce,c||s)}se&&se(re,ce),ce.detectedPlanes&&i.dispatchEvent({type:"planesdetected",data:ce}),y=null}const X=new C$;X.setAnimationLoop(H),this.setAnimationLoop=function(re){se=re},this.dispose=function(){}}}function Rve(t,e){function n(x,v){x.matrixAutoUpdate===!0&&x.updateMatrix(),v.value.copy(x.matrix)}function i(x,v){v.color.getRGB(x.fogColor.value,E$(t)),v.isFog?(x.fogNear.value=v.near,x.fogFar.value=v.far):v.isFogExp2&&(x.fogDensity.value=v.density)}function r(x,v,M,w,E){v.isMeshBasicMaterial||v.isMeshLambertMaterial?a(x,v):v.isMeshToonMaterial?(a(x,v),f(x,v)):v.isMeshPhongMaterial?(a(x,v),d(x,v)):v.isMeshStandardMaterial?(a(x,v),p(x,v),v.isMeshPhysicalMaterial&&m(x,v,E)):v.isMeshMatcapMaterial?(a(x,v),y(x,v)):v.isMeshDepthMaterial?a(x,v):v.isMeshDistanceMaterial?(a(x,v),b(x,v)):v.isMeshNormalMaterial?a(x,v):v.isLineBasicMaterial?(s(x,v),v.isLineDashedMaterial&&o(x,v)):v.isPointsMaterial?l(x,v,M,w):v.isSpriteMaterial?c(x,v):v.isShadowMaterial?(x.color.value.copy(v.color),x.opacity.value=v.opacity):v.isShaderMaterial&&(v.uniformsNeedUpdate=!1)}function a(x,v){x.opacity.value=v.opacity,v.color&&x.diffuse.value.copy(v.color),v.emissive&&x.emissive.value.copy(v.emissive).multiplyScalar(v.emissiveIntensity),v.map&&(x.map.value=v.map,n(v.map,x.mapTransform)),v.alphaMap&&(x.alphaMap.value=v.alphaMap,n(v.alphaMap,x.alphaMapTransform)),v.bumpMap&&(x.bumpMap.value=v.bumpMap,n(v.bumpMap,x.bumpMapTransform),x.bumpScale.value=v.bumpScale,v.side===Da&&(x.bumpScale.value*=-1)),v.normalMap&&(x.normalMap.value=v.normalMap,n(v.normalMap,x.normalMapTransform),x.normalScale.value.copy(v.normalScale),v.side===Da&&x.normalScale.value.negate()),v.displacementMap&&(x.displacementMap.value=v.displacementMap,n(v.displacementMap,x.displacementMapTransform),x.displacementScale.value=v.displacementScale,x.displacementBias.value=v.displacementBias),v.emissiveMap&&(x.emissiveMap.value=v.emissiveMap,n(v.emissiveMap,x.emissiveMapTransform)),v.specularMap&&(x.specularMap.value=v.specularMap,n(v.specularMap,x.specularMapTransform)),v.alphaTest>0&&(x.alphaTest.value=v.alphaTest);const M=e.get(v).envMap;if(M&&(x.envMap.value=M,x.flipEnvMap.value=M.isCubeTexture&&M.isRenderTargetTexture===!1?-1:1,x.reflectivity.value=v.reflectivity,x.ior.value=v.ior,x.refractionRatio.value=v.refractionRatio),v.lightMap){x.lightMap.value=v.lightMap;const w=t._useLegacyLights===!0?Math.PI:1;x.lightMapIntensity.value=v.lightMapIntensity*w,n(v.lightMap,x.lightMapTransform)}v.aoMap&&(x.aoMap.value=v.aoMap,x.aoMapIntensity.value=v.aoMapIntensity,n(v.aoMap,x.aoMapTransform))}function s(x,v){x.diffuse.value.copy(v.color),x.opacity.value=v.opacity,v.map&&(x.map.value=v.map,n(v.map,x.mapTransform))}function o(x,v){x.dashSize.value=v.dashSize,x.totalSize.value=v.dashSize+v.gapSize,x.scale.value=v.scale}function l(x,v,M,w){x.diffuse.value.copy(v.color),x.opacity.value=v.opacity,x.size.value=v.size*M,x.scale.value=w*.5,v.map&&(x.map.value=v.map,n(v.map,x.uvTransform)),v.alphaMap&&(x.alphaMap.value=v.alphaMap,n(v.alphaMap,x.alphaMapTransform)),v.alphaTest>0&&(x.alphaTest.value=v.alphaTest)}function c(x,v){x.diffuse.value.copy(v.color),x.opacity.value=v.opacity,x.rotation.value=v.rotation,v.map&&(x.map.value=v.map,n(v.map,x.mapTransform)),v.alphaMap&&(x.alphaMap.value=v.alphaMap,n(v.alphaMap,x.alphaMapTransform)),v.alphaTest>0&&(x.alphaTest.value=v.alphaTest)}function d(x,v){x.specular.value.copy(v.specular),x.shininess.value=Math.max(v.shininess,1e-4)}function f(x,v){v.gradientMap&&(x.gradientMap.value=v.gradientMap)}function p(x,v){x.metalness.value=v.metalness,v.metalnessMap&&(x.metalnessMap.value=v.metalnessMap,n(v.metalnessMap,x.metalnessMapTransform)),x.roughness.value=v.roughness,v.roughnessMap&&(x.roughnessMap.value=v.roughnessMap,n(v.roughnessMap,x.roughnessMapTransform)),e.get(v).envMap&&(x.envMapIntensity.value=v.envMapIntensity)}function m(x,v,M){x.ior.value=v.ior,v.sheen>0&&(x.sheenColor.value.copy(v.sheenColor).multiplyScalar(v.sheen),x.sheenRoughness.value=v.sheenRoughness,v.sheenColorMap&&(x.sheenColorMap.value=v.sheenColorMap,n(v.sheenColorMap,x.sheenColorMapTransform)),v.sheenRoughnessMap&&(x.sheenRoughnessMap.value=v.sheenRoughnessMap,n(v.sheenRoughnessMap,x.sheenRoughnessMapTransform))),v.clearcoat>0&&(x.clearcoat.value=v.clearcoat,x.clearcoatRoughness.value=v.clearcoatRoughness,v.clearcoatMap&&(x.clearcoatMap.value=v.clearcoatMap,n(v.clearcoatMap,x.clearcoatMapTransform)),v.clearcoatRoughnessMap&&(x.clearcoatRoughnessMap.value=v.clearcoatRoughnessMap,n(v.clearcoatRoughnessMap,x.clearcoatRoughnessMapTransform)),v.clearcoatNormalMap&&(x.clearcoatNormalMap.value=v.clearcoatNormalMap,n(v.clearcoatNormalMap,x.clearcoatNormalMapTransform),x.clearcoatNormalScale.value.copy(v.clearcoatNormalScale),v.side===Da&&x.clearcoatNormalScale.value.negate())),v.iridescence>0&&(x.iridescence.value=v.iridescence,x.iridescenceIOR.value=v.iridescenceIOR,x.iridescenceThicknessMinimum.value=v.iridescenceThicknessRange[0],x.iridescenceThicknessMaximum.value=v.iridescenceThicknessRange[1],v.iridescenceMap&&(x.iridescenceMap.value=v.iridescenceMap,n(v.iridescenceMap,x.iridescenceMapTransform)),v.iridescenceThicknessMap&&(x.iridescenceThicknessMap.value=v.iridescenceThicknessMap,n(v.iridescenceThicknessMap,x.iridescenceThicknessMapTransform))),v.transmission>0&&(x.transmission.value=v.transmission,x.transmissionSamplerMap.value=M.texture,x.transmissionSamplerSize.value.set(M.width,M.height),v.transmissionMap&&(x.transmissionMap.value=v.transmissionMap,n(v.transmissionMap,x.transmissionMapTransform)),x.thickness.value=v.thickness,v.thicknessMap&&(x.thicknessMap.value=v.thicknessMap,n(v.thicknessMap,x.thicknessMapTransform)),x.attenuationDistance.value=v.attenuationDistance,x.attenuationColor.value.copy(v.attenuationColor)),v.anisotropy>0&&(x.anisotropyVector.value.set(v.anisotropy*Math.cos(v.anisotropyRotation),v.anisotropy*Math.sin(v.anisotropyRotation)),v.anisotropyMap&&(x.anisotropyMap.value=v.anisotropyMap,n(v.anisotropyMap,x.anisotropyMapTransform))),x.specularIntensity.value=v.specularIntensity,x.specularColor.value.copy(v.specularColor),v.specularColorMap&&(x.specularColorMap.value=v.specularColorMap,n(v.specularColorMap,x.specularColorMapTransform)),v.specularIntensityMap&&(x.specularIntensityMap.value=v.specularIntensityMap,n(v.specularIntensityMap,x.specularIntensityMapTransform))}function y(x,v){v.matcap&&(x.matcap.value=v.matcap)}function b(x,v){const M=e.get(v).light;x.referencePosition.value.setFromMatrixPosition(M.matrixWorld),x.nearDistance.value=M.shadow.camera.near,x.farDistance.value=M.shadow.camera.far}return{refreshFogUniforms:i,refreshMaterialUniforms:r}}function Nve(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 E=w.program;i.uniformBlockBinding(M,E)}function c(M,w){let E=r[M.id];E===void 0&&(y(M),E=d(M),r[M.id]=E,M.addEventListener("dispose",x));const T=w.program;i.updateUBOMapping(M,T);const P=e.render.frame;a[M.id]!==P&&(p(M),a[M.id]=P)}function d(M){const w=f();M.__bindingPointIndex=w;const E=t.createBuffer(),T=M.__size,P=M.usage;return t.bindBuffer(t.UNIFORM_BUFFER,E),t.bufferData(t.UNIFORM_BUFFER,T,P),t.bindBuffer(t.UNIFORM_BUFFER,null),t.bindBufferBase(t.UNIFORM_BUFFER,w,E),E}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 p(M){const w=r[M.id],E=M.uniforms,T=M.__cache;t.bindBuffer(t.UNIFORM_BUFFER,w);for(let P=0,R=E.length;P<R;P++){const U=E[P];if(m(U,P,T)===!0){const N=U.__offset,O=Array.isArray(U.value)?U.value:[U.value];let B=0;for(let I=0;I<O.length;I++){const W=O[I],L=b(W);typeof W=="number"?(U.__data[0]=W,t.bufferSubData(t.UNIFORM_BUFFER,N+B,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,B),B+=L.storage/Float32Array.BYTES_PER_ELEMENT)}t.bufferSubData(t.UNIFORM_BUFFER,N,U.__data)}}t.bindBuffer(t.UNIFORM_BUFFER,null)}function m(M,w,E){const T=M.value;if(E[w]===void 0){if(typeof T=="number")E[w]=T;else{const P=Array.isArray(T)?T:[T],R=[];for(let U=0;U<P.length;U++)R.push(P[U].clone());E[w]=R}return!0}else if(typeof T=="number"){if(E[w]!==T)return E[w]=T,!0}else{const P=Array.isArray(E[w])?E[w]:[E[w]],R=Array.isArray(T)?T:[T];for(let U=0;U<P.length;U++){const N=P[U];if(N.equals(R[U])===!1)return N.copy(R[U]),!0}}return!1}function y(M){const w=M.uniforms;let E=0;const T=16;let P=0;for(let R=0,U=w.length;R<U;R++){const N=w[R],O={boundary:0,storage:0},B=Array.isArray(N.value)?N.value:[N.value];for(let I=0,W=B.length;I<W;I++){const L=B[I],$=b(L);O.boundary+=$.boundary,O.storage+=$.storage}if(N.__data=new Float32Array(O.storage/Float32Array.BYTES_PER_ELEMENT),N.__offset=E,R>0){P=E%T;const I=T-P;P!==0&&I-O.boundary<0&&(E+=T-P,N.__offset=E)}E+=O.storage}return P=E%T,P>0&&(E+=T-P),M.__size=E,M.__cache={},this}function b(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 x(M){const w=M.target;w.removeEventListener("dispose",x);const E=s.indexOf(w.__bindingPointIndex);s.splice(E,1),t.deleteBuffer(r[w.id]),delete r[w.id],delete a[w.id]}function v(){for(const M in r)t.deleteBuffer(r[M]);s=[],r={},a={}}return{bind:l,update:c,dispose:v}}class PR{constructor(e={}){const{canvas:n=The(),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 p;i!==null?p=i.getContextAttributes().alpha:p=s;const m=new Uint32Array(4),y=new Int32Array(4);let b=null,x=null;const v=[],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=Fr,this._useLegacyLights=!1,this.toneMapping=Su,this.toneMappingExposure=1;const w=this;let E=!1,T=0,P=0,R=null,U=-1,N=null;const O=new Un,B=new Un;let I=null;const W=new Ut(0);let L=0,$=n.width,q=n.height,G=1,Y=null,Q=null;const se=new Un(0,0,$,q),H=new Un(0,0,$,q);let X=!1;const re=new pS;let ce=!1,ye=!1,me=null;const be=new Wn,De=new Vt,he=new Ce,Ae={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function Be(){return R===null?G:1}let le=i;function ut(oe,Ie){for(let qe=0;qe<oe.length;qe++){const Xe=oe[qe],We=n.getContext(Xe,Ie);if(We!==null)return We}return null}try{const oe={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${dS}`),n.addEventListener("webglcontextlost",tt,!1),n.addEventListener("webglcontextrestored",de,!1),n.addEventListener("webglcontextcreationerror",Le,!1),le===null){const Ie=["webgl2","webgl","experimental-webgl"];if(w.isWebGL1Renderer===!0&&Ie.shift(),le=ut(Ie,oe),le===null)throw ut(Ie)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}typeof WebGLRenderingContext<"u"&&le instanceof WebGLRenderingContext&&console.warn("THREE.WebGLRenderer: WebGL 1 support was deprecated in r153 and will be removed in r163."),le.getShaderPrecisionFormat===void 0&&(le.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(oe){throw console.error("THREE.WebGLRenderer: "+oe.message),oe}let z,V,ne,J,ee,ae,ie,we,ve,F,k,K,pe,xe,fe,Ke,ke,$e,rt,Ue,Pe,dt,et,Qe;function st(){z=new jge(le),V=new Lge(le,z,e),z.init(V),dt=new Eve(le,z,V),ne=new wve(le,z,V),J=new Gge(le),ee=new cve,ae=new Mve(le,z,ne,ee,V,dt,J),ie=new Ige(w),we=new Bge(w),ve=new Zhe(le,V),et=new Dge(le,z,ve,V),F=new Hge(le,ve,J,et),k=new Xge(le,F,ve,J),rt=new qge(le,V,ae),Ke=new kge(ee),K=new lve(w,ie,we,z,V,et,Ke),pe=new Rve(w,ee),xe=new dve,fe=new vve(z,V),$e=new Pge(w,ie,we,ne,k,p,l),ke=new Sve(w,k,V),Qe=new Nve(le,J,V,ne),Ue=new Oge(le,z,J,V),Pe=new Vge(le,z,J,V),J.programs=K.programs,w.capabilities=V,w.extensions=z,w.properties=ee,w.renderLists=xe,w.shadowMap=ke,w.state=ne,w.info=J}st();const ue=new Cve(w,le);this.xr=ue,this.getContext=function(){return le},this.getContextAttributes=function(){return le.getContextAttributes()},this.forceContextLoss=function(){const oe=z.get("WEBGL_lose_context");oe&&oe.loseContext()},this.forceContextRestore=function(){const oe=z.get("WEBGL_lose_context");oe&&oe.restoreContext()},this.getPixelRatio=function(){return G},this.setPixelRatio=function(oe){oe!==void 0&&(G=oe,this.setSize($,q,!1))},this.getSize=function(oe){return oe.set($,q)},this.setSize=function(oe,Ie,qe=!0){if(ue.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}$=oe,q=Ie,n.width=Math.floor(oe*G),n.height=Math.floor(Ie*G),qe===!0&&(n.style.width=oe+"px",n.style.height=Ie+"px"),this.setViewport(0,0,oe,Ie)},this.getDrawingBufferSize=function(oe){return oe.set($*G,q*G).floor()},this.setDrawingBufferSize=function(oe,Ie,qe){$=oe,q=Ie,G=qe,n.width=Math.floor(oe*qe),n.height=Math.floor(Ie*qe),this.setViewport(0,0,oe,Ie)},this.getCurrentViewport=function(oe){return oe.copy(O)},this.getViewport=function(oe){return oe.copy(se)},this.setViewport=function(oe,Ie,qe,Xe){oe.isVector4?se.set(oe.x,oe.y,oe.z,oe.w):se.set(oe,Ie,qe,Xe),ne.viewport(O.copy(se).multiplyScalar(G).floor())},this.getScissor=function(oe){return oe.copy(H)},this.setScissor=function(oe,Ie,qe,Xe){oe.isVector4?H.set(oe.x,oe.y,oe.z,oe.w):H.set(oe,Ie,qe,Xe),ne.scissor(B.copy(H).multiplyScalar(G).floor())},this.getScissorTest=function(){return X},this.setScissorTest=function(oe){ne.setScissorTest(X=oe)},this.setOpaqueSort=function(oe){Y=oe},this.setTransparentSort=function(oe){Q=oe},this.getClearColor=function(oe){return oe.copy($e.getClearColor())},this.setClearColor=function(){$e.setClearColor.apply($e,arguments)},this.getClearAlpha=function(){return $e.getClearAlpha()},this.setClearAlpha=function(){$e.setClearAlpha.apply($e,arguments)},this.clear=function(oe=!0,Ie=!0,qe=!0){let Xe=0;if(oe){let We=!1;if(R!==null){const bt=R.texture.format;We=bt===u$||bt===c$||bt===l$}if(We){const bt=R.texture.type,Z=bt===wu||bt===pu||bt===KN||bt===Bd||bt===s$||bt===o$,_e=$e.getClearColor(),Ne=$e.getClearAlpha(),Re=_e.r,Me=_e.g,Ze=_e.b;Z?(m[0]=Re,m[1]=Me,m[2]=Ze,m[3]=Ne,le.clearBufferuiv(le.COLOR,0,m)):(y[0]=Re,y[1]=Me,y[2]=Ze,y[3]=Ne,le.clearBufferiv(le.COLOR,0,y))}else Xe|=le.COLOR_BUFFER_BIT}Ie&&(Xe|=le.DEPTH_BUFFER_BIT),qe&&(Xe|=le.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),le.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",tt,!1),n.removeEventListener("webglcontextrestored",de,!1),n.removeEventListener("webglcontextcreationerror",Le,!1),xe.dispose(),fe.dispose(),ee.dispose(),ie.dispose(),we.dispose(),k.dispose(),et.dispose(),Qe.dispose(),K.dispose(),ue.dispose(),ue.removeEventListener("sessionstart",tn),ue.removeEventListener("sessionend",Pt),me&&(me.dispose(),me=null),wn.stop()};function tt(oe){oe.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),E=!0}function de(){console.log("THREE.WebGLRenderer: Context Restored."),E=!1;const oe=J.autoReset,Ie=ke.enabled,qe=ke.autoUpdate,Xe=ke.needsUpdate,We=ke.type;st(),J.autoReset=oe,ke.enabled=Ie,ke.autoUpdate=qe,ke.needsUpdate=Xe,ke.type=We}function Le(oe){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",oe.statusMessage)}function Ee(oe){const Ie=oe.target;Ie.removeEventListener("dispose",Ee),ge(Ie)}function ge(oe){je(oe),ee.remove(oe)}function je(oe){const Ie=ee.get(oe).programs;Ie!==void 0&&(Ie.forEach(function(qe){K.releaseProgram(qe)}),oe.isShaderMaterial&&K.releaseShaderCache(oe))}this.renderBufferDirect=function(oe,Ie,qe,Xe,We,bt){Ie===null&&(Ie=Ae);const Z=We.isMesh&&We.matrixWorld.determinant()<0,_e=wi(oe,Ie,qe,Xe,We);ne.setMaterial(Xe,Z);let Ne=qe.index,Re=1;if(Xe.wireframe===!0){if(Ne=F.getWireframeAttribute(qe),Ne===void 0)return;Re=2}const Me=qe.drawRange,Ze=qe.attributes.position;let ot=Me.start*Re,mt=(Me.start+Me.count)*Re;bt!==null&&(ot=Math.max(ot,bt.start*Re),mt=Math.min(mt,(bt.start+bt.count)*Re)),Ne!==null?(ot=Math.max(ot,0),mt=Math.min(mt,Ne.count)):Ze!=null&&(ot=Math.max(ot,0),mt=Math.min(mt,Ze.count));const pt=mt-ot;if(pt<0||pt===1/0)return;et.setup(We,Xe,_e,qe,Ne);let Rt,St=Ue;if(Ne!==null&&(Rt=ve.get(Ne),St=Pe,St.setIndex(Rt)),We.isMesh)Xe.wireframe===!0?(ne.setLineWidth(Xe.wireframeLinewidth*Be()),St.setMode(le.LINES)):St.setMode(le.TRIANGLES);else if(We.isLine){let ft=Xe.linewidth;ft===void 0&&(ft=1),ne.setLineWidth(ft*Be()),We.isLineSegments?St.setMode(le.LINES):We.isLineLoop?St.setMode(le.LINE_LOOP):St.setMode(le.LINE_STRIP)}else We.isPoints?St.setMode(le.POINTS):We.isSprite&&St.setMode(le.TRIANGLES);if(We.isBatchedMesh)St.renderMultiDraw(We._multiDrawStarts,We._multiDrawCounts,We._multiDrawCount);else if(We.isInstancedMesh)St.renderInstances(ot,pt,We.count);else if(qe.isInstancedBufferGeometry){const ft=qe._maxInstanceCount!==void 0?qe._maxInstanceCount:1/0,jt=Math.min(qe.instanceCount,ft);St.renderInstances(ot,pt,jt)}else St.render(ot,pt)};function at(oe,Ie,qe){oe.transparent===!0&&oe.side===Ol&&oe.forceSinglePass===!1?(oe.side=Da,oe.needsUpdate=!0,Vr(oe,Ie,qe),oe.side=Pu,oe.needsUpdate=!0,Vr(oe,Ie,qe),oe.side=Ol):Vr(oe,Ie,qe)}this.compile=function(oe,Ie,qe=null){qe===null&&(qe=oe),x=fe.get(qe),x.init(),M.push(x),qe.traverseVisible(function(We){We.isLight&&We.layers.test(Ie.layers)&&(x.pushLight(We),We.castShadow&&x.pushShadow(We))}),oe!==qe&&oe.traverseVisible(function(We){We.isLight&&We.layers.test(Ie.layers)&&(x.pushLight(We),We.castShadow&&x.pushShadow(We))}),x.setupLights(w._useLegacyLights);const Xe=new Set;return oe.traverse(function(We){const bt=We.material;if(bt)if(Array.isArray(bt))for(let Z=0;Z<bt.length;Z++){const _e=bt[Z];at(_e,qe,We),Xe.add(_e)}else at(bt,qe,We),Xe.add(bt)}),M.pop(),x=null,Xe},this.compileAsync=function(oe,Ie,qe=null){const Xe=this.compile(oe,Ie,qe);return new Promise(We=>{function bt(){if(Xe.forEach(function(Z){ee.get(Z).currentProgram.isReady()&&Xe.delete(Z)}),Xe.size===0){We(oe);return}setTimeout(bt,10)}z.get("KHR_parallel_shader_compile")!==null?bt():setTimeout(bt,10)})};let yt=null;function Ct(oe){yt&&yt(oe)}function tn(){wn.stop()}function Pt(){wn.start()}const wn=new C$;wn.setAnimationLoop(Ct),typeof self<"u"&&wn.setContext(self),this.setAnimationLoop=function(oe){yt=oe,ue.setAnimationLoop(oe),oe===null?wn.stop():wn.start()},ue.addEventListener("sessionstart",tn),ue.addEventListener("sessionend",Pt),this.render=function(oe,Ie){if(Ie!==void 0&&Ie.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(E===!0)return;oe.matrixWorldAutoUpdate===!0&&oe.updateMatrixWorld(),Ie.parent===null&&Ie.matrixWorldAutoUpdate===!0&&Ie.updateMatrixWorld(),ue.enabled===!0&&ue.isPresenting===!0&&(ue.cameraAutoUpdate===!0&&ue.updateCamera(Ie),Ie=ue.getCamera()),oe.isScene===!0&&oe.onBeforeRender(w,oe,Ie,R),x=fe.get(oe,M.length),x.init(),M.push(x),be.multiplyMatrices(Ie.projectionMatrix,Ie.matrixWorldInverse),re.setFromProjectionMatrix(be),ye=this.localClippingEnabled,ce=Ke.init(this.clippingPlanes,ye),b=xe.get(oe,v.length),b.init(),v.push(b),zn(oe,Ie,0,w.sortObjects),b.finish(),w.sortObjects===!0&&b.sort(Y,Q),this.info.render.frame++,ce===!0&&Ke.beginShadows();const qe=x.state.shadowsArray;if(ke.render(qe,oe,Ie),ce===!0&&Ke.endShadows(),this.info.autoReset===!0&&this.info.reset(),$e.render(b,oe),x.setupLights(w._useLegacyLights),Ie.isArrayCamera){const Xe=Ie.cameras;for(let We=0,bt=Xe.length;We<bt;We++){const Z=Xe[We];ur(b,oe,Z,Z.viewport)}}else ur(b,oe,Ie);R!==null&&(ae.updateMultisampleRenderTarget(R),ae.updateRenderTargetMipmap(R)),oe.isScene===!0&&oe.onAfterRender(w,oe,Ie),et.resetDefaultState(),U=-1,N=null,M.pop(),M.length>0?x=M[M.length-1]:x=null,v.pop(),v.length>0?b=v[v.length-1]:b=null};function zn(oe,Ie,qe,Xe){if(oe.visible===!1)return;if(oe.layers.test(Ie.layers)){if(oe.isGroup)qe=oe.renderOrder;else if(oe.isLOD)oe.autoUpdate===!0&&oe.update(Ie);else if(oe.isLight)x.pushLight(oe),oe.castShadow&&x.pushShadow(oe);else if(oe.isSprite){if(!oe.frustumCulled||re.intersectsSprite(oe)){Xe&&he.setFromMatrixPosition(oe.matrixWorld).applyMatrix4(be);const Z=k.update(oe),_e=oe.material;_e.visible&&b.push(oe,Z,_e,qe,he.z,null)}}else if((oe.isMesh||oe.isLine||oe.isPoints)&&(!oe.frustumCulled||re.intersectsObject(oe))){const Z=k.update(oe),_e=oe.material;if(Xe&&(oe.boundingSphere!==void 0?(oe.boundingSphere===null&&oe.computeBoundingSphere(),he.copy(oe.boundingSphere.center)):(Z.boundingSphere===null&&Z.computeBoundingSphere(),he.copy(Z.boundingSphere.center)),he.applyMatrix4(oe.matrixWorld).applyMatrix4(be)),Array.isArray(_e)){const Ne=Z.groups;for(let Re=0,Me=Ne.length;Re<Me;Re++){const Ze=Ne[Re],ot=_e[Ze.materialIndex];ot&&ot.visible&&b.push(oe,Z,ot,qe,he.z,Ze)}}else _e.visible&&b.push(oe,Z,_e,qe,he.z,null)}}const bt=oe.children;for(let Z=0,_e=bt.length;Z<_e;Z++)zn(bt[Z],Ie,qe,Xe)}function ur(oe,Ie,qe,Xe){const We=oe.opaque,bt=oe.transmissive,Z=oe.transparent;x.setupLightsView(qe),ce===!0&&Ke.setGlobalState(w.clippingPlanes,qe),bt.length>0&&Xi(We,bt,Ie,qe),Xe&&ne.viewport(O.copy(Xe)),We.length>0&&dr(We,Ie,qe),bt.length>0&&dr(bt,Ie,qe),Z.length>0&&dr(Z,Ie,qe),ne.buffers.depth.setTest(!0),ne.buffers.depth.setMask(!0),ne.buffers.color.setMask(!0),ne.setPolygonOffset(!1)}function Xi(oe,Ie,qe,Xe){if((qe.isScene===!0?qe.overrideMaterial:null)!==null)return;const bt=V.isWebGL2;me===null&&(me=new cf(1,1,{generateMipmaps:!0,type:z.has("EXT_color_buffer_half_float")?b0:wu,minFilter:y0,samples:bt?4:0})),w.getDrawingBufferSize(De),bt?me.setSize(De.x,De.y):me.setSize(f_(De.x),f_(De.y));const Z=w.getRenderTarget();w.setRenderTarget(me),w.getClearColor(W),L=w.getClearAlpha(),L<1&&w.setClearColor(16777215,.5),w.clear();const _e=w.toneMapping;w.toneMapping=Su,dr(oe,qe,Xe),ae.updateMultisampleRenderTarget(me),ae.updateRenderTargetMipmap(me);let Ne=!1;for(let Re=0,Me=Ie.length;Re<Me;Re++){const Ze=Ie[Re],ot=Ze.object,mt=Ze.geometry,pt=Ze.material,Rt=Ze.group;if(pt.side===Ol&&ot.layers.test(Xe.layers)){const St=pt.side;pt.side=Da,pt.needsUpdate=!0,Ar(ot,qe,Xe,mt,pt,Rt),pt.side=St,pt.needsUpdate=!0,Ne=!0}}Ne===!0&&(ae.updateMultisampleRenderTarget(me),ae.updateRenderTargetMipmap(me)),w.setRenderTarget(Z),w.setClearColor(W,L),w.toneMapping=_e}function dr(oe,Ie,qe){const Xe=Ie.isScene===!0?Ie.overrideMaterial:null;for(let We=0,bt=oe.length;We<bt;We++){const Z=oe[We],_e=Z.object,Ne=Z.geometry,Re=Xe===null?Z.material:Xe,Me=Z.group;_e.layers.test(qe.layers)&&Ar(_e,Ie,qe,Ne,Re,Me)}}function Ar(oe,Ie,qe,Xe,We,bt){oe.onBeforeRender(w,Ie,qe,Xe,We,bt),oe.modelViewMatrix.multiplyMatrices(qe.matrixWorldInverse,oe.matrixWorld),oe.normalMatrix.getNormalMatrix(oe.modelViewMatrix),We.onBeforeRender(w,Ie,qe,Xe,oe,bt),We.transparent===!0&&We.side===Ol&&We.forceSinglePass===!1?(We.side=Da,We.needsUpdate=!0,w.renderBufferDirect(qe,Ie,Xe,We,oe,bt),We.side=Pu,We.needsUpdate=!0,w.renderBufferDirect(qe,Ie,Xe,We,oe,bt),We.side=Ol):w.renderBufferDirect(qe,Ie,Xe,We,oe,bt),oe.onAfterRender(w,Ie,qe,Xe,We,bt)}function Vr(oe,Ie,qe){Ie.isScene!==!0&&(Ie=Ae);const Xe=ee.get(oe),We=x.state.lights,bt=x.state.shadowsArray,Z=We.state.version,_e=K.getParameters(oe,We.state,bt,Ie,qe),Ne=K.getProgramCacheKey(_e);let Re=Xe.programs;Xe.environment=oe.isMeshStandardMaterial?Ie.environment:null,Xe.fog=Ie.fog,Xe.envMap=(oe.isMeshStandardMaterial?we:ie).get(oe.envMap||Xe.environment),Re===void 0&&(oe.addEventListener("dispose",Ee),Re=new Map,Xe.programs=Re);let Me=Re.get(Ne);if(Me!==void 0){if(Xe.currentProgram===Me&&Xe.lightsStateVersion===Z)return si(oe,_e),Me}else _e.uniforms=K.getUniforms(oe),oe.onBuild(qe,_e,w),oe.onBeforeCompile(_e,w),Me=K.acquireProgram(_e,Ne),Re.set(Ne,Me),Xe.uniforms=_e.uniforms;const Ze=Xe.uniforms;return(!oe.isShaderMaterial&&!oe.isRawShaderMaterial||oe.clipping===!0)&&(Ze.clippingPlanes=Ke.uniform),si(oe,_e),Xe.needsLights=gc(oe),Xe.lightsStateVersion=Z,Xe.needsLights&&(Ze.ambientLightColor.value=We.state.ambient,Ze.lightProbe.value=We.state.probe,Ze.directionalLights.value=We.state.directional,Ze.directionalLightShadows.value=We.state.directionalShadow,Ze.spotLights.value=We.state.spot,Ze.spotLightShadows.value=We.state.spotShadow,Ze.rectAreaLights.value=We.state.rectArea,Ze.ltc_1.value=We.state.rectAreaLTC1,Ze.ltc_2.value=We.state.rectAreaLTC2,Ze.pointLights.value=We.state.point,Ze.pointLightShadows.value=We.state.pointShadow,Ze.hemisphereLights.value=We.state.hemi,Ze.directionalShadowMap.value=We.state.directionalShadowMap,Ze.directionalShadowMatrix.value=We.state.directionalShadowMatrix,Ze.spotShadowMap.value=We.state.spotShadowMap,Ze.spotLightMatrix.value=We.state.spotLightMatrix,Ze.spotLightMap.value=We.state.spotLightMap,Ze.pointShadowMap.value=We.state.pointShadowMap,Ze.pointShadowMatrix.value=We.state.pointShadowMatrix),Xe.currentProgram=Me,Xe.uniformsList=null,Me}function Di(oe){if(oe.uniformsList===null){const Ie=oe.currentProgram.getUniforms();oe.uniformsList=Fb.seqWithValue(Ie.seq,oe.uniforms)}return oe.uniformsList}function si(oe,Ie){const qe=ee.get(oe);qe.outputColorSpace=Ie.outputColorSpace,qe.batching=Ie.batching,qe.instancing=Ie.instancing,qe.instancingColor=Ie.instancingColor,qe.skinning=Ie.skinning,qe.morphTargets=Ie.morphTargets,qe.morphNormals=Ie.morphNormals,qe.morphColors=Ie.morphColors,qe.morphTargetsCount=Ie.morphTargetsCount,qe.numClippingPlanes=Ie.numClippingPlanes,qe.numIntersection=Ie.numClipIntersection,qe.vertexAlphas=Ie.vertexAlphas,qe.vertexTangents=Ie.vertexTangents,qe.toneMapping=Ie.toneMapping}function wi(oe,Ie,qe,Xe,We){Ie.isScene!==!0&&(Ie=Ae),ae.resetTextureUnits();const bt=Ie.fog,Z=Xe.isMeshStandardMaterial?Ie.environment:null,_e=R===null?w.outputColorSpace:R.isXRRenderTarget===!0?R.texture.colorSpace:ec,Ne=(Xe.isMeshStandardMaterial?we:ie).get(Xe.envMap||Z),Re=Xe.vertexColors===!0&&!!qe.attributes.color&&qe.attributes.color.itemSize===4,Me=!!qe.attributes.tangent&&(!!Xe.normalMap||Xe.anisotropy>0),Ze=!!qe.morphAttributes.position,ot=!!qe.morphAttributes.normal,mt=!!qe.morphAttributes.color;let pt=Su;Xe.toneMapped&&(R===null||R.isXRRenderTarget===!0)&&(pt=w.toneMapping);const Rt=qe.morphAttributes.position||qe.morphAttributes.normal||qe.morphAttributes.color,St=Rt!==void 0?Rt.length:0,ft=ee.get(Xe),jt=x.state.lights;if(ce===!0&&(ye===!0||oe!==N)){const Mi=oe===N&&Xe.id===U;Ke.setState(Xe,oe,Mi)}let Ot=!1;Xe.version===ft.__version?(ft.needsLights&&ft.lightsStateVersion!==jt.state.version||ft.outputColorSpace!==_e||We.isBatchedMesh&&ft.batching===!1||!We.isBatchedMesh&&ft.batching===!0||We.isInstancedMesh&&ft.instancing===!1||!We.isInstancedMesh&&ft.instancing===!0||We.isSkinnedMesh&&ft.skinning===!1||!We.isSkinnedMesh&&ft.skinning===!0||We.isInstancedMesh&&ft.instancingColor===!0&&We.instanceColor===null||We.isInstancedMesh&&ft.instancingColor===!1&&We.instanceColor!==null||ft.envMap!==Ne||Xe.fog===!0&&ft.fog!==bt||ft.numClippingPlanes!==void 0&&(ft.numClippingPlanes!==Ke.numPlanes||ft.numIntersection!==Ke.numIntersection)||ft.vertexAlphas!==Re||ft.vertexTangents!==Me||ft.morphTargets!==Ze||ft.morphNormals!==ot||ft.morphColors!==mt||ft.toneMapping!==pt||V.isWebGL2===!0&&ft.morphTargetsCount!==St)&&(Ot=!0):(Ot=!0,ft.__version=Xe.version);let Yt=ft.currentProgram;Ot===!0&&(Yt=Vr(Xe,Ie,We));let rn=!1,cn=!1,Dt=!1;const Gt=Yt.getUniforms(),Wt=ft.uniforms;if(ne.useProgram(Yt.program)&&(rn=!0,cn=!0,Dt=!0),Xe.id!==U&&(U=Xe.id,cn=!0),rn||N!==oe){Gt.setValue(le,"projectionMatrix",oe.projectionMatrix),Gt.setValue(le,"viewMatrix",oe.matrixWorldInverse);const Mi=Gt.map.cameraPosition;Mi!==void 0&&Mi.setValue(le,he.setFromMatrixPosition(oe.matrixWorld)),V.logarithmicDepthBuffer&&Gt.setValue(le,"logDepthBufFC",2/(Math.log(oe.far+1)/Math.LN2)),(Xe.isMeshPhongMaterial||Xe.isMeshToonMaterial||Xe.isMeshLambertMaterial||Xe.isMeshBasicMaterial||Xe.isMeshStandardMaterial||Xe.isShaderMaterial)&&Gt.setValue(le,"isOrthographic",oe.isOrthographicCamera===!0),N!==oe&&(N=oe,cn=!0,Dt=!0)}if(We.isSkinnedMesh){Gt.setOptional(le,We,"bindMatrix"),Gt.setOptional(le,We,"bindMatrixInverse");const Mi=We.skeleton;Mi&&(V.floatVertexTextures?(Mi.boneTexture===null&&Mi.computeBoneTexture(),Gt.setValue(le,"boneTexture",Mi.boneTexture,ae)):console.warn("THREE.WebGLRenderer: SkinnedMesh can only be used with WebGL 2. With WebGL 1 OES_texture_float and vertex textures support is required."))}We.isBatchedMesh&&(Gt.setOptional(le,We,"batchingTexture"),Gt.setValue(le,"batchingTexture",We._matricesTexture,ae));const hi=qe.morphAttributes;if((hi.position!==void 0||hi.normal!==void 0||hi.color!==void 0&&V.isWebGL2===!0)&&rt.update(We,qe,Yt),(cn||ft.receiveShadow!==We.receiveShadow)&&(ft.receiveShadow=We.receiveShadow,Gt.setValue(le,"receiveShadow",We.receiveShadow)),Xe.isMeshGouraudMaterial&&Xe.envMap!==null&&(Wt.envMap.value=Ne,Wt.flipEnvMap.value=Ne.isCubeTexture&&Ne.isRenderTargetTexture===!1?-1:1),cn&&(Gt.setValue(le,"toneMappingExposure",w.toneMappingExposure),ft.needsLights&&$s(Wt,Dt),bt&&Xe.fog===!0&&pe.refreshFogUniforms(Wt,bt),pe.refreshMaterialUniforms(Wt,Xe,G,q,me),Fb.upload(le,Di(ft),Wt,ae)),Xe.isShaderMaterial&&Xe.uniformsNeedUpdate===!0&&(Fb.upload(le,Di(ft),Wt,ae),Xe.uniformsNeedUpdate=!1),Xe.isSpriteMaterial&&Gt.setValue(le,"center",We.center),Gt.setValue(le,"modelViewMatrix",We.modelViewMatrix),Gt.setValue(le,"normalMatrix",We.normalMatrix),Gt.setValue(le,"modelMatrix",We.matrixWorld),Xe.isShaderMaterial||Xe.isRawShaderMaterial){const Mi=Xe.uniformsGroups;for(let Sn=0,Ws=Mi.length;Sn<Ws;Sn++)if(V.isWebGL2){const Mn=Mi[Sn];Qe.update(Mn,Yt),Qe.bind(Mn,Yt)}else console.warn("THREE.WebGLRenderer: Uniform Buffer Objects can only be used with WebGL 2.")}return Yt}function $s(oe,Ie){oe.ambientLightColor.needsUpdate=Ie,oe.lightProbe.needsUpdate=Ie,oe.directionalLights.needsUpdate=Ie,oe.directionalLightShadows.needsUpdate=Ie,oe.pointLights.needsUpdate=Ie,oe.pointLightShadows.needsUpdate=Ie,oe.spotLights.needsUpdate=Ie,oe.spotLightShadows.needsUpdate=Ie,oe.rectAreaLights.needsUpdate=Ie,oe.hemisphereLights.needsUpdate=Ie}function gc(oe){return oe.isMeshLambertMaterial||oe.isMeshToonMaterial||oe.isMeshPhongMaterial||oe.isMeshStandardMaterial||oe.isShadowMaterial||oe.isShaderMaterial&&oe.lights===!0}this.getActiveCubeFace=function(){return T},this.getActiveMipmapLevel=function(){return P},this.getRenderTarget=function(){return R},this.setRenderTargetTextures=function(oe,Ie,qe){ee.get(oe.texture).__webglTexture=Ie,ee.get(oe.depthTexture).__webglTexture=qe;const Xe=ee.get(oe);Xe.__hasExternalTextures=!0,Xe.__hasExternalTextures&&(Xe.__autoAllocateDepthBuffer=qe===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(oe,Ie){const qe=ee.get(oe);qe.__webglFramebuffer=Ie,qe.__useDefaultFramebuffer=Ie===void 0},this.setRenderTarget=function(oe,Ie=0,qe=0){R=oe,T=Ie,P=qe;let Xe=!0,We=null,bt=!1,Z=!1;if(oe){const Ne=ee.get(oe);Ne.__useDefaultFramebuffer!==void 0?(ne.bindFramebuffer(le.FRAMEBUFFER,null),Xe=!1):Ne.__webglFramebuffer===void 0?ae.setupRenderTarget(oe):Ne.__hasExternalTextures&&ae.rebindTextures(oe,ee.get(oe.texture).__webglTexture,ee.get(oe.depthTexture).__webglTexture);const Re=oe.texture;(Re.isData3DTexture||Re.isDataArrayTexture||Re.isCompressedArrayTexture)&&(Z=!0);const Me=ee.get(oe).__webglFramebuffer;oe.isWebGLCubeRenderTarget?(Array.isArray(Me[Ie])?We=Me[Ie][qe]:We=Me[Ie],bt=!0):V.isWebGL2&&oe.samples>0&&ae.useMultisampledRTT(oe)===!1?We=ee.get(oe).__webglMultisampledFramebuffer:Array.isArray(Me)?We=Me[qe]:We=Me,O.copy(oe.viewport),B.copy(oe.scissor),I=oe.scissorTest}else O.copy(se).multiplyScalar(G).floor(),B.copy(H).multiplyScalar(G).floor(),I=X;if(ne.bindFramebuffer(le.FRAMEBUFFER,We)&&V.drawBuffers&&Xe&&ne.drawBuffers(oe,We),ne.viewport(O),ne.scissor(B),ne.setScissorTest(I),bt){const Ne=ee.get(oe.texture);le.framebufferTexture2D(le.FRAMEBUFFER,le.COLOR_ATTACHMENT0,le.TEXTURE_CUBE_MAP_POSITIVE_X+Ie,Ne.__webglTexture,qe)}else if(Z){const Ne=ee.get(oe.texture),Re=Ie||0;le.framebufferTextureLayer(le.FRAMEBUFFER,le.COLOR_ATTACHMENT0,Ne.__webglTexture,qe||0,Re)}U=-1},this.readRenderTargetPixels=function(oe,Ie,qe,Xe,We,bt,Z){if(!(oe&&oe.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let _e=ee.get(oe).__webglFramebuffer;if(oe.isWebGLCubeRenderTarget&&Z!==void 0&&(_e=_e[Z]),_e){ne.bindFramebuffer(le.FRAMEBUFFER,_e);try{const Ne=oe.texture,Re=Ne.format,Me=Ne.type;if(Re!==Ps&&dt.convert(Re)!==le.getParameter(le.IMPLEMENTATION_COLOR_READ_FORMAT)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}const Ze=Me===b0&&(z.has("EXT_color_buffer_half_float")||V.isWebGL2&&z.has("EXT_color_buffer_float"));if(Me!==wu&&dt.convert(Me)!==le.getParameter(le.IMPLEMENTATION_COLOR_READ_TYPE)&&!(Me===zl&&(V.isWebGL2||z.has("OES_texture_float")||z.has("WEBGL_color_buffer_float")))&&!Ze){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}Ie>=0&&Ie<=oe.width-Xe&&qe>=0&&qe<=oe.height-We&&le.readPixels(Ie,qe,Xe,We,dt.convert(Re),dt.convert(Me),bt)}finally{const Ne=R!==null?ee.get(R).__webglFramebuffer:null;ne.bindFramebuffer(le.FRAMEBUFFER,Ne)}}},this.copyFramebufferToTexture=function(oe,Ie,qe=0){const Xe=Math.pow(2,-qe),We=Math.floor(Ie.image.width*Xe),bt=Math.floor(Ie.image.height*Xe);ae.setTexture2D(Ie,0),le.copyTexSubImage2D(le.TEXTURE_2D,qe,0,0,oe.x,oe.y,We,bt),ne.unbindTexture()},this.copyTextureToTexture=function(oe,Ie,qe,Xe=0){const We=Ie.image.width,bt=Ie.image.height,Z=dt.convert(qe.format),_e=dt.convert(qe.type);ae.setTexture2D(qe,0),le.pixelStorei(le.UNPACK_FLIP_Y_WEBGL,qe.flipY),le.pixelStorei(le.UNPACK_PREMULTIPLY_ALPHA_WEBGL,qe.premultiplyAlpha),le.pixelStorei(le.UNPACK_ALIGNMENT,qe.unpackAlignment),Ie.isDataTexture?le.texSubImage2D(le.TEXTURE_2D,Xe,oe.x,oe.y,We,bt,Z,_e,Ie.image.data):Ie.isCompressedTexture?le.compressedTexSubImage2D(le.TEXTURE_2D,Xe,oe.x,oe.y,Ie.mipmaps[0].width,Ie.mipmaps[0].height,Z,Ie.mipmaps[0].data):le.texSubImage2D(le.TEXTURE_2D,Xe,oe.x,oe.y,Z,_e,Ie.image),Xe===0&&qe.generateMipmaps&&le.generateMipmap(le.TEXTURE_2D),ne.unbindTexture()},this.copyTextureToTexture3D=function(oe,Ie,qe,Xe,We=0){if(w.isWebGL1Renderer){console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");return}const bt=oe.max.x-oe.min.x+1,Z=oe.max.y-oe.min.y+1,_e=oe.max.z-oe.min.z+1,Ne=dt.convert(Xe.format),Re=dt.convert(Xe.type);let Me;if(Xe.isData3DTexture)ae.setTexture3D(Xe,0),Me=le.TEXTURE_3D;else if(Xe.isDataArrayTexture)ae.setTexture2DArray(Xe,0),Me=le.TEXTURE_2D_ARRAY;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}le.pixelStorei(le.UNPACK_FLIP_Y_WEBGL,Xe.flipY),le.pixelStorei(le.UNPACK_PREMULTIPLY_ALPHA_WEBGL,Xe.premultiplyAlpha),le.pixelStorei(le.UNPACK_ALIGNMENT,Xe.unpackAlignment);const Ze=le.getParameter(le.UNPACK_ROW_LENGTH),ot=le.getParameter(le.UNPACK_IMAGE_HEIGHT),mt=le.getParameter(le.UNPACK_SKIP_PIXELS),pt=le.getParameter(le.UNPACK_SKIP_ROWS),Rt=le.getParameter(le.UNPACK_SKIP_IMAGES),St=qe.isCompressedTexture?qe.mipmaps[0]:qe.image;le.pixelStorei(le.UNPACK_ROW_LENGTH,St.width),le.pixelStorei(le.UNPACK_IMAGE_HEIGHT,St.height),le.pixelStorei(le.UNPACK_SKIP_PIXELS,oe.min.x),le.pixelStorei(le.UNPACK_SKIP_ROWS,oe.min.y),le.pixelStorei(le.UNPACK_SKIP_IMAGES,oe.min.z),qe.isDataTexture||qe.isData3DTexture?le.texSubImage3D(Me,We,Ie.x,Ie.y,Ie.z,bt,Z,_e,Ne,Re,St.data):qe.isCompressedArrayTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),le.compressedTexSubImage3D(Me,We,Ie.x,Ie.y,Ie.z,bt,Z,_e,Ne,St.data)):le.texSubImage3D(Me,We,Ie.x,Ie.y,Ie.z,bt,Z,_e,Ne,Re,St),le.pixelStorei(le.UNPACK_ROW_LENGTH,Ze),le.pixelStorei(le.UNPACK_IMAGE_HEIGHT,ot),le.pixelStorei(le.UNPACK_SKIP_PIXELS,mt),le.pixelStorei(le.UNPACK_SKIP_ROWS,pt),le.pixelStorei(le.UNPACK_SKIP_IMAGES,Rt),We===0&&Xe.generateMipmaps&&le.generateMipmap(Me),ne.unbindTexture()},this.initTexture=function(oe){oe.isCubeTexture?ae.setTextureCube(oe,0):oe.isData3DTexture?ae.setTexture3D(oe,0):oe.isDataArrayTexture||oe.isCompressedArrayTexture?ae.setTexture2DArray(oe,0):ae.setTexture2D(oe,0),ne.unbindTexture()},this.resetState=function(){T=0,P=0,R=null,ne.reset(),et.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return Lo}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const n=this.getContext();n.drawingBufferColorSpace=e===ZN?"display-p3":"srgb",n.unpackColorSpace=kn.workingColorSpace===hS?"display-p3":"srgb"}get physicallyCorrectLights(){return console.warn("THREE.WebGLRenderer: The property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead."),!this.useLegacyLights}set physicallyCorrectLights(e){console.warn("THREE.WebGLRenderer: The property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead."),this.useLegacyLights=!e}get outputEncoding(){return console.warn("THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead."),this.outputColorSpace===Fr?Hd:f$}set outputEncoding(e){console.warn("THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead."),this.outputColorSpace=e===Hd?Fr:ec}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 Pve extends PR{}Pve.prototype.isWebGL1Renderer=!0;class iP{constructor(e,n=1,i=1e3){this.isFog=!0,this.name="",this.color=new Ut(e),this.near=n,this.far=i}clone(){return new iP(this.color,this.near,this.far)}toJSON(){return{type:"Fog",name:this.name,color:this.color.getHex(),near:this.near,far:this.far}}}class Dve extends ha{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 Ove{constructor(e,n){this.isInterleavedBuffer=!0,this.array=e,this.stride=n,this.count=e!==void 0?e.length/n:0,this.usage=TR,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.version=0,this.uuid=Wl()}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=Wl()),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=Wl()),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 sa=new Ce;class mu{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++)sa.fromBufferAttribute(this,n),sa.applyMatrix4(e),this.setXYZ(n,sa.x,sa.y,sa.z);return this}applyNormalMatrix(e){for(let n=0,i=this.count;n<i;n++)sa.fromBufferAttribute(this,n),sa.applyNormalMatrix(e),this.setXYZ(n,sa.x,sa.y,sa.z);return this}transformDirection(e){for(let n=0,i=this.count;n<i;n++)sa.fromBufferAttribute(this,n),sa.transformDirection(e),this.setXYZ(n,sa.x,sa.y,sa.z);return this}setX(e,n){return this.normalized&&(n=Ln(n,this.array)),this.data.array[e*this.data.stride+this.offset]=n,this}setY(e,n){return this.normalized&&(n=Ln(n,this.array)),this.data.array[e*this.data.stride+this.offset+1]=n,this}setZ(e,n){return this.normalized&&(n=Ln(n,this.array)),this.data.array[e*this.data.stride+this.offset+2]=n,this}setW(e,n){return this.normalized&&(n=Ln(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=Do(n,this.array)),n}getY(e){let n=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(n=Do(n,this.array)),n}getZ(e){let n=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(n=Do(n,this.array)),n}getW(e){let n=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(n=Do(n,this.array)),n}setXY(e,n,i){return e=e*this.data.stride+this.offset,this.normalized&&(n=Ln(n,this.array),i=Ln(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=Ln(n,this.array),i=Ln(i,this.array),r=Ln(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=Ln(n,this.array),i=Ln(i,this.array),r=Ln(r,this.array),a=Ln(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 is(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 mu(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 Lve extends Oa{constructor(e=null,n=1,i=1,r,a,s,o,l,c=Ur,d=Ur,f,p){super(null,s,o,l,c,d,r,a,f,p),this.isDataTexture=!0,this.image={data:e,width:n,height:i},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}function kve(t,e){return t.z-e.z}function Ive(t,e){return e.z-t.z}class Uve{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 zh="batchId",Zc=new Wn,Xz=new Wn,Fve=new Wn,Yz=new Wn,WA=new pS,Gy=new Us,xd=new Io,vg=new Ce,qA=new Uve,Yr=new co,$y=[];function zve(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 Bve extends co{get maxGeometryCount(){return this._maxGeometryCount}constructor(e,n,i=n*2,r){super(new na,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 Lve(n,e,e,Ps,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,p=new c.constructor(i*d),m=new l.constructor(p,d,f);m.setUsage(l.usage),n.setAttribute(o,m)}if(e.getIndex()!==null){const o=i>65536?new Uint32Array(a):new Uint16Array(a);n.setIndex(new is(o,1))}const s=r>65536?new Uint32Array(i):new Uint16Array(i);n.setAttribute(zh,new is(s,1)),this._geometryInitialized=!0}}_validateGeometry(e){if(e.getAttribute(zh))throw new Error(`BatchedMesh: Geometry cannot use attribute "${zh}"`);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===zh)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 Us);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,Zc),this.getBoundingBoxAt(r,Gy).applyMatrix4(Zc),n.union(Gy))}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new Io);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,Zc),this.getBoundingSphereAt(r,xd).applyMatrix4(Zc),n.union(xd))}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,p=this._active,m=this._matricesTexture,y=this._matricesTexture.image.data;f.push(!0),p.push(!0);const b=this._geometryCount;this._geometryCount++,Fve.toArray(y,b*16),m.needsUpdate=!0,s.push(r),o.push({start:d?r.indexStart:r.vertexStart,count:-1}),l.push({boxInitialized:!1,box:new Us,sphereInitialized:!1,sphere:new Io});const x=this.geometry.getAttribute(zh);for(let v=0;v<r.vertexCount;v++)x.setX(r.vertexStart+v,b);return x.needsUpdate=!0,this.setGeometryAt(b,e),b}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 m in i.attributes){if(m===zh)continue;const y=n.getAttribute(m),b=i.getAttribute(m);zve(y,b,l);const x=y.itemSize;for(let v=y.count,M=c;v<M;v++){const w=l+v;for(let E=0;E<x;E++)b.setComponent(w,E,0)}b.needsUpdate=!0}if(r){const m=o.indexStart;for(let y=0;y<s.count;y++)a.setX(m+y,l+s.getX(y));for(let y=s.count,b=o.indexCount;y<b;y++)a.setX(m+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],p=n.getAttribute("position");return f.count=r?s.count:p.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 p=d;o&&(p=o.getX(p)),a.expandByPoint(vg.fromBufferAttribute(l,p))}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,Gy),Gy.getCenter(a.center);const o=s.index,l=s.attributes.position,c=this._drawRanges[e];let d=0;for(let f=c.start,p=c.start+c.count;f<p;f++){let m=f;o&&(m=o.getX(m)),vg.fromBufferAttribute(l,m),d=Math.max(d,a.center.distanceToSquared(vg))}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;Yr.material=this.material,Yr.geometry.index=l.index,Yr.geometry.attributes=l.attributes,Yr.geometry.boundingBox===null&&(Yr.geometry.boundingBox=new Us),Yr.geometry.boundingSphere===null&&(Yr.geometry.boundingSphere=new Io);for(let c=0;c<s;c++){if(!i[c]||!r[c])continue;const d=a[c];Yr.geometry.setDrawRange(d.start,d.count),this.getMatrixAt(c,Yr.matrixWorld).premultiply(o),this.getBoundingBoxAt(c,Yr.geometry.boundingBox),this.getBoundingSphereAt(c,Yr.geometry.boundingSphere),Yr.raycast(e,$y);for(let f=0,p=$y.length;f<p;f++){const m=$y[f];m.object=this,m.batchId=c,n.push(m)}$y.length=0}Yr.material=null,Yr.geometry.index=null,Yr.geometry.attributes={},Yr.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,p=this.perObjectFrustumCulled;p&&(Yz.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse).multiply(this.matrixWorld),WA.setFromProjectionMatrix(Yz,e.isWebGPURenderer?_0:Lo));let m=0;if(this.sortObjects){Xz.copy(this.matrixWorld).invert(),vg.setFromMatrixPosition(i.matrixWorld).applyMatrix4(Xz);for(let x=0,v=l.length;x<v;x++)if(l[x]){this.getMatrixAt(x,Zc),this.getBoundingSphereAt(x,xd).applyMatrix4(Zc);let M=!1;if(p&&(M=!WA.intersectsSphere(xd)),!M){const w=vg.distanceTo(xd.center);qA.push(f[x],w)}}const y=qA.list,b=this.customSort;b===null?y.sort(a.transparent?Ive:kve):b.call(this,y,i);for(let x=0,v=y.length;x<v;x++){const M=y[x];c[m]=M.start*o,d[m]=M.count,m++}qA.reset()}else for(let y=0,b=l.length;y<b;y++)if(l[y]){let x=!1;if(p&&(this.getMatrixAt(y,Zc),this.getBoundingSphereAt(y,xd).applyMatrix4(Zc),x=!WA.intersectsSphere(xd)),!x){const v=f[y];c[m]=v.start*o,d[m]=v.count,m++}}this._multiDrawCount=m,this._visibilityChanged=!1}onBeforeShadow(e,n,i,r,a,s){this.onBeforeRender(e,null,r,a,s)}}class sv extends Zp{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new Ut(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 Kz=new Ce,Zz=new Ce,Jz=new Wn,XA=new QN,Wy=new Io;class jve extends ha{constructor(e=new na,n=new sv){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++)Kz.fromBufferAttribute(n,r-1),Zz.fromBufferAttribute(n,r),i[r]=i[r-1],i[r]+=Kz.distanceTo(Zz);e.setAttribute("lineDistance",new Ni(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(),Wy.copy(i.boundingSphere),Wy.applyMatrix4(r),Wy.radius+=a,e.ray.intersectsSphere(Wy)===!1)return;Jz.copy(r).invert(),XA.copy(e.ray).applyMatrix4(Jz);const o=a/((this.scale.x+this.scale.y+this.scale.z)/3),l=o*o,c=new Ce,d=new Ce,f=new Ce,p=new Ce,m=this.isLineSegments?2:1,y=i.index,x=i.attributes.position;if(y!==null){const v=Math.max(0,s.start),M=Math.min(y.count,s.start+s.count);for(let w=v,E=M-1;w<E;w+=m){const T=y.getX(w),P=y.getX(w+1);if(c.fromBufferAttribute(x,T),d.fromBufferAttribute(x,P),XA.distanceSqToSegment(c,d,p,f)>l)continue;p.applyMatrix4(this.matrixWorld);const U=e.ray.origin.distanceTo(p);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 v=Math.max(0,s.start),M=Math.min(x.count,s.start+s.count);for(let w=v,E=M-1;w<E;w+=m){if(c.fromBufferAttribute(x,w),d.fromBufferAttribute(x,w+1),XA.distanceSqToSegment(c,d,p,f)>l)continue;p.applyMatrix4(this.matrixWorld);const P=e.ray.origin.distanceTo(p);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 Qz=new Ce,eB=new Ce;class gS extends jve{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)Qz.fromBufferAttribute(n,r),eB.fromBufferAttribute(n,r+1),i[r]=r===0?0:i[r-1],i[r+1]=i[r]+Qz.distanceTo(eB);e.setAttribute("lineDistance",new Ni(i,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class Hve extends na{constructor(e=null){if(super(),this.type="WireframeGeometry",this.parameters={geometry:e},e!==null){const n=[],i=new Set,r=new Ce,a=new Ce;if(e.index!==null){const s=e.attributes.position,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],p=f.start,m=f.count;for(let y=p,b=p+m;y<b;y+=3)for(let x=0;x<3;x++){const v=o.getX(y+x),M=o.getX(y+(x+1)%3);r.fromBufferAttribute(s,v),a.fromBufferAttribute(s,M),tB(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),tB(r,a,i)===!0&&(n.push(r.x,r.y,r.z),n.push(a.x,a.y,a.z))}}this.setAttribute("position",new Ni(n,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}}function tB(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 Vve extends Zp{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new Ut(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Ut(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=h$,this.normalScale=new Vt(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=YN,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 Gve extends sv{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 k$ extends ha{constructor(e,n=1){super(),this.isLight=!0,this.type="Light",this.color=new Ut(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 YA=new Wn,nB=new Ce,iB=new Ce;class $ve{constructor(e){this.camera=e,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new Vt(512,512),this.map=null,this.mapPass=null,this.matrix=new Wn,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new pS,this._frameExtents=new Vt(1,1),this._viewportCount=1,this._viewports=[new Un(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const n=this.camera,i=this.matrix;nB.setFromMatrixPosition(e.matrixWorld),n.position.copy(nB),iB.setFromMatrixPosition(e.target.matrixWorld),n.lookAt(iB),n.updateMatrixWorld(),YA.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(YA),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.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 rB=new Wn,xg=new Ce,KA=new Ce;class Wve extends $ve{constructor(){super(new Ja(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new Vt(4,2),this._viewportCount=6,this._viewports=[new Un(2,1,1,1),new Un(0,1,1,1),new Un(3,1,1,1),new Un(1,1,1,1),new Un(3,0,1,1),new Un(1,0,1,1)],this._cubeDirections=[new Ce(1,0,0),new Ce(-1,0,0),new Ce(0,0,1),new Ce(0,0,-1),new Ce(0,1,0),new Ce(0,-1,0)],this._cubeUps=[new Ce(0,1,0),new Ce(0,1,0),new Ce(0,1,0),new Ce(0,1,0),new Ce(0,0,1),new Ce(0,0,-1)]}updateMatrices(e,n=0){const i=this.camera,r=this.matrix,a=e.distance||i.far;a!==i.far&&(i.far=a,i.updateProjectionMatrix()),xg.setFromMatrixPosition(e.matrixWorld),i.position.copy(xg),KA.copy(i.position),KA.add(this._cubeDirections[n]),i.up.copy(this._cubeUps[n]),i.lookAt(KA),i.updateMatrixWorld(),r.makeTranslation(-xg.x,-xg.y,-xg.z),rB.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),this._frustum.setFromProjectionMatrix(rB)}}class qve extends k${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 Wve}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 Xve extends k${constructor(e,n){super(e,n),this.isAmbientLight=!0,this.type="AmbientLight"}}class Yve extends na{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 DR extends Ove{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 aB{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(zr(n/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}}const sB=new Ce,qy=new Ce;class Kve{constructor(e=new Ce,n=new Ce){this.start=e,this.end=n}set(e,n){return this.start.copy(e),this.end.copy(n),this}copy(e){return this.start.copy(e.start),this.end.copy(e.end),this}getCenter(e){return e.addVectors(this.start,this.end).multiplyScalar(.5)}delta(e){return e.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(e,n){return this.delta(n).multiplyScalar(e).add(this.start)}closestPointToPointParameter(e,n){sB.subVectors(e,this.start),qy.subVectors(this.end,this.start);const i=qy.dot(qy);let a=qy.dot(sB)/i;return n&&(a=zr(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 Zve extends gS{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 na;r.setAttribute("position",new Ni(n,3)),r.setAttribute("color",new Ni(i,3));const a=new sv({vertexColors:!0,toneMapped:!1});super(r,a),this.type="AxesHelper"}setColors(e,n,i){const r=new Ut,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:dS}}));typeof window<"u"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=dS);class Uo{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"),Uo.nextNameID=Uo.nextNameID||0,this.$name.id=`lil-gui-name-${++Uo.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 Jve extends Uo{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 OR(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 Qve={isPrimitive:!0,match:t=>typeof t=="string",fromHexString:OR,toHexString:OR},w0={isPrimitive:!0,match:t=>typeof t=="number",fromHexString:t=>parseInt(t.substring(1),16),toHexString:t=>"#"+t.toString(16).padStart(6,0)},exe={isPrimitive:!1,match:t=>Array.isArray(t),fromHexString(t,e,n=1){const i=w0.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 w0.toHexString(r)}},txe={isPrimitive:!1,match:t=>Object(t)===t,fromHexString(t,e,n=1){const i=w0.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 w0.toHexString(r)}},nxe=[Qve,w0,exe,txe];function ixe(t){return nxe.find(e=>e.match(t))}class rxe extends Uo{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=ixe(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=OR(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 ZA extends Uo{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 axe extends Uo{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 p=5,m=M=>{o=M.clientX,l=c=M.clientY,s=!0,d=this.getValue(),f=0,window.addEventListener("mousemove",y),window.addEventListener("mouseup",b)},y=M=>{if(s){const w=M.clientX-o,E=M.clientY-l;Math.abs(E)>p?(M.preventDefault(),this.$input.blur(),s=!1,this._setDraggingStyle(!0,"vertical")):Math.abs(w)>p&&b()}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},b=()=>{this._setDraggingStyle(!1,"vertical"),this._callOnFinishChange(),window.removeEventListener("mousemove",y),window.removeEventListener("mouseup",b)},x=()=>{this._inputFocused=!0},v=()=>{this._inputFocused=!1,this.updateDisplay(),this._callOnFinishChange()};this.$input.addEventListener("input",n),this.$input.addEventListener("keydown",r),this.$input.addEventListener("wheel",a,{passive:!1}),this.$input.addEventListener("mousedown",m),this.$input.addEventListener("focus",x),this.$input.addEventListener("blur",v)}_initSlider(){this._hasSlider=!0,this.$slider=document.createElement("div"),this.$slider.classList.add("slider"),this.$fill=document.createElement("div"),this.$fill.classList.add("fill"),this.$slider.appendChild(this.$fill),this.$widget.insertBefore(this.$slider,this.$input),this.domElement.classList.add("hasSlider");const e=(v,M,w,E,T)=>(v-M)/(w-M)*(T-E)+E,n=v=>{const M=this.$slider.getBoundingClientRect();let w=e(v,M.left,M.right,this._min,this._max);this._snapClampSetValue(w)},i=v=>{this._setDraggingStyle(!0),n(v.clientX),window.addEventListener("mousemove",r),window.addEventListener("mouseup",a)},r=v=>{n(v.clientX)},a=()=>{this._callOnFinishChange(),this._setDraggingStyle(!1),window.removeEventListener("mousemove",r),window.removeEventListener("mouseup",a)};let s=!1,o,l;const c=v=>{v.preventDefault(),this._setDraggingStyle(!0),n(v.touches[0].clientX),s=!1},d=v=>{v.touches.length>1||(this._hasScrollBar?(o=v.touches[0].clientX,l=v.touches[0].clientY,s=!0):c(v),window.addEventListener("touchmove",f,{passive:!1}),window.addEventListener("touchend",p))},f=v=>{if(s){const M=v.touches[0].clientX-o,w=v.touches[0].clientY-l;Math.abs(M)>Math.abs(w)?c(v):(window.removeEventListener("touchmove",f),window.removeEventListener("touchend",p))}else v.preventDefault(),n(v.touches[0].clientX)},p=()=>{this._callOnFinishChange(),this._setDraggingStyle(!1),window.removeEventListener("touchmove",f),window.removeEventListener("touchend",p)},m=this._callOnFinishChange.bind(this),y=400;let b;const x=v=>{if(Math.abs(v.deltaX)<Math.abs(v.deltaY)&&this._hasScrollBar)return;v.preventDefault();const w=this._normalizeMouseWheel(v)*this._step;this._snapClampSetValue(this.getValue()+w),this.$input.value=this.getValue(),clearTimeout(b),b=setTimeout(m,y)};this.$slider.addEventListener("mousedown",i),this.$slider.addEventListener("touchstart",d,{passive:!1}),this.$slider.addEventListener("wheel",x,{passive:!1})}_setDraggingStyle(e,n="horizontal"){this.$slider&&this.$slider.classList.toggle("active",e),document.body.classList.toggle("lil-gui-dragging",e),document.body.classList.toggle(`lil-gui-${n}`,e)}_getImplicitStep(){return this._hasMin&&this._hasMax?(this._max-this._min)/1e3:.1}_onUpdateMinMax(){!this._hasSlider&&this._hasMin&&this._hasMax&&(this._stepExplicit||this.step(this._getImplicitStep(),!1),this._initSlider(),this.updateDisplay())}_normalizeMouseWheel(e){let{deltaX:n,deltaY:i}=e;return Math.floor(e.deltaY)!==e.deltaY&&e.wheelDelta&&(n=0,i=-e.wheelDelta/120,i*=this._stepExplicit?1:10),n+-i}_arrowKeyMultiplier(e){let n=this._stepExplicit?1:10;return e.shiftKey?n*=10:e.altKey&&(n/=10),n}_snap(e){const n=Math.round(e/this._step)*this._step;return parseFloat(n.toPrecision(15))}_clamp(e){return e<this._min&&(e=this._min),e>this._max&&(e=this._max),e}_snapClampSetValue(e){this.setValue(this._clamp(this._snap(e)))}get _hasScrollBar(){const e=this.parent.root.$children;return e.scrollHeight>e.clientHeight}get _hasMin(){return this._min!==void 0}get _hasMax(){return this._max!==void 0}}class sxe extends Uo{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 oxe extends Uo{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 lxe=`.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 cxe(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 oB=!1;class p_{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"),!oB&&o&&(cxe(lxe),oB=!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 sxe(this,e,n,i);const s=e[n];switch(typeof s){case"number":return new axe(this,e,n,i,r,a);case"boolean":return new Jve(this,e,n);case"string":return new oxe(this,e,n);case"function":return new ZA(this,e,n)}console.error(`gui.add failed
  7812. property:`,n,`
  7813. object:`,e,`
  7814. value:`,s)}addColor(e,n,i=1){return new rxe(this,e,n,i)}addFolder(e){const n=new p_({parent:this,title:e});return this.root._closeFolders&&n.close(),n}load(e,n=!0){return e.controllers&&this.controllers.forEach(i=>{i instanceof ZA||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 ZA)){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 JA(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 rP{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 rP(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 aP{constructor(e,n,i,r){this.src=e,this.gcode=n,this.params=i,this.comment=r}}class lB extends aP{constructor(e,n,i,r){super(e,n,i,r),this.params=i}}class Jc extends aP{constructor(e,n,i,r){super(e,n,void 0,i),this.toolIndex=r}}class cB{constructor(e,n,i,r=0){this.layer=e,this.commands=n,this.lineNumber=i,this.height=r}}class m_{constructor(e){this.lines=[],this.preamble=new cB(-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 lB(e,l,c,s);case"t0":return new Jc(e,l,s,0);case"t1":return new Jc(e,l,s,1);case"t2":return new Jc(e,l,s,2);case"t3":return new Jc(e,l,s,3);case"t4":return new Jc(e,l,s,4);case"t5":return new Jc(e,l,s,5);case"t6":return new Jc(e,l,s,6);case"t7":return new Jc(e,l,s,7);default:return new aP(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 lB){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 cB(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=rP.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}}}m_.prototype.parseGcode=m_.prototype.parseGCode;const uB={type:"change"},QA={type:"start"},dB={type:"end"},Xy=new QN,fB=new nu,uxe=Math.cos(70*m$.DEG2RAD);class dxe extends Af{constructor(e,n){super(),this.object=e,this.domElement=n,this.domElement.style.touchAction="none",this.enabled=!0,this.target=new Ce,this.cursor=new Ce,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minTargetRadius=0,this.maxTargetRadius=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.05,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.enablePan=!0,this.panSpeed=1,this.screenSpacePanning=!0,this.keyPanSpeed=7,this.zoomToCursor=!1,this.autoRotate=!1,this.autoRotateSpeed=2,this.keys={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"},this.mouseButtons={LEFT:_h.ROTATE,MIDDLE:_h.DOLLY,RIGHT:_h.PAN},this.touches={ONE:Sh.ROTATE,TWO:Sh.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(V){V.addEventListener("keydown",Be),this._domElementKeyEvents=V},this.stopListenToKeyEvents=function(){this._domElementKeyEvents.removeEventListener("keydown",Be),this._domElementKeyEvents=null},this.saveState=function(){i.target0.copy(i.target),i.position0.copy(i.object.position),i.zoom0=i.object.zoom},this.reset=function(){i.target.copy(i.target0),i.object.position.copy(i.position0),i.object.zoom=i.zoom0,i.object.updateProjectionMatrix(),i.dispatchEvent(uB),i.update(),a=r.NONE},this.update=(function(){const V=new Ce,ne=new uf().setFromUnitVectors(e.up,new Ce(0,1,0)),J=ne.clone().invert(),ee=new Ce,ae=new uf,ie=new Ce,we=2*Math.PI;return function(ve=null){const F=i.object.position;V.copy(F).sub(i.target),V.applyQuaternion(ne),o.setFromVector3(V),i.autoRotate&&a===r.NONE&&O((function(xe){return xe!==null?2*Math.PI/60*i.autoRotateSpeed*xe:2*Math.PI/60/60*i.autoRotateSpeed})(ve)),i.enableDamping?(o.theta+=l.theta*i.dampingFactor,o.phi+=l.phi*i.dampingFactor):(o.theta+=l.theta,o.phi+=l.phi);let k=i.minAzimuthAngle,K=i.maxAzimuthAngle;isFinite(k)&&isFinite(K)&&(k<-Math.PI?k+=we:k>Math.PI&&(k-=we),K<-Math.PI?K+=we:K>Math.PI&&(K-=we),o.theta=k<=K?Math.max(k,Math.min(K,o.theta)):o.theta>(k+K)/2?Math.max(k,o.theta):Math.min(K,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=Y(o.radius):o.radius=Y(o.radius*c),V.setFromSpherical(o),V.applyQuaternion(J),F.copy(i.target).add(V),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 pe=!1;if(i.zoomToCursor&&P){let xe=null;if(i.object.isPerspectiveCamera){const fe=V.length();xe=Y(fe*c);const Ke=fe-xe;i.object.position.addScaledVector(E,Ke),i.object.updateMatrixWorld()}else if(i.object.isOrthographicCamera){const fe=new Ce(T.x,T.y,0);fe.unproject(i.object),i.object.zoom=Math.max(i.minZoom,Math.min(i.maxZoom,i.object.zoom/c)),i.object.updateProjectionMatrix(),pe=!0;const Ke=new Ce(T.x,T.y,0);Ke.unproject(i.object),i.object.position.sub(Ke).add(fe),i.object.updateMatrixWorld(),xe=V.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),i.zoomToCursor=!1;xe!==null&&(this.screenSpacePanning?i.target.set(0,0,-1).transformDirection(i.object.matrix).multiplyScalar(xe).add(i.object.position):(Xy.origin.copy(i.object.position),Xy.direction.set(0,0,-1).transformDirection(i.object.matrix),Math.abs(i.object.up.dot(Xy.direction))<uxe?e.lookAt(i.target):(fB.setFromNormalAndCoplanarPoint(i.object.up,i.target),Xy.intersectPlane(fB,i.target))))}else i.object.isOrthographicCamera&&(i.object.zoom=Math.max(i.minZoom,Math.min(i.maxZoom,i.object.zoom/c)),i.object.updateProjectionMatrix(),pe=!0);return c=1,P=!1,!!(pe||ee.distanceToSquared(i.object.position)>s||8*(1-ae.dot(i.object.quaternion))>s||ie.distanceToSquared(i.target)>0)&&(i.dispatchEvent(uB),ee.copy(i.object.position),ae.copy(i.object.quaternion),ie.copy(i.target),!0)}})(),this.dispose=function(){i.domElement.removeEventListener("contextmenu",le),i.domElement.removeEventListener("pointerdown",be),i.domElement.removeEventListener("pointercancel",he),i.domElement.removeEventListener("wheel",Ae),i.domElement.removeEventListener("pointermove",De),i.domElement.removeEventListener("pointerup",he),i._domElementKeyEvents!==null&&(i._domElementKeyEvents.removeEventListener("keydown",Be),i._domElementKeyEvents=null)};const i=this,r={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6};let a=r.NONE;const s=1e-6,o=new aB,l=new aB;let c=1;const d=new Ce,f=new Vt,p=new Vt,m=new Vt,y=new Vt,b=new Vt,x=new Vt,v=new Vt,M=new Vt,w=new Vt,E=new Ce,T=new Vt;let P=!1;const R=[],U={};function N(){return Math.pow(.95,i.zoomSpeed)}function O(V){l.theta-=V}function B(V){l.phi-=V}const I=(function(){const V=new Ce;return function(ne,J){V.setFromMatrixColumn(J,0),V.multiplyScalar(-ne),d.add(V)}})(),W=(function(){const V=new Ce;return function(ne,J){i.screenSpacePanning===!0?V.setFromMatrixColumn(J,1):(V.setFromMatrixColumn(J,0),V.crossVectors(i.object.up,V)),V.multiplyScalar(ne),d.add(V)}})(),L=(function(){const V=new Ce;return function(ne,J){const ee=i.domElement;if(i.object.isPerspectiveCamera){const ae=i.object.position;V.copy(ae).sub(i.target);let ie=V.length();ie*=Math.tan(i.object.fov/2*Math.PI/180),I(2*ne*ie/ee.clientHeight,i.object.matrix),W(2*J*ie/ee.clientHeight,i.object.matrix)}else i.object.isOrthographicCamera?(I(ne*(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 $(V){i.object.isPerspectiveCamera||i.object.isOrthographicCamera?c/=V:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),i.enableZoom=!1)}function q(V){i.object.isPerspectiveCamera||i.object.isOrthographicCamera?c*=V:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),i.enableZoom=!1)}function G(V){if(!i.zoomToCursor)return;P=!0;const ne=i.domElement.getBoundingClientRect(),J=V.clientX-ne.left,ee=V.clientY-ne.top,ae=ne.width,ie=ne.height;T.x=J/ae*2-1,T.y=-ee/ie*2+1,E.set(T.x,T.y,1).unproject(i.object).sub(i.object.position).normalize()}function Y(V){return Math.max(i.minDistance,Math.min(i.maxDistance,V))}function Q(V){f.set(V.clientX,V.clientY)}function se(V){y.set(V.clientX,V.clientY)}function H(){if(R.length===1)f.set(R[0].pageX,R[0].pageY);else{const V=.5*(R[0].pageX+R[1].pageX),ne=.5*(R[0].pageY+R[1].pageY);f.set(V,ne)}}function X(){if(R.length===1)y.set(R[0].pageX,R[0].pageY);else{const V=.5*(R[0].pageX+R[1].pageX),ne=.5*(R[0].pageY+R[1].pageY);y.set(V,ne)}}function re(){const V=R[0].pageX-R[1].pageX,ne=R[0].pageY-R[1].pageY,J=Math.sqrt(V*V+ne*ne);v.set(0,J)}function ce(V){if(R.length==1)p.set(V.pageX,V.pageY);else{const J=z(V),ee=.5*(V.pageX+J.x),ae=.5*(V.pageY+J.y);p.set(ee,ae)}m.subVectors(p,f).multiplyScalar(i.rotateSpeed);const ne=i.domElement;O(2*Math.PI*m.x/ne.clientHeight),B(2*Math.PI*m.y/ne.clientHeight),f.copy(p)}function ye(V){if(R.length===1)b.set(V.pageX,V.pageY);else{const ne=z(V),J=.5*(V.pageX+ne.x),ee=.5*(V.pageY+ne.y);b.set(J,ee)}x.subVectors(b,y).multiplyScalar(i.panSpeed),L(x.x,x.y),y.copy(b)}function me(V){const ne=z(V),J=V.pageX-ne.x,ee=V.pageY-ne.y,ae=Math.sqrt(J*J+ee*ee);M.set(0,ae),w.set(0,Math.pow(M.y/v.y,i.zoomSpeed)),$(w.y),v.copy(M)}function be(V){i.enabled!==!1&&(R.length===0&&(i.domElement.setPointerCapture(V.pointerId),i.domElement.addEventListener("pointermove",De),i.domElement.addEventListener("pointerup",he)),(function(ne){R.push(ne)})(V),V.pointerType==="touch"?(function(ne){switch(ut(ne),R.length){case 1:switch(i.touches.ONE){case Sh.ROTATE:if(i.enableRotate===!1)return;H(),a=r.TOUCH_ROTATE;break;case Sh.PAN:if(i.enablePan===!1)return;X(),a=r.TOUCH_PAN;break;default:a=r.NONE}break;case 2:switch(i.touches.TWO){case Sh.DOLLY_PAN:if(i.enableZoom===!1&&i.enablePan===!1)return;i.enableZoom&&re(),i.enablePan&&X(),a=r.TOUCH_DOLLY_PAN;break;case Sh.DOLLY_ROTATE:if(i.enableZoom===!1&&i.enableRotate===!1)return;i.enableZoom&&re(),i.enableRotate&&H(),a=r.TOUCH_DOLLY_ROTATE;break;default:a=r.NONE}break;default:a=r.NONE}a!==r.NONE&&i.dispatchEvent(QA)})(V):(function(ne){let J;switch(ne.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 _h.DOLLY:if(i.enableZoom===!1)return;(function(ee){G(ee),v.set(ee.clientX,ee.clientY)})(ne),a=r.DOLLY;break;case _h.ROTATE:if(ne.ctrlKey||ne.metaKey||ne.shiftKey){if(i.enablePan===!1)return;se(ne),a=r.PAN}else{if(i.enableRotate===!1)return;Q(ne),a=r.ROTATE}break;case _h.PAN:if(ne.ctrlKey||ne.metaKey||ne.shiftKey){if(i.enableRotate===!1)return;Q(ne),a=r.ROTATE}else{if(i.enablePan===!1)return;se(ne),a=r.PAN}break;default:a=r.NONE}a!==r.NONE&&i.dispatchEvent(QA)})(V))}function De(V){i.enabled!==!1&&(V.pointerType==="touch"?(function(ne){switch(ut(ne),a){case r.TOUCH_ROTATE:if(i.enableRotate===!1)return;ce(ne),i.update();break;case r.TOUCH_PAN:if(i.enablePan===!1)return;ye(ne),i.update();break;case r.TOUCH_DOLLY_PAN:if(i.enableZoom===!1&&i.enablePan===!1)return;(function(J){i.enableZoom&&me(J),i.enablePan&&ye(J)})(ne),i.update();break;case r.TOUCH_DOLLY_ROTATE:if(i.enableZoom===!1&&i.enableRotate===!1)return;(function(J){i.enableZoom&&me(J),i.enableRotate&&ce(J)})(ne),i.update();break;default:a=r.NONE}})(V):(function(ne){switch(a){case r.ROTATE:if(i.enableRotate===!1)return;(function(J){p.set(J.clientX,J.clientY),m.subVectors(p,f).multiplyScalar(i.rotateSpeed);const ee=i.domElement;O(2*Math.PI*m.x/ee.clientHeight),B(2*Math.PI*m.y/ee.clientHeight),f.copy(p),i.update()})(ne);break;case r.DOLLY:if(i.enableZoom===!1)return;(function(J){M.set(J.clientX,J.clientY),w.subVectors(M,v),w.y>0?$(N()):w.y<0&&q(N()),v.copy(M),i.update()})(ne);break;case r.PAN:if(i.enablePan===!1)return;(function(J){b.set(J.clientX,J.clientY),x.subVectors(b,y).multiplyScalar(i.panSpeed),L(x.x,x.y),y.copy(b),i.update()})(ne)}})(V))}function he(V){(function(ne){delete U[ne.pointerId];for(let J=0;J<R.length;J++)if(R[J].pointerId==ne.pointerId)return void R.splice(J,1)})(V),R.length===0&&(i.domElement.releasePointerCapture(V.pointerId),i.domElement.removeEventListener("pointermove",De),i.domElement.removeEventListener("pointerup",he)),i.dispatchEvent(dB),a=r.NONE}function Ae(V){i.enabled!==!1&&i.enableZoom!==!1&&a===r.NONE&&(V.preventDefault(),i.dispatchEvent(QA),(function(ne){G(ne),ne.deltaY<0?q(N()):ne.deltaY>0&&$(N()),i.update()})(V),i.dispatchEvent(dB))}function Be(V){i.enabled!==!1&&i.enablePan!==!1&&(function(ne){let J=!1;switch(ne.code){case i.keys.UP:ne.ctrlKey||ne.metaKey||ne.shiftKey?B(2*Math.PI*i.rotateSpeed/i.domElement.clientHeight):L(0,i.keyPanSpeed),J=!0;break;case i.keys.BOTTOM:ne.ctrlKey||ne.metaKey||ne.shiftKey?B(-2*Math.PI*i.rotateSpeed/i.domElement.clientHeight):L(0,-i.keyPanSpeed),J=!0;break;case i.keys.LEFT:ne.ctrlKey||ne.metaKey||ne.shiftKey?O(2*Math.PI*i.rotateSpeed/i.domElement.clientHeight):L(i.keyPanSpeed,0),J=!0;break;case i.keys.RIGHT:ne.ctrlKey||ne.metaKey||ne.shiftKey?O(-2*Math.PI*i.rotateSpeed/i.domElement.clientHeight):L(-i.keyPanSpeed,0),J=!0}J&&(ne.preventDefault(),i.update())})(V)}function le(V){i.enabled!==!1&&V.preventDefault()}function ut(V){let ne=U[V.pointerId];ne===void 0&&(ne=new Vt,U[V.pointerId]=ne),ne.set(V.pageX,V.pageY)}function z(V){const ne=V.pointerId===R[0].pointerId?R[1]:R[0];return U[ne.pointerId]}i.domElement.addEventListener("contextmenu",le),i.domElement.addEventListener("pointerdown",be),i.domElement.addEventListener("pointercancel",he),i.domElement.addEventListener("wheel",Ae,{passive:!1}),this.update()}}gt.line={worldUnits:{value:1},linewidth:{value:1},resolution:{value:new Vt(1,1)},dashOffset:{value:0},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1}},Ca.line={uniforms:eP.merge([gt.common,gt.fog,gt.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 I$ extends Du{constructor(e){super({type:"LineMaterial",uniforms:eP.clone(Ca.line.uniforms),vertexShader:Ca.line.vertexShader,fragmentShader:Ca.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 hB=new Us,Yy=new Ce;class U$ extends Yve{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 Ni([-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 Ni([-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 DR(n,6,1);return this.setAttribute("instanceStart",new mu(i,3,0)),this.setAttribute("instanceEnd",new mu(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 DR(n,6,1);return this.setAttribute("instanceColorStart",new mu(i,3,0)),this.setAttribute("instanceColorEnd",new mu(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 Hve(e.geometry)),this}fromLineSegments(e){const n=e.geometry;return this.setPositions(n.attributes.position.array),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Us);const e=this.attributes.instanceStart,n=this.attributes.instanceEnd;e!==void 0&&n!==void 0&&(this.boundingBox.setFromBufferAttribute(e),hB.setFromBufferAttribute(n),this.boundingBox.union(hB))}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new Io),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++)Yy.fromBufferAttribute(e,a),r=Math.max(r,i.distanceToSquared(Yy)),Yy.fromBufferAttribute(n,a),r=Math.max(r,i.distanceToSquared(Yy));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 pB=new Ce,mB=new Ce,Dr=new Un,Or=new Un,Mo=new Un,eT=new Ce,tT=new Wn,Lr=new Kve,gB=new Ce,Ky=new Us,Zy=new Io,Eo=new Un;let Ao,Rd;function vB(t,e,n){return Eo.set(0,0,-e,1).applyMatrix4(t.projectionMatrix),Eo.multiplyScalar(1/Eo.w),Eo.x=Rd/n.width,Eo.y=Rd/n.height,Eo.applyMatrix4(t.projectionMatrixInverse),Eo.multiplyScalar(1/Eo.w),Math.abs(Math.max(Eo.x,Eo.y))}class fxe extends co{constructor(e=new U$,n=new I$({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)pB.fromBufferAttribute(n,s),mB.fromBufferAttribute(i,s),r[o]=o===0?0:r[o-1],r[o+1]=r[o]+pB.distanceTo(mB);const a=new DR(r,2,1);return e.setAttribute("instanceDistanceStart",new mu(a,1,0)),e.setAttribute("instanceDistanceEnd",new mu(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;Ao=e.ray;const s=this.matrixWorld,o=this.geometry,l=this.material;let c,d;Rd=l.linewidth+a,o.boundingSphere===null&&o.computeBoundingSphere(),Zy.copy(o.boundingSphere).applyMatrix4(s),i?c=.5*Rd:c=vB(r,Math.max(r.near,Zy.distanceToPoint(Ao.origin)),l.resolution),Zy.radius+=c,Ao.intersectsSphere(Zy)!==!1&&(o.boundingBox===null&&o.computeBoundingBox(),Ky.copy(o.boundingBox).applyMatrix4(s),i?d=.5*Rd:d=vB(r,Math.max(r.near,Ky.distanceToPoint(Ao.origin)),l.resolution),Ky.expandByScalar(d),Ao.intersectsBox(Ky)!==!1&&(i?(function(f,p){const m=f.matrixWorld,y=f.geometry,b=y.attributes.instanceStart,x=y.attributes.instanceEnd;for(let v=0,M=Math.min(y.instanceCount,b.count);v<M;v++){Lr.start.fromBufferAttribute(b,v),Lr.end.fromBufferAttribute(x,v),Lr.applyMatrix4(m);const w=new Ce,E=new Ce;Ao.distanceSqToSegment(Lr.start,Lr.end,E,w),E.distanceTo(w)<.5*Rd&&p.push({point:E,pointOnLine:w,distance:Ao.origin.distanceTo(E),object:f,face:null,faceIndex:v,uv:null,uv1:null})}})(this,n):(function(f,p,m){const y=p.projectionMatrix,b=f.material.resolution,x=f.matrixWorld,v=f.geometry,M=v.attributes.instanceStart,w=v.attributes.instanceEnd,E=Math.min(v.instanceCount,M.count),T=-p.near;Ao.at(1,Mo),Mo.w=1,Mo.applyMatrix4(p.matrixWorldInverse),Mo.applyMatrix4(y),Mo.multiplyScalar(1/Mo.w),Mo.x*=b.x/2,Mo.y*=b.y/2,Mo.z=0,eT.copy(Mo),tT.multiplyMatrices(p.matrixWorldInverse,x);for(let P=0,R=E;P<R;P++){if(Dr.fromBufferAttribute(M,P),Or.fromBufferAttribute(w,P),Dr.w=1,Or.w=1,Dr.applyMatrix4(tT),Or.applyMatrix4(tT),Dr.z>T&&Or.z>T)continue;if(Dr.z>T){const I=Dr.z-Or.z,W=(Dr.z-T)/I;Dr.lerp(Or,W)}else if(Or.z>T){const I=Or.z-Dr.z,W=(Or.z-T)/I;Or.lerp(Dr,W)}Dr.applyMatrix4(y),Or.applyMatrix4(y),Dr.multiplyScalar(1/Dr.w),Or.multiplyScalar(1/Or.w),Dr.x*=b.x/2,Dr.y*=b.y/2,Or.x*=b.x/2,Or.y*=b.y/2,Lr.start.copy(Dr),Lr.start.z=0,Lr.end.copy(Or),Lr.end.z=0;const U=Lr.closestPointToPointParameter(eT,!0);Lr.at(U,gB);const N=m$.lerp(Dr.z,Or.z,U),O=N>=-1&&N<=1,B=eT.distanceTo(gB)<.5*Rd;if(O&&B){Lr.start.fromBufferAttribute(M,P),Lr.end.fromBufferAttribute(w,P),Lr.start.applyMatrix4(x),Lr.end.applyMatrix4(x);const I=new Ce,W=new Ce;Ao.distanceSqToSegment(Lr.start,Lr.end,W,I),m.push({point:W,pointOnLine:I,distance:Ao.origin.distanceTo(W),object:f,face:null,faceIndex:P,uv:null,uv1:null})}}})(this,r,n)))}}class hxe extends gS{constructor(e,n,i,r,a=4473924,s=8947848){a=new Ut(a),s=new Ut(s);const o=Math.round(e/n);i=Math.round(i/r)*r/2;const l=[],c=[];let d=0;for(let p=-1*(e=o*n/2);p<=e;p+=n){l.push(p,0,-1*i,p,0,i);const m=p===0?a:s;m.toArray(c,d),d+=3,m.toArray(c,d),d+=3,m.toArray(c,d),d+=3,m.toArray(c,d),d+=3}for(let p=-1*i;p<=i;p+=r){l.push(-1*e,0,p,e,0,p);const m=p===0?a:s;m.toArray(c,d),d+=3,m.toArray(c,d),d+=3,m.toArray(c,d),d+=3,m.toArray(c,d),d+=3}const f=new na;f.setAttribute("position",new Ni(l,3)),f.setAttribute("color",new Ni(c,3)),super(f,new sv({vertexColors:!0,toneMapped:!1}))}}function pxe(t,e,n,i){const r=(function(s,o,l){s*=.5,o*=.5,l*=.5;const c=new na,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 Ni(d,3)),c})(t,e,n),a=new gS(r,new Gve({color:new Ut(i),dashSize:3,gapSize:1}));return a.computeLineDistances(),a}var Gg=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 Gg.Panel("FPS","#0ff","#002")),l=n(new Gg.Panel("MS","#0f0","#020"));if(self.performance&&self.performance.memory)var c=n(new Gg.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}};Gg.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,p=15*s,m=74*s,y=30*s,b=document.createElement("canvas");b.width=o,b.height=l,b.style.cssText="width:80px;height:48px";var x=b.getContext("2d");return x.font="bold "+9*s+"px Helvetica,Arial,sans-serif",x.textBaseline="top",x.fillStyle=n,x.fillRect(0,0,o,l),x.fillStyle=e,x.fillText(t,c,d),x.fillRect(f,p,m,y),x.fillStyle=n,x.globalAlpha=.9,x.fillRect(f,p,m,y),{dom:b,update:function(v,M){i=Math.min(i,v),r=Math.max(r,v),x.fillStyle=n,x.globalAlpha=1,x.fillRect(0,0,o,p),x.fillStyle=e,x.fillText(a(v)+" "+t+" ("+a(i)+"-"+a(r)+")",c,d),x.drawImage(b,f+s,p,m-s,y,f,p,m-s,y),x.fillRect(f+m-s,p,s,y),x.fillStyle=n,x.globalAlpha=.9,x.fillRect(f+m-s,p,s,a((1-v/M)*y))}}};var mxe=Gg;class xB{constructor(e,n){this.openFolders=[],this.watchedObject=e,this.options=n,this.gui=new p_,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 p_,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 gxe extends na{constructor(e=[new Ce],n=.6,i=.2,r=8){super(),this.type="ExtrusionGeometry",this.parameters={points:e,lineWidth:n,lineHeight:i,radialSegments:r,closed:!1};const a=new Ce,s=new Ce,o=new Vt,l=[],c=[],d=[],f=[];function p(m){const[y,b,x]=(function(v){const M=e[v],w=new Ce,E=new Ce,T=new Ce,P=new Ce;w.copy(M).sub(e[v-1]||M).normalize().add((e[v+1]||M).clone().sub(M).normalize()).normalize();let R=Number.MAX_VALUE;const U=Math.abs(w.x),N=Math.abs(w.y),O=Math.abs(w.z);return U<=R&&(R=U,E.set(1,0,0)),N<=R&&(R=N,E.set(0,1,0)),O<=R&&E.set(0,0,1),P.crossVectors(w,E).normalize(),E.crossVectors(w,P),T.crossVectors(w,E),[M,E,T]})(m);for(let v=0;v<=r;v++){const M=v/r*Math.PI*2,w=Math.sin(M),E=-Math.cos(M);s.x=E*b.x+w*x.x,s.y=E*b.y+w*x.y,s.z=E*b.z+w*x.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 m=0;m<e.length;m++)p(m);p(closed===!1?e.length-1:0),(function(){for(let m=0;m<e.length;m++)for(let y=0;y<=r;y++)o.x=m/e.length,o.y=y/r,d.push(o.x,o.y)})(),(function(){for(let m=1;m<e.length;m++)for(let y=1;y<=r;y++){const b=(r+1)*(m-1)+(y-1),x=(r+1)*m+(y-1),v=(r+1)*m+y,M=(r+1)*(m-1)+y;f.push(b,x,M),f.push(x,v,M)}})()})(),this.setIndex(f),this.setAttribute("position",new Ni(l,3)),this.setAttribute("normal",new Ni(c,3)),this.setAttribute("uv",new Ni(d,2))}}class $g{static get initial(){const e=new $g;return Object.assign(e,{x:0,y:0,z:0,r:0,e:0,i:0,j:0,t:0}),e}}const nT={h:0,s:0,l:0};class cp{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=$g.initial,this.beyondFirstMove=!1,this.disposables=[],this._extrusionColor=cp.defaultExtrusionColor,this.renderLayerIndex=0,this._geometries={},this._backgroundColor=new Ut(14737632),this._travelColor=new Ut(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 m_(this.minLayerThreshold),this.scene=new Dve,this.scene.background=this._backgroundColor,e.backgroundColor!==void 0&&(this.backgroundColor=new Ut(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 mxe:void 0,e.extrusionColor!==void 0&&(this.extrusionColor=e.extrusionColor),e.travelColor!==void 0&&(this.travelColor=new Ut(e.travelColor)),e.topLayerColor!==void 0&&(this.topLayerColor=new Ut(e.topLayerColor)),e.lastSegmentColor!==void 0&&(this.lastSegmentColor=new Ut(e.lastSegmentColor)),e.toolColors){this._toolColors={};for(const[m,y]of Object.entries(e.toolColors))this._toolColors[parseInt(m)]=new Ut(y)}if(e.disableGradient!==void 0&&(this.disableGradient=e.disableGradient),console.info("Using THREE r"+dS),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 PR({canvas:this.canvas,preserveDrawingBuffer:!0});else{if(!this.targetId)throw Error("Set either opts.canvas or opts.targetId");const m=document.getElementById(this.targetId);if(!m)throw new Error("Unable to find element "+this.targetId);this.renderer=new PR({preserveDrawingBuffer:!0}),this.canvas=this.renderer.domElement,m.appendChild(this.canvas)}this.camera=new Ja(25,this.canvas.offsetWidth/this.canvas.offsetHeight,10,5e3),this.camera.position.fromArray(this.initialCameraPosition);const f=this.camera.far,p=.8*f;this.scene.fog=new iP(this._backgroundColor,p,f),this.resize(),this.controls=new dxe(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 Ut(i)}else this._extrusionColor=new Ut(e)}get currentToolColor(){var e;return this._extrusionColor===void 0?cp.defaultExtrusionColor:this._extrusionColor instanceof Ut?this._extrusionColor:(e=this._extrusionColor[this.state.t])!==null&&e!==void 0?e:cp.defaultExtrusionColor}get backgroundColor(){return this._backgroundColor}set backgroundColor(e){this._backgroundColor=new Ut(e),this.scene.background=this._backgroundColor}get travelColor(){return this._travelColor}set travelColor(e){this._travelColor=new Ut(e)}get topLayerColor(){return this._topLayerColor}set topLayerColor(e){this._topLayerColor=e!==void 0?new Ut(e):void 0}get lastSegmentColor(){return this._lastSegmentColor}set lastSegmentColor(e){this._lastSegmentColor=e!==void 0?new Ut(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 Zve(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 Xve(13421772,.3*Math.PI),n=new qve(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 Lg;return n.name=e,n.quaternion.setFromEuler(new rv(-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=$g.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 JA(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 p of d.commands)if(p.gcode!="g20"){if(p.gcode.startsWith("t")){this.doRenderExtrusion(f,e),f.extrusion=[];const m=p;this.state.t=m.toolIndex}else if(["g0","g00","g1","g01","g2","g02","g3","g03"].indexOf(p.gcode)>-1){const m=p,y={x:(n=m.params.x)!==null&&n!==void 0?n:this.state.x,y:(i=m.params.y)!==null&&i!==void 0?i:this.state.y,z:(r=m.params.z)!==null&&r!==void 0?r:this.state.z,r:(a=m.params.r)!==null&&a!==void 0?a:this.state.r,e:(s=m.params.e)!==null&&s!==void 0?s:this.state.e,i:(o=m.params.i)!==null&&o!==void 0?o:this.state.i,j:(l=m.params.j)!==null&&l!==void 0?l:this.state.j,t:this.state.t};if(e>=this.minLayerIndex){const b=((c=m.params.e)!==null&&c!==void 0?c:0)>0||this.nonTravelmoves.indexOf(p.gcode)>-1;(y.x!=this.state.x||y.y!=this.state.y||y.z!=this.state.z)&&(b&&this.renderExtrusion||!b&&this.renderTravel)&&(p.gcode=="g2"||p.gcode=="g3"||p.gcode=="g02"||p.gcode=="g03"?this.addArcSegment(f,this.state,y,b,p.gcode=="g2"||p.gcode=="g02"):this.addLineSegment(f,this.state,y,b))}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(nT),a=new Ut().setHSL(nT.h,nT.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 hxe(this.buildVolume.x,10,this.buildVolume.y,10));const e=pxe(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 m_(this.minLayerThreshold)}resetState(){var e;this.startLayer=1,this.endLayer=1/0,this.singleLayerMode=!1,this.beyondFirstMove=!1,this.state=$g.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,p=i.z;let m=i.r,y=i.i,b=i.j;if(m){const $=d-o,q=f-l,G=Math.sqrt(Math.pow($/2,2)+Math.pow(q/2,2));m=Math.max(m,G);const Y=Math.pow($,2)+Math.pow(q,2),Q=Math.pow(m,2)-Y/4;let se=Math.sqrt(Q/Y);(a&&m<0||!a&&m>0)&&(se=-se),y=$/2+q*se,b=q/2-$*se}const x=o==d&&l==f,v=o+y,M=l+b,w=Math.sqrt(y*y+b*b),E=Math.atan2(-b,-y),T=Math.atan2(f-M,d-v);let P;x?P=2*Math.PI:(P=a?E-T:T-E,P<0&&(P+=2*Math.PI));let R=w*P/1.8;this.inches&&(R*=25),R<1&&(R=1);let U=P/R;U*=a?-1:1;const N=[];N.push({x:o,y:l,z:c});const O=(c-p)/R;let B=o,I=l,W=c,L=E;for(let $=0;$<R-1;$++)L+=U,B=v+w*Math.cos(L),I=M+w*Math.sin(L),W+=O,N.push({x:B,y:I,z:W});N.push({x:i.x,y:i.y,z:i.z});for(let $=0;$<N.length-1;$++)s.push(N[$].x,N[$].y,N[$].z,N[$+1].x,N[$+1].y,N[$+1].z)}addLine(e,n){var i;if(typeof this.lineWidth=="number"&&this.lineWidth>0)return void this.addThickLine(e,n);const r=new na;r.setAttribute("position",new Ni(e,3)),this.disposables.push(r);const a=new sv({color:n});this.disposables.push(a);const s=new gS(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 Ce(o[0],o[1],o[2]),c=new Ce(o[3],o[4],o[5]),d=new Ce(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 gxe(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 U$;this.disposables.push(r);const a=new I$({color:n,linewidth:this.lineWidth/(1e3*window.devicePixelRatio)});this.disposables.push(a),r.setPositions(e);const s=new fxe(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=>JA(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 Vve({color:e,wireframe:this._wireframe});this.disposables.push(r);const a=i.reduce(((o,l)=>3*l.attributes.position.count+o),0),s=new Bve(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 JA(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 xB(this):typeof this.devMode=="object"&&(this.devGui=new xB(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())}}cp.defaultExtrusionColor=new Ut("hotpink");const vxe=function(t){return new cp(t)};function xxe({gcodeUrl:t,buildVolume:e={x:256,y:256,z:256},className:n=""}){const i=C.useRef(null),r=C.useRef(null),[a,s]=C.useState(!0),[o,l]=C.useState(null),[c,d]=C.useState(!1),[f,p]=C.useState(0),[m,y]=C.useState(0);C.useEffect(()=>{if(!i.current)return;const v=i.current,M=vxe({canvas:v,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 E=>{if(!E.ok)throw E.status===404&&(await E.json().catch(()=>({}))).detail?.includes("sliced")?(d(!0),new Error("not_sliced")):new Error("Failed to load G-code");return E.text()}).then(E=>{M.processGCode(E);const T=M.layers?.length||0;y(T),p(T),M.render(),s(!1)}).catch(E=>{l(E.message),s(!1)});const w=()=>{if(v.parentElement){const E=v.parentElement.getBoundingClientRect();v.width=E.width,v.height=E.height,M.resize()}};return w(),window.addEventListener("resize",w),()=>{window.removeEventListener("resize",w),M.dispose()}},[t,e]);const b=v=>{if(!r.current)return;const M=Math.max(1,Math.min(v,m));p(M),r.current.render()},x=v=>{b(parseInt(v.target.value,10))};return S.jsxs("div",{className:`relative flex flex-col h-full ${n}`,children:[S.jsxs("div",{className:"flex-1 relative bg-bambu-dark rounded-lg overflow-hidden",children:[S.jsx("canvas",{ref:i,className:"w-full h-full"}),a&&S.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-bambu-dark/80",children:S.jsxs("div",{className:"text-center",children:[S.jsx(ci,{className:"w-8 h-8 animate-spin text-bambu-green mx-auto mb-2"}),S.jsx("p",{className:"text-bambu-gray text-sm",children:"Loading G-code..."})]})}),c&&S.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-bambu-dark/80",children:S.jsxs("div",{className:"text-center max-w-sm px-4",children:[S.jsx(mie,{className:"w-12 h-12 text-bambu-gray mx-auto mb-3"}),S.jsx("p",{className:"text-white font-medium mb-2",children:"G-code not available"}),S.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&&S.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-bambu-dark/80",children:S.jsx("div",{className:"text-center text-red-400",children:S.jsx("p",{className:"text-sm",children:o})})})]}),!a&&!o&&!c&&m>0&&S.jsx("div",{className:"mt-4 px-2",children:S.jsxs("div",{className:"flex items-center gap-3",children:[S.jsx(cG,{className:"w-4 h-4 text-bambu-gray flex-shrink-0"}),S.jsx("button",{onClick:()=>b(f-1),disabled:f<=1,className:"p-1 rounded hover:bg-bambu-dark-tertiary disabled:opacity-30 disabled:cursor-not-allowed",children:S.jsx(tf,{className:"w-4 h-4"})}),S.jsx("input",{type:"range",min:1,max:m,value:f,onChange:x,className:"flex-1 h-2 bg-bambu-dark-tertiary rounded-lg appearance-none cursor-pointer accent-bambu-green"}),S.jsx("button",{onClick:()=>b(f+1),disabled:f>=m,className:"p-1 rounded hover:bg-bambu-dark-tertiary disabled:opacity-30 disabled:cursor-not-allowed",children:S.jsx(Wp,{className:"w-4 h-4"})}),S.jsxs("span",{className:"text-sm text-bambu-gray min-w-[80px] text-right",children:[f," / ",m]})]})})]})}function yxe({archiveId:t,title:e,onClose:n}){const[i,r]=C.useState(null),[a,s]=C.useState(null),[o,l]=C.useState(!0);C.useEffect(()=>{const d=f=>{f.key==="Escape"&&n()};return window.addEventListener("keydown",d),()=>window.removeEventListener("keydown",d)},[n]),C.useEffect(()=>{vt.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}${vt.getArchiveForSlicer(t,d)}`;window.location.href=`bambustudioopen://${encodeURIComponent(f)}`};return S.jsx("div",{className:"fixed inset-0 bg-black/70 flex items-center justify-center z-50 p-8",onClick:n,children:S.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:[S.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-bambu-dark-tertiary",children:[S.jsx("h2",{className:"text-lg font-semibold text-white truncate flex-1 mr-4",children:e}),S.jsxs("div",{className:"flex items-center gap-2",children:[S.jsxs(xt,{variant:"secondary",size:"sm",onClick:c,children:[S.jsx(gp,{className:"w-4 h-4"}),"Open in Slicer"]}),S.jsx(xt,{variant:"ghost",size:"sm",onClick:n,children:S.jsx(_i,{className:"w-5 h-5"})})]})]}),a&&S.jsxs("div",{className:"flex border-b border-bambu-dark-tertiary",children:[S.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:[S.jsx(c0,{className:"w-4 h-4"}),"3D Model",!a.has_model&&S.jsx("span",{className:"text-xs",children:"(not available)"})]}),S.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:[S.jsx(Qne,{className:"w-4 h-4"}),"G-code Preview",!a.has_gcode&&S.jsx("span",{className:"text-xs",children:"(not sliced)"})]})]}),S.jsx("div",{className:"flex-1 overflow-hidden p-4",children:o?S.jsx("div",{className:"w-full h-full flex items-center justify-center",children:S.jsx(ci,{className:"w-8 h-8 animate-spin text-bambu-green"})}):i==="3d"&&a?S.jsx(pfe,{url:vt.getArchiveDownload(t),buildVolume:a.build_volume,className:"w-full h-full"}):i==="gcode"&&a?S.jsx(xxe,{gcodeUrl:vt.getArchiveGcode(t),buildVolume:a.build_volume,className:"w-full h-full"}):S.jsx("div",{className:"w-full h-full flex items-center justify-center text-bambu-gray",children:"No preview available for this file"})})]})})}function bxe({archiveId:t,archiveName:e,onClose:n,onSuccess:i}){const[r,a]=C.useState(null),{data:s,isLoading:o}=ei({queryKey:["printers"],queryFn:vt.getPrinters}),l=Gn({mutationFn:()=>{if(!r)throw new Error("No printer selected");return vt.reprintArchive(t,r)},onSuccess:()=>{i(),n()}}),c=s?.filter(d=>d.is_active)||[];return S.jsx("div",{className:"fixed inset-0 bg-black/70 flex items-center justify-center z-50 p-8",children:S.jsx(bi,{className:"w-full max-w-md",children:S.jsxs(Ri,{children:[S.jsxs("div",{className:"flex items-center justify-between mb-4",children:[S.jsx("h2",{className:"text-lg font-semibold text-white",children:"Re-print"}),S.jsx(xt,{variant:"ghost",size:"sm",onClick:n,children:S.jsx(_i,{className:"w-5 h-5"})})]}),S.jsxs("p",{className:"text-sm text-bambu-gray mb-4",children:["Send ",S.jsx("span",{className:"text-white",children:e})," to a printer"]}),o?S.jsx("div",{className:"flex justify-center py-8",children:S.jsx(ci,{className:"w-6 h-6 text-bambu-green animate-spin"})}):c.length===0?S.jsx("div",{className:"text-center py-8 text-bambu-gray",children:"No active printers available"}):S.jsx("div",{className:"space-y-2 mb-6",children:c.map(d=>S.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:[S.jsx("div",{className:`p-2 rounded-lg ${r===d.id?"bg-bambu-green/20":"bg-bambu-dark-tertiary"}`,children:S.jsx(rf,{className:`w-5 h-5 ${r===d.id?"text-bambu-green":"text-bambu-gray"}`})}),S.jsxs("div",{className:"text-left",children:[S.jsx("p",{className:"text-white font-medium",children:d.name}),S.jsxs("p",{className:"text-xs text-bambu-gray",children:[d.model||"Unknown model"," • ",d.ip_address]})]})]},d.id))}),l.isError&&S.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"}),S.jsxs("div",{className:"flex gap-3",children:[S.jsx(xt,{variant:"secondary",onClick:n,className:"flex-1",children:"Cancel"}),S.jsx(xt,{onClick:()=>l.mutate(),disabled:!r||l.isPending,className:"flex-1",children:l.isPending?S.jsxs(S.Fragment,{children:[S.jsx(ci,{className:"w-4 h-4 animate-spin"}),"Sending..."]}):S.jsxs(S.Fragment,{children:[S.jsx(rf,{className:"w-4 h-4"}),"Print"]})})]})]})})})}function _xe({onClose:t,initialFiles:e}){const n=Hr(),{showToast:i}=Mf(),r=C.useRef(null),[a,s]=C.useState(()=>e?.filter(R=>R.name.endsWith(".3mf")).map(R=>({file:R,status:"pending"}))||[]),[o,l]=C.useState(!1),[c,d]=C.useState(),[f,p]=C.useState(null),{data:m}=ei({queryKey:["printers"],queryFn:vt.getPrinters}),y=Gn({mutationFn:R=>vt.uploadArchivesBulk(R,c),onSuccess:R=>{p(R),n.invalidateQueries({queryKey:["archives"]}),n.invalidateQueries({queryKey:["archiveStats"]}),s(U=>U.map(N=>{const O=R.results.find(I=>I.filename===N.file.name),B=R.errors.find(I=>I.filename===N.file.name);return O?{...N,status:"success",archiveId:O.id}:B?{...N,status:"error",error:B.error}:N})),R.failed===0?i(`${R.uploaded} file${R.uploaded!==1?"s":""} uploaded`):R.uploaded===0?i(`Failed to upload ${R.failed} file${R.failed!==1?"s":""}`,"error"):i(`${R.uploaded} uploaded, ${R.failed} failed`,"warning")},onError:()=>{s(R=>R.map(U=>({...U,status:"error",error:"Upload failed"}))),i("Upload failed","error")}}),b=C.useCallback(R=>{R.preventDefault(),l(!0)},[]),x=C.useCallback(R=>{R.preventDefault(),l(!1)},[]),v=C.useCallback(R=>{R.preventDefault(),l(!1);const U=Array.from(R.dataTransfer.files).filter(N=>N.name.endsWith(".3mf"));U.length>0&&s(N=>[...N,...U.map(O=>({file:O,status:"pending"}))])},[]),M=C.useCallback(R=>{const U=Array.from(R.target.files||[]).filter(N=>N.name.endsWith(".3mf"));U.length>0&&s(N=>[...N,...U.map(O=>({file:O,status:"pending"}))]),r.current&&(r.current.value="")},[]),w=C.useCallback(R=>{s(U=>U.filter((N,O)=>O!==R))},[]),E=()=>{if(a.length===0)return;const R=a.filter(U=>U.status==="pending");R.length!==0&&(s(U=>U.map(N=>N.status==="pending"?{...N,status:"uploading"}:N)),y.mutate(R.map(U=>U.file)))},T=a.filter(R=>R.status==="pending").length,P=y.isPending;return S.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4",children:S.jsx(bi,{className:"w-full max-w-2xl max-h-[90vh] flex flex-col",children:S.jsxs(Ri,{className:"p-0 flex flex-col h-full",children:[S.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-bambu-dark-tertiary",children:[S.jsx("h2",{className:"text-xl font-semibold text-white",children:"Upload 3MF Files"}),S.jsx("button",{onClick:t,className:"text-bambu-gray hover:text-white transition-colors",children:S.jsx(_i,{className:"w-5 h-5"})})]}),S.jsx("div",{className:"p-4",children:S.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:b,onDragLeave:x,onDrop:v,children:[S.jsx(n_,{className:"w-12 h-12 mx-auto mb-4 text-bambu-gray"}),S.jsx("p",{className:"text-white mb-2",children:"Drag & drop .3mf files here"}),S.jsx("p",{className:"text-bambu-gray text-sm mb-4",children:"or"}),S.jsx(xt,{variant:"secondary",onClick:()=>r.current?.click(),disabled:P,children:"Browse Files"}),S.jsx("input",{ref:r,type:"file",accept:".3mf",multiple:!0,className:"hidden",onChange:M})]})}),S.jsxs("div",{className:"px-4 pb-4",children:[S.jsx("label",{className:"block text-sm text-bambu-gray mb-2",children:"Associate with printer (optional)"}),S.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:R=>d(R.target.value?Number(R.target.value):void 0),disabled:P,children:[S.jsx("option",{value:"",children:"No printer"}),m?.map(R=>S.jsx("option",{value:R.id,children:R.name},R.id))]})]}),a.length>0&&S.jsx("div",{className:"px-4 pb-4 max-h-60 overflow-y-auto",children:S.jsx("div",{className:"space-y-2",children:a.map((R,U)=>S.jsxs("div",{className:"flex items-center gap-3 p-3 bg-bambu-dark rounded-lg",children:[S.jsx(oG,{className:"w-5 h-5 text-bambu-gray flex-shrink-0"}),S.jsx("span",{className:"flex-1 text-white text-sm truncate",children:R.file.name}),S.jsxs("span",{className:"text-xs text-bambu-gray",children:[(R.file.size/(1024*1024)).toFixed(1)," MB"]}),R.status==="pending"&&S.jsx("button",{onClick:()=>w(U),className:"text-bambu-gray hover:text-red-400 transition-colors",disabled:P,children:S.jsx(_i,{className:"w-4 h-4"})}),R.status==="uploading"&&S.jsx(ci,{className:"w-4 h-4 text-bambu-green animate-spin"}),R.status==="success"&&S.jsx(iS,{className:"w-4 h-4 text-bambu-green"}),R.status==="error"&&S.jsxs("div",{className:"flex items-center gap-2",children:[S.jsx("span",{className:"text-xs text-red-400",children:R.error}),S.jsx(RN,{className:"w-4 h-4 text-red-400"})]})]},`${R.file.name}-${U}`))})}),f&&S.jsx("div",{className:"px-4 pb-4",children:S.jsx("div",{className:"p-3 bg-bambu-dark rounded-lg",children:S.jsxs("p",{className:"text-sm text-white",children:[S.jsx("span",{className:"text-bambu-green",children:f.uploaded})," uploaded",f.failed>0&&S.jsxs(S.Fragment,{children:[", ",S.jsx("span",{className:"text-red-400",children:f.failed})," failed"]})]})})}),S.jsxs("div",{className:"flex gap-3 p-4 border-t border-bambu-dark-tertiary",children:[S.jsx(xt,{variant:"secondary",onClick:t,className:"flex-1",children:f?"Close":"Cancel"}),!f&&S.jsx(xt,{onClick:E,disabled:T===0||P,className:"flex-1",children:P?S.jsxs(S.Fragment,{children:[S.jsx(ci,{className:"w-4 h-4 animate-spin"}),"Uploading..."]}):S.jsxs(S.Fragment,{children:[S.jsx(n_,{className:"w-4 h-4"}),"Upload ",T>0&&`(${T})`]})})]})]})})})}const Sxe=["Adhesion failure","Spaghetti / Detached","Layer shift","Clogged nozzle","Filament runout","Warping","Stringing","Under-extrusion","Power failure","User cancelled","Other"];function wxe({archive:t,onClose:e,existingTags:n=[]}){C.useEffect(()=>{const Y=Q=>{Q.key==="Escape"&&e()};return window.addEventListener("keydown",Y),()=>window.removeEventListener("keydown",Y)},[e]);const i=Hr(),[r,a]=C.useState(t.print_name||""),[s,o]=C.useState(t.printer_id),[l,c]=C.useState(t.notes||""),[d,f]=C.useState(t.tags||""),[p,m]=C.useState(t.failure_reason||""),[y,b]=C.useState(t.photos||[]),[x,v]=C.useState(!1),[M,w]=C.useState(!1),E=C.useRef(null),T=C.useRef(null),P=C.useRef(null),{data:R}=ei({queryKey:["printers"],queryFn:vt.getPrinters}),{data:U}=ei({queryKey:["archives"],queryFn:()=>vt.getArchives(void 0,1e3,0),enabled:n.length===0}),N=n.length>0?n:[...new Set(U?.flatMap(Y=>Y.tags?.split(",").map(Q=>Q.trim())||[]).filter(Boolean)||[])].sort(),O=d.split(",").map(Y=>Y.trim()).filter(Boolean),B=N.filter(Y=>!O.includes(Y)),I=Y=>{if(!O.includes(Y)){const Q=[...O,Y].join(", ");f(Q)}P.current!==null&&clearTimeout(P.current),E.current?.focus()},W=Y=>{const Q=O.filter(se=>se!==Y).join(", ");f(Q)},L=Gn({mutationFn:Y=>vt.updateArchive(t.id,Y),onSuccess:()=>{i.invalidateQueries({queryKey:["archives"]}),e()}}),$=async Y=>{const Q=Y.target.files?.[0];if(Q){v(!0);try{const se=await vt.uploadArchivePhoto(t.id,Q);b(se.photos),i.invalidateQueries({queryKey:["archives"]})}catch(se){console.error("Failed to upload photo:",se)}finally{v(!1),T.current&&(T.current.value="")}}},q=async Y=>{try{const Q=await vt.deleteArchivePhoto(t.id,Y);b(Q.photos||[]),i.invalidateQueries({queryKey:["archives"]})}catch(Q){console.error("Failed to delete photo:",Q)}},G=Y=>{Y.preventDefault(),L.mutate({print_name:r||void 0,printer_id:s,notes:l||void 0,tags:d||void 0,failure_reason:t.status==="failed"&&p||void 0})};return S.jsx("div",{className:"fixed inset-0 bg-black/70 flex items-center justify-center z-50 p-4",onClick:e,children:S.jsxs("div",{className:"bg-bambu-dark-secondary rounded-xl border border-bambu-dark-tertiary w-full max-w-md max-h-[90vh] flex flex-col",onClick:Y=>Y.stopPropagation(),children:[S.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-bambu-dark-tertiary",children:[S.jsx("h2",{className:"text-lg font-semibold text-white",children:"Edit Archive"}),S.jsx("button",{onClick:e,className:"text-bambu-gray hover:text-white transition-colors",children:S.jsx(_i,{className:"w-5 h-5"})})]}),S.jsxs("form",{onSubmit:G,className:"p-6 space-y-4 overflow-y-auto flex-1",children:[S.jsxs("div",{children:[S.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:"Name"}),S.jsx("input",{type:"text",value:r,onChange:Y=>a(Y.target.value),className:"w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none",placeholder:"Print name"})]}),S.jsxs("div",{children:[S.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:"Printer"}),S.jsxs("select",{value:s??"",onChange:Y=>o(Y.target.value?Number(Y.target.value):null),className:"w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none",children:[S.jsx("option",{value:"",children:"No printer"}),R?.map(Y=>S.jsx("option",{value:Y.id,children:Y.name},Y.id))]})]}),S.jsxs("div",{children:[S.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:"Notes"}),S.jsx("textarea",{value:l,onChange:Y=>c(Y.target.value),rows:3,className:"w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none resize-none",placeholder:"Add notes about this print..."})]}),S.jsxs("div",{children:[S.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:"Tags"}),O.length>0&&S.jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:O.map(Y=>S.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 bg-bambu-dark-tertiary rounded text-sm text-white",children:[S.jsx(h0,{className:"w-3 h-3"}),Y,S.jsx("button",{type:"button",onClick:()=>W(Y),className:"ml-0.5 text-bambu-gray hover:text-white",children:S.jsx(_i,{className:"w-3 h-3"})})]},Y))}),S.jsxs("div",{className:"relative",children:[S.jsx("input",{ref:E,type:"text",value:d,onChange:Y=>f(Y.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:O.length>0?"Add more tags...":"Add tags..."}),M&&B.length>0&&S.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:[S.jsx("div",{className:"p-2 text-xs text-bambu-gray border-b border-bambu-dark-tertiary",children:"Existing tags (click to add)"}),S.jsx("div",{className:"p-2 flex flex-wrap gap-1.5",children:B.map(Y=>S.jsx("button",{type:"button",onClick:()=>I(Y),className:"px-2 py-0.5 bg-bambu-dark-tertiary hover:bg-bambu-green/20 rounded text-sm text-bambu-gray hover:text-white transition-colors",children:Y},Y))})]})]})]}),t.status==="failed"&&S.jsxs("div",{children:[S.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:"Failure Reason"}),S.jsxs("select",{value:p,onChange:Y=>m(Y.target.value),className:"w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none",children:[S.jsx("option",{value:"",children:"Select reason..."}),Sxe.map(Y=>S.jsx("option",{value:Y,children:Y},Y))]})]}),S.jsxs("div",{children:[S.jsxs("label",{className:"block text-sm text-bambu-gray mb-1",children:[S.jsx(A2,{className:"w-4 h-4 inline mr-1"}),"Photos of Printed Result"]}),S.jsxs("div",{className:"flex flex-wrap gap-2 mb-2",children:[y.map(Y=>S.jsxs("div",{className:"relative group",children:[S.jsx("img",{src:vt.getArchivePhotoUrl(t.id,Y),alt:"Print result",className:"w-20 h-20 object-cover rounded-lg border border-bambu-dark-tertiary"}),S.jsx("button",{type:"button",onClick:()=>q(Y),className:"absolute -top-1 -right-1 p-1 bg-red-500 rounded-full opacity-0 group-hover:opacity-100 transition-opacity",children:S.jsx(Jl,{className:"w-3 h-3 text-white"})})]},Y)),S.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:[S.jsx("input",{ref:T,type:"file",accept:"image/jpeg,image/png,image/webp",onChange:$,className:"hidden",disabled:x}),x?S.jsx(ci,{className:"w-6 h-6 text-bambu-gray animate-spin"}):S.jsx(d0,{className:"w-6 h-6 text-bambu-gray"})]})]}),S.jsx("p",{className:"text-xs text-bambu-gray",children:"Click + to add photos of your printed result"})]}),S.jsxs("div",{className:"flex gap-3 pt-2",children:[S.jsx(xt,{type:"button",variant:"secondary",onClick:e,className:"flex-1",children:"Cancel"}),S.jsxs(xt,{type:"submit",disabled:L.isPending,className:"flex-1",children:[S.jsx(sS,{className:"w-4 h-4"}),L.isPending?"Saving...":"Save"]})]})]})]})})}function Mxe({x:t,y:e,items:n,onClose:i}){const r=C.useRef(null);return C.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]),C.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]),S.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?S.jsx("div",{className:"my-1 border-t border-bambu-dark-tertiary"},s):S.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&&S.jsx("span",{className:"w-4 h-4 flex-shrink-0",children:a.icon}),a.label]},s))})}function Exe({selectedIds:t,existingTags:e,onClose:n}){const i=Hr(),{showToast:r}=Mf(),[a,s]=C.useState(""),[o,l]=C.useState(new Set),[c,d]=C.useState("add"),f=Gn({mutationFn:async()=>{const b=Array.from(o);return await Promise.all(t.map(async x=>{const v=await vt.getArchive(x),M=v.tags?v.tags.split(",").map(E=>E.trim()).filter(Boolean):[];let w;return c==="add"?w=[...new Set([...M,...b])]:w=M.filter(E=>!o.has(E)),vt.updateArchive(x,{tags:w.join(", ")})})),{count:t.length,mode:c,tags:b}},onSuccess:({count:b,mode:x,tags:v})=>{i.invalidateQueries({queryKey:["archives"]}),r(`${x==="add"?"Added":"Removed"} ${v.length} tag${v.length!==1?"s":""} ${x==="add"?"to":"from"} ${b} archive${b!==1?"s":""}`),n()},onError:()=>{r("Failed to update tags","error")}}),p=b=>{l(x=>{const v=new Set(x);return v.has(b)?v.delete(b):v.add(b),v})},m=()=>{a.trim()&&!o.has(a.trim())&&(l(b=>new Set([...b,a.trim()])),s(""))},y=b=>{b.key==="Enter"&&(b.preventDefault(),m())};return S.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4",children:S.jsx(bi,{className:"w-full max-w-md",children:S.jsxs(Ri,{className:"p-0",children:[S.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-bambu-dark-tertiary",children:[S.jsxs("div",{className:"flex items-center gap-2",children:[S.jsx(h0,{className:"w-5 h-5 text-bambu-green"}),S.jsx("h2",{className:"text-xl font-semibold text-white",children:c==="add"?"Add Tags":"Remove Tags"})]}),S.jsx("button",{onClick:n,className:"text-bambu-gray hover:text-white transition-colors",children:S.jsx(_i,{className:"w-5 h-5"})})]}),S.jsxs("div",{className:"p-4 space-y-4",children:[S.jsxs("p",{className:"text-sm text-bambu-gray",children:[c==="add"?"Add":"Remove"," tags for ",t.length," selected archive",t.length!==1?"s":""]}),S.jsxs("div",{className:"flex gap-2",children:[S.jsx(xt,{size:"sm",variant:c==="add"?"primary":"secondary",onClick:()=>d("add"),children:"Add Tags"}),S.jsx(xt,{size:"sm",variant:c==="remove"?"primary":"secondary",onClick:()=>d("remove"),children:"Remove Tags"})]}),c==="add"&&S.jsxs("div",{className:"flex gap-2",children:[S.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:b=>s(b.target.value),onKeyDown:y}),S.jsx(xt,{size:"sm",variant:"secondary",onClick:m,disabled:!a.trim(),children:S.jsx(d0,{className:"w-4 h-4"})})]}),e.length>0&&S.jsxs("div",{children:[S.jsx("p",{className:"text-xs text-bambu-gray mb-2",children:"Existing tags:"}),S.jsx("div",{className:"flex flex-wrap gap-2",children:e.map(b=>S.jsx("button",{onClick:()=>p(b),className:`px-2 py-1 rounded text-sm transition-colors ${o.has(b)?"bg-bambu-green text-white":"bg-bambu-dark-tertiary text-bambu-gray-light hover:bg-bambu-dark"}`,children:b},b))})]}),o.size>0&&S.jsxs("div",{children:[S.jsxs("p",{className:"text-xs text-bambu-gray mb-2",children:["Tags to ",c==="add"?"add":"remove",":"]}),S.jsx("div",{className:"flex flex-wrap gap-2",children:Array.from(o).map(b=>S.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:[b,S.jsx("button",{onClick:()=>p(b),className:"hover:opacity-70",children:S.jsx(_i,{className:"w-3 h-3"})})]},b))})]})]}),S.jsxs("div",{className:"flex gap-3 p-4 border-t border-bambu-dark-tertiary",children:[S.jsx(xt,{variant:"secondary",onClick:n,className:"flex-1",children:"Cancel"}),S.jsx(xt,{onClick:()=>f.mutate(),disabled:o.size===0||f.isPending,className:"flex-1",children:f.isPending?S.jsxs(S.Fragment,{children:[S.jsx(ci,{className:"w-4 h-4 animate-spin"}),"Processing..."]}):S.jsxs(S.Fragment,{children:[S.jsx(h0,{className:"w-4 h-4"}),c==="add"?"Add Tags":"Remove Tags"]})})]})]})})})}function Axe(t,e){return new Date(t,e+1,0).getDate()}function Txe(t,e){return new Date(t,e,1).getDay()}const Cxe=["January","February","March","April","May","June","July","August","September","October","November","December"],Rxe=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];function Nxe({archives:t,onArchiveClick:e}){const n=new Date,[i,r]=C.useState(n.getMonth()),[a,s]=C.useState(n.getFullYear()),[o,l]=C.useState(null),c=C.useMemo(()=>{const v=new Map;return t.forEach(M=>{const w=new Date(M.completed_at||M.created_at),E=`${w.getFullYear()}-${String(w.getMonth()+1).padStart(2,"0")}-${String(w.getDate()).padStart(2,"0")}`,T=v.get(E)||[];T.push(M),v.set(E,T)}),v},[t]),d=Axe(a,i),f=Txe(a,i),p=()=>{i===0?(r(11),s(a-1)):r(i-1)},m=()=>{i===11?(r(0),s(a+1)):r(i+1)},y=()=>{r(n.getMonth()),s(n.getFullYear())},b=[];for(let v=0;v<f;v++)b.push(null);for(let v=1;v<=d;v++)b.push(v);const x=o?c.get(o)||[]:[];return S.jsxs("div",{className:"flex flex-col lg:flex-row gap-6",children:[S.jsxs("div",{className:"flex-1",children:[S.jsxs("div",{className:"flex items-center justify-between mb-4",children:[S.jsx("button",{onClick:p,className:"p-2 hover:bg-bambu-dark-tertiary rounded-lg transition-colors",children:S.jsx(tf,{className:"w-5 h-5 text-bambu-gray"})}),S.jsxs("div",{className:"flex items-center gap-3",children:[S.jsxs("h2",{className:"text-lg font-semibold text-white",children:[Cxe[i]," ",a]}),S.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"})]}),S.jsx("button",{onClick:m,className:"p-2 hover:bg-bambu-dark-tertiary rounded-lg transition-colors",children:S.jsx(Wp,{className:"w-5 h-5 text-bambu-gray"})})]}),S.jsx("div",{className:"grid grid-cols-7 gap-1 mb-1",children:Rxe.map(v=>S.jsx("div",{className:"text-center text-xs text-bambu-gray py-2",children:v},v))}),S.jsx("div",{className:"grid grid-cols-7 gap-1",children:b.map((v,M)=>{if(v===null)return S.jsx("div",{className:"aspect-square"},`empty-${M}`);const w=`${a}-${String(i+1).padStart(2,"0")}-${String(v).padStart(2,"0")}`,E=c.get(w)||[],T=E.length>0,P=v===n.getDate()&&i===n.getMonth()&&a===n.getFullYear(),R=w===o,U=E.filter(O=>O.status==="completed").length,N=E.filter(O=>O.status==="failed").length;return S.jsxs("button",{onClick:()=>l(R?null:w),className:`aspect-square rounded-lg p-1 flex flex-col items-center justify-center transition-colors relative ${R?"bg-bambu-green text-white":P?"bg-bambu-green/20 text-white ring-2 ring-bambu-green":T?"bg-bambu-dark-tertiary hover:bg-bambu-dark-tertiary/70 text-white":"hover:bg-bambu-dark-tertiary/50 text-bambu-gray"}`,children:[S.jsx("span",{className:`text-sm font-medium ${P&&!R?"text-bambu-green":""}`,children:v}),T&&S.jsxs("div",{className:"absolute bottom-1 left-1/2 -translate-x-1/2 flex items-center gap-1",children:[S.jsx("div",{className:`w-2 h-2 rounded-full ${N>0&&U===0?"bg-red-400":N>0?"bg-yellow-400":"bg-green-400"}`}),S.jsx("span",{className:"text-xs font-medium",children:E.length})]})]},v)})}),S.jsx("div",{className:"mt-4 pt-4 border-t border-bambu-dark-tertiary",children:S.jsxs("div",{className:"grid grid-cols-3 gap-4 text-center",children:[S.jsxs("div",{children:[S.jsx("div",{className:"text-2xl font-bold text-white",children:t.filter(v=>{const M=new Date(v.completed_at||v.created_at);return M.getMonth()===i&&M.getFullYear()===a}).length}),S.jsx("div",{className:"text-xs text-bambu-gray",children:"Prints this month"})]}),S.jsxs("div",{children:[S.jsx("div",{className:"text-2xl font-bold text-green-400",children:t.filter(v=>{const M=new Date(v.completed_at||v.created_at);return M.getMonth()===i&&M.getFullYear()===a&&v.status==="completed"}).length}),S.jsx("div",{className:"text-xs text-bambu-gray",children:"Successful"})]}),S.jsxs("div",{children:[S.jsx("div",{className:"text-2xl font-bold text-red-400",children:t.filter(v=>{const M=new Date(v.completed_at||v.created_at);return M.getMonth()===i&&M.getFullYear()===a&&v.status==="failed"}).length}),S.jsx("div",{className:"text-xs text-bambu-gray",children:"Failed"})]})]})})]}),S.jsx("div",{className:"lg:w-80 bg-bambu-dark rounded-xl p-4",children:o?S.jsxs(S.Fragment,{children:[S.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"})}),x.length>0?S.jsx("div",{className:"space-y-2 max-h-96 overflow-y-auto",children:x.map(v=>S.jsxs("button",{onClick:()=>e?.(v),className:"w-full flex items-center gap-3 p-2 rounded-lg hover:bg-bambu-dark-tertiary transition-colors text-left",children:[v.thumbnail_path?S.jsx("img",{src:vt.getArchiveThumbnail(v.id),alt:"",className:"w-12 h-12 rounded object-cover"}):S.jsx("div",{className:"w-12 h-12 rounded bg-bambu-dark-tertiary flex items-center justify-center",children:S.jsx("span",{className:"text-xs text-bambu-gray",children:"3MF"})}),S.jsxs("div",{className:"flex-1 min-w-0",children:[S.jsx("p",{className:"text-sm text-white truncate",children:v.print_name||v.filename}),S.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[S.jsx("span",{className:v.status==="failed"?"text-red-400":"text-green-400",children:v.status==="failed"?"Failed":"Completed"}),v.filament_color&&S.jsx("div",{className:"flex gap-0.5",children:v.filament_color.split(",").map((M,w)=>S.jsx("div",{className:"w-3 h-3 rounded-full border border-white/20",style:{backgroundColor:M}},w))})]})]})]},v.id))}):S.jsx("p",{className:"text-sm text-bambu-gray",children:"No prints on this day"})]}):S.jsx("div",{className:"text-center py-8",children:S.jsx("p",{className:"text-sm text-bambu-gray",children:"Select a day to see prints"})})})]})}function Pxe({archiveId:t,archiveName:e,onClose:n}){const i=vt.getArchiveQRCodeUrl(t,300),r=()=>{const a=document.createElement("a");a.href=i,a.download=`${e}_qrcode.png`,a.click()};return S.jsx("div",{className:"fixed inset-0 bg-black/70 flex items-center justify-center z-50 p-4",onClick:n,children:S.jsxs("div",{className:"bg-bambu-dark-secondary rounded-xl border border-bambu-dark-tertiary w-full max-w-sm",onClick:a=>a.stopPropagation(),children:[S.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-bambu-dark-tertiary",children:[S.jsx("h2",{className:"text-lg font-semibold text-white",children:"QR Code"}),S.jsx("button",{onClick:n,className:"text-bambu-gray hover:text-white transition-colors",children:S.jsx(_i,{className:"w-5 h-5"})})]}),S.jsxs("div",{className:"p-6 flex flex-col items-center",children:[S.jsx("p",{className:"text-sm text-bambu-gray mb-4 text-center truncate max-w-full",children:e}),S.jsx("div",{className:"bg-white p-4 rounded-lg mb-4",children:S.jsx("img",{src:i,alt:"QR Code",className:"w-64 h-64"})}),S.jsx("p",{className:"text-xs text-bambu-gray mb-4 text-center",children:"Scan to open this archive"}),S.jsxs(xt,{onClick:r,className:"w-full",children:[S.jsx(nf,{className:"w-4 h-4"}),"Download QR Code"]})]})]})})}function Dxe({archiveId:t,archiveName:e,photos:n,onClose:i,onDelete:r}){const[a,s]=C.useState(0),[o,l]=C.useState(!1);if(C.useEffect(()=>{const m=y=>{y.key==="Escape"&&i(),y.key==="ArrowLeft"&&s(b=>Math.max(0,b-1)),y.key==="ArrowRight"&&s(b=>Math.min(n.length-1,b+1))};return window.addEventListener("keydown",m),()=>window.removeEventListener("keydown",m)},[i,n.length]),C.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=vt.getArchivePhotoUrl(t,c),f=()=>{const m=document.createElement("a");m.href=d,m.download=`${e}_photo_${a+1}.jpg`,m.click()},p=()=>{r&&l(!0)};return S.jsxs("div",{className:"fixed inset-0 bg-black/90 flex items-center justify-center z-50",onClick:i,children:[S.jsxs("div",{className:"relative w-full h-full flex flex-col",onClick:m=>m.stopPropagation(),children:[S.jsxs("div",{className:"flex items-center justify-between px-6 py-4 bg-black/50",children:[S.jsxs("div",{children:[S.jsx("h2",{className:"text-lg font-semibold text-white",children:e}),S.jsxs("p",{className:"text-sm text-bambu-gray",children:["Photo ",a+1," of ",n.length]})]}),S.jsxs("div",{className:"flex items-center gap-2",children:[S.jsxs(xt,{variant:"secondary",size:"sm",onClick:f,children:[S.jsx(nf,{className:"w-4 h-4"}),"Download"]}),r&&S.jsx(xt,{variant:"secondary",size:"sm",onClick:p,className:"text-red-400 hover:text-red-300",children:S.jsx(Jl,{className:"w-4 h-4"})}),S.jsx("button",{onClick:i,className:"p-2 text-bambu-gray hover:text-white transition-colors",children:S.jsx(_i,{className:"w-6 h-6"})})]})]}),S.jsxs("div",{className:"flex-1 min-h-0 flex items-center justify-center p-4 relative overflow-hidden",children:[a>0&&S.jsx("button",{onClick:()=>s(m=>m-1),className:"absolute left-4 z-10 p-3 bg-black/50 hover:bg-black/70 rounded-full transition-colors",children:S.jsx(tf,{className:"w-8 h-8 text-white"})}),S.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&&S.jsx("button",{onClick:()=>s(m=>m+1),className:"absolute right-4 z-10 p-3 bg-black/50 hover:bg-black/70 rounded-full transition-colors",children:S.jsx(Wp,{className:"w-8 h-8 text-white"})})]}),n.length>1&&S.jsx("div",{className:"flex justify-center gap-2 p-4 bg-black/50",children:n.map((m,y)=>S.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:S.jsx("img",{src:vt.getArchivePhotoUrl(t,m),alt:`Thumbnail ${y+1}`,className:"w-full h-full object-cover"})},m))})]}),o&&S.jsx(qp,{title:"Delete Photo",message:"Delete this photo? This cannot be undone.",confirmText:"Delete",variant:"danger",onConfirm:()=>{r?.(c),l(!1)},onCancel:()=>l(!1)})]})}var iT={exports:{}},rT={};var yB;function Oxe(){if(yB)return rT;yB=1;var t=Hp();function e(f,p){return f===p&&(f!==0||1/f===1/p)||f!==f&&p!==p}var n=typeof Object.is=="function"?Object.is:e,i=t.useState,r=t.useEffect,a=t.useLayoutEffect,s=t.useDebugValue;function o(f,p){var m=p(),y=i({inst:{value:m,getSnapshot:p}}),b=y[0].inst,x=y[1];return a(function(){b.value=m,b.getSnapshot=p,l(b)&&x({inst:b})},[f,m,p]),r(function(){return l(b)&&x({inst:b}),f(function(){l(b)&&x({inst:b})})},[f]),s(m),m}function l(f){var p=f.getSnapshot;f=f.value;try{var m=p();return!n(f,m)}catch{return!0}}function c(f,p){return p()}var d=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?c:o;return rT.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:d,rT}var bB;function F$(){return bB||(bB=1,iT.exports=Oxe()),iT.exports}var z$=F$();function Ir(t){this.content=t}Ir.prototype={constructor:Ir,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 Ir(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 Ir(n)},addToStart:function(t,e){return new Ir([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new Ir(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 Ir(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=Ir.from(t),t.size?new Ir(t.content.concat(this.subtract(t).content)):this},append:function(t){return t=Ir.from(t),t.size?new Ir(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=Ir.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}};Ir.from=function(t){if(t instanceof Ir)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new Ir(e)};function B$(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=B$(r.content,a.content,n+1);if(s!=null)return s}n+=r.nodeSize}}function j$(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=j$(s.content,o.content,n-1,i-1);if(c)return c}n-=l,i-=l}}class lt{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 lt(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 lt(i,r)}cutByIndex(e,n){return e==n?lt.empty:e==0&&n==this.content.length?this:new lt(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 lt(r,a)}addToStart(e){return new lt([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new lt(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 B$(this,e,n)}findDiffEnd(e,n=this.size,i=e.size){return j$(this,e,n,i)}findIndex(e){if(e==0)return Jy(0,e);if(e==this.size)return Jy(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?Jy(n+1,a):Jy(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 lt.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new lt(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return lt.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 lt(n||e,i)}static from(e){if(!e)return lt.empty;if(e instanceof lt)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new lt([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}lt.empty=new lt([],0);const aT={index:0,offset:0};function Jy(t,e){return aT.index=t,aT.offset=e,aT}function g_(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(!g_(t[i],e[i]))return!1}else{for(let i in t)if(!(i in e)||!g_(t[i],e[i]))return!1;for(let i in e)if(!(i in t))return!1}return!0}let jn=class LR{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&&g_(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 LR.none;if(e instanceof LR)return[e];let n=e.slice();return n.sort((i,r)=>i.type.rank-r.type.rank),n}};jn.none=[];class v_ extends Error{}class wt{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=V$(this.content,e+this.openStart,n);return i&&new wt(i,this.openStart,this.openEnd)}removeBetween(e,n){return new wt(H$(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 wt.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 wt(lt.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 wt(e,i,r)}}wt.empty=new wt(lt.empty,0,0);function H$(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(H$(a.content,e-r-1,n-r-1)))}function V$(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=V$(s.content,e-a-1,n,s);return o&&t.replaceChild(r,s.copy(o))}function Lxe(t,e,n){if(n.openStart>t.depth)throw new v_("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new v_("Inconsistent open depths");return G$(t,e,n,0)}function G$(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=G$(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 Gd(s,o.cut(0,t.parentOffset).append(n.content).append(o.cut(e.parentOffset)))}else{let{start:s,end:o}=kxe(n,t);return Gd(a,W$(t,s,o,e,i))}else return Gd(a,x_(t,e,i))}function $$(t,e){if(!e.type.compatibleContent(t.type))throw new v_("Cannot join "+e.type.name+" onto "+t.type.name)}function kR(t,e,n){let i=t.node(n);return $$(i,e.node(n)),i}function Vd(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 Wg(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&&(Vd(t.nodeAfter,i),a++));for(let o=a;o<s;o++)Vd(r.child(o),i);e&&e.depth==n&&e.textOffset&&Vd(e.nodeBefore,i)}function Gd(t,e){return t.type.checkContent(e),t.copy(e)}function W$(t,e,n,i,r){let a=t.depth>r&&kR(t,e,r+1),s=i.depth>r&&kR(n,i,r+1),o=[];return Wg(null,t,r,o),a&&s&&e.index(r)==n.index(r)?($$(a,s),Vd(Gd(a,W$(t,e,n,i,r+1)),o)):(a&&Vd(Gd(a,x_(t,e,r+1)),o),Wg(e,n,r,o),s&&Vd(Gd(s,x_(n,i,r+1)),o)),Wg(i,null,r,o),new lt(o)}function x_(t,e,n){let i=[];if(Wg(null,t,n,i),t.depth>n){let r=kR(t,e,n+1);Vd(Gd(r,x_(t,e,n+1)),i)}return Wg(e,null,n,i),new lt(i)}function kxe(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(lt.from(r));return{start:r.resolveNoCache(t.openStart+n),end:r.resolveNoCache(r.content.size-t.openEnd-n)}}class M0{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 jn.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 y_(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 M0(n,i,a)}static resolveCached(e,n){let i=_B.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 _B.set(e,i=new Ixe);let r=i.elts[i.i]=M0.resolve(e,n);return i.i=(i.i+1)%Uxe,r}}class Ixe{constructor(){this.elts=[],this.i=0}}const Uxe=12,_B=new WeakMap;class y_{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 Fxe=Object.create(null);let Mu=class IR{constructor(e,n,i,r=jn.none){this.type=e,this.attrs=n,this.marks=r,this.content=i||lt.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&&g_(this.attrs,n||e.defaultAttrs||Fxe)&&jn.sameSet(this.marks,i||jn.none)}copy(e=null){return e==this.content?this:new IR(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new IR(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 wt.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 wt(c,r.depth-s,a.depth-s)}replace(e,n,i){return Lxe(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 M0.resolveCached(this,e)}resolveNoCache(e){return M0.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()+")"),q$(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=lt.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=jn.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(!jn.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=lt.fromJSON(e,n.content),a=e.nodeType(n.type).create(n.attrs,r,i);return a.type.checkAttrs(a.attrs),a}};Mu.prototype.text=void 0;class b_ extends Mu{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):q$(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 b_(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new b_(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 q$(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class df{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let i=new zxe(e,n);if(i.next==null)return df.empty;let r=X$(i);i.next&&i.err("Unexpected trailing text");let a=Wxe($xe(r));return qxe(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 lt.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 p=a(f,o.concat(d));if(p)return p}}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. `)}}df.empty=new df(!0);class zxe{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 X$(t){let e=[];do e.push(Bxe(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function Bxe(t){let e=[];do e.push(jxe(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function jxe(t){let e=Gxe(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=Hxe(t,e);else break;return e}function SB(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function Hxe(t,e){let n=SB(t),i=n;return t.eat(",")&&(t.next!="}"?i=SB(t):i=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:i,expr:e}}function Vxe(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 Gxe(t){if(t.eat("(")){let e=X$(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=Vxe(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 $xe(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 Y$(t,e){return e-t}function wB(t,e){let n=[];return i(e),n.sort(Y$);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 Wxe(t){let e=Object.create(null);return n(wB(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]);wB(t,l).forEach(d=>{c||r.push([o,c=[]]),c.indexOf(d)==-1&&c.push(d)})})});let a=e[i.join(",")]=new df(i.indexOf(t.length-1)>-1);for(let s=0;s<r.length;s++){let o=r[s][1].sort(Y$);a.next.push({type:r[s][0],next:e[o.join(",")]||n(o)})}return a}}function qxe(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 K$(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 Z$(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 J$(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 Q$(t,e){let n=Object.create(null);if(e)for(let i in e)n[i]=new Yxe(t,i,e[i]);return n}let MB=class e9{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=Q$(e,i.attrs),this.defaultAttrs=K$(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==df.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:Z$(this.attrs,e)}create(e=null,n,i){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new Mu(this,this.computeAttrs(e),lt.from(n),jn.setFrom(i))}createChecked(e=null,n,i){return n=lt.from(n),this.checkContent(n),new Mu(this,this.computeAttrs(e),n,jn.setFrom(i))}createAndFill(e=null,n,i){if(e=this.computeAttrs(e),n=lt.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(lt.empty,!0);return a?new Mu(this,e,n.append(a),jn.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){J$(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:jn.none:e}static compile(e,n){let i=Object.create(null);e.forEach((a,s)=>i[a]=new e9(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 Xxe(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 Yxe{constructor(e,n,i){this.hasDefault=Object.prototype.hasOwnProperty.call(i,"default"),this.default=i.default,this.validate=typeof i.validate=="string"?Xxe(e,n,i.validate):i.validate}get isRequired(){return!this.hasDefault}}class vS{constructor(e,n,i,r){this.name=e,this.rank=n,this.schema=i,this.spec=r,this.attrs=Q$(e,r.attrs),this.excluded=null;let a=K$(this.attrs);this.instance=a?new jn(this,a):null}create(e=null){return!e&&this.instance?this.instance:new jn(this,Z$(this.attrs,e))}static compile(e,n){let i=Object.create(null),r=0;return e.forEach((a,s)=>i[a]=new vS(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){J$(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class t9{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=Ir.from(e.nodes),n.marks=Ir.from(e.marks||{}),this.nodes=MB.compile(this.spec.nodes,this),this.marks=vS.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]=df.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?EB(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==""?[]:EB(this,s.split(" "))}this.nodeFromJSON=r=>Mu.fromJSON(this,r),this.markFromJSON=r=>jn.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 MB){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 b_(i,i.defaultAttrs,e,jn.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 EB(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 Kxe(t){return t.tag!=null}function Zxe(t){return t.style!=null}let qg=class UR{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let i=this.matchedStyles=[];n.forEach(r=>{if(Kxe(r))this.tags.push(r);else if(Zxe(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 TB(this,n,!1);return i.addAll(e,jn.none,n.from,n.to),i.finish()}parseSlice(e,n={}){let i=new TB(this,n,!0);return i.addAll(e,jn.none,n.from,n.to),wt.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(eye(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=CB(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=CB(s)),s.node||s.ignore||s.mark||(s.node=r)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new UR(e,UR.schemaRules(e)))}};const n9={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},Jxe={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},i9={ol:!0,ul:!0},E0=1,FR=2,Xg=4;function AB(t,e,n){return e!=null?(e?E0:0)|(e==="full"?FR:0):t&&t.whitespace=="pre"?E0|FR:n&~Xg}class Qy{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=jn.none,this.match=a||(s&Xg?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(lt.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&E0)){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=lt.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(lt.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&&!n9.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class TB{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=AB(null,n.preserveWhitespace,0)|(i?Xg:0);r?a=new Qy(r.type,r.attrs,jn.none,!0,n.topMatch||r.type.contentMatch,s):i?a=new Qy(null,null,jn.none,!0,null,s):a=new Qy(e.schema.topNodeType,null,jn.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&FR?"full":this.localPreserveWS||(r.options&E0)>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;i9.hasOwnProperty(s)&&this.parser.normalizeLists&&Qxe(e);let l=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(o=this.parser.matchTag(e,this,i));e:if(l?l.ignore:Jxe.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(n9.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=jn.none;for(let o of r.concat(e.marks))(a.type?a.type.allowsMarkType(o.type):RB(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=AB(e,a,s.options);s.options&Xg&&s.content.length==0&&(o|=Xg);let l=jn.none;return i=i.filter(c=>(s.type?s.type.allowsMarkType(c.type):RB(c.type,e))?(l=c.addToSet(l),!1):!0),this.nodes.push(new Qy(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|=E0)}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 Qxe(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let i=e.nodeType==1?e.nodeName.toLowerCase():null;i&&i9.hasOwnProperty(i)&&n?(n.appendChild(e),e=n):i=="li"?n=e:i&&(n=null)}}function eye(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function CB(t){let e={};for(let n in t)e[n]=t[n];return e}function RB(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 Tf{constructor(e,n){this.nodes=e,this.marks=n}serializeFragment(e,n={},i){i||(i=sT(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}=zb(sT(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&&zb(sT(i),r(e,n),null,e.attrs)}static renderSpec(e,n,i=null,r){return zb(e,n,i,r)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new Tf(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=NB(e.nodes);return n.text||(n.text=i=>i.text),n}static marksFromSchema(e){return NB(e.marks)}}function NB(t){let e={};for(let n in t){let i=t[n].spec.toDOM;i&&(e[n]=i)}return e}function sT(t){return t.document||window.document}const PB=new WeakMap;function tye(t){let e=PB.get(t);return e===void 0&&PB.set(t,e=nye(t)),e}function nye(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 zb(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=tye(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 p=f.indexOf(" ");p>0?l.setAttributeNS(f.slice(0,p),f.slice(p+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 p=e[f];if(p===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:m,contentDOM:y}=zb(t,p,n,i);if(l.appendChild(m),y){if(o)throw new RangeError("Multiple content holes");o=y}}}return{dom:l,contentDOM:o}}const r9=65535,a9=Math.pow(2,16);function iye(t,e){return t+e*a9}function DB(t){return t&r9}function rye(t){return(t-(t&r9))/a9}const s9=1,o9=2,Bb=4,l9=8;class zR{constructor(e,n,i){this.pos=e,this.delInfo=n,this.recover=i}get deleted(){return(this.delInfo&l9)>0}get deletedBefore(){return(this.delInfo&(s9|Bb))>0}get deletedAfter(){return(this.delInfo&(o9|Bb))>0}get deletedAcross(){return(this.delInfo&Bb)>0}}class Qa{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&Qa.empty)return Qa.empty}recover(e){let n=0,i=DB(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+rye(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 p=c?e==l?-1:e==f?1:n:n,m=l+r+(p<0?0:d);if(i)return m;let y=e==(n<0?l:f)?null:iye(o/3,e-l),b=e==l?o9:e==f?s9:Bb;return(n<0?e!=l:e!=f)&&(b|=l9),new zR(m,b,y)}r+=d-c}return i?e+r:new zR(e+r,0,null)}touches(e,n){let i=0,r=DB(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 Qa(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?Qa.empty:new Qa(e<0?[0,-e,0]:[0,0,e])}}Qa.empty=new Qa([]);class A0{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 A0(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 A0;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 zR(e,r,null)}}const oT=Object.create(null);let ia=class{getMap(){return Qa.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let i=oT[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 oT)throw new RangeError("Duplicate use of step JSON ID "+e);return oT[e]=n,n.prototype.jsonID=e,n}};class ji{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new ji(e,null)}static fail(e){return new ji(null,e)}static fromReplace(e,n,i,r){try{return ji.ok(e.replace(n,i,r))}catch(a){if(a instanceof v_)return ji.fail(a.message);throw a}}}function sP(t,e,n){let i=[];for(let r=0;r<t.childCount;r++){let a=t.child(r);a.content.size&&(a=a.copy(sP(a.content,e,a))),a.isInline&&(a=e(a,n,r)),i.push(a)}return lt.fromArray(i)}class gu extends ia{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 wt(sP(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 ji.fromReplace(e,this.from,this.to,a)}invert(){return new uo(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 gu(n.pos,i.pos,this.mark)}merge(e){return e instanceof gu&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new gu(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 gu(n.from,n.to,e.markFromJSON(n.mark))}}ia.jsonID("addMark",gu);class uo extends ia{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 wt(sP(n.content,r=>r.mark(this.mark.removeFromSet(r.marks)),e),n.openStart,n.openEnd);return ji.fromReplace(e,this.from,this.to,i)}invert(){return new gu(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 uo(n.pos,i.pos,this.mark)}merge(e){return e instanceof uo&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new uo(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 uo(n.from,n.to,e.markFromJSON(n.mark))}}ia.jsonID("removeMark",uo);class vu extends ia{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return ji.fail("No node at mark step's position");let i=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return ji.fromReplace(e,this.pos,this.pos+1,new wt(lt.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 vu(this.pos,n.marks[r]);return new vu(this.pos,this.mark)}}return new ff(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new vu(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 vu(n.pos,e.markFromJSON(n.mark))}}ia.jsonID("addNodeMark",vu);class ff extends ia{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return ji.fail("No node at mark step's position");let i=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return ji.fromReplace(e,this.pos,this.pos+1,new wt(lt.from(i),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new vu(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new ff(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 ff(n.pos,e.markFromJSON(n.mark))}}ia.jsonID("removeNodeMark",ff);class _r extends ia{constructor(e,n,i,r=!1){super(),this.from=e,this.to=n,this.slice=i,this.structure=r}apply(e){return this.structure&&BR(e,this.from,this.to)?ji.fail("Structure replace would overwrite content"):ji.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new Qa([this.from,this.to-this.from,this.slice.size])}invert(e){return new _r(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 _r(n.pos,Math.max(n.pos,i.pos),this.slice,this.structure)}merge(e){if(!(e instanceof _r)||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?wt.empty:new wt(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new _r(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?wt.empty:new wt(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new _r(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 _r(n.from,n.to,wt.fromJSON(e,n.slice),!!n.structure)}}ia.jsonID("replace",_r);class wr extends ia{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&&(BR(e,this.from,this.gapFrom)||BR(e,this.gapTo,this.to)))return ji.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return ji.fail("Gap is not a flat range");let i=this.slice.insertAt(this.insert,n.content);return i?ji.fromReplace(e,this.from,this.to,i):ji.fail("Content does not fit in gap")}getMap(){return new Qa([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 wr(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 wr(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 wr(n.from,n.to,n.gapFrom,n.gapTo,wt.fromJSON(e,n.slice),n.insert,!!n.structure)}}ia.jsonID("replaceAround",wr);function BR(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 aye(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 p=Math.max(c,e),m=Math.min(c+l.nodeSize,n),y=i.addToSet(f);for(let b=0;b<f.length;b++)f[b].isInSet(y)||(s&&s.to==p&&s.mark.eq(f[b])?s.to=m:r.push(s=new uo(p,m,f[b])));o&&o.to==p?o.to=m:a.push(o=new gu(p,m,i))}}),r.forEach(l=>t.step(l)),a.forEach(l=>t.step(l))}function sye(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 vS){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],p;for(let m=0;m<r.length;m++){let y=r[m];y.step==a-1&&f.eq(r[m].style)&&(p=y)}p?(p.to=c,p.step=a):r.push({style:f,from:Math.max(o,e),to:c,step:a})}}}),r.forEach(s=>t.step(new uo(s.from,s.to,s.style)))}function oP(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 _r(o,d,wt.empty));else{i=f;for(let p=0;p<c.marks.length;p++)n.allowsMarkType(c.marks[p].type)||t.step(new uo(o,d,c.marks[p]));if(r&&c.isText&&n.whitespace!="pre"){let p,m=/\r?\n|\r/g,y;for(;p=m.exec(c.text);)y||(y=new wt(lt.from(n.schema.text(" ",n.allowedMarks(c.marks))),0,0)),s.push(new _r(o+p.index,o+p.index+p[0].length,y))}}o=d}if(!i.validEnd){let l=i.fillBefore(lt.empty,!0);t.replace(o,o,new wt(l,0,0))}for(let l=s.length-1;l>=0;l--)t.step(s[l])}function oye(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function Qp(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||!oye(s,o,l))break;o&&(r=1),l<s.childCount&&(a=1)}return null}function lye(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=lt.empty,f=0;for(let y=a,b=!1;y>n;y--)b||i.index(y)>0?(b=!0,d=lt.from(i.node(y).copy(d)),f++):l--;let p=lt.empty,m=0;for(let y=a,b=!1;y>n;y--)b||r.after(y+1)<r.end(y)?(b=!0,p=lt.from(r.node(y).copy(p)),m++):c++;t.step(new wr(l,c,s,o,new wt(d.append(p),f,m),d.size-f,!0))}function lP(t,e,n=null,i=t){let r=cye(t,e),a=r&&uye(i,e);return a?r.map(OB).concat({type:e,attrs:n}).concat(a.map(OB)):null}function OB(t){return{type:t,attrs:null}}function cye(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 uye(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 dye(t,e,n){let i=lt.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=lt.from(n[s].type.create(n[s].attrs,i))}let r=e.start,a=e.end;t.step(new wr(r,a,r,a,new wt(i,0,0),n.length,!0))}function fye(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)&&hye(t.doc,t.mapping.slice(a).map(o),i)){let c=null;if(i.schema.linebreakReplacement){let m=i.whitespace=="pre",y=!!i.contentMatch.matchType(i.schema.linebreakReplacement);m&&!y?c=!1:!m&&y&&(c=!0)}c===!1&&u9(t,s,o,a),oP(t,t.mapping.slice(a).map(o,1),i,void 0,c===null);let d=t.mapping.slice(a),f=d.map(o,1),p=d.map(o+s.nodeSize,1);return t.step(new wr(f,p,f+1,p-1,new wt(lt.from(i.create(l,null,s.marks)),0,0),1,!0)),c===!0&&c9(t,s,o,a),!1}})}function c9(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 u9(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 hye(t,e,n){let i=t.resolve(e),r=i.index();return i.parent.canReplaceWith(r,r+1,n)}function pye(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 wr(e,e+a.nodeSize,e+1,e+a.nodeSize-1,new wt(lt.from(s),0,0),1,!0))}function ql(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),p=r.index(c);if(f.type.spec.isolating)return!1;let m=f.content.cutByIndex(p,f.childCount),y=i&&i[d+1];y&&(m=m.replaceChild(0,y.type.create(y.attrs)));let b=i&&i[d]||f;if(!f.canReplace(p+1,f.childCount)||!b.type.validContent(m))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 mye(t,e,n=1,i){let r=t.doc.resolve(e),a=lt.empty,s=lt.empty;for(let o=r.depth,l=r.depth-n,c=n-1;o>l;o--,c--){a=lt.from(r.node(o).copy(a));let d=i&&i[c];s=lt.from(d?d.type.create(d.attrs,s):r.node(o).copy(s))}t.step(new _r(e,e,new wt(a.append(s),n,n),!0))}function Bu(t,e){let n=t.resolve(e),i=n.index();return d9(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(i,i+1)}function gye(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 d9(t,e){return!!(t&&e&&!t.isLeaf&&gye(t,e))}function xS(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&&d9(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 vye(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);u9(t,d.node(),d.before(),o)}s.inlineContent&&oP(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 _r(c,l.map(e+n,-1),wt.empty,!0)),i===!0){let d=t.doc.resolve(c);c9(t,d.node(),d.before(),t.steps.length)}return t}function xye(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 f9(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 yS(t,e,n=e,i=wt.empty){if(e==n&&!i.size)return null;let r=t.resolve(e),a=t.resolve(n);return h9(r,a,i)?new _r(e,n,i):new yye(r,a,i).fit()}function h9(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}class yye{constructor(e,n,i){this.$from=e,this.$to=n,this.unplaced=i,this.frontier=[],this.placed=lt.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=lt.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 wt(a,s,o);return e>-1?new wr(i.pos,e,this.$to.pos,this.$to.end(),l,n):l.size||i.pos!=this.$to.pos?new _r(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=lT(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(lt.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=lT(e,n);return!r.childCount||r.firstChild.isLeaf?!1:(this.unplaced=new wt(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=lT(e,n);if(r.childCount<=1&&n>0){let a=e.size-n<=n+r.size;this.unplaced=new wt(kg(e,n-1,1),n-1,a?n-1:i)}else this.unplaced=new wt(kg(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 b=0;b<a.length;b++)this.openFrontierNode(a[b]);let s=this.unplaced,o=i?i.content:s.content,l=s.openStart-e,c=0,d=[],{match:f,type:p}=this.frontier[n];if(r){for(let b=0;b<r.childCount;b++)d.push(r.child(b));f=f.matchFragment(r)}let m=o.size+e-(s.content.size-s.openEnd);for(;c<o.childCount;){let b=o.child(c),x=f.matchType(b.type);if(!x)break;c++,(c>1||l==0||b.content.size)&&(f=x,d.push(p9(b.mark(p.allowedMarks(b.marks)),c==1?l:0,c==o.childCount?m:-1)))}let y=c==o.childCount;y||(m=-1),this.placed=Ig(this.placed,n,lt.from(d)),this.frontier[n].match=f,y&&m<0&&i&&i.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let b=0,x=o;b<m;b++){let v=x.lastChild;this.frontier.push({type:v.type,match:v.contentMatchAt(v.childCount)}),x=v.content}this.unplaced=y?e==0?wt.empty:new wt(kg(s.content,e-1,1),e-1,m<0?s.openEnd:e-1):new wt(kg(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||!cT(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=cT(e,n,r,i,a);if(s){for(let o=n-1;o>=0;o--){let{match:l,type:c}=this.frontier[o],d=cT(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=Ig(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=Ig(this.placed,this.depth,lt.from(e.create(n,i))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(lt.empty,!0);n.childCount&&(this.placed=Ig(this.placed,this.frontier.length,n))}}function kg(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(kg(t.firstChild.content,e-1,n)))}function Ig(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(Ig(t.lastChild.content,e-1,n)))}function lT(t,e){for(let n=0;n<e;n++)t=t.firstChild.content;return t}function p9(t,e,n){if(e<=0)return t;let i=t.content;return e>1&&(i=i.replaceChild(0,p9(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(lt.empty,!0)))),t.copy(i)}function cT(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&&!bye(n,a.content,s)?o:null}function bye(t,e,n){for(let i=n;i<e.childCount;i++)if(!t.allowsMarks(e.child(i).marks))return!0;return!1}function _ye(t){return t.spec.defining||t.spec.definingForContent}function Sye(t,e,n,i){if(!i.size)return t.deleteRange(e,n);let r=t.doc.resolve(e),a=t.doc.resolve(n);if(h9(r,a,i))return t.step(new _r(e,n,i));let s=g9(r,a);s[s.length-1]==0&&s.pop();let o=-(r.depth+1);s.unshift(o);for(let p=r.depth,m=r.pos-1;p>0;p--,m--){let y=r.node(p).type.spec;if(y.defining||y.definingAsContext||y.isolating)break;s.indexOf(p)>-1?o=p:r.before(p)==m&&s.splice(1,0,-p)}let l=s.indexOf(o),c=[],d=i.openStart;for(let p=i.content,m=0;;m++){let y=p.firstChild;if(c.push(y),m==i.openStart)break;p=y.content}for(let p=d-1;p>=0;p--){let m=c[p],y=_ye(m.type);if(y&&!m.sameMarkup(r.node(Math.abs(o)-1)))d=p;else if(y||!m.type.isTextblock)break}for(let p=i.openStart;p>=0;p--){let m=(p+d+1)%(i.openStart+1),y=c[m];if(y)for(let b=0;b<s.length;b++){let x=s[(b+l)%s.length],v=!0;x<0&&(v=!1,x=-x);let M=r.node(x-1),w=r.index(x-1);if(M.canReplaceWith(w,w,y.type,y.marks))return t.replace(r.before(x),v?a.after(x):n,new wt(m9(i.content,0,i.openStart,m),m,i.openEnd))}}let f=t.steps.length;for(let p=s.length-1;p>=0&&(t.replace(e,n,i),!(t.steps.length>f));p--){let m=s[p];m<0||(e=r.before(m),n=a.after(m))}}function m9(t,e,n,i,r){if(e<n){let a=t.firstChild;t=t.replaceChild(0,a.copy(m9(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(lt.empty,!0))}return t}function wye(t,e,n,i){if(!i.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let r=xye(t.doc,e,i.type);r!=null&&(e=n=r)}t.replaceRange(e,n,new wt(lt.from(i),0,0))}function Mye(t,e,n){let i=t.doc.resolve(e),r=t.doc.resolve(n),a=g9(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 g9(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 up extends ia{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 ji.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 ji.fromReplace(e,this.pos,this.pos+1,new wt(lt.from(r),0,n.isLeaf?0:1))}getMap(){return Qa.empty}invert(e){return new up(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 up(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 up(n.pos,n.attr,n.value)}}ia.jsonID("attr",up);class T0 extends ia{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 ji.ok(i)}getMap(){return Qa.empty}invert(e){return new T0(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 T0(n.attr,n.value)}}ia.jsonID("docAttr",T0);let Ap=class extends Error{};Ap=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};Ap.prototype=Object.create(Error.prototype);Ap.prototype.constructor=Ap;Ap.prototype.name="TransformError";class v9{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new A0}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let n=this.maybeStep(e);if(n.failed)throw new Ap(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=wt.empty){let r=yS(this.doc,e,n,i);return r&&this.step(r),this}replaceWith(e,n,i){return this.replace(e,n,new wt(lt.from(i),0,0))}delete(e,n){return this.replace(e,n,wt.empty)}insert(e,n){return this.replaceWith(e,e,n)}replaceRange(e,n,i){return Sye(this,e,n,i),this}replaceRangeWith(e,n,i){return wye(this,e,n,i),this}deleteRange(e,n){return Mye(this,e,n),this}lift(e,n){return lye(this,e,n),this}join(e,n=1){return vye(this,e,n),this}wrap(e,n){return dye(this,e,n),this}setBlockType(e,n=e,i,r=null){return fye(this,e,n,i,r),this}setNodeMarkup(e,n,i=null,r){return pye(this,e,n,i,r),this}setNodeAttribute(e,n,i){return this.step(new up(e,n,i)),this}setDocAttribute(e,n){return this.step(new T0(e,n)),this}addNodeMark(e,n){return this.step(new vu(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 jn)n.isInSet(i.marks)&&this.step(new ff(e,n));else{let r=i.marks,a,s=[];for(;a=n.isInSet(r);)s.push(new ff(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 mye(this,e,n,i),this}addMark(e,n,i){return aye(this,e,n,i),this}removeMark(e,n,i){return sye(this,e,n,i),this}clearIncompatible(e,n,i){return oP(this,e,n,i),this}}const uT=Object.create(null);class en{constructor(e,n,i){this.$anchor=e,this.$head=n,this.ranges=i||[new Eye(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=wt.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?wt.empty:n),o==0&&IB(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),IB(e,i,n.isInline?-1:1))}}static findFrom(e,n,i=!1){let r=e.parent.inlineContent?new Bt(e):Wh(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?Wh(e.node(0),e.node(a),e.before(a+1),e.index(a),n,i):Wh(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 rs(e.node(0))}static atStart(e){return Wh(e,e,0,0,1)||new rs(e)}static atEnd(e){return Wh(e,e,e.content.size,e.childCount,-1)||new rs(e)}static fromJSON(e,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let i=uT[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 uT)throw new RangeError("Duplicate use of selection JSON ID "+e);return uT[e]=n,n.prototype.jsonID=e,n}getBookmark(){return Bt.between(this.$anchor,this.$head).getBookmark()}}en.prototype.visible=!0;class Eye{constructor(e,n){this.$from=e,this.$to=n}}let LB=!1;function kB(t){!LB&&!t.parent.inlineContent&&(LB=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}class Bt extends en{constructor(e,n=e){kB(e),kB(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 en.near(i);let r=e.resolve(n.map(this.anchor));return new Bt(r.parent.inlineContent?r:i,i)}replace(e,n=wt.empty){if(super.replace(e,n),n==wt.empty){let i=this.$from.marksAcross(this.$to);i&&e.ensureMarks(i)}}eq(e){return e instanceof Bt&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new bS(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 Bt(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=en.findFrom(n,i,!0)||en.findFrom(n,-i,!0);if(a)n=a.$head;else return en.near(n,i)}return e.parent.inlineContent||(r==0?e=n:(e=(en.findFrom(e,-i,!0)||en.findFrom(e,i,!0)).$anchor,e.pos<n.pos!=r<0&&(e=n))),new Bt(e,n)}}en.jsonID("text",Bt);class bS{constructor(e,n){this.anchor=e,this.head=n}map(e){return new bS(e.map(this.anchor),e.map(this.head))}resolve(e){return Bt.between(e.resolve(this.anchor),e.resolve(this.head))}}class It extends en{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?en.near(a):new It(a)}content(){return new wt(lt.from(this.node),0,0)}eq(e){return e instanceof It&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new cP(this.anchor)}static fromJSON(e,n){if(typeof n.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new It(e.resolve(n.anchor))}static create(e,n){return new It(e.resolve(n))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}It.prototype.visible=!1;en.jsonID("node",It);class cP{constructor(e){this.anchor=e}map(e){let{deleted:n,pos:i}=e.mapResult(this.anchor);return n?new bS(i,i):new cP(i)}resolve(e){let n=e.resolve(this.anchor),i=n.nodeAfter;return i&&It.isSelectable(i)?new It(n):en.near(n)}}class rs extends en{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,n=wt.empty){if(n==wt.empty){e.delete(0,e.doc.content.size);let i=en.atStart(e.doc);i.eq(e.selection)||e.setSelection(i)}else super.replace(e,n)}toJSON(){return{type:"all"}}static fromJSON(e){return new rs(e)}map(e){return new rs(e)}eq(e){return e instanceof rs}getBookmark(){return Aye}}en.jsonID("all",rs);const Aye={map(){return this},resolve(t){return new rs(t)}};function Wh(t,e,n,i,r,a=!1){if(e.inlineContent)return Bt.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&&It.isSelectable(o))return It.create(t,n-(r<0?o.nodeSize:0))}else{let l=Wh(t,o,n+r,r<0?o.childCount:0,r,a);if(l)return l}n+=o.nodeSize*r}return null}function IB(t,e,n){let i=t.steps.length-1;if(i<e)return;let r=t.steps[i];if(!(r instanceof _r||r instanceof wr))return;let a=t.mapping.maps[i],s;a.forEach((o,l,c,d)=>{s==null&&(s=d)}),t.setSelection(en.near(t.doc.resolve(s),n))}const UB=1,eb=2,FB=4;class Tye extends v9{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|UB)&~eb,this.storedMarks=null,this}get selectionSet(){return(this.updated&UB)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=eb,this}ensureMarks(e){return jn.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&eb)>0}addStep(e,n){super.addStep(e,n),this.updated=this.updated&~eb,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)||jn.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(en.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|=FB,this}get scrolledIntoView(){return(this.updated&FB)>0}}function zB(t,e){return!e||!t?t:t.bind(e)}class Ug{constructor(e,n,i){this.name=e,this.init=zB(n.init,i),this.apply=zB(n.apply,i)}}const Cye=[new Ug("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new Ug("selection",{init(t,e){return t.selection||en.atStart(e.doc)},apply(t){return t.selection}}),new Ug("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,i){return i.selection.$cursor?t.storedMarks:null}}),new Ug("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})];class dT{constructor(e,n){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=Cye.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 Ug(i.key,i.spec.state,i))})}}class ep{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 ep(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 Tye(this)}static create(e){let n=new dT(e.doc?e.doc.type.schema:e.schema,e.plugins),i=new ep(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 dT(this.schema,e.plugins),i=n.fields,r=new ep(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 dT(e.schema,e.plugins),a=new ep(r);return r.fields.forEach(s=>{if(s.name=="doc")a.doc=Mu.fromJSON(e.schema,n.doc);else if(s.name=="selection")a.selection=en.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 x9(t,e,n){for(let i in t){let r=t[i];r instanceof Function?r=r.bind(e):i=="handleDOMEvents"&&(r=x9(r,e,{})),n[i]=r}return n}class di{constructor(e){this.spec=e,this.props={},e.props&&x9(e.props,this,this.props),this.key=e.key?e.key.key:y9("plugin")}getState(e){return e[this.key]}}const fT=Object.create(null);function y9(t){return t in fT?t+"$"+ ++fT[t]:(fT[t]=0,t+"$")}class ar{constructor(e="key"){this.key=y9(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const uP=(t,e)=>t.selection.empty?!1:(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function b9(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}const _9=(t,e,n)=>{let i=b9(t,n);if(!i)return!1;let r=dP(i);if(!r){let s=i.blockRange(),o=s&&Qp(s);return o==null?!1:(e&&e(t.tr.lift(s,o).scrollIntoView()),!0)}let a=r.nodeBefore;if(N9(t,r,e,-1))return!0;if(i.parent.content.size==0&&(Tp(a,"end")||It.isSelectable(a)))for(let s=i.depth;;s--){let o=yS(t.doc,i.before(s),i.after(s),wt.empty);if(o&&o.slice.size<o.to-o.from){if(e){let l=t.tr.step(o);l.setSelection(Tp(a,"end")?en.findFrom(l.doc.resolve(l.mapping.map(r.pos,-1)),-1):It.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},Rye=(t,e,n)=>{let i=b9(t,n);if(!i)return!1;let r=dP(i);return r?S9(t,r,e):!1},Nye=(t,e,n)=>{let i=M9(t,n);if(!i)return!1;let r=fP(i);return r?S9(t,r,e):!1};function S9(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=yS(t.doc,a,l,wt.empty);if(!c||c.from!=a||c instanceof _r&&c.slice.size>=l-a)return!1;if(n){let d=t.tr.step(c);d.setSelection(Bt.create(d.doc,a)),n(d.scrollIntoView())}return!0}function Tp(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 w9=(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=dP(i)}let s=a&&a.nodeBefore;return!s||!It.isSelectable(s)?!1:(e&&e(t.tr.setSelection(It.create(t.doc,a.pos-s.nodeSize)).scrollIntoView()),!0)};function dP(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 M9(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("forward",t):n.parentOffset<n.parent.content.size)?null:n}const E9=(t,e,n)=>{let i=M9(t,n);if(!i)return!1;let r=fP(i);if(!r)return!1;let a=r.nodeAfter;if(N9(t,r,e,1))return!0;if(i.parent.content.size==0&&(Tp(a,"start")||It.isSelectable(a))){let s=yS(t.doc,i.before(),i.after(),wt.empty);if(s&&s.slice.size<s.to-s.from){if(e){let o=t.tr.step(s);o.setSelection(Tp(a,"start")?en.findFrom(o.doc.resolve(o.mapping.map(r.pos)),1):It.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},A9=(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=fP(i)}let s=a&&a.nodeAfter;return!s||!It.isSelectable(s)?!1:(e&&e(t.tr.setSelection(It.create(t.doc,a.pos)).scrollIntoView()),!0)};function fP(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 Pye=(t,e)=>{let n=t.selection,i=n instanceof It,r;if(i){if(n.node.isTextblock||!Bu(t.doc,n.from))return!1;r=n.from}else if(r=xS(t.doc,n.from,-1),r==null)return!1;if(e){let a=t.tr.join(r);i&&a.setSelection(It.create(a.doc,r-t.doc.resolve(r).nodeBefore.nodeSize)),e(a.scrollIntoView())}return!0},Dye=(t,e)=>{let n=t.selection,i;if(n instanceof It){if(n.node.isTextblock||!Bu(t.doc,n.to))return!1;i=n.to}else if(i=xS(t.doc,n.to,1),i==null)return!1;return e&&e(t.tr.join(i).scrollIntoView()),!0},Oye=(t,e)=>{let{$from:n,$to:i}=t.selection,r=n.blockRange(i),a=r&&Qp(r);return a==null?!1:(e&&e(t.tr.lift(r,a).scrollIntoView()),!0)},T9=(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 hP(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 Lye=(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=hP(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(en.near(l.doc.resolve(o),1)),e(l.scrollIntoView())}return!0},C9=(t,e)=>{let n=t.selection,{$from:i,$to:r}=n;if(n instanceof rs||i.parent.inlineContent||r.parent.inlineContent)return!1;let a=hP(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(Bt.create(o.doc,s+1)),e(o.scrollIntoView())}return!0},R9=(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(ql(t.doc,a))return e&&e(t.tr.split(a).scrollIntoView()),!0}let i=n.blockRange(),r=i&&Qp(i);return r==null?!1:(e&&e(t.tr.lift(i,r).scrollIntoView()),!0)};function kye(t){return(e,n)=>{let{$from:i,$to:r}=e.selection;if(e.selection instanceof It&&e.selection.node.isBlock)return!i.parentOffset||!ql(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 m=i.depth;;m--)if(i.node(m).isBlock){l=i.end(m)==i.pos+(i.depth-m),c=i.start(m)==i.pos-(i.depth-m),o=hP(i.node(m-1).contentMatchAt(i.indexAfter(m-1))),a.unshift(l&&o?{type:o}:null),s=m;break}else{if(m==1)return!1;a.unshift(null)}let d=e.tr;(e.selection instanceof Bt||e.selection instanceof rs)&&d.deleteSelection();let f=d.mapping.map(i.pos),p=ql(d.doc,f,a.length,a);if(p||(a[0]=o?{type:o}:null,p=ql(d.doc,f,a.length,a)),!p)return!1;if(d.split(f,a.length,a),!l&&c&&i.node(s).type!=o){let m=d.mapping.map(i.before(s)),y=d.doc.resolve(m);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 Iye=kye(),Uye=(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(It.create(t.doc,r))),!0)};function Fye(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||Bu(t.doc,e.pos))?!1:(n&&n(t.tr.join(e.pos).scrollIntoView()),!0)}function N9(t,e,n,i){let r=e.nodeBefore,a=e.nodeAfter,s,o,l=r.type.spec.isolating||a.type.spec.isolating;if(!l&&Fye(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 m=e.pos+a.nodeSize,y=lt.empty;for(let v=s.length-1;v>=0;v--)y=lt.from(s[v].create(null,y));y=lt.from(r.copy(y));let b=t.tr.step(new wr(e.pos-1,m,e.pos,m,new wt(y,1,0),s.length,!0)),x=b.doc.resolve(m+2*s.length);x.nodeAfter&&x.nodeAfter.type==r.type&&Bu(b.doc,x.pos)&&b.join(x.pos),n(b.scrollIntoView())}return!0}let d=a.type.spec.isolating||i>0&&l?null:en.findFrom(e,1),f=d&&d.$from.blockRange(d.$to),p=f&&Qp(f);if(p!=null&&p>=e.depth)return n&&n(t.tr.lift(f,p).scrollIntoView()),!0;if(c&&Tp(a,"start",!0)&&Tp(r,"end")){let m=r,y=[];for(;y.push(m),!m.isTextblock;)m=m.lastChild;let b=a,x=1;for(;!b.isTextblock;b=b.firstChild)x++;if(m.canReplace(m.childCount,m.childCount,b.content)){if(n){let v=lt.empty;for(let w=y.length-1;w>=0;w--)v=lt.from(y[w].copy(v));let M=t.tr.step(new wr(e.pos-y.length,e.pos+a.nodeSize,e.pos+x,e.pos+a.nodeSize-x,new wt(v,y.length,0),0,!0));n(M.scrollIntoView())}return!0}}return!1}function P9(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(Bt.create(e.doc,t<0?r.start(a):r.end(a)))),!0):!1}}const zye=P9(-1),Bye=P9(1);function jye(t,e=null){return function(n,i){let{$from:r,$to:a}=n.selection,s=r.blockRange(a),o=s&&lP(s,t,e);return o?(i&&i(n.tr.wrap(s,o).scrollIntoView()),!0):!1}}function BB(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 pP(...t){return function(e,n,i){for(let r=0;r<t.length;r++)if(t[r](e,n,i))return!0;return!1}}pP(uP,_9,w9);pP(uP,E9,A9);pP(T9,C9,R9,Iye);typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function Hye(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 Vye(o,s,t,e)?(i&&i(o.scrollIntoView()),!0):!1}}function Vye(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 y_(l,l,e.depth),e.endIndex<e.parent.childCount&&(e=new y_(e.$from,s.resolve(e.$to.end(e.depth)),e.depth)),r=!0}let o=lP(a,n,i,e);return o?(t&&Gye(t,e,o,r,n),!0):!1}function Gye(t,e,n,i,r){let a=lt.empty;for(let d=n.length-1;d>=0;d--)a=lt.from(n[d].type.create(n[d].attrs,a));t.step(new wr(e.start-(i?2:0),e.end,e.start,e.end,new wt(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,p=!0;d<f;d++,p=!1)!p&&ql(t.doc,l,o)&&(t.split(l,o),l+=2*o),l+=c.child(d).nodeSize;return t}function $ye(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?Wye(e,n,t,a):qye(e,n,a):!0:!1}}function Wye(t,e,n,i){let r=t.tr,a=i.end,s=i.$to.end(i.depth);a<s&&(r.step(new wr(a-1,s,a,s,new wt(lt.from(n.create(null,i.parent.copy())),1,0),1,!0)),i=new y_(r.doc.resolve(i.$from.pos),r.doc.resolve(s),i.depth));const o=Qp(i);if(o==null)return!1;r.lift(i,o);let l=r.doc.resolve(r.mapping.map(a,-1)-1);return Bu(r.doc,l.pos)&&l.nodeBefore.type==l.nodeAfter.type&&r.join(l.pos),e(r.scrollIntoView()),!0}function qye(t,e,n){let i=t.tr,r=n.parent;for(let m=n.end,y=n.endIndex-1,b=n.startIndex;y>b;y--)m-=r.child(y).nodeSize,i.delete(m-1,m+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?lt.empty:lt.from(r))))return!1;let f=a.pos,p=f+s.nodeSize;return i.step(new wr(f-(o?1:0),p+(l?1:0),f+1,p-1,new wt((o?lt.empty:lt.from(r.copy(lt.empty))).append(l?lt.empty:lt.from(r.copy(lt.empty))),o?0:1,l?0:1),o?0:1)),e(i.scrollIntoView()),!0}function Xye(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=lt.from(c?t.create():null),f=new wt(lt.from(t.create(null,lt.from(o.type.create(null,d)))),c?3:1,0),p=a.start,m=a.end;n(e.tr.step(new wr(p-(c?3:1),m,p,m,f,1,!0)).scrollIntoView())}return!0}}const Br=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},Cp=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e};let jR=null;const Pl=function(t,e,n){let i=jR||(jR=document.createRange());return i.setEnd(t,n??t.nodeValue.length),i.setStart(t,e||0),i},Yye=function(){jR=null},hf=function(t,e,n,i){return n&&(jB(t,e,n,i,-1)||jB(t,e,n,i,1))},Kye=/^(img|br|input|textarea|hr)$/i;function jB(t,e,n,i,r){for(var a;;){if(t==n&&e==i)return!0;if(e==(r<0?0:Os(t))){let s=t.parentNode;if(!s||s.nodeType!=1||ov(t)||Kye.test(t.nodeName)||t.contentEditable=="false")return!1;e=Br(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?Os(t):0}else return!1}}function Os(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function Zye(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=Os(t)}else if(t.parentNode&&!ov(t))e=Br(t),t=t.parentNode;else return null}}function Jye(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&&!ov(t))e=Br(t)+1,t=t.parentNode;else return null}}function Qye(t,e,n){for(let i=e==0,r=e==Os(t);i||r;){if(t==n)return!0;let a=Br(t);if(t=t.parentNode,!t)return!1;i=i&&a==0,r=r&&a==Os(t)}}function ov(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 _S=function(t){return t.focusNode&&hf(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)};function Nd(t,e){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=t,n.key=n.code=e,n}function ebe(t){let e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function tbe(t,e,n){if(t.caretPositionFromPoint)try{let i=t.caretPositionFromPoint(e,n);if(i)return{node:i.offsetNode,offset:Math.min(Os(i.offsetNode),i.offset)}}catch{}if(t.caretRangeFromPoint){let i=t.caretRangeFromPoint(e,n);if(i)return{node:i.startContainer,offset:Math.min(Os(i.startContainer),i.startOffset)}}}const jo=typeof navigator<"u"?navigator:null,HB=typeof document<"u"?document:null,ju=jo&&jo.userAgent||"",HR=/Edge\/(\d+)/.exec(ju),D9=/MSIE \d/.exec(ju),VR=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(ju),La=!!(D9||VR||HR),Eu=D9?document.documentMode:VR?+VR[1]:HR?+HR[1]:0,Fs=!La&&/gecko\/(\d+)/i.test(ju);Fs&&+(/Firefox\/(\d+)/.exec(ju)||[0,0])[1];const GR=!La&&/Chrome\/(\d+)/.exec(ju),ea=!!GR,O9=GR?+GR[1]:0,pa=!La&&!!jo&&/Apple Computer/.test(jo.vendor),Rp=pa&&(/Mobile\/\w+/.test(ju)||!!jo&&jo.maxTouchPoints>2),Ts=Rp||(jo?/Mac/.test(jo.platform):!1),nbe=jo?/Win/.test(jo.platform):!1,Bl=/Android \d/.test(ju),lv=!!HB&&"webkitFontSmoothing"in HB.documentElement.style,ibe=lv?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function rbe(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 El(t,e){return typeof t=="number"?t:t[e]}function abe(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 VB(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=Cp(s);continue}let o=s,l=o==a.body,c=l?rbe(a):abe(o),d=0,f=0;if(e.top<c.top+El(i,"top")?f=-(c.top-e.top+El(r,"top")):e.bottom>c.bottom-El(i,"bottom")&&(f=e.bottom-e.top>c.bottom-c.top?e.top+El(r,"top")-c.top:e.bottom-c.bottom+El(r,"bottom")),e.left<c.left+El(i,"left")?d=-(c.left-e.left+El(r,"left")):e.right>c.right-El(i,"right")&&(d=e.right-c.right+El(r,"right")),d||f)if(l)a.defaultView.scrollBy(d,f);else{let m=o.scrollLeft,y=o.scrollTop;f&&(o.scrollTop+=f),d&&(o.scrollLeft+=d);let b=o.scrollLeft-m,x=o.scrollTop-y;e={left:e.left-b,top:e.top-x,right:e.right-b,bottom:e.bottom-x}}let p=l?"fixed":getComputedStyle(s).position;if(/^(fixed|sticky)$/.test(p))break;s=p=="absolute"?s.offsetParent:Cp(s)}}function sbe(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:L9(t.dom)}}function L9(t){let e=[],n=t.ownerDocument;for(let i=t;i&&(e.push({dom:i,top:i.scrollTop,left:i.scrollLeft}),t!=n);i=Cp(i));return e}function obe({refDOM:t,refTop:e,stack:n}){let i=t?t.getBoundingClientRect().top:0;k9(n,i==0?0:i-e)}function k9(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 Bh=null;function lbe(t){if(t.setActive)return t.setActive();if(Bh)return t.focus(Bh);let e=L9(t);t.focus(Bh==null?{get preventScroll(){return Bh={preventScroll:!0},!0}}:void 0),Bh||(Bh=!1,k9(e,0))}function I9(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 p;if(d.nodeType==1)p=d.getClientRects();else if(d.nodeType==3)p=Pl(d).getClientRects();else continue;for(let m=0;m<p.length;m++){let y=p[m];if(y.top<=s&&y.bottom>=o){s=Math.max(y.bottom,s),o=Math.min(y.top,o);let b=y.left>e.left?y.left-e.left:y.right<e.left?e.left-y.right:0;if(b<i){n=d,i=b,r=b&&n.nodeType==3?{left:y.right<e.left?y.right:y.left,top:e.top}:e,d.nodeType==1&&b&&(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?cbe(n,r):!n||i&&n.nodeType==1?{node:t,offset:a}:I9(n,r)}function cbe(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=eu(i,1);if(a.top!=a.bottom&&mP(e,a))return{node:t,offset:r+(e.left>=(a.left+a.right)/2?1:0)}}return{node:t,offset:0}}function mP(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function ube(t,e){let n=t.parentNode;return n&&/^li$/i.test(n.nodeName)&&e.left<t.getBoundingClientRect().left?n:t}function dbe(t,e,n){let{node:i,offset:r}=I9(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 fbe(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 U9(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(mP(e,c))return U9(s,e,c)}}if((a=(a+1)%i)==r)break}return t}function hbe(t,e){let n=t.dom.ownerDocument,i,r=0,a=tbe(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(!mP(e,c)||(s=U9(t.dom,e,c),!s))return null}if(pa)for(let c=s;i&&c;c=Cp(c))c.draggable&&(i=void 0);if(s=ube(s,e),i){if(Fs&&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;lv&&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=fbe(t,i,r,e))}o==null&&(o=dbe(t,s,e));let l=t.docView.nearestDesc(s,!0);return{pos:o,inside:l?l.posAtStart-l.border:-1}}function GB(t){return t.top<t.bottom||t.left<t.right}function eu(t,e){let n=t.getClientRects();if(n.length){let i=n[e<0?0:n.length-1];if(GB(i))return i}return Array.prototype.find.call(n,GB)||t.getBoundingClientRect()}const pbe=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function F9(t,e,n){let{node:i,offset:r,atom:a}=t.docView.domFromPos(e,n<0?-1:1),s=lv||Fs;if(i.nodeType==3)if(s&&(pbe.test(i.nodeValue)||(n<0?!r:r==i.nodeValue.length))){let l=eu(Pl(i,r,r),n);if(Fs&&r&&/\s/.test(i.nodeValue[r-1])&&r<i.nodeValue.length){let c=eu(Pl(i,r-1,r-1),-1);if(c.top==l.top){let d=eu(Pl(i,r,r+1),-1);if(d.top!=l.top)return yg(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++,yg(eu(Pl(i,l,c),d),d<0)}if(!t.state.doc.resolve(e-(a||0)).parent.inlineContent){if(a==null&&r&&(n<0||r==Os(i))){let l=i.childNodes[r-1];if(l.nodeType==1)return hT(l.getBoundingClientRect(),!1)}if(a==null&&r<Os(i)){let l=i.childNodes[r];if(l.nodeType==1)return hT(l.getBoundingClientRect(),!0)}return hT(i.getBoundingClientRect(),n>=0)}if(a==null&&r&&(n<0||r==Os(i))){let l=i.childNodes[r-1],c=l.nodeType==3?Pl(l,Os(l)-(s?0:1)):l.nodeType==1&&(l.nodeName!="BR"||!l.nextSibling)?l:null;if(c)return yg(eu(c,1),!1)}if(a==null&&r<Os(i)){let l=i.childNodes[r];for(;l.pmViewDesc&&l.pmViewDesc.ignoreForCoords;)l=l.nextSibling;let c=l?l.nodeType==3?Pl(l,0,s?0:1):l.nodeType==1?l:null:null;if(c)return yg(eu(c,-1),!0)}return yg(eu(i.nodeType==3?Pl(i):i,-n),n>=0)}function yg(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 hT(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 z9(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 mbe(t,e,n){let i=e.selection,r=n=="up"?i.$from:i.$to;return z9(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=F9(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=Pl(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 gbe=/[\u0590-\u08ac]/;function vbe(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?!gbe.test(i.parent.textContent)||!o.modify?n=="left"||n=="backward"?a:s:z9(t,e,()=>{let{focusNode:l,focusOffset:c,anchorNode:d,anchorOffset:f}=t.domSelectionRange(),p=o.caretBidiLevel;o.modify("move",n,"character");let m=i.depth?t.docView.domAfterPos(i.before()):t.dom,{focusNode:y,focusOffset:b}=t.domSelectionRange(),x=y&&!m.contains(y.nodeType==1?y:y.parentNode)||l==y&&c==b;try{o.collapse(d,f),l&&(l!=d||c!=f)&&o.extend&&o.extend(l,c)}catch{}return p!=null&&(o.caretBidiLevel=p),x}):i.pos==i.start()||i.pos==i.end()}let $B=null,WB=null,qB=!1;function xbe(t,e,n){return $B==e&&WB==n?qB:($B=e,WB=n,qB=n=="up"||n=="down"?mbe(t,e,n):vbe(t,e,n))}const zs=0,XB=1,Od=2,Ho=3;class cv{constructor(e,n,i,r){this.parent=e,this.children=n,this.dom=i,this.contentDOM=r,this.dirty=zs,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>Br(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 j9){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 B9&&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?Br(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?Br(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 p=this.children[f-1];if(p.size&&p.dom.parentNode==this.contentDOM&&!p.emptyChildAt(1)){r=Br(p.dom)+1;break}e-=p.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=Br(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 m=0,y=0;m<this.children.length;m++){let b=this.children[m],x=y+b.size;if(a>y&&s<x)return b.setSelection(e-y-b.border,n-y-b.border,i,r);y=x}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((Fs||pa)&&e==n){let{node:m,offset:y}=o;if(m.nodeType==3){if(f=!!(y&&m.nodeValue[y-1]==`
  8065. `),f&&y==m.nodeValue.length)for(let b=m,x;b;b=b.parentNode){if(x=b.nextSibling){x.nodeName=="BR"&&(o=l={node:x.parentNode,offset:Br(x)+1});break}let v=b.pmViewDesc;if(v&&v.node&&v.node.isBlock)break}}else{let b=m.childNodes[y-1];f=b&&(b.nodeName=="BR"||b.contentEditable=="false")}}if(Fs&&d.focusNode&&d.focusNode!=l.node&&d.focusNode.nodeType==1){let m=d.focusNode.childNodes[d.focusOffset];m&&m.contentEditable=="false"&&(r=!0)}if(!(r||f&&pa)&&hf(o.node,o.offset,d.anchorNode,d.anchorOffset)&&hf(l.node,l.offset,d.focusNode,d.focusOffset))return;let p=!1;if((c.extend||e==n)&&!(f&&Fs)){c.collapse(o.node,o.offset);try{e!=n&&c.extend(l.node,l.offset),p=!0}catch{}}if(!p){if(e>n){let y=o;o=l,l=y}let m=document.createRange();m.setEnd(l.node,l.offset),m.setStart(o.node,o.offset),c.removeAllRanges(),c.addRange(m)}}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?Od:XB,e==o&&n==l&&(a.contentLost||a.dom.parentNode!=this.contentDOM)?a.dirty=Ho:a.markDirty(e-o,n-o);return}else a.dirty=a.dom==a.contentDOM&&a.dom.parentNode==this.contentDOM&&!a.children.length?Od:Ho}i=s}this.dirty=Od}markParentsDirty(){let e=1;for(let n=this.parent;n;n=n.parent,e++){let i=e==1?Od:XB;n.dirty<i&&(n.dirty=i)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class B9 extends cv{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==zs&&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 ybe extends cv{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 cv{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=Tf.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&Ho||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=Ho&&this.mark.eq(e)}markDirty(e,n){if(super.markDirty(e,n),this.dirty!=zs){let i=this.parent;for(;!i.node;)i=i.parent;i.dirty<this.dirty&&(i.dirty=this.dirty),this.dirty=zs}}slice(e,n,i){let r=pf.create(this.parent,this.mark,!0,i),a=this.children,s=this.size;n<s&&(a=WR(a,n,s,i)),e>0&&(a=WR(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 Au extends cv{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}=Tf.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 p=d;return d=G9(d,i,n),c?l=new bbe(e,n,i,r,d,f||null,p,c,a,s+1):n.isText?new SS(e,n,i,r,d,p,a):new Au(e,n,i,r,d,f||null,p,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=()=>lt.empty)}return e}matchesNode(e,n,i){return this.dirty==zs&&e.eq(this.node)&&__(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 Sbe(this,s&&s.node,e);Ebe(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?jn.none:this.node.child(d).marks,i,e),l.placeWidget(c,e,r)},(c,d,f,p)=>{l.syncToMarks(c.marks,i,e);let m;l.findNodeMatch(c,d,f,p)||o&&e.state.selection.from>r&&e.state.selection.to<r+c.nodeSize&&(m=l.findIndexWithChild(a.node))>-1&&l.updateNodeAt(c,d,f,m,e)||l.updateNextNode(c,d,f,e,p,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==Od)&&(s&&this.protectLocalComposition(e,s),H9(this.contentDOM,this.children,e),Rp&&Abe(this.dom))}localCompositionInfo(e,n){let{from:i,to:r}=e.state.selection;if(!(e.state.selection instanceof Bt)||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=Tbe(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 ybe(this,a,n,r);e.input.compositionNodes.push(s),this.children=WR(this.children,i,i+r.length,e,s)}update(e,n,i,r){return this.dirty==Ho||!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=zs}updateOuterDeco(e){if(__(e,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,i=this.dom;this.dom=V9(this.dom,this.nodeDOM,$R(this.outerDeco,this.node,n),$R(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){G9(i,e,t);let a=new Au(void 0,t,e,n,i,i,i,r,0);return a.contentDOM&&a.updateChildren(r,0),a}class SS extends Au{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==Ho||this.dirty!=zs&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=zs||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=zs,!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 SS(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=Ho)}get domAtom(){return!1}isText(e){return this.node.text==e}}class j9 extends cv{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==zs&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class bbe extends Au{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==Ho)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 H9(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=KB(i),r=!0;i=i.nextSibling}else r=!0,t.insertBefore(o,i);if(s instanceof pf){let l=i?i.previousSibling:t.lastChild;H9(s.contentDOM,s.children,n),i=l?l.nextSibling:t.firstChild}}for(;i;)i=KB(i),r=!0;r&&n.trackWrites==t&&(n.trackWrites=null)}const Yg=function(t){t&&(this.nodeName=t)};Yg.prototype=Object.create(null);const Ld=[new Yg];function $R(t,e,n){if(t.length==0)return Ld;let i=n?Ld[0]:new Yg,r=[i];for(let a=0;a<t.length;a++){let s=t[a].type.attrs;if(s){s.nodeName&&r.push(i=new Yg(s.nodeName));for(let o in s){let l=s[o];l!=null&&(n&&r.length==1&&r.push(i=new Yg(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 V9(t,e,n,i){if(n==Ld&&i==Ld)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=Ld[0]),r=l}_be(r,o||Ld[0],s)}return r}function _be(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 G9(t,e,n){return V9(t,t,Ld,$R(e,n,t.nodeType!=1))}function __(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 KB(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}class Sbe{constructor(e,n,i){this.lock=n,this.view=i,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=wbe(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=zs,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==Ho&&s.dom==s.contentDOM&&(s.dirty=Od),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 Au){let c=this.preMatch.matched.get(l);if(c!=null&&c!=a)return!1;let d=l.dom,f,p=this.isLocked(d)&&!(e.isText&&l.node&&l.node.isText&&l.nodeDOM.nodeValue==e.text&&l.dirty!=Ho&&__(n,l.outerDeco));if(!p&&l.update(e,n,i,r))return this.destroyBetween(this.index,o),l.dom!=d&&(this.changed=!0),this.index++,!0;if(!p&&(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=Od,f.updateChildren(r,s+1),f.dirty=zs),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)||!__(i,e.outerDeco)||!r.eq(e.innerDeco))return null;let o=Au.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=Au.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 B9(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 SS)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((pa||ea)&&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 j9(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 wbe(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 Mbe(t,e){return t.type.side-e.type.side}function Ebe(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 x=r[s++];x.widget&&(d?(f||(f=[d])).push(x):d=x)}if(d)if(f){f.sort(Mbe);for(let x=0;x<f.length;x++)n(f[x],c,!!l)}else n(d,c,!!l);let p,m;if(l)m=-1,p=l,l=null;else if(c<t.childCount)m=c,p=t.child(c++);else break;for(let x=0;x<o.length;x++)o[x].to<=a&&o.splice(x--,1);for(;s<r.length&&r[s].from<=a&&r[s].to>a;)o.push(r[s++]);let y=a+p.nodeSize;if(p.isText){let x=y;s<r.length&&r[s].from<x&&(x=r[s].from);for(let v=0;v<o.length;v++)o[v].to<x&&(x=o[v].to);x<y&&(l=p.cut(x-a),p=p.cut(0,x-a),y=x,m=-1)}else for(;s<r.length&&r[s].to<y;)s++;let b=p.isInline&&!p.isLeaf?o.filter(x=>!x.inline):o.slice();i(p,b,e.forChild(a,p),m),a=y}}function Abe(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 Tbe(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 WR(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 gP(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(_S(n)){for(l=s;r&&!r.node;)r=r.parent;let f=r.node;if(r&&f.isAtom&&It.isSelectable(f)&&r.parent&&!(f.isInline&&Qye(n.focusNode,n.focusOffset,r.dom))){let p=r.posBefore;c=new It(s==p?o:i.resolve(p))}}else{if(n instanceof t.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let f=s,p=s;for(let m=0;m<n.rangeCount;m++){let y=n.getRangeAt(m);f=Math.min(f,t.docView.posFromDOM(y.startContainer,y.startOffset,1)),p=Math.max(p,t.docView.posFromDOM(y.endContainer,y.endOffset,-1))}if(f<0)return null;[l,s]=p==t.state.selection.anchor?[p,f]:[f,p],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=vP(t,d,o,f)}return c}function $9(t){return t.editable?t.hasFocus():q9(t)&&document.activeElement&&document.activeElement.contains(t.dom)}function Xl(t,e=!1){let n=t.state.selection;if(W9(t,n),!!$9(t)){if(!e&&t.input.mouseDown&&t.input.mouseDown.allowDefault&&ea){let i=t.domSelectionRange(),r=t.domObserver.currentSelection;if(i.anchorNode&&r.anchorNode&&hf(i.anchorNode,i.anchorOffset,r.anchorNode,r.anchorOffset)){t.input.mouseDown.delayedSelectionSync=!0,t.domObserver.setCurSelection();return}}if(t.domObserver.disconnectSelection(),t.cursorWrapper)Rbe(t);else{let{anchor:i,head:r}=n,a,s;ZB&&!(n instanceof Bt)&&(n.$from.parent.inlineContent||(a=JB(t,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(s=JB(t,n.to))),t.docView.setSelection(i,r,t,e),ZB&&(a&&QB(a),s&&QB(s)),n.visible?t.dom.classList.remove("ProseMirror-hideselection"):(t.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&Cbe(t))}t.domObserver.setCurSelection(),t.domObserver.connectSelection()}}const ZB=pa||ea&&O9<63;function JB(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(pa&&r&&r.contentEditable=="false")return pT(r);if((!r||r.contentEditable=="false")&&(!a||a.contentEditable=="false")){if(r)return pT(r);if(a)return pT(a)}}function pT(t){return t.contentEditable="true",pa&&t.draggable&&(t.draggable=!1,t.wasDraggable=!0),t}function QB(t){t.contentEditable="false",t.wasDraggable&&(t.draggable=!0,t.wasDraggable=null)}function Cbe(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(()=>{(!$9(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function Rbe(t){let e=t.domSelection();if(!e)return;let n=t.cursorWrapper.dom,i=n.nodeName=="IMG";i?e.collapse(n.parentNode,Br(n)+1):e.collapse(n,0),!i&&!t.state.selection.visible&&La&&Eu<=11&&(n.disabled=!0,n.disabled=!1)}function W9(t,e){if(e instanceof It){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(e5(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else e5(t)}function e5(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function vP(t,e,n,i){return t.someProp("createSelectionBetween",r=>r(t,e,n))||Bt.between(e,n,i)}function t5(t){return t.editable&&!t.hasFocus()?!1:q9(t)}function q9(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 Nbe(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),n=t.domSelectionRange();return hf(e.node,e.offset,n.anchorNode,n.anchorOffset)}function qR(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&&en.findFrom(a,e)}function iu(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function n5(t,e,n){let i=t.state.selection;if(i instanceof Bt)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 iu(t,new Bt(i.$anchor,s))}else if(i.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let r=qR(t.state,e);return r&&r instanceof It?iu(t,r):!1}else if(!(Ts&&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?It.isSelectable(a)?iu(t,new It(e<0?t.state.doc.resolve(r.pos-a.nodeSize):r)):lv?iu(t,new Bt(t.state.doc.resolve(e<0?o:o+a.nodeSize))):!1:!1}}else return!1;else{if(i instanceof It&&i.node.isInline)return iu(t,new Bt(e>0?i.$to:i.$from));{let r=qR(t.state,e);return r?iu(t,r):!1}}}function S_(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function Kg(t,e){let n=t.pmViewDesc;return n&&n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function jh(t,e){return e<0?Pbe(t):Dbe(t)}function Pbe(t){let e=t.domSelectionRange(),n=e.focusNode,i=e.focusOffset;if(!n)return;let r,a,s=!1;for(Fs&&n.nodeType==1&&i<S_(n)&&Kg(n.childNodes[i],-1)&&(s=!0);;)if(i>0){if(n.nodeType!=1)break;{let o=n.childNodes[i-1];if(Kg(o,-1))r=n,a=--i;else if(o.nodeType==3)n=o,i=n.nodeValue.length;else break}}else{if(X9(n))break;{let o=n.previousSibling;for(;o&&Kg(o,-1);)r=n.parentNode,a=Br(o),o=o.previousSibling;if(o)n=o,i=S_(n);else{if(n=n.parentNode,n==t.dom)break;i=0}}}s?XR(t,n,i):r&&XR(t,r,a)}function Dbe(t){let e=t.domSelectionRange(),n=e.focusNode,i=e.focusOffset;if(!n)return;let r=S_(n),a,s;for(;;)if(i<r){if(n.nodeType!=1)break;let o=n.childNodes[i];if(Kg(o,1))a=n,s=++i;else break}else{if(X9(n))break;{let o=n.nextSibling;for(;o&&Kg(o,1);)a=o.parentNode,s=Br(o)+1,o=o.nextSibling;if(o)n=o,i=0,r=S_(n);else{if(n=n.parentNode,n==t.dom)break;i=r=0}}}a&&XR(t,a,s)}function X9(t){let e=t.pmViewDesc;return e&&e.node&&e.node.isBlock}function Obe(t,e){for(;t&&e==t.childNodes.length&&!ov(t);)e=Br(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 Lbe(t,e){for(;t&&!e&&!ov(t);)e=Br(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 XR(t,e,n){if(e.nodeType!=3){let a,s;(s=Obe(e,n))?(e=s,n=0):(a=Lbe(e,n))&&(e=a,n=a.nodeValue.length)}let i=t.domSelection();if(!i)return;if(_S(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&&Xl(t)},50)}function i5(t,e){let n=t.state.doc.resolve(e);if(!(ea||nbe)&&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 r5(t,e,n){let i=t.state.selection;if(i instanceof Bt&&!i.empty||n.indexOf("s")>-1||Ts&&n.indexOf("m")>-1)return!1;let{$from:r,$to:a}=i;if(!r.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let s=qR(t.state,e);if(s&&s instanceof It)return iu(t,s)}if(!r.parent.inlineContent){let s=e<0?r:a,o=i instanceof rs?en.near(s,e):en.findFrom(s,e);return o?iu(t,o):!1}return!1}function a5(t,e){if(!(t.state.selection instanceof Bt))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 s5(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function kbe(t){if(!pa||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;s5(t,i,"true"),setTimeout(()=>s5(t,i,"false"),20)}return!1}function Ibe(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function Ube(t,e){let n=e.keyCode,i=Ibe(e);if(n==8||Ts&&n==72&&i=="c")return a5(t,-1)||jh(t,-1);if(n==46&&!e.shiftKey||Ts&&n==68&&i=="c")return a5(t,1)||jh(t,1);if(n==13||n==27)return!0;if(n==37||Ts&&n==66&&i=="c"){let r=n==37?i5(t,t.state.selection.from)=="ltr"?-1:1:-1;return n5(t,r,i)||jh(t,r)}else if(n==39||Ts&&n==70&&i=="c"){let r=n==39?i5(t,t.state.selection.from)=="ltr"?1:-1:1;return n5(t,r,i)||jh(t,r)}else{if(n==38||Ts&&n==80&&i=="c")return r5(t,-1,i)||jh(t,-1);if(n==40||Ts&&n==78&&i=="c")return kbe(t)||r5(t,1,i)||jh(t,1);if(i==(Ts?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function xP(t,e){t.someProp("transformCopied",m=>{e=m(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 m=i.firstChild;n.push(m.type.name,m.attrs!=m.type.defaultAttrs?m.attrs:null),i=m.content}let s=t.someProp("clipboardSerializer")||Tf.fromSchema(t.state.schema),o=eW(),l=o.createElement("div");l.appendChild(s.serializeFragment(i,{document:o}));let c=l.firstChild,d,f=0;for(;c&&c.nodeType==1&&(d=Q9[c.nodeName.toLowerCase()]);){for(let m=d.length-1;m>=0;m--){let y=o.createElement(d[m]);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 p=t.someProp("clipboardTextSerializer",m=>m(e,t))||e.content.textBetween(0,e.content.size,`
  8066. `);return{dom:l,text:p,slice:e}}function Y9(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",p=>{e=p(e,a||i,t)}),a)return o=new wt(lt.from(t.state.schema.text(e.replace(/\r\n?/g,`
  8067. `))),0,0),t.someProp("transformPasted",p=>{o=p(o,t,!0)}),o;let f=t.someProp("clipboardTextParser",p=>p(e,r,i,t));if(f)o=f;else{let p=r.marks(),{schema:m}=t.state,y=Tf.fromSchema(m);s=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(b=>{let x=s.appendChild(document.createElement("p"));b&&x.appendChild(y.serializeNode(m.text(b,p)))})}}else t.someProp("transformPastedHTML",f=>{n=f(n,t)}),s=jbe(n),lv&&Hbe(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 p=s.firstChild;for(;p&&p.nodeType!=1;)p=p.nextSibling;if(!p)break;s=p}if(o||(o=(t.someProp("clipboardParser")||t.someProp("domParser")||qg.fromSchema(t.state.schema)).parseSlice(s,{preserveWhitespace:!!(l||d),context:r,ruleFromNode(p){return p.nodeName=="BR"&&!p.nextSibling&&p.parentNode&&!Fbe.test(p.parentNode.nodeName)?{ignore:!0}:null}})),d)o=Vbe(o5(o,+d[1],+d[2]),d[4]);else if(o=wt.maxOpen(zbe(o.content,r),!0),o.openStart||o.openEnd){let f=0,p=0;for(let m=o.content.firstChild;f<o.openStart&&!m.type.spec.isolating;f++,m=m.firstChild);for(let m=o.content.lastChild;p<o.openEnd&&!m.type.spec.isolating;p++,m=m.lastChild);o=o5(o,f,p)}return t.someProp("transformPasted",f=>{o=f(o,t,l)}),o}const Fbe=/^(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 zbe(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&&Z9(l,a,o,s[s.length-1],0))s[s.length-1]=c;else{s.length&&(s[s.length-1]=J9(s[s.length-1],a.length));let d=K9(o,l);s.push(d),r=r.matchType(d.type),a=l}}),s)return lt.from(s)}return t}function K9(t,e,n=0){for(let i=e.length-1;i>=n;i--)t=e[i].create(null,lt.from(t));return t}function Z9(t,e,n,i,r){if(r<t.length&&r<e.length&&t[r]==e[r]){let a=Z9(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(lt.from(K9(n,t,r+1))))}}function J9(t,e){if(e==0)return t;let n=t.content.replaceChild(t.childCount-1,J9(t.lastChild,e-1)),i=t.contentMatchAt(t.childCount).fillBefore(lt.empty,!0);return t.copy(n.append(i))}function YR(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=YR(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(lt.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,s.copy(o))}function o5(t,e,n){return e<t.openStart&&(t=new wt(YR(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd)),n<t.openEnd&&(t=new wt(YR(t.content,1,n,t.openEnd,0,0),t.openStart,n)),t}const Q9={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 l5=null;function eW(){return l5||(l5=document.implementation.createHTMLDocument("title"))}let mT=null;function Bbe(t){let e=window.trustedTypes;return e?(mT||(mT=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:n=>n})),mT.createHTML(t)):t}function jbe(t){let e=/^(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=eW().createElement("div"),i=/<([a-z][^>\s]+)/i.exec(t),r;if((r=i&&Q9[i[1].toLowerCase()])&&(t=r.map(a=>"<"+a+">").join("")+t+r.map(a=>"</"+a+">").reverse().join("")),n.innerHTML=Bbe(t),r)for(let a=0;a<r.length;a++)n=n.querySelector(r[a])||n;return n}function Hbe(t){let e=t.querySelectorAll(ea?"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 Vbe(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=lt.from(l.create(i[o+1],r)),a++,s++}return new wt(r,a,s)}const ma={},ga={},Gbe={touchstart:!0,touchmove:!0};class $be{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 Wbe(t){for(let e in ma){let n=ma[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=i=>{Xbe(t,i)&&!yP(t,i)&&(t.editable||!(i.type in ga))&&n(t,i)},Gbe[e]?{passive:!0}:void 0)}pa&&t.dom.addEventListener("input",()=>null),KR(t)}function xu(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function qbe(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 KR(t){t.someProp("handleDOMEvents",e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=i=>yP(t,i))})}function yP(t,e){return t.someProp("handleDOMEvents",n=>{let i=n[e.type];return i?i(t,e)||e.defaultPrevented:!1})}function Xbe(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 Ybe(t,e){!yP(t,e)&&ma[e.type]&&(t.editable||!(e.type in ga))&&ma[e.type](t,e)}ga.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!nW(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(Bl&&ea&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),Rp&&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,Nd(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",i=>i(t,n))||Ube(t,n)?n.preventDefault():xu(t,"key")};ga.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)};ga.keypress=(t,e)=>{let n=e;if(nW(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||Ts&&n.metaKey)return;if(t.someProp("handleKeyPress",r=>r(t,n))){n.preventDefault();return}let i=t.state.selection;if(!(i instanceof Bt)||!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 wS(t){return{left:t.clientX,top:t.clientY}}function Kbe(t,e){let n=e.x-t.clientX,i=e.y-t.clientY;return n*n+i*i<100}function bP(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 dp(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 Zbe(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),i=n.nodeAfter;return i&&i.isAtom&&It.isSelectable(i)?(dp(t,new It(n)),!0):!1}function Jbe(t,e){if(e==-1)return!1;let n=t.state.selection,i,r;n instanceof It&&(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(It.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?(dp(t,It.create(t.state.doc,r)),!0):!1}function Qbe(t,e,n,i,r){return bP(t,"handleClickOn",e,n,i)||t.someProp("handleClick",a=>a(t,e,i))||(r?Jbe(t,n):Zbe(t,n))}function e_e(t,e,n,i){return bP(t,"handleDoubleClickOn",e,n,i)||t.someProp("handleDoubleClick",r=>r(t,e,i))}function t_e(t,e,n,i){return bP(t,"handleTripleClickOn",e,n,i)||t.someProp("handleTripleClick",r=>r(t,e,i))||n_e(t,n,i)}function n_e(t,e,n){if(n.button!=0)return!1;let i=t.state.doc;if(e==-1)return i.inlineContent?(dp(t,Bt.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)dp(t,Bt.create(i,o+1,o+1+s.content.size));else if(It.isSelectable(s))dp(t,It.create(i,o));else continue;return!0}}function _P(t){return w_(t)}const tW=Ts?"metaKey":"ctrlKey";ma.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let i=_P(t),r=Date.now(),a="singleClick";r-t.input.lastClick.time<500&&Kbe(n,t.input.lastClick)&&!n[tW]&&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(wS(n));s&&(a=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new i_e(t,s,n,!!i)):(a=="doubleClick"?e_e:t_e)(t,s.pos,s.inside,n)?n.preventDefault():xu(t,"pointer"))};class i_e{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[tW],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 It&&c.from<=s&&c.to>s)&&(this.mightDrag={node:a,pos:s,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&Fs&&!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)),xu(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(()=>Xl(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(wS(e))),this.updateAllowDefault(e),this.allowDefault||!n?xu(this.view,"pointer"):Qbe(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||pa&&this.mightDrag&&!this.mightDrag.node.isAtom||ea&&!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)?(dp(this.view,en.near(this.view.state.doc.resolve(n.pos))),e.preventDefault()):xu(this.view,"pointer")}move(e){this.updateAllowDefault(e),xu(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)}}ma.touchstart=t=>{t.input.lastTouch=Date.now(),_P(t),xu(t,"pointer")};ma.touchmove=t=>{t.input.lastTouch=Date.now(),xu(t,"pointer")};ma.contextmenu=t=>_P(t);function nW(t,e){return t.composing?!0:pa&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const r_e=Bl?5e3:-1;ga.compositionstart=ga.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof Bt&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(i=>i.type.spec.inclusive===!1)))t.markCursor=t.state.storedMarks||n.marks(),w_(t,!0),t.markCursor=null;else if(w_(t,!e.selection.empty),Fs&&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}iW(t,r_e)};ga.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++,iW(t,20))};function iW(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>w_(t),e))}function rW(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=s_e());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function a_e(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let n=Zye(e.focusNode,e.focusOffset),i=Jye(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 s_e(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function w_(t,e=!1){if(!(Bl&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),rW(t),e||t.docView&&t.docView.dirty){let n=gP(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 o_e(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 C0=La&&Eu<15||Rp&&ibe<604;ma.copy=ga.cut=(t,e)=>{let n=e,i=t.state.selection,r=n.type=="cut";if(i.empty)return;let a=C0?null:n.clipboardData,s=i.content(),{dom:o,text:l}=xP(t,s);a?(n.preventDefault(),a.clearData(),a.setData("text/html",o.innerHTML),a.setData("text/plain",l)):o_e(t,o),r&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function l_e(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function c_e(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?R0(t,i.value,null,r,e):R0(t,i.textContent,i.innerHTML,r,e)},50)}function R0(t,e,n,i,r){let a=Y9(t,e,n,i,t.state.selection.$from);if(t.someProp("handlePaste",l=>l(t,r,a||wt.empty)))return!0;if(!a)return!1;let s=l_e(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 aW(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," "):""}ga.paste=(t,e)=>{let n=e;if(t.composing&&!Bl)return;let i=C0?null:n.clipboardData,r=t.input.shiftKey&&t.input.lastKeyCode!=45;i&&R0(t,aW(i),i.getData("text/html"),r,n)?n.preventDefault():c_e(t,n)};class sW{constructor(e,n,i){this.slice=e,this.move=n,this.node=i}}const u_e=Ts?"altKey":"ctrlKey";function oW(t,e){let n=t.someProp("dragCopies",i=>!i(e));return n??!e[u_e]}ma.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(wS(n)),s;if(!(a&&a.pos>=r.from&&a.pos<=(r instanceof It?r.to-1:r.to))){if(i&&i.mightDrag)s=It.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=It.create(t.state.doc,f.posBefore))}}let o=(s||t.state.selection).content(),{dom:l,text:c,slice:d}=xP(t,o);(!n.dataTransfer.files.length||!ea||O9>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(C0?"Text":"text/html",l.innerHTML),n.dataTransfer.effectAllowed="copyMove",C0||n.dataTransfer.setData("text/plain",c),t.dragging=new sW(d,oW(t,n),s)};ma.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)};ga.dragover=ga.dragenter=(t,e)=>e.preventDefault();ga.drop=(t,e)=>{let n=e,i=t.dragging;if(t.dragging=null,!n.dataTransfer)return;let r=t.posAtCoords(wS(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=Y9(t,aW(n.dataTransfer),C0?null:n.dataTransfer.getData("text/html"),!1,a);let o=!!(i&&oW(t,n));if(t.someProp("handleDrop",y=>y(t,n,s||wt.empty,o))){n.preventDefault();return}if(!s)return;n.preventDefault();let l=s?f9(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,p=c.doc;if(f?c.replaceRangeWith(d,d,s.content.firstChild):c.replaceRange(d,d,s),c.doc.eq(p))return;let m=c.doc.resolve(d);if(f&&It.isSelectable(s.content.firstChild)&&m.nodeAfter&&m.nodeAfter.sameMarkup(s.content.firstChild))c.setSelection(new It(m));else{let y=c.mapping.map(l);c.mapping.maps[c.mapping.maps.length-1].forEach((b,x,v,M)=>y=M),c.setSelection(vP(t,m,c.doc.resolve(y)))}t.focus(),t.dispatch(c.setMeta("uiEvent","drop"))};ma.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())&&Xl(t)},20))};ma.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)};ma.beforeinput=(t,e)=>{if(ea&&Bl&&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,Nd(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 ga)ma[t]=ga[t];function N0(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 M_{constructor(e,n){this.toDOM=e,this.spec=n||$d,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 da(a-i,a-i,this)}valid(){return!0}eq(e){return this==e||e instanceof M_&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&N0(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class Tu{constructor(e,n){this.attrs=e,this.spec=n||$d}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 da(a,s,this)}valid(e,n){return n.from<n.to}eq(e){return this==e||e instanceof Tu&&N0(this.attrs,e.attrs)&&N0(this.spec,e.spec)}static is(e){return e.type instanceof Tu}destroy(){}}class SP{constructor(e,n){this.attrs=e,this.spec=n||$d}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 da(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 SP&&N0(this.attrs,e.attrs)&&N0(this.spec,e.spec)}destroy(){}}class da{constructor(e,n,i){this.from=e,this.to=n,this.type=i}copy(e,n){return new da(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 da(e,e,new M_(n,i))}static inline(e,n,i,r){return new da(e,n,new Tu(i,r))}static node(e,n,i,r){return new da(e,n,new SP(i,r))}get spec(){return this.type.spec}get inline(){return this.type instanceof Tu}get widget(){return this.type instanceof M_}}const qh=[],$d={};class oi{constructor(e,n){this.local=e.length?e:qh,this.children=n.length?n:qh}static create(e,n){return n.length?E_(n,e,0,$d):Zr}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==Zr||e.maps.length==0?this:this.mapInner(e,n,0,0,i||$d)}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?d_e(this.children,s||[],e,n,i,r,a):s?new oi(s.sort(Wd),qh):Zr}add(e,n){return n.length?this==Zr?oi.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=cW(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,E_(d,o,c+1,$d)),a+=3}});let s=lW(a?uW(n):n,-i);for(let o=0;o<s.length;o++)s[o].type.valid(e,s[o])||s.splice(o--,1);return new oi(s.length?this.local.concat(s).sort(Wd):this.local,r||this.children)}remove(e){return e.length==0||this==Zr?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!=Zr?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 oi(r,i):Zr}forChild(e,n){if(this==Zr)return this;if(n.isLeaf)return oi.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 Tu){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 oi(r.sort(Wd),qh);return i?new uu([o,i]):o}return i||Zr}eq(e){if(this==e)return!0;if(!(e instanceof oi)||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 wP(this.localsInner(e))}localsInner(e){if(this==Zr)return qh;if(e.inlineContent||!this.local.some(Tu.is))return this.local;let n=[];for(let i=0;i<this.local.length;i++)this.local[i].type instanceof Tu||n.push(this.local[i]);return n}forEachSet(e){e(this)}}oi.empty=new oi([],[]);oi.removeOverlap=wP;const Zr=oi.empty;class uu{constructor(e){this.members=e}map(e,n){const i=this.members.map(r=>r.map(e,n,$d));return uu.from(i)}forChild(e,n){if(n.isLeaf)return oi.empty;let i=[];for(let r=0;r<this.members.length;r++){let a=this.members[r].forChild(e,n);a!=Zr&&(a instanceof uu?i=i.concat(a.members):i.push(a))}return uu.from(i)}eq(e){if(!(e instanceof uu)||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?wP(i?n:n.sort(Wd)):qh}static from(e){switch(e.length){case 0:return Zr;case 1:return e[0];default:return new uu(e.every(n=>n instanceof oi)?e:e.reduce((n,i)=>n.concat(i instanceof oi?i:i.members),[]))}}forEachSet(e){for(let n=0;n<this.members.length;n++)this.members[n].forEachSet(e)}}function d_e(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((p,m,y,b)=>{let x=b-y-(m-p);for(let v=0;v<o.length;v+=3){let M=o[v+1];if(M<0||p>M+d-f)continue;let w=o[v]+d-f;m>=w?o[v+1]=p<=w?-2:-1:p>=d&&x&&(o[v]+=x,o[v+1]+=x)}f+=x}),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 p=n.map(t[c+1]+a,-1),m=p-r,{index:y,offset:b}=i.content.findIndex(f),x=i.maybeChild(y);if(x&&b==f&&b+x.nodeSize==m){let v=o[c+2].mapInner(n,x,d+1,t[c]+a+1,s);v!=Zr?(o[c]=f,o[c+1]=m,o[c+2]=v):(o[c+1]=-2,l=!0)}else l=!0}if(l){let c=f_e(o,t,e,n,r,a,s),d=E_(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,p=0;f<d.children.length;f+=3){let m=d.children[f];for(;p<o.length&&o[p]<m;)p+=3;o.splice(p,0,d.children[f],d.children[f+1],d.children[f+2])}}return new oi(e.sort(Wd),o)}function lW(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 da(r.from+e,r.to+e,r.type))}return n}function f_e(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 cW(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 uW(t){let e=[];for(let n=0;n<t.length;n++)t[n]!=null&&e.push(t[n]);return e}function E_(t,e,n,i){let r=[],a=!1;e.forEach((o,l)=>{let c=cW(t,o,l+n);if(c){a=!0;let d=E_(c,o,n+l+1,i);d!=Zr&&r.push(l,l+o.nodeSize,d)}});let s=lW(a?uW(t):t,-n).sort(Wd);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 oi(s,r):Zr}function Wd(t,e){return t.from-e.from||t.to-e.to}function wP(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),c5(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),c5(e,r,i.copy(a.from,i.to)));break}}}return e}function c5(t,e,n){for(;e<t.length&&Wd(n,t[e])>0;)e++;t.splice(e,0,n)}function gT(t){let e=[];return t.someProp("decorations",n=>{let i=n(t.state);i&&i!=Zr&&e.push(i)}),t.cursorWrapper&&e.push(oi.create(t.state.doc,[t.cursorWrapper.deco])),uu.from(e)}const h_e={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},p_e=La&&Eu<=11;class m_e{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 g_e{constructor(e,n){this.view=e,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new m_e,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]);La&&Eu<=11&&i.some(r=>r.type=="childList"&&r.removedNodes.length||r.type=="characterData"&&r.oldValue.length>r.target.nodeValue.length)?this.flushSoon():this.flush()}),p_e&&(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,h_e)),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(t5(this.view)){if(this.suppressingSelectionUpdates)return Xl(this.view);if(La&&Eu<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&hf(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=Cp(a))n.add(a);for(let a=e.anchorNode;a;a=Cp(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)&&t5(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(Fs&&l.length){let d=l.filter(f=>f.nodeName=="BR");if(d.length==2){let[f,p]=d;f.parentNode&&f.parentNode.parentNode==p.parentNode?p.remove():f.remove()}else{let{focusNode:f}=this.currentSelection;for(let p of d){let m=p.parentNode;m&&m.nodeName=="LI"&&(!f||y_e(e,f)!=m)&&p.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&&_S(i)&&(c=gP(e))&&c.eq(en.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,Xl(e),this.currentSelection.set(i),e.scrollToSelection()):(a>-1||r)&&(a>-1&&(e.docView.markDirty(a,s),v_e(e)),this.handleDOMChange(a,s,o,l),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(i)||Xl(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(La&&Eu<=11&&e.addedNodes.length)for(let d=0;d<e.addedNodes.length;d++){let{previousSibling:f,nextSibling:p}=e.addedNodes[d];(!f||Array.prototype.indexOf.call(e.addedNodes,f)<0)&&(r=f),(!p||Array.prototype.indexOf.call(e.addedNodes,p)<0)&&(a=p)}let s=r&&r.parentNode==e.target?Br(r)+1:0,o=i.localPosFromDOM(e.target,s,-1),l=a&&a.parentNode==e.target?Br(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 u5=new WeakMap,d5=!1;function v_e(t){if(!u5.has(t)&&(u5.set(t,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(t.dom).whiteSpace)!==-1)){if(t.requiresGeckoHackNode=Fs,d5)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."),d5=!0}}function f5(t,e){let n=e.startContainer,i=e.startOffset,r=e.endContainer,a=e.endOffset,s=t.domAtPos(t.state.selection.anchor);return hf(s.node,s.offset,r,a)&&([n,i,r,a]=[r,a,n,i]),{anchorNode:n,anchorOffset:i,focusNode:r,focusOffset:a}}function x_e(t,e){if(e.getComposedRanges){let r=e.getComposedRanges(t.root)[0];if(r)return f5(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?f5(t,n):null}function y_e(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 b_e(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}],_S(l)||c.push({node:l.focusNode,offset:l.focusOffset})),ea&&t.input.lastKeyCode===8)for(let x=a;x>r;x--){let v=i.childNodes[x-1],M=v.pmViewDesc;if(v.nodeName=="BR"&&!M){a=x;break}if(!M||M.size)break}let f=t.state.doc,p=t.someProp("domParser")||qg.fromSchema(t.state.schema),m=f.resolve(s),y=null,b=p.parse(i,{topNode:m.parent,topMatch:m.parent.contentMatchAt(m.index()),topOpen:!0,from:r,to:a,preserveWhitespace:m.parent.type.whitespace=="pre"?"full":!0,findPositions:c,ruleFromNode:__e,context:m});if(c&&c[0].pos!=null){let x=c[0].pos,v=c[1]&&c[1].pos;v==null&&(v=x),y={anchor:x+s,head:v+s}}return{doc:b,sel:y,from:s,to:o}}function __e(t){let e=t.pmViewDesc;if(e)return e.parseRule();if(t.nodeName=="BR"&&t.parentNode){if(pa&&/^(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||pa&&/^(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 S_e=/^(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 w_e(t,e,n,i,r){let a=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,e<0){let R=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,U=gP(t,R);if(U&&!t.state.selection.eq(U)){if(ea&&Bl&&t.input.lastKeyCode===13&&Date.now()-100<t.input.lastKeyCodeTime&&t.someProp("handleKeyDown",O=>O(t,Nd(13,"Enter"))))return;let N=t.state.tr.setSelection(U);R=="pointer"?N.setMeta("pointer",!0):R=="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=b_e(t,e,n),d=t.state.doc,f=d.slice(c.from,c.to),p,m;t.input.lastKeyCode===8&&Date.now()-100<t.input.lastKeyCodeTime?(p=t.state.selection.to,m="end"):(p=t.state.selection.from,m="start"),t.input.lastKeyCode=null;let y=A_e(f.content,c.doc.content,c.from,p,m);if(y&&t.input.domChangeCount++,(Rp&&t.input.lastIOSEnter>Date.now()-225||Bl)&&r.some(R=>R.nodeType==1&&!S_e.test(R.nodeName))&&(!y||y.endA>=y.endB)&&t.someProp("handleKeyDown",R=>R(t,Nd(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!y)if(i&&l instanceof Bt&&!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 R=h5(t,t.state.doc,c.sel);if(R&&!R.eq(t.state.selection)){let U=t.state.tr.setSelection(R);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 Bt&&(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)),La&&Eu<=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 b=c.doc.resolveNoCache(y.start-c.from),x=c.doc.resolveNoCache(y.endB-c.from),v=d.resolve(y.start),M=b.sameParent(x)&&b.parent.inlineContent&&v.end()>=y.endA;if((Rp&&t.input.lastIOSEnter>Date.now()-225&&(!M||r.some(R=>R.nodeName=="DIV"||R.nodeName=="P"))||!M&&b.pos<c.doc.content.size&&(!b.sameParent(x)||!b.parent.inlineContent)&&b.pos<x.pos&&!/\S/.test(c.doc.textBetween(b.pos,x.pos,"","")))&&t.someProp("handleKeyDown",R=>R(t,Nd(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>y.start&&E_e(d,y.start,y.endA,b,x)&&t.someProp("handleKeyDown",R=>R(t,Nd(8,"Backspace")))){Bl&&ea&&t.domObserver.suppressSelectionUpdates();return}ea&&y.endB==y.start&&(t.input.lastChromeDelete=Date.now()),Bl&&!M&&b.start()!=x.start()&&x.parentOffset==0&&b.depth==x.depth&&c.sel&&c.sel.anchor==c.sel.head&&c.sel.head==y.endA&&(y.endB-=2,x=c.doc.resolveNoCache(y.endB-c.from),setTimeout(()=>{t.someProp("handleKeyDown",function(R){return R(t,Nd(13,"Enter"))})},20));let w=y.start,E=y.endA,T=R=>{let U=R||t.state.tr.replace(w,E,c.doc.slice(y.start-c.from,y.endB-c.from));if(c.sel){let N=h5(t,U.doc,c.sel);N&&!(ea&&t.composing&&N.empty&&(y.start!=y.endB||t.input.lastChromeDelete<Date.now()-100)&&(N.head==w||N.head==U.mapping.map(E)-1)||La&&N.empty&&N.head==w)&&U.setSelection(N)}return a&&U.setMeta("composition",a),U.scrollIntoView()},P;if(M)if(b.pos==x.pos){La&&Eu<=11&&b.parentOffset==0&&(t.domObserver.suppressSelectionUpdates(),setTimeout(()=>Xl(t),20));let R=T(t.state.tr.delete(w,E)),U=d.resolve(y.start).marksAcross(d.resolve(y.endA));U&&R.ensureMarks(U),t.dispatch(R)}else if(y.endA==y.endB&&(P=M_e(b.parent.content.cut(b.parentOffset,x.parentOffset),v.parent.content.cut(v.parentOffset,y.endA-v.start())))){let R=T(t.state.tr);P.type=="add"?R.addMark(w,E,P.mark):R.removeMark(w,E,P.mark),t.dispatch(R)}else if(b.parent.child(b.index()).isText&&b.index()==x.index()-(x.textOffset?0:1)){let R=b.parent.textBetween(b.parentOffset,x.parentOffset),U=()=>T(t.state.tr.insertText(R,w,E));t.someProp("handleTextInput",N=>N(t,w,E,R,U))||t.dispatch(U())}else t.dispatch(T());else t.dispatch(T())}function h5(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:vP(t,e.resolve(n.anchor),e.resolve(n.head))}function M_e(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(lt.from(c).eq(t))return{mark:o,type:s}}function E_e(t,e,n,i,r){if(n-e<=r.pos-i.pos||vT(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(vT(a,!0,!0));return!s.parent.isTextblock||s.pos>n||vT(s,!0,!1)<n?!1:i.parent.content.cut(i.parentOffset).eq(s.parent.content)}function vT(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 A_e(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&&p5(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&&p5(t.textBetween(a-1,a+1))&&(a+=l?1:-1),s=a+(s-o),o=a}return{start:a,endA:s,endB:o}}function p5(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 dW{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 $be,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(y5),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=v5(this),g5(this),this.nodeViews=x5(this),this.docView=YB(this.state.doc,m5(this),gT(this),this.dom,this),this.domObserver=new g_e(this,(i,r,a,s)=>w_e(this,i,r,a,s)),this.domObserver.start(),Wbe(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&&KR(this);let n=this._props;this._props=e,e.plugins&&(e.plugins.forEach(y5),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&&(rW(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 m=x5(this);C_e(m,this.nodeViews)&&(this.nodeViews=m,a=!0)}(o||n.handleDOMEvents!=this._props.handleDOMEvents)&&KR(this),this.editable=v5(this),g5(this);let l=gT(this),c=m5(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 p=d=="preserve"&&s&&this.dom.style.overflowAnchor==null&&sbe(this);if(s){this.domObserver.stop();let m=f&&(La||ea)&&!this.composing&&!r.selection.empty&&!e.selection.empty&&T_e(r.selection,e.selection);if(f){let y=ea?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=a_e(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&&(m=!0)}m||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&Nbe(this))?Xl(this,m):(W9(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():p&&obe(p)}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 It){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&VB(this,n.getBoundingClientRect(),e)}else VB(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 sW(e.slice,e.move,r<0?void 0:It.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(La){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&&lbe(this.dom),Xl(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 hbe(this,e)}coordsAtPos(e,n=1){return F9(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 xbe(this,n||this.state,e)}pasteHTML(e,n){return R0(this,"",e,!1,n||new ClipboardEvent("paste"))}pasteText(e,n){return R0(this,e,null,!0,n||new ClipboardEvent("paste"))}serializeForClipboard(e){return xP(this,e)}destroy(){this.docView&&(qbe(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],gT(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,Yye())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return Ybe(this,e)}domSelectionRange(){let e=this.domSelection();return e?pa&&this.root.nodeType===11&&ebe(this.dom.ownerDocument)==this.dom&&x_e(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}dW.prototype.dispatch=function(t){let e=this._props.dispatchTransaction;e?e.call(this,t):this.updateState(this.state.apply(t))};function m5(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"),[da.node(0,t.state.doc.content.size,e)]}function g5(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:da.widget(t.state.selection.from,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function v5(t){return!t.someProp("editable",e=>e(t.state)===!1)}function T_e(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 x5(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 C_e(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 y5(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 Ou={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:"'"},A_={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},R_e=typeof navigator<"u"&&/Mac/.test(navigator.platform),N_e=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var jr=0;jr<10;jr++)Ou[48+jr]=Ou[96+jr]=String(jr);for(var jr=1;jr<=24;jr++)Ou[jr+111]="F"+jr;for(var jr=65;jr<=90;jr++)Ou[jr]=String.fromCharCode(jr+32),A_[jr]=String.fromCharCode(jr);for(var xT in Ou)A_.hasOwnProperty(xT)||(A_[xT]=Ou[xT]);function P_e(t){var e=R_e&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||N_e&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?A_:Ou)[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 D_e=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),O_e=typeof navigator<"u"&&/Win/.test(navigator.platform);function L_e(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))D_e?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 k_e(t){let e=Object.create(null);for(let n in t)e[L_e(n)]=t[n];return e}function yT(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 I_e(t){return new di({props:{handleKeyDown:fW(t)}})}function fW(t){let e=k_e(t);return function(n,i){let r=P_e(i),a,s=e[yT(r,i)];if(s&&s(n.state,n.dispatch,n))return!0;if(r.length==1&&r!=" "){if(i.shiftKey){let o=e[yT(r,i,!1)];if(o&&o(n.state,n.dispatch,n))return!0}if((i.altKey||i.metaKey||i.ctrlKey)&&!(O_e&&i.ctrlKey&&i.altKey)&&(a=Ou[i.keyCode])&&a!=r){let o=e[yT(a,i)];if(o&&o(n.state,n.dispatch,n))return!0}}return!1}}var U_e=Object.defineProperty,MP=(t,e)=>{for(var n in e)U_e(t,n,{get:e[n],enumerable:!0})};function MS(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 ES=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,p])=>[f,(...y)=>{const b=this.buildProps(l,e),x=p(...y)(b);return s.push(x),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:MS({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}},hW={};MP(hW,{blur:()=>F_e,clearContent:()=>z_e,clearNodes:()=>B_e,command:()=>j_e,createParagraphNear:()=>H_e,cut:()=>V_e,deleteCurrentNode:()=>G_e,deleteNode:()=>$_e,deleteRange:()=>W_e,deleteSelection:()=>q_e,enter:()=>X_e,exitCode:()=>Y_e,extendMarkRange:()=>K_e,first:()=>Z_e,focus:()=>Q_e,forEach:()=>e1e,insertContent:()=>t1e,insertContentAt:()=>r1e,joinBackward:()=>o1e,joinDown:()=>s1e,joinForward:()=>l1e,joinItemBackward:()=>c1e,joinItemForward:()=>u1e,joinTextblockBackward:()=>d1e,joinTextblockForward:()=>f1e,joinUp:()=>a1e,keyboardShortcut:()=>p1e,lift:()=>m1e,liftEmptyBlock:()=>g1e,liftListItem:()=>v1e,newlineInCode:()=>x1e,resetAttributes:()=>y1e,scrollIntoView:()=>b1e,selectAll:()=>_1e,selectNodeBackward:()=>S1e,selectNodeForward:()=>w1e,selectParentNode:()=>M1e,selectTextblockEnd:()=>E1e,selectTextblockStart:()=>A1e,setContent:()=>T1e,setMark:()=>$1e,setMeta:()=>W1e,setNode:()=>q1e,setNodeSelection:()=>X1e,setTextDirection:()=>Y1e,setTextSelection:()=>K1e,sinkListItem:()=>Z1e,splitBlock:()=>J1e,splitListItem:()=>Q1e,toggleList:()=>eSe,toggleMark:()=>tSe,toggleNode:()=>nSe,toggleWrap:()=>iSe,undoInputRule:()=>rSe,unsetAllMarks:()=>aSe,unsetMark:()=>sSe,unsetTextDirection:()=>oSe,updateAttributes:()=>lSe,wrapIn:()=>cSe,wrapInList:()=>uSe});var F_e=()=>({editor:t,view:e})=>(requestAnimationFrame(()=>{var n;t.isDestroyed||(e.dom.blur(),(n=window?.getSelection())==null||n.removeAllRanges())}),!0),z_e=(t=!0)=>({commands:e})=>e.setContent("",{emitUpdate:t}),B_e=()=>({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)),p=c.resolve(d.map(l+o.nodeSize)),m=f.blockRange(p);if(!m)return;const y=Qp(m);if(o.type.isTextblock){const{defaultType:b}=f.parent.contentMatchAt(f.index());e.setNodeMarkup(m.start,b)}(y||y===0)&&e.lift(m,y)})}),!0},j_e=t=>e=>t(e),H_e=()=>({state:t,dispatch:e})=>C9(t,e),V_e=(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 Bt(i.doc.resolve(Math.max(s-1,0)))),!0},G_e=()=>({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 Wi(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 $_e=t=>({tr:e,state:n,dispatch:i})=>{const r=Wi(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},W_e=t=>({tr:e,dispatch:n})=>{const{from:i,to:r}=t;return n&&e.delete(i,r),!0},q_e=()=>({state:t,dispatch:e})=>uP(t,e),X_e=()=>({commands:t})=>t.keyboardShortcut("Enter"),Y_e=()=>({state:t,dispatch:e})=>Lye(t,e);function EP(t){return Object.prototype.toString.call(t)==="[object RegExp]"}function T_(t,e,n={strict:!0}){const i=Object.keys(e);return i.length?i.every(r=>n.strict?e[r]===t[r]:EP(e[r])?e[r].test(t[r]):e[r]===t[r]):!0}function pW(t,e,n={}){return t.find(i=>i.type===e&&T_(Object.fromEntries(Object.keys(n).map(r=>[r,i.attrs[r]])),n))}function b5(t,e,n={}){return!!pW(t,e,n)}function AP(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),!pW([...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&&b5([...t.parent.child(s-1).marks],e,n);)s-=1,o-=t.parent.child(s).nodeSize;for(;l<t.parent.childCount&&b5([...t.parent.child(l).marks],e,n);)c+=t.parent.child(l).nodeSize,l+=1;return{from:o,to:c}}function lc(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 K_e=(t,e={})=>({tr:n,state:i,dispatch:r})=>{const a=lc(t,i.schema),{doc:s,selection:o}=n,{$from:l,from:c,to:d}=o;if(r){const f=AP(l,a,e);if(f&&f.from<=c&&f.to>=d){const p=Bt.create(s,f.from,f.to);n.setSelection(p)}}return!0},Z_e=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 mW(t){return t instanceof Bt}function kd(t=0,e=0,n=0){return Math.min(Math.max(t,e),n)}function gW(t,e=null){if(!e)return null;const n=en.atStart(t),i=en.atEnd(t);if(e==="start"||e===!0)return n;if(e==="end")return i;const r=n.from,a=i.to;return e==="all"?Bt.create(t,kd(0,r,a),kd(t.content.size,r,a)):Bt.create(t,kd(e,r,a),kd(e,r,a))}function J_e(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}function TP(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}var Q_e=(t=null,e={})=>({editor:n,view:i,tr:r,dispatch:a})=>{e={scrollIntoView:!0,...e};const s=()=>{(TP()||J_e())&&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&&!mW(n.state.selection))return s(),!0;const o=gW(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},e1e=(t,e)=>n=>t.every((i,r)=>e(i,{...n,index:r})),t1e=(t,e)=>({tr:n,commands:i})=>i.insertContentAt({from:n.selection.from,to:n.selection.to},t,e),vW=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&&vW(i)}return t};function tb(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 vW(n)}function P0(t,e,n){if(t instanceof Mu||t instanceof lt)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 lt.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),P0("",e,n)}if(r){if(n.errorOnInvalidContent){let s=!1,o="";const l=new t9({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?qg.fromSchema(l).parseSlice(tb(t),n.parseOptions):qg.fromSchema(l).parse(tb(t),n.parseOptions),n.errorOnInvalidContent&&s)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${o}`)})}const a=qg.fromSchema(e);return n.slice?a.parseSlice(tb(t),n.parseOptions).content:a.parse(tb(t),n.parseOptions)}return P0("",e,n)}function n1e(t,e,n){const i=t.steps.length-1;if(i<e)return;const r=t.steps[i];if(!(r instanceof _r||r instanceof wr))return;const a=t.mapping.maps[i];let s=0;a.forEach((o,l,c,d)=>{s===0&&(s=d)}),t.setSelection(en.near(t.doc.resolve(s),n))}var i1e=t=>!("type"in t),r1e=(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=x=>{a.emit("contentError",{editor:a,error:x,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{P0(e,a.schema,{parseOptions:c,errorOnInvalidContent:!0})}catch(x){l(x)}try{o=P0(e,a.schema,{parseOptions:c,errorOnInvalidContent:(s=n.errorOnInvalidContent)!=null?s:a.options.enableContentCheck})}catch(x){return l(x),!1}let{from:d,to:f}=typeof t=="number"?{from:t,to:t}:{from:t.from,to:t.to},p=!0,m=!0;if((i1e(o)?o:[o]).forEach(x=>{x.check(),p=p?x.isText&&x.marks.length===0:!1,m=m?x.isBlock:!1}),d===f&&m){const{parent:x}=i.doc.resolve(d);x.isTextblock&&!x.type.spec.code&&!x.childCount&&(d-=1,f+=1)}let b;if(p){if(Array.isArray(e))b=e.map(x=>x.text||"").join("");else if(e instanceof lt){let x="";e.forEach(v=>{v.text&&(x+=v.text)}),b=x}else typeof e=="object"&&e&&e.text?b=e.text:b=e;i.insertText(b,d,f)}else{b=o;const x=i.doc.resolve(d),v=x.node(),M=x.parentOffset===0,w=v.isText||v.isTextblock,E=v.content.size>0;M&&w&&E&&(d=Math.max(0,d-1)),i.replaceWith(d,f,b)}n.updateSelection&&n1e(i,i.steps.length-1,-1),n.applyInputRules&&i.setMeta("applyInputRules",{from:d,text:b}),n.applyPasteRules&&i.setMeta("applyPasteRules",{from:d,text:b})}return!0},a1e=()=>({state:t,dispatch:e})=>Pye(t,e),s1e=()=>({state:t,dispatch:e})=>Dye(t,e),o1e=()=>({state:t,dispatch:e})=>_9(t,e),l1e=()=>({state:t,dispatch:e})=>E9(t,e),c1e=()=>({state:t,dispatch:e,tr:n})=>{try{const i=xS(t.doc,t.selection.$from.pos,-1);return i==null?!1:(n.join(i,2),e&&e(n),!0)}catch{return!1}},u1e=()=>({state:t,dispatch:e,tr:n})=>{try{const i=xS(t.doc,t.selection.$from.pos,1);return i==null?!1:(n.join(i,2),e&&e(n),!0)}catch{return!1}},d1e=()=>({state:t,dispatch:e})=>Rye(t,e),f1e=()=>({state:t,dispatch:e})=>Nye(t,e);function xW(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function h1e(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))TP()||xW()?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 p1e=t=>({editor:e,view:n,tr:i,dispatch:r})=>{const a=h1e(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 Lu(t,e,n={}){const{from:i,to:r,empty:a}=t.selection,s=e?Wi(e,t.schema):null,o=[];t.doc.nodesBetween(i,r,(f,p)=>{if(f.isText)return;const m=Math.max(i,p),y=Math.min(r,p+f.nodeSize);o.push({node:f,from:m,to:y})});const l=r-i,c=o.filter(f=>s?s.name===f.node.type.name:!0).filter(f=>T_(f.node.attrs,n,{strict:!1}));return a?!!c.length:c.reduce((f,p)=>f+p.to-p.from,0)>=l}var m1e=(t,e={})=>({state:n,dispatch:i})=>{const r=Wi(t,n.schema);return Lu(n,r,e)?Oye(n,i):!1},g1e=()=>({state:t,dispatch:e})=>R9(t,e),v1e=t=>({state:e,dispatch:n})=>{const i=Wi(t,e.schema);return $ye(i)(e,n)},x1e=()=>({state:t,dispatch:e})=>T9(t,e);function AS(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}function _5(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 y1e=(t,e)=>({tr:n,state:i,dispatch:r})=>{let a=null,s=null;const o=AS(typeof t=="string"?t:t.name,i.schema);if(!o)return!1;o==="node"&&(a=Wi(t,i.schema)),o==="mark"&&(s=lc(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,_5(d.attrs,e))),s&&d.marks.length&&d.marks.forEach(p=>{s===p.type&&(l=!0,r&&n.addMark(f,f+d.nodeSize,s.create(_5(p.attrs,e))))})})}),l},b1e=()=>({tr:t,dispatch:e})=>(e&&t.scrollIntoView(),!0),_1e=()=>({tr:t,dispatch:e})=>{if(e){const n=new rs(t.doc);t.setSelection(n)}return!0},S1e=()=>({state:t,dispatch:e})=>w9(t,e),w1e=()=>({state:t,dispatch:e})=>A9(t,e),M1e=()=>({state:t,dispatch:e})=>Uye(t,e),E1e=()=>({state:t,dispatch:e})=>Bye(t,e),A1e=()=>({state:t,dispatch:e})=>zye(t,e);function ZR(t,e,n={},i={}){return P0(t,e,{slice:!1,parseOptions:n,errorOnInvalidContent:i.errorOnInvalidContent})}var T1e=(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=ZR(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 yW(t,e){const n=lc(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 bW(t,e){const n=new v9(t);return e.forEach(i=>{i.steps.forEach(r=>{n.step(r)})}),n}function C1e(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 R1e(t,e,n){const i=[];return t.nodesBetween(e.from,e.to,(r,a)=>{n(r)&&i.push({node:r,pos:a})}),i}function N1e(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 TS(t){return e=>N1e(e.$from,t)}function kt(t,e,n){return t.config[e]===void 0&&t.parent?kt(t.parent,e,n):typeof t.config[e]=="function"?t.config[e].bind({...n,parent:t.parent?kt(t.parent,e,n):null}):t.config[e]}function CP(t){return t.map(e=>{const n={name:e.name,options:e.options,storage:e.storage},i=kt(e,"addExtensions",n);return i?[e,...CP(i())]:e}).flat(10)}function RP(t,e){const n=Tf.fromSchema(e).serializeFragment(t),r=document.implementation.createHTMLDocument().createElement("div");return r.appendChild(n),r.innerHTML}function _W(t){return typeof t=="function"}function Tn(t,e=void 0,...n){return _W(t)?e?t.bind(e)(...n):t(...n):t}function P1e(t={}){return Object.keys(t).length===0&&t.constructor===Object}function Np(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 SW(t){const e=[],{nodeExtensions:n,markExtensions:i}=Np(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=kt(s,"addGlobalAttributes",o);if(!l)return;l().forEach(d=>{d.types.forEach(f=>{Object.entries(d.attributes).forEach(([p,m])=>{e.push({type:f,name:p,attribute:{...a,...m}})})})})}),r.forEach(s=>{const o={name:s.name,options:s.options,storage:s.storage},l=kt(s,"addAttributes",o);if(!l)return;const c=l();Object.entries(c).forEach(([d,f])=>{const p={...a,...f};typeof p?.default=="function"&&(p.default=p.default()),p?.isRequired&&p?.default===void 0&&delete p.default,e.push({type:s.name,name:d,attribute:p})})}),e}function Si(...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,p]=d.split(":").map(m=>m.trim());c.set(f,p)}),o.forEach(d=>{const[f,p]=d.split(":").map(m=>m.trim());c.set(f,p)}),i[r]=Array.from(c.entries()).map(([d,f])=>`${d}: ${f}`).join("; ")}else i[r]=a}),i},{})}function C_(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)=>Si(n,i),{})}function D1e(t){return typeof t!="string"?t:t.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(t):t==="true"?!0:t==="false"?!1:t}function S5(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):D1e(n.getAttribute(s.name));return o==null?a:{...a,[s.name]:o}},{});return{...i,...r}}}}function w5(t){return Object.fromEntries(Object.entries(t).filter(([e,n])=>e==="attrs"&&P1e(n)?!1:n!=null))}function M5(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 O1e(t,e){var n;const i=SW(t),{nodeExtensions:r,markExtensions:a}=Np(t),s=(n=r.find(c=>kt(c,"topNode")))==null?void 0:n.name,o=Object.fromEntries(r.map(c=>{const d=i.filter(v=>v.type===c.name),f={name:c.name,options:c.options,storage:c.storage,editor:e},p=t.reduce((v,M)=>{const w=kt(M,"extendNodeSchema",f);return{...v,...w?w(c):{}}},{}),m=w5({...p,content:Tn(kt(c,"content",f)),marks:Tn(kt(c,"marks",f)),group:Tn(kt(c,"group",f)),inline:Tn(kt(c,"inline",f)),atom:Tn(kt(c,"atom",f)),selectable:Tn(kt(c,"selectable",f)),draggable:Tn(kt(c,"draggable",f)),code:Tn(kt(c,"code",f)),whitespace:Tn(kt(c,"whitespace",f)),linebreakReplacement:Tn(kt(c,"linebreakReplacement",f)),defining:Tn(kt(c,"defining",f)),isolating:Tn(kt(c,"isolating",f)),attrs:Object.fromEntries(d.map(M5))}),y=Tn(kt(c,"parseHTML",f));y&&(m.parseDOM=y.map(v=>S5(v,d)));const b=kt(c,"renderHTML",f);b&&(m.toDOM=v=>b({node:v,HTMLAttributes:C_(v,d)}));const x=kt(c,"renderText",f);return x&&(m.toText=x),[c.name,m]})),l=Object.fromEntries(a.map(c=>{const d=i.filter(x=>x.type===c.name),f={name:c.name,options:c.options,storage:c.storage,editor:e},p=t.reduce((x,v)=>{const M=kt(v,"extendMarkSchema",f);return{...x,...M?M(c):{}}},{}),m=w5({...p,inclusive:Tn(kt(c,"inclusive",f)),excludes:Tn(kt(c,"excludes",f)),group:Tn(kt(c,"group",f)),spanning:Tn(kt(c,"spanning",f)),code:Tn(kt(c,"code",f)),attrs:Object.fromEntries(d.map(M5))}),y=Tn(kt(c,"parseHTML",f));y&&(m.parseDOM=y.map(x=>S5(x,d)));const b=kt(c,"renderHTML",f);return b&&(m.toDOM=x=>b({mark:x,HTMLAttributes:C_(x,d)})),[c.name,m]}));return new t9({topNode:s,nodes:o,marks:l})}function L1e(t){const e=t.filter((n,i)=>t.indexOf(n)!==i);return Array.from(new Set(e))}function NP(t){return t.sort((n,i)=>{const r=kt(n,"priority")||100,a=kt(i,"priority")||100;return r>a?-1:r<a?1:0})}function wW(t){const e=NP(CP(t)),n=L1e(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 MW(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 p;l.isBlock&&c>i&&(o+=a);const m=s?.[l.type.name];if(m)return d&&(o+=m({node:l,pos:c,parent:d,index:f,range:e})),!1;l.isText&&(o+=(p=l?.text)==null?void 0:p.slice(Math.max(i,c)-c,r-c))}),o}function k1e(t,e){const n={from:0,to:t.content.size};return MW(t,n,e)}function EW(t){return Object.fromEntries(Object.entries(t.nodes).filter(([,e])=>e.spec.toText).map(([e,n])=>[e,n.spec.toText]))}function I1e(t,e){const n=Wi(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 AW(t,e){const n=AS(typeof e=="string"?e:e.name,t.schema);return n==="node"?I1e(t,e):n==="mark"?yW(t,e):{}}function U1e(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 F1e(t){const e=U1e(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 TW(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),p=e.invert().map(d);i.push({oldRange:{from:f,to:p},newRange:{from:c,to:d}})})}),F1e(i)}function PP(t,e,n){const i=[];return t===e?n.resolve(t).marks().forEach(r=>{const a=n.resolve(t),s=AP(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 z1e=(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 bT(t,e){return e.nodes[t]||e.marks[t]||null}function jb(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 B1e=(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 JR(t,e,n={}){const{empty:i,ranges:r}=t.selection,a=e?lc(e,t.schema):null;if(i)return!!(t.storedMarks||t.selection.$from.marks()).filter(f=>a?a.name===f.type.name:!0).find(f=>T_(f.attrs,n,{strict:!1}));let s=0;const o=[];if(r.forEach(({$from:f,$to:p})=>{const m=f.pos,y=p.pos;t.doc.nodesBetween(m,y,(b,x)=>{if(!b.isText&&!b.marks.length)return;const v=Math.max(m,x),M=Math.min(y,x+b.nodeSize),w=M-v;s+=w,o.push(...b.marks.map(E=>({mark:E,from:v,to:M})))})}),s===0)return!1;const l=o.filter(f=>a?a.name===f.mark.type.name:!0).filter(f=>T_(f.mark.attrs,n,{strict:!1})).reduce((f,p)=>f+p.to-p.from,0),c=o.filter(f=>a?f.mark.type!==a&&f.mark.type.excludes(a):!0).reduce((f,p)=>f+p.to-p.from,0);return(l>0?l+c:l)>=s}function j1e(t,e,n={}){if(!e)return Lu(t,null,n)||JR(t,null,n);const i=AS(e,t.schema);return i==="node"?Lu(t,e,n):i==="mark"?JR(t,e,n):!1}var H1e=(t,e)=>{const{$from:n,$to:i,$anchor:r}=t.selection;if(e){const a=TS(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)},V1e=t=>{const{$from:e,$to:n}=t.selection;return!(e.parentOffset>0||e.pos!==n.pos)};function E5(t,e){return Array.isArray(e)?e.some(n=>(typeof n=="string"?n:n.name)===t.name):e}function A5(t,e){const{nodeExtensions:n}=Np(e),i=n.find(s=>s.name===t);if(!i)return!1;const r={name:i.name,options:i.options,storage:i.storage},a=Tn(kt(i,"group",r));return typeof a!="string"?!1:a.split(" ").includes("list")}function CS(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&&(CS(a,{ignoreWhitespace:n,checkChildren:e})||(r=!1))}),r}return!1}function CW(t){return t instanceof It}function G1e(t,e,n){var i;const{selection:r}=e;let a=null;if(mW(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,p)=>{if(c)return!1;if(d.isInline){const m=!p||p.type.allowsMarkType(n),y=!!n.isInSet(d.marks)||!d.marks.some(b=>b.type.excludes(n));c=m&&y}return!c}),c})}var $1e=(t,e={})=>({tr:n,state:i,dispatch:r})=>{const{selection:a}=n,{empty:s,ranges:o}=a,l=lc(t,i.schema);if(r)if(s){const c=yW(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,(p,m)=>{const y=Math.max(m,d),b=Math.min(m+p.nodeSize,f);p.marks.find(v=>v.type===l)?p.marks.forEach(v=>{l===v.type&&n.addMark(y,b,l.create({...v.attrs,...e}))}):n.addMark(y,b,l.create(e))})});return G1e(i,n,l)},W1e=(t,e)=>({tr:n})=>(n.setMeta(t,e),!0),q1e=(t,e={})=>({state:n,dispatch:i,chain:r})=>{const a=Wi(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})=>BB(a,{...s,...e})(n)?!0:o.clearNodes()).command(({state:o})=>BB(a,{...s,...e})(o,i)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},X1e=t=>({tr:e,dispatch:n})=>{if(n){const{doc:i}=e,r=kd(t,0,i.content.size),a=It.create(i,r);e.setSelection(a)}return!0},Y1e=(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},K1e=t=>({tr:e,dispatch:n})=>{if(n){const{doc:i}=e,{from:r,to:a}=typeof t=="number"?{from:t,to:t}:t,s=Bt.atStart(i).from,o=Bt.atEnd(i).to,l=kd(r,s,o),c=kd(a,s,o),d=Bt.create(i,l,c);e.setSelection(d)}return!0},Z1e=t=>({state:e,dispatch:n})=>{const i=Wi(t,e.schema);return Xye(i)(e,n)};function T5(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 J1e=({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=jb(c,o.node().type.name,o.node().attrs);if(a instanceof It&&a.node.isBlock)return!o.parentOffset||!ql(s,o.pos)?!1:(i&&(t&&T5(n,r.extensionManager.splittableMarks),e.split(o.pos).scrollIntoView()),!0);if(!o.parent.isBlock)return!1;const f=l.parentOffset===l.parent.content.size,p=o.depth===0?void 0:C1e(o.node(-1).contentMatchAt(o.indexAfter(-1)));let m=f&&p?[{type:p,attrs:d}]:void 0,y=ql(e.doc,e.mapping.map(o.pos),1,m);if(!m&&!y&&ql(e.doc,e.mapping.map(o.pos),1,p?[{type:p}]:void 0)&&(y=!0,m=p?[{type:p,attrs:d}]:void 0),i){if(y&&(a instanceof Bt&&e.deleteSelection(),e.split(e.mapping.map(o.pos),1,m),p&&!f&&!o.parentOffset&&o.parent.type!==p)){const b=e.mapping.map(o.before()),x=e.doc.resolve(b);o.node(-1).canReplaceWith(x.index(),x.index()+1,p)&&e.setNodeMarkup(e.mapping.map(o.before()),p)}t&&T5(n,r.extensionManager.splittableMarks),e.scrollIntoView()}return y},Q1e=(t,e={})=>({tr:n,state:i,dispatch:r,editor:a})=>{var s;const o=Wi(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 p=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 v=lt.empty;const M=l.index(-1)?1:l.index(-2)?2:3;for(let U=l.depth-M;U>=l.depth-3;U-=1)v=lt.from(l.node(U).copy(v));const w=l.indexAfter(-1)<l.node(-2).childCount?1:l.indexAfter(-2)<l.node(-3).childCount?2:3,E={...jb(p,l.node().type.name,l.node().attrs),...e},T=((s=o.contentMatch.defaultType)==null?void 0:s.createAndFill(E))||void 0;v=v.append(lt.from(o.createAndFill(null,T)||void 0));const P=l.before(l.depth-(M-1));n.replace(P,l.after(-w),new wt(v,4-M,0));let R=-1;n.doc.nodesBetween(P,n.doc.content.size,(U,N)=>{if(R>-1)return!1;U.isTextblock&&U.content.size===0&&(R=N+1)}),R>-1&&n.setSelection(Bt.near(n.doc.resolve(R))),n.scrollIntoView()}return!0}const m=c.pos===l.end()?f.contentMatchAt(0).defaultType:null,y={...jb(p,f.type.name,f.attrs),...e},b={...jb(p,l.node().type.name,l.node().attrs),...e};n.delete(l.pos,c.pos);const x=m?[{type:o,attrs:y},{type:m,attrs:b}]:[{type:o,attrs:y}];if(!ql(n.doc,l.pos,2))return!1;if(r){const{selection:v,storedMarks:M}=i,{splittableMarks:w}=a.extensionManager,E=M||v.$to.parentOffset&&v.$from.marks();if(n.split(l.pos,2,x).scrollIntoView(),!E||!r)return!0;const T=E.filter(P=>w.includes(P.type.name));n.ensureMarks(T)}return!0},_T=(t,e)=>{const n=TS(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&&Bu(t.doc,n.pos)&&t.join(n.pos),!0},ST=(t,e)=>{const n=TS(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&&Bu(t.doc,i)&&t.join(i),!0},eSe=(t,e,n,i={})=>({editor:r,tr:a,state:s,dispatch:o,chain:l,commands:c,can:d})=>{const{extensions:f,splittableMarks:p}=r.extensionManager,m=Wi(t,s.schema),y=Wi(e,s.schema),{selection:b,storedMarks:x}=s,{$from:v,$to:M}=b,w=v.blockRange(M),E=x||b.$to.parentOffset&&b.$from.marks();if(!w)return!1;const T=TS(P=>A5(P.type.name,f))(b);if(w.depth>=1&&T&&w.depth-T.depth<=1){if(T.node.type===m)return c.liftListItem(y);if(A5(T.node.type.name,f)&&m.validContent(T.node.content)&&o)return l().command(()=>(a.setNodeMarkup(T.pos,m),!0)).command(()=>_T(a,m)).command(()=>ST(a,m)).run()}return!n||!E||!o?l().command(()=>d().wrapInList(m,i)?!0:c.clearNodes()).wrapInList(m,i).command(()=>_T(a,m)).command(()=>ST(a,m)).run():l().command(()=>{const P=d().wrapInList(m,i),R=E.filter(U=>p.includes(U.type.name));return a.ensureMarks(R),P?!0:c.clearNodes()}).wrapInList(m,i).command(()=>_T(a,m)).command(()=>ST(a,m)).run()},tSe=(t,e={},n={})=>({state:i,commands:r})=>{const{extendEmptyMarkRange:a=!1}=n,s=lc(t,i.schema);return JR(i,s,e)?r.unsetMark(s,{extendEmptyMarkRange:a}):r.setMark(s,e)},nSe=(t,e,n={})=>({state:i,commands:r})=>{const a=Wi(t,i.schema),s=Wi(e,i.schema),o=Lu(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})},iSe=(t,e={})=>({state:n,commands:i})=>{const r=Wi(t,n.schema);return Lu(n,r,e)?i.lift(r):i.wrapIn(r,e)},rSe=()=>({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},aSe=()=>({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},sSe=(t,e={})=>({tr:n,state:i,dispatch:r})=>{var a;const{extendEmptyMarkRange:s=!1}=e,{selection:o}=n,l=lc(t,i.schema),{$from:c,empty:d,ranges:f}=o;if(!r)return!0;if(d&&s){let{from:p,to:m}=o;const y=(a=c.marks().find(x=>x.type===l))==null?void 0:a.attrs,b=AP(c,l,y);b&&(p=b.from,m=b.to),n.removeMark(p,m,l)}else f.forEach(p=>{n.removeMark(p.$from.pos,p.$to.pos,l)});return n.removeStoredMark(l),!0},oSe=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},lSe=(t,e={})=>({tr:n,state:i,dispatch:r})=>{let a=null,s=null;const o=AS(typeof t=="string"?t:t.name,i.schema);if(!o)return!1;o==="node"&&(a=Wi(t,i.schema)),o==="mark"&&(s=lc(t,i.schema));let l=!1;return n.selection.ranges.forEach(c=>{const d=c.$from.pos,f=c.$to.pos;let p,m,y,b;n.selection.empty?i.doc.nodesBetween(d,f,(x,v)=>{a&&a===x.type&&(l=!0,y=Math.max(v,d),b=Math.min(v+x.nodeSize,f),p=v,m=x)}):i.doc.nodesBetween(d,f,(x,v)=>{v<d&&a&&a===x.type&&(l=!0,y=Math.max(v,d),b=Math.min(v+x.nodeSize,f),p=v,m=x),v>=d&&v<=f&&(a&&a===x.type&&(l=!0,r&&n.setNodeMarkup(v,void 0,{...x.attrs,...e})),s&&x.marks.length&&x.marks.forEach(M=>{if(s===M.type&&(l=!0,r)){const w=Math.max(v,d),E=Math.min(v+x.nodeSize,f);n.addMark(w,E,s.create({...M.attrs,...e}))}}))}),m&&(p!==void 0&&r&&n.setNodeMarkup(p,void 0,{...m.attrs,...e}),s&&m.marks.length&&m.marks.forEach(x=>{s===x.type&&r&&n.addMark(y,b,s.create({...x.attrs,...e}))}))}),l},cSe=(t,e={})=>({state:n,dispatch:i})=>{const r=Wi(t,n.schema);return jye(r,e)(n,i)},uSe=(t,e={})=>({state:n,dispatch:i})=>{const r=Wi(t,n.schema);return Hye(r,e)(n,i)},dSe=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={}}},RS=class{constructor(t){var e;this.find=t.find,this.handler=t.handler,this.undoable=(e=t.undoable)!=null?e:!0}},fSe=(t,e)=>{if(EP(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 nb(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(p=>p.type.spec.code))return!1;let d=!1;const f=B1e(c)+a;return s.forEach(p=>{if(d)return;const m=fSe(f,p.find);if(!m)return;const y=l.state.tr,b=MS({state:l.state,transaction:y}),x={from:i-(m[0].length-a.length),to:r},{commands:v,chain:M,can:w}=new ES({editor:n,state:b});p.handler({state:b,range:x,match:m,commands:v,chain:M,can:w})===null||!y.steps.length||(p.undoable&&y.setMeta(o,{transform:y,from:i,to:r,text:a}),l.dispatch(y),d=!0)}),d}function hSe(t){const{editor:e,rules:n}=t,i=new di({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=RP(lt.from(d),s.schema);const{from:f}=l,p=f+d.length;nb({editor:e,from:f,to:p,text:d,rules:n,plugin:i})}),r.selectionSet||r.docChanged?null:a}},props:{handleTextInput(r,a,s,o){return nb({editor:e,from:a,to:s,text:o,rules:n,plugin:i})},handleDOMEvents:{compositionend:r=>(setTimeout(()=>{const{$cursor:a}=r.state.selection;a&&nb({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?nb({editor:e,from:s.pos,to:s.pos,text:`
  8069. `,rules:n,plugin:i}):!1}},isInputRules:!0});return i}function pSe(t){return Object.prototype.toString.call(t).slice(8,-1)}function ib(t){return pSe(t)!=="Object"?!1:t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype}function RW(t,e){const n={...t};return ib(t)&&ib(e)&&Object.keys(e).forEach(i=>{ib(e[i])&&ib(t[i])?n[i]=RW(t[i],e[i]):n[i]=e[i]}),n}var DP=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{...Tn(kt(this,"addOptions",{name:this.name}))||{}}}get storage(){return{...Tn(kt(this,"addStorage",{name:this.name,options:this.options}))||{}}}configure(t={}){const e=this.extend({...this.config,addOptions:()=>RW(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}},Hu=class NW extends DP{constructor(){super(...arguments),this.type="mark"}static create(e={}){const n=typeof e=="function"?e():e;return new NW(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 mSe(t){return typeof t=="number"}var gSe=class{constructor(t){this.find=t.find,this.handler=t.handler}},vSe=(t,e,n)=>{if(EP(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 xSe(t){const{editor:e,state:n,from:i,to:r,rule:a,pasteEvent:s,dropEvent:o}=t,{commands:l,chain:c,can:d}=new ES({editor:e,state:n}),f=[];return n.doc.nodesBetween(i,r,(m,y)=>{var b,x,v,M,w;if((x=(b=m.type)==null?void 0:b.spec)!=null&&x.code||!(m.isText||m.isTextblock||m.isInline))return;const E=(w=(M=(v=m.content)==null?void 0:v.size)!=null?M:m.nodeSize)!=null?w:0,T=Math.max(i,y),P=Math.min(r,y+E);if(T>=P)return;const R=m.isText?m.text||"":m.textBetween(T-y,P-y,void 0,"");vSe(R,a.find,s).forEach(N=>{if(N.index===void 0)return;const O=T+N.index+1,B=O+N[0].length,I={from:n.tr.mapping.map(O),to:n.tr.mapping.map(B)},W=a.handler({state:n,range:I,match:N,commands:l,chain:c,can:d,pasteEvent:s,dropEvent:o});f.push(W)})}),f.every(m=>m!==null)}var rb=null,ySe=t=>{var e;const n=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=n.clipboardData)==null||e.setData("text/html",t),n};function bSe(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:p,rule:m,pasteEvt:y})=>{const b=d.tr,x=MS({state:d,transaction:b});if(!(!xSe({editor:e,state:x,from:Math.max(f-1,0),to:p.b-1,rule:m,pasteEvent:y,dropEvent:o})||!b.steps.length)){try{o=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{o=null}return s=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,b}};return n.map(d=>new di({view(f){const p=y=>{var b;i=(b=f.dom.parentElement)!=null&&b.contains(y.target)?f.dom.parentElement:null,i&&(rb=e)},m=()=>{rb&&(rb=null)};return window.addEventListener("dragstart",p),window.addEventListener("dragend",m),{destroy(){window.removeEventListener("dragstart",p),window.removeEventListener("dragend",m)}}},props:{handleDOMEvents:{drop:(f,p)=>{if(a=i===f.dom.parentElement,o=p,!a){const m=rb;m?.isEditable&&setTimeout(()=>{const y=m.state.selection;y&&m.commands.deleteRange({from:y.from,to:y.to})},10)}return!1},paste:(f,p)=>{var m;const y=(m=p.clipboardData)==null?void 0:m.getData("text/html");return s=p,r=!!y?.includes("data-pm-slice"),!1}}},appendTransaction:(f,p,m)=>{const y=f[0],b=y.getMeta("uiEvent")==="paste"&&!r,x=y.getMeta("uiEvent")==="drop"&&!a,v=y.getMeta("applyPasteRules"),M=!!v;if(!b&&!x&&!M)return;if(M){let{text:T}=v;typeof T=="string"?T=T:T=RP(lt.from(T),m.schema);const{from:P}=v,R=P+T.length,U=ySe(T);return l({rule:d,state:m,from:P,to:{b:R},pasteEvt:U})}const w=p.doc.content.findDiffStart(m.doc.content),E=p.doc.content.findDiffEnd(m.doc.content);if(!(!mSe(w)||!E||w===E.b))return l({rule:d,state:m,from:w,to:E,pasteEvt:s})}}))}var NS=class{constructor(t,e){this.splittableMarks=[],this.editor=e,this.baseExtensions=t,this.extensions=wW(t),this.schema=O1e(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:bT(e.name,this.schema)},i=kt(e,"addCommands",n);return i?{...t,...i()}:t},{})}get plugins(){const{editor:t}=this;return NP([...this.extensions].reverse()).flatMap(i=>{const r={name:i.name,options:i.options,storage:this.editor.extensionStorage[i.name],editor:t,type:bT(i.name,this.schema)},a=[],s=kt(i,"addKeyboardShortcuts",r);let o={};if(i.type==="mark"&&kt(i,"exitable",r)&&(o.ArrowRight=()=>Hu.handleExit({editor:t,mark:i})),s){const p=Object.fromEntries(Object.entries(s()).map(([m,y])=>[m,()=>y({editor:t})]));o={...o,...p}}const l=I_e(o);a.push(l);const c=kt(i,"addInputRules",r);if(E5(i,t.options.enableInputRules)&&c){const p=c();if(p&&p.length){const m=hSe({editor:t,rules:p}),y=Array.isArray(m)?m:[m];a.push(...y)}}const d=kt(i,"addPasteRules",r);if(E5(i,t.options.enablePasteRules)&&d){const p=d();if(p&&p.length){const m=bSe({editor:t,rules:p});a.push(...m)}}const f=kt(i,"addProseMirrorPlugins",r);if(f){const p=f();a.push(...p)}return a})}get attributes(){return SW(this.extensions)}get nodeViews(){const{editor:t}=this,{nodeExtensions:e}=Np(this.extensions);return Object.fromEntries(e.filter(n=>!!kt(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:Wi(n.name,this.schema)},a=kt(n,"addNodeView",r);if(!a)return[];const s=a();if(!s)return[];const o=(l,c,d,f,p)=>{const m=C_(l,i);return s({node:l,view:c,getPos:d,decorations:f,innerDecorations:p,editor:t,extension:n,HTMLAttributes:m})};return[n.name,o]}))}get markViews(){const{editor:t}=this,{markExtensions:e}=Np(this.extensions);return Object.fromEntries(e.filter(n=>!!kt(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:lc(n.name,this.schema)},a=kt(n,"addMarkView",r);if(!a)return[];const s=(o,l,c)=>{const d=C_(o,i);return a()({mark:o,view:l,inline:c,editor:t,extension:n,HTMLAttributes:d,updateAttributes:f=>{kSe(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:bT(e.name,this.schema)};e.type==="mark"&&((n=Tn(kt(e,"keepOnSplit",i)))==null||n)&&this.splittableMarks.push(e.name);const r=kt(e,"onBeforeCreate",i),a=kt(e,"onCreate",i),s=kt(e,"onUpdate",i),o=kt(e,"onSelectionUpdate",i),l=kt(e,"onTransaction",i),c=kt(e,"onFocus",i),d=kt(e,"onBlur",i),f=kt(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)})}};NS.resolve=wW;NS.sort=NP;NS.flatten=CP;var _Se={};MP(_Se,{ClipboardTextSerializer:()=>DW,Commands:()=>OW,Delete:()=>LW,Drop:()=>kW,Editable:()=>IW,FocusEvents:()=>FW,Keymap:()=>zW,Paste:()=>BW,Tabindex:()=>jW,TextDirection:()=>HW,focusEventsPluginKey:()=>UW});var Fn=class PW extends DP{constructor(){super(...arguments),this.type="extension"}static create(e={}){const n=typeof e=="function"?e():e;return new PW(n)}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}},DW=Fn.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new di({key:new ar("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=EW(n);return MW(i,{from:s,to:o},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:l})}}})]}}),OW=Fn.create({name:"commands",addCommands(){return{...hW}}}),LW=Fn.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=bW(t.before,[t,...e]);TW(d).forEach(m=>{d.mapping.mapResult(m.oldRange.from).deletedAfter&&d.mapping.mapResult(m.oldRange.to).deletedBefore&&d.before.nodesBetween(m.oldRange.from,m.oldRange.to,(y,b)=>{const x=b+y.nodeSize-2,v=m.oldRange.from<=b&&x<=m.oldRange.to;this.editor.emit("delete",{type:"node",node:y,from:b,to:x,newFrom:d.mapping.map(b),newTo:d.mapping.map(x),deletedRange:m.oldRange,newRange:m.newRange,partial:!v,editor:this.editor,transaction:t,combinedTransform:d})})});const p=d.mapping;d.steps.forEach((m,y)=>{var b,x;if(m instanceof uo){const v=p.slice(y).map(m.from,-1),M=p.slice(y).map(m.to),w=p.invert().map(v,-1),E=p.invert().map(M),T=(b=d.doc.nodeAt(v-1))==null?void 0:b.marks.some(R=>R.eq(m.mark)),P=(x=d.doc.nodeAt(M))==null?void 0:x.marks.some(R=>R.eq(m.mark));this.editor.emit("delete",{type:"mark",mark:m.mark,from:m.from,to:m.to,deletedRange:{from:w,to:E},newRange:{from:v,to:M},partial:!!(P||T),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()}}),kW=Fn.create({name:"drop",addProseMirrorPlugins(){return[new di({key:new ar("tiptapDrop"),props:{handleDrop:(t,e,n,i)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:n,moved:i})}}})]}}),IW=Fn.create({name:"editable",addProseMirrorPlugins(){return[new di({key:new ar("editable"),props:{editable:()=>this.editor.options.editable}})]}}),UW=new ar("focusEvents"),FW=Fn.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:t}=this;return[new di({key:UW,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}}}})]}}),zW=Fn.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:p,parent:m}=f,y=f.parent.isTextblock&&p>0?o.doc.resolve(p-1):f,b=y.parent.type.spec.isolating,x=f.pos-f.parentOffset,v=b&&y.parent.childCount===1?x===f.pos:en.atStart(c).from===p;return!d||!m.type.isTextblock||m.textContent.length||!v||v&&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 TP()||xW()?a:r},addProseMirrorPlugins(){return[new di({key:new ar("clearDocument"),appendTransaction:(t,e,n)=>{if(t.some(b=>b.getMeta("composition")))return;const i=t.some(b=>b.docChanged)&&!e.doc.eq(n.doc),r=t.some(b=>b.getMeta("preventClearDocument"));if(!i||r)return;const{empty:a,from:s,to:o}=e.selection,l=en.atStart(e.doc).from,c=en.atEnd(e.doc).to;if(a||!(s===l&&o===c)||!CS(n.doc))return;const p=n.tr,m=MS({state:n,transaction:p}),{commands:y}=new ES({editor:this.editor,state:m});if(y.clearNodes(),!!p.steps.length)return p}})]}}),BW=Fn.create({name:"paste",addProseMirrorPlugins(){return[new di({key:new ar("tiptapPaste"),props:{handlePaste:(t,e,n)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:n})}}})]}}),jW=Fn.create({name:"tabindex",addProseMirrorPlugins(){return[new di({key:new ar("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}}),HW=Fn.create({name:"textDirection",addOptions(){return{direction:void 0}},addGlobalAttributes(){if(!this.options.direction)return[];const{nodeExtensions:t}=Np(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 di({key:new ar("textDirection"),props:{attributes:()=>{const t=this.options.direction;return t?{dir:t}:{}}}})]}}),SSe=class Xh{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 Xh(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 Xh(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 Xh(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 Xh(o,this.editor,r,r?n:null);r&&(l.actualDepth=this.depth+1),e.push(new Xh(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)}},wSe=`.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 MSe(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 ESe=class extends dSe{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=gW(e,this.options.autofocus);this.editorState=ep.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=MSe(wSe,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=_W(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?[IW,DW.configure({blockSeparator:(e=(t=this.options.coreExtensionOptions)==null?void 0:t.clipboardTextSerializer)==null?void 0:e.blockSeparator}),OW,FW,zW,jW,kW,BW,LW,HW.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 NS(i,this)}createCommandManager(){this.commandManager=new ES({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let t;try{t=ZR(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=ZR(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}return t}createView(t){var e;this.editorView=new dW(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 AW(this.state,t)}isActive(t,e){const n=typeof t=="string"?t:null,i=typeof t=="string"?e:t;return j1e(this.state,n,i)}getJSON(){return this.state.doc.toJSON()}getHTML(){return RP(this.state.doc.content,this.schema)}getText(t){const{blockSeparator:e=`
  8128. `,textSerializers:n={}}=t||{};return k1e(this.state.doc,{blockSeparator:e,textSerializers:{...EW(this.schema),...n}})}get isEmpty(){return CS(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 SSe(e,this)}get $doc(){return this.$pos(0)}};function Pp(t){return new RS({find:t.find,handler:({state:e,range:n,match:i})=>{const r=Tn(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(PP(n.from,n.to,e.doc).filter(m=>m.mark.type.excluded.find(b=>b===t.type&&b!==m.mark.type)).filter(m=>m.to>c).length)return null;d<n.to&&a.delete(d,n.to),c>n.from&&a.delete(n.from+l,c);const p=n.from+l+s.length;a.addMark(n.from+l,p,t.type.create(r||{})),a.removeStoredMark(t.type)}},undoable:t.undoable})}function VW(t){return new RS({find:t.find,handler:({state:e,range:n,match:i})=>{const r=Tn(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 QR(t){return new RS({find:t.find,handler:({state:e,range:n,match:i})=>{const r=e.doc.resolve(n.from),a=Tn(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 Dp(t){return new RS({find:t.find,handler:({state:e,range:n,match:i,chain:r})=>{const a=Tn(t.getAttributes,void 0,i)||{},s=e.tr.delete(n.from,n.to),l=s.doc.resolve(n.from).blockRange(),c=l&&lP(l,t.type,a);if(!c)return null;if(s.wrap(l,c),t.keepMarks&&t.editor){const{selection:f,storedMarks:p}=e,{splittableMarks:m}=t.editor.extensionManager,y=p||f.$to.parentOffset&&f.$from.marks();if(y){const b=y.filter(x=>m.includes(x.type.name));s.ensureMarks(b)}}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&&Bu(s.doc,n.from-1)&&(!t.joinPredicate||t.joinPredicate(i,d))&&s.join(n.from-1)},undoable:t.undoable})}var ASe=t=>"touches"in t,TSe=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,ASe(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 CSe(t,e){const{selection:n}=t,{$from:i}=n;if(n instanceof It){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 RSe={};MP(RSe,{createAtomBlockMarkdownSpec:()=>NSe,createBlockMarkdownSpec:()=>PSe,createInlineMarkdownSpec:()=>LSe,parseAttributes:()=>OP,parseIndentedBlocks:()=>e3,renderNestedMarkdownContent:()=>kP,serializeAttributes:()=>LP});function OP(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 p=parseInt(((f=d.match(/__QUOTED_(\d+)__/))==null?void 0:f[1])||"0",10),m=n[p];m&&(e[c]=m.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 LP(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 NSe(t){const{nodeName:e,name:n,parseAttributes:i=OP,serializeAttributes:r=LP,defaultAttributes:a={},requiredAttributes:s=[],allowedAttributes:o}=t,l=n||e,c=d=>{if(!o)return d;const f={};return o.forEach(p=>{p in d&&(f[p]=d[p])}),f};return{parseMarkdown:(d,f)=>{const p={...a,...d.attributes};return f.createNode(e,p,[])},markdownTokenizer:{name:e,level:"block",start(d){var f;const p=new RegExp(`^:::${l}(?:\\s|$)`,"m"),m=(f=d.match(p))==null?void 0:f.index;return m!==void 0?m:-1},tokenize(d,f,p){const m=new RegExp(`^:::${l}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`),y=d.match(m);if(!y)return;const b=y[1]||"",x=i(b);if(!s.find(M=>!(M in x)))return{type:e,raw:y[0],attributes:x}}},renderMarkdown:d=>{const f=c(d.attrs||{}),p=r(f),m=p?` {${p}}`:"";return`:::${l}${m} :::`}}}function PSe(t){const{nodeName:e,name:n,getContent:i,parseAttributes:r=OP,serializeAttributes:a=LP,defaultAttributes:s={},content:o="block",allowedAttributes:l}=t,c=n||e,d=f=>{if(!l)return f;const p={};return l.forEach(m=>{m in f&&(p[m]=f[m])}),p};return{parseMarkdown:(f,p)=>{let m;if(i){const b=i(f);m=typeof b=="string"?[{type:"text",text:b}]:b}else o==="block"?m=p.parseChildren(f.tokens||[]):m=p.parseInline(f.tokens||[]);const y={...s,...f.attributes};return p.createNode(e,y,m)},markdownTokenizer:{name:e,level:"block",start(f){var p;const m=new RegExp(`^:::${c}`,"m"),y=(p=f.match(m))==null?void 0:p.index;return y!==void 0?y:-1},tokenize(f,p,m){var y;const b=new RegExp(`^:::${c}(?:\\s+\\{([^}]*)\\})?\\s*\\n`),x=f.match(b);if(!x)return;const[v,M=""]=x,w=r(M);let E=1;const T=v.length;let P="";const R=/^:::([\w-]*)(\s.*)?/gm,U=f.slice(T);for(R.lastIndex=0;;){const N=R.exec(U);if(N===null)break;const O=N.index,B=N[1];if(!((y=N[2])!=null&&y.endsWith(":::"))){if(B)E+=1;else if(E-=1,E===0){const I=U.slice(0,O);P=I.trim();const W=f.slice(0,T+O+N[0].length);let L=[];if(P)if(o==="block")for(L=m.blockTokens(I),L.forEach($=>{$.text&&(!$.tokens||$.tokens.length===0)&&($.tokens=m.inlineTokens($.text))});L.length>0;){const $=L[L.length-1];if($.type==="paragraph"&&(!$.text||$.text.trim()===""))L.pop();else break}else L=m.inlineTokens(P);return{type:e,raw:W,attributes:w,content:P,tokens:L}}}}}},renderMarkdown:(f,p)=>{const m=d(f.attrs||{}),y=a(m),b=y?` {${y}}`:"",x=p.renderChildren(f.content||[],`
  8129. `);return`:::${c}${b}
  8130. ${x}
  8131. :::`}}}function DSe(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 OSe(t){return Object.entries(t).filter(([,e])=>e!=null).map(([e,n])=>`${e}="${n}"`).join(" ")}function LSe(t){const{nodeName:e,name:n,getContent:i,parseAttributes:r=DSe,serializeAttributes:a=OSe,defaultAttributes:s={},selfClosing:o=!1,allowedAttributes:l}=t,c=n||e,d=p=>{if(!l)return p;const m={};return l.forEach(y=>{y in p&&(m[y]=p[y])}),m},f=c.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{parseMarkdown:(p,m)=>{const y={...s,...p.attributes};if(o)return m.createNode(e,y);const b=i?i(p):p.content||"";return b?m.createNode(e,y,[m.createTextNode(b)]):m.createNode(e,y,[])},markdownTokenizer:{name:e,level:"inline",start(p){const m=o?new RegExp(`\\[${f}\\s*[^\\]]*\\]`):new RegExp(`\\[${f}\\s*[^\\]]*\\][\\s\\S]*?\\[\\/${f}\\]`),y=p.match(m),b=y?.index;return b!==void 0?b:-1},tokenize(p,m,y){const b=o?new RegExp(`^\\[${f}\\s*([^\\]]*)\\]`):new RegExp(`^\\[${f}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${f}\\]`),x=p.match(b);if(!x)return;let v="",M="";if(o){const[,E]=x;M=E}else{const[,E,T]=x;M=E,v=T||""}const w=r(M.trim());return{type:e,raw:x[0],content:v.trim(),attributes:w}}},renderMarkdown:p=>{let m="";i?m=i(p):p.content&&p.content.length>0&&(m=p.content.filter(v=>v.type==="text").map(v=>v.text).join(""));const y=d(p.attrs||{}),b=a(y),x=b?` ${b}`:"";return o?`[${c}${x}]`:`[${c}${x}]${m}[/${c}]`}}}function e3(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 p=o[d],m=p.match(e.itemPattern);if(!m){if(l.length>0)break;if(p.trim()===""){d+=1,c=`${c}${p}
  8133. `;continue}else return}const y=e.extractItemData(m),{indentLevel:b,mainContent:x}=y;c=`${c}${p}
  8134. `;const v=[x];for(d+=1;d<o.length;){const T=o[d];if(T.trim()===""){const R=o.slice(d+1).findIndex(O=>O.trim()!=="");if(R===-1)break;if((((r=(i=o[d+1+R].match(/^(\s*)/))==null?void 0:i[1])==null?void 0:r.length)||0)>b){v.push(T),c=`${c}${T}
  8135. `,d+=1;continue}else break}if((((s=(a=T.match(/^(\s*)/))==null?void 0:a[1])==null?void 0:s.length)||0)>b)v.push(T),c=`${c}${T}
  8136. `,d+=1;else break}let M;const w=v.slice(1);if(w.length>0){const T=w.map(P=>P.slice(b+f)).join(`
  8137. `);T.trim()&&(e.customNestedParser?M=e.customNestedParser(T):M=n.blockTokens(T))}const E=e.createToken(y,M);l.push(E)}if(l.length!==0)return{items:l,raw:c}}function kP(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(p=>p?e.indent(p):"").join(`
  8139. `);l.push(f)}}),l.join(`
  8140. `)}function kSe(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(m=>{if(m!==s)return!1;f=m}),!f)return;let p=!1;if(Object.keys(n).forEach(m=>{n[m]!==f.attrs[m]&&(p=!0)}),p){const m=t.type.create({...t.attrs,...n});a.removeMark(c,d,t.type),a.addMark(c,d,m)}}),a.docChanged&&e.view.dispatch(a)}var Ia=class GW extends DP{constructor(){super(...arguments),this.type="node"}static create(e={}){const n=typeof e=="function"?e():e;return new GW(n)}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}};function mf(t){return new gSe({find:t.find,handler:({state:e,range:n,match:i,pasteEvent:r})=>{const a=Tn(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),p=f+o.length;if(PP(n.from,n.to,e.doc).filter(y=>y.mark.type.excluded.find(x=>x===t.type&&x!==y.mark.type)).filter(y=>y.to>f).length)return null;p<n.to&&s.delete(p,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 wT,C5;function ISe(){return C5||(C5=1,wT=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}),wT}var USe=ISe();const FSe=Vs(USe);var MT={exports:{}},ET={};var R5;function zSe(){if(R5)return ET;R5=1;var t=Hp(),e=F$();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 ET.useSyncExternalStoreWithSelector=function(c,d,f,p,m){var y=a(null);if(y.current===null){var b={hasValue:!1,value:null};y.current=b}else b=y.current;y=o(function(){function v(P){if(!M){if(M=!0,w=P,P=p(P),m!==void 0&&b.hasValue){var R=b.value;if(m(R,P))return E=R}return E=P}if(R=E,i(w,P))return R;var U=p(P);return m!==void 0&&m(R,U)?(w=P,R):(w=P,E=U)}var M=!1,w,E,T=f===void 0?null:f;return[function(){return v(d())},T===null?void 0:function(){return v(T())}]},[d,f,p,m]);var x=r(c,y[0],y[1]);return s(function(){b.hasValue=!0,b.value=x},[x]),l(x),x},ET}var N5;function BSe(){return N5||(N5=1,MT.exports=zSe()),MT.exports}var $W=BSe(),jSe=(...t)=>e=>{t.forEach(n=>{typeof n=="function"?n(e):n&&(n.current=e)})},HSe=({contentComponent:t})=>{const e=z$.useSyncExternalStore(t.subscribe,t.getSnapshot,t.getServerSnapshot);return S.jsx(S.Fragment,{children:Object.values(e)})};function VSe(){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]:Ute.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 GSe=class extends yi.Component{constructor(t){var e;super(t),this.editorContentRef=yi.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=VSe(),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 S.jsxs(S.Fragment,{children:[S.jsx("div",{ref:jSe(e,this.editorContentRef),...n}),t?.contentComponent&&S.jsx(HSe,{contentComponent:t.contentComponent})]})}},$Se=C.forwardRef((t,e)=>{const n=yi.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[t.editor]);return yi.createElement(GSe,{key:n,innerRef:e,...t})}),WSe=yi.memo($Se),qSe=typeof window<"u"?C.useLayoutEffect:C.useEffect,XSe=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 YSe(t){var e;const[n]=C.useState(()=>new XSe(t.editor)),i=$W.useSyncExternalStoreWithSelector(n.subscribe,n.getSnapshot,n.getServerSnapshot,t.selector,(e=t.equalityFn)!=null?e:FSe);return qSe(()=>n.watch(t.editor),[t.editor,n]),C.useDebugValue(i),i}var KSe=!1,t3=typeof window>"u",ZSe=t3||!!(typeof window<"u"&&window.next),JSe=class WW{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?t3||ZSe?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 ESe(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?WW.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 QSe(t={},e=[]){const n=C.useRef(t);n.current=t;const[i]=C.useState(()=>new JSe(n)),r=z$.useSyncExternalStore(i.subscribe,i.getEditor,i.getServerSnapshot);return C.useDebugValue(r),C.useEffect(i.onRender(e)),YSe({editor:r,selector:({transactionNumber:a})=>t.shouldRerenderOnTransaction===!1||t.shouldRerenderOnTransaction===void 0?null:t.immediatelyRender&&a===0?0:a+1}),r}var ewe=C.createContext({editor:null});ewe.Consumer;var twe=C.createContext({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}}),nwe=()=>C.useContext(twe);yi.forwardRef((t,e)=>{const{onDragStart:n}=nwe(),i=t.as||"div";return S.jsx(i,{...t,ref:e,"data-node-view-wrapper":"",onDragStart:n,style:{whiteSpace:"normal",...t.style}})});yi.createContext({markViewContentRef:()=>{}});var R_=(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]},iwe=/^\s*>\s$/,rwe=Ia.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:t}){return R_("blockquote",{...Si(this.options.HTMLAttributes,t),children:R_("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[Dp({find:iwe,type:this.type})]}}),awe=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,swe=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,owe=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,lwe=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,cwe=Hu.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 R_("strong",{...Si(this.options.HTMLAttributes,t),children:R_("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[Pp({find:awe,type:this.type}),Pp({find:owe,type:this.type})]},addPasteRules(){return[mf({find:swe,type:this.type}),mf({find:lwe,type:this.type})]}}),uwe=/(^|[^`])`([^`]+)`(?!`)$/,dwe=/(^|[^`])`([^`]+)`(?!`)/g,fwe=Hu.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:t}){return["code",Si(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[Pp({find:uwe,type:this.type})]},addPasteRules(){return[mf({find:dwe,type:this.type})]}}),AT=4,hwe=/^```([a-z]+)?[\s\n]$/,pwe=/^~~~([a-z]+)?[\s\n]$/,mwe=Ia.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:AT,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",Si(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:AT,{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,m=i.doc.textBetween(c,d,`
  8147. `,`
  8148. `).split(`
  8149. `).map(y=>o+y).join(`
  8150. `);return l.replaceWith(c,d,i.schema.text(m)),!0})},"Shift-Tab":({editor:t})=>{var e;if(!this.options.enableTabIndentation)return!1;const n=(e=this.options.tabSize)!=null?e:AT,{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(),m=i.doc.textBetween(d,f,`
  8151. `,`
  8152. `).split(`
  8153. `);let y=0,b=0;const x=c-d;for(let P=0;P<m.length;P+=1){if(b+m[P].length>=x){y=P;break}b+=m[P].length+1}const M=((l=m[y].match(/^ */))==null?void 0:l[0])||"",w=Math.min(M.length,n);if(w===0)return!0;let E=d;for(let P=0;P<y;P+=1)E+=m[P].length+1;return o.delete(E,E+w),c-E<=w&&o.setSelection(Bt.create(o.doc,E)),!0}):t.commands.command(({tr:o})=>{const{from:l,to:c}=r,p=i.doc.textBetween(l,c,`
  8154. `,`
  8155. `).split(`
  8156. `).map(m=>{var y;const b=((y=m.match(/^ */))==null?void 0:y[0])||"",x=Math.min(b.length,n);return m.slice(x)}).join(`
  8157. `);return o.replaceWith(l,c,i.schema.text(p)),!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(en.near(i.resolve(o))),!0)):t.commands.exitCode()}}},addInputRules(){return[QR({find:hwe,type:this.type,getAttributes:t=>({language:t[1]})}),QR({find:pwe,type:this.type,getAttributes:t=>({language:t[1]})})]},addProseMirrorPlugins(){return[new di({key:new ar("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(Bt.near(s.doc.resolve(Math.max(0,s.selection.from-2)))),s.setMeta("paste",!0),t.dispatch(s),!0}}})]}}),gwe=Ia.create({name:"doc",topNode:!0,content:"block+",renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
  8160. `):""}),vwe=Ia.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",Si(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(p=>o.includes(p.type.name));c.ensureMarks(f)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),xwe=Ia.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]}`,Si(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=>QR({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${t}})\\s$`),type:this.type,getAttributes:{level:t}}))}}),ywe=Ia.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{},nextNodeType:"paragraph"}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:t}){return["hr",Si(this.options.HTMLAttributes,t)]},markdownTokenName:"hr",parseMarkdown:(t,e)=>e.createNode("horizontalRule"),renderMarkdown:()=>"---",addCommands(){return{setHorizontalRule:()=>({chain:t,state:e})=>{if(!CSe(e,e.schema.nodes[this.name]))return!1;const{selection:n}=e,{$to:i}=n,r=t();return CW(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(Bt.create(s.doc,l.pos+1)):l.nodeAfter.isBlock?s.setSelection(It.create(s.doc,l.pos)):s.setSelection(Bt.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(Bt.create(s.doc,c+1)))}s.scrollIntoView()}return!0}).run()}}},addInputRules(){return[VW({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),bwe=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,_we=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,Swe=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,wwe=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,Mwe=Hu.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",Si(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[Pp({find:bwe,type:this.type}),Pp({find:Swe,type:this.type})]},addPasteRules(){return[mf({find:_we,type:this.type}),mf({find:wwe,type:this.type})]}});const Ewe="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",Awe="ελ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",n3="numeric",i3="ascii",r3="alpha",Zg="asciinumeric",Fg="alphanumeric",a3="domain",qW="emoji",Twe="scheme",Cwe="slashscheme",TT="whitespace";function Rwe(t,e){return t in e||(e[t]=[]),e[t]}function Id(t,e,n){e[n3]&&(e[Zg]=!0,e[Fg]=!0),e[i3]&&(e[Zg]=!0,e[r3]=!0),e[Zg]&&(e[Fg]=!0),e[r3]&&(e[Fg]=!0),e[Fg]&&(e[a3]=!0),e[qW]&&(e[a3]=!0);for(const i in e){const r=Rwe(i,n);r.indexOf(t)<0&&r.push(t)}}function Nwe(t,e){const n={};for(const i in e)e[i].indexOf(t)>=0&&(n[i]=!0);return n}function Ra(t=null){this.j={},this.jr=[],this.jd=null,this.t=t}Ra.groups={};Ra.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||Ra.groups;let r;return e&&e.j?r=e:(r=new Ra(e),n&&i&&Id(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||Ra.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 Ra,Object.assign(s.j,o.j),s.jr.push.apply(s.jr,o.jr),s.jd=o.jd,s.t=o.t):s=new Ra,a){if(i)if(s.t&&typeof s.t=="string"){const l=Object.assign(Nwe(s.t,i),n);Id(a,l,i)}else n&&Id(a,n,i);s.t=a}return r.j[t]=s,s}};const Kt=(t,e,n,i,r)=>t.ta(e,n,i,r),gi=(t,e,n,i,r)=>t.tr(e,n,i,r),P5=(t,e,n,i,r)=>t.ts(e,n,i,r),ht=(t,e,n,i,r)=>t.tt(e,n,i,r),Nl="WORD",s3="UWORD",XW="ASCIINUMERICAL",YW="ALPHANUMERICAL",D0="LOCALHOST",o3="TLD",l3="UTLD",Hb="SCHEME",Yh="SLASH_SCHEME",IP="NUM",c3="WS",UP="NL",Jg="OPENBRACE",Qg="CLOSEBRACE",N_="OPENBRACKET",P_="CLOSEBRACKET",D_="OPENPAREN",O_="CLOSEPAREN",L_="OPENANGLEBRACKET",k_="CLOSEANGLEBRACKET",I_="FULLWIDTHLEFTPAREN",U_="FULLWIDTHRIGHTPAREN",F_="LEFTCORNERBRACKET",z_="RIGHTCORNERBRACKET",B_="LEFTWHITECORNERBRACKET",j_="RIGHTWHITECORNERBRACKET",H_="FULLWIDTHLESSTHAN",V_="FULLWIDTHGREATERTHAN",G_="AMPERSAND",$_="APOSTROPHE",W_="ASTERISK",ru="AT",q_="BACKSLASH",X_="BACKTICK",Y_="CARET",du="COLON",FP="COMMA",K_="DOLLAR",To="DOT",Z_="EQUALS",zP="EXCLAMATION",ws="HYPHEN",e0="PERCENT",J_="PIPE",Q_="PLUS",e1="POUND",t0="QUERY",BP="QUOTE",KW="FULLWIDTHMIDDLEDOT",jP="SEMI",Co="SLASH",n0="TILDE",t1="UNDERSCORE",ZW="EMOJI",n1="SYM";var JW=Object.freeze({__proto__:null,ALPHANUMERICAL:YW,AMPERSAND:G_,APOSTROPHE:$_,ASCIINUMERICAL:XW,ASTERISK:W_,AT:ru,BACKSLASH:q_,BACKTICK:X_,CARET:Y_,CLOSEANGLEBRACKET:k_,CLOSEBRACE:Qg,CLOSEBRACKET:P_,CLOSEPAREN:O_,COLON:du,COMMA:FP,DOLLAR:K_,DOT:To,EMOJI:ZW,EQUALS:Z_,EXCLAMATION:zP,FULLWIDTHGREATERTHAN:V_,FULLWIDTHLEFTPAREN:I_,FULLWIDTHLESSTHAN:H_,FULLWIDTHMIDDLEDOT:KW,FULLWIDTHRIGHTPAREN:U_,HYPHEN:ws,LEFTCORNERBRACKET:F_,LEFTWHITECORNERBRACKET:B_,LOCALHOST:D0,NL:UP,NUM:IP,OPENANGLEBRACKET:L_,OPENBRACE:Jg,OPENBRACKET:N_,OPENPAREN:D_,PERCENT:e0,PIPE:J_,PLUS:Q_,POUND:e1,QUERY:t0,QUOTE:BP,RIGHTCORNERBRACKET:z_,RIGHTWHITECORNERBRACKET:j_,SCHEME:Hb,SEMI:jP,SLASH:Co,SLASH_SCHEME:Yh,SYM:n1,TILDE:n0,TLD:o3,UNDERSCORE:t1,UTLD:l3,UWORD:s3,WORD:Nl,WS:c3});const Al=/[a-z]/,bg=new RegExp("\\p{L}","u"),CT=new RegExp("\\p{Emoji}","u"),Tl=/\d/,RT=/\s/,D5="\r",NT=`
  8163. `,Pwe="️",Dwe="‍",PT="";let ab=null,sb=null;function Owe(t=[]){const e={};Ra.groups=e;const n=new Ra;ab==null&&(ab=O5(Ewe)),sb==null&&(sb=O5(Awe)),ht(n,"'",$_),ht(n,"{",Jg),ht(n,"}",Qg),ht(n,"[",N_),ht(n,"]",P_),ht(n,"(",D_),ht(n,")",O_),ht(n,"<",L_),ht(n,">",k_),ht(n,"(",I_),ht(n,")",U_),ht(n,"「",F_),ht(n,"」",z_),ht(n,"『",B_),ht(n,"』",j_),ht(n,"<",H_),ht(n,">",V_),ht(n,"&",G_),ht(n,"*",W_),ht(n,"@",ru),ht(n,"`",X_),ht(n,"^",Y_),ht(n,":",du),ht(n,",",FP),ht(n,"$",K_),ht(n,".",To),ht(n,"=",Z_),ht(n,"!",zP),ht(n,"-",ws),ht(n,"%",e0),ht(n,"|",J_),ht(n,"+",Q_),ht(n,"#",e1),ht(n,"?",t0),ht(n,'"',BP),ht(n,"/",Co),ht(n,";",jP),ht(n,"~",n0),ht(n,"_",t1),ht(n,"\\",q_),ht(n,"・",KW);const i=gi(n,Tl,IP,{[n3]:!0});gi(i,Tl,i);const r=gi(i,Al,XW,{[Zg]:!0}),a=gi(i,bg,YW,{[Fg]:!0}),s=gi(n,Al,Nl,{[i3]:!0});gi(s,Tl,r),gi(s,Al,s),gi(r,Tl,r),gi(r,Al,r);const o=gi(n,bg,s3,{[r3]:!0});gi(o,Al),gi(o,Tl,a),gi(o,bg,o),gi(a,Tl,a),gi(a,Al),gi(a,bg,a);const l=ht(n,NT,UP,{[TT]:!0}),c=ht(n,D5,c3,{[TT]:!0}),d=gi(n,RT,c3,{[TT]:!0});ht(n,PT,d),ht(c,NT,l),ht(c,PT,d),gi(c,RT,d),ht(d,D5),ht(d,NT),gi(d,RT,d),ht(d,PT,d);const f=gi(n,CT,ZW,{[qW]:!0});ht(f,"#"),gi(f,CT,f),ht(f,Pwe,f);const p=ht(f,Dwe);ht(p,"#"),gi(p,CT,f);const m=[[Al,s],[Tl,r]],y=[[Al,null],[bg,o],[Tl,a]];for(let b=0;b<ab.length;b++)Qc(n,ab[b],o3,Nl,m);for(let b=0;b<sb.length;b++)Qc(n,sb[b],l3,s3,y);Id(o3,{tld:!0,ascii:!0},e),Id(l3,{utld:!0,alpha:!0},e),Qc(n,"file",Hb,Nl,m),Qc(n,"mailto",Hb,Nl,m),Qc(n,"http",Yh,Nl,m),Qc(n,"https",Yh,Nl,m),Qc(n,"ftp",Yh,Nl,m),Qc(n,"ftps",Yh,Nl,m),Id(Hb,{scheme:!0,ascii:!0},e),Id(Yh,{slashscheme:!0,ascii:!0},e),t=t.sort((b,x)=>b[0]>x[0]?1:-1);for(let b=0;b<t.length;b++){const x=t[b][0],M=t[b][1]?{[Twe]:!0}:{[Cwe]:!0};x.indexOf("-")>=0?M[a3]=!0:Al.test(x)?Tl.test(x)?M[Zg]=!0:M[i3]=!0:M[n3]=!0,P5(n,x,x,M)}return P5(n,"localhost",D0,{ascii:!0}),n.jd=new Ra(n1),{start:n,tokens:Object.assign({groups:e},JW)}}function QW(t,e){const n=Lwe(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,p=-1;for(;s<i&&(l=o.go(n[s]));)o=l,o.accepts()?(f=0,p=0,d=o):f>=0&&(f+=n[s].length,p++),c+=n[s].length,a+=n[s].length,s++;a-=f,s-=p,c-=f,r.push({t:d.t,v:e.slice(a-c,a),s:a-c,e:a})}return r}function Lwe(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 Qc(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 Ra(i),a.jr=r.slice(),t.j[l]=a),t=a}return a=new Ra(n),a.jr=r.slice(),t.j[e[s-1]]=a,a}function O5(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 O0={defaultProtocol:"http",events:null,format:L5,formatHref:L5,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function HP(t,e=null){let n=Object.assign({},O0);t&&(n=Object.assign(n,t instanceof HP?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}HP.prototype={o:O0,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]:O0[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 L5(t){return t}function e7(t,e){this.t="token",this.v=t,this.tk=e}e7.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=O0.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 PS(t,e){class n extends e7{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 k5=PS("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),I5=PS("text"),kwe=PS("nl"),ob=PS("url",{isLink:!0,toHref(t=O0.defaultProtocol){return this.hasProtocol()?this.v:`${t}://${this.v}`},hasProtocol(){const t=this.tk;return t.length>=2&&t[0].t!==D0&&t[1].t===du}}),ys=t=>new Ra(t);function Iwe({groups:t}){const e=t.domain.concat([G_,W_,ru,q_,X_,Y_,K_,Z_,ws,IP,e0,J_,Q_,e1,Co,n1,n0,t1]),n=[$_,du,FP,To,zP,e0,t0,BP,jP,L_,k_,Jg,Qg,P_,N_,D_,O_,I_,U_,F_,z_,B_,j_,H_,V_],i=[G_,$_,W_,q_,X_,Y_,K_,Z_,ws,Jg,Qg,e0,J_,Q_,e1,t0,Co,n1,n0,t1],r=ys(),a=ht(r,n0);Kt(a,i,a),Kt(a,t.domain,a);const s=ys(),o=ys(),l=ys();Kt(r,t.domain,s),Kt(r,t.scheme,o),Kt(r,t.slashscheme,l),Kt(s,i,a),Kt(s,t.domain,s);const c=ht(s,ru);ht(a,ru,c),ht(o,ru,c),ht(l,ru,c);const d=ht(a,To);Kt(d,i,a),Kt(d,t.domain,a);const f=ys();Kt(c,t.domain,f),Kt(f,t.domain,f);const p=ht(f,To);Kt(p,t.domain,f);const m=ys(k5);Kt(p,t.tld,m),Kt(p,t.utld,m),ht(c,D0,m);const y=ht(f,ws);ht(y,ws,y),Kt(y,t.domain,f),Kt(m,t.domain,f),ht(m,To,p),ht(m,ws,y);const b=ht(m,du);Kt(b,t.numeric,k5);const x=ht(s,ws),v=ht(s,To);ht(x,ws,x),Kt(x,t.domain,s),Kt(v,i,a),Kt(v,t.domain,s);const M=ys(ob);Kt(v,t.tld,M),Kt(v,t.utld,M),Kt(M,t.domain,s),Kt(M,i,a),ht(M,To,v),ht(M,ws,x),ht(M,ru,c);const w=ht(M,du),E=ys(ob);Kt(w,t.numeric,E);const T=ys(ob),P=ys();Kt(T,e,T),Kt(T,n,P),Kt(P,e,T),Kt(P,n,P),ht(M,Co,T),ht(E,Co,T);const R=ht(o,du),U=ht(l,du),N=ht(U,Co),O=ht(N,Co);Kt(o,t.domain,s),ht(o,To,v),ht(o,ws,x),Kt(l,t.domain,s),ht(l,To,v),ht(l,ws,x),Kt(R,t.domain,T),ht(R,Co,T),ht(R,t0,T),Kt(O,t.domain,T),Kt(O,e,T),ht(O,Co,T);const B=[[Jg,Qg],[N_,P_],[D_,O_],[L_,k_],[I_,U_],[F_,z_],[B_,j_],[H_,V_]];for(let I=0;I<B.length;I++){const[W,L]=B[I],$=ht(T,W);ht(P,W,$),ht($,L,T);const q=ys(ob);Kt($,e,q);const G=ys();Kt($,n),Kt(q,e,q),Kt(q,n,G),Kt(G,e,q),Kt(G,n,G),ht(q,L,T),ht(G,L,T)}return ht(r,D0,M),ht(r,UP,kwe),{start:r,tokens:JW}}function Uwe(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,p=-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()?(p=0,f=o):p>=0&&p++,r++,d++;if(p<0)r-=d,r<i&&(s.push(n[r]),r++);else{s.length>0&&(a.push(DT(I5,e,s)),s=[]),r-=p,d-=p;const m=f.t,y=n.slice(r-d,r);a.push(DT(m,e,y))}}return s.length>0&&a.push(DT(I5,e,s)),a}function DT(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 Fwe=typeof console<"u"&&console&&console.warn||(()=>{}),zwe="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",Zn={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function Bwe(){return Ra.groups={},Zn.scanner=null,Zn.parser=null,Zn.tokenQueue=[],Zn.pluginQueue=[],Zn.customSchemes=[],Zn.initialized=!1,Zn}function U5(t,e=!1){if(Zn.initialized&&Fwe(`linkifyjs: already initialized - will not register custom scheme "${t}" ${zwe}`),!/^[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`);Zn.customSchemes.push([t,e])}function jwe(){Zn.scanner=Owe(Zn.customSchemes);for(let t=0;t<Zn.tokenQueue.length;t++)Zn.tokenQueue[t][1]({scanner:Zn.scanner});Zn.parser=Iwe(Zn.scanner.tokens);for(let t=0;t<Zn.pluginQueue.length;t++)Zn.pluginQueue[t][1]({scanner:Zn.scanner,parser:Zn.parser});return Zn.initialized=!0,Zn}function VP(t){return Zn.initialized||jwe(),Uwe(Zn.parser.start,t,QW(Zn.scanner.start,t))}VP.scan=QW;function t7(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 HP(n),r=VP(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 GP="[\0-   ᠎ -\u2029  ]",Hwe=new RegExp(GP),Vwe=new RegExp(`${GP}$`),Gwe=new RegExp(GP,"g");function $we(t){return t.length===1?t[0].isLink:t.length===3&&t[1].isLink?["()","[]"].includes(t[0].value+t[2].value):!1}function Wwe(t){return new di({key:new ar("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=bW(n.doc,[...e]);if(TW(o).forEach(({newRange:c})=>{const d=R1e(i.doc,c,m=>m.isTextblock);let f,p;if(d.length>1)f=d[0],p=i.doc.textBetween(f.pos,f.pos+f.node.nodeSize,void 0," ");else if(d.length){const m=i.doc.textBetween(c.from,c.to," "," ");if(!Vwe.test(m))return;f=d[0],p=i.doc.textBetween(f.pos,c.to,void 0," ")}if(f&&p){const m=p.split(Hwe).filter(Boolean);if(m.length<=0)return!1;const y=m[m.length-1],b=f.pos+p.lastIndexOf(y);if(!y)return!1;const x=VP(y).map(v=>v.toObject(t.defaultProtocol));if(!$we(x))return!1;x.filter(v=>v.isLink).map(v=>({...v,from:b+v.start+1,to:b+v.end+1})).filter(v=>i.schema.marks.code?!i.doc.rangeHasMark(v.from,v.to,i.schema.marks.code):!0).filter(v=>t.validate(v.value)).filter(v=>t.shouldAutoLink(v.value)).forEach(v=>{PP(v.from,v.to,i.doc).some(M=>M.mark.type===t.type)||s.addMark(v.from,v.to,t.type.create({href:v.href}))})}}),!!s.steps.length)return s}})}function qwe(t){return new di({key:new ar("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(p=>p.nodeName==="A")}if(!s)return!1;const o=AW(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 Xwe(t){return new di({key:new ar("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=t7(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 yd(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(Gwe,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}var n7=Hu.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"){U5(t);return}U5(t.scheme,t.optionalSlashes)})},onDestroy(){Bwe()},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)=>!!yd(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=>!!yd(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=>!!yd(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",Si(this.options.HTMLAttributes,t),0]:["a",Si(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=>!!yd(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=>!!yd(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[mf({find:t=>{const e=[];if(t){const{protocols:n,defaultProtocol:i}=this.options,r=t7(t).filter(a=>a.isLink&&this.options.isAllowedUri(a.value,{defaultValidate:s=>!!yd(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(Wwe({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:i=>this.options.isAllowedUri(i,{defaultValidate:r=>!!yd(r,e),protocols:e,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),this.options.openOnClick===!0&&t.push(qwe({type:this.type,editor:this.editor,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&t.push(Xwe({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),t}}),Ywe=n7,Kwe=Object.defineProperty,Zwe=(t,e)=>{for(var n in e)Kwe(t,n,{get:e[n],enumerable:!0})},Jwe="listItem",F5="textStyle",z5=/^\s*([-+*])\s$/,i7=Ia.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",Si(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(Jwe,this.editor.getAttributes(F5)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let t=Dp({find:z5,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(t=Dp({find:z5,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(F5),editor:this.editor})),[t]}}),r7=Ia.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:t}){return["li",Si(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)=>kP(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)}}}),Qwe={};Zwe(Qwe,{findListItemPos:()=>uv,getNextListDepth:()=>$P,handleBackspace:()=>u3,handleDelete:()=>d3,hasListBefore:()=>a7,hasListItemAfter:()=>eMe,hasListItemBefore:()=>s7,listItemHasSubList:()=>o7,nextListIsDeeper:()=>l7,nextListIsHigher:()=>c7});var uv=(t,e)=>{const{$from:n}=e.selection,i=Wi(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}},$P=(t,e)=>{const n=uv(t,e);if(!n)return!1;const[,i]=z1e(e,t,n.$pos.pos+4);return i},a7=(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))},s7=(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)},o7=(t,e,n)=>{if(!n)return!1;const i=Wi(t,e.schema);let r=!1;return n.descendants(a=>{a.type===i&&(r=!0)}),r},u3=(t,e,n)=>{if(t.commands.undoInputRule())return!0;if(t.state.selection.from!==t.state.selection.to)return!1;if(!Lu(t.state,e)&&a7(t.state,e,n)){const{$anchor:o}=t.state.selection,l=t.state.doc.resolve(o.before()-1),c=[];l.node().descendants((p,m)=>{p.type.name===e&&c.push({node:p,pos:m})});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(!Lu(t.state,e)||!V1e(t.state))return!1;const i=uv(e,t.state);if(!i)return!1;const a=t.state.doc.resolve(i.$pos.pos-2).node(i.depth),s=o7(e,t.state,a);return s7(e,t.state)&&!s?t.commands.joinItemBackward():t.chain().liftListItem(e).run()},l7=(t,e)=>{const n=$P(t,e),i=uv(t,e);return!i||!n?!1:n>i.depth},c7=(t,e)=>{const n=$P(t,e),i=uv(t,e);return!i||!n?!1:n<i.depth},d3=(t,e)=>{if(!Lu(t.state,e)||!H1e(t.state,e))return!1;const{selection:n}=t.state,{$from:i,$to:r}=n;return!n.empty&&i.sameParent(r)?!1:l7(e,t.state)?t.chain().focus(t.state.selection.from+4).lift(e).joinBackward().run():c7(e,t.state)?t.chain().joinForward().joinBackward().run():t.commands.joinItemForward()},eMe=(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)},u7=Fn.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&&d3(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&&d3(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&&u3(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&&u3(t,n,i)&&(e=!0)}),e}}}}),B5=/^(\s*)(\d+)\.\s+(.*)$/,tMe=/^\s/;function nMe(t){const e=[];let n=0,i=0;for(;n<t.length;){const r=t[n],a=r.match(B5);if(!a)break;const[,s,o,l]=a,c=s.length;let d=l,f=n+1;const p=[r];for(;f<t.length;){const m=t[f];if(m.match(B5))break;if(m.trim()==="")p.push(m),d+=`
  8168. `,f+=1;else if(m.match(tMe))p.push(m),d+=`
  8169. ${m.slice(c+2)}`,f+=1;else break}e.push({indent:c,number:parseInt(o,10),content:d.trim(),raw:p.join(`
  8170. `)}),i=f,n=f}return[e,i]}function d7(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 m=n.blockTokens(d);c.push(...m)}let f=a+1;const p=[];for(;f<t.length&&t[f].indent>e;)p.push(t[f]),f+=1;if(p.length>0){const m=Math.min(...p.map(b=>b.indent)),y=d7(p,m,n);c.push({type:"list",ordered:!0,start:p[0].number,items:y,raw:p.map(b=>b.raw).join(`
  8173. `)})}r.push({type:"list_item",raw:s.raw,tokens:c}),a=f}else a+=1}return r}function iMe(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 rMe="listItem",j5="textStyle",H5=/^(\d+)\.\s$/,f7=Ia.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",Si(this.options.HTMLAttributes,n),0]:["ol",Si(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?iMe(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]=nMe(r);if(a.length===0)return;const o=d7(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(rMe,this.editor.getAttributes(j5)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let t=Dp({find:H5,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=Dp({find:H5,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(j5)}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1],editor:this.editor})),[t]}}),aMe=/^\s*(\[([( |x])?\])\s$/,sMe=Ia.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",Si(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 kP(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,p;o.ariaLabel=((p=(f=this.options.a11y)==null?void 0:f.checkboxLabel)==null?void 0:p.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:p})=>{const m=n();if(typeof m!="number")return!1;const y=p.doc.nodeAt(m);return p.setNodeMarkup(m,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[Dp({find:aMe,type:this.type,getAttributes:t=>({checked:t[t.length-1]==="x"})})]}}),oMe=Ia.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",Si(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=e3(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=e3(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()}}});Fn.create({name:"listKit",addExtensions(){const t=[];return this.options.bulletList!==!1&&t.push(i7.configure(this.options.bulletList)),this.options.listItem!==!1&&t.push(r7.configure(this.options.listItem)),this.options.listKeymap!==!1&&t.push(u7.configure(this.options.listKeymap)),this.options.orderedList!==!1&&t.push(f7.configure(this.options.orderedList)),this.options.taskItem!==!1&&t.push(sMe.configure(this.options.taskItem)),this.options.taskList!==!1&&t.push(oMe.configure(this.options.taskList)),t}});var lMe=Ia.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",Si(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()}}}),cMe=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,uMe=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,dMe=Hu.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",Si(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[Pp({find:cMe,type:this.type})]},addPasteRules(){return[mf({find:uMe,type:this.type})]}}),fMe=Ia.create({name:"text",group:"inline",parseMarkdown:t=>({type:"text",text:t.text||""}),renderMarkdown:t=>t.text||""}),h7=Hu.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",Si(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()}}}),hMe=h7;function pMe(t={}){return new di({view(e){return new mMe(e,t)}})}class mMe{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,p=e.nodeAfter;if(f||p){let m=this.editorView.nodeDOM(this.cursorPos-(f?f.nodeSize:0));if(m){let y=m.getBoundingClientRect(),b=f?y.bottom:y.top;f&&p&&(b=(b+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let x=this.width/2*o;i={left:y.left,right:y.right,top:b-x,bottom:b+x}}}}if(!i){let f=this.editorView.coordsAtPos(this.cursorPos),p=this.width/2*s;i={left:f.left-p,right:f.left+p,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(),p=f.width/l.offsetWidth,m=f.height/l.offsetHeight;c=f.left-l.scrollLeft*p,d=f.top-l.scrollTop*m}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=f9(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 xi extends en{constructor(e){super(e,e)}map(e,n){let i=e.resolve(n.map(this.head));return xi.valid(i)?new xi(i):en.near(i)}content(){return wt.empty}eq(e){return e instanceof xi&&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 xi(e.resolve(n.pos))}getBookmark(){return new WP(this.anchor)}static valid(e){let n=e.parent;if(n.isTextblock||!gMe(e)||!vMe(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&&xi.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(xi.valid(l))return l}for(;;){let s=n>0?a.firstChild:a.lastChild;if(!s){if(a.isAtom&&!a.isText&&!It.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(xi.valid(o))return o}return null}}}xi.prototype.visible=!1;xi.findFrom=xi.findGapCursorFrom;en.jsonID("gapcursor",xi);class WP{constructor(e){this.pos=e}map(e){return new WP(e.map(this.pos))}resolve(e){let n=e.resolve(this.pos);return xi.valid(n)?new xi(n):en.near(n)}}function p7(t){return t.isAtom||t.spec.isolating||t.spec.createGapCursor}function gMe(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||p7(r.type))return!0;if(r.inlineContent)return!1}}return!0}function vMe(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||p7(r.type))return!0;if(r.inlineContent)return!1}}return!0}function xMe(){return new di({props:{decorations:SMe,createSelectionBetween(t,e,n){return e.pos==n.pos&&xi.valid(n)?new xi(n):null},handleClick:bMe,handleKeyDown:yMe,handleDOMEvents:{beforeinput:_Me}}})}const yMe=fW({ArrowLeft:lb("horiz",-1),ArrowRight:lb("horiz",1),ArrowUp:lb("vert",-1),ArrowDown:lb("vert",1)});function lb(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 Bt){if(!a.endOfTextblock(n)||o.depth==0)return!1;l=!1,o=i.doc.resolve(e>0?o.after():o.before())}let c=xi.findGapCursorFrom(o,e,l);return c?(r&&r(i.tr.setSelection(new xi(c))),!0):!1}}function bMe(t,e,n){if(!t||!t.editable)return!1;let i=t.state.doc.resolve(e);if(!xi.valid(i))return!1;let r=t.posAtCoords({left:n.clientX,top:n.clientY});return r&&r.inside>-1&&It.isSelectable(t.state.doc.nodeAt(r.inside))?!1:(t.dispatch(t.state.tr.setSelection(new xi(i))),!0)}function _Me(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof xi))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=lt.empty;for(let s=i.length-1;s>=0;s--)r=lt.from(i[s].createAndFill(null,r));let a=t.state.tr.replace(n.pos,n.pos,new wt(r,0,0));return a.setSelection(Bt.near(a.doc.resolve(n.pos+1))),t.dispatch(a),!1}function SMe(t){if(!(t.selection instanceof xi))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",oi.create(t.doc,[da.widget(t.selection.head,e,{key:"gapcursor"})])}var i1=200,Mr=function(){};Mr.prototype.append=function(e){return e.length?(e=Mr.from(e),!this.length&&e||e.length<i1&&this.leafAppend(e)||this.length<i1&&e.leafPrepend(this)||this.appendInner(e)):this};Mr.prototype.prepend=function(e){return e.length?Mr.from(e).append(this):this};Mr.prototype.appendInner=function(e){return new wMe(this,e)};Mr.prototype.slice=function(e,n){return e===void 0&&(e=0),n===void 0&&(n=this.length),e>=n?Mr.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,n))};Mr.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};Mr.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)};Mr.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};Mr.from=function(e){return e instanceof Mr?e:e&&e.length?new m7(e):Mr.empty};var m7=(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<=i1)return new e(this.values.concat(r.flatten()))},e.prototype.leafPrepend=function(r){if(this.length+r.length<=i1)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})(Mr);Mr.empty=new m7([]);var wMe=(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})(Mr);const MMe=500;class ro{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,p)=>{if(!f.step){r||(r=this.remapping(i,p+1),a=r.maps.length),a--,d.push(f);return}if(r){d.push(new Ro(f.map));let m=f.step.map(r.slice(a)),y;m&&s.maybeStep(m).doc&&(y=s.mapping.maps[s.mapping.maps.length-1],c.push(new Ro(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 ro(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]),p=new Ro(e.mapping.maps[d],f,n),m;(m=l&&l.merge(p))&&(p=m,d?a.pop():o=o.slice(0,o.length-1)),a.push(p),n&&(s++,n=void 0),r||(l=p)}let c=s-i.depth;return c>AMe&&(o=EMe(o,c),s-=c),new ro(o.append(a),s)}remapping(e,n){let i=new A0;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 ro(this.items.append(e.map(n=>new Ro(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(p=>{p.selection&&o--},r);let l=n;this.items.forEach(p=>{let m=a.getMirror(--l);if(m==null)return;s=Math.min(s,m);let y=a.maps[m];if(p.step){let b=e.steps[m].invert(e.docs[m]),x=p.selection&&p.selection.map(a.slice(l+1,m));x&&o++,i.push(new Ro(y,b,x))}else i.push(new Ro(y))},r);let c=[];for(let p=n;p<s;p++)c.push(new Ro(a.maps[p]));let d=this.items.slice(0,r).append(c).append(i),f=new ro(d,o);return f.emptyItemCount()>MMe&&(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 Ro(c.invert(),l,d),p,m=r.length-1;(p=r.length&&r[m].merge(f))?r[m]=p:r.push(f)}}else s.map&&i--},this.items.length,0),new ro(Mr.from(r.reverse()),a)}}ro.empty=new ro(Mr.empty,0);function EMe(t,e){let n;return t.forEach((i,r)=>{if(i.selection&&e--==0)return n=r,!1}),t.slice(n)}class Ro{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 Ro(n.getMap().invert(),n,this.selection)}}}class au{constructor(e,n,i,r,a){this.done=e,this.undone=n,this.prevRanges=i,this.prevTime=r,this.prevComposition=a}}const AMe=20;function TMe(t,e,n,i){let r=n.getMeta(qd),a;if(r)return r.historyState;n.getMeta(NMe)&&(t=new au(t.done,t.undone,null,0,-1));let s=n.getMeta("appendedTransaction");if(n.steps.length==0)return t;if(s&&s.getMeta(qd))return s.getMeta(qd).redo?new au(t.done.addTransform(n,void 0,i,Vb(e)),t.undone,V5(n.mapping.maps),t.prevTime,t.prevComposition):new au(t.done,t.undone.addTransform(n,void 0,i,Vb(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||!CMe(n,t.prevRanges)),c=s?OT(t.prevRanges,n.mapping):V5(n.mapping.maps);return new au(t.done.addTransform(n,l?e.selection.getBookmark():void 0,i,Vb(e)),ro.empty,c,n.time,o??t.prevComposition)}else return(a=n.getMeta("rebased"))?new au(t.done.rebased(n,a),t.undone.rebased(n,a),OT(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new au(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),OT(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function CMe(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 V5(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 OT(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 RMe(t,e,n){let i=Vb(e),r=qd.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 au(n?o:a.remaining,n?a.remaining:o,null,0,-1);return a.transform.setSelection(s).setMeta(qd,{redo:n,historyState:l})}let LT=!1,G5=null;function Vb(t){let e=t.plugins;if(G5!=e){LT=!1,G5=e;for(let n=0;n<e.length;n++)if(e[n].spec.historyPreserveItems){LT=!0;break}}return LT}const qd=new ar("history"),NMe=new ar("closeHistory");function PMe(t={}){return t={depth:t.depth||100,newGroupDelay:t.newGroupDelay||500},new di({key:qd,state:{init(){return new au(ro.empty,ro.empty,null,0,-1)},apply(e,n,i){return TMe(n,i,e,t)}},config:t,props:{handleDOMEvents:{beforeinput(e,n){let i=n.inputType,r=i=="historyUndo"?v7:i=="historyRedo"?x7:null;return!r||!e.editable?!1:(n.preventDefault(),r(e.state,e.dispatch))}}}})}function g7(t,e){return(n,i)=>{let r=qd.getState(n);if(!r||(t?r.undone:r.done).eventCount==0)return!1;if(i){let a=RMe(r,n,t);a&&i(e?a.scrollIntoView():a)}return!0}}const v7=g7(!1,!0),x7=g7(!0,!0);Fn.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 di({key:new ar("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 DMe=Fn.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[pMe(this.options)]}});Fn.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new di({key:new ar("focus"),props:{decorations:({doc:t,selection:e})=>{const{isEditable:n,isFocused:i}=this.editor,{anchor:r}=e,a=[];if(!n||!i)return oi.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(da.node(c,c+l.nodeSize,{class:this.options.className}))}),oi.create(t,a)}}})]}});var OMe=Fn.create({name:"gapCursor",addProseMirrorPlugins(){return[xMe()]},extendNodeSchema(t){var e;const n={name:t.name,options:t.options,storage:t.storage};return{allowGapCursor:(e=Tn(kt(t,"allowGapCursor",n)))!=null?e:null}}});Fn.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[new di({key:new ar("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&&CS(s);if((l||!this.options.showOnlyCurrent)&&c){const d=[this.options.emptyNodeClass];a&&d.push(this.options.emptyEditorClass);const f=da.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}),oi.create(t,r)}}})]}});Fn.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:t,options:e}=this;return[new di({key:new ar("selection"),props:{decorations(n){return n.selection.empty||t.isFocused||!t.isEditable||CW(n.selection)||t.view.dragging?null:oi.create(n.doc,[da.inline(n.selection.from,n.selection.to,{class:e.className})])}}})]}});function $5({types:t,node:e}){return e&&Array.isArray(t)&&t.includes(e.type)||e?.type===t}var LMe=Fn.create({name:"trailingNode",addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){var t;const e=new ar(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 di({key:e,appendTransaction:(r,a,s)=>{const{doc:o,tr:l,schema:c}=s,d=e.getState(s),f=o.content.size,p=c.nodes[n];if(d)return l.insert(f,p.create())},state:{init:(r,a)=>{const s=a.tr.doc.lastChild;return!$5({node:s,types:i})},apply:(r,a)=>{if(!r.docChanged||r.getMeta("__uniqueIDTransaction"))return a;const s=r.doc.lastChild;return!$5({node:s,types:i})}}})]}}),kMe=Fn.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:t,dispatch:e})=>v7(t,e),redo:()=>({state:t,dispatch:e})=>x7(t,e)}},addProseMirrorPlugins(){return[PMe(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()}}}),IMe=Fn.create({name:"starterKit",addExtensions(){var t,e,n,i;const r=[];return this.options.bold!==!1&&r.push(cwe.configure(this.options.bold)),this.options.blockquote!==!1&&r.push(rwe.configure(this.options.blockquote)),this.options.bulletList!==!1&&r.push(i7.configure(this.options.bulletList)),this.options.code!==!1&&r.push(fwe.configure(this.options.code)),this.options.codeBlock!==!1&&r.push(mwe.configure(this.options.codeBlock)),this.options.document!==!1&&r.push(gwe.configure(this.options.document)),this.options.dropcursor!==!1&&r.push(DMe.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&r.push(OMe.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&r.push(vwe.configure(this.options.hardBreak)),this.options.heading!==!1&&r.push(xwe.configure(this.options.heading)),this.options.undoRedo!==!1&&r.push(kMe.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&r.push(ywe.configure(this.options.horizontalRule)),this.options.italic!==!1&&r.push(Mwe.configure(this.options.italic)),this.options.listItem!==!1&&r.push(r7.configure(this.options.listItem)),this.options.listKeymap!==!1&&r.push(u7.configure((t=this.options)==null?void 0:t.listKeymap)),this.options.link!==!1&&r.push(n7.configure((e=this.options)==null?void 0:e.link)),this.options.orderedList!==!1&&r.push(f7.configure(this.options.orderedList)),this.options.paragraph!==!1&&r.push(lMe.configure(this.options.paragraph)),this.options.strike!==!1&&r.push(dMe.configure(this.options.strike)),this.options.text!==!1&&r.push(fMe.configure(this.options.text)),this.options.underline!==!1&&r.push(h7.configure((n=this.options)==null?void 0:n.underline)),this.options.trailingNode!==!1&&r.push(LMe.configure((i=this.options)==null?void 0:i.trailingNode)),r}}),UMe=IMe,FMe=Fn.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")}}}),zMe=FMe,BMe=20,y7=(t,e=0)=>{const n=[];return!t.children.length||e>BMe||Array.from(t.children).forEach(i=>{i.tagName==="SPAN"?n.push(i):i.children.length&&n.push(...y7(i,e+1))}),n},jMe=t=>{if(!t.children.length)return;const e=y7(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}`)})},b7=Hu.create({name:"textStyle",priority:101,addOptions(){return{HTMLAttributes:{},mergeNestedSpanStyles:!0}},parseHTML(){return[{tag:"span",consuming:!1,getAttrs:t=>t.hasAttribute("style")?(this.options.mergeNestedSpanStyles&&jMe(t),{}):!1}]},renderHTML({HTMLAttributes:t}){return["span",Si(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}}}}),HMe=Fn.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()}}}),_7=Fn.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()}}}),VMe=Fn.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()}}}),GMe=Fn.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()}}}),$Me=Fn.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()}}});Fn.create({name:"textStyleKit",addExtensions(){const t=[];return this.options.backgroundColor!==!1&&t.push(HMe.configure(this.options.backgroundColor)),this.options.color!==!1&&t.push(_7.configure(this.options.color)),this.options.fontFamily!==!1&&t.push(VMe.configure(this.options.fontFamily)),this.options.fontSize!==!1&&t.push(GMe.configure(this.options.fontSize)),this.options.lineHeight!==!1&&t.push($Me.configure(this.options.lineHeight)),this.options.textStyle!==!1&&t.push(b7.configure(this.options.textStyle)),t}});var WMe=_7,qMe=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,XMe=Ia.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",Si(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 TSe({element:o,node:r,getPos:a,onResize:(d,f)=>{o.style.width=`${d}px`,o.style.height=`${f}px`},onCommit:(d,f)=>{const p=a();p!==void 0&&this.editor.chain().setNodeSelection(p).updateAttributes(this.name,{width:d,height:f}).run()},onUpdate:(d,f,p)=>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[VW({find:qMe,type:this.type,getAttributes:t=>{const[,,e,n,i]=t;return{src:n,alt:e,title:i}}})]}}),YMe=XMe;function W5({content:t,onChange:e,placeholder:n}){const i=QSe({extensions:[UMe.configure({heading:!1,codeBlock:!1,code:!1}),hMe,Ywe.configure({openOnClick:!1,HTMLAttributes:{target:"_blank",rel:"noopener noreferrer"}}),zMe.configure({types:["paragraph"]}),b7,WMe,YMe.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})=>S.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 S.jsxs("div",{className:"border border-bambu-dark-tertiary rounded-lg overflow-hidden bg-bambu-dark",children:[S.jsxs("div",{className:"flex items-center gap-0.5 p-1.5 border-b border-bambu-dark-tertiary bg-bambu-dark-secondary",children:[S.jsx(r,{onClick:()=>i.chain().focus().toggleBold().run(),isActive:i.isActive("bold"),title:"Bold",children:S.jsx(One,{className:"w-4 h-4"})}),S.jsx(r,{onClick:()=>i.chain().focus().toggleItalic().run(),isActive:i.isActive("italic"),title:"Italic",children:S.jsx(Lie,{className:"w-4 h-4"})}),S.jsx(r,{onClick:()=>i.chain().focus().toggleUnderline().run(),isActive:i.isActive("underline"),title:"Underline",children:S.jsx(Qre,{className:"w-4 h-4"})}),S.jsx("div",{className:"w-px h-5 bg-bambu-dark-tertiary mx-1"}),S.jsx(r,{onClick:()=>i.chain().focus().toggleBulletList().run(),isActive:i.isActive("bulletList"),title:"Bullet List",children:S.jsx(uG,{className:"w-4 h-4"})}),S.jsx(r,{onClick:()=>i.chain().focus().toggleOrderedList().run(),isActive:i.isActive("orderedList"),title:"Numbered List",children:S.jsx(Gie,{className:"w-4 h-4"})}),S.jsx("div",{className:"w-px h-5 bg-bambu-dark-tertiary mx-1"}),S.jsx(r,{onClick:()=>i.chain().focus().setTextAlign("left").run(),isActive:i.isActive({textAlign:"left"}),title:"Align Left",children:S.jsx(Xre,{className:"w-4 h-4"})}),S.jsx(r,{onClick:()=>i.chain().focus().setTextAlign("center").run(),isActive:i.isActive({textAlign:"center"}),title:"Align Center",children:S.jsx(Gre,{className:"w-4 h-4"})}),S.jsx(r,{onClick:()=>i.chain().focus().setTextAlign("right").run(),isActive:i.isActive({textAlign:"right"}),title:"Align Right",children:S.jsx(Wre,{className:"w-4 h-4"})}),S.jsx("div",{className:"w-px h-5 bg-bambu-dark-tertiary mx-1"}),S.jsx(r,{onClick:a,isActive:i.isActive("link"),title:"Add Link",children:S.jsx(Hie,{className:"w-4 h-4"})}),i.isActive("link")&&S.jsx(r,{onClick:()=>i.chain().focus().unsetLink().run(),title:"Remove Link",children:S.jsx(tae,{className:"w-4 h-4"})})]}),S.jsx(WSe,{editor:i})]})}function KMe({archiveId:t,archiveName:e,onClose:n}){const i=Hr(),[r,a]=C.useState(!1),[s,o]=C.useState(null),[l,c]=C.useState({}),{data:d,isLoading:f,error:p}=ei({queryKey:["archive-project-page",t],queryFn:()=>vt.getArchiveProjectPage(t)}),m=Gn({mutationFn:T=>vt.updateArchiveProjectPage(t,T),onSuccess:()=>{i.invalidateQueries({queryKey:["archive-project-page",t]}),a(!1),c({})}});C.useEffect(()=>{const T=P=>{P.key==="Escape"&&(s!==null?o(null):r?v():n())};return document.addEventListener("keydown",T),()=>document.removeEventListener("keydown",T)},[s,r,n]);const y=[...d?.model_pictures||[],...d?.profile_pictures||[]],b=()=>{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)},x=()=>{m.mutate(l)},v=()=>{a(!1),c({})},M=T=>{const P=["p","br","b","strong","i","em","u","a","ul","ol","li","figure","img"],R=new DOMParser().parseFromString(T,"text/html"),U=N=>{if(N.nodeType===Node.TEXT_NODE)return N.textContent||"";if(N.nodeType===Node.ELEMENT_NODE){const O=N,B=O.tagName.toLowerCase();if(!P.includes(B))return Array.from(O.childNodes).map(U).join("");let I="";if(B==="a"&&O.getAttribute("href")){const L=O.getAttribute("href");L?.toLowerCase().startsWith("http")&&(I=` href="${L}" target="_blank" rel="noopener noreferrer"`)}if(B==="img"){const L=O.getAttribute("src");if(!L?.toLowerCase().startsWith("http"))return"";I=` src="${L}" style="max-width: 100%; height: auto;"`}const W=Array.from(O.childNodes).map(U).join("");return["br","img"].includes(B)?`<${B}${I} />`:`<${B}${I}>${W}</${B}>`}return""};return Array.from(R.body.childNodes).map(U).join("")},w=d&&(d.title||d.description||d.designer||d.profile_title||y.length>0),E=T=>{T.target===T.currentTarget&&n()};return S.jsxs("div",{className:"fixed inset-0 bg-black/70 flex items-center justify-center z-50 p-4",onClick:E,children:[S.jsxs("div",{className:"bg-bambu-dark-secondary rounded-xl max-w-4xl w-full max-h-[90vh] overflow-hidden flex flex-col",children:[S.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-bambu-dark-tertiary",children:[S.jsxs("div",{className:"flex items-center gap-3",children:[S.jsx(Zh,{className:"w-5 h-5 text-bambu-green"}),S.jsxs("h2",{className:"text-lg font-semibold text-white",children:["Project Page",e&&S.jsxs("span",{className:"text-bambu-gray ml-2",children:["- ",e]})]})]}),S.jsxs("div",{className:"flex items-center gap-2",children:[!r&&w&&S.jsxs(xt,{variant:"ghost",size:"sm",onClick:b,children:[S.jsx(are,{className:"w-4 h-4 mr-1"}),"Edit"]}),r&&S.jsxs(S.Fragment,{children:[S.jsx(xt,{variant:"ghost",size:"sm",onClick:v,children:"Cancel"}),S.jsxs(xt,{variant:"primary",size:"sm",onClick:x,disabled:m.isPending,children:[S.jsx(sS,{className:"w-4 h-4 mr-1"}),"Save"]})]}),S.jsx("button",{onClick:n,className:"p-2 hover:bg-bambu-dark-tertiary rounded-lg transition-colors",children:S.jsx(_i,{className:"w-5 h-5 text-bambu-gray"})})]})]}),S.jsxs("div",{className:"flex-1 overflow-y-auto p-6",children:[f&&S.jsx("div",{className:"flex items-center justify-center py-12",children:S.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-2 border-bambu-green border-t-transparent"})}),p&&S.jsx("div",{className:"text-red-400 text-center py-12",children:"Failed to load project page data"}),d&&!w&&S.jsxs("div",{className:"text-bambu-gray text-center py-12",children:[S.jsx(Zh,{className:"w-12 h-12 mx-auto mb-4 opacity-50"}),S.jsx("p",{children:"No project page data found in this 3MF file."}),S.jsx("p",{className:"text-sm mt-2",children:"Project pages are typically included in files downloaded from MakerWorld."})]}),d&&w&&S.jsxs("div",{className:"space-y-6",children:[S.jsxs("div",{className:"space-y-4",children:[r?S.jsx("input",{type:"text",value:l.title||"",onChange:T=>c({...l,title:T.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&&S.jsx("h3",{className:"text-xl font-semibold text-white",children:d.title}),S.jsxs("div",{className:"flex flex-wrap gap-4 text-sm",children:[r?S.jsxs("div",{className:"flex items-center gap-2",children:[S.jsx(v4,{className:"w-4 h-4 text-bambu-gray"}),S.jsx("input",{type:"text",value:l.designer||"",onChange:T=>c({...l,designer:T.target.value}),placeholder:"Designer",className:"bg-bambu-dark border border-bambu-dark-tertiary rounded px-2 py-1 text-white"})]}):d.designer&&S.jsxs("div",{className:"flex items-center gap-2 text-bambu-gray",children:[S.jsx(v4,{className:"w-4 h-4"}),S.jsx("span",{children:d.designer}),d.designer_user_id&&S.jsx("a",{href:`https://makerworld.com/en/@${d.designer_user_id}`,target:"_blank",rel:"noopener noreferrer",className:"text-bambu-green hover:underline",children:S.jsx(gp,{className:"w-3 h-3"})})]}),d.creation_date&&S.jsxs("div",{className:"flex items-center gap-2 text-bambu-gray",children:[S.jsx(E2,{className:"w-4 h-4"}),S.jsx("span",{children:d.creation_date})]}),r?S.jsxs("div",{className:"flex items-center gap-2",children:[S.jsx(Zh,{className:"w-4 h-4 text-bambu-gray"}),S.jsx("input",{type:"text",value:l.license||"",onChange:T=>c({...l,license:T.target.value}),placeholder:"License",className:"bg-bambu-dark border border-bambu-dark-tertiary rounded px-2 py-1 text-white"})]}):d.license&&S.jsxs("div",{className:"flex items-center gap-2 text-bambu-gray",children:[S.jsx(Zh,{className:"w-4 h-4"}),S.jsx("span",{children:d.license})]}),d.origin&&S.jsx("span",{className:"px-2 py-0.5 bg-bambu-dark rounded text-bambu-gray",children:d.origin})]})]}),(d.description||r)&&S.jsxs("div",{className:"space-y-2",children:[S.jsx("h4",{className:"text-sm font-medium text-bambu-gray uppercase tracking-wide",children:"Description"}),r?S.jsx(W5,{content:l.description||"",onChange:T=>c({...l,description:T}),placeholder:"Enter description..."}):S.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)&&S.jsxs("div",{className:"space-y-2 p-4 bg-bambu-dark rounded-lg",children:[S.jsx("h4",{className:"text-sm font-medium text-bambu-gray uppercase tracking-wide",children:"Print Profile"}),r?S.jsxs("div",{className:"space-y-2",children:[S.jsx("input",{type:"text",value:l.profile_title||"",onChange:T=>c({...l,profile_title:T.target.value}),placeholder:"Profile Title",className:"w-full bg-bambu-dark-secondary border border-bambu-dark-tertiary rounded px-3 py-2 text-white"}),S.jsx(W5,{content:l.profile_description||"",onChange:T=>c({...l,profile_description:T}),placeholder:"Profile description..."})]}):S.jsxs(S.Fragment,{children:[d.profile_title&&S.jsx("p",{className:"text-white font-medium",children:d.profile_title}),d.profile_description&&S.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&&S.jsxs("p",{className:"text-sm text-bambu-gray",children:["by ",d.profile_user_name]})]})]}),y.length>0&&S.jsxs("div",{className:"space-y-2",children:[S.jsxs("h4",{className:"text-sm font-medium text-bambu-gray uppercase tracking-wide flex items-center gap-2",children:[S.jsx(rS,{className:"w-4 h-4"}),"Images (",y.length,")"]}),S.jsx("div",{className:"grid grid-cols-3 sm:grid-cols-4 md:grid-cols-5 gap-2",children:y.map((T,P)=>S.jsx("button",{onClick:()=>o(P),className:"aspect-square rounded-lg overflow-hidden border border-bambu-dark-tertiary hover:border-bambu-green transition-colors",children:S.jsx("img",{src:T.url,alt:T.name,className:"w-full h-full object-cover"})},T.path))})]}),d.design_model_id&&S.jsx("div",{className:"pt-4 border-t border-bambu-dark-tertiary",children:S.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:[S.jsx(gp,{className:"w-4 h-4"}),"View on MakerWorld"]})})]})]})]}),s!==null&&y[s]&&S.jsxs("div",{className:"fixed inset-0 bg-black/90 flex items-center justify-center z-60",onClick:()=>o(null),children:[S.jsx("button",{onClick:T=>{T.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:S.jsx(tf,{className:"w-6 h-6 text-white"})}),S.jsx("img",{src:y[s].url,alt:y[s].name,className:"max-w-[90vw] max-h-[90vh] object-contain",onClick:T=>T.stopPropagation()}),S.jsx("button",{onClick:T=>{T.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:S.jsx(Wp,{className:"w-6 h-6 text-white"})}),S.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:S.jsx(_i,{className:"w-6 h-6 text-white"})}),S.jsxs("div",{className:"absolute bottom-4 text-white text-sm",children:[s+1," / ",y.length]})]})]})}const ZMe=[.25,.5,.75,1,1.5,2,3,4];function JMe({src:t,title:e,downloadFilename:n,onClose:i}){const r=C.useRef(null),[a,s]=C.useState(!0),[o,l]=C.useState(.5),[c,d]=C.useState(0),[f,p]=C.useState(0);C.useEffect(()=>{const w=r.current;w&&(w.playbackRate=o)},[o]),C.useEffect(()=>{const w=r.current;if(!w)return;const E=()=>d(w.currentTime),T=()=>p(w.duration),P=()=>s(!0),R=()=>s(!1);return w.addEventListener("timeupdate",E),w.addEventListener("durationchange",T),w.addEventListener("play",P),w.addEventListener("pause",R),()=>{w.removeEventListener("timeupdate",E),w.removeEventListener("durationchange",T),w.removeEventListener("play",P),w.removeEventListener("pause",R)}},[]);const m=()=>{const w=r.current;w&&(a?w.pause():w.play())},y=w=>{const E=r.current;E&&(E.currentTime=parseFloat(w.target.value))},b=()=>{const w=r.current;w&&(w.currentTime=Math.max(0,w.currentTime-5))},x=()=>{const w=r.current;w&&(w.currentTime=Math.min(f,w.currentTime+5))},v=w=>{const E=Math.floor(w/60),T=Math.floor(w%60);return`${E}:${T.toString().padStart(2,"0")}`},M=()=>{const w=document.createElement("a");w.href=t,w.download=n,w.click()};return S.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/80",children:S.jsxs("div",{className:"relative bg-bambu-dark-secondary rounded-xl max-w-4xl w-full mx-4 overflow-hidden",children:[S.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-bambu-dark-tertiary",children:[S.jsxs("h3",{className:"text-lg font-semibold text-white flex items-center gap-2",children:[S.jsx(u0,{className:"w-5 h-5 text-bambu-green"}),e]}),S.jsxs("div",{className:"flex items-center gap-2",children:[S.jsxs(xt,{variant:"secondary",size:"sm",onClick:M,children:[S.jsx(nf,{className:"w-4 h-4"}),"Download"]}),S.jsx("button",{onClick:i,className:"p-1 hover:bg-bambu-dark-tertiary rounded transition-colors",children:S.jsx(_i,{className:"w-5 h-5 text-bambu-gray"})})]})]}),S.jsxs("div",{className:"p-4",children:[S.jsx("video",{ref:r,src:t,autoPlay:!0,className:"w-full rounded-lg",onClick:m}),S.jsxs("div",{className:"mt-4 space-y-3",children:[S.jsxs("div",{className:"flex items-center gap-3",children:[S.jsx("span",{className:"text-xs text-bambu-gray w-12 text-right",children:v(c)}),S.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`}),S.jsx("span",{className:"text-xs text-bambu-gray w-12",children:v(f)})]}),S.jsxs("div",{className:"flex items-center justify-between",children:[S.jsxs("div",{className:"flex items-center gap-2",children:[S.jsx("button",{onClick:b,className:"p-2 hover:bg-bambu-dark-tertiary rounded-lg transition-colors",title:"Skip back 5s",children:S.jsx(Rre,{className:"w-5 h-5 text-bambu-gray"})}),S.jsx("button",{onClick:m,className:"p-2 bg-bambu-green hover:bg-bambu-green-dark rounded-lg transition-colors",children:a?S.jsx(ire,{className:"w-5 h-5 text-white"}):S.jsx(dG,{className:"w-5 h-5 text-white"})}),S.jsx("button",{onClick:x,className:"p-2 hover:bg-bambu-dark-tertiary rounded-lg transition-colors",title:"Skip forward 5s",children:S.jsx(Pre,{className:"w-5 h-5 text-bambu-gray"})})]}),S.jsxs("div",{className:"flex items-center gap-2",children:[S.jsx("span",{className:"text-sm text-bambu-gray",children:"Speed:"}),S.jsx("div",{className:"flex gap-1",children:ZMe.map(w=>S.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 S7(t){return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/(1024*1024)).toFixed(1)} MB`}function _g(t){const e=Math.floor(t/3600),n=Math.floor(t%3600/60);return e>0?`${e}h ${n}m`:`${n}m`}function QMe(t){return new Date(t).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}function eEe({archive:t,printerName:e,isSelected:n,onSelect:i,selectionMode:r}){const a=Hr(),{showToast:s}=Mf(),[o,l]=C.useState(!1),[c,d]=C.useState(!1),[f,p]=C.useState(!1),[m,y]=C.useState(!1),[b,x]=C.useState(!1),[v,M]=C.useState(!1),[w,E]=C.useState(!1),[T,P]=C.useState(!1),[R,U]=C.useState(null),N=Gn({mutationFn:()=>vt.scanArchiveTimelapse(t.id),onSuccess:L=>{L.status==="attached"?(a.invalidateQueries({queryKey:["archives"]}),s(`Timelapse attached: ${L.filename}`)):L.status==="exists"?s("Timelapse already attached"):s(L.message||"No matching timelapse found","warning")},onError:L=>{s(L.message||"Failed to scan for timelapse","error")}}),O=Gn({mutationFn:()=>vt.deleteArchive(t.id),onSuccess:()=>{a.invalidateQueries({queryKey:["archives"]}),s("Archive deleted")},onError:()=>{s("Failed to delete archive","error")}}),B=Gn({mutationFn:()=>vt.toggleFavorite(t.id),onSuccess:L=>{a.invalidateQueries({queryKey:["archives"]}),s(L.is_favorite?"Added to favorites":"Removed from favorites")}}),I=L=>{L.preventDefault(),U({x:L.clientX,y:L.clientY})},W=[{label:"Print",icon:S.jsx(rf,{className:"w-4 h-4"}),onClick:()=>d(!0)},{label:"Open in Bambu Studio",icon:S.jsx(gp,{className:"w-4 h-4"}),onClick:()=>{const L=t.print_name||t.filename||"model",$=`${window.location.origin}${vt.getArchiveForSlicer(t.id,L)}`;window.location.href=`bambustudioopen://${encodeURIComponent($)}`}},{label:"View on MakerWorld",icon:S.jsx(C2,{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:S.jsx(c0,{className:"w-4 h-4"}),onClick:()=>l(!0)},{label:"View Timelapse",icon:S.jsx(u0,{className:"w-4 h-4"}),onClick:()=>x(!0),disabled:!t.timelapse_path},{label:"Scan for Timelapse",icon:S.jsx(wre,{className:"w-4 h-4"}),onClick:()=>N.mutate(),disabled:!t.printer_id||!!t.timelapse_path||N.isPending},{label:"Download",icon:S.jsx(nf,{className:"w-4 h-4"}),onClick:()=>{const L=document.createElement("a");L.href=vt.getArchiveDownload(t.id),L.download=`${t.print_name||t.filename}.3mf`,L.click()}},{label:"Copy Download Link",icon:S.jsx(T2,{className:"w-4 h-4"}),onClick:()=>{const L=`${window.location.origin}${vt.getArchiveDownload(t.id)}`;navigator.clipboard.writeText(L).then(()=>{s("Link copied to clipboard")}).catch(()=>{s("Failed to copy link","error")})}},{label:"QR Code",icon:S.jsx(xre,{className:"w-4 h-4"}),onClick:()=>M(!0)},{label:`View Photos${t.photos?.length?` (${t.photos.length})`:""}`,icon:S.jsx(A2,{className:"w-4 h-4"}),onClick:()=>E(!0),disabled:!t.photos?.length},{label:"Project Page",icon:S.jsx(Zh,{className:"w-4 h-4"}),onClick:()=>P(!0)},{label:"",divider:!0,onClick:()=>{}},{label:t.is_favorite?"Remove from Favorites":"Add to Favorites",icon:S.jsx(f0,{className:`w-4 h-4 ${t.is_favorite?"fill-yellow-400 text-yellow-400":""}`}),onClick:()=>B.mutate()},{label:"Edit",icon:S.jsx(m4,{className:"w-4 h-4"}),onClick:()=>y(!0)},{label:n?"Deselect":"Select",icon:n?S.jsx(e_,{className:"w-4 h-4"}):S.jsx(t_,{className:"w-4 h-4"}),onClick:()=>i(t.id)},{label:"",divider:!0,onClick:()=>{}},{label:"Delete",icon:S.jsx(Jl,{className:"w-4 h-4"}),onClick:()=>p(!0),danger:!0}];return S.jsxs(bi,{className:`relative flex flex-col ${n?"ring-2 ring-bambu-green":""}`,onContextMenu:I,children:[r&&S.jsx("button",{className:"absolute top-2 left-2 z-10 p-1 rounded bg-black/50 hover:bg-black/70 transition-colors",onClick:()=>i(t.id),children:n?S.jsx(e_,{className:"w-5 h-5 text-bambu-green"}):S.jsx(t_,{className:"w-5 h-5 text-white"})}),S.jsxs("div",{className:"aspect-video bg-bambu-dark relative flex-shrink-0 overflow-hidden rounded-t-xl",children:[t.thumbnail_path?S.jsx("img",{src:vt.getArchiveThumbnail(t.id),alt:t.print_name||t.filename,className:"w-full h-full object-cover"}):S.jsx("div",{className:"w-full h-full flex items-center justify-center",children:S.jsx(rS,{className:"w-12 h-12 text-bambu-dark-tertiary"})}),S.jsx("button",{className:"absolute top-2 right-2 p-1 rounded bg-black/50 hover:bg-black/70 transition-colors",onClick:L=>{L.stopPropagation(),B.mutate()},title:t.is_favorite?"Remove from favorites":"Add to favorites",children:S.jsx(f0,{className:`w-5 h-5 ${t.is_favorite?"text-yellow-400 fill-yellow-400":"text-white"}`})}),t.status==="failed"&&S.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&&S.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:[S.jsx(T2,{className:"w-3 h-3"}),"duplicate"]}),t.timelapse_path&&S.jsx("button",{className:"absolute bottom-2 right-2 p-1.5 rounded bg-black/60 hover:bg-black/80 transition-colors",onClick:L=>{L.stopPropagation(),x(!0)},title:"View timelapse",children:S.jsx(u0,{className:"w-4 h-4 text-bambu-green"})}),t.photos&&t.photos.length>0&&S.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:L=>{L.stopPropagation(),E(!0)},title:`View ${t.photos.length} photo${t.photos.length>1?"s":""}`,children:[S.jsx(A2,{className:"w-4 h-4 text-blue-400"}),t.photos.length>1&&S.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})]})]}),S.jsxs(Ri,{className:"p-4 flex-1 flex flex-col",children:[S.jsx("h3",{className:"font-medium text-white mb-1 truncate",children:t.print_name||t.filename}),S.jsx("p",{className:"text-xs text-bambu-gray mb-3",children:e}),S.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)&&S.jsxs("div",{className:"flex items-center gap-1.5 text-bambu-gray",title:t.time_accuracy?`Estimated: ${_g(t.print_time_seconds||0)}
  8181. Actual: ${_g(t.actual_time_seconds||0)}
  8182. Accuracy: ${t.time_accuracy.toFixed(0)}%`:t.actual_time_seconds?`Actual: ${_g(t.actual_time_seconds)}`:`Estimated: ${_g(t.print_time_seconds||0)}`,children:[S.jsx(nv,{className:"w-3 h-3"}),_g(t.actual_time_seconds||t.print_time_seconds||0),t.time_accuracy&&S.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&&S.jsxs("div",{className:"flex items-center gap-1.5 text-bambu-gray",children:[S.jsx(Qb,{className:"w-3 h-3"}),t.filament_used_grams.toFixed(1),"g"]}),t.layer_height&&S.jsxs("div",{className:"flex items-center gap-1.5 text-bambu-gray",children:[S.jsx(cG,{className:"w-3 h-3"}),t.layer_height,"mm"]}),t.filament_type&&S.jsxs("div",{className:"flex items-center gap-1.5 col-span-2",children:[S.jsx("span",{className:"text-bambu-gray text-xs",children:t.filament_type}),t.filament_color&&S.jsx("div",{className:"flex items-center gap-0.5 flex-wrap",children:t.filament_color.split(",").map((L,$)=>S.jsx("div",{className:"w-3 h-3 rounded-full border border-white/20",style:{backgroundColor:L},title:L},$))})]})]}),(t.tags||t.notes)&&S.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 mb-3",children:[t.notes&&S.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:S.jsx(Ire,{className:"w-3 h-3"})}),t.tags?.split(",").map((L,$)=>S.jsx("span",{className:"px-1.5 py-0.5 bg-bambu-dark-tertiary text-bambu-gray-light rounded text-xs",children:L.trim()},$))]}),S.jsx("div",{className:"flex-1"}),S.jsxs("div",{className:"flex items-center justify-between text-xs text-bambu-gray border-t border-bambu-dark-tertiary pt-3",children:[S.jsx("span",{children:QMe(t.created_at)}),S.jsx("span",{children:S7(t.file_size)})]}),S.jsxs("div",{className:"flex gap-1 mt-3",children:[S.jsxs(xt,{variant:"primary",size:"sm",className:"flex-1 min-w-0",onClick:()=>d(!0),children:[S.jsx(rf,{className:"w-3 h-3 flex-shrink-0"}),S.jsx("span",{className:"hidden sm:inline",children:"Print"})]}),S.jsx(xt,{variant:"secondary",size:"sm",className:"min-w-0 p-1 sm:p-1.5",onClick:()=>{const L=t.print_name||t.filename||"model",$=`${window.location.origin}${vt.getArchiveForSlicer(t.id,L)}`;window.location.href=`bambustudioopen://${encodeURIComponent($)}`},title:"Open in Bambu Studio",children:S.jsx(gp,{className:"w-3 h-3 sm:w-4 sm:h-4"})}),S.jsx(xt,{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:S.jsx(C2,{className:`w-3 h-3 sm:w-4 sm:h-4 ${t.makerworld_url?"":"opacity-20"}`})}),S.jsx(xt,{variant:"secondary",size:"sm",className:"min-w-0 p-1 sm:p-1.5",onClick:()=>l(!0),title:"3D Preview",children:S.jsx(c0,{className:"w-3 h-3 sm:w-4 sm:h-4"})}),S.jsx(xt,{variant:"secondary",size:"sm",className:"min-w-0 p-1 sm:p-1.5",onClick:()=>{const L=document.createElement("a");L.href=vt.getArchiveDownload(t.id),L.download=`${t.print_name||t.filename}.3mf`,L.click()},title:"Download",children:S.jsx(nf,{className:"w-3 h-3 sm:w-4 sm:h-4"})}),S.jsx(xt,{variant:"ghost",size:"sm",className:"min-w-0 p-1 sm:p-1.5",onClick:()=>y(!0),title:"Edit",children:S.jsx(m4,{className:"w-3 h-3 sm:w-4 sm:h-4"})}),S.jsx(xt,{variant:"ghost",size:"sm",className:"min-w-0 p-1 sm:p-1.5",onClick:()=>p(!0),title:"Delete",children:S.jsx(Jl,{className:"w-3 h-3 sm:w-4 sm:h-4 text-red-400"})})]})]}),m&&S.jsx(wxe,{archive:t,onClose:()=>y(!1)}),o&&S.jsx(yxe,{archiveId:t.id,title:t.print_name||t.filename,onClose:()=>l(!1)}),c&&S.jsx(bxe,{archiveId:t.id,archiveName:t.print_name||t.filename,onClose:()=>d(!1),onSuccess:()=>{}}),f&&S.jsx(qp,{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:()=>{O.mutate(),p(!1)},onCancel:()=>p(!1)}),R&&S.jsx(Mxe,{x:R.x,y:R.y,items:W,onClose:()=>U(null)}),b&&t.timelapse_path&&S.jsx(JMe,{src:vt.getArchiveTimelapse(t.id),title:`${t.print_name||t.filename} - Timelapse`,downloadFilename:`${t.print_name||t.filename}_timelapse.mp4`,onClose:()=>x(!1)}),v&&S.jsx(Pxe,{archiveId:t.id,archiveName:t.print_name||t.filename,onClose:()=>M(!1)}),w&&t.photos&&t.photos.length>0&&S.jsx(Dxe,{archiveId:t.id,archiveName:t.print_name||t.filename,photos:t.photos,onClose:()=>E(!1),onDelete:async L=>{try{await vt.deleteArchivePhoto(t.id,L),a.invalidateQueries({queryKey:["archives"]}),s("Photo deleted")}catch{s("Failed to delete photo","error")}}}),T&&S.jsx(KMe,{archiveId:t.id,archiveName:t.print_name||t.filename,onClose:()=>P(!1)})]})}const tEe=[{id:"all",label:"All Archives",icon:S.jsx(bie,{className:"w-4 h-4"})},{id:"recent",label:"Last 24 Hours",icon:S.jsx(nv,{className:"w-4 h-4"})},{id:"this-week",label:"This Week",icon:S.jsx(E2,{className:"w-4 h-4"})},{id:"this-month",label:"This Month",icon:S.jsx(E2,{className:"w-4 h-4"})},{id:"favorites",label:"Favorites",icon:S.jsx(f0,{className:"w-4 h-4"})},{id:"failed",label:"Failed Prints",icon:S.jsx(RN,{className:"w-4 h-4"})},{id:"duplicates",label:"Duplicates",icon:S.jsx(T2,{className:"w-4 h-4"})}];function nEe(){const t=Hr(),{showToast:e}=Mf(),n=C.useRef(null),[i,r]=C.useState(""),[a,s]=C.useState(null),[o,l]=C.useState(null),[c,d]=C.useState(new Set),[f,p]=C.useState("or"),[m,y]=C.useState(!1),[b,x]=C.useState(null),[v,M]=C.useState(!1),[w,E]=C.useState([]),[T,P]=C.useState(!1),[R,U]=C.useState(new Set),[N,O]=C.useState(!1),[B,I]=C.useState(!1),[W,L]=C.useState("grid"),[$,q]=C.useState("date-desc"),[G,Y]=C.useState("all"),{data:Q,isLoading:se}=ei({queryKey:["archives",a],queryFn:()=>vt.getArchives(a||void 0)}),{data:H}=ei({queryKey:["printers"],queryFn:vt.getPrinters}),X=Gn({mutationFn:async ie=>(await Promise.all(ie.map(we=>vt.deleteArchive(we))),ie.length),onSuccess:ie=>{t.invalidateQueries({queryKey:["archives"]}),U(new Set),e(`${ie} archive${ie!==1?"s":""} deleted`)},onError:()=>{e("Failed to delete archives","error")}}),re=new Map(H?.map(ie=>[ie.id,ie.name])||[]),ce=[...new Set(Q?.flatMap(ie=>ie.filament_type?.split(", ")||[]).filter(Boolean)||[])].sort(),ye=[...new Set(Q?.flatMap(ie=>ie.filament_color?.split(",")||[]).filter(Boolean)||[])],me=[...new Set(Q?.flatMap(ie=>ie.tags?.split(",").map(we=>we.trim())||[]).filter(Boolean)||[])].sort(),be=Q?.filter(ie=>{const we=new Date,ve=new Date(ie.created_at);let F=!0;switch(G){case"recent":F=we.getTime()-ve.getTime()<1440*60*1e3;break;case"this-week":F=we.getTime()-ve.getTime()<10080*60*1e3;break;case"this-month":F=ve.getMonth()===we.getMonth()&&ve.getFullYear()===we.getFullYear();break;case"favorites":F=ie.is_favorite===!0;break;case"failed":F=ie.status==="failed";break;case"duplicates":F=ie.duplicate_count>0;break}const k=(ie.print_name||ie.filename).toLowerCase().includes(i.toLowerCase()),K=!o||ie.filament_type?.split(", ").includes(o),pe=ie.filament_color?.split(",")||[],xe=c.size===0||(f==="or"?pe.some($e=>c.has($e)):[...c].every($e=>pe.includes($e))),fe=G==="favorites"||!m||ie.is_favorite,Ke=ie.tags?.split(",").map($e=>$e.trim())||[],ke=!b||Ke.includes(b);return F&&k&&K&&xe&&fe&&ke}).sort((ie,we)=>{switch($){case"date-desc":return new Date(we.created_at).getTime()-new Date(ie.created_at).getTime();case"date-asc":return new Date(ie.created_at).getTime()-new Date(we.created_at).getTime();case"name-asc":return(ie.print_name||ie.filename).localeCompare(we.print_name||we.filename);case"name-desc":return(we.print_name||we.filename).localeCompare(ie.print_name||ie.filename);case"size-desc":return we.file_size-ie.file_size;case"size-asc":return ie.file_size-we.file_size;default:return 0}}),De=R.size>0,he=ie=>{U(we=>{const ve=new Set(we);return ve.has(ie)?ve.delete(ie):ve.add(ie),ve})},Ae=()=>{be&&U(new Set(be.map(ie=>ie.id)))},Be=()=>{U(new Set)},le=ie=>{d(we=>{const ve=new Set(we);return ve.has(ie)?ve.delete(ie):ve.add(ie),ve})},ut=()=>{d(new Set)},z=()=>{r(""),s(null),l(null),y(!1),x(null)},V=i||a||o||m||b,ne=C.useCallback(ie=>{ie.preventDefault(),ie.dataTransfer.types.includes("Files")&&P(!0)},[]),J=C.useCallback(ie=>{ie.preventDefault(),ie.currentTarget===ie.target&&P(!1)},[]),ee=C.useCallback(ie=>{ie.preventDefault(),P(!1);const we=Array.from(ie.dataTransfer.files).filter(ve=>ve.name.endsWith(".3mf"));we.length>0?(E(we),M(!0)):ie.dataTransfer.files.length>0&&e("Only .3mf files are supported","warning")},[e]),ae=C.useCallback(ie=>{const we=ie.target;if(we.tagName==="INPUT"||we.tagName==="TEXTAREA"||we.isContentEditable){ie.key==="Escape"&&we.blur();return}switch(ie.key){case"/":ie.preventDefault(),n.current?.focus();break;case"u":case"U":!ie.metaKey&&!ie.ctrlKey&&(ie.preventDefault(),M(!0));break;case"Escape":De&&Be();break}},[De]);return C.useEffect(()=>(document.addEventListener("keydown",ae),()=>document.removeEventListener("keydown",ae)),[ae]),S.jsxs("div",{className:"p-8 relative min-h-full",onDragOver:ne,onDragLeave:J,onDrop:ee,children:[T&&S.jsx("div",{className:"fixed inset-0 z-50 bg-bambu-dark/90 flex items-center justify-center pointer-events-none",children:S.jsxs("div",{className:"border-4 border-dashed border-bambu-green rounded-xl p-12 text-center",children:[S.jsx(n_,{className:"w-16 h-16 mx-auto mb-4 text-bambu-green"}),S.jsx("p",{className:"text-2xl font-semibold text-white mb-2",children:"Drop .3mf files here"}),S.jsx("p",{className:"text-bambu-gray",children:"Release to upload"})]})}),De&&S.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:[S.jsxs("span",{className:"text-white font-medium",children:[R.size," selected"]}),S.jsx("div",{className:"w-px h-6 bg-bambu-dark-tertiary"}),S.jsx(xt,{variant:"secondary",size:"sm",onClick:Ae,children:"Select All"}),S.jsxs(xt,{variant:"secondary",size:"sm",onClick:Be,children:[S.jsx(_i,{className:"w-4 h-4"}),"Clear"]}),S.jsx("div",{className:"w-px h-6 bg-bambu-dark-tertiary"}),S.jsxs(xt,{variant:"secondary",size:"sm",onClick:()=>I(!0),children:[S.jsx(h0,{className:"w-4 h-4"}),"Tags"]}),S.jsxs(xt,{variant:"secondary",size:"sm",onClick:()=>{const ie=Array.from(R);Promise.all(ie.map(we=>vt.toggleFavorite(we))).then(()=>{t.invalidateQueries({queryKey:["archives"]}),e(`Toggled favorites for ${ie.length} archive${ie.length!==1?"s":""}`)}).catch(()=>{e("Failed to update favorites","error")})},children:[S.jsx(f0,{className:"w-4 h-4"}),"Favorite"]}),S.jsxs(xt,{size:"sm",className:"bg-red-500 hover:bg-red-600",onClick:()=>O(!0),children:[S.jsx(Jl,{className:"w-4 h-4"}),"Delete"]})]}),S.jsxs("div",{className:"flex items-center justify-between mb-8",children:[S.jsxs("div",{children:[S.jsxs("div",{className:"flex items-center gap-3",children:[S.jsx("h1",{className:"text-2xl font-bold text-white",children:"Archives"}),S.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:G,onChange:ie=>Y(ie.target.value),children:tEe.map(ie=>S.jsx("option",{value:ie.id,children:ie.label},ie.id))})]}),S.jsxs("p",{className:"text-bambu-gray",children:[be?.length||0," of ",Q?.length||0," prints"]})]}),S.jsxs("div",{className:"flex items-center gap-3",children:[!De&&S.jsxs(xt,{variant:"secondary",onClick:()=>be?.length&&he(be[0].id),children:[S.jsx(e_,{className:"w-4 h-4"}),"Select"]}),S.jsxs(xt,{onClick:()=>M(!0),children:[S.jsx(n_,{className:"w-4 h-4"}),"Upload 3MF"]})]})]}),S.jsx(bi,{className:"mb-6",children:S.jsxs(Ri,{className:"py-4",children:[S.jsxs("div",{className:"flex gap-4 items-center flex-wrap",children:[S.jsxs("div",{className:"flex-1 relative min-w-[200px]",children:[S.jsx(hG,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-bambu-gray"}),S.jsx("input",{ref:n,type:"text",placeholder:"Search archives... (press /)",className:"w-full pl-10 pr-4 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none",value:i,onChange:ie=>r(ie.target.value)})]}),S.jsxs("div",{className:"flex items-center gap-2",children:[S.jsx(Mie,{className:"w-4 h-4 text-bambu-gray"}),S.jsxs("select",{className:"px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none",value:a||"",onChange:ie=>s(ie.target.value?Number(ie.target.value):null),children:[S.jsx("option",{value:"",children:"All Printers"}),H?.map(ie=>S.jsx("option",{value:ie.id,children:ie.name},ie.id))]})]}),S.jsxs("div",{className:"flex items-center gap-2",children:[S.jsx(Qb,{className:"w-4 h-4 text-bambu-gray"}),S.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:ie=>l(ie.target.value||null),children:[S.jsx("option",{value:"",children:"All Materials"}),ce.map(ie=>S.jsx("option",{value:ie,children:ie},ie))]})]}),S.jsxs("button",{onClick:()=>y(!m),className:`flex items-center gap-2 px-3 py-2 rounded-lg border transition-colors ${m?"bg-yellow-500/20 border-yellow-500 text-yellow-400":"bg-bambu-dark border-bambu-dark-tertiary text-bambu-gray hover:text-white"}`,title:m?"Show all":"Show favorites only",children:[S.jsx(f0,{className:`w-4 h-4 ${m?"fill-yellow-400":""}`}),S.jsx("span",{className:"text-sm",children:"Favorites"})]}),me.length>0&&S.jsxs("div",{className:"flex items-center gap-2",children:[S.jsx(h0,{className:"w-4 h-4 text-bambu-gray"}),S.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:b||"",onChange:ie=>x(ie.target.value||null),children:[S.jsx("option",{value:"",children:"All Tags"}),me.map(ie=>S.jsx("option",{value:ie,children:ie},ie))]})]}),S.jsxs("div",{className:"flex items-center gap-2",children:[S.jsx(Rne,{className:"w-4 h-4 text-bambu-gray"}),S.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:ie=>q(ie.target.value),children:[S.jsx("option",{value:"date-desc",children:"Newest first"}),S.jsx("option",{value:"date-asc",children:"Oldest first"}),S.jsx("option",{value:"name-asc",children:"Name A-Z"}),S.jsx("option",{value:"name-desc",children:"Name Z-A"}),S.jsx("option",{value:"size-desc",children:"Largest first"}),S.jsx("option",{value:"size-asc",children:"Smallest first"})]})]}),S.jsxs("div",{className:"flex items-center border border-bambu-dark-tertiary rounded-lg overflow-hidden",children:[S.jsx("button",{className:`p-2 ${W==="grid"?"bg-bambu-green text-white":"bg-bambu-dark text-bambu-gray hover:text-white"}`,onClick:()=>L("grid"),title:"Grid view",children:S.jsx(Bie,{className:"w-4 h-4"})}),S.jsx("button",{className:`p-2 ${W==="list"?"bg-bambu-green text-white":"bg-bambu-dark text-bambu-gray hover:text-white"}`,onClick:()=>L("list"),title:"List view",children:S.jsx(uG,{className:"w-4 h-4"})}),S.jsx("button",{className:`p-2 ${W==="calendar"?"bg-bambu-green text-white":"bg-bambu-dark text-bambu-gray hover:text-white"}`,onClick:()=>L("calendar"),title:"Calendar view",children:S.jsx(Ine,{className:"w-4 h-4"})})]}),V&&S.jsxs(xt,{variant:"ghost",size:"sm",onClick:z,className:"text-bambu-gray hover:text-white",children:[S.jsx(_i,{className:"w-4 h-4"}),"Reset"]})]}),ye.length>0&&S.jsxs("div",{className:"flex items-center gap-3 mt-4 pt-4 border-t border-bambu-dark-tertiary",children:[S.jsx("span",{className:"text-xs text-bambu-gray",children:"Colors:"}),c.size>1&&S.jsx("button",{onClick:()=>p(ie=>ie==="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()}),S.jsx("div",{className:"flex items-center gap-1.5 flex-wrap",children:ye.map(ie=>S.jsx("button",{onClick:()=>le(ie),className:`w-6 h-6 rounded-full border-2 transition-all ${c.has(ie)?"border-bambu-green scale-110":"border-white/20 hover:border-white/40"}`,style:{backgroundColor:ie},title:ie},ie))}),c.size>0&&S.jsxs("button",{onClick:ut,className:"text-xs text-bambu-gray hover:text-white flex items-center gap-1",children:[S.jsx(_i,{className:"w-3 h-3"}),"Clear"]})]})]})}),se?S.jsx("div",{className:"text-center py-12 text-bambu-gray",children:"Loading archives..."}):be?.length===0?S.jsx(bi,{children:S.jsxs(Ri,{className:"text-center py-12",children:[S.jsx("p",{className:"text-bambu-gray",children:i?"No archives match your search":"No archives yet"}),S.jsx("p",{className:"text-sm text-bambu-gray mt-2",children:"Archives are created automatically when prints complete"})]})}):W==="calendar"?S.jsx(bi,{className:"p-6",children:S.jsx(Nxe,{archives:be||[],onArchiveClick:ie=>{r(ie.print_name||ie.filename),L("grid")}})}):W==="grid"?S.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6",children:be?.map(ie=>S.jsx(eEe,{archive:ie,printerName:ie.printer_id?re.get(ie.printer_id)||"Unknown":"No Printer",isSelected:R.has(ie.id),onSelect:he,selectionMode:De},ie.id))}):W==="list"?S.jsx(bi,{children:S.jsxs("div",{className:"divide-y divide-bambu-dark-tertiary",children:[S.jsxs("div",{className:"grid grid-cols-12 gap-4 px-4 py-3 text-xs text-bambu-gray font-medium",children:[S.jsx("div",{className:"col-span-1"}),S.jsx("div",{className:"col-span-4",children:"Name"}),S.jsx("div",{className:"col-span-2",children:"Printer"}),S.jsx("div",{className:"col-span-2",children:"Date"}),S.jsx("div",{className:"col-span-1",children:"Size"}),S.jsx("div",{className:"col-span-2 text-right",children:"Actions"})]}),be?.map(ie=>S.jsxs("div",{className:`grid grid-cols-12 gap-4 px-4 py-3 items-center hover:bg-bambu-dark-tertiary/30 ${R.has(ie.id)?"bg-bambu-green/10":""}`,children:[S.jsxs("div",{className:"col-span-1 flex items-center gap-2",children:[De&&S.jsx("button",{onClick:()=>he(ie.id),children:R.has(ie.id)?S.jsx(e_,{className:"w-4 h-4 text-bambu-green"}):S.jsx(t_,{className:"w-4 h-4 text-bambu-gray"})}),ie.thumbnail_path?S.jsx("img",{src:vt.getArchiveThumbnail(ie.id),alt:"",className:"w-10 h-10 object-cover rounded"}):S.jsx("div",{className:"w-10 h-10 bg-bambu-dark rounded flex items-center justify-center",children:S.jsx(rS,{className:"w-5 h-5 text-bambu-dark-tertiary"})})]}),S.jsxs("div",{className:"col-span-4",children:[S.jsxs("div",{className:"flex items-center gap-2",children:[S.jsx("p",{className:"text-white text-sm truncate",children:ie.print_name||ie.filename}),ie.timelapse_path&&S.jsx("span",{title:"Has timelapse",children:S.jsx(u0,{className:"w-3.5 h-3.5 text-bambu-green flex-shrink-0"})})]}),ie.filament_type&&S.jsxs("div",{className:"flex items-center gap-1.5 mt-0.5",children:[S.jsx("span",{className:"text-xs text-bambu-gray",children:ie.filament_type}),ie.filament_color&&S.jsx("div",{className:"flex items-center gap-0.5 flex-wrap",children:ie.filament_color.split(",").map((we,ve)=>S.jsx("div",{className:"w-2.5 h-2.5 rounded-full border border-white/20",style:{backgroundColor:we},title:we},ve))})]})]}),S.jsx("div",{className:"col-span-2 text-sm text-bambu-gray truncate",children:ie.printer_id?re.get(ie.printer_id)||"Unknown":"No Printer"}),S.jsx("div",{className:"col-span-2 text-sm text-bambu-gray",children:new Date(ie.created_at).toLocaleDateString()}),S.jsx("div",{className:"col-span-1 text-sm text-bambu-gray",children:S7(ie.file_size)}),S.jsxs("div",{className:"col-span-2 flex justify-end gap-1",children:[S.jsx(xt,{variant:"ghost",size:"sm",onClick:()=>{const we=ie.print_name||ie.filename||"model",ve=`${window.location.origin}${vt.getArchiveForSlicer(ie.id,we)}`;window.location.href=`bambustudioopen://${encodeURIComponent(ve)}`},title:"Open in Slicer",children:S.jsx(gp,{className:"w-4 h-4"})}),ie.makerworld_url&&S.jsx(xt,{variant:"ghost",size:"sm",onClick:()=>window.open(ie.makerworld_url,"_blank"),title:"MakerWorld",children:S.jsx(C2,{className:"w-4 h-4"})}),S.jsx(xt,{variant:"ghost",size:"sm",onClick:()=>{const we=document.createElement("a");we.href=vt.getArchiveDownload(ie.id),we.download=`${ie.print_name||ie.filename}.3mf`,we.click()},title:"Download",children:S.jsx(nf,{className:"w-4 h-4"})})]})]},ie.id))]})}):null,v&&S.jsx(_xe,{onClose:()=>{M(!1),E([])},initialFiles:w}),N&&S.jsx(qp,{title:"Delete Archives",message:`Are you sure you want to delete ${R.size} archive${R.size>1?"s":""}? This action cannot be undone.`,confirmText:`Delete ${R.size}`,variant:"danger",onConfirm:()=>{X.mutate(Array.from(R)),O(!1)},onCancel:()=>O(!1)}),B&&S.jsx(Exe,{selectedIds:Array.from(R),existingTags:me,onClose:()=>I(!1)})]})}function iEe({printDates:t,months:e=3}){const{weeks:n,monthLabels:i,printCounts:r}=C.useMemo(()=>{const l={};t.forEach(v=>{const M=v.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=[],p=[];let m=[],y=-1;const b=new Date(d);let x=0;for(;b<=c;)b.getDay()===0&&m.length>0&&(f.push(m),m=[],x++),b.getMonth()!==y&&(p.push({month:b.toLocaleDateString("en-US",{month:"short"}),weekIndex:x}),y=b.getMonth()),m.push(new Date(b)),b.setDate(b.getDate()+1);return m.length>0&&f.push(m),{weeks:f,monthLabels:p,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 S.jsxs("div",{className:"overflow-x-auto",children:[S.jsx("div",{className:"flex mb-1 ml-8",children:i.map(({month:l,weekIndex:c},d)=>S.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))}),S.jsxs("div",{className:"flex gap-0.5",children:[S.jsx("div",{className:"flex flex-col gap-0.5 mr-1",children:o.map((l,c)=>S.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)=>S.jsx("div",{className:"flex flex-col gap-0.5",children:[0,1,2,3,4,5,6].map(d=>{const f=l.find(b=>b.getDay()===d);if(!f)return S.jsx("div",{className:"w-3 h-3"},d);const p=f.toISOString().split("T")[0],m=r[p]||0,y=p===new Date().toISOString().split("T")[0];return S.jsx("div",{className:`w-3 h-3 rounded-sm ${s(m)} ${y?"ring-1 ring-white":""}`,title:`${f.toLocaleDateString()}: ${m} print${m!==1?"s":""}`},d)})},c))]}),S.jsxs("div",{className:"flex items-center gap-2 mt-3 text-xs text-bambu-gray",children:[S.jsx("span",{children:"Less"}),S.jsxs("div",{className:"flex gap-0.5",children:[S.jsx("div",{className:"w-3 h-3 rounded-sm bg-bambu-dark"}),S.jsx("div",{className:"w-3 h-3 rounded-sm bg-bambu-green/30"}),S.jsx("div",{className:"w-3 h-3 rounded-sm bg-bambu-green/50"}),S.jsx("div",{className:"w-3 h-3 rounded-sm bg-bambu-green/75"}),S.jsx("div",{className:"w-3 h-3 rounded-sm bg-bambu-green"})]}),S.jsx("span",{children:"More"})]})]})}function w7(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=w7(t[e]))&&(i&&(i+=" "),i+=n)}else for(n in t)t[n]&&(i&&(i+=" "),i+=n);return i}function yn(){for(var t,e,n=0,i="",r=arguments.length;n<r;n++)(t=arguments[n])&&(e=w7(t))&&(i&&(i+=" "),i+=e);return i}var rEe=["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 qP(t){if(typeof t!="string")return!1;var e=rEe;return e.includes(t)}var aEe=["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"],sEe=new Set(aEe);function M7(t){return typeof t!="string"?!1:sEe.has(t)}function E7(t){return typeof t=="string"&&t.startsWith("data-")}function ka(t){if(typeof t!="object"||t===null)return{};var e={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(M7(n)||E7(n))&&(e[n]=t[n]);return e}function gf(t){if(t==null)return null;if(C.isValidElement(t)&&typeof t.props=="object"&&t.props!==null){var e=t.props;return ka(e)}return typeof t=="object"&&!Array.isArray(t)?ka(t):null}function va(t){var e={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(M7(n)||E7(n)||qP(n))&&(e[n]=t[n]);return e}function oEe(t){return t==null?null:C.isValidElement(t)?va(t.props):typeof t=="object"&&!Array.isArray(t)?va(t):null}var lEe=["children","width","height","viewBox","className","style","title","desc"];function f3(){return f3=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},f3.apply(null,arguments)}function cEe(t,e){if(t==null)return{};var n,i,r=uEe(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 uEe(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 XP=C.forwardRef((t,e)=>{var{children:n,width:i,height:r,viewBox:a,className:s,style:o,title:l,desc:c}=t,d=cEe(t,lEe),f=a||{width:i,height:r,x:0,y:0},p=yn("recharts-surface",s);return C.createElement("svg",f3({},va(d),{className:p,width:i,height:r,style:o,viewBox:"".concat(f.x," ").concat(f.y," ").concat(f.width," ").concat(f.height),ref:e}),C.createElement("title",null,l),C.createElement("desc",null,c),n)}),dEe=["children","className"];function h3(){return h3=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},h3.apply(null,arguments)}function fEe(t,e){if(t==null)return{};var n,i,r=hEe(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 hEe(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 Pi=C.forwardRef((t,e)=>{var{children:n,className:i}=t,r=fEe(t,dEe),a=yn("recharts-layer",i);return C.createElement("g",h3({className:a},va(r),{ref:e}),n)}),A7=C.createContext(null),pEe=()=>C.useContext(A7);function $n(t){return function(){return t}}const T7=Math.cos,r1=Math.sin,xo=Math.sqrt,a1=Math.PI,DS=2*a1,p3=Math.PI,m3=2*p3,Sd=1e-6,mEe=m3-Sd;function C7(t){this._+=t[0];for(let e=1,n=t.length;e<n;++e)this._+=arguments[e]+t[e]}function gEe(t){let e=Math.floor(t);if(!(e>=0))throw new Error(`invalid digits: ${t}`);if(e>15)return C7;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 vEe{constructor(e){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=e==null?C7:gEe(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,p=d*d+f*f;if(this._x1===null)this._append`M${this._x1=e},${this._y1=n}`;else if(p>Sd)if(!(Math.abs(f*l-c*d)>Sd)||!a)this._append`L${this._x1=e},${this._y1=n}`;else{let m=i-s,y=r-o,b=l*l+c*c,x=m*m+y*y,v=Math.sqrt(b),M=Math.sqrt(p),w=a*Math.tan((p3-Math.acos((b+p-x)/(2*v*M)))/2),E=w/M,T=w/v;Math.abs(E-1)>Sd&&this._append`L${e+E*d},${n+E*f}`,this._append`A${a},${a},0,0,${+(f*m>d*y)},${this._x1=e+T*l},${this._y1=n+T*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,p=s?r-a:a-r;this._x1===null?this._append`M${c},${d}`:(Math.abs(this._x1-c)>Sd||Math.abs(this._y1-d)>Sd)&&this._append`L${c},${d}`,i&&(p<0&&(p=p%m3+m3),p>mEe?this._append`A${i},${i},0,1,${f},${e-o},${n-l}A${i},${i},0,1,${f},${this._x1=c},${this._y1=d}`:p>Sd&&this._append`A${i},${i},0,${+(p>=p3)},${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 YP(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 vEe(e)}function KP(t){return typeof t=="object"&&"length"in t?t:Array.from(t)}function R7(t){this._context=t}R7.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 OS(t){return new R7(t)}function N7(t){return t[0]}function P7(t){return t[1]}function D7(t,e){var n=$n(!0),i=null,r=OS,a=null,s=YP(o);t=typeof t=="function"?t:t===void 0?N7:$n(t),e=typeof e=="function"?e:e===void 0?P7:$n(e);function o(l){var c,d=(l=KP(l)).length,f,p=!1,m;for(i==null&&(a=r(m=s())),c=0;c<=d;++c)!(c<d&&n(f=l[c],c,l))===p&&((p=!p)?a.lineStart():a.lineEnd()),p&&a.point(+t(f,c,l),+e(f,c,l));if(m)return a=null,m+""||null}return o.x=function(l){return arguments.length?(t=typeof l=="function"?l:$n(+l),o):t},o.y=function(l){return arguments.length?(e=typeof l=="function"?l:$n(+l),o):e},o.defined=function(l){return arguments.length?(n=typeof l=="function"?l:$n(!!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 cb(t,e,n){var i=null,r=$n(!0),a=null,s=OS,o=null,l=YP(c);t=typeof t=="function"?t:t===void 0?N7:$n(+t),e=typeof e=="function"?e:$n(e===void 0?0:+e),n=typeof n=="function"?n:n===void 0?P7:$n(+n);function c(f){var p,m,y,b=(f=KP(f)).length,x,v=!1,M,w=new Array(b),E=new Array(b);for(a==null&&(o=s(M=l())),p=0;p<=b;++p){if(!(p<b&&r(x=f[p],p,f))===v)if(v=!v)m=p,o.areaStart(),o.lineStart();else{for(o.lineEnd(),o.lineStart(),y=p-1;y>=m;--y)o.point(w[y],E[y]);o.lineEnd(),o.areaEnd()}v&&(w[p]=+t(x,p,f),E[p]=+e(x,p,f),o.point(i?+i(x,p,f):w[p],n?+n(x,p,f):E[p]))}if(M)return o=null,M+""||null}function d(){return D7().defined(r).curve(s).context(a)}return c.x=function(f){return arguments.length?(t=typeof f=="function"?f:$n(+f),i=null,c):t},c.x0=function(f){return arguments.length?(t=typeof f=="function"?f:$n(+f),c):t},c.x1=function(f){return arguments.length?(i=f==null?null:typeof f=="function"?f:$n(+f),c):i},c.y=function(f){return arguments.length?(e=typeof f=="function"?f:$n(+f),n=null,c):e},c.y0=function(f){return arguments.length?(e=typeof f=="function"?f:$n(+f),c):e},c.y1=function(f){return arguments.length?(n=f==null?null:typeof f=="function"?f:$n(+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:$n(!!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 O7{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 xEe(t){return new O7(t,!0)}function yEe(t){return new O7(t,!1)}const ZP={draw(t,e){const n=xo(e/a1);t.moveTo(n,0),t.arc(0,0,n,0,DS)}},bEe={draw(t,e){const n=xo(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()}},L7=xo(1/3),_Ee=L7*2,SEe={draw(t,e){const n=xo(e/_Ee),i=n*L7;t.moveTo(0,-n),t.lineTo(i,0),t.lineTo(0,n),t.lineTo(-i,0),t.closePath()}},wEe={draw(t,e){const n=xo(e),i=-n/2;t.rect(i,i,n,n)}},MEe=.8908130915292852,k7=r1(a1/10)/r1(7*a1/10),EEe=r1(DS/10)*k7,AEe=-T7(DS/10)*k7,TEe={draw(t,e){const n=xo(e*MEe),i=EEe*n,r=AEe*n;t.moveTo(0,-n),t.lineTo(i,r);for(let a=1;a<5;++a){const s=DS*a/5,o=T7(s),l=r1(s);t.lineTo(l*n,-o*n),t.lineTo(o*i-l*r,l*i+o*r)}t.closePath()}},kT=xo(3),CEe={draw(t,e){const n=-xo(e/(kT*3));t.moveTo(0,n*2),t.lineTo(-kT*n,-n),t.lineTo(kT*n,-n),t.closePath()}},bs=-.5,_s=xo(3)/2,g3=1/xo(12),REe=(g3/2+1)*3,NEe={draw(t,e){const n=xo(e/REe),i=n/2,r=n*g3,a=i,s=n*g3+n,o=-a,l=s;t.moveTo(i,r),t.lineTo(a,s),t.lineTo(o,l),t.lineTo(bs*i-_s*r,_s*i+bs*r),t.lineTo(bs*a-_s*s,_s*a+bs*s),t.lineTo(bs*o-_s*l,_s*o+bs*l),t.lineTo(bs*i+_s*r,bs*r-_s*i),t.lineTo(bs*a+_s*s,bs*s-_s*a),t.lineTo(bs*o+_s*l,bs*l-_s*o),t.closePath()}};function PEe(t,e){let n=null,i=YP(r);t=typeof t=="function"?t:$n(t||ZP),e=typeof e=="function"?e:$n(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:$n(a),r):t},r.size=function(a){return arguments.length?(e=typeof a=="function"?a:$n(+a),r):e},r.context=function(a){return arguments.length?(n=a??null,r):n},r}function s1(){}function o1(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 I7(t){this._context=t}I7.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:o1(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:o1(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function DEe(t){return new I7(t)}function U7(t){this._context=t}U7.prototype={areaStart:s1,areaEnd:s1,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:o1(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function OEe(t){return new U7(t)}function F7(t){this._context=t}F7.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:o1(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function LEe(t){return new F7(t)}function z7(t){this._context=t}z7.prototype={areaStart:s1,areaEnd:s1,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 kEe(t){return new z7(t)}function q5(t){return t<0?-1:1}function X5(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(q5(a)+q5(s))*Math.min(Math.abs(a),Math.abs(s),.5*Math.abs(o))||0}function Y5(t,e){var n=t._x1-t._x0;return n?(3*(t._y1-t._y0)/n-e)/2:e}function IT(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 l1(t){this._context=t}l1.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:IT(this,this._t0,Y5(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,IT(this,Y5(this,n=X5(this,t,e)),n);break;default:IT(this,this._t0,n=X5(this,t,e));break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e,this._t0=n}}};function B7(t){this._context=new j7(t)}(B7.prototype=Object.create(l1.prototype)).point=function(t,e){l1.prototype.point.call(this,e,t)};function j7(t){this._context=t}j7.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 IEe(t){return new l1(t)}function UEe(t){return new B7(t)}function H7(t){this._context=t}H7.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=K5(t),r=K5(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 K5(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 FEe(t){return new H7(t)}function LS(t,e){this._context=t,this._t=e}LS.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 zEe(t){return new LS(t,.5)}function BEe(t){return new LS(t,0)}function jEe(t){return new LS(t,1)}function Op(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 v3(t){for(var e=t.length,n=new Array(e);--e>=0;)n[e]=e;return n}function HEe(t,e){return t[e]}function VEe(t){const e=[];return e.key=t,e}function GEe(){var t=$n([]),e=v3,n=Op,i=HEe;function r(a){var s=Array.from(t.apply(this,arguments),VEe),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=KP(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:$n(Array.from(a)),r):t},r.value=function(a){return arguments.length?(i=typeof a=="function"?a:$n(+a),r):i},r.order=function(a){return arguments.length?(e=a==null?v3:typeof a=="function"?a:$n(Array.from(a)),r):e},r.offset=function(a){return arguments.length?(n=a??Op,r):n},r}function $Ee(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}Op(t,e)}}function WEe(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}Op(t,e)}}function qEe(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,p=d[i-1][1]||0,m=(f-p)/2,y=0;y<o;++y){var b=t[e[y]],x=b[i][1]||0,v=b[i-1][1]||0;m+=x-v}l+=f,c+=m*f}r[i-1][1]+=r[i-1][0]=n,l&&(n-=c/l)}r[i-1][1]+=r[i-1][0]=n,Op(t,e)}}var UT={},FT={},Z5;function XEe(){return Z5||(Z5=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});function e(n){return n==="__proto__"}t.isUnsafeProperty=e})(FT)),FT}var zT={},J5;function V7(){return J5||(J5=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})(zT)),zT}var BT={},Q5;function JP(){return Q5||(Q5=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})(BT)),BT}var jT={},HT={},ej;function YEe(){return ej||(ej=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})(HT)),HT}var tj;function QP(){return tj||(tj=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=YEe(),n=JP();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})(jT)),jT}var nj;function eD(){return nj||(nj=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=XEe(),n=V7(),i=JP(),r=QP();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})(UT)),UT}var VT,ij;function KEe(){return ij||(ij=1,VT=eD().get),VT}var ZEe=KEe();const vf=Vs(ZEe);var Sr=t=>t===0?0:t>0?1:-1,Bs=t=>typeof t=="number"&&t!=+t,tc=t=>typeof t=="string"&&t.indexOf("%")===t.length-1,Mt=t=>(typeof t=="number"||t instanceof Number)&&!Bs(t),Vo=t=>Mt(t)||typeof t=="string",JEe=0,L0=t=>{var e=++JEe;return"".concat(t||"").concat(e)},ta=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(!Mt(e)&&typeof e!="string")return i;var a;if(tc(e)){if(n==null)return i;var s=e.indexOf("%");a=n*parseFloat(e.slice(0,s))/100}else a=+e;return Bs(a)&&(a=i),r&&n!=null&&a>n&&(a=n),a},G7=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 Qn(t,e,n){return Mt(t)&&Mt(e)?t+n*(e-t):e}function $7(t,e,n){if(!(!t||!t.length))return t.find(i=>i&&(typeof e=="function"?e(i):vf(i,e))===n)}var ui=t=>t===null||typeof t>"u",dv=t=>ui(t)?t:"".concat(t.charAt(0).toUpperCase()).concat(t.slice(1));function QEe(t){return t!=null}function fv(){}var eAe=["type","size","sizeType"];function x3(){return x3=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},x3.apply(null,arguments)}function rj(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 aj(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?rj(Object(n),!0).forEach(function(i){tAe(t,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):rj(Object(n)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(n,i))})}return t}function tAe(t,e,n){return(e=nAe(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function nAe(t){var e=iAe(t,"string");return typeof e=="symbol"?e:e+""}function iAe(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 rAe(t,e){if(t==null)return{};var n,i,r=aAe(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 aAe(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 W7={symbolCircle:ZP,symbolCross:bEe,symbolDiamond:SEe,symbolSquare:wEe,symbolStar:TEe,symbolTriangle:CEe,symbolWye:NEe},sAe=Math.PI/180,oAe=t=>{var e="symbol".concat(dv(t));return W7[e]||ZP},lAe=(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*sAe;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}},cAe=(t,e)=>{W7["symbol".concat(dv(t))]=e},tD=t=>{var{type:e="circle",size:n=64,sizeType:i="area"}=t,r=rAe(t,eAe),a=aj(aj({},r),{},{type:e,size:n,sizeType:i}),s="circle";typeof e=="string"&&(s=e);var o=()=>{var p=oAe(s),m=PEe().type(p).size(lAe(n,i,s)),y=m();if(y!==null)return y},{className:l,cx:c,cy:d}=a,f=va(a);return Mt(c)&&Mt(d)&&Mt(n)?C.createElement("path",x3({},f,{className:yn("recharts-symbols",l),transform:"translate(".concat(c,", ").concat(d,")"),d:o()})):null};tD.registerSymbol=cAe;var q7=t=>"radius"in t&&"startAngle"in t&&"endAngle"in t,nD=(t,e)=>{if(!t||typeof t=="function"||typeof t=="boolean")return null;var n=t;if(C.isValidElement(t)&&(n=t.props),typeof n!="object"&&typeof n!="function")return null;var i={};return Object.keys(n).forEach(r=>{qP(r)&&(i[r]=(a=>n[r](n,a)))}),i},uAe=(t,e,n)=>i=>(t(e,n,i),null),hv=(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];qP(r)&&typeof a=="function"&&(i||(i={}),i[r]=uAe(a,e,n))}),i};function sj(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 dAe(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?sj(Object(n),!0).forEach(function(i){fAe(t,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):sj(Object(n)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(n,i))})}return t}function fAe(t,e,n){return(e=hAe(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function hAe(t){var e=pAe(t,"string");return typeof e=="symbol"?e:e+""}function pAe(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 qi(t,e){var n=dAe({},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 c1(){return c1=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},c1.apply(null,arguments)}function oj(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 mAe(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?oj(Object(n),!0).forEach(function(i){gAe(t,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):oj(Object(n)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(n,i))})}return t}function gAe(t,e,n){return(e=vAe(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function vAe(t){var e=xAe(t,"string");return typeof e=="symbol"?e:e+""}function xAe(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 Ms=32,yAe={align:"center",iconSize:14,inactiveColor:"#ccc",layout:"horizontal",verticalAlign:"middle"};function bAe(t){var{data:e,iconType:n,inactiveColor:i}=t,r=Ms/2,a=Ms/6,s=Ms/3,o=e.inactive?i:e.color,l=n??e.type;if(l==="none")return null;if(l==="plainline"){var c;return C.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:Ms,y2:r,className:"recharts-legend-icon"})}if(l==="line")return C.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(Ms,"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 C.createElement("path",{stroke:"none",fill:o,d:"M0,".concat(Ms/8,"h").concat(Ms,"v").concat(Ms*3/4,"h").concat(-Ms,"z"),className:"recharts-legend-icon"});if(C.isValidElement(e.legendIcon)){var d=mAe({},e);return delete d.legendIcon,C.cloneElement(e.legendIcon,d)}return C.createElement(tD,{fill:o,cx:r,cy:r,size:Ms,sizeType:"diameter",type:l})}function _Ae(t){var{payload:e,iconSize:n,layout:i,formatter:r,inactiveColor:a,iconType:s}=t,o={x:0,y:0,width:Ms,height:Ms},l={display:i==="horizontal"?"inline-block":"block",marginRight:10},c={display:"inline-block",verticalAlign:"middle",marginRight:4};return e.map((d,f)=>{var p=d.formatter||r,m=yn({"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,b=p?p(d.value,d,f):d.value;return C.createElement("li",c1({className:m,style:l,key:"legend-item-".concat(f)},hv(t,d,f)),C.createElement(XP,{width:n,height:n,viewBox:o,style:c,"aria-label":"".concat(b," legend icon")},C.createElement(bAe,{data:d,iconType:s,inactiveColor:a})),C.createElement("span",{className:"recharts-legend-item-text",style:{color:y}},b))})}var SAe=t=>{var e=qi(t,yAe),{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 C.createElement("ul",{className:"recharts-default-legend",style:a},C.createElement(_Ae,c1({},e,{payload:n})))},GT={},$T={},lj;function wAe(){return lj||(lj=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})($T)),$T}var WT={},cj;function X7(){return cj||(cj=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});function e(n){return n}t.identity=e})(WT)),WT}var qT={},XT={},YT={},uj;function MAe(){return uj||(uj=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});function e(n){return Number.isSafeInteger(n)&&n>=0}t.isLength=e})(YT)),YT}var dj;function iD(){return dj||(dj=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=MAe();function n(i){return i!=null&&typeof i!="function"&&e.isLength(i.length)}t.isArrayLike=n})(XT)),XT}var KT={},fj;function EAe(){return fj||(fj=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});function e(n){return typeof n=="object"&&n!==null}t.isObjectLike=e})(KT)),KT}var hj;function AAe(){return hj||(hj=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=iD(),n=EAe();function i(r){return n.isObjectLike(r)&&e.isArrayLike(r)}t.isArrayLikeObject=i})(qT)),qT}var ZT={},JT={},pj;function TAe(){return pj||(pj=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=eD();function n(i){return function(r){return e.get(r,i)}}t.property=n})(JT)),JT}var QT={},eC={},tC={},nC={},mj;function Y7(){return mj||(mj=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})(nC)),nC}var iC={},gj;function K7(){return gj||(gj=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})(iC)),iC}var rC={},vj;function Z7(){return vj||(vj=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})(rC)),rC}var xj;function CAe(){return xj||(xj=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=Y7(),n=K7(),i=Z7();function r(d,f,p){return typeof p!="function"?r(d,f,()=>{}):a(d,f,function m(y,b,x,v,M,w){const E=p(y,b,x,v,M,w);return E!==void 0?!!E:a(y,b,m,w)},new Map)}function a(d,f,p,m){if(f===d)return!0;switch(typeof f){case"object":return s(d,f,p,m);case"function":return Object.keys(f).length>0?a(d,{...f},p,m):i.eq(d,f);default:return e.isObject(d)?typeof f=="string"?f==="":!0:i.eq(d,f)}}function s(d,f,p,m){if(f==null)return!0;if(Array.isArray(f))return l(d,f,p,m);if(f instanceof Map)return o(d,f,p,m);if(f instanceof Set)return c(d,f,p,m);const y=Object.keys(f);if(d==null)return y.length===0;if(y.length===0)return!0;if(m?.has(f))return m.get(f)===d;m?.set(f,d);try{for(let b=0;b<y.length;b++){const x=y[b];if(!n.isPrimitive(d)&&!(x in d)||f[x]===void 0&&d[x]!==void 0||f[x]===null&&d[x]!==null||!p(d[x],f[x],x,d,f,m))return!1}return!0}finally{m?.delete(f)}}function o(d,f,p,m){if(f.size===0)return!0;if(!(d instanceof Map))return!1;for(const[y,b]of f.entries()){const x=d.get(y);if(p(x,b,y,d,f,m)===!1)return!1}return!0}function l(d,f,p,m){if(f.length===0)return!0;if(!Array.isArray(d))return!1;const y=new Set;for(let b=0;b<f.length;b++){const x=f[b];let v=!1;for(let M=0;M<d.length;M++){if(y.has(M))continue;const w=d[M];let E=!1;if(p(w,x,b,d,f,m)&&(E=!0),E){y.add(M),v=!0;break}}if(!v)return!1}return!0}function c(d,f,p,m){return f.size===0?!0:d instanceof Set?l([...d],[...f],p,m):!1}t.isMatchWith=r,t.isSetMatch=c})(tC)),tC}var yj;function J7(){return yj||(yj=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=CAe();function n(i,r){return e.isMatchWith(i,r,()=>{})}t.isMatch=n})(eC)),eC}var aC={},sC={},oC={},bj;function RAe(){return bj||(bj=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})(oC)),oC}var lC={},_j;function Q7(){return _j||(_j=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})(lC)),lC}var cC={},Sj;function eq(){return Sj||(Sj=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]",p="[object ArrayBuffer]",m="[object Object]",y="[object Error]",b="[object DataView]",x="[object Uint8Array]",v="[object Uint8ClampedArray]",M="[object Uint16Array]",w="[object Uint32Array]",E="[object BigUint64Array]",T="[object Int8Array]",P="[object Int16Array]",R="[object Int32Array]",U="[object BigInt64Array]",N="[object Float32Array]",O="[object Float64Array]";t.argumentsTag=a,t.arrayBufferTag=p,t.arrayTag=d,t.bigInt64ArrayTag=U,t.bigUint64ArrayTag=E,t.booleanTag=r,t.dataViewTag=b,t.dateTag=o,t.errorTag=y,t.float32ArrayTag=N,t.float64ArrayTag=O,t.functionTag=f,t.int16ArrayTag=P,t.int32ArrayTag=R,t.int8ArrayTag=T,t.mapTag=l,t.numberTag=i,t.objectTag=m,t.regexpTag=e,t.setTag=c,t.stringTag=n,t.symbolTag=s,t.uint16ArrayTag=M,t.uint32ArrayTag=w,t.uint8ArrayTag=x,t.uint8ClampedArrayTag=v})(cC)),cC}var uC={},wj;function NAe(){return wj||(wj=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});function e(n){return ArrayBuffer.isView(n)&&!(n instanceof DataView)}t.isTypedArray=e})(uC)),uC}var Mj;function tq(){return Mj||(Mj=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=RAe(),n=Q7(),i=eq(),r=K7(),a=NAe();function s(d,f){return o(d,void 0,d,new Map,f)}function o(d,f,p,m=new Map,y=void 0){const b=y?.(d,f,p,m);if(b!==void 0)return b;if(r.isPrimitive(d))return d;if(m.has(d))return m.get(d);if(Array.isArray(d)){const x=new Array(d.length);m.set(d,x);for(let v=0;v<d.length;v++)x[v]=o(d[v],v,p,m,y);return Object.hasOwn(d,"index")&&(x.index=d.index),Object.hasOwn(d,"input")&&(x.input=d.input),x}if(d instanceof Date)return new Date(d.getTime());if(d instanceof RegExp){const x=new RegExp(d.source,d.flags);return x.lastIndex=d.lastIndex,x}if(d instanceof Map){const x=new Map;m.set(d,x);for(const[v,M]of d)x.set(v,o(M,v,p,m,y));return x}if(d instanceof Set){const x=new Set;m.set(d,x);for(const v of d)x.add(o(v,void 0,p,m,y));return x}if(typeof Buffer<"u"&&Buffer.isBuffer(d))return d.subarray();if(a.isTypedArray(d)){const x=new(Object.getPrototypeOf(d)).constructor(d.length);m.set(d,x);for(let v=0;v<d.length;v++)x[v]=o(d[v],v,p,m,y);return x}if(d instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&d instanceof SharedArrayBuffer)return d.slice(0);if(d instanceof DataView){const x=new DataView(d.buffer.slice(0),d.byteOffset,d.byteLength);return m.set(d,x),l(x,d,p,m,y),x}if(typeof File<"u"&&d instanceof File){const x=new File([d],d.name,{type:d.type});return m.set(d,x),l(x,d,p,m,y),x}if(typeof Blob<"u"&&d instanceof Blob){const x=new Blob([d],{type:d.type});return m.set(d,x),l(x,d,p,m,y),x}if(d instanceof Error){const x=new d.constructor;return m.set(d,x),x.message=d.message,x.name=d.name,x.stack=d.stack,x.cause=d.cause,l(x,d,p,m,y),x}if(d instanceof Boolean){const x=new Boolean(d.valueOf());return m.set(d,x),l(x,d,p,m,y),x}if(d instanceof Number){const x=new Number(d.valueOf());return m.set(d,x),l(x,d,p,m,y),x}if(d instanceof String){const x=new String(d.valueOf());return m.set(d,x),l(x,d,p,m,y),x}if(typeof d=="object"&&c(d)){const x=Object.create(Object.getPrototypeOf(d));return m.set(d,x),l(x,d,p,m,y),x}return d}function l(d,f,p=d,m,y){const b=[...Object.keys(f),...e.getSymbols(f)];for(let x=0;x<b.length;x++){const v=b[x],M=Object.getOwnPropertyDescriptor(d,v);(M==null||M.writable)&&(d[v]=o(f[v],v,p,m,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})(sC)),sC}var Ej;function PAe(){return Ej||(Ej=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=tq();function n(i){return e.cloneDeepWithImpl(i,void 0,i,new Map,void 0)}t.cloneDeep=n})(aC)),aC}var Aj;function DAe(){return Aj||(Aj=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=J7(),n=PAe();function i(r){return r=n.cloneDeep(r),a=>e.isMatch(a,r)}t.matches=i})(QT)),QT}var dC={},fC={},hC={},Tj;function OAe(){return Tj||(Tj=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=tq(),n=eq();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})(hC)),hC}var Cj;function LAe(){return Cj||(Cj=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=OAe();function n(i){return e.cloneDeepWith(i)}t.cloneDeep=n})(fC)),fC}var pC={},mC={},Rj;function nq(){return Rj||(Rj=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})(mC)),mC}var gC={},Nj;function kAe(){return Nj||(Nj=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=Q7();function n(i){return i!==null&&typeof i=="object"&&e.getTag(i)==="[object Arguments]"}t.isArguments=n})(gC)),gC}var Pj;function IAe(){return Pj||(Pj=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=V7(),n=nq(),i=kAe(),r=QP();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})(pC)),pC}var Dj;function UAe(){return Dj||(Dj=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=J7(),n=JP(),i=LAe(),r=eD(),a=IAe();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})(dC)),dC}var Oj;function FAe(){return Oj||(Oj=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=X7(),n=TAe(),i=DAe(),r=UAe();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})(ZT)),ZT}var Lj;function zAe(){return Lj||(Lj=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=wAe(),n=X7(),i=AAe(),r=FAe();function a(s,o=n.identity){return i.isArrayLikeObject(s)?e.uniqBy(Array.from(s),r.iteratee(o)):[]}t.uniqBy=a})(GT)),GT}var vC,kj;function BAe(){return kj||(kj=1,vC=zAe().uniqBy),vC}var jAe=BAe();const Ij=Vs(jAe);function iq(t,e,n){return e===!0?Ij(t,n):typeof e=="function"?Ij(t,e):t}var rD=C.createContext(null),HAe=t=>t,qn=()=>{var t=C.useContext(rD);return t?t.store.dispatch:HAe},Gb=()=>{},VAe=()=>Gb,GAe=(t,e)=>t===e;function Et(t){var e=C.useContext(rD);return $W.useSyncExternalStoreWithSelector(e?e.subscription.addNestedSub:VAe,e?e.store.getState:Gb,e?e.store.getState:Gb,e?t:Gb,GAe)}function $Ae(t,e=`expected a function, instead received ${typeof t}`){if(typeof t!="function")throw new TypeError(e)}function WAe(t,e=`expected an object, instead received ${typeof t}`){if(typeof t!="object")throw new TypeError(e)}function qAe(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 Uj=t=>Array.isArray(t)?t:[t];function XAe(t){const e=Array.isArray(t[0])?t[0]:t;return qAe(e,"createSelector expects all input-selectors to be functions, but received the following types: "),e}function YAe(t,e){const n=[],{length:i}=t;for(let r=0;r<i;r++)n.push(t[r].apply(null,e));return n}var KAe=class{constructor(t){this.value=t}deref(){return this.value}},ZAe=typeof WeakRef<"u"?WeakRef:KAe,JAe=0,Fj=1;function ub(){return{s:JAe,v:void 0,o:null,p:null}}function rq(t,e={}){let n=ub();const{resultEqualityCheck:i}=e;let r,a=0;function s(){let o=n;const{length:l}=arguments;for(let f=0,p=l;f<p;f++){const m=arguments[f];if(typeof m=="function"||typeof m=="object"&&m!==null){let y=o.o;y===null&&(o.o=y=new WeakMap);const b=y.get(m);b===void 0?(o=ub(),y.set(m,o)):o=b}else{let y=o.p;y===null&&(o.p=y=new Map);const b=y.get(m);b===void 0?(o=ub(),y.set(m,o)):o=b}}const c=o;let d;if(o.s===Fj)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 ZAe(d):d}return c.s=Fj,c.v=d,d}return s.clearCache=()=>{n=ub(),s.resetResultsCount()},s.resultsCount=()=>a,s.resetResultsCount=()=>{a=0},s}function QAe(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()),$Ae(c,`createSelector expects an output function after the inputs, but received: [${typeof c}]`);const d={...n,...l},{memoize:f,memoizeOptions:p=[],argsMemoize:m=rq,argsMemoizeOptions:y=[]}=d,b=Uj(p),x=Uj(y),v=XAe(r),M=f(function(){return a++,c.apply(null,arguments)},...b),w=m(function(){s++;const T=YAe(v,arguments);return o=M.apply(null,T),o},...x);return Object.assign(w,{resultFunc:c,memoizedResultFunc:M,dependencies:v,dependencyRecomputations:()=>s,resetDependencyRecomputations:()=>{s=0},lastResult:()=>o,recomputations:()=>a,resetRecomputations:()=>{a=0},memoize:f,argsMemoize:m})};return Object.assign(i,{withTypes:()=>i}),i}var He=QAe(rq),eTe=Object.assign((t,e=He)=>{WAe(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:()=>eTe}),xC={},yC={},bC={},zj;function tTe(){return zj||(zj=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})(bC)),bC}var _C={},SC={},Bj;function aq(){return Bj||(Bj=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});function e(n){return typeof n=="symbol"||n instanceof Symbol}t.isSymbol=e})(SC)),SC}var jj;function nTe(){return jj||(jj=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=aq(),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})(_C)),_C}var Hj;function iTe(){return Hj||(Hj=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=tTe(),n=nTe(),i=QP();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(m=>String(m));const c=(m,y)=>{let b=m;for(let x=0;x<y.length&&b!=null;++x)b=b[y[x]];return b},d=(m,y)=>y==null||m==null?y:typeof m=="object"&&"key"in m?Object.hasOwn(y,m.key)?y[m.key]:c(y,m.path):typeof m=="function"?m(y):Array.isArray(m)?c(y,m):typeof y=="object"?y[m]:y,f=s.map(m=>(Array.isArray(m)&&m.length===1&&(m=m[0]),m==null||typeof m=="function"||Array.isArray(m)||n.isKey(m)?m:{key:m,path:i.toPath(m)}));return a.map(m=>({original:m,criteria:f.map(y=>d(y,m))})).slice().sort((m,y)=>{for(let b=0;b<f.length;b++){const x=e.compareValues(m.criteria[b],y.criteria[b],o[b]);if(x!==0)return x}return 0}).map(m=>m.original)}t.orderBy=r})(yC)),yC}var wC={},Vj;function rTe(){return Vj||(Vj=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})(wC)),wC}var MC={},Gj;function sq(){return Gj||(Gj=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=nq(),n=iD(),i=Y7(),r=Z7();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})(MC)),MC}var $j;function aTe(){return $j||($j=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=iTe(),n=rTe(),i=sq();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})(xC)),xC}var EC,Wj;function sTe(){return Wj||(Wj=1,EC=aTe().sortBy),EC}var oTe=sTe();const kS=Vs(oTe);var oq=t=>t.legend.settings,lTe=t=>t.legend.size,cTe=t=>t.legend.payload,uTe=He([cTe,oq],(t,e)=>{var{itemSorter:n}=e,i=t.flat(1);return n?kS(i,n):i});function dTe(){return Et(uTe)}var db=1;function lq(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],[e,n]=C.useState({height:0,left:0,top:0,width:0}),i=C.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)>db||Math.abs(s.left-e.left)>db||Math.abs(s.top-e.top)>db||Math.abs(s.width-e.width)>db)&&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 kr(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 fTe=typeof Symbol=="function"&&Symbol.observable||"@@observable",qj=fTe,AC=()=>Math.random().toString(36).substring(7).split("").join("."),hTe={INIT:`@@redux/INIT${AC()}`,REPLACE:`@@redux/REPLACE${AC()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${AC()}`},u1=hTe;function aD(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 cq(t,e,n){if(typeof t!="function")throw new Error(kr(2));if(typeof e=="function"&&typeof n=="function"||typeof n=="function"&&typeof arguments[3]=="function")throw new Error(kr(0));if(typeof e=="function"&&typeof n>"u"&&(n=e,e=void 0),typeof n<"u"){if(typeof n!="function")throw new Error(kr(1));return n(cq)(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((x,v)=>{s.set(v,x)}))}function d(){if(l)throw new Error(kr(3));return r}function f(x){if(typeof x!="function")throw new Error(kr(4));if(l)throw new Error(kr(5));let v=!0;c();const M=o++;return s.set(M,x),function(){if(v){if(l)throw new Error(kr(6));v=!1,c(),s.delete(M),a=null}}}function p(x){if(!aD(x))throw new Error(kr(7));if(typeof x.type>"u")throw new Error(kr(8));if(typeof x.type!="string")throw new Error(kr(17));if(l)throw new Error(kr(9));try{l=!0,r=i(r,x)}finally{l=!1}return(a=s).forEach(M=>{M()}),x}function m(x){if(typeof x!="function")throw new Error(kr(10));i=x,p({type:u1.REPLACE})}function y(){const x=f;return{subscribe(v){if(typeof v!="object"||v===null)throw new Error(kr(11));function M(){const E=v;E.next&&E.next(d())}return M(),{unsubscribe:x(M)}},[qj](){return this}}}return p({type:u1.INIT}),{dispatch:p,subscribe:f,getState:d,replaceReducer:m,[qj]:y}}function pTe(t){Object.keys(t).forEach(e=>{const n=t[e];if(typeof n(void 0,{type:u1.INIT})>"u")throw new Error(kr(12));if(typeof n(void 0,{type:u1.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(kr(13))})}function uq(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{pTe(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],p=n[f],m=s[f],y=p(m,o);if(typeof y>"u")throw o&&o.type,new Error(kr(14));c[f]=y,l=l||y!==m}return l=l||i.length!==Object.keys(s).length,l?c:s}}function d1(...t){return t.length===0?e=>e:t.length===1?t[0]:t.reduce((e,n)=>(...i)=>e(n(...i)))}function mTe(...t){return e=>(n,i)=>{const r=e(n,i);let a=()=>{throw new Error(kr(15))};const s={getState:r.getState,dispatch:(l,...c)=>a(l,...c)},o=t.map(l=>l(s));return a=d1(...o)(r.dispatch),{...r,dispatch:a}}}function dq(t){return aD(t)&&"type"in t&&typeof t.type=="string"}var fq=Symbol.for("immer-nothing"),Xj=Symbol.for("immer-draftable"),xa=Symbol.for("immer-state");function ao(t,...e){throw new Error(`[Immer] minified error nr: ${t}. Full error at: https://bit.ly/3cXEKWf`)}var ts=Object,Lp=ts.getPrototypeOf,f1="constructor",IS="prototype",y3="configurable",h1="enumerable",$b="writable",k0="value",nc=t=>!!t&&!!t[xa];function mo(t){return t?hq(t)||US(t)||!!t[Xj]||!!t[f1]?.[Xj]||FS(t)||zS(t):!1}var gTe=ts[IS][f1].toString(),Yj=new WeakMap;function hq(t){if(!t||!sD(t))return!1;const e=Lp(t);if(e===null||e===ts[IS])return!0;const n=ts.hasOwnProperty.call(e,f1)&&e[f1];if(n===Object)return!0;if(!Kh(n))return!1;let i=Yj.get(n);return i===void 0&&(i=Function.toString.call(n),Yj.set(n,i)),i===gTe}function pv(t,e,n=!0){mv(t)===0?(n?Reflect.ownKeys(t):ts.keys(t)).forEach(r=>{e(r,t[r],t)}):t.forEach((i,r)=>e(r,i,t))}function mv(t){const e=t[xa];return e?e.type_:US(t)?1:FS(t)?2:zS(t)?3:0}var Kj=(t,e,n=mv(t))=>n===2?t.has(e):ts[IS].hasOwnProperty.call(t,e),b3=(t,e,n=mv(t))=>n===2?t.get(e):t[e],p1=(t,e,n,i=mv(t))=>{i===2?t.set(e,n):i===3?t.add(n):t[e]=n};function vTe(t,e){return t===e?t!==0||1/t===1/e:t!==t&&e!==e}var US=Array.isArray,FS=t=>t instanceof Map,zS=t=>t instanceof Set,sD=t=>typeof t=="object",Kh=t=>typeof t=="function",TC=t=>typeof t=="boolean",Dl=t=>t.copy_||t.base_,oD=t=>t.modified_?t.copy_:t.base_;function _3(t,e){if(FS(t))return new Map(t);if(zS(t))return new Set(t);if(US(t))return Array[IS].slice.call(t);const n=hq(t);if(e===!0||e==="class_only"&&!n){const i=ts.getOwnPropertyDescriptors(t);delete i[xa];let r=Reflect.ownKeys(i);for(let a=0;a<r.length;a++){const s=r[a],o=i[s];o[$b]===!1&&(o[$b]=!0,o[y3]=!0),(o.get||o.set)&&(i[s]={[y3]:!0,[$b]:!0,[h1]:o[h1],[k0]:t[s]})}return ts.create(Lp(t),i)}else{const i=Lp(t);if(i!==null&&n)return{...t};const r=ts.create(i);return ts.assign(r,t)}}function lD(t,e=!1){return BS(t)||nc(t)||!mo(t)||(mv(t)>1&&ts.defineProperties(t,{set:fb,add:fb,clear:fb,delete:fb}),ts.freeze(t),e&&pv(t,(n,i)=>{lD(i,!0)},!1)),t}function xTe(){ao(2)}var fb={[k0]:xTe};function BS(t){return t===null||!sD(t)?!0:ts.isFrozen(t)}var m1="MapSet",S3="Patches",pq={};function kp(t){const e=pq[t];return e||ao(0,t),e}var yTe=t=>!!pq[t],I0,mq=()=>I0,bTe=(t,e)=>({drafts_:[],parent_:t,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:yTe(m1)?kp(m1):void 0});function Zj(t,e){e&&(t.patchPlugin_=kp(S3),t.patches_=[],t.inversePatches_=[],t.patchListener_=e)}function w3(t){M3(t),t.drafts_.forEach(_Te),t.drafts_=null}function M3(t){t===I0&&(I0=t.parent_)}var Jj=t=>I0=bTe(I0,t);function _Te(t){const e=t[xa];e.type_===0||e.type_===1?e.revoke_():e.revoked_=!0}function Qj(t,e){e.unfinalizedDrafts_=e.drafts_.length;const n=e.drafts_[0];if(t!==void 0&&t!==n){n[xa].modified_&&(w3(e),ao(4)),mo(t)&&(t=eH(e,t));const{patchPlugin_:r}=e;r&&r.generateReplacementPatches_(n[xa].base_,t,e)}else t=eH(e,n);return STe(e,t,!0),w3(e),e.patches_&&e.patchListener_(e.patches_,e.inversePatches_),t!==fq?t:void 0}function eH(t,e){if(BS(e))return e;const n=e[xa];if(!n)return cD(e,t.handledSet_,t);if(!jS(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);xq(n,t)}return n.copy_}function STe(t,e,n=!1){!t.parent_&&t.immer_.autoFreeze_&&t.canAutoFreeze_&&lD(e,n)}function gq(t){t.finalized_=!0,t.scope_.unfinalizedDrafts_--}var jS=(t,e)=>t.scope_===e,wTe=[];function vq(t,e,n,i){const r=Dl(t),a=t.type_;if(i!==void 0&&b3(r,i,a)===e){p1(r,i,n,a);return}if(!t.draftLocations_){const o=t.draftLocations_=new Map;pv(r,(l,c)=>{if(nc(c)){const d=o.get(c)||[];d.push(l),o.set(c,d)}})}const s=t.draftLocations_.get(e)??wTe;for(const o of s)p1(r,o,n,a)}function MTe(t,e,n){t.callbacks_.push(function(r){const a=e;if(!a||!jS(a,r))return;r.mapSetPlugin_?.fixSetContents(a);const s=oD(a);vq(t,a.draft_??a,s,n),xq(a,r)})}function xq(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)}gq(t)}}function ETe(t,e,n){const{scope_:i}=t;if(nc(n)){const r=n[xa];jS(r,i)&&r.callbacks_.push(function(){Wb(t);const s=oD(r);vq(t,n,s,e)})}else mo(n)&&t.callbacks_.push(function(){const a=Dl(t);b3(a,e,t.type_)===n&&i.drafts_.length>1&&(t.assigned_.get(e)??!1)===!0&&t.copy_&&cD(b3(t.copy_,e,t.type_),i.handledSet_,i)})}function cD(t,e,n){return!n.immer_.autoFreeze_&&n.unfinalizedDrafts_<1||nc(t)||e.has(t)||!mo(t)||BS(t)||(e.add(t),pv(t,(i,r)=>{if(nc(r)){const a=r[xa];if(jS(a,n)){const s=oD(a);p1(t,i,s,t.type_),gq(a)}}else mo(r)&&cD(r,e,n)})),t}function ATe(t,e){const n=US(t),i={type_:n?1:0,scope_:e?e.scope_:mq(),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=uD;n&&(r=[i],a=U0);const{revoke:s,proxy:o}=Proxy.revocable(r,a);return i.draft_=o,i.revoke_=s,[o,i]}var uD={get(t,e){if(e===xa)return t;const n=Dl(t);if(!Kj(n,e,t.type_))return TTe(t,n,e);const i=n[e];if(t.finalized_||!mo(i))return i;if(i===CC(t.base_,e)){Wb(t);const r=t.type_===1?+e:e,a=A3(t.scope_,i,t,r);return t.copy_[r]=a}return i},has(t,e){return e in Dl(t)},ownKeys(t){return Reflect.ownKeys(Dl(t))},set(t,e,n){const i=yq(Dl(t),e);if(i?.set)return i.set.call(t.draft_,n),!0;if(!t.modified_){const r=CC(Dl(t),e),a=r?.[xa];if(a&&a.base_===n)return t.copy_[e]=n,t.assigned_.set(e,!1),!0;if(vTe(n,r)&&(n!==void 0||Kj(t.base_,e,t.type_)))return!0;Wb(t),E3(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),ETe(t,e,n)),!0},deleteProperty(t,e){return Wb(t),CC(t.base_,e)!==void 0||e in t.base_?(t.assigned_.set(e,!1),E3(t)):t.assigned_.delete(e),t.copy_&&delete t.copy_[e],!0},getOwnPropertyDescriptor(t,e){const n=Dl(t),i=Reflect.getOwnPropertyDescriptor(n,e);return i&&{[$b]:!0,[y3]:t.type_!==1||e!=="length",[h1]:i[h1],[k0]:n[e]}},defineProperty(){ao(11)},getPrototypeOf(t){return Lp(t.base_)},setPrototypeOf(){ao(12)}},U0={};pv(uD,(t,e)=>{U0[t]=function(){const n=arguments;return n[0]=n[0][0],e.apply(this,n)}});U0.deleteProperty=function(t,e){return U0.set.call(this,t,e,void 0)};U0.set=function(t,e,n){return uD.set.call(this,t[0],e,n,t[0])};function CC(t,e){const n=t[xa];return(n?Dl(n):t)[e]}function TTe(t,e,n){const i=yq(e,n);return i?k0 in i?i[k0]:i.get?.call(t.draft_):void 0}function yq(t,e){if(!(e in t))return;let n=Lp(t);for(;n;){const i=Object.getOwnPropertyDescriptor(n,e);if(i)return i;n=Lp(n)}}function E3(t){t.modified_||(t.modified_=!0,t.parent_&&E3(t.parent_))}function Wb(t){t.copy_||(t.assigned_=new Map,t.copy_=_3(t.base_,t.scope_.immer_.useStrictShallowCopy_))}var CTe=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(n,i,r)=>{if(Kh(n)&&!Kh(i)){const s=i;i=n;const o=this;return function(c=s,...d){return o.produce(c,f=>i.call(this,f,...d))}}Kh(i)||ao(6),r!==void 0&&!Kh(r)&&ao(7);let a;if(mo(n)){const s=Jj(this),o=A3(s,n,void 0);let l=!0;try{a=i(o),l=!1}finally{l?w3(s):M3(s)}return Zj(s,r),Qj(a,s)}else if(!n||!sD(n)){if(a=i(n),a===void 0&&(a=n),a===fq&&(a=void 0),this.autoFreeze_&&lD(a,!0),r){const s=[],o=[];kp(S3).generateReplacementPatches_(n,a,{patches_:s,inversePatches_:o}),r(s,o)}return a}else ao(1,n)},this.produceWithPatches=(n,i)=>{if(Kh(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]},TC(e?.autoFreeze)&&this.setAutoFreeze(e.autoFreeze),TC(e?.useStrictShallowCopy)&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),TC(e?.useStrictIteration)&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){mo(e)||ao(8),nc(e)&&(e=ho(e));const n=Jj(this),i=A3(n,e,void 0);return i[xa].isManual_=!0,M3(n),i}finishDraft(e,n){const i=e&&e[xa];(!i||!i.isManual_)&&ao(9);const{scope_:r}=i;return Zj(r,n),Qj(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=kp(S3).applyPatches_;return nc(e)?r(e,n):this.produce(e,a=>r(a,n))}};function A3(t,e,n,i){const[r,a]=FS(e)?kp(m1).proxyMap_(e,n):zS(e)?kp(m1).proxySet_(e,n):ATe(e,n);return(n?.scope_??mq()).drafts_.push(r),a.callbacks_=n?.callbacks_??[],a.key_=i,n&&i!==void 0?MTe(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 ho(t){return nc(t)||ao(10,t),bq(t)}function bq(t){if(!mo(t)||BS(t))return t;const e=t[xa];let n,i=!0;if(e){if(!e.modified_)return e.base_;e.finalized_=!0,n=_3(t,e.scope_.immer_.useStrictShallowCopy_),i=e.scope_.immer_.shouldUseStrictIteration()}else n=_3(t,!0);return pv(n,(r,a)=>{p1(n,r,bq(a))},i),e&&(e.finalized_=!1),n}var RTe=new CTe,_q=RTe.produce;function Sq(t){return({dispatch:n,getState:i})=>r=>a=>typeof a=="function"?a(n,i,t):r(a)}var NTe=Sq(),PTe=Sq,DTe=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]=="object"?d1:d1.apply(null,arguments)};function js(t,e){function n(...i){if(e){let r=e(...i);if(!r)throw new Error(as(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=>dq(i)&&i.type===t,n}var wq=class zg extends Array{constructor(...e){super(...e),Object.setPrototypeOf(this,zg.prototype)}static get[Symbol.species](){return zg}concat(...e){return super.concat.apply(this,e)}prepend(...e){return e.length===1&&Array.isArray(e[0])?new zg(...e[0].concat(this)):new zg(...e.concat(this))}};function tH(t){return mo(t)?_q(t,()=>{}):t}function hb(t,e,n){return t.has(e)?t.get(e):t.set(e,n(e)).get(e)}function OTe(t){return typeof t=="boolean"}var LTe=()=>function(e){const{thunk:n=!0,immutableCheck:i=!0,serializableCheck:r=!0,actionCreatorCheck:a=!0}=e??{};let s=new wq;return n&&(OTe(n)?s.push(NTe):s.push(PTe(n.extraArgument))),s},Mq="RTK_autoBatch",ii=()=>t=>({payload:t,meta:{[Mq]:!0}}),nH=t=>e=>{setTimeout(e,t)},Eq=(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:nH(10):t.type==="callback"?t.queueNotification:nH(t.timeout),c=()=>{s=!1,a&&(a=!1,o.forEach(d=>d()))};return Object.assign({},i,{subscribe(d){const f=()=>r&&d(),p=i.subscribe(f);return o.add(d),()=>{p(),o.delete(d)}},dispatch(d){try{return r=!d?.meta?.[Mq],a=!r,a&&(s||(s=!0,l(c))),i.dispatch(d)}finally{r=!0}}})},kTe=t=>function(n){const{autoBatch:i=!0}=n??{};let r=new wq(t);return i&&r.push(Eq(typeof i=="object"?i:void 0)),r};function ITe(t){const e=LTe(),{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(aD(n))o=uq(n);else throw new Error(as(1));let l;typeof i=="function"?l=i(e):l=e();let c=d1;r&&(c=DTe({trace:!1,...typeof r=="object"&&r}));const d=mTe(...l),f=kTe(d);let p=typeof s=="function"?s(f):f();const m=c(...p);return cq(o,a,m)}function Aq(t){const e={},n=[];let i;const r={addCase(a,s){const o=typeof a=="string"?a:a.type;if(!o)throw new Error(as(28));if(o in e)throw new Error(as(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 UTe(t){return typeof t=="function"}function FTe(t,e){let[n,i,r]=Aq(e),a;if(UTe(t))a=()=>tH(t());else{const o=tH(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(nc(d)){const m=f(d,l);return m===void 0?d:m}else{if(mo(d))return _q(d,p=>f(p,l));{const p=f(d,l);if(p===void 0){if(d===null)return d;throw Error("A case reducer on a non-draftable value must not return undefined")}return p}}return d},o)}return s.getInitialState=a,s}var zTe="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW",BTe=(t=21)=>{let e="",n=t;for(;n--;)e+=zTe[Math.random()*64|0];return e},jTe=Symbol.for("rtk-slice-createasyncthunk");function HTe(t,e){return`${t}/${e}`}function VTe({creators:t}={}){const e=t?.asyncThunk?.[jTe];return function(i){const{name:r,reducerPath:a=r}=i;if(!r)throw new Error(as(11));const s=(typeof i.reducers=="function"?i.reducers($Te()):i.reducers)||{},o=Object.keys(s),l={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},c={addCase(w,E){const T=typeof w=="string"?w:w.type;if(!T)throw new Error(as(12));if(T in l.sliceCaseReducersByType)throw new Error(as(13));return l.sliceCaseReducersByType[T]=E,c},addMatcher(w,E){return l.sliceMatchers.push({matcher:w,reducer:E}),c},exposeAction(w,E){return l.actionCreators[w]=E,c},exposeCaseReducer(w,E){return l.sliceCaseReducersByName[w]=E,c}};o.forEach(w=>{const E=s[w],T={reducerName:w,type:HTe(r,w),createNotation:typeof i.reducers=="function"};qTe(E)?YTe(T,E,c,e):WTe(T,E,c)});function d(){const[w={},E=[],T=void 0]=typeof i.extraReducers=="function"?Aq(i.extraReducers):[i.extraReducers],P={...w,...l.sliceCaseReducersByType};return FTe(i.initialState,R=>{for(let U in P)R.addCase(U,P[U]);for(let U of l.sliceMatchers)R.addMatcher(U.matcher,U.reducer);for(let U of E)R.addMatcher(U.matcher,U.reducer);T&&R.addDefaultCase(T)})}const f=w=>w,p=new Map,m=new WeakMap;let y;function b(w,E){return y||(y=d()),y(w,E)}function x(){return y||(y=d()),y.getInitialState()}function v(w,E=!1){function T(R){let U=R[w];return typeof U>"u"&&E&&(U=hb(m,T,x)),U}function P(R=f){const U=hb(p,E,()=>new WeakMap);return hb(U,R,()=>{const N={};for(const[O,B]of Object.entries(i.selectors??{}))N[O]=GTe(B,R,()=>hb(m,R,x),E);return N})}return{reducerPath:w,getSelectors:P,get selectors(){return P(T)},selectSlice:T}}const M={name:r,reducer:b,actions:l.actionCreators,caseReducers:l.sliceCaseReducersByName,getInitialState:x,...v(a),injectInto(w,{reducerPath:E,...T}={}){const P=E??a;return w.inject({reducerPath:P,reducer:b},T),{...M,...v(P,!0)}}};return M}}function GTe(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 Ua=VTe();function $Te(){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 WTe({type:t,reducerName:e,createNotation:n},i,r){let a,s;if("reducer"in i){if(n&&!XTe(i))throw new Error(as(17));a=i.reducer,s=i.prepare}else a=i;r.addCase(t,a).exposeCaseReducer(e,a).exposeAction(e,s?js(t,s):js(t))}function qTe(t){return t._reducerDefinitionType==="asyncThunk"}function XTe(t){return t._reducerDefinitionType==="reducerWithPrepare"}function YTe({type:t,reducerName:e},n,i,r){if(!r)throw new Error(as(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||pb,pending:o||pb,rejected:l||pb,settled:c||pb})}function pb(){}var KTe="task",Tq="listener",Cq="completed",dD="cancelled",ZTe=`task-${dD}`,JTe=`task-${Cq}`,T3=`${Tq}-${dD}`,QTe=`${Tq}-${Cq}`,HS=class{constructor(t){this.code=t,this.message=`${KTe} ${dD} (reason: ${t})`}name="TaskAbortError";message},fD=(t,e)=>{if(typeof t!="function")throw new TypeError(as(32))},g1=()=>{},Rq=(t,e=g1)=>(t.catch(e),t),Nq=(t,e)=>(t.addEventListener("abort",e,{once:!0}),()=>t.removeEventListener("abort",e)),Xd=(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))},Yd=t=>{if(t.aborted){const{reason:e}=t;throw new HS(e)}};function Pq(t,e){let n=g1;return new Promise((i,r)=>{const a=()=>r(new HS(t.reason));if(t.aborted){a();return}n=Nq(t,a),e.finally(()=>n()).then(i,r)}).finally(()=>{n=g1})}var eCe=async(t,e)=>{try{return await Promise.resolve(),{status:"ok",value:await t()}}catch(n){return{status:n instanceof HS?"cancelled":"rejected",error:n}}finally{e?.()}},v1=t=>e=>Rq(Pq(t,e).then(n=>(Yd(t),n))),Dq=t=>{const e=v1(t);return n=>e(new Promise(i=>setTimeout(i,n)))},{assign:fp}=Object,iH={},VS="listenerMiddleware",tCe=(t,e)=>{const n=i=>Nq(t,()=>Xd(i,t.reason));return(i,r)=>{fD(i);const a=new AbortController;n(a);const s=eCe(async()=>{Yd(t),Yd(a.signal);const o=await i({pause:v1(a.signal),delay:Dq(a.signal),signal:a.signal});return Yd(a.signal),o},()=>Xd(a,JTe));return r?.autoJoin&&e.push(s.catch(g1)),{result:v1(t)(s),cancel(){Xd(a,ZTe)}}}},nCe=(t,e)=>{const n=async(i,r)=>{Yd(e);let a=()=>{};const o=[new Promise((l,c)=>{let d=t({predicate:i,effect:(f,p)=>{p.unsubscribe(),l([f,p.getState(),p.getOriginalState()])}});a=()=>{d(),c()}})];r!=null&&o.push(new Promise(l=>setTimeout(l,r,null)));try{const l=await Pq(e,Promise.race(o));return Yd(e),l}finally{a()}};return(i,r)=>Rq(n(i,r))},Oq=t=>{let{type:e,actionCreator:n,matcher:i,predicate:r,effect:a}=t;if(e)r=js(e).match;else if(n)e=n.type,r=n.match;else if(i)r=i;else if(!r)throw new Error(as(21));return fD(a),{predicate:r,type:e,effect:a}},Lq=fp(t=>{const{type:e,predicate:n,effect:i}=Oq(t);return{id:BTe(),effect:i,type:e,predicate:n,pending:new Set,unsubscribe:()=>{throw new Error(as(22))}}},{withTypes:()=>Lq}),rH=(t,e)=>{const{type:n,effect:i,predicate:r}=Oq(e);return Array.from(t.values()).find(a=>(typeof n=="string"?a.type===n:a.predicate===r)&&a.effect===i)},C3=t=>{t.pending.forEach(e=>{Xd(e,T3)})},iCe=(t,e)=>()=>{for(const n of e.keys())C3(n);t.clear()},aH=(t,e,n)=>{try{t(e,n)}catch(i){setTimeout(()=>{throw i},0)}},kq=fp(js(`${VS}/add`),{withTypes:()=>kq}),rCe=js(`${VS}/removeAll`),Iq=fp(js(`${VS}/remove`),{withTypes:()=>Iq}),aCe=(...t)=>{console.error(`${VS}/error`,...t)},gv=(t={})=>{const e=new Map,n=new Map,i=m=>{const y=n.get(m)??0;n.set(m,y+1)},r=m=>{const y=n.get(m)??1;y===1?n.delete(m):n.set(m,y-1)},{extra:a,onError:s=aCe}=t;fD(s);const o=m=>(m.unsubscribe=()=>e.delete(m.id),e.set(m.id,m),y=>{m.unsubscribe(),y?.cancelActive&&C3(m)}),l=m=>{const y=rH(e,m)??Lq(m);return o(y)};fp(l,{withTypes:()=>l});const c=m=>{const y=rH(e,m);return y&&(y.unsubscribe(),m.cancelActive&&C3(y)),!!y};fp(c,{withTypes:()=>c});const d=async(m,y,b,x)=>{const v=new AbortController,M=nCe(l,v.signal),w=[];try{m.pending.add(v),i(m),await Promise.resolve(m.effect(y,fp({},b,{getOriginalState:x,condition:(E,T)=>M(E,T).then(Boolean),take:M,delay:Dq(v.signal),pause:v1(v.signal),extra:a,signal:v.signal,fork:tCe(v.signal,w),unsubscribe:m.unsubscribe,subscribe:()=>{e.set(m.id,m)},cancelActiveListeners:()=>{m.pending.forEach((E,T,P)=>{E!==v&&(Xd(E,T3),P.delete(E))})},cancel:()=>{Xd(v,T3),m.pending.delete(v)},throwIfCancelled:()=>{Yd(v.signal)}})))}catch(E){E instanceof HS||aH(s,E,{raisedBy:"effect"})}finally{await Promise.all(w),Xd(v,QTe),r(m),m.pending.delete(v)}},f=iCe(e,n);return{middleware:m=>y=>b=>{if(!dq(b))return y(b);if(kq.match(b))return l(b.payload);if(rCe.match(b)){f();return}if(Iq.match(b))return c(b.payload);let x=m.getState();const v=()=>{if(x===iH)throw new Error(as(23));return x};let M;try{if(M=y(b),e.size>0){const w=m.getState(),E=Array.from(e.values());for(const T of E){let P=!1;try{P=T.predicate(b,w,x)}catch(R){P=!1,aH(s,R,{raisedBy:"predicate"})}P&&d(T,b,m,v)}}}finally{x=iH}return M},startListening:l,stopListening:c,clearListeners:f}};function as(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 sCe={layoutType:"horizontal",width:0,height:0,margin:{top:5,right:5,bottom:5,left:5},scale:1},Uq=Ua({name:"chartLayout",initialState:sCe,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:oCe,setLayout:lCe,setChartSize:cCe,setScale:uCe}=Uq.actions,dCe=Uq.reducer;function Fq(t,e,n){return Array.isArray(t)&&t&&e+n!==0?t.slice(e,n+1):t}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 tp(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){fCe(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 fCe(t,e,n){return(e=hCe(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function hCe(t){var e=pCe(t,"string");return typeof e=="symbol"?e:e+""}function pCe(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 Hn(t,e,n){return ui(t)||ui(e)?n:Vo(e)?vf(t,e,n):typeof e=="function"?e(t):n}var mCe=(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"&&Mt(t[a]))return tp(tp({},t),{},{[a]:t[a]+(i||0)});if((o==="horizontal"||o==="vertical"&&a==="center")&&s!=="middle"&&Mt(t[s]))return tp(tp({},t),{},{[s]:t[s]+(r||0)})}return t},cc=(t,e)=>t==="horizontal"&&e==="xAxis"||t==="vertical"&&e==="yAxis"||t==="centric"&&e==="angleAxis"||t==="radial"&&e==="radiusAxis",zq=(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},Bq=(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:p,axisType:m}=t;if(!s)return null;var y=o==="scaleBand"&&s.bandwidth?s.bandwidth()/2:2,b=r==="category"&&s.bandwidth?s.bandwidth()/y:0;if(b=m==="angleAxis"&&a&&a.length>=2?Sr(a[0]-a[1])*2*b:b,f||p){var x=(f||p||[]).map((v,M)=>{var w=i?i.indexOf(v):v;return{coordinate:s(w)+b,value:v,offset:b,index:M}});return x.filter(v=>!Bs(v.coordinate))}return l&&c?c.map((v,M)=>({coordinate:s(v)+b,value:v,index:M,offset:b})):s.ticks&&d!=null?s.ticks(d).map((v,M)=>({coordinate:s(v)+b,value:v,offset:b,index:M})):s.domain().map((v,M)=>({coordinate:s(v)+b,value:i?i[v]:v,index:M,offset:b}))},oH=1e-4,gCe=t=>{var e=t.domain();if(!(!e||e.length<=2)){var n=e.length,i=t.range(),r=Math.min(i[0],i[1])-oH,a=Math.max(i[0],i[1])+oH,s=t(e[0]),o=t(e[n-1]);(s<r||s>a||o<r||o>a)&&t.domain([e[0],e[n-1]])}},vCe=(t,e)=>{if(!e||e.length!==2||!Mt(e[0])||!Mt(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(!Mt(t[0])||t[0]<n)&&(r[0]=n),(!Mt(t[1])||t[1]>i)&&(r[1]=i),r[0]>i&&(r[0]=i),r[1]<n&&(r[1]=n),r},xCe=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=Bs(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])}},yCe=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=Bs(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)}},bCe={sign:xCe,expand:$Ee,none:Op,silhouette:WEe,wiggle:qEe,positive:yCe},_Ce=(t,e,n)=>{var i=bCe[n],r=GEe().keys(e).value((a,s)=>Number(Hn(a,s,0))).order(v3).offset(i);return r(t)};function jq(t){return t==null?void 0:String(t)}function lH(t){var{axis:e,ticks:n,bandSize:i,entry:r,index:a,dataKey:s}=t;if(e.type==="category"){if(!e.allowDuplicatedCategory&&e.dataKey&&!ui(r[e.dataKey])){var o=$7(n,"value",r[e.dataKey]);if(o)return o.coordinate+i/2}return n[a]?n[a].coordinate+i/2:null}var l=Hn(r,ui(s)?e.dataKey:s);return ui(l)?null:e.scale(l)}var cH=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=Hn(a,e.dataKey,e.scale.domain()[s]);return ui(o)?null:e.scale(o)-r/2+i},SCe=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]},wCe=t=>{var e=t.flat(2).filter(Mt);return[Math.min(...e),Math.max(...e)]},MCe=t=>[t[0]===1/0?0:t[0],t[1]===-1/0?0:t[1]],ECe=(t,e,n)=>{if(t!=null)return MCe(Object.keys(t).reduce((i,r)=>{var a=t[r],{stackedData:s}=a,o=s.reduce((l,c)=>{var d=Fq(c,e,n),f=wCe(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]))},uH=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,dH=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,Ip=(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=kS(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 fH(t){var{tooltipEntrySettings:e,dataKey:n,payload:i,value:r,name:a}=t;return tp(tp({},e),{},{dataKey:n,payload:i,value:r,name:a})}function em(t,e){if(t)return String(t);if(typeof e=="string")return e}var ACe=(t,e)=>{if(e==="horizontal")return t.chartX;if(e==="vertical")return t.chartY},TCe=(t,e)=>e==="centric"?t.angle:t.radius,uc=t=>t.layout.width,dc=t=>t.layout.height,CCe=t=>t.layout.scale,Hq=t=>t.layout.margin,GS=He(t=>t.cartesianAxis.xAxis,t=>Object.values(t)),$S=He(t=>t.cartesianAxis.yAxis,t=>Object.values(t)),Vq="data-recharts-item-index",Gq="data-recharts-item-data-key",vv=60;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 mb(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){RCe(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 RCe(t,e,n){return(e=NCe(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function NCe(t){var e=PCe(t,"string");return typeof e=="symbol"?e:e+""}function PCe(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 DCe=t=>t.brush.height;function OCe(t){var e=$S(t);return e.reduce((n,i)=>{if(i.orientation==="left"&&!i.mirror&&!i.hide){var r=typeof i.width=="number"?i.width:vv;return n+r}return n},0)}function LCe(t){var e=$S(t);return e.reduce((n,i)=>{if(i.orientation==="right"&&!i.mirror&&!i.hide){var r=typeof i.width=="number"?i.width:vv;return n+r}return n},0)}function kCe(t){var e=GS(t);return e.reduce((n,i)=>i.orientation==="top"&&!i.mirror&&!i.hide?n+i.height:n,0)}function ICe(t){var e=GS(t);return e.reduce((n,i)=>i.orientation==="bottom"&&!i.mirror&&!i.hide?n+i.height:n,0)}var sr=He([uc,dc,Hq,DCe,OCe,LCe,kCe,ICe,oq,lTe],(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},p=mb(mb({},f),d),m=p.bottom;p.bottom+=i,p=mCe(p,l,c);var y=t-p.left-p.right,b=e-p.top-p.bottom;return mb(mb({brushBottom:m},p),{},{width:Math.max(y,0),height:Math.max(b,0)})}),UCe=He(sr,t=>({x:t.left,y:t.top,width:t.width,height:t.height})),hD=He(uc,dc,(t,e)=>({x:0,y:0,width:t,height:e})),FCe=C.createContext(null),ra=()=>C.useContext(FCe)!=null,WS=t=>t.brush,qS=He([WS,sr,Hq],(t,e,n)=>({height:t.height,x:Mt(t.x)?t.x:e.left,y:Mt(t.y)?t.y:e.top+e.height+e.brushBottom-(n?.bottom||0),width:Mt(t.width)?t.width:e.width})),RC={},NC={},PC={},pH;function zCe(){return pH||(pH=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(),b()};let p=null;const m=()=>{p!=null&&clearTimeout(p),p=setTimeout(()=>{p=null,f()},i)},y=()=>{p!==null&&(clearTimeout(p),p=null)},b=()=>{y(),s=void 0,o=null},x=()=>{d()},v=function(...M){if(r?.aborted)return;s=this,o=M;const w=p==null;m(),l&&w&&d()};return v.schedule=m,v.cancel=b,v.flush=x,r?.addEventListener("abort",b,{once:!0}),v}t.debounce=e})(PC)),PC}var mH;function BCe(){return mH||(mH=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=zCe();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 p=e.debounce(function(...b){d=i.apply(this,b),f=null},r,{edges:c}),m=function(...b){return l!=null&&(f===null&&(f=Date.now()),Date.now()-f>=l)?(d=i.apply(this,b),f=Date.now(),p.cancel(),p.schedule(),d):(p.apply(this,b),d)},y=()=>(p.flush(),d);return m.cancel=p.cancel,m.flush=y,m}t.debounce=n})(NC)),NC}var gH;function jCe(){return gH||(gH=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=BCe();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})(RC)),RC}var DC,vH;function HCe(){return vH||(vH=1,DC=jCe().throttle),DC}var VCe=HCe();const GCe=Vs(VCe);var x1=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++]))}},$q=(t,e,n)=>{var{width:i="100%",height:r="100%",aspect:a,maxHeight:s}=n,o=tc(i)?t:Number(i),l=tc(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}},$Ce={width:0,height:0,overflow:"visible"},WCe={width:0,overflowX:"visible"},qCe={height:0,overflowY:"visible"},XCe={},YCe=t=>{var{width:e,height:n}=t,i=tc(e),r=tc(n);return i&&r?$Ce:i?WCe:r?qCe:XCe};function KCe(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 ti(t){return Number.isFinite(t)}function Go(t){return typeof t=="number"&&t>0&&Number.isFinite(t)}function R3(){return R3=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},R3.apply(null,arguments)}function xH(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?xH(Object(n),!0).forEach(function(i){ZCe(t,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):xH(Object(n)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(n,i))})}return t}function ZCe(t,e,n){return(e=JCe(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function JCe(t){var e=QCe(t,"string");return typeof e=="symbol"?e:e+""}function QCe(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 Wq=C.createContext({width:-1,height:-1});function e2e(t){return Go(t.width)&&Go(t.height)}function qq(t){var{children:e,width:n,height:i}=t,r=C.useMemo(()=>({width:n,height:i}),[n,i]);return e2e(r)?C.createElement(Wq.Provider,{value:r},e):null}var pD=()=>C.useContext(Wq),t2e=C.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:p,onResize:m,style:y={}}=t,b=C.useRef(null),x=C.useRef();x.current=m,C.useImperativeHandle(e,()=>b.current);var[v,M]=C.useState({containerWidth:i.width,containerHeight:i.height}),w=C.useCallback((U,N)=>{M(O=>{var B=Math.round(U),I=Math.round(N);return O.containerWidth===B&&O.containerHeight===I?O:{containerWidth:B,containerHeight:I}})},[]);C.useEffect(()=>{if(b.current==null||typeof ResizeObserver>"u")return fv;var U=I=>{var W,{width:L,height:$}=I[0].contentRect;w(L,$),(W=x.current)===null||W===void 0||W.call(x,L,$)};d>0&&(U=GCe(U,d,{trailing:!0,leading:!1}));var N=new ResizeObserver(U),{width:O,height:B}=b.current.getBoundingClientRect();return w(O,B),N.observe(b.current),()=>{N.disconnect()}},[w,d]);var{containerWidth:E,containerHeight:T}=v;x1(!n||n>0,"The aspect(%s) must be greater than zero.",n);var{calculatedWidth:P,calculatedHeight:R}=$q(E,T,{width:r,height:a,aspect:n,maxHeight:l});return x1(P!=null&&P>0||R!=null&&R>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,R,r,a,s,o,n),C.createElement("div",{id:f?"".concat(f):void 0,className:yn("recharts-responsive-container",p),style:yH(yH({},y),{},{width:r,height:a,minWidth:s,minHeight:o,maxHeight:l}),ref:b},C.createElement("div",{style:YCe({width:r,height:a})},C.createElement(qq,{width:P,height:R},c)))}),OC=C.forwardRef((t,e)=>{var n=pD();if(Go(n.width)&&Go(n.height))return t.children;var{width:i,height:r}=KCe({width:t.width,height:t.height,aspect:t.aspect}),{calculatedWidth:a,calculatedHeight:s}=$q(void 0,void 0,{width:i,height:r,aspect:t.aspect,maxHeight:t.maxHeight});return Mt(a)&&Mt(s)?C.createElement(qq,{width:a,height:s},t.children):C.createElement(t2e,R3({},t,{width:i,height:r,ref:e}))});function Xq(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 XS=()=>{var t,e=ra(),n=Et(UCe),i=Et(qS),r=(t=Et(WS))===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}},n2e={top:0,bottom:0,left:0,right:0,width:0,height:0,brushBottom:0},Yq=()=>{var t;return(t=Et(sr))!==null&&t!==void 0?t:n2e},mD=()=>Et(uc),gD=()=>Et(dc),i2e=()=>Et(t=>t.layout.margin),mn=t=>t.layout.layoutType,tm=()=>Et(mn),r2e=()=>{var t=tm();if(t==="horizontal"||t==="vertical")return t},a2e=()=>{var t=tm();return t!==void 0},YS=t=>{var e=qn(),n=ra(),{width:i,height:r}=t,a=pD(),s=i,o=r;return a&&(s=a.width>0?a.width:i,o=a.height>0?a.height:r),C.useEffect(()=>{!n&&Go(s)&&Go(o)&&e(cCe({width:s,height:o}))},[e,n,s,o]),null},Kq=Symbol.for("immer-nothing"),bH=Symbol.for("immer-draftable"),ls=Symbol.for("immer-state");function so(t,...e){throw new Error(`[Immer] minified error nr: ${t}. Full error at: https://bit.ly/3cXEKWf`)}var F0=Object.getPrototypeOf;function Up(t){return!!t&&!!t[ls]}function xf(t){return t?Zq(t)||Array.isArray(t)||!!t[bH]||!!t.constructor?.[bH]||xv(t)||ZS(t):!1}var s2e=Object.prototype.constructor.toString(),_H=new WeakMap;function Zq(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=_H.get(n);return i===void 0&&(i=Function.toString.call(n),_H.set(n,i)),i===s2e}function y1(t,e,n=!0){KS(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 KS(t){const e=t[ls];return e?e.type_:Array.isArray(t)?1:xv(t)?2:ZS(t)?3:0}function N3(t,e){return KS(t)===2?t.has(e):Object.prototype.hasOwnProperty.call(t,e)}function Jq(t,e,n){const i=KS(t);i===2?t.set(e,n):i===3?t.add(n):t[e]=n}function o2e(t,e){return t===e?t!==0||1/t===1/e:t!==t&&e!==e}function xv(t){return t instanceof Map}function ZS(t){return t instanceof Set}function wd(t){return t.copy_||t.base_}function P3(t,e){if(xv(t))return new Map(t);if(ZS(t))return new Set(t);if(Array.isArray(t))return Array.prototype.slice.call(t);const n=Zq(t);if(e===!0||e==="class_only"&&!n){const i=Object.getOwnPropertyDescriptors(t);delete i[ls];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(F0(t),i)}else{const i=F0(t);if(i!==null&&n)return{...t};const r=Object.create(i);return Object.assign(r,t)}}function vD(t,e=!1){return JS(t)||Up(t)||!xf(t)||(KS(t)>1&&Object.defineProperties(t,{set:gb,add:gb,clear:gb,delete:gb}),Object.freeze(t),e&&Object.values(t).forEach(n=>vD(n,!0))),t}function l2e(){so(2)}var gb={value:l2e};function JS(t){return t===null||typeof t!="object"?!0:Object.isFrozen(t)}var c2e={};function yf(t){const e=c2e[t];return e||so(0,t),e}var z0;function Qq(){return z0}function u2e(t,e){return{drafts_:[],parent_:t,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function SH(t,e){e&&(yf("Patches"),t.patches_=[],t.inversePatches_=[],t.patchListener_=e)}function D3(t){O3(t),t.drafts_.forEach(d2e),t.drafts_=null}function O3(t){t===z0&&(z0=t.parent_)}function wH(t){return z0=u2e(z0,t)}function d2e(t){const e=t[ls];e.type_===0||e.type_===1?e.revoke_():e.revoked_=!0}function MH(t,e){e.unfinalizedDrafts_=e.drafts_.length;const n=e.drafts_[0];return t!==void 0&&t!==n?(n[ls].modified_&&(D3(e),so(4)),xf(t)&&(t=b1(e,t),e.parent_||_1(e,t)),e.patches_&&yf("Patches").generateReplacementPatches_(n[ls].base_,t,e.patches_,e.inversePatches_)):t=b1(e,n,[]),D3(e),e.patches_&&e.patchListener_(e.patches_,e.inversePatches_),t!==Kq?t:void 0}function b1(t,e,n){if(JS(e))return e;const i=t.immer_.shouldUseStrictIteration(),r=e[ls];if(!r)return y1(e,(a,s)=>EH(t,r,e,a,s,n),i),e;if(r.scope_!==t)return e;if(!r.modified_)return _1(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),y1(s,(l,c)=>EH(t,r,a,l,c,n,o),i),_1(t,a,!1),n&&t.patches_&&yf("Patches").generatePatches_(r,n,t.patches_,t.inversePatches_)}return r.copy_}function EH(t,e,n,i,r,a,s){if(r==null||typeof r!="object"&&!s)return;const o=JS(r);if(!(o&&!s)){if(Up(r)){const l=a&&e&&e.type_!==3&&!N3(e.assigned_,i)?a.concat(i):void 0,c=b1(t,r,l);if(Jq(n,i,c),Up(c))t.canAutoFreeze_=!1;else return}else s&&n.add(r);if(xf(r)&&!o){if(!t.immer_.autoFreeze_&&t.unfinalizedDrafts_<1||e&&e.base_&&e.base_[i]===r&&o)return;b1(t,r),(!e||!e.scope_.parent_)&&typeof i!="symbol"&&(xv(n)?n.has(i):Object.prototype.propertyIsEnumerable.call(n,i))&&_1(t,r)}}}function _1(t,e,n=!1){!t.parent_&&t.immer_.autoFreeze_&&t.canAutoFreeze_&&vD(e,n)}function f2e(t,e){const n=Array.isArray(t),i={type_:n?1:0,scope_:e?e.scope_:Qq(),modified_:!1,finalized_:!1,assigned_:{},parent_:e,base_:t,draft_:null,copy_:null,revoke_:null,isManual_:!1};let r=i,a=xD;n&&(r=[i],a=B0);const{revoke:s,proxy:o}=Proxy.revocable(r,a);return i.draft_=o,i.revoke_=s,o}var xD={get(t,e){if(e===ls)return t;const n=wd(t);if(!N3(n,e))return h2e(t,n,e);const i=n[e];return t.finalized_||!xf(i)?i:i===LC(t.base_,e)?(kC(t),t.copy_[e]=k3(i,t)):i},has(t,e){return e in wd(t)},ownKeys(t){return Reflect.ownKeys(wd(t))},set(t,e,n){const i=eX(wd(t),e);if(i?.set)return i.set.call(t.draft_,n),!0;if(!t.modified_){const r=LC(wd(t),e),a=r?.[ls];if(a&&a.base_===n)return t.copy_[e]=n,t.assigned_[e]=!1,!0;if(o2e(n,r)&&(n!==void 0||N3(t.base_,e)))return!0;kC(t),L3(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 LC(t.base_,e)!==void 0||e in t.base_?(t.assigned_[e]=!1,kC(t),L3(t)):delete t.assigned_[e],t.copy_&&delete t.copy_[e],!0},getOwnPropertyDescriptor(t,e){const n=wd(t),i=Reflect.getOwnPropertyDescriptor(n,e);return i&&{writable:!0,configurable:t.type_!==1||e!=="length",enumerable:i.enumerable,value:n[e]}},defineProperty(){so(11)},getPrototypeOf(t){return F0(t.base_)},setPrototypeOf(){so(12)}},B0={};y1(xD,(t,e)=>{B0[t]=function(){return arguments[0]=arguments[0][0],e.apply(this,arguments)}});B0.deleteProperty=function(t,e){return B0.set.call(this,t,e,void 0)};B0.set=function(t,e,n){return xD.set.call(this,t[0],e,n,t[0])};function LC(t,e){const n=t[ls];return(n?wd(n):t)[e]}function h2e(t,e,n){const i=eX(e,n);return i?"value"in i?i.value:i.get?.call(t.draft_):void 0}function eX(t,e){if(!(e in t))return;let n=F0(t);for(;n;){const i=Object.getOwnPropertyDescriptor(n,e);if(i)return i;n=F0(n)}}function L3(t){t.modified_||(t.modified_=!0,t.parent_&&L3(t.parent_))}function kC(t){t.copy_||(t.copy_=P3(t.base_,t.scope_.immer_.useStrictShallowCopy_))}var p2e=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"&&so(6),i!==void 0&&typeof i!="function"&&so(7);let r;if(xf(e)){const a=wH(this),s=k3(e,void 0);let o=!0;try{r=n(s),o=!1}finally{o?D3(a):O3(a)}return SH(a,i),MH(r,a)}else if(!e||typeof e!="object"){if(r=n(e),r===void 0&&(r=e),r===Kq&&(r=void 0),this.autoFreeze_&&vD(r,!0),i){const a=[],s=[];yf("Patches").generateReplacementPatches_(e,r,a,s),i(a,s)}return r}else so(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){xf(t)||so(8),Up(t)&&(t=m2e(t));const e=wH(this),n=k3(t,void 0);return n[ls].isManual_=!0,O3(e),n}finishDraft(t,e){const n=t&&t[ls];(!n||!n.isManual_)&&so(9);const{scope_:i}=n;return SH(i,e),MH(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=yf("Patches").applyPatches_;return Up(t)?i(t,e):this.produce(t,r=>i(r,e))}};function k3(t,e){const n=xv(t)?yf("MapSet").proxyMap_(t,e):ZS(t)?yf("MapSet").proxySet_(t,e):f2e(t,e);return(e?e.scope_:Qq()).drafts_.push(n),n}function m2e(t){return Up(t)||so(10,t),tX(t)}function tX(t){if(!xf(t)||JS(t))return t;const e=t[ls];let n,i=!0;if(e){if(!e.modified_)return e.base_;e.finalized_=!0,n=P3(t,e.scope_.immer_.useStrictShallowCopy_),i=e.scope_.immer_.shouldUseStrictIteration()}else n=P3(t,!0);return y1(n,(r,a)=>{Jq(n,r,tX(a))},i),e&&(e.finalized_=!1),n}var g2e=new p2e;g2e.produce;var v2e={settings:{layout:"horizontal",align:"center",verticalAlign:"middle",itemSorter:"value"},size:{width:0,height:0},payload:[]},nX=Ua({name:"legend",initialState:v2e,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:ii()},replaceLegendPayload:{reducer(t,e){var{prev:n,next:i}=e.payload,r=ho(t).payload.indexOf(n);r>-1&&(t.payload[r]=i)},prepare:ii()},removeLegendPayload:{reducer(t,e){var n=ho(t).payload.indexOf(e.payload);n>-1&&t.payload.splice(n,1)},prepare:ii()}}}),{setLegendSize:AH,setLegendSettings:x2e,addLegendPayload:iX,replaceLegendPayload:rX,removeLegendPayload:aX}=nX.actions,y2e=nX.reducer,b2e=["contextPayload"];function I3(){return I3=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},I3.apply(null,arguments)}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 Fp(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){_2e(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 _2e(t,e,n){return(e=S2e(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function S2e(t){var e=w2e(t,"string");return typeof e=="symbol"?e:e+""}function w2e(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 M2e(t,e){if(t==null)return{};var n,i,r=E2e(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 E2e(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 A2e(t){return t.value}function T2e(t){var{contextPayload:e}=t,n=M2e(t,b2e),i=iq(e,t.payloadUniqBy,A2e),r=Fp(Fp({},n),{},{payload:i});return C.isValidElement(t.content)?C.cloneElement(t.content,r):typeof t.content=="function"?C.createElement(t.content,r):C.createElement(SAe,r)}function C2e(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}),Fp(Fp({},c),d)}function R2e(t){var e=qn();return C.useEffect(()=>{e(x2e(t))},[e,t]),null}function N2e(t){var e=qn();return C.useEffect(()=>(e(AH(t)),()=>{e(AH({width:0,height:0}))}),[e,t]),null}function P2e(t,e,n,i){return t==="vertical"&&Mt(e)?{height:e}:t==="horizontal"?{width:n||i}:null}var D2e={align:"center",iconSize:14,itemSorter:"value",layout:"horizontal",verticalAlign:"bottom"};function sX(t){var e=qi(t,D2e),n=dTe(),i=pEe(),r=i2e(),{width:a,height:s,wrapperStyle:o,portal:l}=e,[c,d]=lq([n]),f=mD(),p=gD();if(f==null||p==null)return null;var m=f-(r?.left||0)-(r?.right||0),y=P2e(e.layout,s,a,m),b=l?o:Fp(Fp({position:"absolute",width:y?.width||a||"auto",height:y?.height||s||"auto"},C2e(o,e,r,f,p,c)),o),x=l??i;if(x==null||n==null)return null;var v=C.createElement("div",{className:"recharts-legend-wrapper",style:b,ref:d},C.createElement(R2e,{layout:e.layout,align:e.align,verticalAlign:e.verticalAlign,itemSorter:e.itemSorter}),!l&&C.createElement(N2e,{width:c.width,height:c.height}),C.createElement(T2e,I3({},e,y,{margin:r,chartWidth:f,chartHeight:p,contextPayload:n})));return Il.createPortal(v,x)}sX.displayName="Legend";function U3(){return U3=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},U3.apply(null,arguments)}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 IC(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){O2e(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 O2e(t,e,n){return(e=L2e(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function L2e(t){var e=k2e(t,"string");return typeof e=="symbol"?e:e+""}function k2e(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 I2e(t){return Array.isArray(t)&&Vo(t[0])&&Vo(t[1])?t.join(" ~ "):t}var U2e=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:p=!1}=t,m=()=>{if(a&&a.length){var T={padding:0,margin:0},P=(o?kS(a,o):a).map((R,U)=>{if(R.type==="none")return null;var N=R.formatter||s||I2e,{value:O,name:B}=R,I=O,W=B;if(N){var L=N(O,B,R,U,a);if(Array.isArray(L))[I,W]=L;else if(L!=null)I=L;else return null}var $=IC({display:"block",paddingTop:4,paddingBottom:4,color:R.color||"#000"},i);return C.createElement("li",{className:"recharts-tooltip-item",key:"tooltip-item-".concat(U),style:$},Vo(W)?C.createElement("span",{className:"recharts-tooltip-item-name"},W):null,Vo(W)?C.createElement("span",{className:"recharts-tooltip-item-separator"},e):null,C.createElement("span",{className:"recharts-tooltip-item-value"},I),C.createElement("span",{className:"recharts-tooltip-item-unit"},R.unit||""))});return C.createElement("ul",{className:"recharts-tooltip-item-list",style:T},P)}return null},y=IC({margin:0,padding:10,backgroundColor:"#fff",border:"1px solid #ccc",whiteSpace:"nowrap"},n),b=IC({margin:0},r),x=!ui(d),v=x?d:"",M=yn("recharts-default-tooltip",l),w=yn("recharts-tooltip-label",c);x&&f&&a!==void 0&&a!==null&&(v=f(d,a));var E=p?{role:"status","aria-live":"assertive"}:{};return C.createElement("div",U3({className:M,style:y},E),C.createElement("p",{className:w,style:b},C.isValidElement(v)?v:"".concat(v)),m())},Sg="recharts-tooltip-wrapper",F2e={visibility:"hidden"};function z2e(t){var{coordinate:e,translateX:n,translateY:i}=t;return yn(Sg,{["".concat(Sg,"-right")]:Mt(n)&&e&&Mt(e.x)&&n>=e.x,["".concat(Sg,"-left")]:Mt(n)&&e&&Mt(e.x)&&n<e.x,["".concat(Sg,"-bottom")]:Mt(i)&&e&&Mt(e.y)&&i>=e.y,["".concat(Sg,"-top")]:Mt(i)&&e&&Mt(e.y)&&i<e.y})}function RH(t){var{allowEscapeViewBox:e,coordinate:n,key:i,offsetTopLeft:r,position:a,reverseDirection:s,tooltipDimension:o,viewBox:l,viewBoxDimension:c}=t;if(a&&Mt(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 p=l[i];if(p==null)return 0;if(s[i]){var m=d,y=p;return m<y?Math.max(f,p):Math.max(d,p)}if(c==null)return 0;var b=f+o,x=p+c;return b>x?Math.max(d,p):Math.max(f,p)}function B2e(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 j2e(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=RH({allowEscapeViewBox:e,coordinate:n,key:"x",offsetTopLeft:i,position:r,reverseDirection:a,tooltipDimension:s.width,viewBox:l,viewBoxDimension:l.width}),f=RH({allowEscapeViewBox:e,coordinate:n,key:"y",offsetTopLeft:i,position:r,reverseDirection:a,tooltipDimension:s.height,viewBox:l,viewBoxDimension:l.height}),c=B2e({translateX:d,translateY:f,useTranslate3d:o})):c=F2e,{cssProperties:c,cssClasses:z2e({translateX:d,translateY:f,coordinate:n})}}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 vb(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){F3(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 F3(t,e,n){return(e=H2e(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function H2e(t){var e=V2e(t,"string");return typeof e=="symbol"?e:e+""}function V2e(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 G2e extends C.PureComponent{constructor(){super(...arguments),F3(this,"state",{dismissed:!1,dismissedAtCoordinate:{x:0,y:0}}),F3(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:p,viewBox:m,wrapperStyle:y,lastBoundingBox:b,innerRef:x,hasPortalFromProps:v}=this.props,{cssClasses:M,cssProperties:w}=j2e({allowEscapeViewBox:n,coordinate:s,offsetTopLeft:c,position:d,reverseDirection:f,tooltipBox:{height:b.height,width:b.width},useTranslate3d:p,viewBox:m}),E=v?{}:vb(vb({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}),T=vb(vb({},E),{},{visibility:!this.state.dismissed&&e&&o?"visible":"hidden"},y);return C.createElement("div",{xmlns:"http://www.w3.org/1999/xhtml",tabIndex:-1,className:M,style:T,ref:x},a)}}var oX=()=>{var t;return(t=Et(e=>e.rootProps.accessibilityLayer))!==null&&t!==void 0?t:!0};function z3(){return z3=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},z3.apply(null,arguments)}function PH(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 DH(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?PH(Object(n),!0).forEach(function(i){$2e(t,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):PH(Object(n)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(n,i))})}return t}function $2e(t,e,n){return(e=W2e(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function W2e(t){var e=q2e(t,"string");return typeof e=="symbol"?e:e+""}function q2e(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 OH={curveBasisClosed:OEe,curveBasisOpen:LEe,curveBasis:DEe,curveBumpX:xEe,curveBumpY:yEe,curveLinearClosed:kEe,curveLinear:OS,curveMonotoneX:IEe,curveMonotoneY:UEe,curveNatural:FEe,curveStep:zEe,curveStepAfter:jEe,curveStepBefore:BEe},S1=t=>ti(t.x)&&ti(t.y),LH=t=>t.base!=null&&S1(t.base)&&S1(t),wg=t=>t.x,Mg=t=>t.y,X2e=(t,e)=>{if(typeof t=="function")return t;var n="curve".concat(dv(t));return(n==="curveMonotone"||n==="curveBump")&&e?OH["".concat(n).concat(e==="vertical"?"Y":"X")]:OH[n]||OS},Y2e=t=>{var{type:e="linear",points:n=[],baseLine:i,layout:r,connectNulls:a=!1}=t,s=X2e(e,r),o=a?n.filter(S1):n,l;if(Array.isArray(i)){var c=n.map((m,y)=>DH(DH({},m),{},{base:i[y]}));r==="vertical"?l=cb().y(Mg).x1(wg).x0(m=>m.base.x):l=cb().x(wg).y1(Mg).y0(m=>m.base.y);var d=l.defined(LH).curve(s),f=a?c.filter(LH):c;return d(f)}r==="vertical"&&Mt(i)?l=cb().y(Mg).x1(wg).x0(i):Mt(i)?l=cb().x(wg).y1(Mg).y0(i):l=D7().x(wg).y(Mg);var p=l.defined(S1).curve(s);return p(o)},hp=t=>{var{className:e,points:n,path:i,pathRef:r}=t;if((!n||!n.length)&&!i)return null;var a=n&&n.length?Y2e(t):i;return C.createElement("path",z3({},ka(t),nD(t),{className:yn("recharts-curve",e),d:a===null?void 0:a,ref:r}))},K2e=["x","y","top","left","width","height","className"];function B3(){return B3=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},B3.apply(null,arguments)}function kH(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 Z2e(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?kH(Object(n),!0).forEach(function(i){J2e(t,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):kH(Object(n)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(n,i))})}return t}function J2e(t,e,n){return(e=Q2e(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Q2e(t){var e=eRe(t,"string");return typeof e=="symbol"?e:e+""}function eRe(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 tRe(t,e){if(t==null)return{};var n,i,r=nRe(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 nRe(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 iRe=(t,e,n,i,r,a)=>"M".concat(t,",").concat(r,"v").concat(i,"M").concat(a,",").concat(e,"h").concat(n),rRe=t=>{var{x:e=0,y:n=0,top:i=0,left:r=0,width:a=0,height:s=0,className:o}=t,l=tRe(t,K2e),c=Z2e({x:e,y:n,top:i,left:r,width:a,height:s},l);return!Mt(e)||!Mt(n)||!Mt(a)||!Mt(s)||!Mt(i)||!Mt(r)?null:C.createElement("path",B3({},va(c),{className:yn("recharts-cross",o),d:iRe(e,n,a,s,i,r)}))};function aRe(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 IH(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 UH(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?IH(Object(n),!0).forEach(function(i){sRe(t,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):IH(Object(n)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(n,i))})}return t}function sRe(t,e,n){return(e=oRe(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function oRe(t){var e=lRe(t,"string");return typeof e=="symbol"?e:e+""}function lRe(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 cRe=t=>t.replace(/([A-Z])/g,e=>"-".concat(e.toLowerCase())),lX=(t,e,n)=>t.map(i=>"".concat(cRe(i)," ").concat(e,"ms ").concat(n)).join(","),uRe=(t,e)=>[Object.keys(t),Object.keys(e)].reduce((n,i)=>n.filter(r=>i.includes(r))),j0=(t,e)=>Object.keys(e).reduce((n,i)=>UH(UH({},n),{},{[i]:t(i,e[i])}),{});function FH(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 Ji(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?FH(Object(n),!0).forEach(function(i){dRe(t,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):FH(Object(n)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(n,i))})}return t}function dRe(t,e,n){return(e=fRe(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function fRe(t){var e=hRe(t,"string");return typeof e=="symbol"?e:e+""}function hRe(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 w1=(t,e,n)=>t+(e-t)*n,j3=t=>{var{from:e,to:n}=t;return e!==n},cX=(t,e,n)=>{var i=j0((r,a)=>{if(j3(a)){var[s,o]=t(a.from,a.to,a.velocity);return Ji(Ji({},a),{},{from:s,velocity:o})}return a},e);return n<1?j0((r,a)=>j3(a)?Ji(Ji({},a),{},{velocity:w1(a.velocity,i[r].velocity,n),from:w1(a.from,i[r].from,n)}):a,e):cX(t,i,n-1)};function pRe(t,e,n,i,r,a){var s,o=i.reduce((p,m)=>Ji(Ji({},p),{},{[m]:{from:t[m],velocity:0,to:e[m]}}),{}),l=()=>j0((p,m)=>m.from,o),c=()=>!Object.values(o).filter(j3).length,d=null,f=p=>{s||(s=p);var m=p-s,y=m/n.dt;o=cX(n,o,y),r(Ji(Ji(Ji({},t),e),l())),s=p,c()||(d=a.setTimeout(f))};return()=>(d=a.setTimeout(f),()=>{var p;(p=d)===null||p===void 0||p()})}function mRe(t,e,n,i,r,a,s){var o=null,l=r.reduce((f,p)=>Ji(Ji({},f),{},{[p]:[t[p],e[p]]}),{}),c,d=f=>{c||(c=f);var p=(f-c)/i,m=j0((b,x)=>w1(...x,n(p)),l);if(a(Ji(Ji(Ji({},t),e),m)),p<1)o=s.setTimeout(d);else{var y=j0((b,x)=>w1(...x,n(1)),l);a(Ji(Ji(Ji({},t),e),y))}};return()=>(o=s.setTimeout(d),()=>{var f;(f=o)===null||f===void 0||f()})}const gRe=(t,e,n,i,r,a)=>{var s=uRe(t,e);return n==null?()=>(r(Ji(Ji({},t),e)),()=>{}):n.isStepper===!0?pRe(t,e,n,s,r,a):mRe(t,e,n,i,s,r,a)};var M1=1e-4,uX=(t,e)=>[0,3*t,3*e-6*t,3*t-3*e+1],dX=(t,e)=>t.map((n,i)=>n*e**i).reduce((n,i)=>n+i),zH=(t,e)=>n=>{var i=uX(t,e);return dX(i,n)},vRe=(t,e)=>n=>{var i=uX(t,e),r=[...i.map((a,s)=>a*s).slice(1),0];return dX(r,n)},xRe=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]},yRe=(t,e,n,i)=>{var r=zH(t,n),a=zH(e,i),s=vRe(t,n),o=c=>c>1?1:c<0?0:c,l=c=>{for(var d=c>1?1:c,f=d,p=0;p<8;++p){var m=r(f)-d,y=s(f);if(Math.abs(m-d)<M1||y<M1)return a(f);f=o(f-m/y)}return a(f)};return l.isStepper=!1,l},BH=function(){return yRe(...xRe(...arguments))},bRe=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,p=l*r/1e3+s;return Math.abs(p-o)<M1&&Math.abs(f)<M1?[o,0]:[p,f]};return a.isStepper=!0,a.dt=r,a},_Re=t=>{if(typeof t=="string")switch(t){case"ease":case"ease-in-out":case"ease-out":case"ease-in":case"linear":return BH(t);case"spring":return bRe();default:if(t.split("(")[0]==="cubic-bezier")return BH(t)}return typeof t=="function"?t:null};function SRe(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 wRe{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 MRe(){return SRe(new wRe)}var ERe=C.createContext(MRe);function ARe(t,e){var n=C.useContext(ERe);return C.useMemo(()=>e??n(t),[t,e,n])}var TRe=()=>!(typeof window<"u"&&window.document&&window.document.createElement&&window.setTimeout),nm={devToolsEnabled:!1,isSsr:TRe()},CRe={begin:0,duration:1e3,easing:"ease",isActive:!0,canBegin:!0,onAnimationEnd:()=>{},onAnimationStart:()=>{}},jH={t:0},UC={t:1};function yv(t){var e=qi(t,CRe),{isActive:n,canBegin:i,duration:r,easing:a,begin:s,onAnimationEnd:o,onAnimationStart:l,children:c}=e,d=n==="auto"?!nm.isSsr:n,f=ARe(e.animationId,e.animationManager),[p,m]=C.useState(d?jH:UC),y=C.useRef(null);return C.useEffect(()=>{d||m(UC)},[d]),C.useEffect(()=>{if(!d||!i)return fv;var b=gRe(jH,UC,_Re(a),r,m,f.getTimeoutController()),x=()=>{y.current=b()};return f.start([l,s,x,r,o]),()=>{f.stop(),y.current&&y.current(),o()}},[d,i,r,a,s,l,o,f]),c(p.t)}function bv(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"animation-",n=C.useRef(L0(e)),i=C.useRef(t);return i.current!==t&&(n.current=L0(e),i.current=t),n.current}var RRe=["radius"],NRe=["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 VH(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){PRe(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 PRe(t,e,n){return(e=DRe(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function DRe(t){var e=ORe(t,"string");return typeof e=="symbol"?e:e+""}function ORe(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 E1(){return E1=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},E1.apply(null,arguments)}function GH(t,e){if(t==null)return{};var n,i,r=LRe(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 LRe(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 $H=(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,p=4;f<p;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 m=Math.min(a,r);c="M ".concat(t,",").concat(e+s*m,`
  8192. A `).concat(m,",").concat(m,",0,0,").concat(l,",").concat(t+o*m,",").concat(e,`
  8193. L `).concat(t+n-o*m,",").concat(e,`
  8194. A `).concat(m,",").concat(m,",0,0,").concat(l,",").concat(t+n,",").concat(e+s*m,`
  8195. L `).concat(t+n,",").concat(e+i-s*m,`
  8196. A `).concat(m,",").concat(m,",0,0,").concat(l,",").concat(t+n-o*m,",").concat(e+i,`
  8197. L `).concat(t+o*m,",").concat(e+i,`
  8198. A `).concat(m,",").concat(m,",0,0,").concat(l,",").concat(t,",").concat(e+i-s*m," Z")}else c="M ".concat(t,",").concat(e," h ").concat(n," v ").concat(i," h ").concat(-n," Z");return c},WH={x:0,y:0,width:0,height:0,radius:0,isAnimationActive:!1,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},fX=t=>{var e=qi(t,WH),n=C.useRef(null),[i,r]=C.useState(-1);C.useEffect(()=>{if(n.current&&n.current.getTotalLength)try{var G=n.current.getTotalLength();G&&r(G)}catch{}},[]);var{x:a,y:s,width:o,height:l,radius:c,className:d}=e,{animationEasing:f,animationDuration:p,animationBegin:m,isAnimationActive:y,isUpdateAnimationActive:b}=e,x=C.useRef(o),v=C.useRef(l),M=C.useRef(a),w=C.useRef(s),E=C.useMemo(()=>({x:a,y:s,width:o,height:l,radius:c}),[a,s,o,l,c]),T=bv(E,"rectangle-");if(a!==+a||s!==+s||o!==+o||l!==+l||o===0||l===0)return null;var P=yn("recharts-rectangle",d);if(!b){var R=va(e),{radius:U}=R,N=GH(R,RRe);return C.createElement("path",E1({},N,{radius:typeof c=="number"?c:void 0,className:P,d:$H(a,s,o,l,c)}))}var O=x.current,B=v.current,I=M.current,W=w.current,L="0px ".concat(i===-1?1:i,"px"),$="".concat(i,"px 0px"),q=lX(["strokeDasharray"],p,typeof f=="string"?f:WH.animationEasing);return C.createElement(yv,{animationId:T,key:T,canBegin:i>0,duration:p,easing:f,isActive:b,begin:m},G=>{var Y=Qn(O,o,G),Q=Qn(B,l,G),se=Qn(I,a,G),H=Qn(W,s,G);n.current&&(x.current=Y,v.current=Q,M.current=se,w.current=H);var X;y?G>0?X={transition:q,strokeDasharray:$}:X={strokeDasharray:L}:X={strokeDasharray:$};var re=va(e),{radius:ce}=re,ye=GH(re,NRe);return C.createElement("path",E1({},ye,{radius:typeof c=="number"?c:void 0,className:P,d:$H(se,H,Y,Q,c),ref:n,style:VH(VH({},X),e.style)}))})};function qH(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 XH(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?qH(Object(n),!0).forEach(function(i){kRe(t,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):qH(Object(n)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(n,i))})}return t}function kRe(t,e,n){return(e=IRe(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function IRe(t){var e=URe(t,"string");return typeof e=="symbol"?e:e+""}function URe(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 A1=Math.PI/180,FRe=t=>t*180/Math.PI,Hi=(t,e,n,i)=>({x:t+Math.cos(-A1*i)*n,y:e+Math.sin(-A1*i)*n}),hX=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},zRe=(t,e)=>{var{x:n,y:i}=t,{x:r,y:a}=e;return Math.sqrt((n-r)**2+(i-a)**2)},BRe=(t,e)=>{var{x:n,y:i}=t,{cx:r,cy:a}=e,s=zRe({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:FRe(l),angleInRadian:l}},jRe=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}},HRe=(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},VRe=(t,e)=>{var{chartX:n,chartY:i}=t,{radius:r,angle:a}=BRe({x:n,y:i},e),{innerRadius:s,outerRadius:o}=e;if(r<s||r>o||r===0)return null;var{startAngle:l,endAngle:c}=jRe(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?XH(XH({},e),{},{radius:r,angle:HRe(d,e)}):null};function pX(t){var{cx:e,cy:n,radius:i,startAngle:r,endAngle:a}=t,s=Hi(e,n,i,r),o=Hi(e,n,i,a);return{points:[s,o],cx:e,cy:n,radius:i,startAngle:r,endAngle:a}}function H3(){return H3=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},H3.apply(null,arguments)}var GRe=(t,e)=>{var n=Sr(e-t),i=Math.min(Math.abs(e-t),359.999);return n*i},xb=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)/A1,f=l?r:r+a*d,p=Hi(e,n,c,f),m=Hi(e,n,i,f),y=l?r-a*d:r,b=Hi(e,n,c*Math.cos(d*A1),y);return{center:p,circleTangency:m,lineTangency:b,theta:d}},mX=t=>{var{cx:e,cy:n,innerRadius:i,outerRadius:r,startAngle:a,endAngle:s}=t,o=GRe(a,s),l=a+o,c=Hi(e,n,r,a),d=Hi(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 p=Hi(e,n,i,a),m=Hi(e,n,i,l);f+="L ".concat(m.x,",").concat(m.y,`
  8203. A `).concat(i,",").concat(i,`,0,
  8204. `).concat(+(Math.abs(o)>180),",").concat(+(a<=l),`,
  8205. `).concat(p.x,",").concat(p.y," Z")}else f+="L ".concat(e,",").concat(n," Z");return f},$Re=t=>{var{cx:e,cy:n,innerRadius:i,outerRadius:r,cornerRadius:a,forceCornerRadius:s,cornerIsExternal:o,startAngle:l,endAngle:c}=t,d=Sr(c-l),{circleTangency:f,lineTangency:p,theta:m}=xb({cx:e,cy:n,radius:r,angle:l,sign:d,cornerRadius:a,cornerIsExternal:o}),{circleTangency:y,lineTangency:b,theta:x}=xb({cx:e,cy:n,radius:r,angle:c,sign:-d,cornerRadius:a,cornerIsExternal:o}),v=o?Math.abs(l-c):Math.abs(l-c)-m-x;if(v<0)return s?"M ".concat(p.x,",").concat(p.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. `):mX({cx:e,cy:n,innerRadius:i,outerRadius:r,startAngle:l,endAngle:c});var M="M ".concat(p.x,",").concat(p.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(+(v>180),",").concat(+(d<0),",").concat(y.x,",").concat(y.y,`
  8211. A`).concat(a,",").concat(a,",0,0,").concat(+(d<0),",").concat(b.x,",").concat(b.y,`
  8212. `);if(i>0){var{circleTangency:w,lineTangency:E,theta:T}=xb({cx:e,cy:n,radius:i,angle:l,sign:d,isExternal:!0,cornerRadius:a,cornerIsExternal:o}),{circleTangency:P,lineTangency:R,theta:U}=xb({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)-T-U;if(N<0&&a===0)return"".concat(M,"L").concat(e,",").concat(n,"Z");M+="L".concat(R.x,",").concat(R.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(E.x,",").concat(E.y,"Z")}else M+="L".concat(e,",").concat(n,"Z");return M},WRe={cx:0,cy:0,innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,cornerRadius:0,forceCornerRadius:!1,cornerIsExternal:!1},gX=t=>{var e=qi(t,WRe),{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 p=yn("recharts-sector",f),m=a-r,y=ta(s,m,0,!0),b;return y>0&&Math.abs(c-d)<360?b=$Re({cx:n,cy:i,innerRadius:r,outerRadius:a,cornerRadius:Math.min(y,m/2),forceCornerRadius:o,cornerIsExternal:l,startAngle:c,endAngle:d}):b=mX({cx:n,cy:i,innerRadius:r,outerRadius:a,startAngle:c,endAngle:d}),C.createElement("path",H3({},va(e),{className:p,d:b}))};function qRe(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(q7(e)){if(t==="centric"){var{cx:i,cy:r,innerRadius:a,outerRadius:s,angle:o}=e,l=Hi(i,r,a,o),c=Hi(i,r,s,o);return[{x:l.x,y:l.y},{x:c.x,y:c.y}]}return pX(e)}}var FC={},zC={},BC={},YH;function XRe(){return YH||(YH=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=aq();function n(i){return e.isSymbol(i)?NaN:Number(i)}t.toNumber=n})(BC)),BC}var KH;function YRe(){return KH||(KH=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=XRe();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})(zC)),zC}var ZH;function KRe(){return ZH||(ZH=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=sq(),n=YRe();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})(FC)),FC}var jC,JH;function ZRe(){return JH||(JH=1,jC=KRe().range),jC}var JRe=ZRe();const vX=Vs(JRe);function Cu(t,e){return t==null||e==null?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function QRe(t,e){return t==null||e==null?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function yD(t){let e,n,i;t.length!==2?(e=Cu,n=(o,l)=>Cu(t(o),l),i=(o,l)=>t(o)-l):(e=t===Cu||t===QRe?t:e3e,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 e3e(){return 0}function xX(t){return t===null?NaN:+t}function*t3e(t,e){for(let n of t)n!=null&&(n=+n)>=n&&(yield n)}const n3e=yD(Cu),_v=n3e.right;yD(xX).center;class QH extends Map{constructor(e,n=a3e){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(e8(this,e))}has(e){return super.has(e8(this,e))}set(e,n){return super.set(i3e(this,e),n)}delete(e){return super.delete(r3e(this,e))}}function e8({_intern:t,_key:e},n){const i=e(n);return t.has(i)?t.get(i):n}function i3e({_intern:t,_key:e},n){const i=e(n);return t.has(i)?t.get(i):(t.set(i,n),n)}function r3e({_intern:t,_key:e},n){const i=e(n);return t.has(i)&&(n=t.get(i),t.delete(i)),n}function a3e(t){return t!==null&&typeof t=="object"?t.valueOf():t}function s3e(t=Cu){if(t===Cu)return yX;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 yX(t,e){return(t==null||!(t>=t))-(e==null||!(e>=e))||(t<e?-1:t>e?1:0)}const o3e=Math.sqrt(50),l3e=Math.sqrt(10),c3e=Math.sqrt(2);function T1(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>=o3e?10:a>=l3e?5:a>=c3e?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?T1(t,e,n*2):[o,l,c]}function V3(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?T1(e,t,n):T1(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 G3(t,e,n){return e=+e,t=+t,n=+n,T1(t,e,n)[2]}function $3(t,e,n){e=+e,t=+t,n=+n;const i=e<t,r=i?G3(e,t,n):G3(t,e,n);return(i?-1:1)*(r<0?1/-r:r)}function t8(t,e){let n;for(const i of t)i!=null&&(n<i||n===void 0&&i>=i)&&(n=i);return n}function n8(t,e){let n;for(const i of t)i!=null&&(n>i||n===void 0&&i>=i)&&(n=i);return n}function bX(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?yX:s3e(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),p=.5*Math.sqrt(d*f*(l-f)/l)*(c-l/2<0?-1:1),m=Math.max(n,Math.floor(e-c*f/l+p)),y=Math.min(i,Math.floor(e+(l-c)*f/l+p));bX(t,e,m,y,r)}const a=t[e];let s=n,o=i;for(Eg(t,n,e),r(t[i],a)>0&&Eg(t,n,i);s<o;){for(Eg(t,s,o),++s,--o;r(t[s],a)<0;)++s;for(;r(t[o],a)>0;)--o}r(t[n],a)===0?Eg(t,n,o):(++o,Eg(t,o,i)),o<=e&&(n=o+1),e<=o&&(i=o-1)}return t}function Eg(t,e,n){const i=t[e];t[e]=t[n],t[n]=i}function u3e(t,e,n){if(t=Float64Array.from(t3e(t)),!(!(i=t.length)||isNaN(e=+e))){if(e<=0||i<2)return n8(t);if(e>=1)return t8(t);var i,r=(i-1)*e,a=Math.floor(r),s=t8(bX(t,a).subarray(0,a+1)),o=n8(t.subarray(a+1));return s+(o-s)*(r-a)}}function d3e(t,e,n=xX){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 f3e(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 Gs(t,e){switch(arguments.length){case 0:break;case 1:this.range(t);break;default:this.range(e).domain(t);break}return this}function fc(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 W3=Symbol("implicit");function bD(){var t=new QH,e=[],n=[],i=W3;function r(a){let s=t.get(a);if(s===void 0){if(i!==W3)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 QH;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 bD(e,n).unknown(i)},Gs.apply(r,arguments),r}function _D(){var t=bD().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 p=e().length,m=r<i,y=m?r:i,b=m?i:r;a=(b-y)/Math.max(1,p-l+c*2),o&&(a=Math.floor(a)),y+=(b-y-a*(p-l))*d,s=a*(1-l),o&&(y=Math.round(y),s=Math.round(s));var x=f3e(p).map(function(v){return y+a*v});return n(m?x.reverse():x)}return t.domain=function(p){return arguments.length?(e(p),f()):e()},t.range=function(p){return arguments.length?([i,r]=p,i=+i,r=+r,f()):[i,r]},t.rangeRound=function(p){return[i,r]=p,i=+i,r=+r,o=!0,f()},t.bandwidth=function(){return s},t.step=function(){return a},t.round=function(p){return arguments.length?(o=!!p,f()):o},t.padding=function(p){return arguments.length?(l=Math.min(1,c=+p),f()):l},t.paddingInner=function(p){return arguments.length?(l=Math.min(1,p),f()):l},t.paddingOuter=function(p){return arguments.length?(c=+p,f()):c},t.align=function(p){return arguments.length?(d=Math.max(0,Math.min(1,p)),f()):d},t.copy=function(){return _D(e(),[i,r]).round(o).paddingInner(l).paddingOuter(c).align(d)},Gs.apply(f(),arguments)}function _X(t){var e=t.copy;return t.padding=t.paddingOuter,delete t.paddingInner,delete t.paddingOuter,t.copy=function(){return _X(e())},t}function h3e(){return _X(_D.apply(null,arguments).paddingInner(1))}function SD(t,e,n){t.prototype=e.prototype=n,n.constructor=t}function SX(t,e){var n=Object.create(t.prototype);for(var i in e)n[i]=e[i];return n}function Sv(){}var H0=.7,C1=1/H0,pp="\\s*([+-]?\\d+)\\s*",V0="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Fo="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",p3e=/^#([0-9a-f]{3,8})$/,m3e=new RegExp(`^rgb\\(${pp},${pp},${pp}\\)$`),g3e=new RegExp(`^rgb\\(${Fo},${Fo},${Fo}\\)$`),v3e=new RegExp(`^rgba\\(${pp},${pp},${pp},${V0}\\)$`),x3e=new RegExp(`^rgba\\(${Fo},${Fo},${Fo},${V0}\\)$`),y3e=new RegExp(`^hsl\\(${V0},${Fo},${Fo}\\)$`),b3e=new RegExp(`^hsla\\(${V0},${Fo},${Fo},${V0}\\)$`),i8={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};SD(Sv,G0,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:r8,formatHex:r8,formatHex8:_3e,formatHsl:S3e,formatRgb:a8,toString:a8});function r8(){return this.rgb().formatHex()}function _3e(){return this.rgb().formatHex8()}function S3e(){return wX(this).formatHsl()}function a8(){return this.rgb().formatRgb()}function G0(t){var e,n;return t=(t+"").trim().toLowerCase(),(e=p3e.exec(t))?(n=e[1].length,e=parseInt(e[1],16),n===6?s8(e):n===3?new Na(e>>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):n===8?yb(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):n===4?yb(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=m3e.exec(t))?new Na(e[1],e[2],e[3],1):(e=g3e.exec(t))?new Na(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=v3e.exec(t))?yb(e[1],e[2],e[3],e[4]):(e=x3e.exec(t))?yb(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=y3e.exec(t))?c8(e[1],e[2]/100,e[3]/100,1):(e=b3e.exec(t))?c8(e[1],e[2]/100,e[3]/100,e[4]):i8.hasOwnProperty(t)?s8(i8[t]):t==="transparent"?new Na(NaN,NaN,NaN,0):null}function s8(t){return new Na(t>>16&255,t>>8&255,t&255,1)}function yb(t,e,n,i){return i<=0&&(t=e=n=NaN),new Na(t,e,n,i)}function w3e(t){return t instanceof Sv||(t=G0(t)),t?(t=t.rgb(),new Na(t.r,t.g,t.b,t.opacity)):new Na}function q3(t,e,n,i){return arguments.length===1?w3e(t):new Na(t,e,n,i??1)}function Na(t,e,n,i){this.r=+t,this.g=+e,this.b=+n,this.opacity=+i}SD(Na,q3,SX(Sv,{brighter(t){return t=t==null?C1:Math.pow(C1,t),new Na(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=t==null?H0:Math.pow(H0,t),new Na(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new Na(Kd(this.r),Kd(this.g),Kd(this.b),R1(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:o8,formatHex:o8,formatHex8:M3e,formatRgb:l8,toString:l8}));function o8(){return`#${Ud(this.r)}${Ud(this.g)}${Ud(this.b)}`}function M3e(){return`#${Ud(this.r)}${Ud(this.g)}${Ud(this.b)}${Ud((isNaN(this.opacity)?1:this.opacity)*255)}`}function l8(){const t=R1(this.opacity);return`${t===1?"rgb(":"rgba("}${Kd(this.r)}, ${Kd(this.g)}, ${Kd(this.b)}${t===1?")":`, ${t})`}`}function R1(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function Kd(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function Ud(t){return t=Kd(t),(t<16?"0":"")+t.toString(16)}function c8(t,e,n,i){return i<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new oo(t,e,n,i)}function wX(t){if(t instanceof oo)return new oo(t.h,t.s,t.l,t.opacity);if(t instanceof Sv||(t=G0(t)),!t)return new oo;if(t instanceof oo)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 oo(s,o,l,t.opacity)}function E3e(t,e,n,i){return arguments.length===1?wX(t):new oo(t,e,n,i??1)}function oo(t,e,n,i){this.h=+t,this.s=+e,this.l=+n,this.opacity=+i}SD(oo,E3e,SX(Sv,{brighter(t){return t=t==null?C1:Math.pow(C1,t),new oo(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=t==null?H0:Math.pow(H0,t),new oo(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 Na(HC(t>=240?t-240:t+120,r,i),HC(t,r,i),HC(t<120?t+240:t-120,r,i),this.opacity)},clamp(){return new oo(u8(this.h),bb(this.s),bb(this.l),R1(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=R1(this.opacity);return`${t===1?"hsl(":"hsla("}${u8(this.h)}, ${bb(this.s)*100}%, ${bb(this.l)*100}%${t===1?")":`, ${t})`}`}}));function u8(t){return t=(t||0)%360,t<0?t+360:t}function bb(t){return Math.max(0,Math.min(1,t||0))}function HC(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 wD=t=>()=>t;function A3e(t,e){return function(n){return t+n*e}}function T3e(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 C3e(t){return(t=+t)==1?MX:function(e,n){return n-e?T3e(e,n,t):wD(isNaN(e)?n:e)}}function MX(t,e){var n=e-t;return n?A3e(t,n):wD(isNaN(t)?e:t)}const d8=(function t(e){var n=C3e(e);function i(r,a){var s=n((r=q3(r)).r,(a=q3(a)).r),o=n(r.g,a.g),l=n(r.b,a.b),c=MX(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 R3e(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 N3e(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function P3e(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]=im(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 D3e(t,e){var n=new Date;return t=+t,e=+e,function(i){return n.setTime(t*(1-i)+e*i),n}}function N1(t,e){return t=+t,e=+e,function(n){return t*(1-n)+e*n}}function O3e(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]=im(t[r],e[r]):i[r]=e[r];return function(a){for(r in n)i[r]=n[r](a);return i}}var X3=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,VC=new RegExp(X3.source,"g");function L3e(t){return function(){return t}}function k3e(t){return function(e){return t(e)+""}}function I3e(t,e){var n=X3.lastIndex=VC.lastIndex=0,i,r,a,s=-1,o=[],l=[];for(t=t+"",e=e+"";(i=X3.exec(t))&&(r=VC.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:N1(i,r)})),n=VC.lastIndex;return n<e.length&&(a=e.slice(n),o[s]?o[s]+=a:o[++s]=a),o.length<2?l[0]?k3e(l[0].x):L3e(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 im(t,e){var n=typeof e,i;return e==null||n==="boolean"?wD(e):(n==="number"?N1:n==="string"?(i=G0(e))?(e=i,d8):I3e:e instanceof G0?d8:e instanceof Date?D3e:N3e(e)?R3e:Array.isArray(e)?P3e:typeof e.valueOf!="function"&&typeof e.toString!="function"||isNaN(e)?O3e:N1)(t,e)}function MD(t,e){return t=+t,e=+e,function(n){return Math.round(t*(1-n)+e*n)}}function U3e(t,e){e===void 0&&(e=t,t=im);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 F3e(t){return function(){return t}}function P1(t){return+t}var f8=[0,1];function fa(t){return t}function Y3(t,e){return(e-=t=+t)?function(n){return(n-t)/e}:F3e(isNaN(e)?NaN:.5)}function z3e(t,e){var n;return t>e&&(n=t,t=e,e=n),function(i){return Math.max(t,Math.min(e,i))}}function B3e(t,e,n){var i=t[0],r=t[1],a=e[0],s=e[1];return r<i?(i=Y3(r,i),a=n(s,a)):(i=Y3(i,r),a=n(a,s)),function(o){return a(i(o))}}function j3e(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]=Y3(t[s],t[s+1]),a[s]=n(e[s],e[s+1]);return function(o){var l=_v(t,o,1,i)-1;return a[l](r[l](o))}}function wv(t,e){return e.domain(t.domain()).range(t.range()).interpolate(t.interpolate()).clamp(t.clamp()).unknown(t.unknown())}function QS(){var t=f8,e=f8,n=im,i,r,a,s=fa,o,l,c;function d(){var p=Math.min(t.length,e.length);return s!==fa&&(s=z3e(t[0],t[p-1])),o=p>2?j3e:B3e,l=c=null,f}function f(p){return p==null||isNaN(p=+p)?a:(l||(l=o(t.map(i),e,n)))(i(s(p)))}return f.invert=function(p){return s(r((c||(c=o(e,t.map(i),N1)))(p)))},f.domain=function(p){return arguments.length?(t=Array.from(p,P1),d()):t.slice()},f.range=function(p){return arguments.length?(e=Array.from(p),d()):e.slice()},f.rangeRound=function(p){return e=Array.from(p),n=MD,d()},f.clamp=function(p){return arguments.length?(s=p?!0:fa,d()):s!==fa},f.interpolate=function(p){return arguments.length?(n=p,d()):n},f.unknown=function(p){return arguments.length?(a=p,f):a},function(p,m){return i=p,r=m,d()}}function ED(){return QS()(fa,fa)}function H3e(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)}function D1(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 zp(t){return t=D1(Math.abs(t)),t?t[1]:NaN}function V3e(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 G3e(t){return function(e){return e.replace(/[0-9]/g,function(n){return t[+n]})}}var $3e=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function $0(t){if(!(e=$3e.exec(t)))throw new Error("invalid format: "+t);var e;return new AD({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]})}$0.prototype=AD.prototype;function AD(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+""}AD.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 W3e(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 EX;function q3e(t,e){var n=D1(t,e);if(!n)return t+"";var i=n[0],r=n[1],a=r-(EX=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")+D1(t,Math.max(0,e+a-1))[0]}function h8(t,e){var n=D1(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 p8={"%":(t,e)=>(t*100).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:H3e,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)=>h8(t*100,e),r:h8,s:q3e,X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function m8(t){return t}var g8=Array.prototype.map,v8=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function X3e(t){var e=t.grouping===void 0||t.thousands===void 0?m8:V3e(g8.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?m8:G3e(g8.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=$0(f);var p=f.fill,m=f.align,y=f.sign,b=f.symbol,x=f.zero,v=f.width,M=f.comma,w=f.precision,E=f.trim,T=f.type;T==="n"?(M=!0,T="g"):p8[T]||(w===void 0&&(w=12),E=!0,T="g"),(x||p==="0"&&m==="=")&&(x=!0,p="0",m="=");var P=b==="$"?n:b==="#"&&/[boxX]/.test(T)?"0"+T.toLowerCase():"",R=b==="$"?i:/[%p]/.test(T)?s:"",U=p8[T],N=/[defgprs%]/.test(T);w=w===void 0?6:/[gprs]/.test(T)?Math.max(1,Math.min(21,w)):Math.max(0,Math.min(20,w));function O(B){var I=P,W=R,L,$,q;if(T==="c")W=U(B)+W,B="";else{B=+B;var G=B<0||1/B<0;if(B=isNaN(B)?l:U(Math.abs(B),w),E&&(B=W3e(B)),G&&+B==0&&y!=="+"&&(G=!1),I=(G?y==="("?y:o:y==="-"||y==="("?"":y)+I,W=(T==="s"?v8[8+EX/3]:"")+W+(G&&y==="("?")":""),N){for(L=-1,$=B.length;++L<$;)if(q=B.charCodeAt(L),48>q||q>57){W=(q===46?r+B.slice(L+1):B.slice(L))+W,B=B.slice(0,L);break}}}M&&!x&&(B=e(B,1/0));var Y=I.length+B.length+W.length,Q=Y<v?new Array(v-Y+1).join(p):"";switch(M&&x&&(B=e(Q+B,Q.length?v-W.length:1/0),Q=""),m){case"<":B=I+B+W+Q;break;case"=":B=I+Q+B+W;break;case"^":B=Q.slice(0,Y=Q.length>>1)+I+B+W+Q.slice(Y);break;default:B=Q+I+B+W;break}return a(B)}return O.toString=function(){return f+""},O}function d(f,p){var m=c((f=$0(f),f.type="f",f)),y=Math.max(-8,Math.min(8,Math.floor(zp(p)/3)))*3,b=Math.pow(10,-y),x=v8[8+y/3];return function(v){return m(b*v)+x}}return{format:c,formatPrefix:d}}var _b,TD,AX;Y3e({thousands:",",grouping:[3],currency:["$",""]});function Y3e(t){return _b=X3e(t),TD=_b.format,AX=_b.formatPrefix,_b}function K3e(t){return Math.max(0,-zp(Math.abs(t)))}function Z3e(t,e){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(zp(e)/3)))*3-zp(Math.abs(t)))}function J3e(t,e){return t=Math.abs(t),e=Math.abs(e)-t,Math.max(0,zp(e)-zp(t))+1}function TX(t,e,n,i){var r=$3(t,e,n),a;switch(i=$0(i??",f"),i.type){case"s":{var s=Math.max(Math.abs(t),Math.abs(e));return i.precision==null&&!isNaN(a=Z3e(r,s))&&(i.precision=a),AX(i,s)}case"":case"e":case"g":case"p":case"r":{i.precision==null&&!isNaN(a=J3e(r,Math.max(Math.abs(t),Math.abs(e))))&&(i.precision=a-(i.type==="e"));break}case"f":case"%":{i.precision==null&&!isNaN(a=K3e(r))&&(i.precision=a-(i.type==="%")*2);break}}return TD(i)}function Vu(t){var e=t.domain;return t.ticks=function(n){var i=e();return V3(i[0],i[i.length-1],n??10)},t.tickFormat=function(n,i){var r=e();return TX(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=G3(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 CX(){var t=ED();return t.copy=function(){return wv(t,CX())},Gs.apply(t,arguments),Vu(t)}function RX(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,P1),n):t.slice()},n.unknown=function(i){return arguments.length?(e=i,n):e},n.copy=function(){return RX(t).unknown(e)},t=arguments.length?Array.from(t,P1):[0,1],Vu(n)}function NX(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 x8(t){return Math.log(t)}function y8(t){return Math.exp(t)}function Q3e(t){return-Math.log(-t)}function eNe(t){return-Math.exp(-t)}function tNe(t){return isFinite(t)?+("1e"+t):t<0?0:t}function nNe(t){return t===10?tNe:t===Math.E?Math.exp:e=>Math.pow(t,e)}function iNe(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 b8(t){return(e,n)=>-t(-e,n)}function CD(t){const e=t(x8,y8),n=e.domain;let i=10,r,a;function s(){return r=iNe(i),a=nNe(i),n()[0]<0?(r=b8(r),a=b8(a),t(Q3e,eNe)):t(x8,y8),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 p=r(c),m=r(d),y,b;const x=o==null?10:+o;let v=[];if(!(i%1)&&m-p<x){if(p=Math.floor(p),m=Math.ceil(m),c>0){for(;p<=m;++p)for(y=1;y<i;++y)if(b=p<0?y/a(-p):y*a(p),!(b<c)){if(b>d)break;v.push(b)}}else for(;p<=m;++p)for(y=i-1;y>=1;--y)if(b=p>0?y/a(-p):y*a(p),!(b<c)){if(b>d)break;v.push(b)}v.length*2<x&&(v=V3(c,d,x))}else v=V3(p,m,Math.min(m-p,x)).map(a);return f?v.reverse():v},e.tickFormat=(o,l)=>{if(o==null&&(o=10),l==null&&(l=i===10?"s":","),typeof l!="function"&&(!(i%1)&&(l=$0(l)).precision==null&&(l.trim=!0),l=TD(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(NX(n(),{floor:o=>a(Math.floor(r(o))),ceil:o=>a(Math.ceil(r(o)))})),e}function PX(){const t=CD(QS()).domain([1,10]);return t.copy=()=>wv(t,PX()).base(t.base()),Gs.apply(t,arguments),t}function _8(t){return function(e){return Math.sign(e)*Math.log1p(Math.abs(e/t))}}function S8(t){return function(e){return Math.sign(e)*Math.expm1(Math.abs(e))*t}}function RD(t){var e=1,n=t(_8(e),S8(e));return n.constant=function(i){return arguments.length?t(_8(e=+i),S8(e)):e},Vu(n)}function DX(){var t=RD(QS());return t.copy=function(){return wv(t,DX()).constant(t.constant())},Gs.apply(t,arguments)}function w8(t){return function(e){return e<0?-Math.pow(-e,t):Math.pow(e,t)}}function rNe(t){return t<0?-Math.sqrt(-t):Math.sqrt(t)}function aNe(t){return t<0?-t*t:t*t}function ND(t){var e=t(fa,fa),n=1;function i(){return n===1?t(fa,fa):n===.5?t(rNe,aNe):t(w8(n),w8(1/n))}return e.exponent=function(r){return arguments.length?(n=+r,i()):n},Vu(e)}function PD(){var t=ND(QS());return t.copy=function(){return wv(t,PD()).exponent(t.exponent())},Gs.apply(t,arguments),t}function sNe(){return PD.apply(null,arguments).exponent(.5)}function M8(t){return Math.sign(t)*t*t}function oNe(t){return Math.sign(t)*Math.sqrt(Math.abs(t))}function OX(){var t=ED(),e=[0,1],n=!1,i;function r(a){var s=oNe(t(a));return isNaN(s)?i:n?Math.round(s):s}return r.invert=function(a){return t.invert(M8(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,P1)).map(M8)),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 OX(t.domain(),e).round(n).clamp(t.clamp()).unknown(i)},Gs.apply(r,arguments),Vu(r)}function LX(){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]=d3e(t,s/o);return a}function a(s){return s==null||isNaN(s=+s)?i:e[_v(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(Cu),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 LX().domain(t).range(e).unknown(i)},Gs.apply(a,arguments)}function kX(){var t=0,e=1,n=1,i=[.5],r=[0,1],a;function s(l){return l!=null&&l<=l?r[_v(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 kX().domain([t,e]).range(r).unknown(a)},Gs.apply(Vu(s),arguments)}function IX(){var t=[.5],e=[0,1],n,i=1;function r(a){return a!=null&&a<=a?e[_v(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 IX().domain(t).range(e).unknown(n)},Gs.apply(r,arguments)}const GC=new Date,$C=new Date;function or(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=>or(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)=>(GC.setTime(+a),$C.setTime(+s),t(GC),t($C),Math.floor(n(GC,$C))),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 O1=or(()=>{},(t,e)=>{t.setTime(+t+e)},(t,e)=>e-t);O1.every=t=>(t=Math.floor(t),!isFinite(t)||!(t>0)?null:t>1?or(e=>{e.setTime(Math.floor(e/t)*t)},(e,n)=>{e.setTime(+e+n*t)},(e,n)=>(n-e)/t):O1);O1.range;const jl=1e3,ks=jl*60,Hl=ks*60,ic=Hl*24,DD=ic*7,E8=ic*30,WC=ic*365,Fd=or(t=>{t.setTime(t-t.getMilliseconds())},(t,e)=>{t.setTime(+t+e*jl)},(t,e)=>(e-t)/jl,t=>t.getUTCSeconds());Fd.range;const OD=or(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*jl)},(t,e)=>{t.setTime(+t+e*ks)},(t,e)=>(e-t)/ks,t=>t.getMinutes());OD.range;const LD=or(t=>{t.setUTCSeconds(0,0)},(t,e)=>{t.setTime(+t+e*ks)},(t,e)=>(e-t)/ks,t=>t.getUTCMinutes());LD.range;const kD=or(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*jl-t.getMinutes()*ks)},(t,e)=>{t.setTime(+t+e*Hl)},(t,e)=>(e-t)/Hl,t=>t.getHours());kD.range;const ID=or(t=>{t.setUTCMinutes(0,0,0)},(t,e)=>{t.setTime(+t+e*Hl)},(t,e)=>(e-t)/Hl,t=>t.getUTCHours());ID.range;const Mv=or(t=>t.setHours(0,0,0,0),(t,e)=>t.setDate(t.getDate()+e),(t,e)=>(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*ks)/ic,t=>t.getDate()-1);Mv.range;const ew=or(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/ic,t=>t.getUTCDate()-1);ew.range;const UX=or(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/ic,t=>Math.floor(t/ic));UX.range;function Cf(t){return or(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())*ks)/DD)}const tw=Cf(0),L1=Cf(1),lNe=Cf(2),cNe=Cf(3),Bp=Cf(4),uNe=Cf(5),dNe=Cf(6);tw.range;L1.range;lNe.range;cNe.range;Bp.range;uNe.range;dNe.range;function Rf(t){return or(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)/DD)}const nw=Rf(0),k1=Rf(1),fNe=Rf(2),hNe=Rf(3),jp=Rf(4),pNe=Rf(5),mNe=Rf(6);nw.range;k1.range;fNe.range;hNe.range;jp.range;pNe.range;mNe.range;const UD=or(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());UD.range;const FD=or(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());FD.range;const rc=or(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());rc.every=t=>!isFinite(t=Math.floor(t))||!(t>0)?null:or(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)});rc.range;const ac=or(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());ac.every=t=>!isFinite(t=Math.floor(t))||!(t>0)?null:or(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)});ac.range;function FX(t,e,n,i,r,a){const s=[[Fd,1,jl],[Fd,5,5*jl],[Fd,15,15*jl],[Fd,30,30*jl],[a,1,ks],[a,5,5*ks],[a,15,15*ks],[a,30,30*ks],[r,1,Hl],[r,3,3*Hl],[r,6,6*Hl],[r,12,12*Hl],[i,1,ic],[i,2,2*ic],[n,1,DD],[e,1,E8],[e,3,3*E8],[t,1,WC]];function o(c,d,f){const p=d<c;p&&([c,d]=[d,c]);const m=f&&typeof f.range=="function"?f:l(c,d,f),y=m?m.range(c,+d+1):[];return p?y.reverse():y}function l(c,d,f){const p=Math.abs(d-c)/f,m=yD(([,,x])=>x).right(s,p);if(m===s.length)return t.every($3(c/WC,d/WC,f));if(m===0)return O1.every(Math.max($3(c,d,f),1));const[y,b]=s[p/s[m-1][2]<s[m][2]/p?m-1:m];return y.every(b)}return[o,l]}const[gNe,vNe]=FX(ac,FD,nw,UX,ID,LD),[xNe,yNe]=FX(rc,UD,tw,Mv,kD,OD);function qC(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 XC(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 Ag(t,e,n){return{y:t,m:e,d:n,H:0,M:0,S:0,L:0}}function bNe(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=Tg(r),d=Cg(r),f=Tg(a),p=Cg(a),m=Tg(s),y=Cg(s),b=Tg(o),x=Cg(o),v=Tg(l),M=Cg(l),w={a:G,A:Y,b:Q,B:se,c:null,d:P8,e:P8,f:VNe,g:QNe,G:tPe,H:BNe,I:jNe,j:HNe,L:zX,m:GNe,M:$Ne,p:H,q:X,Q:L8,s:k8,S:WNe,u:qNe,U:XNe,V:YNe,w:KNe,W:ZNe,x:null,X:null,y:JNe,Y:ePe,Z:nPe,"%":O8},E={a:re,A:ce,b:ye,B:me,c:null,d:D8,e:D8,f:sPe,g:gPe,G:xPe,H:iPe,I:rPe,j:aPe,L:jX,m:oPe,M:lPe,p:be,q:De,Q:L8,s:k8,S:cPe,u:uPe,U:dPe,V:fPe,w:hPe,W:pPe,x:null,X:null,y:mPe,Y:vPe,Z:yPe,"%":O8},T={a:O,A:B,b:I,B:W,c:L,d:R8,e:R8,f:INe,g:C8,G:T8,H:N8,I:N8,j:DNe,L:kNe,m:PNe,M:ONe,p:N,q:NNe,Q:FNe,s:zNe,S:LNe,u:ENe,U:ANe,V:TNe,w:MNe,W:CNe,x:$,X:q,y:C8,Y:T8,Z:RNe,"%":UNe};w.x=P(n,w),w.X=P(i,w),w.c=P(e,w),E.x=P(n,E),E.X=P(i,E),E.c=P(e,E);function P(he,Ae){return function(Be){var le=[],ut=-1,z=0,V=he.length,ne,J,ee;for(Be instanceof Date||(Be=new Date(+Be));++ut<V;)he.charCodeAt(ut)===37&&(le.push(he.slice(z,ut)),(J=A8[ne=he.charAt(++ut)])!=null?ne=he.charAt(++ut):J=ne==="e"?" ":"0",(ee=Ae[ne])&&(ne=ee(Be,J)),le.push(ne),z=ut+1);return le.push(he.slice(z,ut)),le.join("")}}function R(he,Ae){return function(Be){var le=Ag(1900,void 0,1),ut=U(le,he,Be+="",0),z,V;if(ut!=Be.length)return null;if("Q"in le)return new Date(le.Q);if("s"in le)return new Date(le.s*1e3+("L"in le?le.L:0));if(Ae&&!("Z"in le)&&(le.Z=0),"p"in le&&(le.H=le.H%12+le.p*12),le.m===void 0&&(le.m="q"in le?le.q:0),"V"in le){if(le.V<1||le.V>53)return null;"w"in le||(le.w=1),"Z"in le?(z=XC(Ag(le.y,0,1)),V=z.getUTCDay(),z=V>4||V===0?k1.ceil(z):k1(z),z=ew.offset(z,(le.V-1)*7),le.y=z.getUTCFullYear(),le.m=z.getUTCMonth(),le.d=z.getUTCDate()+(le.w+6)%7):(z=qC(Ag(le.y,0,1)),V=z.getDay(),z=V>4||V===0?L1.ceil(z):L1(z),z=Mv.offset(z,(le.V-1)*7),le.y=z.getFullYear(),le.m=z.getMonth(),le.d=z.getDate()+(le.w+6)%7)}else("W"in le||"U"in le)&&("w"in le||(le.w="u"in le?le.u%7:"W"in le?1:0),V="Z"in le?XC(Ag(le.y,0,1)).getUTCDay():qC(Ag(le.y,0,1)).getDay(),le.m=0,le.d="W"in le?(le.w+6)%7+le.W*7-(V+5)%7:le.w+le.U*7-(V+6)%7);return"Z"in le?(le.H+=le.Z/100|0,le.M+=le.Z%100,XC(le)):qC(le)}}function U(he,Ae,Be,le){for(var ut=0,z=Ae.length,V=Be.length,ne,J;ut<z;){if(le>=V)return-1;if(ne=Ae.charCodeAt(ut++),ne===37){if(ne=Ae.charAt(ut++),J=T[ne in A8?Ae.charAt(ut++):ne],!J||(le=J(he,Be,le))<0)return-1}else if(ne!=Be.charCodeAt(le++))return-1}return le}function N(he,Ae,Be){var le=c.exec(Ae.slice(Be));return le?(he.p=d.get(le[0].toLowerCase()),Be+le[0].length):-1}function O(he,Ae,Be){var le=m.exec(Ae.slice(Be));return le?(he.w=y.get(le[0].toLowerCase()),Be+le[0].length):-1}function B(he,Ae,Be){var le=f.exec(Ae.slice(Be));return le?(he.w=p.get(le[0].toLowerCase()),Be+le[0].length):-1}function I(he,Ae,Be){var le=v.exec(Ae.slice(Be));return le?(he.m=M.get(le[0].toLowerCase()),Be+le[0].length):-1}function W(he,Ae,Be){var le=b.exec(Ae.slice(Be));return le?(he.m=x.get(le[0].toLowerCase()),Be+le[0].length):-1}function L(he,Ae,Be){return U(he,e,Ae,Be)}function $(he,Ae,Be){return U(he,n,Ae,Be)}function q(he,Ae,Be){return U(he,i,Ae,Be)}function G(he){return s[he.getDay()]}function Y(he){return a[he.getDay()]}function Q(he){return l[he.getMonth()]}function se(he){return o[he.getMonth()]}function H(he){return r[+(he.getHours()>=12)]}function X(he){return 1+~~(he.getMonth()/3)}function re(he){return s[he.getUTCDay()]}function ce(he){return a[he.getUTCDay()]}function ye(he){return l[he.getUTCMonth()]}function me(he){return o[he.getUTCMonth()]}function be(he){return r[+(he.getUTCHours()>=12)]}function De(he){return 1+~~(he.getUTCMonth()/3)}return{format:function(he){var Ae=P(he+="",w);return Ae.toString=function(){return he},Ae},parse:function(he){var Ae=R(he+="",!1);return Ae.toString=function(){return he},Ae},utcFormat:function(he){var Ae=P(he+="",E);return Ae.toString=function(){return he},Ae},utcParse:function(he){var Ae=R(he+="",!0);return Ae.toString=function(){return he},Ae}}}var A8={"-":"",_:" ",0:"0"},Er=/^\s*\d+/,_Ne=/^%/,SNe=/[\\^$*+?|[\]().{}]/g;function bn(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 wNe(t){return t.replace(SNe,"\\$&")}function Tg(t){return new RegExp("^(?:"+t.map(wNe).join("|")+")","i")}function Cg(t){return new Map(t.map((e,n)=>[e.toLowerCase(),n]))}function MNe(t,e,n){var i=Er.exec(e.slice(n,n+1));return i?(t.w=+i[0],n+i[0].length):-1}function ENe(t,e,n){var i=Er.exec(e.slice(n,n+1));return i?(t.u=+i[0],n+i[0].length):-1}function ANe(t,e,n){var i=Er.exec(e.slice(n,n+2));return i?(t.U=+i[0],n+i[0].length):-1}function TNe(t,e,n){var i=Er.exec(e.slice(n,n+2));return i?(t.V=+i[0],n+i[0].length):-1}function CNe(t,e,n){var i=Er.exec(e.slice(n,n+2));return i?(t.W=+i[0],n+i[0].length):-1}function T8(t,e,n){var i=Er.exec(e.slice(n,n+4));return i?(t.y=+i[0],n+i[0].length):-1}function C8(t,e,n){var i=Er.exec(e.slice(n,n+2));return i?(t.y=+i[0]+(+i[0]>68?1900:2e3),n+i[0].length):-1}function RNe(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 NNe(t,e,n){var i=Er.exec(e.slice(n,n+1));return i?(t.q=i[0]*3-3,n+i[0].length):-1}function PNe(t,e,n){var i=Er.exec(e.slice(n,n+2));return i?(t.m=i[0]-1,n+i[0].length):-1}function R8(t,e,n){var i=Er.exec(e.slice(n,n+2));return i?(t.d=+i[0],n+i[0].length):-1}function DNe(t,e,n){var i=Er.exec(e.slice(n,n+3));return i?(t.m=0,t.d=+i[0],n+i[0].length):-1}function N8(t,e,n){var i=Er.exec(e.slice(n,n+2));return i?(t.H=+i[0],n+i[0].length):-1}function ONe(t,e,n){var i=Er.exec(e.slice(n,n+2));return i?(t.M=+i[0],n+i[0].length):-1}function LNe(t,e,n){var i=Er.exec(e.slice(n,n+2));return i?(t.S=+i[0],n+i[0].length):-1}function kNe(t,e,n){var i=Er.exec(e.slice(n,n+3));return i?(t.L=+i[0],n+i[0].length):-1}function INe(t,e,n){var i=Er.exec(e.slice(n,n+6));return i?(t.L=Math.floor(i[0]/1e3),n+i[0].length):-1}function UNe(t,e,n){var i=_Ne.exec(e.slice(n,n+1));return i?n+i[0].length:-1}function FNe(t,e,n){var i=Er.exec(e.slice(n));return i?(t.Q=+i[0],n+i[0].length):-1}function zNe(t,e,n){var i=Er.exec(e.slice(n));return i?(t.s=+i[0],n+i[0].length):-1}function P8(t,e){return bn(t.getDate(),e,2)}function BNe(t,e){return bn(t.getHours(),e,2)}function jNe(t,e){return bn(t.getHours()%12||12,e,2)}function HNe(t,e){return bn(1+Mv.count(rc(t),t),e,3)}function zX(t,e){return bn(t.getMilliseconds(),e,3)}function VNe(t,e){return zX(t,e)+"000"}function GNe(t,e){return bn(t.getMonth()+1,e,2)}function $Ne(t,e){return bn(t.getMinutes(),e,2)}function WNe(t,e){return bn(t.getSeconds(),e,2)}function qNe(t){var e=t.getDay();return e===0?7:e}function XNe(t,e){return bn(tw.count(rc(t)-1,t),e,2)}function BX(t){var e=t.getDay();return e>=4||e===0?Bp(t):Bp.ceil(t)}function YNe(t,e){return t=BX(t),bn(Bp.count(rc(t),t)+(rc(t).getDay()===4),e,2)}function KNe(t){return t.getDay()}function ZNe(t,e){return bn(L1.count(rc(t)-1,t),e,2)}function JNe(t,e){return bn(t.getFullYear()%100,e,2)}function QNe(t,e){return t=BX(t),bn(t.getFullYear()%100,e,2)}function ePe(t,e){return bn(t.getFullYear()%1e4,e,4)}function tPe(t,e){var n=t.getDay();return t=n>=4||n===0?Bp(t):Bp.ceil(t),bn(t.getFullYear()%1e4,e,4)}function nPe(t){var e=t.getTimezoneOffset();return(e>0?"-":(e*=-1,"+"))+bn(e/60|0,"0",2)+bn(e%60,"0",2)}function D8(t,e){return bn(t.getUTCDate(),e,2)}function iPe(t,e){return bn(t.getUTCHours(),e,2)}function rPe(t,e){return bn(t.getUTCHours()%12||12,e,2)}function aPe(t,e){return bn(1+ew.count(ac(t),t),e,3)}function jX(t,e){return bn(t.getUTCMilliseconds(),e,3)}function sPe(t,e){return jX(t,e)+"000"}function oPe(t,e){return bn(t.getUTCMonth()+1,e,2)}function lPe(t,e){return bn(t.getUTCMinutes(),e,2)}function cPe(t,e){return bn(t.getUTCSeconds(),e,2)}function uPe(t){var e=t.getUTCDay();return e===0?7:e}function dPe(t,e){return bn(nw.count(ac(t)-1,t),e,2)}function HX(t){var e=t.getUTCDay();return e>=4||e===0?jp(t):jp.ceil(t)}function fPe(t,e){return t=HX(t),bn(jp.count(ac(t),t)+(ac(t).getUTCDay()===4),e,2)}function hPe(t){return t.getUTCDay()}function pPe(t,e){return bn(k1.count(ac(t)-1,t),e,2)}function mPe(t,e){return bn(t.getUTCFullYear()%100,e,2)}function gPe(t,e){return t=HX(t),bn(t.getUTCFullYear()%100,e,2)}function vPe(t,e){return bn(t.getUTCFullYear()%1e4,e,4)}function xPe(t,e){var n=t.getUTCDay();return t=n>=4||n===0?jp(t):jp.ceil(t),bn(t.getUTCFullYear()%1e4,e,4)}function yPe(){return"+0000"}function O8(){return"%"}function L8(t){return+t}function k8(t){return Math.floor(+t/1e3)}var Hh,VX,GX;bPe({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 bPe(t){return Hh=bNe(t),VX=Hh.format,Hh.parse,GX=Hh.utcFormat,Hh.utcParse,Hh}function _Pe(t){return new Date(t)}function SPe(t){return t instanceof Date?+t:+new Date(+t)}function zD(t,e,n,i,r,a,s,o,l,c){var d=ED(),f=d.invert,p=d.domain,m=c(".%L"),y=c(":%S"),b=c("%I:%M"),x=c("%I %p"),v=c("%a %d"),M=c("%b %d"),w=c("%B"),E=c("%Y");function T(P){return(l(P)<P?m:o(P)<P?y:s(P)<P?b:a(P)<P?x:i(P)<P?r(P)<P?v:M:n(P)<P?w:E)(P)}return d.invert=function(P){return new Date(f(P))},d.domain=function(P){return arguments.length?p(Array.from(P,SPe)):p().map(_Pe)},d.ticks=function(P){var R=p();return t(R[0],R[R.length-1],P??10)},d.tickFormat=function(P,R){return R==null?T:c(R)},d.nice=function(P){var R=p();return(!P||typeof P.range!="function")&&(P=e(R[0],R[R.length-1],P??10)),P?p(NX(R,P)):d},d.copy=function(){return wv(d,zD(t,e,n,i,r,a,s,o,l,c))},d}function wPe(){return Gs.apply(zD(xNe,yNe,rc,UD,tw,Mv,kD,OD,Fd,VX).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}function MPe(){return Gs.apply(zD(gNe,vNe,ac,FD,nw,ew,ID,LD,Fd,GX).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)}function iw(){var t=0,e=1,n,i,r,a,s=fa,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(p){var m,y;return arguments.length?([m,y]=p,s=f(m,y),c):[s(0),s(1)]}}return c.range=d(im),c.rangeRound=d(MD),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 Gu(t,e){return e.domain(t.domain()).interpolator(t.interpolator()).clamp(t.clamp()).unknown(t.unknown())}function $X(){var t=Vu(iw()(fa));return t.copy=function(){return Gu(t,$X())},fc.apply(t,arguments)}function WX(){var t=CD(iw()).domain([1,10]);return t.copy=function(){return Gu(t,WX()).base(t.base())},fc.apply(t,arguments)}function qX(){var t=RD(iw());return t.copy=function(){return Gu(t,qX()).constant(t.constant())},fc.apply(t,arguments)}function BD(){var t=ND(iw());return t.copy=function(){return Gu(t,BD()).exponent(t.exponent())},fc.apply(t,arguments)}function EPe(){return BD.apply(null,arguments).exponent(.5)}function XX(){var t=[],e=fa;function n(i){if(i!=null&&!isNaN(i=+i))return e((_v(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(Cu),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)=>u3e(t,a/i))},n.copy=function(){return XX(e).domain(t)},fc.apply(n,arguments)}function rw(){var t=0,e=.5,n=1,i=1,r,a,s,o,l,c=fa,d,f=!1,p;function m(b){return isNaN(b=+b)?p:(b=.5+((b=+d(b))-a)*(i*b<i*a?o:l),c(f?Math.max(0,Math.min(1,b)):b))}m.domain=function(b){return arguments.length?([t,e,n]=b,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,m):[t,e,n]},m.clamp=function(b){return arguments.length?(f=!!b,m):f},m.interpolator=function(b){return arguments.length?(c=b,m):c};function y(b){return function(x){var v,M,w;return arguments.length?([v,M,w]=x,c=U3e(b,[v,M,w]),m):[c(0),c(.5),c(1)]}}return m.range=y(im),m.rangeRound=y(MD),m.unknown=function(b){return arguments.length?(p=b,m):p},function(b){return d=b,r=b(t),a=b(e),s=b(n),o=r===a?0:.5/(a-r),l=a===s?0:.5/(s-a),i=a<r?-1:1,m}}function YX(){var t=Vu(rw()(fa));return t.copy=function(){return Gu(t,YX())},fc.apply(t,arguments)}function KX(){var t=CD(rw()).domain([.1,1,10]);return t.copy=function(){return Gu(t,KX()).base(t.base())},fc.apply(t,arguments)}function ZX(){var t=RD(rw());return t.copy=function(){return Gu(t,ZX()).constant(t.constant())},fc.apply(t,arguments)}function jD(){var t=ND(rw());return t.copy=function(){return Gu(t,jD()).exponent(t.exponent())},fc.apply(t,arguments)}function APe(){return jD.apply(null,arguments).exponent(.5)}const Bg=Object.freeze(Object.defineProperty({__proto__:null,scaleBand:_D,scaleDiverging:YX,scaleDivergingLog:KX,scaleDivergingPow:jD,scaleDivergingSqrt:APe,scaleDivergingSymlog:ZX,scaleIdentity:RX,scaleImplicit:W3,scaleLinear:CX,scaleLog:PX,scaleOrdinal:bD,scalePoint:h3e,scalePow:PD,scaleQuantile:LX,scaleQuantize:kX,scaleRadial:OX,scaleSequential:$X,scaleSequentialLog:WX,scaleSequentialPow:BD,scaleSequentialQuantile:XX,scaleSequentialSqrt:EPe,scaleSequentialSymlog:qX,scaleSqrt:sNe,scaleSymlog:DX,scaleThreshold:IX,scaleTime:wPe,scaleUtc:MPe,tickFormat:TX},Symbol.toStringTag,{value:"Module"}));var $u=t=>t.chartData,HD=He([$u],t=>{var e=t.chartData!=null?t.chartData.length-1:0;return{chartData:t.chartData,computedData:t.computedData,dataEndIndex:e,dataStartIndex:0}}),aw=(t,e,n,i)=>i?HD(t):$u(t);function ku(t){if(Array.isArray(t)&&t.length===2){var[e,n]=t;if(ti(e)&&ti(n))return!0}return!1}function I8(t,e,n){return n?t:[Math.min(t[0],e[0]),Math.max(t[1],e[1])]}function JX(t,e){if(e&&typeof t!="function"&&Array.isArray(t)&&t.length===2){var[n,i]=t,r,a;if(ti(n))r=n;else if(typeof n=="function")return;if(ti(i))a=i;else if(typeof i=="function")return;var s=[r,a];if(ku(s))return s}}function TPe(t,e,n){if(!(!n&&e==null)){if(typeof t=="function"&&e!=null)try{var i=t(e,n);if(ku(i))return I8(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(Mt(r))s=r;else if(typeof r=="function")try{e!=null&&(s=r(e?.[0]))}catch{}else if(typeof r=="string"&&uH.test(r)){var l=uH.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(Mt(a))o=a;else if(typeof a=="function")try{e!=null&&(o=a(e?.[1]))}catch{}else if(typeof a=="string"&&dH.test(a)){var d=dH.exec(a);if(d==null||e==null)o=void 0;else{var f=+d[1];o=e[1]+f}}else o=e?.[1];var p=[s,o];if(ku(p))return e==null?p:I8(p,e,n)}}}var rm=1e9,CPe={precision:20,rounding:4,toExpNeg:-7,toExpPos:21,LN10:"2.302585092994045684017991454684364207601101488628772976033327900967572609677352480235997205089598298341967784042286"},GD,ri=!0,Hs="[DecimalError] ",Zd=Hs+"Invalid argument: ",VD=Hs+"Exponent out of range: ",am=Math.floor,Md=Math.pow,RPe=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,es,yr=1e7,Jn=7,QX=9007199254740991,I1=am(QX/Jn),At={};At.absoluteValue=At.abs=function(){var t=new this.constructor(this);return t.s&&(t.s=1),t};At.comparedTo=At.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};At.decimalPlaces=At.dp=function(){var t=this,e=t.d.length-1,n=(e-t.e)*Jn;if(e=t.d[e],e)for(;e%10==0;e/=10)n--;return n<0?0:n};At.dividedBy=At.div=function(t){return Yl(this,new this.constructor(t))};At.dividedToIntegerBy=At.idiv=function(t){var e=this,n=e.constructor;return Vn(Yl(e,new n(t),0,1),n.precision)};At.equals=At.eq=function(t){return!this.cmp(t)};At.exponent=function(){return $i(this)};At.greaterThan=At.gt=function(t){return this.cmp(t)>0};At.greaterThanOrEqualTo=At.gte=function(t){return this.cmp(t)>=0};At.isInteger=At.isint=function(){return this.e>this.d.length-2};At.isNegative=At.isneg=function(){return this.s<0};At.isPositive=At.ispos=function(){return this.s>0};At.isZero=function(){return this.s===0};At.lessThan=At.lt=function(t){return this.cmp(t)<0};At.lessThanOrEqualTo=At.lte=function(t){return this.cmp(t)<1};At.logarithm=At.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(es))throw Error(Hs+"NaN");if(n.s<1)throw Error(Hs+(n.s?"NaN":"-Infinity"));return n.eq(es)?new i(0):(ri=!1,e=Yl(W0(n,a),W0(t,a),a),ri=!0,Vn(e,r))};At.minus=At.sub=function(t){var e=this;return t=new e.constructor(t),e.s==t.s?nY(e,t):eY(e,(t.s=-t.s,t))};At.modulo=At.mod=function(t){var e,n=this,i=n.constructor,r=i.precision;if(t=new i(t),!t.s)throw Error(Hs+"NaN");return n.s?(ri=!1,e=Yl(n,t,0,1).times(t),ri=!0,n.minus(e)):Vn(new i(n),r)};At.naturalExponential=At.exp=function(){return tY(this)};At.naturalLogarithm=At.ln=function(){return W0(this)};At.negated=At.neg=function(){var t=new this.constructor(this);return t.s=-t.s||0,t};At.plus=At.add=function(t){var e=this;return t=new e.constructor(t),e.s==t.s?eY(e,t):nY(e,(t.s=-t.s,t))};At.precision=At.sd=function(t){var e,n,i,r=this;if(t!==void 0&&t!==!!t&&t!==1&&t!==0)throw Error(Zd+t);if(e=$i(r)+1,i=r.d.length-1,n=i*Jn+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};At.squareRoot=At.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(Hs+"NaN")}for(t=$i(o),ri=!1,r=Math.sqrt(+o),r==0||r==1/0?(e=ko(o.d),(e.length+t)%2==0&&(e+="0"),r=Math.sqrt(e),t=am((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(Yl(o,a,s+2)).times(.5),ko(a.d).slice(0,s)===(e=ko(i.d)).slice(0,s)){if(e=e.slice(s-3,s+1),r==s&&e=="4999"){if(Vn(a,n+1,0),a.times(a).eq(o)){i=a;break}}else if(e!="9999")break;s+=4}return ri=!0,Vn(i,n)};At.times=At.mul=function(t){var e,n,i,r,a,s,o,l,c,d=this,f=d.constructor,p=d.d,m=(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=p.length,c=m.length,l<c&&(a=p,p=m,m=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]+m[i]*p[r-i-1]+e,a[r--]=o%yr|0,e=o/yr|0;a[r]=(a[r]+e)%yr|0}for(;!a[--s];)a.pop();return e?++n:a.shift(),t.d=a,t.e=n,ri?Vn(t,f.precision):t};At.toDecimalPlaces=At.todp=function(t,e){var n=this,i=n.constructor;return n=new i(n),t===void 0?n:($o(t,0,rm),e===void 0?e=i.rounding:$o(e,0,8),Vn(n,t+$i(n)+1,e))};At.toExponential=function(t,e){var n,i=this,r=i.constructor;return t===void 0?n=bf(i,!0):($o(t,0,rm),e===void 0?e=r.rounding:$o(e,0,8),i=Vn(new r(i),t+1,e),n=bf(i,!0,t+1)),n};At.toFixed=function(t,e){var n,i,r=this,a=r.constructor;return t===void 0?bf(r):($o(t,0,rm),e===void 0?e=a.rounding:$o(e,0,8),i=Vn(new a(r),t+$i(r)+1,e),n=bf(i.abs(),!1,t+$i(i)+1),r.isneg()&&!r.isZero()?"-"+n:n)};At.toInteger=At.toint=function(){var t=this,e=t.constructor;return Vn(new e(t),$i(t)+1,e.rounding)};At.toNumber=function(){return+this};At.toPower=At.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(es);if(o=new l(o),!o.s){if(t.s<1)throw Error(Hs+"Infinity");return o}if(o.eq(es))return o;if(i=l.precision,t.eq(es))return Vn(o,i);if(e=t.e,n=t.d.length-1,s=e>=n,a=o.s,s){if((n=d<0?-d:d)<=QX){for(r=new l(es),e=Math.ceil(i/Jn+4),ri=!1;n%2&&(r=r.times(o),F8(r.d,e)),n=am(n/2),n!==0;)o=o.times(o),F8(o.d,e);return ri=!0,t.s<0?new l(es).div(r):Vn(r,i)}}else if(a<0)throw Error(Hs+"NaN");return a=a<0&&t.d[Math.max(e,n)]&1?-1:1,o.s=1,ri=!1,r=t.times(W0(o,i+c)),ri=!0,r=tY(r),r.s=a,r};At.toPrecision=function(t,e){var n,i,r=this,a=r.constructor;return t===void 0?(n=$i(r),i=bf(r,n<=a.toExpNeg||n>=a.toExpPos)):($o(t,1,rm),e===void 0?e=a.rounding:$o(e,0,8),r=Vn(new a(r),t,e),n=$i(r),i=bf(r,t<=n||n<=a.toExpNeg,t)),i};At.toSignificantDigits=At.tosd=function(t,e){var n=this,i=n.constructor;return t===void 0?(t=i.precision,e=i.rounding):($o(t,1,rm),e===void 0?e=i.rounding:$o(e,0,8)),Vn(new i(n),t,e)};At.toString=At.valueOf=At.val=At.toJSON=At[Symbol.for("nodejs.util.inspect.custom")]=function(){var t=this,e=$i(t),n=t.constructor;return bf(t,e<=n.toExpNeg||e>=n.toExpPos)};function eY(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)),ri?Vn(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/Jn),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)/yr|0,l[a]%=yr;for(n&&(l.unshift(n),++r),o=l.length;l[--o]==0;)l.pop();return e.d=l,e.e=r,ri?Vn(e,f):e}function $o(t,e,n){if(t!==~~t||t<e||t>n)throw Error(Zd+t)}function ko(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=Jn-i.length,n&&(a+=su(n)),a+=i;s=t[e],i=s+"",n=Jn-i.length,n&&(a+=su(n))}else if(s===0)return"0";for(;s%10===0;)s/=10;return a+s}var Yl=(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%yr|0,s=a/yr|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*yr+i[a]-r[a];for(;!i[0]&&i.length>1;)i.shift()}return function(i,r,a,s){var o,l,c,d,f,p,m,y,b,x,v,M,w,E,T,P,R,U,N=i.constructor,O=i.s==r.s?1:-1,B=i.d,I=r.d;if(!i.s)return new N(i);if(!r.s)throw Error(Hs+"Division by zero");for(l=i.e-r.e,R=I.length,T=B.length,m=new N(O),y=m.d=[],c=0;I[c]==(B[c]||0);)++c;if(I[c]>(B[c]||0)&&--l,a==null?M=a=N.precision:s?M=a+($i(i)-$i(r))+1:M=a,M<0)return new N(0);if(M=M/Jn+2|0,c=0,R==1)for(d=0,I=I[0],M++;(c<T||d)&&M--;c++)w=d*yr+(B[c]||0),y[c]=w/I|0,d=w%I|0;else{for(d=yr/(I[0]+1)|0,d>1&&(I=t(I,d),B=t(B,d),R=I.length,T=B.length),E=R,b=B.slice(0,R),x=b.length;x<R;)b[x++]=0;U=I.slice(),U.unshift(0),P=I[0],I[1]>=yr/2&&++P;do d=0,o=e(I,b,R,x),o<0?(v=b[0],R!=x&&(v=v*yr+(b[1]||0)),d=v/P|0,d>1?(d>=yr&&(d=yr-1),f=t(I,d),p=f.length,x=b.length,o=e(f,b,p,x),o==1&&(d--,n(f,R<p?U:I,p))):(d==0&&(o=d=1),f=I.slice()),p=f.length,p<x&&f.unshift(0),n(b,f,x),o==-1&&(x=b.length,o=e(I,b,R,x),o<1&&(d++,n(b,R<x?U:I,x))),x=b.length):o===0&&(d++,b=[0]),y[c++]=d,o&&b[0]?b[x++]=B[E]||0:(b=[B[E]],x=1);while((E++<T||b[0]!==void 0)&&M--)}return y[0]||y.shift(),m.e=l,Vn(m,s?a+$i(m)+1:a)}})();function tY(t,e){var n,i,r,a,s,o,l=0,c=0,d=t.constructor,f=d.precision;if($i(t)>16)throw Error(VD+$i(t));if(!t.s)return new d(es);for(ri=!1,o=f,s=new d(.03125);t.abs().gte(.1);)t=t.times(s),c+=5;for(i=Math.log(Md(2,c))/Math.LN10*2+5|0,o+=i,n=r=a=new d(es),d.precision=o;;){if(r=Vn(r.times(t),o),n=n.times(++l),s=a.plus(Yl(r,n,o)),ko(s.d).slice(0,o)===ko(a.d).slice(0,o)){for(;c--;)a=Vn(a.times(a),o);return d.precision=f,e==null?(ri=!0,Vn(a,f)):a}a=s}}function $i(t){for(var e=t.e*Jn,n=t.d[0];n>=10;n/=10)e++;return e}function YC(t,e,n){if(e>t.LN10.sd())throw ri=!0,n&&(t.precision=n),Error(Hs+"LN10 precision limit exceeded");return Vn(new t(t.LN10),e)}function su(t){for(var e="";t--;)e+="0";return e}function W0(t,e){var n,i,r,a,s,o,l,c,d,f=1,p=10,m=t,y=m.d,b=m.constructor,x=b.precision;if(m.s<1)throw Error(Hs+(m.s?"NaN":"-Infinity"));if(m.eq(es))return new b(0);if(e==null?(ri=!1,c=x):c=e,m.eq(10))return e==null&&(ri=!0),YC(b,c);if(c+=p,b.precision=c,n=ko(y),i=n.charAt(0),a=$i(m),Math.abs(a)<15e14){for(;i<7&&i!=1||i==1&&n.charAt(1)>3;)m=m.times(t),n=ko(m.d),i=n.charAt(0),f++;a=$i(m),i>1?(m=new b("0."+n),a++):m=new b(i+"."+n.slice(1))}else return l=YC(b,c+2,x).times(a+""),m=W0(new b(i+"."+n.slice(1)),c-p).plus(l),b.precision=x,e==null?(ri=!0,Vn(m,x)):m;for(o=s=m=Yl(m.minus(es),m.plus(es),c),d=Vn(m.times(m),c),r=3;;){if(s=Vn(s.times(d),c),l=o.plus(Yl(s,new b(r),c)),ko(l.d).slice(0,c)===ko(o.d).slice(0,c))return o=o.times(2),a!==0&&(o=o.plus(YC(b,c+2,x).times(a+""))),o=Yl(o,new b(f),c),b.precision=x,e==null?(ri=!0,Vn(o,x)):o;o=l,r+=2}}function U8(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=am(n/Jn),t.d=[],i=(n+1)%Jn,n<0&&(i+=Jn),i<r){for(i&&t.d.push(+e.slice(0,i)),r-=Jn;i<r;)t.d.push(+e.slice(i,i+=Jn));e=e.slice(i),i=Jn-e.length}else i-=r;for(;i--;)e+="0";if(t.d.push(+e),ri&&(t.e>I1||t.e<-I1))throw Error(VD+n)}else t.s=0,t.e=0,t.d=[0];return t}function Vn(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+=Jn,r=e,c=f[d=0];else{if(d=Math.ceil((i+1)/Jn),a=f.length,d>=a)return t;for(c=a=f[d],s=1;a>=10;a/=10)s++;i%=Jn,r=i-Jn+s}if(n!==void 0&&(a=Md(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/Md(10,s-r):0:f[d-1])%10&1||n==(t.s<0?8:7))),e<1||!f[0])return l?(a=$i(t),f.length=1,e=e-a-1,f[0]=Md(10,(Jn-e%Jn)%Jn),t.e=am(-e/Jn)||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=Md(10,Jn-i),f[d]=r>0?(c/Md(10,s-r)%Md(10,r)|0)*a:0),l)for(;;)if(d==0){(f[0]+=a)==yr&&(f[0]=1,++t.e);break}else{if(f[d]+=a,f[d]!=yr)break;f[d--]=0,a=1}for(i=f.length;f[--i]===0;)f.pop();if(ri&&(t.e>I1||t.e<-I1))throw Error(VD+$i(t));return t}function nY(t,e){var n,i,r,a,s,o,l,c,d,f,p=t.constructor,m=p.precision;if(!t.s||!e.s)return e.s?e.s=-e.s:e=new p(t),ri?Vn(e,m):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(m/Jn),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]=yr-1;--l[a],l[r]+=yr}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,ri?Vn(e,m):e):new p(0)}function bf(t,e,n){var i,r=$i(t),a=ko(t.d),s=a.length;return e?(n&&(i=n-s)>0?a=a.charAt(0)+"."+a.slice(1)+su(i):s>1&&(a=a.charAt(0)+"."+a.slice(1)),a=a+(r<0?"e":"e+")+r):r<0?(a="0."+su(-r-1)+a,n&&(i=n-s)>0&&(a+=su(i))):r>=s?(a+=su(r+1-s),n&&(i=n-r-1)>0&&(a=a+"."+su(i))):((i=r+1)<s&&(a=a.slice(0,i)+"."+a.slice(i)),n&&(i=n-s)>0&&(r+1===s&&(a+="."),a+=su(i))),t.s<0?"-"+a:a}function F8(t,e){if(t.length>e)return t.length=e,!0}function iY(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(Zd+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 U8(s,a.toString())}else if(typeof a!="string")throw Error(Zd+a);if(a.charCodeAt(0)===45?(a=a.slice(1),s.s=-1):s.s=1,RPe.test(a))U8(s,a);else throw Error(Zd+a)}if(r.prototype=At,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=iY,r.config=r.set=NPe,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 NPe(t){if(!t||typeof t!="object")throw Error(Hs+"Object expected");var e,n,i,r=["precision",1,rm,"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(am(i)===i&&i>=r[e+1]&&i<=r[e+2])this[n]=i;else throw Error(Zd+n+": "+i);if((i=t[n="LN10"])!==void 0)if(i==Math.LN10)this[n]=new this(i);else throw Error(Zd+n+": "+i);return this}var GD=iY(CPe);es=new GD(1);const Cn=GD;var PPe=t=>t,rY={},aY=t=>t===rY,z8=t=>function e(){return arguments.length===0||arguments.length===1&&aY(arguments.length<=0?void 0:arguments[0])?e:t(...arguments)},sY=(t,e)=>t===1?e:z8(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!==rY).length;return a>=t?e(...i):sY(t-a,z8(function(){for(var s=arguments.length,o=new Array(s),l=0;l<s;l++)o[l]=arguments[l];var c=i.map(d=>aY(d)?o.shift():d);return e(...c,...o)}))}),DPe=t=>sY(t.length,t),K3=(t,e)=>{for(var n=[],i=t;i<e;++i)n[i-t]=i;return n},OPe=DPe((t,e)=>Array.isArray(e)?e.map(t):Object.keys(e).map(n=>e[n]).map(t)),LPe=function(){for(var e=arguments.length,n=new Array(e),i=0;i<e;i++)n[i]=arguments[i];if(!n.length)return PPe;var r=n.reverse(),a=r[0],s=r.slice(1);return function(){return s.reduce((o,l)=>l(o),a(...arguments))}},Z3=t=>Array.isArray(t)?t.reverse():t.split("").reverse().join("");function oY(t){var e;return t===0?e=1:e=Math.floor(new Cn(t).abs().log(10).toNumber())+1,e}function lY(t,e,n){for(var i=new Cn(t),r=0,a=[];i.lt(e)&&r<1e5;)a.push(i.toNumber()),i=i.add(n),r++;return a}var cY=t=>{var[e,n]=t,[i,r]=[e,n];return e>n&&([i,r]=[n,e]),[i,r]},uY=(t,e,n)=>{if(t.lte(0))return new Cn(0);var i=oY(t.toNumber()),r=new Cn(10).pow(i),a=t.div(r),s=i!==1?.05:.1,o=new Cn(Math.ceil(a.div(s).toNumber())).add(n).mul(s),l=o.mul(r);return e?new Cn(l.toNumber()):new Cn(Math.ceil(l.toNumber()))},kPe=(t,e,n)=>{var i=new Cn(1),r=new Cn(t);if(!r.isint()&&n){var a=Math.abs(t);a<1?(i=new Cn(10).pow(oY(t)-1),r=new Cn(Math.floor(r.div(i).toNumber())).mul(i)):a>1&&(r=new Cn(Math.floor(t)))}else t===0?r=new Cn(Math.floor((e-1)/2)):n||(r=new Cn(Math.floor(t)));var s=Math.floor((e-1)/2),o=LPe(OPe(l=>r.add(new Cn(l-s).mul(i)).toNumber()),K3);return o(0,e)},dY=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 Cn(0),tickMin:new Cn(0),tickMax:new Cn(0)};var s=uY(new Cn(n).sub(e).div(i-1),r,a),o;e<=0&&n>=0?o=new Cn(0):(o=new Cn(e).add(n).div(2),o=o.sub(new Cn(o).mod(s)));var l=Math.ceil(o.sub(e).div(s).toNumber()),c=Math.ceil(new Cn(n).sub(o).div(s).toNumber()),d=l+c+1;return d>i?dY(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 Cn(l).mul(s)),tickMax:o.add(new Cn(c).mul(s))})},IPe=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]=cY([n,i]);if(o===-1/0||l===1/0){var c=l===1/0?[o,...K3(0,r-1).map(()=>1/0)]:[...K3(0,r-1).map(()=>-1/0),l];return n>i?Z3(c):c}if(o===l)return kPe(o,r,a);var{step:d,tickMin:f,tickMax:p}=dY(o,l,s,a,0),m=lY(f,p.add(new Cn(.1).mul(d)),d);return n>i?Z3(m):m},UPe=function(e,n){var[i,r]=e,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,[s,o]=cY([i,r]);if(s===-1/0||o===1/0)return[i,r];if(s===o)return[s];var l=Math.max(n,2),c=uY(new Cn(o).sub(s).div(l-1),a,0),d=[...lY(new Cn(s),new Cn(o),c),o];return a===!1&&(d=d.map(f=>Math.round(f))),i>r?Z3(d):d},fY=t=>t.rootProps.maxBarSize,FPe=t=>t.rootProps.barGap,hY=t=>t.rootProps.barCategoryGap,zPe=t=>t.rootProps.barSize,Ev=t=>t.rootProps.stackOffset,pY=t=>t.rootProps.reverseStackOrder,$D=t=>t.options.chartName,WD=t=>t.rootProps.syncId,mY=t=>t.rootProps.syncMethod,qD=t=>t.options.eventEmitter,BPe=t=>t.rootProps.baseValue,Vi={grid:-100,barBackground:-50,area:100,cursorRectangle:200,bar:300,line:400,axis:500,scatter:600,activeBar:1e3,cursorLine:1100,activeDot:1200,label:2e3},Ll={allowDuplicatedCategory:!0,angleAxisId:0,reversed:!1,scale:"auto",tick:!0,type:"category"},Za={allowDataOverflow:!1,allowDuplicatedCategory:!0,radiusAxisId:0,scale:"auto",tick:!0,tickCount:5,type:"number"},sw=(t,e)=>{if(!(!t||!e))return t!=null&&t.reversed?[e[1],e[0]]:e},jPe={allowDataOverflow:!1,allowDecimals:!1,allowDuplicatedCategory:!1,dataKey:void 0,domain:void 0,id:Ll.angleAxisId,includeHidden:!1,name:void 0,reversed:Ll.reversed,scale:Ll.scale,tick:Ll.tick,tickCount:void 0,ticks:void 0,type:Ll.type,unit:void 0},HPe={allowDataOverflow:Za.allowDataOverflow,allowDecimals:!1,allowDuplicatedCategory:Za.allowDuplicatedCategory,dataKey:void 0,domain:void 0,id:Za.radiusAxisId,includeHidden:!1,name:void 0,reversed:!1,scale:Za.scale,tick:Za.tick,tickCount:Za.tickCount,ticks:void 0,type:Za.type,unit:void 0},VPe={allowDataOverflow:!1,allowDecimals:!1,allowDuplicatedCategory:Ll.allowDuplicatedCategory,dataKey:void 0,domain:void 0,id:Ll.angleAxisId,includeHidden:!1,name:void 0,reversed:!1,scale:Ll.scale,tick:Ll.tick,tickCount:void 0,ticks:void 0,type:"number",unit:void 0},GPe={allowDataOverflow:Za.allowDataOverflow,allowDecimals:!1,allowDuplicatedCategory:Za.allowDuplicatedCategory,dataKey:void 0,domain:void 0,id:Za.radiusAxisId,includeHidden:!1,name:void 0,reversed:!1,scale:Za.scale,tick:Za.tick,tickCount:Za.tickCount,ticks:void 0,type:"category",unit:void 0},XD=(t,e)=>t.polarAxis.angleAxis[e]!=null?t.polarAxis.angleAxis[e]:t.layout.layoutType==="radial"?VPe:jPe,YD=(t,e)=>t.polarAxis.radiusAxis[e]!=null?t.polarAxis.radiusAxis[e]:t.layout.layoutType==="radial"?GPe:HPe,ow=t=>t.polarOptions,KD=He([uc,dc,sr],hX),gY=He([ow,KD],(t,e)=>{if(t!=null)return ta(t.innerRadius,e,0)}),vY=He([ow,KD],(t,e)=>{if(t!=null)return ta(t.outerRadius,e,e*.8)}),$Pe=t=>{if(t==null)return[0,0];var{startAngle:e,endAngle:n}=t;return[e,n]},xY=He([ow],$Pe);He([XD,xY],sw);var yY=He([KD,gY,vY],(t,e,n)=>{if(!(t==null||e==null||n==null))return[e,n]});He([YD,yY],sw);var bY=He([mn,ow,gY,vY,uc,dc],(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:ta(s,r,r/2),cy:ta(o,a,a/2),innerRadius:n,outerRadius:i,startAngle:l,endAngle:c,clockWise:!1}}}),ai=(t,e)=>e,Av=(t,e,n)=>n;function lw(t){return t?.id}function _Y(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=lw(o);c.forEach((f,p)=>{var m=a==null||r?p:String(Hn(f,a,null)),y=Hn(f,o.dataKey,0),b;s.has(m)?b=s.get(m):b={},Object.assign(b,{[d]:y}),s.set(m,b)})}}),Array.from(s.values())}function cw(t){return t.stackId!=null&&t.dataKey!=null}var uw=(t,e)=>t===e?!0:t==null||e==null?!1:t[0]===e[0]&&t[1]===e[1];function dw(t,e){return Array.isArray(t)&&Array.isArray(e)&&t.length===0&&e.length===0?!0:t===e}function WPe(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 lr=t=>{var e=mn(t);return e==="horizontal"?"xAxis":e==="vertical"?"yAxis":e==="centric"?"angleAxis":"radiusAxis"},sm=t=>t.tooltip.settings.axisId;function B8(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 U1(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?B8(Object(n),!0).forEach(function(i){qPe(t,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):B8(Object(n)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(n,i))})}return t}function qPe(t,e,n){return(e=XPe(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function XPe(t){var e=YPe(t,"string");return typeof e=="symbol"?e:e+""}function YPe(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 J3=[0,"auto"],vr={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},SY=(t,e)=>t.cartesianAxis.xAxis[e],hc=(t,e)=>{var n=SY(t,e);return n??vr},xr={allowDataOverflow:!1,allowDecimals:!0,allowDuplicatedCategory:!0,angle:0,dataKey:void 0,domain:J3,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:vv},wY=(t,e)=>t.cartesianAxis.yAxis[e],pc=(t,e)=>{var n=wY(t,e);return n??xr},KPe={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:""},ZD=(t,e)=>{var n=t.cartesianAxis.zAxis[e];return n??KPe},fi=(t,e,n)=>{switch(e){case"xAxis":return hc(t,n);case"yAxis":return pc(t,n);case"zAxis":return ZD(t,n);case"angleAxis":return XD(t,n);case"radiusAxis":return YD(t,n);default:throw new Error("Unexpected axis type: ".concat(e))}},ZPe=(t,e,n)=>{switch(e){case"xAxis":return hc(t,n);case"yAxis":return pc(t,n);default:throw new Error("Unexpected axis type: ".concat(e))}},Tv=(t,e,n)=>{switch(e){case"xAxis":return hc(t,n);case"yAxis":return pc(t,n);case"angleAxis":return XD(t,n);case"radiusAxis":return YD(t,n);default:throw new Error("Unexpected axis type: ".concat(e))}},MY=t=>t.graphicalItems.cartesianItems.some(e=>e.type==="bar")||t.graphicalItems.polarItems.some(e=>e.type==="radialBar");function JD(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 fw=t=>t.graphicalItems.cartesianItems,JPe=He([ai,Av],JD),QD=(t,e,n)=>t.filter(n).filter(i=>e?.includeHidden===!0?!0:!i.hide),Cv=He([fw,fi,JPe],QD,{memoizeOptions:{resultEqualityCheck:dw}}),EY=He([Cv],t=>t.filter(e=>e.type==="area"||e.type==="bar").filter(cw)),AY=t=>t.filter(e=>!("stackId"in e)||e.stackId===void 0),QPe=He([Cv],AY),eO=t=>t.map(e=>e.data).filter(Boolean).flat(1),eDe=He([Cv],eO,{memoizeOptions:{resultEqualityCheck:dw}}),tO=(t,e)=>{var{chartData:n=[],dataStartIndex:i,dataEndIndex:r}=e;return t.length>0?t:n.slice(i,r+1)},nO=He([eDe,aw],tO),iO=(t,e,n)=>e?.dataKey!=null?t.map(i=>({value:Hn(i,e.dataKey)})):n.length>0?n.map(i=>i.dataKey).flatMap(i=>t.map(r=>({value:Hn(r,i)}))):t.map(i=>({value:i})),hw=He([nO,fi,Cv],iO);function TY(t,e){switch(t){case"xAxis":return e.direction==="x";case"yAxis":return e.direction==="y";default:return!1}}function qb(t){if(Vo(t)||t instanceof Date){var e=Number(t);if(ti(e))return e}}function j8(t){if(Array.isArray(t)){var e=[qb(t[0]),qb(t[1])];return ku(e)?e:void 0}var n=qb(t);if(n!=null)return[n,n]}function sc(t){return t.map(qb).filter(QEe)}function tDe(t,e,n){return!n||typeof e!="number"||Bs(e)?[]:n.length?sc(n.flatMap(i=>{var r=Hn(t,i.dataKey),a,s;if(Array.isArray(r)?[a,s]=r:a=s=r,!(!ti(a)||!ti(s)))return[e-a,e+s]})):[]}var cr=t=>{var e=lr(t),n=sm(t);return Tv(t,e,n)},Rv=He([cr],t=>t?.dataKey),nDe=He([EY,aw,cr],_Y),CY=(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(lw);return[o,{stackedData:_Ce(t,d,n),graphicalItems:c}]}))},q0=He([nDe,EY,Ev,pY],CY),RY=(t,e,n,i)=>{var{dataStartIndex:r,dataEndIndex:a}=e;if(i==null&&n!=="zAxis"){var s=ECe(t,r,a);if(!(s!=null&&s[0]===0&&s[1]===0))return s}},iDe=He([fi],t=>t.allowDataOverflow),rO=t=>{var e;if(t==null||!("domain"in t))return J3;if(t.domain!=null)return t.domain;if(t.ticks!=null){if(t.type==="number"){var n=sc(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:J3},aO=He([fi],rO),sO=He([aO,iDe],JX),rDe=He([q0,$u,ai,sO],RY,{memoizeOptions:{resultEqualityCheck:uw}}),pw=t=>t.errorBars,aDe=(t,e,n)=>t.flatMap(i=>e[i.id]).filter(Boolean).filter(i=>TY(n,i)),F1=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]}},oO=(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(v=>TY(r,v)),p=Hn(o,(d=e.dataKey)!==null&&d!==void 0?d:l.dataKey),m=tDe(o,p,f);if(m.length>=2){var y=Math.min(...m),b=Math.max(...m);(a==null||y<a)&&(a=y),(s==null||b>s)&&(s=b)}var x=j8(p);x!=null&&(a=a==null?x[0]:Math.min(a,x[0]),s=s==null?x[1]:Math.max(s,x[1]))})}),e?.dataKey!=null&&t.forEach(o=>{var l=j8(Hn(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]))}),ti(a)&&ti(s))return[a,s]},sDe=He([nO,fi,QPe,pw,ai],oO,{memoizeOptions:{resultEqualityCheck:uw}});function oDe(t){var{value:e}=t;if(Vo(e)||e instanceof Date)return e}var lDe=(t,e,n)=>{var i=t.map(oDe).filter(r=>r!=null);return n&&(e.dataKey==null||e.allowDuplicatedCategory&&G7(i))?vX(0,t.length):e.allowDuplicatedCategory?i:Array.from(new Set(i))},NY=t=>t.referenceElements.dots,om=(t,e,n)=>t.filter(i=>i.ifOverflow==="extendDomain").filter(i=>e==="xAxis"?i.xAxisId===n:i.yAxisId===n),cDe=He([NY,ai,Av],om),PY=t=>t.referenceElements.areas,uDe=He([PY,ai,Av],om),DY=t=>t.referenceElements.lines,dDe=He([DY,ai,Av],om),OY=(t,e)=>{var n=sc(t.map(i=>e==="xAxis"?i.x:i.y));if(n.length!==0)return[Math.min(...n),Math.max(...n)]},fDe=He(cDe,ai,OY),LY=(t,e)=>{var n=sc(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)]},hDe=He([uDe,ai],LY);function pDe(t){var e;if(t.x!=null)return sc([t.x]);var n=(e=t.segment)===null||e===void 0?void 0:e.map(i=>i.x);return n==null||n.length===0?[]:sc(n)}function mDe(t){var e;if(t.y!=null)return sc([t.y]);var n=(e=t.segment)===null||e===void 0?void 0:e.map(i=>i.y);return n==null||n.length===0?[]:sc(n)}var kY=(t,e)=>{var n=t.flatMap(i=>e==="xAxis"?pDe(i):mDe(i));if(n.length!==0)return[Math.min(...n),Math.max(...n)]},gDe=He([dDe,ai],kY),vDe=He(fDe,gDe,hDe,(t,e,n)=>F1(t,n,e)),lO=(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?F1(i,a,r):F1(a,r);return TPe(e,c,t.allowDataOverflow)},xDe=He([fi,aO,sO,rDe,sDe,vDe,mn,ai],lO,{memoizeOptions:{resultEqualityCheck:uw}}),yDe=[0,1],cO=(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=cc(e,a);if(c&&o==null){var d;return vX(0,(d=n?.length)!==null&&d!==void 0?d:0)}return l==="category"?lDe(i,t,c):r==="expand"?yDe:s}},uO=He([fi,mn,nO,hw,Ev,ai,xDe],cO),IY=(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(dv(a));return o in Bg?o:"point"}}},lm=He([fi,mn,MY,$D,ai],IY);function bDe(t){if(t!=null){if(t in Bg)return Bg[t]();var e="scale".concat(dv(t));if(e in Bg)return Bg[e]()}}function dO(t,e,n,i){if(!(n==null||i==null)){if(typeof t.scale=="function")return t.scale.copy().domain(n).range(i);var r=bDe(e);if(r!=null){var a=r.domain(n).range(i);return gCe(a),a}}}var fO=(t,e,n)=>{var i=rO(e);if(!(n!=="auto"&&n!=="linear")){if(e!=null&&e.tickCount&&Array.isArray(i)&&(i[0]==="auto"||i[1]==="auto")&&ku(t))return IPe(t,e.tickCount,e.allowDecimals);if(e!=null&&e.tickCount&&e.type==="number"&&ku(t))return UPe(t,e.tickCount,e.allowDecimals)}},hO=He([uO,Tv,lm],fO),pO=(t,e,n,i)=>{if(i!=="angleAxis"&&t?.type==="number"&&ku(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},_De=He([fi,uO,hO,ai],pO),SDe=He(hw,fi,(t,e)=>{if(!(!e||e.type!=="number")){var n=1/0,i=Array.from(sc(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}}),UY=He(SDe,mn,hY,sr,(t,e,n,i)=>i,(t,e,n,i,r)=>{if(!ti(t))return 0;var a=e==="vertical"?i.height:i.width;if(r==="gap")return t*a/2;if(r==="no-gap"){var s=ta(n,t*a),o=t*a/2;return o-s-(o-s)/a*s}return 0}),wDe=(t,e)=>{var n=hc(t,e);return n==null||typeof n.padding!="string"?0:UY(t,"xAxis",e,n.padding)},MDe=(t,e)=>{var n=pc(t,e);return n==null||typeof n.padding!="string"?0:UY(t,"yAxis",e,n.padding)},EDe=He(hc,wDe,(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}}),ADe=He(pc,MDe,(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}}),TDe=He([sr,EDe,qS,WS,(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]}),CDe=He([sr,mn,ADe,qS,WS,(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]}),Nv=(t,e,n,i)=>{var r;switch(e){case"xAxis":return TDe(t,n,i);case"yAxis":return CDe(t,n,i);case"zAxis":return(r=ZD(t,n))===null||r===void 0?void 0:r.range;case"angleAxis":return xY(t);case"radiusAxis":return yY(t,n);default:return}},FY=He([fi,Nv],sw),cm=He([fi,lm,_De,FY],dO);He([Cv,pw,ai],aDe);function zY(t,e){return t.id<e.id?-1:t.id>e.id?1:0}var mw=(t,e)=>e,gw=(t,e,n)=>n,RDe=He(GS,mw,gw,(t,e,n)=>t.filter(i=>i.orientation===e).filter(i=>i.mirror===n).sort(zY)),NDe=He($S,mw,gw,(t,e,n)=>t.filter(i=>i.orientation===e).filter(i=>i.mirror===n).sort(zY)),BY=(t,e)=>({width:t.width,height:e.height}),PDe=(t,e)=>{var n=typeof e.width=="number"?e.width:vv;return{width:n,height:t.height}},jY=He(sr,hc,BY),DDe=(t,e,n)=>{switch(e){case"top":return t.top;case"bottom":return n-t.bottom;default:return 0}},ODe=(t,e,n)=>{switch(e){case"left":return t.left;case"right":return n-t.right;default:return 0}},LDe=He(dc,sr,RDe,mw,gw,(t,e,n,i,r)=>{var a={},s;return n.forEach(o=>{var l=BY(e,o);s==null&&(s=DDe(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}),kDe=He(uc,sr,NDe,mw,gw,(t,e,n,i,r)=>{var a={},s;return n.forEach(o=>{var l=PDe(e,o);s==null&&(s=ODe(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}),IDe=(t,e)=>{var n=hc(t,e);if(n!=null)return LDe(t,n.orientation,n.mirror)},UDe=He([sr,hc,IDe,(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}}}),FDe=(t,e)=>{var n=pc(t,e);if(n!=null)return kDe(t,n.orientation,n.mirror)},zDe=He([sr,pc,FDe,(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}}}),HY=He(sr,pc,(t,e)=>{var n=typeof e.width=="number"?e.width:vv;return{width:n,height:t.height}}),H8=(t,e,n)=>{switch(e){case"xAxis":return jY(t,n).width;case"yAxis":return HY(t,n).height;default:return}},VY=(t,e,n,i)=>{if(n!=null){var{allowDuplicatedCategory:r,type:a,dataKey:s}=n,o=cc(t,i),l=e.map(c=>c.value);if(s&&o&&a==="category"&&r&&G7(l))return l}},mO=He([mn,hw,fi,ai],VY),GY=(t,e,n,i)=>{if(!(n==null||n.dataKey==null)){var{type:r,scale:a}=n,s=cc(t,i);if(s&&(r==="number"||a!=="auto"))return e.map(o=>o.value)}},gO=He([mn,hw,Tv,ai],GY),V8=He([mn,ZPe,lm,cm,mO,gO,Nv,hO,ai],(t,e,n,i,r,a,s,o,l)=>{if(e!=null){var c=cc(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}}}),BDe=(t,e,n,i,r,a,s,o,l)=>{if(!(e==null||i==null)){var c=cc(t,l),{type:d,ticks:f,tickCount:p}=e,m=n==="scaleBand"&&typeof i.bandwidth=="function"?i.bandwidth()/2:2,y=d==="category"&&i.bandwidth?i.bandwidth()/m:0;y=l==="angleAxis"&&a!=null&&a.length>=2?Sr(a[0]-a[1])*2*y:y;var b=f||r;if(b){var x=b.map((v,M)=>{var w=s?s.indexOf(v):v;return{index:M,coordinate:i(w)+y,value:v,offset:y}});return x.filter(v=>ti(v.coordinate))}return c&&o?o.map((v,M)=>({coordinate:i(v)+y,value:v,index:M,offset:y})).filter(v=>ti(v.coordinate)):i.ticks?i.ticks(p).map(v=>({coordinate:i(v)+y,value:v,offset:y})):i.domain().map((v,M)=>({coordinate:i(v)+y,value:s?s[v]:v,index:M,offset:y}))}},$Y=He([mn,Tv,lm,cm,hO,Nv,mO,gO,ai],BDe),jDe=(t,e,n,i,r,a,s)=>{if(!(e==null||n==null||i==null||i[0]===i[1])){var o=cc(t,s),{tickCount:l}=e,c=0;return c=s==="angleAxis"&&i?.length>=2?Sr(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}))}},Iu=He([mn,Tv,cm,Nv,mO,gO,ai],jDe),Uu=He(fi,cm,(t,e)=>{if(!(t==null||e==null))return U1(U1({},t),{},{scale:e})}),HDe=He([fi,lm,uO,FY],dO);He((t,e,n)=>ZD(t,n),HDe,(t,e)=>{if(!(t==null||e==null))return U1(U1({},t),{},{scale:e})});var VDe=He([mn,GS,$S],(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}}),WY=t=>t.options.defaultTooltipEventType,qY=t=>t.options.validateTooltipEventTypes;function XY(t,e,n){if(t==null)return e;var i=t?"axis":"item";return n==null?e:n.includes(i)?i:e}function vO(t,e){var n=WY(t),i=qY(t);return XY(e,n,i)}function GDe(t){return Et(e=>vO(e,t))}var YY=(t,e)=>{var n,i=Number(e);if(!(Bs(i)||e==null))return i>=0?t==null||(n=t[i])===null||n===void 0?void 0:n.value:void 0},$De=t=>t.tooltip.settings,fu={active:!1,index:null,dataKey:void 0,graphicalItemId:void 0,coordinate:void 0},WDe={itemInteraction:{click:fu,hover:fu},axisInteraction:{click:fu,hover:fu},keyboardInteraction:fu,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}},KY=Ua({name:"tooltip",initialState:WDe,reducers:{addTooltipEntrySettings:{reducer(t,e){t.tooltipItemPayloads.push(e.payload)},prepare:ii()},replaceTooltipEntrySettings:{reducer(t,e){var{prev:n,next:i}=e.payload,r=ho(t).tooltipItemPayloads.indexOf(n);r>-1&&(t.tooltipItemPayloads[r]=i)},prepare:ii()},removeTooltipEntrySettings:{reducer(t,e){var n=ho(t).tooltipItemPayloads.indexOf(e.payload);n>-1&&t.tooltipItemPayloads.splice(n,1)},prepare:ii()},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:qDe,replaceTooltipEntrySettings:XDe,removeTooltipEntrySettings:YDe,setTooltipSettingsState:KDe,setActiveMouseOverItemIndex:ZY,mouseLeaveItem:ZDe,mouseLeaveChart:JY,setActiveClickItemIndex:JDe,setMouseOverAxisIndex:QY,setMouseClickAxisIndex:QDe,setSyncInteraction:Q3,setKeyboardInteraction:eN}=KY.actions,eOe=KY.reducer;function G8(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 Sb(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?G8(Object(n),!0).forEach(function(i){tOe(t,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):G8(Object(n)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(n,i))})}return t}function tOe(t,e,n){return(e=nOe(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function nOe(t){var e=iOe(t,"string");return typeof e=="symbol"?e:e+""}function iOe(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 rOe(t,e,n){return e==="axis"?n==="click"?t.axisInteraction.click:t.axisInteraction.hover:n==="click"?t.itemInteraction.click:t.itemInteraction.hover}function aOe(t){return t.index!=null}var eK=(t,e,n,i)=>{if(e==null)return fu;var r=rOe(t,e,n);if(r==null)return fu;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(aOe(r)){if(a)return Sb(Sb({},r),{},{active:!0})}else if(i!=null)return{active:!0,coordinate:void 0,dataKey:void 0,index:i,graphicalItemId:void 0};return Sb(Sb({},fu),{},{coordinate:r.coordinate})};function sOe(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 oOe(t,e){var n=sOe(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 lOe(t,e,n){if(n==null||e==null)return!0;var i=Hn(t,e);return i==null||!ku(n)?!0:oOe(i,n)}var xO=(t,e,n,i)=>{var r=t?.index;if(r==null)return null;var a=Number(r);if(!ti(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||lOe(c,n,i)?String(l):null},tK=(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}}}},nK=(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})},Pv=t=>t.options.tooltipPayloadSearcher,um=t=>t.tooltip;function $8(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 W8(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?$8(Object(n),!0).forEach(function(i){cOe(t,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):$8(Object(n)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(n,i))})}return t}function cOe(t,e,n){return(e=uOe(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function uOe(t){var e=dOe(t,"string");return typeof e=="symbol"?e:e+""}function dOe(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 fOe(t,e){return t??e}var iK=(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((p,m)=>{var y,{dataDefinedOnItem:b,settings:x}=m,v=fOe(b,o),M=Array.isArray(v)?Fq(v,c,d):v,w=(y=x?.dataKey)!==null&&y!==void 0?y:i,E=x?.nameKey,T;if(i&&Array.isArray(M)&&!Array.isArray(M[0])&&s==="axis"?T=$7(M,i,r):T=a(M,e,l,E),Array.isArray(T))T.forEach(R=>{var U=W8(W8({},x),{},{name:R.name,unit:R.unit,color:void 0,fill:void 0});p.push(fH({tooltipEntrySettings:U,dataKey:R.dataKey,payload:R.payload,value:Hn(R.payload,R.dataKey),name:R.name}))});else{var P;p.push(fH({tooltipEntrySettings:x,dataKey:w,payload:T,value:Hn(T,w),name:(P=Hn(T,E))!==null&&P!==void 0?P:x?.name}))}return p},f)}},yO=He([cr,mn,MY,$D,lr],IY),hOe=He([t=>t.graphicalItems.cartesianItems,t=>t.graphicalItems.polarItems],(t,e)=>[...t,...e]),pOe=He([lr,sm],JD),Dv=He([hOe,cr,pOe],QD,{memoizeOptions:{resultEqualityCheck:dw}}),mOe=He([Dv],t=>t.filter(cw)),gOe=He([Dv],eO,{memoizeOptions:{resultEqualityCheck:dw}}),dm=He([gOe,$u],tO),vOe=He([mOe,$u,cr],_Y),bO=He([dm,cr,Dv],iO),rK=He([cr],rO),xOe=He([cr],t=>t.allowDataOverflow),aK=He([rK,xOe],JX),yOe=He([Dv],t=>t.filter(cw)),bOe=He([vOe,yOe,Ev,pY],CY),_Oe=He([bOe,$u,lr,aK],RY),SOe=He([Dv],AY),wOe=He([dm,cr,SOe,pw,lr],oO,{memoizeOptions:{resultEqualityCheck:uw}}),MOe=He([NY,lr,sm],om),EOe=He([MOe,lr],OY),AOe=He([PY,lr,sm],om),TOe=He([AOe,lr],LY),COe=He([DY,lr,sm],om),ROe=He([COe,lr],kY),NOe=He([EOe,ROe,TOe],F1),POe=He([cr,rK,aK,_Oe,wOe,NOe,mn,lr],lO),Ov=He([cr,mn,dm,bO,Ev,lr,POe],cO),DOe=He([Ov,cr,yO],fO),OOe=He([cr,Ov,DOe,lr],pO),sK=t=>{var e=lr(t),n=sm(t),i=!1;return Nv(t,e,n,i)},oK=He([cr,sK],sw),lK=He([cr,yO,OOe,oK],dO),LOe=He([mn,bO,cr,lr],VY),kOe=He([mn,bO,cr,lr],GY),IOe=(t,e,n,i,r,a,s,o)=>{if(e){var{type:l}=e,c=cc(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?Sr(r[0]-r[1])*2*f:f,c&&s?s.map((p,m)=>({coordinate:i(p)+f,value:p,index:m,offset:f})):i.domain().map((p,m)=>({coordinate:i(p)+f,value:a?a[p]:p,index:m,offset:f}))}}},mc=He([mn,cr,yO,lK,sK,LOe,kOe,lr],IOe),_O=He([WY,qY,$De],(t,e,n)=>XY(n.shared,t,e)),cK=t=>t.tooltip.settings.trigger,SO=t=>t.tooltip.settings.defaultIndex,Lv=He([um,_O,cK,SO],eK),Fu=He([Lv,dm,Rv,Ov],xO),uK=He([mc,Fu],YY),wO=He([Lv],t=>{if(t)return t.dataKey}),UOe=He([Lv],t=>{if(t)return t.graphicalItemId}),dK=He([um,_O,cK,SO],nK),FOe=He([uc,dc,mn,sr,mc,SO,dK,Pv],tK),zOe=He([Lv,FOe],(t,e)=>t!=null&&t.coordinate?t.coordinate:e),BOe=He([Lv],t=>t.active),jOe=He([dK,Fu,$u,Rv,uK,Pv,_O],iK),HOe=He([jOe],t=>{if(t!=null){var e=t.map(n=>n.payload).filter(n=>n!=null);return Array.from(new Set(e))}});function q8(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 X8(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?q8(Object(n),!0).forEach(function(i){VOe(t,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):q8(Object(n)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(n,i))})}return t}function VOe(t,e,n){return(e=GOe(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function GOe(t){var e=$Oe(t,"string");return typeof e=="symbol"?e:e+""}function $Oe(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 WOe=()=>Et(cr),qOe=()=>{var t=WOe(),e=Et(mc),n=Et(lK);return Ip(!t||!n?void 0:X8(X8({},t),{},{scale:n}),e)};function Y8(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 Vh(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Y8(Object(n),!0).forEach(function(i){XOe(t,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Y8(Object(n)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(n,i))})}return t}function XOe(t,e,n){return(e=YOe(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function YOe(t){var e=KOe(t,"string");return typeof e=="symbol"?e:e+""}function KOe(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 ZOe=(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}},JOe=(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 Vh(Vh(Vh({},i),Hi(i.cx,i.cy,s,a)),{},{angle:a,radius:s})}var o=r.coordinate,{angle:l}=i;return Vh(Vh(Vh({},i),Hi(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 QOe(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 fK=(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,p=void 0;if(Sr(d-c)!==Sr(f-d)){var m=[];if(Sr(f-d)===Sr(r[1]-r[0])){p=f;var y=d+r[1]-r[0];m[0]=Math.min(y,(y+c)/2),m[1]=Math.max(y,(y+c)/2)}else{p=c;var b=f+r[1]-r[0];m[0]=Math.min(d,(b+d)/2),m[1]=Math.max(d,(b+d)/2)}var x=[Math.min(d,(p+d)/2),Math.max(d,(p+d)/2)];if(t>x[0]&&t<=x[1]||t>=m[0]&&t<=m[1]){({index:s}=n[l]);break}}else{var v=Math.min(c,f),M=Math.max(c,f);if(t>(v+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},hK=()=>Et($D),MO=(t,e)=>e,pK=(t,e,n)=>n,EO=(t,e,n,i)=>i,eLe=He(mc,t=>kS(t,e=>e.coordinate)),AO=He([um,MO,pK,EO],eK),TO=He([AO,dm,Rv,Ov],xO),tLe=(t,e,n)=>{if(e!=null){var i=um(t);return e==="axis"?n==="hover"?i.axisInteraction.hover.dataKey:i.axisInteraction.click.dataKey:n==="hover"?i.itemInteraction.hover.dataKey:i.itemInteraction.click.dataKey}},mK=He([um,MO,pK,EO],nK),z1=He([uc,dc,mn,sr,mc,EO,mK,Pv],tK),nLe=He([AO,z1],(t,e)=>{var n;return(n=t.coordinate)!==null&&n!==void 0?n:e}),gK=He([mc,TO],YY),iLe=He([mK,TO,$u,Rv,gK,Pv,MO],iK),rLe=He([AO,TO],(t,e)=>({isActive:t.active&&e!=null,activeIndex:e})),aLe=(t,e,n,i,r,a,s)=>{if(!(!t||!n||!i||!r)&&QOe(t,s)){var o=ACe(t,e),l=fK(o,a,r,n,i),c=ZOe(e,r,l,t);return{activeIndex:String(l),activeCoordinate:c}}},sLe=(t,e,n,i,r,a,s)=>{if(!(!t||!i||!r||!a||!n)){var o=VRe(t,n);if(o){var l=TCe(o,e),c=fK(l,s,a,i,r),d=JOe(e,a,c,o);return{activeIndex:String(c),activeCoordinate:d}}}},oLe=(t,e,n,i,r,a,s,o)=>{if(!(!t||!e||!i||!r||!a))return e==="horizontal"||e==="vertical"?aLe(t,e,i,r,a,s,o):sLe(t,e,n,i,r,a,s)},lLe=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}}),cLe=He(t=>t.zIndex.zIndexMap,t=>{var e=Object.keys(t).map(i=>parseInt(i,10)).concat(Object.values(Vi)),n=Array.from(new Set(e));return n.sort((i,r)=>i-r)},{memoizeOptions:{resultEqualityCheck:WPe}});function K8(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 Z8(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?K8(Object(n),!0).forEach(function(i){uLe(t,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):K8(Object(n)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(n,i))})}return t}function uLe(t,e,n){return(e=dLe(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function dLe(t){var e=fLe(t,"string");return typeof e=="symbol"?e:e+""}function fLe(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 hLe={},pLe={zIndexMap:Object.values(Vi).reduce((t,e)=>Z8(Z8({},t),{},{[e]:{elementId:void 0,panoramaElementId:void 0,consumers:0}}),hLe)},mLe=new Set(Object.values(Vi));function gLe(t){return mLe.has(t)}var vK=Ua({name:"zIndex",initialState:pLe,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:ii()},unregisterZIndexPortal:{reducer:(t,e)=>{var{zIndex:n}=e.payload;t.zIndexMap[n]&&(t.zIndexMap[n].consumers-=1,t.zIndexMap[n].consumers<=0&&!gLe(n)&&delete t.zIndexMap[n])},prepare:ii()},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:ii()},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:ii()}}}),{registerZIndexPortal:vLe,unregisterZIndexPortal:xLe,registerZIndexPortalId:yLe,unregisterZIndexPortalId:bLe}=vK.actions,_Le=vK.reducer;function Fa(t){var{zIndex:e,children:n}=t,i=a2e(),r=i&&e!==void 0&&e!==0,a=ra(),s=qn();C.useLayoutEffect(()=>r?(s(vLe({zIndex:e})),()=>{s(xLe({zIndex:e}))}):fv,[s,e,r]);var o=Et(c=>lLe(c,e,a));if(!r)return n;if(!o)return null;var l=document.getElementById(o);return l?Il.createPortal(n,l):null}function tN(){return tN=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},tN.apply(null,arguments)}function J8(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?J8(Object(n),!0).forEach(function(i){SLe(t,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):J8(Object(n)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(n,i))})}return t}function SLe(t,e,n){return(e=wLe(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function wLe(t){var e=MLe(t,"string");return typeof e=="symbol"?e:e+""}function MLe(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 ELe(t){var{cursor:e,cursorComp:n,cursorProps:i}=t;return C.isValidElement(e)?C.cloneElement(e,i):C.createElement(n,i)}function ALe(t){var e,{coordinate:n,payload:i,index:r,offset:a,tooltipAxisBandSize:s,layout:o,cursor:l,tooltipEventType:c,chartName:d}=t,f=n,p=i,m=r;if(!l||!f||d!=="ScatterChart"&&c!=="axis")return null;var y,b,x;if(d==="ScatterChart")y=f,b=rRe,x=Vi.cursorLine;else if(d==="BarChart")y=aRe(o,f,a,s),b=fX,x=Vi.cursorRectangle;else if(o==="radial"&&q7(f)){var{cx:v,cy:M,radius:w,startAngle:E,endAngle:T}=pX(f);y={cx:v,cy:M,startAngle:E,endAngle:T,innerRadius:w,outerRadius:w},b=gX,x=Vi.cursorLine}else y={points:qRe(o,f,a)},b=hp,x=Vi.cursorLine;var P=typeof l=="object"&&"className"in l?l.className:void 0,R=wb(wb(wb(wb({stroke:"#ccc",pointerEvents:"none"},a),y),gf(l)),{},{payload:p,payloadIndex:m,className:yn("recharts-tooltip-cursor",P)});return C.createElement(Fa,{zIndex:(e=t.zIndex)!==null&&e!==void 0?e:x},C.createElement(ELe,{cursor:l,cursorComp:b,cursorProps:R}))}function TLe(t){var e=qOe(),n=Yq(),i=tm(),r=hK();return e==null||n==null||i==null||r==null?null:C.createElement(ALe,tN({},t,{offset:n,layout:i,tooltipAxisBandSize:e,chartName:r}))}var xK=C.createContext(null),CLe=()=>C.useContext(xK),KC={exports:{}},Q8;function RLe(){return Q8||(Q8=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,p){if(typeof d!="function")throw new TypeError("The listener must be a function");var m=new r(d,f||l,p),y=n?n+c:c;return l._events[y]?l._events[y].fn?l._events[y]=[l._events[y],m]:l._events[y].push(m):(l._events[y]=m,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 p=0,m=f.length,y=new Array(m);p<m;p++)y[p]=f[p].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,p,m,y){var b=n?n+c:c;if(!this._events[b])return!1;var x=this._events[b],v=arguments.length,M,w;if(x.fn){switch(x.once&&this.removeListener(c,x.fn,void 0,!0),v){case 1:return x.fn.call(x.context),!0;case 2:return x.fn.call(x.context,d),!0;case 3:return x.fn.call(x.context,d,f),!0;case 4:return x.fn.call(x.context,d,f,p),!0;case 5:return x.fn.call(x.context,d,f,p,m),!0;case 6:return x.fn.call(x.context,d,f,p,m,y),!0}for(w=1,M=new Array(v-1);w<v;w++)M[w-1]=arguments[w];x.fn.apply(x.context,M)}else{var E=x.length,T;for(w=0;w<E;w++)switch(x[w].once&&this.removeListener(c,x[w].fn,void 0,!0),v){case 1:x[w].fn.call(x[w].context);break;case 2:x[w].fn.call(x[w].context,d);break;case 3:x[w].fn.call(x[w].context,d,f);break;case 4:x[w].fn.call(x[w].context,d,f,p);break;default:if(!M)for(T=1,M=new Array(v-1);T<v;T++)M[T-1]=arguments[T];x[w].fn.apply(x[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,p){var m=n?n+c:c;if(!this._events[m])return this;if(!d)return s(this,m),this;var y=this._events[m];if(y.fn)y.fn===d&&(!p||y.once)&&(!f||y.context===f)&&s(this,m);else{for(var b=0,x=[],v=y.length;b<v;b++)(y[b].fn!==d||p&&!y[b].once||f&&y[b].context!==f)&&x.push(y[b]);x.length?this._events[m]=x.length===1?x[0]:x:s(this,m)}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})(KC)),KC.exports}var NLe=RLe();const PLe=Vs(NLe);var X0=new PLe,nN="recharts.syncEvent.tooltip",e6="recharts.syncEvent.brush";function CO(t,e){if(e){var n=Number.parseInt(e,10);if(!Bs(n))return t?.[n]}}var DLe={chartName:"",tooltipPayloadSearcher:void 0,eventEmitter:void 0,defaultTooltipEventType:"axis"},yK=Ua({name:"options",initialState:DLe,reducers:{createEventEmitter:t=>{t.eventEmitter==null&&(t.eventEmitter=Symbol("rechartsEventEmitter"))}}}),OLe=yK.reducer,{createEventEmitter:LLe}=yK.actions;function kLe(t){return t.tooltip.syncInteraction}var ILe={chartData:void 0,computedData:void 0,dataStartIndex:0,dataEndIndex:0},bK=Ua({name:"chartData",initialState:ILe,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:t6,setDataStartEndIndexes:ULe,setComputedData:S8e}=bK.actions,FLe=bK.reducer,zLe=["x","y"];function n6(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 Gh(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?n6(Object(n),!0).forEach(function(i){BLe(t,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):n6(Object(n)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(n,i))})}return t}function BLe(t,e,n){return(e=jLe(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function jLe(t){var e=HLe(t,"string");return typeof e=="symbol"?e:e+""}function HLe(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 VLe(t,e){if(t==null)return{};var n,i,r=GLe(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 GLe(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 $Le(){var t=Et(WD),e=Et(qD),n=qn(),i=Et(mY),r=Et(mc),a=tm(),s=XS(),o=Et(l=>l.rootProps.className);C.useEffect(()=>{if(t==null)return fv;var l=(c,d,f)=>{if(e!==f&&t===c){if(i==="index"){var p;if(s&&d!==null&&d!==void 0&&(p=d.payload)!==null&&p!==void 0&&p.coordinate&&d.payload.sourceViewBox){var m=d.payload.coordinate,{x:y,y:b}=m,x=VLe(m,zLe),{x:v,y:M,width:w,height:E}=d.payload.sourceViewBox,T=Gh(Gh({},x),{},{x:s.x+(w?(y-v)/w:0)*s.width,y:s.y+(E?(b-M)/E:0)*s.height});n(Gh(Gh({},d),{},{payload:Gh(Gh({},d.payload),{},{coordinate:T})}))}else n(d);return}if(r!=null){var P;if(typeof i=="function"){var R={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,R);P=r[U]}else i==="value"&&(P=r.find(q=>String(q.value)===d.payload.label));var{coordinate:N}=d.payload;if(P==null||d.payload.active===!1||N==null||s==null){n(Q3({active:!1,coordinate:void 0,dataKey:void 0,index:null,label:void 0,sourceViewBox:void 0,graphicalItemId:void 0}));return}var{x:O,y:B}=N,I=Math.min(O,s.x+s.width),W=Math.min(B,s.y+s.height),L={x:a==="horizontal"?P.coordinate:I,y:a==="horizontal"?W:P.coordinate},$=Q3({active:d.payload.active,coordinate:L,dataKey:d.payload.dataKey,index:String(P.index),label:d.payload.label,sourceViewBox:d.payload.sourceViewBox,graphicalItemId:d.payload.graphicalItemId});n($)}}};return X0.on(nN,l),()=>{X0.off(nN,l)}},[o,n,e,t,i,r,a,s])}function WLe(){var t=Et(WD),e=Et(qD),n=qn();C.useEffect(()=>{if(t==null)return fv;var i=(r,a,s)=>{e!==s&&t===r&&n(ULe(a))};return X0.on(e6,i),()=>{X0.off(e6,i)}},[n,e,t])}function qLe(){var t=qn();C.useEffect(()=>{t(LLe())},[t]),$Le(),WLe()}function XLe(t,e,n,i,r,a){var s=Et(m=>tLe(m,t,e)),o=Et(qD),l=Et(WD),c=Et(mY),d=Et(kLe),f=d?.active,p=XS();C.useEffect(()=>{if(!f&&l!=null&&o!=null){var m=Q3({active:a,coordinate:n,dataKey:s,index:r,label:typeof i=="number"?String(i):i,sourceViewBox:p,graphicalItemId:void 0});X0.emit(nN,l,m,o)}},[f,n,s,r,i,o,l,c,a,p])}function i6(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 r6(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?i6(Object(n),!0).forEach(function(i){YLe(t,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):i6(Object(n)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(n,i))})}return t}function YLe(t,e,n){return(e=KLe(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function KLe(t){var e=ZLe(t,"string");return typeof e=="symbol"?e:e+""}function ZLe(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 JLe(t){return t.dataKey}function QLe(t,e){return C.isValidElement(t)?C.cloneElement(t,e):typeof t=="function"?C.createElement(t,e):C.createElement(U2e,e)}var a6=[],eke={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 ZC(t){var e,n,i=qi(t,eke),{active:r,allowEscapeViewBox:a,animationDuration:s,animationEasing:o,content:l,filterNull:c,isAnimationActive:d,offset:f,payloadUniqBy:p,position:m,reverseDirection:y,useTranslate3d:b,wrapperStyle:x,cursor:v,shared:M,trigger:w,defaultIndex:E,portal:T,axisId:P}=i,R=qn(),U=typeof E=="number"?String(E):E;C.useEffect(()=>{R(KDe({shared:M,trigger:w,axisId:P,active:r,defaultIndex:U}))},[R,M,w,P,r,U]);var N=XS(),O=oX(),B=GDe(M),{activeIndex:I,isActive:W}=(e=Et(be=>rLe(be,B,w,U)))!==null&&e!==void 0?e:{},L=Et(be=>iLe(be,B,w,U)),$=Et(be=>gK(be,B,w,U)),q=Et(be=>nLe(be,B,w,U)),G=L,Y=CLe(),Q=(n=r??W)!==null&&n!==void 0?n:!1,[se,H]=lq([G,Q]),X=B==="axis"?$:void 0;XLe(B,w,q,X,I,Q);var re=T??Y;if(re==null||N==null||B==null)return null;var ce=G??a6;Q||(ce=a6),c&&ce.length&&(ce=iq(ce.filter(be=>be.value!=null&&(be.hide!==!0||i.includeHidden)),p,JLe));var ye=ce.length>0,me=C.createElement(G2e,{allowEscapeViewBox:a,animationDuration:s,animationEasing:o,isAnimationActive:d,active:Q,coordinate:q,hasPayload:ye,offset:f,position:m,reverseDirection:y,useTranslate3d:b,viewBox:N,wrapperStyle:x,lastBoundingBox:se,innerRef:H,hasPortalFromProps:!!T},QLe(l,r6(r6({},i),{},{payload:ce,label:X,active:Q,activeIndex:I,coordinate:q,accessibilityLayer:O})));return C.createElement(C.Fragment,null,Il.createPortal(me,re),Q&&C.createElement(TLe,{cursor:v,tooltipEventType:B,coordinate:q,payload:ce,index:I}))}var kv=t=>null;kv.displayName="Cell";function tke(t,e,n){return(e=nke(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function nke(t){var e=ike(t,"string");return typeof e=="symbol"?e:e+""}function ike(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 rke{constructor(e){tke(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 s6(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 ake(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?s6(Object(n),!0).forEach(function(i){ske(t,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):s6(Object(n)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(n,i))})}return t}function ske(t,e,n){return(e=oke(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function oke(t){var e=lke(t,"string");return typeof e=="symbol"?e:e+""}function lke(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 cke={cacheSize:2e3,enableCache:!0},_K=ake({},cke),o6=new rke(_K.cacheSize),uke={position:"absolute",top:"-20000px",left:0,padding:0,margin:0,border:"none",whiteSpace:"pre"},l6="recharts_measurement_span";function dke(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 c6=(t,e)=>{try{var n=document.getElementById(l6);n||(n=document.createElement("span"),n.setAttribute("id",l6),n.setAttribute("aria-hidden","true"),document.body.appendChild(n)),Object.assign(n.style,uke,e),n.textContent="".concat(t);var i=n.getBoundingClientRect();return{width:i.width,height:i.height}}catch{return{width:0,height:0}}},i0=function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(e==null||nm.isSsr)return{width:0,height:0};if(!_K.enableCache)return c6(e,n);var i=dke(e,n),r=o6.get(i);if(r)return r;var a=c6(e,n);return o6.set(i,a),a},u6=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([*/])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,d6=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([+-])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,fke=/^px|cm|vh|vw|em|rem|%|mm|in|pt|pc|ex|ch|vmin|vmax|Q$/,hke=/(-?\d+(?:\.\d+)?)([a-zA-Z%]+)?/,SK={cm:96/2.54,mm:96/25.4,pt:96/72,pc:96/6,in:96,Q:96/(2.54*40),px:1},pke=Object.keys(SK),np="NaN";function mke(t,e){return t*SK[e]}class Ta{static parse(e){var n,[,i,r]=(n=hke.exec(e))!==null&&n!==void 0?n:[];return new Ta(parseFloat(i),r??"")}constructor(e,n){this.num=e,this.unit=n,this.num=e,this.unit=n,Bs(e)&&(this.unit=""),n!==""&&!fke.test(n)&&(this.num=NaN,this.unit=""),pke.includes(n)&&(this.num=mke(e,n),this.unit="px")}add(e){return this.unit!==e.unit?new Ta(NaN,""):new Ta(this.num+e.num,this.unit)}subtract(e){return this.unit!==e.unit?new Ta(NaN,""):new Ta(this.num-e.num,this.unit)}multiply(e){return this.unit!==""&&e.unit!==""&&this.unit!==e.unit?new Ta(NaN,""):new Ta(this.num*e.num,this.unit||e.unit)}divide(e){return this.unit!==""&&e.unit!==""&&this.unit!==e.unit?new Ta(NaN,""):new Ta(this.num/e.num,this.unit||e.unit)}toString(){return"".concat(this.num).concat(this.unit)}isNaN(){return Bs(this.num)}}function wK(t){if(t.includes(np))return np;for(var e=t;e.includes("*")||e.includes("/");){var n,[,i,r,a]=(n=u6.exec(e))!==null&&n!==void 0?n:[],s=Ta.parse(i??""),o=Ta.parse(a??""),l=r==="*"?s.multiply(o):s.divide(o);if(l.isNaN())return np;e=e.replace(u6,l.toString())}for(;e.includes("+")||/.-\d+(?:\.\d+)?/.test(e);){var c,[,d,f,p]=(c=d6.exec(e))!==null&&c!==void 0?c:[],m=Ta.parse(d??""),y=Ta.parse(p??""),b=f==="+"?m.add(y):m.subtract(y);if(b.isNaN())return np;e=e.replace(d6,b.toString())}return e}var f6=/\(([^()]*)\)/;function gke(t){for(var e=t,n;(n=f6.exec(e))!=null;){var[,i]=n;e=e.replace(f6,wK(i))}return e}function vke(t){var e=t.replace(/\s+/g,"");return e=gke(e),e=wK(e),e}function xke(t){try{return vke(t)}catch{return np}}function JC(t){var e=xke(t.slice(5,-1));return e===np?"":e}var yke=["x","y","lineHeight","capHeight","fill","scaleToFit","textAnchor","verticalAnchor"],bke=["dx","dy","angle","className","breakAll"];function iN(){return iN=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},iN.apply(null,arguments)}function h6(t,e){if(t==null)return{};var n,i,r=_ke(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 _ke(t,e){if(t==null)return{};var n={};for(var i in t)if({}.hasOwnProperty.call(t,i)){if(e.indexOf(i)!==-1)continue;n[i]=t[i]}return n}var MK=/[ \f\n\r\t\v\u2028\u2029]+/,EK=t=>{var{children:e,breakAll:n,style:i}=t;try{var r=[];ui(e)||(n?r=e.toString().split(""):r=e.toString().split(MK));var a=r.map(o=>({word:o,width:i0(o,i).width})),s=n?0:i0(" ",i).width;return{wordsWithComputedWidth:a,spaceWidth:s}}catch{return null}};function Ske(t){return t==="start"||t==="middle"||t==="end"||t==="inherit"}var AK=(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},[]),TK=t=>t.reduce((e,n)=>e.width>n.width?e:n),wke="…",p6=(t,e,n,i,r,a,s,o)=>{var l=t.slice(0,e),c=EK({breakAll:n,style:i,children:l+wke});if(!c)return[!1,[]];var d=AK(c.wordsWithComputedWidth,a,s,o),f=d.length>r||TK(d).width>Number(a);return[f,d]},Mke=(t,e,n,i,r)=>{var{maxLines:a,children:s,style:o,breakAll:l}=t,c=Mt(a),d=String(s),f=AK(e,i,n,r);if(!c||r)return f;var p=f.length>a||TK(f).width>Number(i);if(!p)return f;for(var m=0,y=d.length-1,b=0,x;m<=y&&b<=d.length-1;){var v=Math.floor((m+y)/2),M=v-1,[w,E]=p6(d,M,l,o,a,i,n,r),[T]=p6(d,v,l,o,a,i,n,r);if(!w&&!T&&(m=v+1),w&&T&&(y=v-1),!w&&T){x=E;break}b++}return x||f},m6=t=>{var e=ui(t)?[]:t.toString().split(MK);return[{words:e,width:void 0}]},Eke=t=>{var{width:e,scaleToFit:n,children:i,style:r,breakAll:a,maxLines:s}=t;if((e||n)&&!nm.isSsr){var o,l,c=EK({breakAll:a,children:i,style:r});if(c){var{wordsWithComputedWidth:d,spaceWidth:f}=c;o=d,l=f}else return m6(i);return Mke({breakAll:a,children:i,maxLines:s,style:r},o,l,e,!!n)}return m6(i)},CK="#808080",Ake={angle:0,breakAll:!1,capHeight:"0.71em",fill:CK,lineHeight:"1em",scaleToFit:!1,textAnchor:"start",verticalAnchor:"end",x:0,y:0},vw=C.forwardRef((t,e)=>{var n=qi(t,Ake),{x:i,y:r,lineHeight:a,capHeight:s,fill:o,scaleToFit:l,textAnchor:c,verticalAnchor:d}=n,f=h6(n,yke),p=C.useMemo(()=>Eke({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:m,dy:y,angle:b,className:x,breakAll:v}=f,M=h6(f,bke);if(!Vo(i)||!Vo(r)||p.length===0)return null;var w=Number(i)+(Mt(m)?m:0),E=Number(r)+(Mt(y)?y:0);if(!ti(w)||!ti(E))return null;var T;switch(d){case"start":T=JC("calc(".concat(s,")"));break;case"middle":T=JC("calc(".concat((p.length-1)/2," * -").concat(a," + (").concat(s," / 2))"));break;default:T=JC("calc(".concat(p.length-1," * -").concat(a,")"));break}var P=[];if(l){var R=p[0].width,{width:U}=f;P.push("scale(".concat(Mt(U)&&Mt(R)?U/R:1,")"))}return b&&P.push("rotate(".concat(b,", ").concat(w,", ").concat(E,")")),P.length&&(M.transform=P.join(" ")),C.createElement("text",iN({},va(M),{ref:e,x:w,y:E,className:yn("recharts-text",x),textAnchor:c,fill:o.includes("url")?CK:o}),p.map((N,O)=>{var B=N.words.join(v?"":" ");return C.createElement("tspan",{x:w,dy:O===0?T:a,key:"".concat(B,"-").concat(O)},B)}))});vw.displayName="Text";var Tke=["labelRef"];function Cke(t,e){if(t==null)return{};var n,i,r=Rke(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 Rke(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 g6(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),n.push.apply(n,i)}return n}function Ti(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?g6(Object(n),!0).forEach(function(i){Nke(t,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):g6(Object(n)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(n,i))})}return t}function Nke(t,e,n){return(e=Pke(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Pke(t){var e=Dke(t,"string");return typeof e=="symbol"?e:e+""}function Dke(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 kl(){return kl=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},kl.apply(null,arguments)}var RK=C.createContext(null),Oke=t=>{var{x:e,y:n,upperWidth:i,lowerWidth:r,width:a,height:s,children:o}=t,l=C.useMemo(()=>({x:e,y:n,upperWidth:i,lowerWidth:r,width:a,height:s}),[e,n,i,r,a,s]);return C.createElement(RK.Provider,{value:l},o)},NK=()=>{var t=C.useContext(RK),e=XS();return t||Xq(e)},Lke=C.createContext(null),kke=()=>{var t=C.useContext(Lke),e=Et(bY);return t||e},Ike=t=>{var{value:e,formatter:n}=t,i=ui(t.children)?e:t.children;return typeof n=="function"?n(i):i},RO=t=>t!=null&&typeof t=="function",Uke=(t,e)=>{var n=Sr(e-t),i=Math.min(Math.abs(e-t),360);return n*i},Fke=(t,e,n,i,r)=>{var{offset:a,className:s}=t,{cx:o,cy:l,innerRadius:c,outerRadius:d,startAngle:f,endAngle:p,clockWise:m}=r,y=(c+d)/2,b=Uke(f,p),x=b>=0?1:-1,v,M;switch(e){case"insideStart":v=f+x*a,M=m;break;case"insideEnd":v=p-x*a,M=!m;break;case"end":v=p+x*a,M=m;break;default:throw new Error("Unsupported position ".concat(e))}M=b<=0?M:!M;var w=Hi(o,l,y,v),E=Hi(o,l,y,v+(M?1:-1)*359),T="M".concat(w.x,",").concat(w.y,`
  8216. A`).concat(y,",").concat(y,",0,1,").concat(M?0:1,`,
  8217. `).concat(E.x,",").concat(E.y),P=ui(t.id)?L0("recharts-radial-line-"):t.id;return C.createElement("text",kl({},i,{dominantBaseline:"central",className:yn("recharts-radial-bar-label",s)}),C.createElement("defs",null,C.createElement("path",{id:P,d:T})),C.createElement("textPath",{xlinkHref:"#".concat(P)},n))},zke=(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}=Hi(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 p=(a+s)/2,{x:m,y}=Hi(i,r,p,c);return{x:m,y,textAnchor:"middle",verticalAnchor:"middle"}},rN=t=>"cx"in t&&Mt(t.cx),Bke=(t,e)=>{var{parentViewBox:n,offset:i,position:r}=t,a;n!=null&&!rN(n)&&(a=n);var{x:s,y:o,upperWidth:l,lowerWidth:c,height:d}=e,f=s,p=s+(l-c)/2,m=(f+p)/2,y=(l+c)/2,b=f+l/2,x=d>=0?1:-1,v=x*i,M=x>0?"end":"start",w=x>0?"start":"end",E=l>=0?1:-1,T=E*i,P=E>0?"end":"start",R=E>0?"start":"end";if(r==="top"){var U={x:f+l/2,y:o-v,textAnchor:"middle",verticalAnchor:M};return Ti(Ti({},U),a?{height:Math.max(o-a.y,0),width:l}:{})}if(r==="bottom"){var N={x:p+c/2,y:o+d+v,textAnchor:"middle",verticalAnchor:w};return Ti(Ti({},N),a?{height:Math.max(a.y+a.height-(o+d),0),width:c}:{})}if(r==="left"){var O={x:m-T,y:o+d/2,textAnchor:P,verticalAnchor:"middle"};return Ti(Ti({},O),a?{width:Math.max(O.x-a.x,0),height:d}:{})}if(r==="right"){var B={x:m+y+T,y:o+d/2,textAnchor:R,verticalAnchor:"middle"};return Ti(Ti({},B),a?{width:Math.max(a.x+a.width-B.x,0),height:d}:{})}var I=a?{width:y,height:d}:{};return r==="insideLeft"?Ti({x:m+T,y:o+d/2,textAnchor:R,verticalAnchor:"middle"},I):r==="insideRight"?Ti({x:m+y-T,y:o+d/2,textAnchor:P,verticalAnchor:"middle"},I):r==="insideTop"?Ti({x:f+l/2,y:o+v,textAnchor:"middle",verticalAnchor:w},I):r==="insideBottom"?Ti({x:p+c/2,y:o+d-v,textAnchor:"middle",verticalAnchor:M},I):r==="insideTopLeft"?Ti({x:f+T,y:o+v,textAnchor:R,verticalAnchor:w},I):r==="insideTopRight"?Ti({x:f+l-T,y:o+v,textAnchor:P,verticalAnchor:w},I):r==="insideBottomLeft"?Ti({x:p+T,y:o+d-v,textAnchor:R,verticalAnchor:M},I):r==="insideBottomRight"?Ti({x:p+c-T,y:o+d-v,textAnchor:P,verticalAnchor:M},I):r&&typeof r=="object"&&(Mt(r.x)||tc(r.x))&&(Mt(r.y)||tc(r.y))?Ti({x:s+ta(r.x,y),y:o+ta(r.y,d),textAnchor:"end",verticalAnchor:"end"},I):Ti({x:b,y:o+d/2,textAnchor:"middle",verticalAnchor:"middle"},I)},jke={angle:0,offset:5,zIndex:Vi.label,position:"middle",textBreakAll:!1};function ou(t){var e=qi(t,jke),{viewBox:n,position:i,value:r,children:a,content:s,className:o="",textBreakAll:l,labelRef:c}=e,d=kke(),f=NK(),p=i==="center"?f:d??f,m,y,b;if(n==null?m=p:rN(n)?m=n:m=Xq(n),!m||ui(r)&&ui(a)&&!C.isValidElement(s)&&typeof s!="function")return null;var x=Ti(Ti({},e),{},{viewBox:m});if(C.isValidElement(s)){var{labelRef:v}=x,M=Cke(x,Tke);return C.cloneElement(s,M)}if(typeof s=="function"){if(y=C.createElement(s,x),C.isValidElement(y))return y}else y=Ike(e);var w=va(e);if(rN(m)){if(i==="insideStart"||i==="insideEnd"||i==="end")return Fke(e,i,y,w,m);b=zke(m,e.offset,e.position)}else b=Bke(e,m);return C.createElement(Fa,{zIndex:e.zIndex},C.createElement(vw,kl({ref:c,className:yn("recharts-label",o)},w,b,{textAnchor:Ske(w.textAnchor)?w.textAnchor:b.textAnchor,breakAll:l}),y))}ou.displayName="Label";var Hke=(t,e,n)=>{if(!t)return null;var i={viewBox:e,labelRef:n};return t===!0?C.createElement(ou,kl({key:"label-implicit"},i)):Vo(t)?C.createElement(ou,kl({key:"label-implicit",value:t},i)):C.isValidElement(t)?t.type===ou?C.cloneElement(t,Ti({key:"label-implicit"},i)):C.createElement(ou,kl({key:"label-implicit",content:t},i)):RO(t)?C.createElement(ou,kl({key:"label-implicit",content:t},i)):t&&typeof t=="object"?C.createElement(ou,kl({},t,{key:"label-implicit"},i)):null};function Vke(t){var{label:e,labelRef:n}=t,i=NK();return Hke(e,i,n)||null}var QC={},e2={},v6;function Gke(){return v6||(v6=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});function e(n){return n[n.length-1]}t.last=e})(e2)),e2}var t2={},x6;function $ke(){return x6||(x6=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});function e(n){return Array.isArray(n)?n:Array.from(n)}t.toArray=e})(t2)),t2}var y6;function Wke(){return y6||(y6=1,(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=Gke(),n=$ke(),i=iD();function r(a){if(i.isArrayLike(a))return e.last(n.toArray(a))}t.last=r})(QC)),QC}var n2,b6;function qke(){return b6||(b6=1,n2=Wke().last),n2}var Xke=qke();const Yke=Vs(Xke);var Kke=["valueAccessor"],Zke=["dataKey","clockWise","id","textBreakAll","zIndex"];function B1(){return B1=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},B1.apply(null,arguments)}function _6(t,e){if(t==null)return{};var n,i,r=Jke(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 Jke(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 Qke=t=>Array.isArray(t.value)?Yke(t.value):t.value,PK=C.createContext(void 0),DK=PK.Provider,OK=C.createContext(void 0),eIe=OK.Provider;function tIe(){return C.useContext(PK)}function nIe(){return C.useContext(OK)}function Xb(t){var{valueAccessor:e=Qke}=t,n=_6(t,Kke),{dataKey:i,clockWise:r,id:a,textBreakAll:s,zIndex:o}=n,l=_6(n,Zke),c=tIe(),d=nIe(),f=c||d;return!f||!f.length?null:C.createElement(Fa,{zIndex:o??Vi.label},C.createElement(Pi,{className:"recharts-label-list"},f.map((p,m)=>{var y,b=ui(i)?e(p,m):Hn(p&&p.payload,i),x=ui(a)?{}:{id:"".concat(a,"-").concat(m)};return C.createElement(ou,B1({key:"label-".concat(m)},va(p),l,x,{fill:(y=n.fill)!==null&&y!==void 0?y:p.fill,parentViewBox:p.parentViewBox,value:b,textBreakAll:s,viewBox:p.viewBox,index:m,zIndex:0}))})))}Xb.displayName="LabelList";function NO(t){var{label:e}=t;return e?e===!0?C.createElement(Xb,{key:"labelList-implicit"}):C.isValidElement(e)||RO(e)?C.createElement(Xb,{key:"labelList-implicit",content:e}):typeof e=="object"?C.createElement(Xb,B1({key:"labelList-implicit"},e,{type:String(e.type)})):null:null}function aN(){return aN=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},aN.apply(null,arguments)}var LK=t=>{var{cx:e,cy:n,r:i,className:r}=t,a=yn("recharts-dot",r);return Mt(e)&&Mt(n)&&Mt(i)?C.createElement("circle",aN({},ka(t),nD(t),{className:a,cx:e,cy:n,r:i})):null},kK=t=>t.graphicalItems.polarItems,iIe=He([ai,Av],JD),xw=He([kK,fi,iIe],QD),rIe=He([xw],eO),yw=He([rIe,HD],tO),aIe=He([yw,fi,xw],iO);He([yw,fi,xw],(t,e,n)=>n.length>0?t.flatMap(i=>n.flatMap(r=>{var a,s=Hn(i,(a=e.dataKey)!==null&&a!==void 0?a:r.dataKey);return{value:s,errorDomain:[]}})).filter(Boolean):e?.dataKey!=null?t.map(i=>({value:Hn(i,e.dataKey),errorDomain:[]})):t.map(i=>({value:i,errorDomain:[]})));var S6=()=>{},sIe=He([yw,fi,xw,pw,ai],oO),oIe=He([fi,aO,sO,S6,sIe,S6,mn,ai],lO),IK=He([fi,mn,yw,aIe,Ev,ai,oIe],cO),lIe=He([IK,fi,lm],fO);He([fi,IK,lIe,ai],pO);var cIe={radiusAxis:{},angleAxis:{}},UK=Ua({name:"polarAxis",initialState:cIe,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:w8e,removeRadiusAxis:M8e,addAngleAxis:E8e,removeAngleAxis:A8e}=UK.actions,uIe=UK.reducer;function w6(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 M6(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?w6(Object(n),!0).forEach(function(i){dIe(t,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):w6(Object(n)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(n,i))})}return t}function dIe(t,e,n){return(e=fIe(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function fIe(t){var e=hIe(t,"string");return typeof e=="symbol"?e:e+""}function hIe(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 pIe=(t,e)=>e,PO=He([kK,pIe],(t,e)=>t.filter(n=>n.type==="pie").find(n=>n.id===e)),mIe=[],DO=(t,e,n)=>n?.length===0?mIe:n,FK=He([HD,PO,DO],(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=>M6(M6({},e.presentationProps),a.props))),r!=null)return r}}),gIe=He([FK,PO,DO],(t,e,n)=>{if(!(t==null||e==null))return t.map((i,r)=>{var a,s=Hn(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:em(s,e.dataKey),color:o,payload:i,type:e.legendType}})}),vIe=He([FK,PO,DO,sr],(t,e,n,i)=>{if(!(e==null||t==null))return xUe({offset:i,pieSettings:e,displayedData:t,cells:n})}),i2={exports:{}},Dn={};var E6;function xIe(){if(E6)return Dn;E6=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"),p=Symbol.for("react.view_transition"),m=Symbol.for("react.client.reference");function y(b){if(typeof b=="object"&&b!==null){var x=b.$$typeof;switch(x){case t:switch(b=b.type,b){case n:case r:case i:case l:case c:case p:return b;default:switch(b=b&&b.$$typeof,b){case s:case o:case f:case d:return b;case a:return b;default:return x}}case e:return x}}}return Dn.ContextConsumer=a,Dn.ContextProvider=s,Dn.Element=t,Dn.ForwardRef=o,Dn.Fragment=n,Dn.Lazy=f,Dn.Memo=d,Dn.Portal=e,Dn.Profiler=r,Dn.StrictMode=i,Dn.Suspense=l,Dn.SuspenseList=c,Dn.isContextConsumer=function(b){return y(b)===a},Dn.isContextProvider=function(b){return y(b)===s},Dn.isElement=function(b){return typeof b=="object"&&b!==null&&b.$$typeof===t},Dn.isForwardRef=function(b){return y(b)===o},Dn.isFragment=function(b){return y(b)===n},Dn.isLazy=function(b){return y(b)===f},Dn.isMemo=function(b){return y(b)===d},Dn.isPortal=function(b){return y(b)===e},Dn.isProfiler=function(b){return y(b)===r},Dn.isStrictMode=function(b){return y(b)===i},Dn.isSuspense=function(b){return y(b)===l},Dn.isSuspenseList=function(b){return y(b)===c},Dn.isValidElementType=function(b){return typeof b=="string"||typeof b=="function"||b===n||b===r||b===i||b===l||b===c||typeof b=="object"&&b!==null&&(b.$$typeof===f||b.$$typeof===d||b.$$typeof===s||b.$$typeof===a||b.$$typeof===o||b.$$typeof===m||b.getModuleId!==void 0)},Dn.typeOf=y,Dn}var A6;function yIe(){return A6||(A6=1,i2.exports=xIe()),i2.exports}var bIe=yIe(),T6=t=>typeof t=="string"?t:t?t.displayName||t.name||"Component":"",C6=null,r2=null,zK=t=>{if(t===C6&&Array.isArray(r2))return r2;var e=[];return C.Children.forEach(t,n=>{ui(n)||(bIe.isFragment(n)?e=e.concat(zK(n.props.children)):e.push(n))}),r2=e,C6=t,e};function OO(t,e){var n=[],i=[];return Array.isArray(e)?i=e.map(r=>T6(r)):i=[T6(e)],zK(t).forEach(r=>{var a=vf(r,"type.displayName")||vf(r,"type.name");a&&i.indexOf(a)!==-1&&n.push(r)}),n}var BK=t=>t&&typeof t=="object"&&"clipDot"in t?!!t.clipDot:!0,a2={},R6;function _Ie(){return R6||(R6=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})(a2)),a2}var s2,N6;function SIe(){return N6||(N6=1,s2=_Ie().isPlainObject),s2}var wIe=SIe();const MIe=Vs(wIe);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 D6(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){EIe(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 EIe(t,e,n){return(e=AIe(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function AIe(t){var e=TIe(t,"string");return typeof e=="symbol"?e:e+""}function TIe(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 j1(){return j1=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},j1.apply(null,arguments)}var O6=(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},CIe={x:0,y:0,upperWidth:0,lowerWidth:0,height:0,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},RIe=t=>{var e=qi(t,CIe),{x:n,y:i,upperWidth:r,lowerWidth:a,height:s,className:o}=e,{animationEasing:l,animationDuration:c,animationBegin:d,isUpdateAnimationActive:f}=e,p=C.useRef(null),[m,y]=C.useState(-1),b=C.useRef(r),x=C.useRef(a),v=C.useRef(s),M=C.useRef(n),w=C.useRef(i),E=bv(t,"trapezoid-");if(C.useEffect(()=>{if(p.current&&p.current.getTotalLength)try{var L=p.current.getTotalLength();L&&y(L)}catch{}},[]),n!==+n||i!==+i||r!==+r||a!==+a||s!==+s||r===0&&a===0||s===0)return null;var T=yn("recharts-trapezoid",o);if(!f)return C.createElement("g",null,C.createElement("path",j1({},va(e),{className:T,d:O6(n,i,r,a,s)})));var P=b.current,R=x.current,U=v.current,N=M.current,O=w.current,B="0px ".concat(m===-1?1:m,"px"),I="".concat(m,"px 0px"),W=lX(["strokeDasharray"],c,l);return C.createElement(yv,{animationId:E,key:E,canBegin:m>0,duration:c,easing:l,isActive:f,begin:d},L=>{var $=Qn(P,r,L),q=Qn(R,a,L),G=Qn(U,s,L),Y=Qn(N,n,L),Q=Qn(O,i,L);p.current&&(b.current=$,x.current=q,v.current=G,M.current=Y,w.current=Q);var se=L>0?{transition:W,strokeDasharray:I}:{strokeDasharray:B};return C.createElement("path",j1({},va(e),{className:T,d:O6(Y,Q,$,q,G),ref:p,style:D6(D6({},se),e.style)}))})},NIe=["option","shapeType","propTransformer","activeClassName"];function PIe(t,e){if(t==null)return{};var n,i,r=DIe(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 DIe(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 L6(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 H1(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?L6(Object(n),!0).forEach(function(i){OIe(t,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):L6(Object(n)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(n,i))})}return t}function OIe(t,e,n){return(e=LIe(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function LIe(t){var e=kIe(t,"string");return typeof e=="symbol"?e:e+""}function kIe(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){return H1(H1({},e),t)}function UIe(t,e){return t==="symbols"}function k6(t){var{shapeType:e,elementProps:n}=t;switch(e){case"rectangle":return C.createElement(fX,n);case"trapezoid":return C.createElement(RIe,n);case"sector":return C.createElement(gX,n);case"symbols":if(UIe(e))return C.createElement(tD,n);break;case"curve":return C.createElement(hp,n);default:return null}}function FIe(t){return C.isValidElement(t)?t.props:t}function jK(t){var{option:e,shapeType:n,propTransformer:i=IIe,activeClassName:r="recharts-active-shape"}=t,a=PIe(t,NIe),s;if(C.isValidElement(e))s=C.cloneElement(e,H1(H1({},a),FIe(e)));else if(typeof e=="function")s=e(a,a.index);else if(MIe(e)&&typeof e!="boolean"){var o=i(e,a);s=C.createElement(k6,{shapeType:n,elementProps:o})}else{var l=a;s=C.createElement(k6,{shapeType:n,elementProps:l})}return a.isActive?C.createElement(Pi,{className:r},s):s}var LO=(t,e,n)=>{var i=qn();return(r,a)=>s=>{t?.(r,a,s),i(ZY({activeIndex:String(a),activeDataKey:e,activeCoordinate:r.tooltipPosition,activeGraphicalItemId:n}))}},kO=t=>{var e=qn();return(n,i)=>r=>{t?.(n,i,r),e(ZDe())}},IO=(t,e,n)=>{var i=qn();return(r,a)=>s=>{t?.(r,a,s),i(JDe({activeIndex:String(a),activeDataKey:e,activeCoordinate:r.tooltipPosition,activeGraphicalItemId:n}))}};function UO(t){var{tooltipEntrySettings:e}=t,n=qn(),i=ra(),r=C.useRef(null);return C.useLayoutEffect(()=>{i||(r.current===null?n(qDe(e)):r.current!==e&&n(XDe({prev:r.current,next:e})),r.current=e)},[e,n,i]),C.useLayoutEffect(()=>()=>{r.current&&(n(YDe(r.current)),r.current=null)},[n]),null}function HK(t){var{legendPayload:e}=t,n=qn(),i=ra(),r=C.useRef(null);return C.useLayoutEffect(()=>{i||(r.current===null?n(iX(e)):r.current!==e&&n(rX({prev:r.current,next:e})),r.current=e)},[n,i,e]),C.useLayoutEffect(()=>()=>{r.current&&(n(aX(r.current)),r.current=null)},[n]),null}function zIe(t){var{legendPayload:e}=t,n=qn(),i=Et(mn),r=C.useRef(null);return C.useLayoutEffect(()=>{i!=="centric"&&i!=="radial"||(r.current===null?n(iX(e)):r.current!==e&&n(rX({prev:r.current,next:e})),r.current=e)},[n,i,e]),C.useLayoutEffect(()=>()=>{r.current&&(n(aX(r.current)),r.current=null)},[n]),null}var o2,BIe=()=>{var[t]=C.useState(()=>L0("uid-"));return t},jIe=(o2=aee.useId)!==null&&o2!==void 0?o2:BIe;function VK(t,e){var n=jIe();return e||(t?"".concat(t,"-").concat(n):n)}var HIe=C.createContext(void 0),FO=t=>{var{id:e,type:n,children:i}=t,r=VK("recharts-".concat(n),e);return C.createElement(HIe.Provider,{value:r},i(r))},VIe={cartesianItems:[],polarItems:[]},GK=Ua({name:"graphicalItems",initialState:VIe,reducers:{addCartesianGraphicalItem:{reducer(t,e){t.cartesianItems.push(e.payload)},prepare:ii()},replaceCartesianGraphicalItem:{reducer(t,e){var{prev:n,next:i}=e.payload,r=ho(t).cartesianItems.indexOf(n);r>-1&&(t.cartesianItems[r]=i)},prepare:ii()},removeCartesianGraphicalItem:{reducer(t,e){var n=ho(t).cartesianItems.indexOf(e.payload);n>-1&&t.cartesianItems.splice(n,1)},prepare:ii()},addPolarGraphicalItem:{reducer(t,e){t.polarItems.push(e.payload)},prepare:ii()},removePolarGraphicalItem:{reducer(t,e){var n=ho(t).polarItems.indexOf(e.payload);n>-1&&t.polarItems.splice(n,1)},prepare:ii()}}}),{addCartesianGraphicalItem:GIe,replaceCartesianGraphicalItem:$Ie,removeCartesianGraphicalItem:WIe,addPolarGraphicalItem:qIe,removePolarGraphicalItem:XIe}=GK.actions,YIe=GK.reducer,KIe=t=>{var e=qn(),n=C.useRef(null);return C.useLayoutEffect(()=>{n.current===null?e(GIe(t)):n.current!==t&&e($Ie({prev:n.current,next:t})),n.current=t},[e,t]),C.useLayoutEffect(()=>()=>{n.current&&(e(WIe(n.current)),n.current=null)},[e]),null},$K=C.memo(KIe);function ZIe(t){var e=qn();return C.useLayoutEffect(()=>(e(qIe(t)),()=>{e(XIe(t))}),[e,t]),null}var JIe=["key"],QIe=["onMouseEnter","onClick","onMouseLeave"],eUe=["id"],tUe=["id"];function I6(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 vi(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?I6(Object(n),!0).forEach(function(i){nUe(t,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):I6(Object(n)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(n,i))})}return t}function nUe(t,e,n){return(e=iUe(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function iUe(t){var e=rUe(t,"string");return typeof e=="symbol"?e:e+""}function rUe(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 zu(){return zu=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},zu.apply(null,arguments)}function bw(t,e){if(t==null)return{};var n,i,r=aUe(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 aUe(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 sUe(t){var e=C.useMemo(()=>OO(t.children,kv),[t.children]),n=Et(i=>gIe(i,t.id,e));return n==null?null:C.createElement(zIe,{legendPayload:n})}var oUe=C.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:em(o,e),hide:l,type:c,color:s,unit:""}};return C.createElement(UO,{tooltipEntrySettings:d})}),lUe=(t,e)=>t>e?"start":t<e?"end":"middle",cUe=(t,e,n)=>ta(typeof e=="function"?e(t):e,n,n*.8),uUe=(t,e,n)=>{var{top:i,left:r,width:a,height:s}=e,o=hX(a,s),l=r+ta(t.cx,a,a/2),c=i+ta(t.cy,s,s/2),d=ta(t.innerRadius,o,0),f=cUe(n,t.outerRadius,o),p=t.maxRadius||Math.sqrt(a*a+s*s)/2;return{cx:l,cy:c,innerRadius:d,outerRadius:f,maxRadius:p}},dUe=(t,e)=>{var n=Sr(e-t),i=Math.min(Math.abs(e-t),360);return n*i};function fUe(t){return t&&typeof t=="object"&&"className"in t&&typeof t.className=="string"?t.className:""}var hUe=(t,e)=>{if(C.isValidElement(t))return C.cloneElement(t,e);if(typeof t=="function")return t(e);var n=yn("recharts-pie-label-line",typeof t!="boolean"?t.className:""),{key:i}=e,r=bw(e,JIe);return C.createElement(hp,zu({},r,{type:"linear",className:n}))},pUe=(t,e,n)=>{if(C.isValidElement(t))return C.cloneElement(t,e);var i=n;if(typeof t=="function"&&(i=t(e),C.isValidElement(i)))return i;var r=yn("recharts-pie-label-text",fUe(t));return C.createElement(vw,zu({},e,{alignmentBaseline:"middle",className:r}),i)};function mUe(t){var{sectors:e,props:n,showLabels:i}=t,{label:r,labelLine:a,dataKey:s}=n;if(!i||!r||!e)return null;var o=ka(n),l=gf(r),c=gf(a),d=typeof r=="object"&&"offsetRadius"in r&&typeof r.offsetRadius=="number"&&r.offsetRadius||20,f=e.map((p,m)=>{var y=(p.startAngle+p.endAngle)/2,b=Hi(p.cx,p.cy,p.outerRadius+d,y),x=vi(vi(vi(vi({},o),p),{},{stroke:"none"},l),{},{index:m,textAnchor:lUe(b.x,p.cx)},b),v=vi(vi(vi(vi({},o),p),{},{fill:"none",stroke:p.fill},c),{},{index:m,points:[Hi(p.cx,p.cy,p.outerRadius,y),b],key:"line"});return C.createElement(Fa,{zIndex:Vi.label,key:"label-".concat(p.startAngle,"-").concat(p.endAngle,"-").concat(p.midAngle,"-").concat(m)},C.createElement(Pi,null,a&&hUe(a,v),pUe(r,x,Hn(p,s))))});return C.createElement(Pi,{className:"recharts-pie-labels"},f)}function gUe(t){var{sectors:e,props:n,showLabels:i}=t,{label:r}=n;return typeof r=="object"&&r!=null&&"position"in r?C.createElement(NO,{label:r}):C.createElement(mUe,{sectors:e,props:n,showLabels:i})}function vUe(t){var{sectors:e,activeShape:n,inactiveShape:i,allOtherPieProps:r,shape:a,id:s}=t,o=Et(Fu),l=Et(wO),c=Et(UOe),{onMouseEnter:d,onClick:f,onMouseLeave:p}=r,m=bw(r,QIe),y=LO(d,r.dataKey,s),b=kO(p),x=IO(f,r.dataKey,s);return e==null||e.length===0?null:C.createElement(C.Fragment,null,e.map((v,M)=>{if(v?.startAngle===0&&v?.endAngle===0&&e.length!==1)return null;var w=c==null||c===s,E=String(M)===o&&(l==null||r.dataKey===l)&&w,T=o?i:null,P=n&&E?n:T,R=vi(vi({},v),{},{stroke:v.stroke,tabIndex:-1,[Vq]:M,[Gq]:r.dataKey});return C.createElement(Pi,zu({key:"sector-".concat(v?.startAngle,"-").concat(v?.endAngle,"-").concat(v.midAngle,"-").concat(M),tabIndex:-1,className:"recharts-pie-sector"},hv(m,v,M),{onMouseEnter:y(v,M),onMouseLeave:b(v,M),onClick:x(v,M)}),C.createElement(jK,zu({option:a??P,index:M,shapeType:"sector",isActive:E},R)))}))}function xUe(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,p=Math.abs(n.minAngle),m=dUe(o,l),y=Math.abs(m),b=i.length<=1?0:(e=n.paddingAngle)!==null&&e!==void 0?e:0,x=i.filter(P=>Hn(P,c,0)!==0).length,v=(y>=360?x:x-1)*b,M=y-x*p-v,w=i.reduce((P,R)=>{var U=Hn(R,c,0);return P+(Mt(U)?U:0)},0),E;if(w>0){var T;E=i.map((P,R)=>{var U=Hn(P,c,0),N=Hn(P,d,R),O=uUe(n,a,P),B=(Mt(U)?U:0)/w,I,W=vi(vi({},P),r&&r[R]&&r[R].props);R?I=T.endAngle+Sr(m)*b*(U!==0?1:0):I=o;var L=I+Sr(m)*((U!==0?p:0)+B*M),$=(I+L)/2,q=(O.innerRadius+O.outerRadius)/2,G=[{name:N,value:U,payload:W,dataKey:c,type:f}],Y=Hi(O.cx,O.cy,q,$);return T=vi(vi(vi(vi({},n.presentationProps),{},{percent:B,cornerRadius:typeof s=="string"?parseFloat(s):s,name:N,tooltipPayload:G,midAngle:$,middleRadius:q,tooltipPosition:Y},W),O),{},{value:U,dataKey:c,startAngle:I,endAngle:L,payload:W,paddingAngle:Sr(m)*b}),T})}return E}function yUe(t){var{showLabels:e,sectors:n,children:i}=t,r=C.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 C.createElement(eIe,{value:e?r:void 0},i)}function bUe(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:p}=e,m=bv(e,"recharts-pie-"),y=n.current,[b,x]=C.useState(!1),v=C.useCallback(()=>{typeof p=="function"&&p(),x(!1)},[p]),M=C.useCallback(()=>{typeof f=="function"&&f(),x(!0)},[f]);return C.createElement(yUe,{showLabels:!b,sectors:r},C.createElement(yv,{animationId:m,begin:s,duration:o,isActive:a,easing:l,onAnimationStart:M,onAnimationEnd:v,key:m},w=>{var E=[],T=r&&r[0],P=T?.startAngle;return r?.forEach((R,U)=>{var N=y&&y[U],O=U>0?vf(R,"paddingAngle",0):0;if(N){var B=Qn(N.endAngle-N.startAngle,R.endAngle-R.startAngle,w),I=vi(vi({},R),{},{startAngle:P+O,endAngle:P+B+O});E.push(I),P=I.endAngle}else{var{endAngle:W,startAngle:L}=R,$=Qn(0,W-L,w),q=vi(vi({},R),{},{startAngle:P+O,endAngle:P+$+O});E.push(q),P=q.endAngle}}),n.current=E,C.createElement(Pi,null,C.createElement(vUe,{sectors:E,activeShape:c,inactiveShape:d,allOtherPieProps:e,shape:e.shape,id:i}))}),C.createElement(gUe,{showLabels:!b,sectors:r,props:e}),e.children)}var _Ue={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:Vi.area};function SUe(t){var{id:e}=t,n=bw(t,eUe),{hide:i,className:r,rootTabIndex:a}=t,s=C.useMemo(()=>OO(t.children,kv),[t.children]),o=Et(d=>vIe(d,e,s)),l=C.useRef(null),c=yn("recharts-pie",r);return i||o==null?(l.current=null,C.createElement(Pi,{tabIndex:a,className:c})):C.createElement(Fa,{zIndex:t.zIndex},C.createElement(oUe,{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}),C.createElement(Pi,{tabIndex:a,className:c},C.createElement(bUe,{props:vi(vi({},n),{},{sectors:o}),previousSectorsRef:l,id:e})))}function WK(t){var e=qi(t,_Ue),{id:n}=e,i=bw(e,tUe),r=ka(i);return C.createElement(FO,{id:n,type:"pie"},a=>C.createElement(C.Fragment,null,C.createElement(ZIe,{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}),C.createElement(sUe,zu({},i,{id:a})),C.createElement(SUe,zu({},i,{id:a}))))}WK.displayName="Pie";var wUe=["points"];function U6(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 l2(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?U6(Object(n),!0).forEach(function(i){MUe(t,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):U6(Object(n)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(n,i))})}return t}function MUe(t,e,n){return(e=EUe(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function EUe(t){var e=AUe(t,"string");return typeof e=="symbol"?e:e+""}function AUe(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 V1(){return V1=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},V1.apply(null,arguments)}function TUe(t,e){if(t==null)return{};var n,i,r=CUe(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 CUe(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 RUe(t){var{option:e,dotProps:n,className:i}=t;if(C.isValidElement(e))return C.cloneElement(e,n);if(typeof e=="function")return e(n);var r=yn(i,typeof e!="boolean"?e.className:""),a=n??{},{points:s}=a,o=TUe(a,wUe);return C.createElement(LK,V1({},o,{className:r}))}function NUe(t,e){return t==null?!1:e?!0:t.length===1}function PUe(t){var{points:e,dot:n,className:i,dotClassName:r,dataKey:a,baseProps:s,needClip:o,clipPathId:l,zIndex:c=Vi.scatter}=t;if(!NUe(e,n))return null;var d=BK(n),f=oEe(n),p=e.map((y,b)=>{var x,v,M=l2(l2(l2({r:3},s),f),{},{index:b,cx:(x=y.x)!==null&&x!==void 0?x:void 0,cy:(v=y.y)!==null&&v!==void 0?v:void 0,dataKey:a,value:y.value,payload:y.payload,points:e});return C.createElement(RUe,{key:"dot-".concat(b),option:n,dotProps:M,className:r})}),m={};return o&&l!=null&&(m.clipPath="url(#clipPath-".concat(d?"":"dots-").concat(l,")")),C.createElement(Fa,{zIndex:c},C.createElement(Pi,V1({className:i},m),p))}function F6(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 z6(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?F6(Object(n),!0).forEach(function(i){DUe(t,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):F6(Object(n)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(n,i))})}return t}function DUe(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)}var kUe={xAxis:{},yAxis:{},zAxis:{}},qK=Ua({name:"cartesianAxis",initialState:kUe,reducers:{addXAxis:{reducer(t,e){t.xAxis[e.payload.id]=e.payload},prepare:ii()},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:ii()},removeXAxis:{reducer(t,e){delete t.xAxis[e.payload.id]},prepare:ii()},addYAxis:{reducer(t,e){t.yAxis[e.payload.id]=e.payload},prepare:ii()},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:ii()},removeYAxis:{reducer(t,e){delete t.yAxis[e.payload.id]},prepare:ii()},addZAxis:{reducer(t,e){t.zAxis[e.payload.id]=e.payload},prepare:ii()},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:ii()},removeZAxis:{reducer(t,e){delete t.zAxis[e.payload.id]},prepare:ii()},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]=z6(z6({},t.yAxis[n]),{},{width:i,widthHistory:s})}}}}),{addXAxis:IUe,replaceXAxis:UUe,removeXAxis:FUe,addYAxis:zUe,replaceYAxis:BUe,removeYAxis:jUe,addZAxis:T8e,replaceZAxis:C8e,removeZAxis:R8e,updateYAxisWidth:HUe}=qK.actions,VUe=qK.reducer,GUe=He([sr],t=>({top:t.top,bottom:t.bottom,left:t.left,right:t.right})),$Ue=He([GUe,uc,dc],(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)}}),zO=()=>Et($Ue),WUe=()=>Et(HOe);function B6(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 c2(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?B6(Object(n),!0).forEach(function(i){qUe(t,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):B6(Object(n)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(n,i))})}return t}function qUe(t,e,n){return(e=XUe(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function XUe(t){var e=YUe(t,"string");return typeof e=="symbol"?e:e+""}function YUe(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 KUe=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=c2(c2(c2({},o),gf(r)),nD(r)),c;return C.isValidElement(r)?c=C.cloneElement(r,l):typeof r=="function"?c=r(l):c=C.createElement(LK,l),C.createElement(Pi,{className:"recharts-active-dot",clipPath:s},c)};function j6(t){var{points:e,mainColor:n,activeDot:i,itemDataKey:r,clipPath:a,zIndex:s=Vi.activeDot}=t,o=Et(Fu),l=WUe();if(e==null||l==null)return null;var c=e.find(d=>l.includes(d.payload));return ui(c)?null:C.createElement(Fa,{zIndex:s},C.createElement(KUe,{point:c,childIndex:Number(o),mainColor:n,dataKey:r,activeDot:i,clipPath:a}))}var ZUe="Invariant failed";function JUe(t,e){throw new Error(ZUe)}var QUe=["x","y"];function sN(){return sN=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},sN.apply(null,arguments)}function H6(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 Rg(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?H6(Object(n),!0).forEach(function(i){e4e(t,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):H6(Object(n)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(n,i))})}return t}function e4e(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=n4e(t,"string");return typeof e=="symbol"?e:e+""}function n4e(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 i4e(t,e){if(t==null)return{};var n,i,r=r4e(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 r4e(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 a4e(t,e){var{x:n,y:i}=t,r=i4e(t,QUe),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),p=parseInt(f,10);return Rg(Rg(Rg(Rg(Rg({},e),r),s?{x:s}:{}),l?{y:l}:{}),{},{height:d,width:p,name:e.name,radius:e.radius})}function G1(t){return C.createElement(jK,sN({shapeType:"rectangle",propTransformer:a4e,activeClassName:"recharts-active-bar"},t))}var s4e=function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return(i,r)=>{if(Mt(e))return e;var a=Mt(i)||ui(i);return a?e(i,r):(a||JUe(),n)}},o4e={},XK=Ua({name:"errorBars",initialState:o4e,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:N8e,replaceErrorBar:P8e,removeErrorBar:D8e}=XK.actions,l4e=XK.reducer,c4e=["children"];function u4e(t,e){if(t==null)return{};var n,i,r=d4e(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 d4e(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 f4e={data:[],xAxisId:"xAxis-0",yAxisId:"yAxis-0",dataPointFormatter:()=>({x:0,y:0,value:0}),errorBarOffset:0},h4e=C.createContext(f4e);function p4e(t){var{children:e}=t,n=u4e(t,c4e);return C.createElement(h4e.Provider,{value:n},e)}function BO(t,e){var n,i,r=Et(c=>hc(c,t)),a=Et(c=>pc(c,e)),s=(n=r?.allowDataOverflow)!==null&&n!==void 0?n:vr.allowDataOverflow,o=(i=a?.allowDataOverflow)!==null&&i!==void 0?i:xr.allowDataOverflow,l=s||o;return{needClip:l,needClipX:s,needClipY:o}}function YK(t){var{xAxisId:e,yAxisId:n,clipPathId:i}=t,r=zO(),{needClipX:a,needClipY:s,needClip:o}=BO(e,n);if(!o||!r)return null;var{x:l,y:c,width:d,height:f}=r;return C.createElement("clipPath",{id:"clipPath-".concat(i)},C.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 m4e(t,e){return t&&typeof t=="object"&&"zIndex"in t&&typeof t.zIndex=="number"&&ti(t.zIndex)?t.zIndex:e}var u2={exports:{}},d2={};var V6;function g4e(){if(V6)return d2;V6=1;var t=Hp();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 d2.useSyncExternalStoreWithSelector=function(l,c,d,f,p){var m=r(null);if(m.current===null){var y={hasValue:!1,value:null};m.current=y}else y=m.current;m=s(function(){function x(T){if(!v){if(v=!0,M=T,T=f(T),p!==void 0&&y.hasValue){var P=y.value;if(p(P,T))return w=P}return w=T}if(P=w,n(M,T))return P;var R=f(T);return p!==void 0&&p(P,R)?(M=T,P):(M=T,w=R)}var v=!1,M,w,E=d===void 0?null:d;return[function(){return x(c())},E===null?void 0:function(){return x(E())}]},[c,d,f,p]);var b=i(l,m[0],m[1]);return a(function(){y.hasValue=!0,y.value=b},[b]),o(b),b},d2}var G6;function v4e(){return G6||(G6=1,u2.exports=g4e()),u2.exports}v4e();function x4e(t){t()}function y4e(){let t=null,e=null;return{clear(){t=null,e=null},notify(){x4e(()=>{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 $6={notify(){},get:()=>[]};function b4e(t,e){let n,i=$6,r=0,a=!1;function s(b){d();const x=i.subscribe(b);let v=!1;return()=>{v||(v=!0,x(),f())}}function o(){i.notify()}function l(){y.onStateChange&&y.onStateChange()}function c(){return a}function d(){r++,n||(n=t.subscribe(l),i=y4e())}function f(){r--,n&&r===0&&(n(),n=void 0,i.clear(),i=$6)}function p(){a||(a=!0,d())}function m(){a&&(a=!1,f())}const y={addNestedSub:s,notifyNestedSubs:o,handleChangeWrapper:l,isSubscribed:c,trySubscribe:p,tryUnsubscribe:m,getListeners:()=>i};return y}var _4e=()=>typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",S4e=_4e(),w4e=()=>typeof navigator<"u"&&navigator.product==="ReactNative",M4e=w4e(),E4e=()=>S4e||M4e?C.useLayoutEffect:C.useEffect,A4e=E4e();function W6(t,e){return t===e?t!==0||e!==0||1/t===1/e:t!==t&&e!==e}function T4e(t,e){if(W6(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])||!W6(t[n[r]],e[n[r]]))return!1;return!0}var C4e=Symbol.for("react-redux-context"),R4e=typeof globalThis<"u"?globalThis:{};function N4e(){if(!C.createContext)return{};const t=R4e[C4e]??=new Map;let e=t.get(C.createContext);return e||(e=C.createContext(null),t.set(C.createContext,e)),e}var P4e=N4e();function D4e(t){const{children:e,context:n,serverState:i,store:r}=t,a=C.useMemo(()=>{const l=b4e(r);return{store:r,subscription:l,getServerState:i?()=>i:void 0}},[r,i]),s=C.useMemo(()=>r.getState(),[r]);A4e(()=>{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||P4e;return C.createElement(o.Provider,{value:a},e)}var O4e=D4e,L4e=new Set(["axisLine","tickLine","activeBar","activeDot","activeLabel","activeShape","allowEscapeViewBox","background","cursor","dot","label","line","margin","padding","position","shape","style","tick","wrapperStyle"]);function k4e(t,e){return t==null&&e==null?!0:typeof t=="number"&&typeof e=="number"?t===e||t!==t&&e!==e:t===e}function _w(t,e){var n=new Set([...Object.keys(t),...Object.keys(e)]);for(var i of n)if(L4e.has(i)){if(t[i]==null&&e[i]==null)continue;if(!T4e(t[i],e[i]))return!1}else if(!k4e(t[i],e[i]))return!1;return!0}var I4e=["onMouseEnter","onMouseLeave","onClick"],U4e=["value","background","tooltipPosition"],F4e=["id"],z4e=["onMouseEnter","onClick","onMouseLeave"];function oc(){return oc=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},oc.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 ua(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){B4e(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 B4e(t,e,n){return(e=j4e(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function j4e(t){var e=H4e(t,"string");return typeof e=="symbol"?e:e+""}function H4e(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 $1(t,e){if(t==null)return{};var n,i,r=V4e(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 V4e(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 G4e=t=>{var{dataKey:e,name:n,fill:i,legendType:r,hide:a}=t;return[{inactive:a,dataKey:e,type:r,color:i,value:em(n,e),payload:t}]},$4e=C.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:em(a,e),hide:s,type:l,color:r,unit:o}};return C.createElement(UO,{tooltipEntrySettings:c})});function W4e(t){var e=Et(Fu),{data:n,dataKey:i,background:r,allOtherBarProps:a}=t,{onMouseEnter:s,onMouseLeave:o,onClick:l}=a,c=$1(a,I4e),d=LO(s,i),f=kO(o),p=IO(l,i);if(!r||n==null)return null;var m=gf(r);return C.createElement(Fa,{zIndex:m4e(r,Vi.barBackground)},n.map((y,b)=>{var{value:x,background:v,tooltipPosition:M}=y,w=$1(y,U4e);if(!v)return null;var E=d(y,b),T=f(y,b),P=p(y,b),R=ua(ua(ua(ua(ua({option:r,isActive:String(b)===e},w),{},{fill:"#eee"},v),m),hv(c,y,b)),{},{onMouseEnter:E,onMouseLeave:T,onClick:P,dataKey:i,index:b,className:"recharts-bar-background-rectangle"});return C.createElement(G1,oc({key:"background-bar-".concat(b)},R))}))}function q4e(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 ua(ua({},s),{},{value:a.value,payload:a.payload,parentViewBox:a.parentViewBox,viewBox:s,fill:a.fill})});return C.createElement(DK,{value:e?r:void 0},n)}function X4e(t){var{shape:e,activeBar:n,baseProps:i,entry:r,index:a,dataKey:s}=t,o=Et(Fu),l=Et(wO),c=n&&String(a)===o&&(l==null||s===l),d=c?n:e;return c?C.createElement(Fa,{zIndex:Vi.activeBar},C.createElement(G1,oc({},i,{name:String(i.name)},r,{isActive:c,option:d,index:a,dataKey:s}))):C.createElement(G1,oc({},i,{name:String(i.name)},r,{isActive:c,option:d,index:a,dataKey:s}))}function Y4e(t){var{shape:e,baseProps:n,entry:i,index:r,dataKey:a}=t;return C.createElement(G1,oc({},n,{name:String(n.name)},i,{isActive:!1,option:e,index:r,dataKey:a}))}function K4e(t){var e,{data:n,props:i}=t,r=(e=ka(i))!==null&&e!==void 0?e:{},{id:a}=r,s=$1(r,F4e),{shape:o,dataKey:l,activeBar:c}=i,{onMouseEnter:d,onClick:f,onMouseLeave:p}=i,m=$1(i,z4e),y=LO(d,l),b=kO(p),x=IO(f,l);return n?C.createElement(C.Fragment,null,n.map((v,M)=>C.createElement(Pi,oc({key:"rectangle-".concat(v?.x,"-").concat(v?.y,"-").concat(v?.value,"-").concat(M),className:"recharts-bar-rectangle"},hv(m,v,M),{onMouseEnter:y(v,M),onMouseLeave:b(v,M),onClick:x(v,M)}),c?C.createElement(X4e,{shape:o,activeBar:c,baseProps:s,entry:v,index:M,dataKey:l}):C.createElement(Y4e,{shape:o,baseProps:s,entry:v,index:M,dataKey:l})))):null}function Z4e(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,p=bv(e,"recharts-bar-"),[m,y]=C.useState(!1),b=!m,x=C.useCallback(()=>{typeof c=="function"&&c(),y(!1)},[c]),v=C.useCallback(()=>{typeof d=="function"&&d(),y(!0)},[d]);return C.createElement(q4e,{showLabels:b,rects:i},C.createElement(yv,{animationId:p,begin:s,duration:o,isActive:a,easing:l,onAnimationEnd:x,onAnimationStart:v,key:p},M=>{var w=M===1?i:i?.map((E,T)=>{var P=f&&f[T];if(P)return ua(ua({},E),{},{x:Qn(P.x,E.x,M),y:Qn(P.y,E.y,M),width:Qn(P.width,E.width,M),height:Qn(P.height,E.height,M)});if(r==="horizontal"){var R=Qn(0,E.height,M),U=Qn(E.stackedBarStart,E.y,M);return ua(ua({},E),{},{y:U,height:R})}var N=Qn(0,E.width,M),O=Qn(E.stackedBarStart,E.x,M);return ua(ua({},E),{},{width:N,x:O})});return M>0&&(n.current=w??null),w==null?null:C.createElement(Pi,null,C.createElement(K4e,{props:e,data:w}))}),C.createElement(NO,{label:e.label}),e.children)}function J4e(t){var e=C.useRef(null);return C.createElement(Z4e,{previousRectanglesRef:e,props:t})}var KK=0,Q4e=(t,e)=>{var n=Array.isArray(t.value)?t.value[1]:t.value;return{x:t.x,y:t.y,value:n,errorVal:Hn(t,e)}};class eFe extends C.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=yn("recharts-bar",r),f=c;return C.createElement(Pi,{className:d,id:c},o&&C.createElement("defs",null,C.createElement(YK,{clipPathId:f,xAxisId:a,yAxisId:s})),C.createElement(Pi,{className:"recharts-bar-rectangles",clipPath:o?"url(#clipPath-".concat(f,")"):void 0},C.createElement(W4e,{data:n,dataKey:i,background:l,allOtherBarProps:this.props}),C.createElement(J4e,this.props)))}}var tFe={activeBar:!1,animationBegin:0,animationDuration:400,animationEasing:"ease",background:!1,hide:!1,isAnimationActive:"auto",label:!1,legendType:"rect",minPointSize:KK,xAxisId:0,yAxisId:0,zIndex:Vi.bar};function nFe(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}=BO(e,n),p=tm(),m=ra(),y=OO(t.children,kv),b=Et(M=>NFe(M,e,n,m,t.id,y));if(p!=="vertical"&&p!=="horizontal")return null;var x,v=b?.[0];return v==null||v.height==null||v.width==null?x=0:x=p==="vertical"?v.height/2:v.width/2,C.createElement(p4e,{xAxisId:e,yAxisId:n,data:b,dataPointFormatter:Q4e,errorBarOffset:x},C.createElement(eFe,oc({},t,{layout:p,needClip:f,data:b,xAxisId:e,yAxisId:n,hide:i,legendType:r,minPointSize:a,activeBar:s,animationBegin:o,animationDuration:l,animationEasing:c,isAnimationActive:d})))}function iFe(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:p,cells:m,parentViewBox:y,dataStartIndex:b}=t,x=e==="horizontal"?o:s,v=d?x.scale.domain():null,M=SCe({numericAxis:x}),w=x.scale(M);return f.map((E,T)=>{var P,R,U,N,O,B;d?P=vCe(d[T+b],v):(P=Hn(E,n),Array.isArray(P)||(P=[M,P]));var I=s4e(i,KK)(P[1],T);if(e==="horizontal"){var W,[L,$]=[o.scale(P[0]),o.scale(P[1])];R=cH({axis:s,ticks:l,bandSize:a,offset:r.offset,entry:E,index:T}),U=(W=$??L)!==null&&W!==void 0?W:void 0,N=r.size;var q=L-$;if(O=Bs(q)?0:q,B={x:R,y:p.top,width:N,height:p.height},Math.abs(I)>0&&Math.abs(O)<Math.abs(I)){var G=Sr(O||I)*(Math.abs(I)-Math.abs(O));U-=G,O+=G}}else{var[Y,Q]=[s.scale(P[0]),s.scale(P[1])];if(R=Y,U=cH({axis:o,ticks:c,bandSize:a,offset:r.offset,entry:E,index:T}),N=Q-Y,O=r.size,B={x:p.left,y:U,width:p.width,height:O},Math.abs(I)>0&&Math.abs(N)<Math.abs(I)){var se=Sr(N||I)*(Math.abs(I)-Math.abs(N));N+=se}}if(R==null||U==null||N==null||O==null)return null;var H=ua(ua({},E),{},{stackedBarStart:w,x:R,y:U,width:N,height:O,value:d?P:P[1],payload:E,background:B,tooltipPosition:{x:R+N/2,y:U+O/2},parentViewBox:y},m&&m[T]&&m[T].props);return H}).filter(Boolean)}function rFe(t){var e=qi(t,tFe),n=ra();return C.createElement(FO,{id:e.id,type:"bar"},i=>C.createElement(C.Fragment,null,C.createElement(HK,{legendPayload:G4e(e)}),C.createElement($4e,{dataKey:e.dataKey,stroke:e.stroke,strokeWidth:e.strokeWidth,fill:e.fill,name:e.name,hide:e.hide,unit:e.unit,tooltipType:e.tooltipType}),C.createElement($K,{type:"bar",id:i,data:void 0,xAxisId:e.xAxisId,yAxisId:e.yAxisId,zAxisId:0,dataKey:e.dataKey,stackId:jq(e.stackId),hide:e.hide,barSize:e.barSize,minPointSize:e.minPointSize,maxBarSize:e.maxBarSize,isPanorama:n}),C.createElement(Fa,{zIndex:e.zIndex},C.createElement(nFe,oc({},e,{id:i})))))}var ZK=C.memo(rFe,_w);ZK.displayName="Bar";function X6(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 Mb(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?X6(Object(n),!0).forEach(function(i){aFe(t,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):X6(Object(n)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(n,i))})}return t}function aFe(t,e,n){return(e=sFe(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function sFe(t){var e=oFe(t,"string");return typeof e=="symbol"?e:e+""}function oFe(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 lFe=(t,e)=>e,cFe=(t,e,n)=>n,uFe=(t,e,n,i)=>i,dFe=(t,e,n,i,r)=>r,Iv=He([fw,dFe],(t,e)=>t.filter(n=>n.type==="bar").find(n=>n.id===e)),fFe=He([Iv],t=>t?.maxBarSize),hFe=(t,e,n,i,r,a)=>a,Y6=(t,e,n)=>{var i=n??t;if(!ui(i))return ta(i,e,0)},pFe=He([mn,fw,lFe,cFe,uFe],(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")),mFe=(t,e,n,i)=>{var r=mn(t);return r==="horizontal"?q0(t,"yAxis",n,i):q0(t,"xAxis",e,i)},gFe=(t,e,n)=>{var i=mn(t);return i==="horizontal"?H8(t,"xAxis",e):H8(t,"yAxis",n)},vFe=(t,e,n)=>{var i={},r=t.filter(cw),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,p=f.map(y=>y.dataKey),m=Y6(e,n,f[0].barSize);return{stackId:d,dataKeys:p,barSize:m}}),l=a.map(c=>{var d=[c.dataKey].filter(p=>p!=null),f=Y6(e,n,c.barSize);return{stackId:void 0,dataKeys:d,barSize:f}});return[...o,...l]},xFe=He([pFe,zPe,gFe],vFe),yFe=(t,e,n,i,r)=>{var a,s,o=Iv(t,e,n,i,r);if(o!=null){var l=mn(t),c=fY(t),{maxBarSize:d}=o,f=ui(d)?c:d,p,m;return l==="horizontal"?(p=Uu(t,"xAxis",e,i),m=Iu(t,"xAxis",e,i)):(p=Uu(t,"yAxis",n,i),m=Iu(t,"yAxis",n,i)),(a=(s=Ip(p,m,!0))!==null&&s!==void 0?s:f)!==null&&a!==void 0?a:0}},JK=(t,e,n,i)=>{var r=mn(t),a,s;return r==="horizontal"?(a=Uu(t,"xAxis",e,i),s=Iu(t,"xAxis",e,i)):(a=Uu(t,"yAxis",n,i),s=Iu(t,"yAxis",n,i)),Ip(a,s)};function bFe(t,e,n,i,r){var a=i.length;if(!(a<1)){var s=ta(t,n,0,!0),o,l=[];if(ti(i[0].barSize)){var c=!1,d=n/a,f=i.reduce((v,M)=>v+(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 p=(n-f)/2>>0,m={offset:p-s,size:0};o=i.reduce((v,M)=>{var w,E={stackId:M.stackId,dataKeys:M.dataKeys,position:{offset:m.offset+m.size+s,size:c?d:(w=M.barSize)!==null&&w!==void 0?w:0}},T=[...v,E];return m=T[T.length-1].position,T},l)}else{var y=ta(e,n,0,!0);n-2*y-(a-1)*s<=0&&(s=0);var b=(n-2*y-(a-1)*s)/a;b>1&&(b>>=0);var x=ti(r)?Math.min(b,r):b;o=i.reduce((v,M,w)=>[...v,{stackId:M.stackId,dataKeys:M.dataKeys,position:{offset:y+(b+s)*w+(b-x)/2,size:x}}],l)}return o}}var _Fe=(t,e,n,i,r,a,s)=>{var o=ui(s)?e:s,l=bFe(n,i,r!==a?r:a,t,o);return r!==a&&l!=null&&(l=l.map(c=>Mb(Mb({},c),{},{position:Mb(Mb({},c.position),{},{offset:c.position.offset-r/2})}))),l},SFe=He([xFe,fY,FPe,hY,yFe,JK,fFe],_Fe),wFe=(t,e,n,i)=>Uu(t,"xAxis",e,i),MFe=(t,e,n,i)=>Uu(t,"yAxis",n,i),EFe=(t,e,n,i)=>Iu(t,"xAxis",e,i),AFe=(t,e,n,i)=>Iu(t,"yAxis",n,i),TFe=He([SFe,Iv],(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}}),CFe=(t,e)=>{var n=lw(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)}}}},RFe=He([mFe,Iv],CFe),NFe=He([sr,hD,wFe,MFe,EFe,AFe,TFe,mn,aw,JK,RFe,Iv,hFe],(t,e,n,i,r,a,s,o,l,c,d,f,p)=>{var{chartData:m,dataStartIndex:y,dataEndIndex:b}=l;if(!(f==null||s==null||e==null||o!=="horizontal"&&o!=="vertical"||n==null||i==null||r==null||a==null||c==null)){var{data:x}=f,v;if(x!=null&&x.length>0?v=x:v=m?.slice(y,b+1),v!=null)return iFe({layout:o,barSettings:f,pos:s,parentViewBox:e,bandSize:c,xAxis:n,yAxis:i,xAxisTicks:r,yAxisTicks:a,stackedData:d,displayedData:v,offset:t,cells:p,dataStartIndex:y})}}),QK=t=>{var{chartData:e}=t,n=qn(),i=ra();return C.useEffect(()=>i?()=>{}:(n(t6(e)),()=>{n(t6(void 0))}),[e,n,i]),null},K6={x:0,y:0,width:0,height:0,padding:{top:0,right:0,bottom:0,left:0}},eZ=Ua({name:"brush",initialState:K6,reducers:{setBrushSettings(t,e){return e.payload==null?K6:e.payload}}}),{setBrushSettings:O8e}=eZ.actions,PFe=eZ.reducer;function DFe(t,e,n){return(e=OFe(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function OFe(t){var e=LFe(t,"string");return typeof e=="symbol"?e:e+""}function LFe(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 jO{static create(e){return new jO(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}}DFe(jO,"EPS",1e-4);function kFe(t){return(t%180+180)%180}var IFe=function(e){var{width:n,height:i}=e,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a=kFe(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)},UFe={dots:[],areas:[],lines:[]},tZ=Ua({name:"referenceElements",initialState:UFe,reducers:{addDot:(t,e)=>{t.dots.push(e.payload)},removeDot:(t,e)=>{var n=ho(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=ho(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=ho(t).lines.findIndex(i=>i===e.payload);n!==-1&&t.lines.splice(n,1)}}}),{addDot:L8e,removeDot:k8e,addArea:I8e,removeArea:U8e,addLine:F8e,removeLine:z8e}=tZ.actions,FFe=tZ.reducer,zFe=C.createContext(void 0),BFe=t=>{var{children:e}=t,[n]=C.useState("".concat(L0("recharts"),"-clip")),i=zO();if(i==null)return null;var{x:r,y:a,width:s,height:o}=i;return C.createElement(zFe.Provider,{value:n},C.createElement("defs",null,C.createElement("clipPath",{id:n},C.createElement("rect",{x:r,y:a,height:o,width:s}))),e)};function nZ(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 jFe(t,e,n){var i={width:t.width+e.width,height:t.height+e.height};return IFe(i,n)}function HFe(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 W1(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 VFe(t,e){return nZ(t,e+1)}function GFe(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:nZ(i,c)};var b=l,x,v=()=>(x===void 0&&(x=n(y,b)),x),M=y.coordinate,w=l===0||W1(t,M,v,d,o);w||(l=0,d=s,c+=1),w&&(d=M+t*(v()/2+r),l+=c)},p;c<=a.length;)if(p=f(),p)return p.v;return[]}function Z6(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?Z6(Object(n),!0).forEach(function(i){$Fe(t,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Z6(Object(n)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(n,i))})}return t}function $Fe(t,e,n){return(e=WFe(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function WFe(t){var e=qFe(t,"string");return typeof e=="symbol"?e:e+""}function qFe(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 XFe(t,e,n,i,r){for(var a=(i||[]).slice(),s=a.length,{start:o}=e,{end:l}=e,c=function(p){var m=a[p],y,b=()=>(y===void 0&&(y=n(m,p)),y);if(p===s-1){var x=t*(m.coordinate+t*b()/2-l);a[p]=m=Jr(Jr({},m),{},{tickCoord:x>0?m.coordinate-x*t:m.coordinate})}else a[p]=m=Jr(Jr({},m),{},{tickCoord:m.coordinate});if(m.tickCoord!=null){var v=W1(t,m.tickCoord,b,o,l);v&&(l=m.tickCoord-t*(b()/2+r),a[p]=Jr(Jr({},m),{},{isShow:!0}))}},d=s-1;d>=0;d--)c(d);return a}function YFe(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),p=t*(d.coordinate+t*f/2-c);if(s[o-1]=d=Jr(Jr({},d),{},{tickCoord:p>0?d.coordinate-p*t:d.coordinate}),d.tickCoord!=null){var m=W1(t,d.tickCoord,()=>f,l,c);m&&(c=d.tickCoord-t*(f/2+r),s[o-1]=Jr(Jr({},d),{},{isShow:!0}))}}for(var y=a?o-1:o,b=function(M){var w=s[M],E,T=()=>(E===void 0&&(E=n(w,M)),E);if(M===0){var P=t*(w.coordinate-t*T()/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 R=W1(t,w.tickCoord,T,l,c);R&&(l=w.tickCoord+t*(T()/2+r),s[M]=Jr(Jr({},w),{},{isShow:!0}))}},x=0;x<y;x++)b(x);return s}function HO(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(Mt(l)||nm.isSsr){var p;return(p=VFe(r,Mt(l)?l:0))!==null&&p!==void 0?p:[]}var m=[],y=o==="top"||o==="bottom"?"width":"height",b=d&&y==="width"?i0(d,{fontSize:e,letterSpacing:n}):{width:0,height:0},x=(w,E)=>{var T=typeof c=="function"?c(w.value,E):w.value;return y==="width"?jFe(i0(T,{fontSize:e,letterSpacing:n}),b,f):i0(T,{fontSize:e,letterSpacing:n})[y]},v=r.length>=2?Sr(r[1].coordinate-r[0].coordinate):1,M=HFe(a,v,y);return l==="equidistantPreserveStart"?GFe(v,M,x,r,s):(l==="preserveStart"||l==="preserveStartEnd"?m=YFe(v,M,x,r,s,l==="preserveStartEnd"):m=XFe(v,M,x,r,s),m.filter(w=>w.isShow))}var KFe=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},ZFe=["axisLine","width","height","className","hide","ticks","axisType"];function JFe(t,e){if(t==null)return{};var n,i,r=QFe(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 QFe(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 _f(){return _f=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},_f.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 zi(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){eze(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 eze(t,e,n){return(e=tze(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function tze(t){var e=nze(t,"string");return typeof e=="symbol"?e:e+""}function nze(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 Kl={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:Vi.axis};function ize(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=zi(zi(zi({},l),ka(o)),{},{fill:"none"});if(a==="top"||a==="bottom"){var d=+(a==="top"&&!s||a==="bottom"&&s);c=zi(zi({},c),{},{x1:e,y1:n+d*r,x2:e+i,y2:n+d*r})}else{var f=+(a==="left"&&!s||a==="right"&&s);c=zi(zi({},c),{},{x1:e+f*i,y1:n,x2:e+f*i,y2:n+r})}return C.createElement("line",_f({},c,{className:yn("recharts-cartesian-axis-line",vf(o,"className"))}))}function rze(t,e,n,i,r,a,s,o,l){var c,d,f,p,m,y,b=o?-1:1,x=t.tickSize||s,v=Mt(t.tickCoord)?t.tickCoord:t.coordinate;switch(a){case"top":c=d=t.coordinate,p=n+ +!o*r,f=p-b*x,y=f-b*l,m=v;break;case"left":f=p=t.coordinate,d=e+ +!o*i,c=d-b*x,m=c-b*l,y=v;break;case"right":f=p=t.coordinate,d=e+ +o*i,c=d+b*x,m=c+b*l,y=v;break;default:c=d=t.coordinate,p=n+ +o*r,f=p+b*x,y=f+b*l,m=v;break}return{line:{x1:c,y1:f,x2:d,y2:p},tick:{x:m,y}}}function aze(t,e){switch(t){case"left":return e?"start":"end";case"right":return e?"end":"start";default:return"middle"}}function sze(t,e){switch(t){case"left":case"right":return"middle";case"top":return e?"start":"end";default:return e?"end":"start"}}function oze(t){var{option:e,tickProps:n,value:i}=t,r,a=yn(n.className,"recharts-cartesian-axis-tick-value");if(C.isValidElement(e))r=C.cloneElement(e,zi(zi({},n),{},{className:a}));else if(typeof e=="function")r=e(zi(zi({},n),{},{className:a}));else{var s="recharts-cartesian-axis-tick-value";typeof e!="boolean"&&(s=yn(s,e?.className)),r=C.createElement(vw,_f({},n,{className:s}),i)}return r}var lze=C.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:p,y:m,width:y,height:b,tickSize:x,tickMargin:v,fontSize:M,letterSpacing:w,getTicksConfig:E,events:T,axisType:P}=t,R=HO(zi(zi({},E),{},{ticks:n}),M,w),U=aze(d,f),N=sze(d,f),O=ka(E),B=gf(i),I={};typeof r=="object"&&(I=r);var W=zi(zi({},O),{},{fill:"none"},I),L=R.map(G=>zi({entry:G},rze(G,p,m,y,b,d,x,f,v))),$=L.map(G=>{var{entry:Y,line:Q}=G;return C.createElement(Pi,{className:"recharts-cartesian-axis-tick",key:"tick-".concat(Y.value,"-").concat(Y.coordinate,"-").concat(Y.tickCoord)},r&&C.createElement("line",_f({},W,Q,{className:yn("recharts-cartesian-axis-tick-line",vf(r,"className"))})))}),q=L.map((G,Y)=>{var{entry:Q,tick:se}=G,H=zi(zi(zi(zi({textAnchor:U,verticalAnchor:N},O),{},{stroke:"none",fill:a},B),se),{},{index:Y,payload:Q,visibleTicksCount:R.length,tickFormatter:s,padding:l},c);return C.createElement(Pi,_f({className:"recharts-cartesian-axis-tick-label",key:"tick-label-".concat(Q.value,"-").concat(Q.coordinate,"-").concat(Q.tickCoord)},hv(T,Q,Y)),i&&C.createElement(oze,{option:i,tickProps:H,value:"".concat(typeof s=="function"?s(Q.value,Y):Q.value).concat(o||"")}))});return C.createElement("g",{className:"recharts-cartesian-axis-ticks recharts-".concat(P,"-ticks")},q.length>0&&C.createElement(Fa,{zIndex:Vi.label},C.createElement("g",{className:"recharts-cartesian-axis-tick-labels recharts-".concat(P,"-tick-labels"),ref:e},q)),$.length>0&&C.createElement("g",{className:"recharts-cartesian-axis-tick-lines recharts-".concat(P,"-tick-lines")},$))}),cze=C.forwardRef((t,e)=>{var{axisLine:n,width:i,height:r,className:a,hide:s,ticks:o,axisType:l}=t,c=JFe(t,ZFe),[d,f]=C.useState(""),[p,m]=C.useState(""),y=C.useRef(null);C.useImperativeHandle(e,()=>({getCalculatedWidth:()=>{var x;return KFe({ticks:y.current,label:(x=t.labelRef)===null||x===void 0?void 0:x.current,labelGapWithTick:5,tickSize:t.tickSize,tickMargin:t.tickMargin})}}));var b=C.useCallback(x=>{if(x){var v=x.getElementsByClassName("recharts-cartesian-axis-tick-value");y.current=v;var M=v[0];if(M){var w=window.getComputedStyle(M),E=w.fontSize,T=w.letterSpacing;(E!==d||T!==p)&&(f(E),m(T))}}},[d,p]);return s||i!=null&&i<=0||r!=null&&r<=0?null:C.createElement(Fa,{zIndex:t.zIndex},C.createElement(Pi,{className:yn("recharts-cartesian-axis",a)},C.createElement(ize,{x:t.x,y:t.y,width:i,height:r,orientation:t.orientation,mirror:t.mirror,axisLine:n,otherSvgProps:ka(t)}),C.createElement(lze,{ref:b,axisType:l,events:c,fontSize:d,getTicksConfig:t,height:t.height,letterSpacing:p,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}),C.createElement(Oke,{x:t.x,y:t.y,width:t.width,height:t.height,lowerWidth:t.width,upperWidth:t.width},C.createElement(Vke,{label:t.label,labelRef:t.labelRef}),t.children)))}),VO=C.forwardRef((t,e)=>{var n=qi(t,Kl);return C.createElement(cze,_f({},n,{ref:e}))});VO.displayName="CartesianAxis";var uze=["x1","y1","x2","y2","key"],dze=["offset"],fze=["xAxisId","yAxisId"],hze=["xAxisId","yAxisId"];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 Qr(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){pze(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 pze(t,e,n){return(e=mze(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function mze(t){var e=gze(t,"string");return typeof e=="symbol"?e:e+""}function gze(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 zd(){return zd=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},zd.apply(null,arguments)}function q1(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 xze=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 C.createElement("rect",{x:i,y:r,ry:o,width:a,height:s,stroke:"none",fill:e,fillOpacity:n,className:"recharts-cartesian-grid-bg"})};function iZ(t){var{option:e,lineItemProps:n}=t,i;if(C.isValidElement(e))i=C.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=q1(n,uze),f=(r=ka(d))!==null&&r!==void 0?r:{},{offset:p}=f,m=q1(f,dze);i=C.createElement("line",zd({},m,{x1:a,y1:s,x2:o,y2:l,fill:"none",key:c}))}return i}function yze(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=q1(t,fze),l=r.map((c,d)=>{var f=Qr(Qr({},o),{},{x1:e,y1:c,x2:e+n,y2:c,key:"line-".concat(d),index:d});return C.createElement(iZ,{key:"line-".concat(d),option:i,lineItemProps:f})});return C.createElement("g",{className:"recharts-cartesian-grid-horizontal"},l)}function bze(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=q1(t,hze),l=r.map((c,d)=>{var f=Qr(Qr({},o),{},{x1:c,y1:e,x2:c,y2:e+n,key:"line-".concat(d),index:d});return C.createElement(iZ,{option:i,lineItemProps:f,key:"line-".concat(d)})});return C.createElement("g",{className:"recharts-cartesian-grid-vertical"},l)}function _ze(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,p)=>f-p);r!==c[0]&&c.unshift(0);var d=c.map((f,p)=>{var m=!c[p+1],y=m?r+s-f:c[p+1]-f;if(y<=0)return null;var b=p%e.length;return C.createElement("rect",{key:"react-".concat(p),y:f,x:i,height:y,width:a,stroke:"none",fill:e[b],fillOpacity:n,className:"recharts-cartesian-grid-bg"})});return C.createElement("g",{className:"recharts-cartesian-gridstripes-horizontal"},d)}function Sze(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,p)=>f-p);r!==c[0]&&c.unshift(0);var d=c.map((f,p)=>{var m=!c[p+1],y=m?r+s-f:c[p+1]-f;if(y<=0)return null;var b=p%n.length;return C.createElement("rect",{key:"react-".concat(p),x:f,y:a,width:y,height:o,stroke:"none",fill:n[b],fillOpacity:i,className:"recharts-cartesian-grid-bg"})});return C.createElement("g",{className:"recharts-cartesian-gridstripes-vertical"},d)}var wze=(t,e)=>{var{xAxis:n,width:i,height:r,offset:a}=t;return zq(HO(Qr(Qr(Qr({},Kl),n),{},{ticks:Bq(n),viewBox:{x:0,y:0,width:i,height:r}})),a.left,a.left+a.width,e)},Mze=(t,e)=>{var{yAxis:n,width:i,height:r,offset:a}=t;return zq(HO(Qr(Qr(Qr({},Kl),n),{},{ticks:Bq(n),viewBox:{x:0,y:0,width:i,height:r}})),a.top,a.top+a.height,e)},Eze={horizontal:!0,vertical:!0,horizontalPoints:[],verticalPoints:[],stroke:"#ccc",fill:"none",verticalFill:[],horizontalFill:[],xAxisId:0,yAxisId:0,syncWithTicks:!1,zIndex:Vi.grid};function oN(t){var e=mD(),n=gD(),i=Yq(),r=Qr(Qr({},qi(t,Eze)),{},{x:Mt(t.x)?t.x:i.left,y:Mt(t.y)?t.y:i.top,width:Mt(t.width)?t.width:i.width,height:Mt(t.height)?t.height:i.height}),{xAxisId:a,yAxisId:s,x:o,y:l,width:c,height:d,syncWithTicks:f,horizontalValues:p,verticalValues:m}=r,y=ra(),b=Et(N=>V8(N,"xAxis",a,y)),x=Et(N=>V8(N,"yAxis",s,y));if(!Go(c)||!Go(d)||!Mt(o)||!Mt(l))return null;var v=r.verticalCoordinatesGenerator||wze,M=r.horizontalCoordinatesGenerator||Mze,{horizontalPoints:w,verticalPoints:E}=r;if((!w||!w.length)&&typeof M=="function"){var T=p&&p.length,P=M({yAxis:x?Qr(Qr({},x),{},{ticks:T?p:x.ticks}):void 0,width:e??c,height:n??d,offset:i},T?!0:f);x1(Array.isArray(P),"horizontalCoordinatesGenerator should return Array but instead it returned [".concat(typeof P,"]")),Array.isArray(P)&&(w=P)}if((!E||!E.length)&&typeof v=="function"){var R=m&&m.length,U=v({xAxis:b?Qr(Qr({},b),{},{ticks:R?m:b.ticks}):void 0,width:e??c,height:n??d,offset:i},R?!0:f);x1(Array.isArray(U),"verticalCoordinatesGenerator should return Array but instead it returned [".concat(typeof U,"]")),Array.isArray(U)&&(E=U)}return C.createElement(Fa,{zIndex:r.zIndex},C.createElement("g",{className:"recharts-cartesian-grid"},C.createElement(xze,{fill:r.fill,fillOpacity:r.fillOpacity,x:r.x,y:r.y,width:r.width,height:r.height,ry:r.ry}),C.createElement(_ze,zd({},r,{horizontalPoints:w})),C.createElement(Sze,zd({},r,{verticalPoints:E})),C.createElement(yze,zd({},r,{offset:i,horizontalPoints:w,xAxis:b,yAxis:x})),C.createElement(bze,zd({},r,{offset:i,verticalPoints:E,xAxis:b,yAxis:x}))))}oN.displayName="CartesianGrid";function Aze(t){var e=gf(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 rZ=(t,e,n,i)=>Uu(t,"xAxis",e,i),aZ=(t,e,n,i)=>Iu(t,"xAxis",e,i),sZ=(t,e,n,i)=>Uu(t,"yAxis",n,i),oZ=(t,e,n,i)=>Iu(t,"yAxis",n,i),Tze=He([mn,rZ,sZ,aZ,oZ],(t,e,n,i,r)=>cc(t,"xAxis")?Ip(e,i,!1):Ip(n,r,!1)),Cze=(t,e,n,i,r)=>r,lZ=He([fw,Cze],(t,e)=>t.filter(n=>n.type==="area").find(n=>n.id===e)),Rze=(t,e,n,i,r)=>{var a,s=lZ(t,e,n,i,r);if(s!=null){var o=mn(t),l=cc(o,"xAxis"),c;if(l?c=q0(t,"yAxis",n,i):c=q0(t,"xAxis",e,i),c!=null){var{stackId:d}=s,f=lw(s);if(!(d==null||f==null)){var p=(a=c[d])===null||a===void 0?void 0:a.stackedData;return p?.find(m=>m.key===f)}}}},Nze=He([mn,rZ,sZ,aZ,oZ,Rze,aw,Tze,lZ,BPe],(t,e,n,i,r,a,s,o,l,c)=>{var{chartData:d,dataStartIndex:f,dataEndIndex:p}=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:m}=l,y;if(m&&m.length>0?y=m:y=d?.slice(f,p+1),y!=null)return Yze({layout:t,xAxis:e,yAxis:n,xAxisTicks:i,yAxisTicks:r,dataStartIndex:f,areaSettings:l,stackedData:a,displayedData:y,chartBaseValue:c,bandSize:o})}}),Pze=["id"],Dze=["activeDot","animationBegin","animationDuration","animationEasing","connectNulls","dot","fill","fillOpacity","hide","isAnimationActive","legendType","stroke","xAxisId","yAxisId"];function Jd(){return Jd=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},Jd.apply(null,arguments)}function cZ(t,e){if(t==null)return{};var n,i,r=Oze(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 Oze(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 eV(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 ip(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?eV(Object(n),!0).forEach(function(i){Lze(t,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):eV(Object(n)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(n,i))})}return t}function Lze(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=Ize(t,"string");return typeof e=="symbol"?e:e+""}function Ize(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 X1(t,e){return t&&t!=="none"?t:e}var Uze=t=>{var{dataKey:e,name:n,stroke:i,fill:r,legendType:a,hide:s}=t;return[{inactive:s,dataKey:e,type:a,color:X1(i,r),value:em(n,e),payload:t}]},Fze=C.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:em(s,e),hide:o,type:c,color:X1(i,a),unit:l}};return C.createElement(UO,{tooltipEntrySettings:d})});function zze(t){var{clipPathId:e,points:n,props:i}=t,{needClip:r,dot:a,dataKey:s}=i,o=ka(i);return C.createElement(PUe,{points:n,dot:a,className:"recharts-area-dots",dotClassName:"recharts-area-dot",dataKey:s,baseProps:o,needClip:r,clipPathId:e})}function Bze(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 ip(ip({},l),{},{value:a.value,payload:a.payload,parentViewBox:void 0,viewBox:l,fill:void 0})});return C.createElement(DK,{value:e?r:void 0},n)}function tV(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,p=cZ(a,Pze),m=ka(p),y=va(p);return C.createElement(C.Fragment,null,e?.length>1&&C.createElement(Pi,{clipPath:i?"url(#clipPath-".concat(r,")"):void 0},C.createElement(hp,Jd({},y,{id:f,points:e,connectNulls:c,type:o,baseLine:n,layout:s,stroke:"none",className:"recharts-area-area"})),l!=="none"&&C.createElement(hp,Jd({},m,{className:"recharts-area-curve",layout:s,type:o,connectNulls:c,fill:"none",points:e})),l!=="none"&&d&&C.createElement(hp,Jd({},m,{className:"recharts-area-curve",layout:s,type:o,connectNulls:c,fill:"none",points:n}))),C.createElement(zze,{points:e,props:p,clipPathId:r}))}function jze(t){var{alpha:e,baseLine:n,points:i,strokeWidth:r}=t,a=i[0].y,s=i[i.length-1].y;if(!ti(a)||!ti(s))return null;var o=e*Math.abs(a-s),l=Math.max(...i.map(c=>c.x||0));return Mt(n)?l=Math.max(n,l):n&&Array.isArray(n)&&n.length&&(l=Math.max(...n.map(c=>c.x||0),l)),Mt(l)?C.createElement("rect",{x:0,y:a<s?a:a-o,width:l+(r?parseInt("".concat(r),10):1),height:Math.floor(o)}):null}function Hze(t){var{alpha:e,baseLine:n,points:i,strokeWidth:r}=t,a=i[0].x,s=i[i.length-1].x;if(!ti(a)||!ti(s))return null;var o=e*Math.abs(a-s),l=Math.max(...i.map(c=>c.y||0));return Mt(n)?l=Math.max(n,l):n&&Array.isArray(n)&&n.length&&(l=Math.max(...n.map(c=>c.y||0),l)),Mt(l)?C.createElement("rect",{x:a<s?a:a-o,y:0,width:o,height:Math.floor(l+(r?parseInt("".concat(r),10):1))}):null}function Vze(t){var{alpha:e,layout:n,points:i,baseLine:r,strokeWidth:a}=t;return n==="vertical"?C.createElement(jze,{alpha:e,points:i,baseLine:r,strokeWidth:a}):C.createElement(Hze,{alpha:e,points:i,baseLine:r,strokeWidth:a})}function Gze(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:p,onAnimationEnd:m}=i,y=C.useMemo(()=>({points:s,baseLine:o}),[s,o]),b=bv(y,"recharts-area-"),x=r2e(),[v,M]=C.useState(!1),w=!v,E=C.useCallback(()=>{typeof m=="function"&&m(),M(!1)},[m]),T=C.useCallback(()=>{typeof p=="function"&&p(),M(!0)},[p]);if(x==null)return null;var P=r.current,R=a.current;return C.createElement(Bze,{showLabels:w,points:s},i.children,C.createElement(yv,{animationId:b,begin:c,duration:d,isActive:l,easing:f,onAnimationEnd:E,onAnimationStart:T,key:b},U=>{if(P){var N=P.length/s.length,O=U===1?s:s.map((I,W)=>{var L=Math.floor(W*N);if(P[L]){var $=P[L];return ip(ip({},I),{},{x:Qn($.x,I.x,U),y:Qn($.y,I.y,U)})}return I}),B;return Mt(o)?B=Qn(R,o,U):ui(o)||Bs(o)?B=Qn(R,0,U):B=o.map((I,W)=>{var L=Math.floor(W*N);if(Array.isArray(R)&&R[L]){var $=R[L];return ip(ip({},I),{},{x:Qn($.x,I.x,U),y:Qn($.y,I.y,U)})}return I}),U>0&&(r.current=O,a.current=B),C.createElement(tV,{points:O,baseLine:B,needClip:e,clipPathId:n,props:i})}return U>0&&(r.current=s,a.current=o),C.createElement(Pi,null,l&&C.createElement("defs",null,C.createElement("clipPath",{id:"animationClipPath-".concat(n)},C.createElement(Vze,{alpha:U,points:s,baseLine:o,layout:x,strokeWidth:i.strokeWidth}))),C.createElement(Pi,{clipPath:"url(#animationClipPath-".concat(n,")")},C.createElement(tV,{points:s,baseLine:o,needClip:e,clipPathId:n,props:i})))}),C.createElement(NO,{label:i.label}))}function $ze(t){var{needClip:e,clipPathId:n,props:i}=t,r=C.useRef(null),a=C.useRef();return C.createElement(Gze,{needClip:e,clipPathId:n,props:i,previousPointsRef:r,previousBaselineRef:a})}class Wze extends C.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:p,baseLine:m,zIndex:y}=this.props;if(e)return null;var b=yn("recharts-area",r),x=p,{r:v,strokeWidth:M}=Aze(n),w=BK(n),E=v*2+M,T=o?"url(#clipPath-".concat(w?"":"dots-").concat(x,")"):void 0;return C.createElement(Fa,{zIndex:y},C.createElement(Pi,{className:b},o&&C.createElement("defs",null,C.createElement(YK,{clipPathId:x,xAxisId:l,yAxisId:c}),!w&&C.createElement("clipPath",{id:"clipPath-dots-".concat(x)},C.createElement("rect",{x:s-E/2,y:a-E/2,width:d+E,height:f+E}))),C.createElement($ze,{needClip:o,clipPathId:x,props:this.props})),C.createElement(j6,{points:i,mainColor:X1(this.props.stroke,this.props.fill),itemDataKey:this.props.dataKey,activeDot:this.props.activeDot,clipPath:T}),this.props.isRange&&Array.isArray(m)&&C.createElement(j6,{points:m,mainColor:X1(this.props.stroke,this.props.fill),itemDataKey:this.props.dataKey,activeDot:this.props.activeDot,clipPath:T}))}}var uZ={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:Vi.area};function qze(t){var e,n=qi(t,uZ),{activeDot:i,animationBegin:r,animationDuration:a,animationEasing:s,connectNulls:o,dot:l,fill:c,fillOpacity:d,hide:f,isAnimationActive:p,legendType:m,stroke:y,xAxisId:b,yAxisId:x}=n,v=cZ(n,Dze),M=tm(),w=hK(),{needClip:E}=BO(b,x),T=ra(),{points:P,isRange:R,baseLine:U}=(e=Et(L=>Nze(L,b,x,T,t.id)))!==null&&e!==void 0?e:{},N=zO();if(M!=="horizontal"&&M!=="vertical"||N==null||w!=="AreaChart"&&w!=="ComposedChart")return null;var{height:O,width:B,x:I,y:W}=N;return!P||!P.length?null:C.createElement(Wze,Jd({},v,{activeDot:i,animationBegin:r,animationDuration:a,animationEasing:s,baseLine:U,connectNulls:o,dot:l,fill:c,fillOpacity:d,height:O,hide:f,layout:M,isAnimationActive:p==="auto"?!nm.isSsr:p,isRange:R,legendType:m,needClip:E,points:P,stroke:y,width:B,left:I,top:W,xAxisId:b,yAxisId:x}))}var Xze=(t,e,n,i,r)=>{var a=n??e;if(Mt(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 Yze(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:p,bandSize:m}=t,y=r&&r.length,b=Xze(a,s,n,o,l),x=a==="horizontal",v=!1,M=c.map((E,T)=>{var P;y?P=r[d+T]:(P=Hn(E,i),Array.isArray(P)?v=!0:P=[b,P]);var R=P[1]==null||y&&!e&&Hn(E,i)==null;return x?{x:lH({axis:o,ticks:f,bandSize:m,entry:E,index:T}),y:R?null:l.scale(P[1]),value:P,payload:E}:{x:R?null:o.scale(P[1]),y:lH({axis:l,ticks:p,bandSize:m,entry:E,index:T}),value:P,payload:E}}),w;return y||v?w=M.map(E=>{var T=Array.isArray(E.value)?E.value[0]:null;return x?{x:E.x,y:T!=null&&E.y!=null?l.scale(T):null,payload:E.payload}:{x:T!=null?o.scale(T):null,y:E.y,payload:E.payload}}):w=x?l.scale(b):o.scale(b),{points:M,baseLine:w,isRange:v}}function Kze(t){var e=qi(t,uZ),n=ra();return C.createElement(FO,{id:e.id,type:"area"},i=>C.createElement(C.Fragment,null,C.createElement(HK,{legendPayload:Uze(e)}),C.createElement(Fze,{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}),C.createElement($K,{type:"area",id:i,data:e.data,dataKey:e.dataKey,xAxisId:e.xAxisId,yAxisId:e.yAxisId,zAxisId:0,stackId:jq(e.stackId),hide:e.hide,barSize:void 0,baseValue:e.baseValue,isPanorama:n,connectNulls:e.connectNulls}),C.createElement(qze,Jd({},e,{id:i}))))}var dZ=C.memo(Kze,_w);dZ.displayName="Area";var Zze=["domain","range"],Jze=["domain","range"];function nV(t,e){if(t==null)return{};var n,i,r=Qze(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 Qze(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 iV(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 fZ(t,e){if(t===e)return!0;var{domain:n,range:i}=t,r=nV(t,Zze),{domain:a,range:s}=e,o=nV(e,Jze);return!iV(n,a)||!iV(i,s)?!1:_w(r,o)}var eBe=["dangerouslySetInnerHTML","ticks"],tBe=["id"];function lN(){return lN=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},lN.apply(null,arguments)}function rV(t,e){if(t==null)return{};var n,i,r=nBe(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 nBe(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 iBe(t){var e=qn(),n=C.useRef(null);return C.useLayoutEffect(()=>{n.current===null?e(IUe(t)):n.current!==t&&e(UUe({prev:n.current,next:t})),n.current=t},[t,e]),C.useLayoutEffect(()=>()=>{n.current&&(e(FUe(n.current)),n.current=null)},[e]),null}var rBe=t=>{var{xAxisId:e,className:n}=t,i=Et(hD),r=ra(),a="xAxis",s=Et(x=>cm(x,a,e,r)),o=Et(x=>$Y(x,a,e,r)),l=Et(x=>jY(x,e)),c=Et(x=>UDe(x,e)),d=Et(x=>SY(x,e));if(l==null||c==null||d==null)return null;var{dangerouslySetInnerHTML:f,ticks:p}=t,m=rV(t,eBe),{id:y}=d,b=rV(d,tBe);return C.createElement(VO,lN({},m,b,{scale:s,x:c.x,y:c.y,width:l.width,height:l.height,className:yn("recharts-".concat(a," ").concat(a),n),viewBox:i,ticks:o,axisType:a}))},aBe={allowDataOverflow:vr.allowDataOverflow,allowDecimals:vr.allowDecimals,allowDuplicatedCategory:vr.allowDuplicatedCategory,angle:vr.angle,axisLine:Kl.axisLine,height:vr.height,hide:!1,includeHidden:vr.includeHidden,interval:vr.interval,minTickGap:vr.minTickGap,mirror:vr.mirror,orientation:vr.orientation,padding:vr.padding,reversed:vr.reversed,scale:vr.scale,tick:vr.tick,tickCount:vr.tickCount,tickLine:Kl.tickLine,tickSize:Kl.tickSize,type:vr.type,xAxisId:0},sBe=t=>{var e=qi(t,aBe);return C.createElement(C.Fragment,null,C.createElement(iBe,{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}),C.createElement(rBe,e))},cN=C.memo(sBe,fZ);cN.displayName="XAxis";var oBe=["dangerouslySetInnerHTML","ticks"],lBe=["id"];function uN(){return uN=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},uN.apply(null,arguments)}function aV(t,e){if(t==null)return{};var n,i,r=cBe(t,e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(i=0;i<a.length;i++)n=a[i],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function cBe(t,e){if(t==null)return{};var n={};for(var i in t)if({}.hasOwnProperty.call(t,i)){if(e.indexOf(i)!==-1)continue;n[i]=t[i]}return n}function uBe(t){var e=qn(),n=C.useRef(null);return C.useLayoutEffect(()=>{n.current===null?e(zUe(t)):n.current!==t&&e(BUe({prev:n.current,next:t})),n.current=t},[t,e]),C.useLayoutEffect(()=>()=>{n.current&&(e(jUe(n.current)),n.current=null)},[e]),null}var dBe=t=>{var{yAxisId:e,className:n,width:i,label:r}=t,a=C.useRef(null),s=C.useRef(null),o=Et(hD),l=ra(),c=qn(),d="yAxis",f=Et(T=>cm(T,d,e,l)),p=Et(T=>HY(T,e)),m=Et(T=>zDe(T,e)),y=Et(T=>$Y(T,d,e,l)),b=Et(T=>wY(T,e));if(C.useLayoutEffect(()=>{if(!(i!=="auto"||!p||RO(r)||C.isValidElement(r)||b==null)){var T=a.current;if(T){var P=T.getCalculatedWidth();Math.round(p.width)!==Math.round(P)&&c(HUe({id:e,width:P}))}}},[y,p,c,r,e,i,b]),p==null||m==null||b==null)return null;var{dangerouslySetInnerHTML:x,ticks:v}=t,M=aV(t,oBe),{id:w}=b,E=aV(b,lBe);return C.createElement(VO,uN({},M,E,{ref:a,labelRef:s,scale:f,x:m.x,y:m.y,tickTextProps:i==="auto"?{width:void 0}:{width:i},width:p.width,height:p.height,className:yn("recharts-".concat(d," ").concat(d),n),viewBox:o,ticks:y,axisType:d}))},fBe={allowDataOverflow:xr.allowDataOverflow,allowDecimals:xr.allowDecimals,allowDuplicatedCategory:xr.allowDuplicatedCategory,angle:xr.angle,axisLine:Kl.axisLine,hide:!1,includeHidden:xr.includeHidden,interval:xr.interval,minTickGap:xr.minTickGap,mirror:xr.mirror,orientation:xr.orientation,padding:xr.padding,reversed:xr.reversed,scale:xr.scale,tick:xr.tick,tickCount:xr.tickCount,tickLine:Kl.tickLine,tickSize:Kl.tickSize,type:xr.type,width:xr.width,yAxisId:0},hBe=t=>{var e=qi(t,fBe);return C.createElement(C.Fragment,null,C.createElement(uBe,{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}),C.createElement(dBe,e))},dN=C.memo(hBe,fZ);dN.displayName="YAxis";var pBe=(t,e)=>e,GO=He([pBe,mn,bY,lr,oK,mc,eLe,sr],oLe),$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)}},hZ=js("mouseClick"),pZ=gv();pZ.startListening({actionCreator:hZ,effect:(t,e)=>{var n=t.payload,i=GO(e.getState(),$O(n));i?.activeIndex!=null&&e.dispatch(QDe({activeIndex:i.activeIndex,activeDataKey:void 0,activeCoordinate:i.activeCoordinate}))}});var fN=js("mouseMove"),mZ=gv(),Eb=null;mZ.startListening({actionCreator:fN,effect:(t,e)=>{var n=t.payload;Eb!==null&&cancelAnimationFrame(Eb);var i=$O(n);Eb=requestAnimationFrame(()=>{var r=e.getState(),a=vO(r,r.tooltip.settings.shared);if(a==="axis"){var s=GO(r,i);s?.activeIndex!=null?e.dispatch(QY({activeIndex:s.activeIndex,activeDataKey:void 0,activeCoordinate:s.activeCoordinate})):e.dispatch(JY())}Eb=null})}});var sV={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},gZ=Ua({name:"rootProps",initialState:sV,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:sV.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}}}),mBe=gZ.reducer,{updateOptions:gBe}=gZ.actions,vZ=Ua({name:"polarOptions",initialState:null,reducers:{updatePolarOptions:(t,e)=>e.payload}}),{updatePolarOptions:vBe}=vZ.actions,xBe=vZ.reducer,xZ=js("keyDown"),yZ=js("focus"),WO=gv();WO.startListening({actionCreator:xZ,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,dm(n),Rv(n),Ov(n)),o=s==null?-1:Number(s);if(!(!Number.isFinite(o)||o<0)){var l=mc(n);if(a==="Enter"){var c=z1(n,"axis","hover",String(r.index));e.dispatch(eN({active:!r.active,activeIndex:r.index,activeDataKey:r.dataKey,activeCoordinate:c}));return}var d=VDe(n),f=d==="left-to-right"?1:-1,p=a==="ArrowRight"?1:-1,m=o+p*f;if(!(l==null||m>=l.length||m<0)){var y=z1(n,"axis","hover",String(m));e.dispatch(eN({active:!0,activeIndex:m.toString(),activeDataKey:void 0,activeCoordinate:y}))}}}}}});WO.startListening({actionCreator:yZ,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=z1(n,"axis","hover",String(a));e.dispatch(eN({activeDataKey:void 0,active:!0,activeIndex:a,activeCoordinate:s}))}}}});var Ss=js("externalEvent"),bZ=gv(),f2=new Map;bZ.startListening({actionCreator:Ss,effect:(t,e)=>{var{handler:n,reactEvent:i}=t.payload;if(n!=null){i.persist();var r=i.type,a=f2.get(r);a!==void 0&&cancelAnimationFrame(a);var s=requestAnimationFrame(()=>{try{var o=e.getState(),l={activeCoordinate:zOe(o),activeDataKey:wO(o),activeIndex:Fu(o),activeLabel:uK(o),activeTooltipIndex:Fu(o),isTooltipActive:BOe(o)};n(l,i)}finally{f2.delete(r)}});f2.set(r,s)}}});var yBe=He([um],t=>t.tooltipItemPayloads),bBe=He([yBe,Pv,(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}}}),_Z=js("touchMove"),SZ=gv();SZ.startListening({actionCreator:_Z,effect:(t,e)=>{var n=t.payload;if(!(n.touches==null||n.touches.length===0)){var i=e.getState(),r=vO(i,i.tooltip.settings.shared);if(r==="axis"){var a=GO(i,$O({clientX:n.touches[0].clientX,clientY:n.touches[0].clientY,currentTarget:n.currentTarget}));a?.activeIndex!=null&&e.dispatch(QY({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(Vq),d=(s=l.getAttribute(Gq))!==null&&s!==void 0?s:void 0,f=bBe(e.getState(),c,d);e.dispatch(ZY({activeDataKey:d,activeIndex:c,activeCoordinate:f}))}}}});var _Be=uq({brush:PFe,cartesianAxis:VUe,chartData:FLe,errorBars:l4e,graphicalItems:YIe,layout:dCe,legend:y2e,options:OLe,polarAxis:uIe,polarOptions:xBe,referenceElements:FFe,rootProps:mBe,tooltip:eOe,zIndex:_Le}),SBe=function(e){return ITe({reducer:_Be,preloadedState:e,middleware:n=>{var i;return n({serializableCheck:!1,immutableCheck:!["commonjs","es6","production"].includes((i="es6")!==null&&i!==void 0?i:"")}).concat([pZ.middleware,mZ.middleware,WO.middleware,bZ.middleware,SZ.middleware])},enhancers:n=>{var i=n;return typeof n=="function"&&(i=n()),i.concat(Eq({type:"raf"}))},devTools:nm.devToolsEnabled})};function wZ(t){var{preloadedState:e,children:n,reduxStoreName:i}=t,r=ra(),a=C.useRef(null);if(r)return n;a.current==null&&(a.current=SBe(e));var s=rD;return C.createElement(O4e,{context:s,store:a.current},n)}function wBe(t){var{layout:e,margin:n}=t,i=qn(),r=ra();return C.useEffect(()=>{r||(i(lCe(e)),i(oCe(n)))},[i,r,e,n]),null}var MZ=C.memo(wBe,_w);function EZ(t){var e=qn();return C.useEffect(()=>{e(gBe(t))},[e,t]),null}function oV(t){var{zIndex:e,isPanorama:n}=t,i=n?"recharts-zindex-panorama-":"recharts-zindex-",r=VK("".concat(i).concat(e)),a=qn();return C.useLayoutEffect(()=>(a(yLe({zIndex:e,elementId:r,isPanorama:n})),()=>{a(bLe({zIndex:e,isPanorama:n}))}),[a,e,r,n]),C.createElement("g",{tabIndex:-1,id:r})}function lV(t){var{children:e,isPanorama:n}=t,i=Et(cLe);if(!i||i.length===0)return e;var r=i.filter(s=>s<0),a=i.filter(s=>s>0);return C.createElement(C.Fragment,null,r.map(s=>C.createElement(oV,{key:s,zIndex:s,isPanorama:n})),e,a.map(s=>C.createElement(oV,{key:s,zIndex:s,isPanorama:n})))}var MBe=["children"];function EBe(t,e){if(t==null)return{};var n,i,r=ABe(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 ABe(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 Y1(){return Y1=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},Y1.apply(null,arguments)}var TBe={width:"100%",height:"100%",display:"block"},CBe=C.forwardRef((t,e)=>{var n=mD(),i=gD(),r=oX();if(!Go(n)||!Go(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),C.createElement(XP,Y1({},s,{title:o,desc:l,role:d,tabIndex:c,width:n,height:i,style:TBe,ref:e}),a)}),RBe=t=>{var{children:e}=t,n=Et(qS);if(!n)return null;var{width:i,height:r,y:a,x:s}=n;return C.createElement(XP,{width:i,height:r,x:s,y:a},e)},cV=C.forwardRef((t,e)=>{var{children:n}=t,i=EBe(t,MBe),r=ra();return r?C.createElement(RBe,null,C.createElement(lV,{isPanorama:!0},n)):C.createElement(CBe,Y1({ref:e},i),C.createElement(lV,{isPanorama:!1},n))});function NBe(){var t=qn(),[e,n]=C.useState(null),i=Et(CCe);return C.useEffect(()=>{if(e!=null){var r=e.getBoundingClientRect(),a=r.width/e.offsetWidth;ti(a)&&a!==i&&t(uCe(a))}},[e,t,i]),n}function uV(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 PBe(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?uV(Object(n),!0).forEach(function(i){DBe(t,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):uV(Object(n)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(n,i))})}return t}function DBe(t,e,n){return(e=OBe(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function OBe(t){var e=LBe(t,"string");return typeof e=="symbol"?e:e+""}function LBe(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 Sf(){return Sf=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},Sf.apply(null,arguments)}var kBe=()=>(qLe(),null);function K1(t){if(typeof t=="number")return t;if(typeof t=="string"){var e=parseFloat(t);if(!Number.isNaN(e))return e}return 0}var IBe=C.forwardRef((t,e)=>{var n,i,r=C.useRef(null),[a,s]=C.useState({containerWidth:K1((n=t.style)===null||n===void 0?void 0:n.width),containerHeight:K1((i=t.style)===null||i===void 0?void 0:i.height)}),o=C.useCallback((c,d)=>{s(f=>{var p=Math.round(c),m=Math.round(d);return f.containerWidth===p&&f.containerHeight===m?f:{containerWidth:p,containerHeight:m}})},[]),l=C.useCallback(c=>{if(typeof e=="function"&&e(c),c!=null&&typeof ResizeObserver<"u"){var{width:d,height:f}=c.getBoundingClientRect();o(d,f);var p=y=>{var{width:b,height:x}=y[0].contentRect;o(b,x)},m=new ResizeObserver(p);m.observe(c),r.current=m}},[e,o]);return C.useEffect(()=>()=>{var c=r.current;c?.disconnect()},[o]),C.createElement(C.Fragment,null,C.createElement(YS,{width:a.containerWidth,height:a.containerHeight}),C.createElement("div",Sf({ref:l},t)))}),UBe=C.forwardRef((t,e)=>{var{width:n,height:i}=t,[r,a]=C.useState({containerWidth:K1(n),containerHeight:K1(i)}),s=C.useCallback((l,c)=>{a(d=>{var f=Math.round(l),p=Math.round(c);return d.containerWidth===f&&d.containerHeight===p?d:{containerWidth:f,containerHeight:p}})},[]),o=C.useCallback(l=>{if(typeof e=="function"&&e(l),l!=null){var{width:c,height:d}=l.getBoundingClientRect();s(c,d)}},[e,s]);return C.createElement(C.Fragment,null,C.createElement(YS,{width:r.containerWidth,height:r.containerHeight}),C.createElement("div",Sf({ref:o},t)))}),FBe=C.forwardRef((t,e)=>{var{width:n,height:i}=t;return C.createElement(C.Fragment,null,C.createElement(YS,{width:n,height:i}),C.createElement("div",Sf({ref:e},t)))}),zBe=C.forwardRef((t,e)=>{var{width:n,height:i}=t;return tc(n)||tc(i)?C.createElement(UBe,Sf({},t,{ref:e})):C.createElement(FBe,Sf({},t,{ref:e}))});function BBe(t){return t===!0?IBe:zBe}var jBe=C.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:p,onTouchEnd:m,onTouchMove:y,onTouchStart:b,style:x,width:v,responsive:M,dispatchTouchEvents:w=!0}=t,E=C.useRef(null),T=qn(),[P,R]=C.useState(null),[U,N]=C.useState(null),O=NBe(),B=pD(),I=B?.width>0?B.width:v,W=B?.height>0?B.height:r,L=C.useCallback(he=>{O(he),typeof e=="function"&&e(he),R(he),N(he),he!=null&&(E.current=he)},[O,e,R,N]),$=C.useCallback(he=>{T(hZ(he)),T(Ss({handler:a,reactEvent:he}))},[T,a]),q=C.useCallback(he=>{T(fN(he)),T(Ss({handler:c,reactEvent:he}))},[T,c]),G=C.useCallback(he=>{T(JY()),T(Ss({handler:d,reactEvent:he}))},[T,d]),Y=C.useCallback(he=>{T(fN(he)),T(Ss({handler:f,reactEvent:he}))},[T,f]),Q=C.useCallback(()=>{T(yZ())},[T]),se=C.useCallback(he=>{T(xZ(he.key))},[T]),H=C.useCallback(he=>{T(Ss({handler:s,reactEvent:he}))},[T,s]),X=C.useCallback(he=>{T(Ss({handler:o,reactEvent:he}))},[T,o]),re=C.useCallback(he=>{T(Ss({handler:l,reactEvent:he}))},[T,l]),ce=C.useCallback(he=>{T(Ss({handler:p,reactEvent:he}))},[T,p]),ye=C.useCallback(he=>{T(Ss({handler:b,reactEvent:he}))},[T,b]),me=C.useCallback(he=>{w&&T(_Z(he)),T(Ss({handler:y,reactEvent:he}))},[T,w,y]),be=C.useCallback(he=>{T(Ss({handler:m,reactEvent:he}))},[T,m]),De=BBe(M);return C.createElement(xK.Provider,{value:P},C.createElement(A7.Provider,{value:U},C.createElement(De,{width:I??x?.width,height:W??x?.height,className:yn("recharts-wrapper",i),style:PBe({position:"relative",cursor:"default",width:I,height:W},x),onClick:$,onContextMenu:H,onDoubleClick:X,onFocus:Q,onKeyDown:se,onMouseDown:re,onMouseEnter:q,onMouseLeave:G,onMouseMove:Y,onMouseUp:ce,onTouchEnd:be,onTouchMove:me,onTouchStart:ye,ref:L},C.createElement(kBe,null),n)))}),HBe=["width","height","responsive","children","className","style","compact","title","desc"];function VBe(t,e){if(t==null)return{};var n,i,r=GBe(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 GBe(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 AZ=C.forwardRef((t,e)=>{var{width:n,height:i,responsive:r,children:a,className:s,style:o,compact:l,title:c,desc:d}=t,f=VBe(t,HBe),p=ka(f);return l?C.createElement(C.Fragment,null,C.createElement(YS,{width:n,height:i}),C.createElement(cV,{otherAttributes:p,title:c,desc:d},a)):C.createElement(jBe,{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},C.createElement(cV,{otherAttributes:p,title:c,desc:d,ref:e},C.createElement(BFe,null,a)))});function hN(){return hN=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},hN.apply(null,arguments)}var $Be={top:5,right:5,bottom:5,left:5},WBe={accessibilityLayer:!0,barCategoryGap:"10%",barGap:4,layout:"horizontal",margin:$Be,responsive:!1,reverseStackOrder:!1,stackOffset:"none",syncMethod:"index"},TZ=C.forwardRef(function(e,n){var i,r=qi(e.categoricalChartProps,WBe),{chartName:a,defaultTooltipEventType:s,validateTooltipEventTypes:o,tooltipPayloadSearcher:l,categoricalChartProps:c}=e,d={chartName:a,defaultTooltipEventType:s,validateTooltipEventTypes:o,tooltipPayloadSearcher:l,eventEmitter:void 0};return C.createElement(wZ,{preloadedState:{options:d},reduxStoreName:(i=c.id)!==null&&i!==void 0?i:a},C.createElement(QK,{chartData:c.data}),C.createElement(MZ,{layout:r.layout,margin:r.margin}),C.createElement(EZ,{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}),C.createElement(AZ,hN({},r,{ref:n})))}),qBe=["axis","item"],XBe=C.forwardRef((t,e)=>C.createElement(TZ,{chartName:"BarChart",defaultTooltipEventType:"axis",validateTooltipEventTypes:qBe,tooltipPayloadSearcher:CO,categoricalChartProps:t,ref:e}));function YBe(t){var e=qn();return C.useEffect(()=>{e(vBe(t))},[e,t]),null}var KBe=["layout"];function pN(){return pN=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},pN.apply(null,arguments)}function ZBe(t,e){if(t==null)return{};var n,i,r=JBe(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 JBe(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 QBe={top:5,right:5,bottom:5,left:5},CZ={accessibilityLayer:!0,stackOffset:"none",barCategoryGap:"10%",barGap:4,margin:QBe,reverseStackOrder:!1,syncMethod:"index",layout:"radial",responsive:!1,cx:"50%",cy:"50%",innerRadius:0,outerRadius:"80%"},e5e=C.forwardRef(function(e,n){var i,r=qi(e.categoricalChartProps,CZ),{layout:a}=r,s=ZBe(r,KBe),{chartName:o,defaultTooltipEventType:l,validateTooltipEventTypes:c,tooltipPayloadSearcher:d}=e,f={chartName:o,defaultTooltipEventType:l,validateTooltipEventTypes:c,tooltipPayloadSearcher:d,eventEmitter:void 0};return C.createElement(wZ,{preloadedState:{options:f},reduxStoreName:(i=r.id)!==null&&i!==void 0?i:o},C.createElement(QK,{chartData:r.data}),C.createElement(MZ,{layout:a,margin:r.margin}),C.createElement(EZ,{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}),C.createElement(YBe,{cx:r.cx,cy:r.cy,startAngle:r.startAngle,endAngle:r.endAngle,innerRadius:r.innerRadius,outerRadius:r.outerRadius}),C.createElement(AZ,pN({},s,{ref:n})))});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 fV(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){t5e(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 t5e(t,e,n){return(e=n5e(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function n5e(t){var e=i5e(t,"string");return typeof e=="symbol"?e:e+""}function i5e(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 r5e=["item"],a5e=fV(fV({},CZ),{},{layout:"centric",startAngle:0,endAngle:360}),s5e=C.forwardRef((t,e)=>{var n=qi(t,a5e);return C.createElement(e5e,{chartName:"PieChart",defaultTooltipEventType:"item",validateTooltipEventTypes:r5e,tooltipPayloadSearcher:CO,categoricalChartProps:n,ref:e})}),o5e=["axis"],l5e=C.forwardRef((t,e)=>C.createElement(TZ,{chartName:"AreaChart",defaultTooltipEventType:"axis",validateTooltipEventTypes:o5e,tooltipPayloadSearcher:CO,categoricalChartProps:t,ref:e}));const hV=["#00ae42","#3b82f6","#f59e0b","#ef4444","#8b5cf6","#ec4899","#14b8a6","#f97316"];function c5e(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 u5e({archives:t,currency:e="$"}){const[n,i]=C.useState("30d"),r=C.useMemo(()=>{const p=c5e(n);return t.filter(m=>new Date(m.completed_at||m.created_at)>=p)},[t,n]),a=C.useMemo(()=>{const p=new Map;return r.forEach(m=>{const b=new Date(m.completed_at||m.created_at).toISOString().split("T")[0],x=p.get(b)||{date:b,filament:0,cost:0,prints:0};x.filament+=m.filament_used_grams||0,x.cost+=m.cost||0,x.prints+=1,p.set(b,x)}),Array.from(p.values()).sort((m,y)=>m.date.localeCompare(y.date)).map(m=>({...m,dateLabel:new Date(m.date).toLocaleDateString("en-US",{month:"short",day:"numeric"})}))},[r]),s=C.useMemo(()=>{if(n==="7d"||n==="30d")return a;const p=new Map;return r.forEach(m=>{const y=new Date(m.completed_at||m.created_at),b=new Date(y);b.setDate(y.getDate()-y.getDay());const x=b.toISOString().split("T")[0],v=p.get(x)||{week:x,filament:0,cost:0,prints:0};v.filament+=m.filament_used_grams||0,v.cost+=m.cost||0,v.prints+=1,p.set(x,v)}),Array.from(p.values()).sort((m,y)=>m.week.localeCompare(y.week)).map(m=>({date:m.week,dateLabel:`Week of ${new Date(m.week).toLocaleDateString("en-US",{month:"short",day:"numeric"})}`,...m}))},[r,a,n]),o=C.useMemo(()=>{const p=new Map;return r.forEach(m=>{const b=(m.filament_type||"Unknown").split(", ");b.forEach(x=>{const v=(m.filament_used_grams||0)/b.length;p.set(x,(p.get(x)||0)+v)})}),Array.from(p.entries()).map(([m,y])=>({name:m,value:Math.round(y)})).sort((m,y)=>y.value-m.value)},[r]),l=C.useMemo(()=>{const p=new Date,m=[];for(let y=5;y>=0;y--){const b=new Date(p.getFullYear(),p.getMonth()-y,1),x=new Date(p.getFullYear(),p.getMonth()-y+1,0),v=b.toLocaleDateString("en-US",{month:"short",year:"2-digit"}),M=t.filter(w=>{const E=new Date(w.completed_at||w.created_at);return E>=b&&E<=x});m.push({month:v,filament:Math.round(M.reduce((w,E)=>w+(E.filament_used_grams||0),0)),cost:M.reduce((w,E)=>w+(E.cost||0),0),prints:M.length})}return m},[t]),c=n==="7d"||n==="30d"?a:s,d=r.reduce((p,m)=>p+(m.filament_used_grams||0),0),f=r.reduce((p,m)=>p+(m.cost||0),0);return S.jsxs("div",{className:"space-y-6",children:[S.jsxs("div",{className:"flex items-center justify-between",children:[S.jsx("h3",{className:"text-lg font-semibold text-white",children:"Filament Usage Trends"}),S.jsx("div",{className:"flex gap-1 bg-bambu-dark rounded-lg p-1",children:["7d","30d","90d","365d","all"].map(p=>S.jsx("button",{onClick:()=>i(p),className:`px-3 py-1 text-sm rounded-md transition-colors ${n===p?"bg-bambu-green text-white":"text-bambu-gray hover:text-white"}`,children:p==="all"?"All":p.replace("d","D")},p))})]}),S.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[S.jsxs("div",{className:"bg-bambu-dark rounded-lg p-4",children:[S.jsx("p",{className:"text-sm text-bambu-gray",children:"Period Filament"}),S.jsxs("p",{className:"text-2xl font-bold text-white",children:[(d/1e3).toFixed(2),"kg"]}),S.jsxs("p",{className:"text-xs text-bambu-gray",children:[d.toFixed(0),"g total"]})]}),S.jsxs("div",{className:"bg-bambu-dark rounded-lg p-4",children:[S.jsx("p",{className:"text-sm text-bambu-gray",children:"Period Cost"}),S.jsxs("p",{className:"text-2xl font-bold text-white",children:[e,f.toFixed(2)]}),S.jsxs("p",{className:"text-xs text-bambu-gray",children:[r.length," prints"]})]}),S.jsxs("div",{className:"bg-bambu-dark rounded-lg p-4",children:[S.jsx("p",{className:"text-sm text-bambu-gray",children:"Avg per Print"}),S.jsxs("p",{className:"text-2xl font-bold text-white",children:[r.length>0?(d/r.length).toFixed(0):0,"g"]}),S.jsxs("p",{className:"text-xs text-bambu-gray",children:[e,r.length>0?(f/r.length).toFixed(2):"0.00"," avg"]})]})]}),c.length>0?S.jsxs("div",{className:"bg-bambu-dark rounded-lg p-4",children:[S.jsx("h4",{className:"text-sm font-medium text-bambu-gray mb-4",children:"Usage Over Time"}),S.jsx(OC,{width:"100%",height:250,children:S.jsxs(l5e,{data:c,children:[S.jsx("defs",{children:S.jsxs("linearGradient",{id:"colorFilament",x1:"0",y1:"0",x2:"0",y2:"1",children:[S.jsx("stop",{offset:"5%",stopColor:"#00ae42",stopOpacity:.3}),S.jsx("stop",{offset:"95%",stopColor:"#00ae42",stopOpacity:0})]})}),S.jsx(oN,{strokeDasharray:"3 3",stroke:"#3d3d3d"}),S.jsx(cN,{dataKey:"dateLabel",stroke:"#9ca3af",tick:{fontSize:12},interval:"preserveStartEnd"}),S.jsx(dN,{stroke:"#9ca3af",tick:{fontSize:12},tickFormatter:p=>`${p}g`}),S.jsx(ZC,{contentStyle:{backgroundColor:"#2d2d2d",border:"1px solid #3d3d3d",borderRadius:"8px"},labelStyle:{color:"#fff"},formatter:p=>[`${p.toFixed(0)}g`,"Filament"]}),S.jsx(dZ,{type:"monotone",dataKey:"filament",stroke:"#00ae42",strokeWidth:2,fillOpacity:1,fill:"url(#colorFilament)"})]})})]}):S.jsx("div",{className:"bg-bambu-dark rounded-lg p-8 text-center text-bambu-gray",children:"No data for selected time range"}),S.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[S.jsxs("div",{className:"bg-bambu-dark rounded-lg p-4",children:[S.jsx("h4",{className:"text-sm font-medium text-bambu-gray mb-4",children:"By Filament Type"}),o.length>0?S.jsx(OC,{width:"100%",height:200,children:S.jsxs(s5e,{children:[S.jsx(WK,{data:o,cx:"50%",cy:"50%",innerRadius:50,outerRadius:80,paddingAngle:2,dataKey:"value",label:({name:p,percent:m})=>`${p} ${((m||0)*100).toFixed(0)}%`,labelLine:!1,children:o.map((p,m)=>S.jsx(kv,{fill:hV[m%hV.length]},`cell-${m}`))}),S.jsx(ZC,{contentStyle:{backgroundColor:"#2d2d2d",border:"1px solid #3d3d3d",borderRadius:"8px"},formatter:p=>[`${p}g`,"Usage"]})]})}):S.jsx("div",{className:"h-[200px] flex items-center justify-center text-bambu-gray",children:"No filament data"})]}),S.jsxs("div",{className:"bg-bambu-dark rounded-lg p-4",children:[S.jsx("h4",{className:"text-sm font-medium text-bambu-gray mb-4",children:"Monthly Comparison"}),S.jsx(OC,{width:"100%",height:200,children:S.jsxs(XBe,{data:l,children:[S.jsx(oN,{strokeDasharray:"3 3",stroke:"#3d3d3d"}),S.jsx(cN,{dataKey:"month",stroke:"#9ca3af",tick:{fontSize:12}}),S.jsx(dN,{stroke:"#9ca3af",tick:{fontSize:12},tickFormatter:p=>`${p}g`}),S.jsx(ZC,{contentStyle:{backgroundColor:"#2d2d2d",border:"1px solid #3d3d3d",borderRadius:"8px"},formatter:(p,m)=>[m==="filament"?`${p}g`:m==="cost"?`${e}${p.toFixed(2)}`:p,m==="filament"?"Filament":m==="cost"?"Cost":"Prints"]}),S.jsx(sX,{}),S.jsx(ZK,{dataKey:"filament",name:"Filament (g)",fill:"#00ae42",radius:[4,4,0,0]})]})})]})]})]})}function d5e(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return C.useMemo(()=>i=>{e.forEach(r=>r(i))},e)}const Sw=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function fm(t){const e=Object.prototype.toString.call(t);return e==="[object Window]"||e==="[object global]"}function qO(t){return"nodeType"in t}function za(t){var e,n;return t?fm(t)?t:qO(t)&&(e=(n=t.ownerDocument)==null?void 0:n.defaultView)!=null?e:window:window}function XO(t){const{Document:e}=za(t);return t instanceof e}function Uv(t){return fm(t)?!1:t instanceof za(t).HTMLElement}function RZ(t){return t instanceof za(t).SVGElement}function hm(t){return t?fm(t)?t.document:qO(t)?XO(t)?t:Uv(t)||RZ(t)?t.ownerDocument:document:document:document}const Wo=Sw?C.useLayoutEffect:C.useEffect;function YO(t){const e=C.useRef(t);return Wo(()=>{e.current=t}),C.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 f5e(){const t=C.useRef(null),e=C.useCallback((i,r)=>{t.current=setInterval(i,r)},[]),n=C.useCallback(()=>{t.current!==null&&(clearInterval(t.current),t.current=null)},[]);return[e,n]}function Y0(t,e){e===void 0&&(e=[t]);const n=C.useRef(t);return Wo(()=>{n.current!==t&&(n.current=t)},e),n}function Fv(t,e){const n=C.useRef();return C.useMemo(()=>{const i=t(n.current);return n.current=i,i},[...e])}function Z1(t){const e=YO(t),n=C.useRef(null),i=C.useCallback(r=>{r!==n.current&&e?.(r,n.current),n.current=r},[]);return[n,i]}function mN(t){const e=C.useRef();return C.useEffect(()=>{e.current=t},[t]),e.current}let h2={};function zv(t,e){return C.useMemo(()=>{if(e)return e;const n=h2[t]==null?0:h2[t]+1;return h2[t]=n,t+"-"+n},[t,e])}function NZ(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 mp=NZ(1),K0=NZ(-1);function h5e(t){return"clientX"in t&&"clientY"in t}function KO(t){if(!t)return!1;const{KeyboardEvent:e}=za(t.target);return e&&t instanceof e}function p5e(t){if(!t)return!1;const{TouchEvent:e}=za(t.target);return e&&t instanceof e}function gN(t){if(p5e(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 h5e(t)?{x:t.clientX,y:t.clientY}:null}const Z0=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[Z0.Translate.toString(t),Z0.Scale.toString(t)].join(" ")}},Transition:{toString(t){let{property:e,duration:n,easing:i}=t;return e+" "+n+"ms "+i}}}),pV="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function m5e(t){return t.matches(pV)?t:t.querySelector(pV)}const g5e={display:"none"};function v5e(t){let{id:e,value:n}=t;return yi.createElement("div",{id:e,style:g5e},n)}function x5e(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 yi.createElement("div",{id:e,style:r,role:"status","aria-live":i,"aria-atomic":!0},n)}function y5e(){const[t,e]=C.useState("");return{announce:C.useCallback(i=>{i!=null&&e(i)},[]),announcement:t}}const PZ=C.createContext(null);function b5e(t){const e=C.useContext(PZ);C.useEffect(()=>{if(!e)throw new Error("useDndMonitor must be used within a children of <DndContext>");return e(t)},[t,e])}function _5e(){const[t]=C.useState(()=>new Set),e=C.useCallback(i=>(t.add(i),()=>t.delete(i)),[t]);return[C.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 S5e={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. `},w5e={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 M5e(t){let{announcements:e=w5e,container:n,hiddenTextDescribedById:i,screenReaderInstructions:r=S5e}=t;const{announce:a,announcement:s}=y5e(),o=zv("DndLiveRegion"),[l,c]=C.useState(!1);if(C.useEffect(()=>{c(!0)},[]),b5e(C.useMemo(()=>({onDragStart(f){let{active:p}=f;a(e.onDragStart({active:p}))},onDragMove(f){let{active:p,over:m}=f;e.onDragMove&&a(e.onDragMove({active:p,over:m}))},onDragOver(f){let{active:p,over:m}=f;a(e.onDragOver({active:p,over:m}))},onDragEnd(f){let{active:p,over:m}=f;a(e.onDragEnd({active:p,over:m}))},onDragCancel(f){let{active:p,over:m}=f;a(e.onDragCancel({active:p,over:m}))}}),[a,e])),!l)return null;const d=yi.createElement(yi.Fragment,null,yi.createElement(v5e,{id:i,value:r.draggable}),yi.createElement(x5e,{id:o,announcement:s}));return n?Il.createPortal(d,n):d}var Qi;(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"})(Qi||(Qi={}));function J1(){}function mV(t,e){return C.useMemo(()=>({sensor:t,options:e??{}}),[t,e])}function E5e(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return C.useMemo(()=>[...e].filter(i=>i!=null),[...e])}const go=Object.freeze({x:0,y:0});function DZ(t,e){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))}function OZ(t,e){let{data:{value:n}}=t,{data:{value:i}}=e;return n-i}function A5e(t,e){let{data:{value:n}}=t,{data:{value:i}}=e;return i-n}function gV(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 LZ(t,e){if(!t||t.length===0)return null;const[n]=t;return n[e]}function vV(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 T5e=t=>{let{collisionRect:e,droppableRects:n,droppableContainers:i}=t;const r=vV(e,e.left,e.top),a=[];for(const s of i){const{id:o}=s,l=n.get(o);if(l){const c=DZ(vV(l),r);a.push({id:o,data:{droppableContainer:s,value:c}})}}return a.sort(OZ)},C5e=t=>{let{collisionRect:e,droppableRects:n,droppableContainers:i}=t;const r=gV(e),a=[];for(const s of i){const{id:o}=s,l=n.get(o);if(l){const c=gV(l),d=r.reduce((p,m,y)=>p+DZ(c[y],m),0),f=Number((d/4).toFixed(4));a.push({id:o,data:{droppableContainer:s,value:f}})}}return a.sort(OZ)};function R5e(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 N5e=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=R5e(o,e);l>0&&r.push({id:s,data:{droppableContainer:a,value:l}})}}return r.sort(A5e)};function P5e(t,e,n){return{...t,scaleX:e&&n?e.width/n.width:1,scaleY:e&&n?e.height/n.height:1}}function kZ(t,e){return t&&e?{x:t.left-e.left,y:t.top-e.top}:go}function D5e(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 O5e=D5e(1);function L5e(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 k5e(t,e,n){const i=L5e(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 I5e={ignoreTransform:!1};function pm(t,e){e===void 0&&(e=I5e);let n=t.getBoundingClientRect();if(e.ignoreTransform){const{transform:c,transformOrigin:d}=za(t).getComputedStyle(t);c&&(n=k5e(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 xV(t){return pm(t,{ignoreTransform:!0})}function U5e(t){const e=t.innerWidth,n=t.innerHeight;return{top:0,left:0,right:e,bottom:n,width:e,height:n}}function F5e(t,e){return e===void 0&&(e=za(t).getComputedStyle(t)),e.position==="fixed"}function z5e(t,e){e===void 0&&(e=za(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 ww(t,e){const n=[];function i(r){if(e!=null&&n.length>=e||!r)return n;if(XO(r)&&r.scrollingElement!=null&&!n.includes(r.scrollingElement))return n.push(r.scrollingElement),n;if(!Uv(r)||RZ(r)||n.includes(r))return n;const a=za(t).getComputedStyle(r);return r!==t&&z5e(r,a)&&n.push(r),F5e(r,a)?n:i(r.parentNode)}return t?i(t):n}function IZ(t){const[e]=ww(t,1);return e??null}function p2(t){return!Sw||!t?null:fm(t)?t:qO(t)?XO(t)||t===hm(t).scrollingElement?window:Uv(t)?t:null:null}function UZ(t){return fm(t)?t.scrollX:t.scrollLeft}function FZ(t){return fm(t)?t.scrollY:t.scrollTop}function vN(t){return{x:UZ(t),y:FZ(t)}}var br;(function(t){t[t.Forward=1]="Forward",t[t.Backward=-1]="Backward"})(br||(br={}));function zZ(t){return!Sw||!t?!1:t===document.scrollingElement}function BZ(t){const e={x:0,y:0},n=zZ(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 B5e={x:.2,y:.2};function j5e(t,e,n,i,r){let{top:a,left:s,right:o,bottom:l}=n;i===void 0&&(i=10),r===void 0&&(r=B5e);const{isTop:c,isBottom:d,isLeft:f,isRight:p}=BZ(t),m={x:0,y:0},y={x:0,y:0},b={height:e.height*r.y,width:e.width*r.x};return!c&&a<=e.top+b.height?(m.y=br.Backward,y.y=i*Math.abs((e.top+b.height-a)/b.height)):!d&&l>=e.bottom-b.height&&(m.y=br.Forward,y.y=i*Math.abs((e.bottom-b.height-l)/b.height)),!p&&o>=e.right-b.width?(m.x=br.Forward,y.x=i*Math.abs((e.right-b.width-o)/b.width)):!f&&s<=e.left+b.width&&(m.x=br.Backward,y.x=i*Math.abs((e.left+b.width-s)/b.width)),{direction:m,speed:y}}function H5e(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 jZ(t){return t.reduce((e,n)=>mp(e,vN(n)),go)}function V5e(t){return t.reduce((e,n)=>e+UZ(n),0)}function G5e(t){return t.reduce((e,n)=>e+FZ(n),0)}function $5e(t,e){if(e===void 0&&(e=pm),!t)return;const{top:n,left:i,bottom:r,right:a}=e(t);IZ(t)&&(r<=0||a<=0||n>=window.innerHeight||i>=window.innerWidth)&&t.scrollIntoView({block:"center",inline:"center"})}const W5e=[["x",["left","right"],V5e],["y",["top","bottom"],G5e]];class ZO{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=ww(n),r=jZ(i);this.rect={...e},this.width=e.width,this.height=e.height;for(const[a,s,o]of W5e)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 r0{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 q5e(t){const{EventTarget:e}=za(t);return t instanceof e?t:hm(t)}function m2(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 Cs;(function(t){t.Click="click",t.DragStart="dragstart",t.Keydown="keydown",t.ContextMenu="contextmenu",t.Resize="resize",t.SelectionChange="selectionchange",t.VisibilityChange="visibilitychange"})(Cs||(Cs={}));function yV(t){t.preventDefault()}function X5e(t){t.stopPropagation()}var pn;(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"})(pn||(pn={}));const HZ={start:[pn.Space,pn.Enter],cancel:[pn.Esc],end:[pn.Space,pn.Enter,pn.Tab]},Y5e=(t,e)=>{let{currentCoordinates:n}=e;switch(t.code){case pn.Right:return{...n,x:n.x+25};case pn.Left:return{...n,x:n.x-25};case pn.Down:return{...n,y:n.y+25};case pn.Up:return{...n,y:n.y-25}}};class JO{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 r0(hm(n)),this.windowListeners=new r0(za(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Cs.Resize,this.handleCancel),this.windowListeners.add(Cs.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Cs.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:e,onStart:n}=this.props,i=e.node.current;i&&$5e(i),n(go)}handleKeyDown(e){if(KO(e)){const{active:n,context:i,options:r}=this.props,{keyboardCodes:a=HZ,coordinateGetter:s=Y5e,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}:go;this.referenceCoordinates||(this.referenceCoordinates=d);const f=s(e,{active:n,context:i.current,currentCoordinates:d});if(f){const p=K0(f,d),m={x:0,y:0},{scrollableAncestors:y}=i.current;for(const b of y){const x=e.code,{isTop:v,isRight:M,isLeft:w,isBottom:E,maxScroll:T,minScroll:P}=BZ(b),R=H5e(b),U={x:Math.min(x===pn.Right?R.right-R.width/2:R.right,Math.max(x===pn.Right?R.left:R.left+R.width/2,f.x)),y:Math.min(x===pn.Down?R.bottom-R.height/2:R.bottom,Math.max(x===pn.Down?R.top:R.top+R.height/2,f.y))},N=x===pn.Right&&!M||x===pn.Left&&!w,O=x===pn.Down&&!E||x===pn.Up&&!v;if(N&&U.x!==f.x){const B=b.scrollLeft+p.x,I=x===pn.Right&&B<=T.x||x===pn.Left&&B>=P.x;if(I&&!p.y){b.scrollTo({left:B,behavior:o});return}I?m.x=b.scrollLeft-B:m.x=x===pn.Right?b.scrollLeft-T.x:b.scrollLeft-P.x,m.x&&b.scrollBy({left:-m.x,behavior:o});break}else if(O&&U.y!==f.y){const B=b.scrollTop+p.y,I=x===pn.Down&&B<=T.y||x===pn.Up&&B>=P.y;if(I&&!p.x){b.scrollTo({top:B,behavior:o});return}I?m.y=b.scrollTop-B:m.y=x===pn.Down?b.scrollTop-T.y:b.scrollTop-P.y,m.y&&b.scrollBy({top:-m.y,behavior:o});break}}this.handleMove(e,mp(K0(f,this.referenceCoordinates),m))}}}handleMove(e,n){const{onMove:i}=this.props;e.preventDefault(),i(n)}handleEnd(e){const{onEnd:n}=this.props;e.preventDefault(),this.detach(),n()}handleCancel(e){const{onCancel:n}=this.props;e.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}JO.activators=[{eventName:"onKeyDown",handler:(t,e,n)=>{let{keyboardCodes:i=HZ,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 bV(t){return!!(t&&"distance"in t)}function _V(t){return!!(t&&"delay"in t)}class QO{constructor(e,n,i){var r;i===void 0&&(i=q5e(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=hm(s),this.documentListeners=new r0(this.document),this.listeners=new r0(i),this.windowListeners=new r0(za(s)),this.initialCoordinates=(r=gN(a))!=null?r:go,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(Cs.Resize,this.handleCancel),this.windowListeners.add(Cs.DragStart,yV),this.windowListeners.add(Cs.VisibilityChange,this.handleCancel),this.windowListeners.add(Cs.ContextMenu,yV),this.documentListeners.add(Cs.Keydown,this.handleKeydown),n){if(i!=null&&i({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(_V(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(bV(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(Cs.Click,X5e,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Cs.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=gN(e))!=null?n:go,c=K0(r,l);if(!i&&o){if(bV(o)){if(o.tolerance!=null&&m2(c,o.tolerance))return this.handleCancel();if(m2(c,o.distance))return this.handleStart()}if(_V(o)&&m2(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===pn.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}}const K5e={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class eL extends QO{constructor(e){const{event:n}=e,i=hm(n.target);super(e,K5e,i)}}eL.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 Z5e={move:{name:"mousemove"},end:{name:"mouseup"}};var xN;(function(t){t[t.RightClick=2]="RightClick"})(xN||(xN={}));class J5e extends QO{constructor(e){super(e,Z5e,hm(e.event.target))}}J5e.activators=[{eventName:"onMouseDown",handler:(t,e)=>{let{nativeEvent:n}=t,{onActivation:i}=e;return n.button===xN.RightClick?!1:(i?.({event:n}),!0)}}];const g2={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class Q5e extends QO{constructor(e){super(e,g2)}static setup(){return window.addEventListener(g2.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(g2.move.name,e)};function e(){}}}Q5e.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 a0;(function(t){t[t.Pointer=0]="Pointer",t[t.DraggableRect=1]="DraggableRect"})(a0||(a0={}));var Q1;(function(t){t[t.TreeOrder=0]="TreeOrder",t[t.ReversedTreeOrder=1]="ReversedTreeOrder"})(Q1||(Q1={}));function eje(t){let{acceleration:e,activator:n=a0.Pointer,canScroll:i,draggingRect:r,enabled:a,interval:s=5,order:o=Q1.TreeOrder,pointerCoordinates:l,scrollableAncestors:c,scrollableAncestorRects:d,delta:f,threshold:p}=t;const m=nje({delta:f,disabled:!a}),[y,b]=f5e(),x=C.useRef({x:0,y:0}),v=C.useRef({x:0,y:0}),M=C.useMemo(()=>{switch(n){case a0.Pointer:return l?{top:l.y,bottom:l.y,left:l.x,right:l.x}:null;case a0.DraggableRect:return r}},[n,r,l]),w=C.useRef(null),E=C.useCallback(()=>{const P=w.current;if(!P)return;const R=x.current.x*v.current.x,U=x.current.y*v.current.y;P.scrollBy(R,U)},[]),T=C.useMemo(()=>o===Q1.TreeOrder?[...c].reverse():c,[o,c]);C.useEffect(()=>{if(!a||!c.length||!M){b();return}for(const P of T){if(i?.(P)===!1)continue;const R=c.indexOf(P),U=d[R];if(!U)continue;const{direction:N,speed:O}=j5e(P,U,M,e,p);for(const B of["x","y"])m[B][N[B]]||(O[B]=0,N[B]=0);if(O.x>0||O.y>0){b(),w.current=P,y(E,s),x.current=O,v.current=N;return}}x.current={x:0,y:0},v.current={x:0,y:0},b()},[e,E,i,b,a,s,JSON.stringify(M),JSON.stringify(m),y,c,T,d,JSON.stringify(p)])}const tje={x:{[br.Backward]:!1,[br.Forward]:!1},y:{[br.Backward]:!1,[br.Forward]:!1}};function nje(t){let{delta:e,disabled:n}=t;const i=mN(e);return Fv(r=>{if(n||!i||!r)return tje;const a={x:Math.sign(e.x-i.x),y:Math.sign(e.y-i.y)};return{x:{[br.Backward]:r.x[br.Backward]||a.x===-1,[br.Forward]:r.x[br.Forward]||a.x===1},y:{[br.Backward]:r.y[br.Backward]||a.y===-1,[br.Forward]:r.y[br.Forward]||a.y===1}}},[n,e,i])}function ije(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 rje(t,e){return C.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 J0;(function(t){t[t.Always=0]="Always",t[t.BeforeDragging=1]="BeforeDragging",t[t.WhileDragging=2]="WhileDragging"})(J0||(J0={}));var yN;(function(t){t.Optimized="optimized"})(yN||(yN={}));const SV=new Map;function aje(t,e){let{dragging:n,dependencies:i,config:r}=e;const[a,s]=C.useState(null),{frequency:o,measure:l,strategy:c}=r,d=C.useRef(t),f=x(),p=Y0(f),m=C.useCallback(function(v){v===void 0&&(v=[]),!p.current&&s(M=>M===null?v:M.concat(v.filter(w=>!M.includes(w))))},[p]),y=C.useRef(null),b=Fv(v=>{if(f&&!n)return SV;if(!v||v===SV||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 E=w.node.current,T=E?new ZO(l(E),E):null;w.rect.current=T,T&&M.set(w.id,T)}return M}return v},[t,a,n,f,l]);return C.useEffect(()=>{d.current=t},[t]),C.useEffect(()=>{f||m()},[n,f]),C.useEffect(()=>{a&&a.length>0&&s(null)},[JSON.stringify(a)]),C.useEffect(()=>{f||typeof o!="number"||y.current!==null||(y.current=setTimeout(()=>{m(),y.current=null},o))},[o,f,m,...i]),{droppableRects:b,measureDroppableContainers:m,measuringScheduled:a!=null};function x(){switch(c){case J0.Always:return!1;case J0.BeforeDragging:return n;default:return!n}}}function VZ(t,e){return Fv(n=>t?n||(typeof e=="function"?e(t):t):null,[e,t])}function sje(t,e){return VZ(t,e)}function oje(t){let{callback:e,disabled:n}=t;const i=YO(e),r=C.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:a}=window;return new a(i)},[i,n]);return C.useEffect(()=>()=>r?.disconnect(),[r]),r}function Mw(t){let{callback:e,disabled:n}=t;const i=YO(e),r=C.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:a}=window;return new a(i)},[n]);return C.useEffect(()=>()=>r?.disconnect(),[r]),r}function lje(t){return new ZO(pm(t),t)}function wV(t,e,n){e===void 0&&(e=lje);const[i,r]=C.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=oje({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=Mw({callback:a});return Wo(()=>{a(),t?(o?.observe(t),s?.observe(document.body,{childList:!0,subtree:!0})):(o?.disconnect(),s?.disconnect())},[t]),i}function cje(t){const e=VZ(t);return kZ(t,e)}const MV=[];function uje(t){const e=C.useRef(t),n=Fv(i=>t?i&&i!==MV&&t&&e.current&&t.parentNode===e.current.parentNode?i:ww(t):MV,[t]);return C.useEffect(()=>{e.current=t},[t]),n}function dje(t){const[e,n]=C.useState(null),i=C.useRef(t),r=C.useCallback(a=>{const s=p2(a.target);s&&n(o=>o?(o.set(s,vN(s)),new Map(o)):null)},[]);return C.useEffect(()=>{const a=i.current;if(t!==a){s(a);const o=t.map(l=>{const c=p2(l);return c?(c.addEventListener("scroll",r,{passive:!0}),[c,vN(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=p2(l);c?.removeEventListener("scroll",r)})}},[r,t]),C.useMemo(()=>t.length?e?Array.from(e.values()).reduce((a,s)=>mp(a,s),go):jZ(t):go,[t,e])}function EV(t,e){e===void 0&&(e=[]);const n=C.useRef(null);return C.useEffect(()=>{n.current=null},e),C.useEffect(()=>{const i=t!==go;i&&!n.current&&(n.current=t),!i&&n.current&&(n.current=null)},[t]),n.current?K0(t,n.current):go}function fje(t){C.useEffect(()=>{if(!Sw)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 hje(t,e){return C.useMemo(()=>t.reduce((n,i)=>{let{eventName:r,handler:a}=i;return n[r]=s=>{a(s,e)},n},{}),[t,e])}function GZ(t){return C.useMemo(()=>t?U5e(t):null,[t])}const AV=[];function pje(t,e){e===void 0&&(e=pm);const[n]=t,i=GZ(n?za(n):null),[r,a]=C.useState(AV);function s(){a(()=>t.length?t.map(l=>zZ(l)?i:new ZO(e(l),l)):AV)}const o=Mw({callback:s});return Wo(()=>{o?.disconnect(),s(),t.forEach(l=>o?.observe(l))},[t]),r}function mje(t){if(!t)return null;if(t.children.length>1)return t;const e=t.children[0];return Uv(e)?e:t}function gje(t){let{measure:e}=t;const[n,i]=C.useState(null),r=C.useCallback(c=>{for(const{target:d}of c)if(Uv(d)){i(f=>{const p=e(d);return f?{...f,width:p.width,height:p.height}:p});break}},[e]),a=Mw({callback:r}),s=C.useCallback(c=>{const d=mje(c);a?.disconnect(),d&&a?.observe(d),i(d?e(d):null)},[e,a]),[o,l]=Z1(s);return C.useMemo(()=>({nodeRef:o,rect:n,setRef:l}),[n,o,l])}const vje=[{sensor:eL,options:{}},{sensor:JO,options:{}}],xje={current:{}},Yb={draggable:{measure:xV},droppable:{measure:xV,strategy:J0.WhileDragging,frequency:yN.Optimized},dragOverlay:{measure:pm}};class s0 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 yje={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new s0,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:J1},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Yb,measureDroppableContainers:J1,windowRect:null,measuringScheduled:!1},bje={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:J1,draggableNodes:new Map,over:null,measureDroppableContainers:J1},Ew=C.createContext(bje),$Z=C.createContext(yje);function _je(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new s0}}}function Sje(t,e){switch(e.type){case Qi.DragStart:return{...t,draggable:{...t.draggable,initialCoordinates:e.initialCoordinates,active:e.active}};case Qi.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 Qi.DragEnd:case Qi.DragCancel:return{...t,draggable:{...t.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Qi.RegisterDroppable:{const{element:n}=e,{id:i}=n,r=new s0(t.droppable.containers);return r.set(i,n),{...t,droppable:{...t.droppable,containers:r}}}case Qi.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 s0(t.droppable.containers);return s.set(n,{...a,disabled:r}),{...t,droppable:{...t.droppable,containers:s}}}case Qi.UnregisterDroppable:{const{id:n,key:i}=e,r=t.droppable.containers.get(n);if(!r||i!==r.key)return t;const a=new s0(t.droppable.containers);return a.delete(n),{...t,droppable:{...t.droppable,containers:a}}}default:return t}}function wje(t){let{disabled:e}=t;const{active:n,activatorEvent:i,draggableNodes:r}=C.useContext(Ew),a=mN(i),s=mN(n?.id);return C.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=m5e(d);if(f){f.focus();break}}})}},[i,e,r,s,a]),null}function Mje(t,e){let{transform:n,...i}=e;return t!=null&&t.length?t.reduce((r,a)=>a({transform:r,...i}),n):n}function Eje(t){return C.useMemo(()=>({draggable:{...Yb.draggable,...t?.draggable},droppable:{...Yb.droppable,...t?.droppable},dragOverlay:{...Yb.dragOverlay,...t?.dragOverlay}}),[t?.draggable,t?.droppable,t?.dragOverlay])}function Aje(t){let{activeNode:e,measure:n,initialRect:i,config:r=!0}=t;const a=C.useRef(!1),{x:s,y:o}=typeof r=="boolean"?{x:r,y:r}:r;Wo(()=>{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=kZ(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 p=IZ(c);p&&p.scrollBy({top:f.y,left:f.x})}},[e,s,o,i,n])}const WZ=C.createContext({...go,scaleX:1,scaleY:1});var lu;(function(t){t[t.Uninitialized=0]="Uninitialized",t[t.Initializing=1]="Initializing",t[t.Initialized=2]="Initialized"})(lu||(lu={}));const Tje=C.memo(function(e){var n,i,r,a;let{id:s,accessibility:o,autoScroll:l=!0,children:c,sensors:d=vje,collisionDetection:f=N5e,measuring:p,modifiers:m,...y}=e;const b=C.useReducer(Sje,void 0,_je),[x,v]=b,[M,w]=_5e(),[E,T]=C.useState(lu.Uninitialized),P=E===lu.Initialized,{draggable:{active:R,nodes:U,translate:N},droppable:{containers:O}}=x,B=R!=null?U.get(R):null,I=C.useRef({initial:null,translated:null}),W=C.useMemo(()=>{var Le;return R!=null?{id:R,data:(Le=B?.data)!=null?Le:xje,rect:I}:null},[R,B]),L=C.useRef(null),[$,q]=C.useState(null),[G,Y]=C.useState(null),Q=Y0(y,Object.values(y)),se=zv("DndDescribedBy",s),H=C.useMemo(()=>O.getEnabled(),[O]),X=Eje(p),{droppableRects:re,measureDroppableContainers:ce,measuringScheduled:ye}=aje(H,{dragging:P,dependencies:[N.x,N.y],config:X.droppable}),me=ije(U,R),be=C.useMemo(()=>G?gN(G):null,[G]),De=de(),he=sje(me,X.draggable.measure);Aje({activeNode:R!=null?U.get(R):null,config:De.layoutShiftCompensation,initialRect:he,measure:X.draggable.measure});const Ae=wV(me,X.draggable.measure,he),Be=wV(me?me.parentElement:null),le=C.useRef({activatorEvent:null,active:null,activeNode:me,collisionRect:null,collisions:null,droppableRects:re,draggableNodes:U,draggingNode:null,draggingNodeRect:null,droppableContainers:O,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),ut=O.getNodeFor((n=le.current.over)==null?void 0:n.id),z=gje({measure:X.dragOverlay.measure}),V=(i=z.nodeRef.current)!=null?i:me,ne=P?(r=z.rect)!=null?r:Ae:null,J=!!(z.nodeRef.current&&z.rect),ee=cje(J?null:Ae),ae=GZ(V?za(V):null),ie=uje(P?ut??me:null),we=pje(ie),ve=Mje(m,{transform:{x:N.x-ee.x,y:N.y-ee.y,scaleX:1,scaleY:1},activatorEvent:G,active:W,activeNodeRect:Ae,containerNodeRect:Be,draggingNodeRect:ne,over:le.current.over,overlayNodeRect:z.rect,scrollableAncestors:ie,scrollableAncestorRects:we,windowRect:ae}),F=be?mp(be,N):null,k=dje(ie),K=EV(k),pe=EV(k,[Ae]),xe=mp(ve,K),fe=ne?O5e(ne,ve):null,Ke=W&&fe?f({active:W,collisionRect:fe,droppableRects:re,droppableContainers:H,pointerCoordinates:F}):null,ke=LZ(Ke,"id"),[$e,rt]=C.useState(null),Ue=J?ve:mp(ve,pe),Pe=P5e(Ue,(a=$e?.rect)!=null?a:null,Ae),dt=C.useRef(null),et=C.useCallback((Le,Ee)=>{let{sensor:ge,options:je}=Ee;if(L.current==null)return;const at=U.get(L.current);if(!at)return;const yt=Le.nativeEvent,Ct=new ge({active:L.current,activeNode:at,event:yt,options:je,context:le,onAbort(Pt){if(!U.get(Pt))return;const{onDragAbort:zn}=Q.current,ur={id:Pt};zn?.(ur),M({type:"onDragAbort",event:ur})},onPending(Pt,wn,zn,ur){if(!U.get(Pt))return;const{onDragPending:dr}=Q.current,Ar={id:Pt,constraint:wn,initialCoordinates:zn,offset:ur};dr?.(Ar),M({type:"onDragPending",event:Ar})},onStart(Pt){const wn=L.current;if(wn==null)return;const zn=U.get(wn);if(!zn)return;const{onDragStart:ur}=Q.current,Xi={activatorEvent:yt,active:{id:wn,data:zn.data,rect:I}};Il.unstable_batchedUpdates(()=>{ur?.(Xi),T(lu.Initializing),v({type:Qi.DragStart,initialCoordinates:Pt,active:wn}),M({type:"onDragStart",event:Xi}),q(dt.current),Y(yt)})},onMove(Pt){v({type:Qi.DragMove,coordinates:Pt})},onEnd:tn(Qi.DragEnd),onCancel:tn(Qi.DragCancel)});dt.current=Ct;function tn(Pt){return async function(){const{active:zn,collisions:ur,over:Xi,scrollAdjustedTranslate:dr}=le.current;let Ar=null;if(zn&&dr){const{cancelDrop:Vr}=Q.current;Ar={activatorEvent:yt,active:zn,collisions:ur,delta:dr,over:Xi},Pt===Qi.DragEnd&&typeof Vr=="function"&&await Promise.resolve(Vr(Ar))&&(Pt=Qi.DragCancel)}L.current=null,Il.unstable_batchedUpdates(()=>{v({type:Pt}),T(lu.Uninitialized),rt(null),q(null),Y(null),dt.current=null;const Vr=Pt===Qi.DragEnd?"onDragEnd":"onDragCancel";if(Ar){const Di=Q.current[Vr];Di?.(Ar),M({type:Vr,event:Ar})}})}}},[U]),Qe=C.useCallback((Le,Ee)=>(ge,je)=>{const at=ge.nativeEvent,yt=U.get(je);if(L.current!==null||!yt||at.dndKit||at.defaultPrevented)return;const Ct={active:yt};Le(ge,Ee.options,Ct)===!0&&(at.dndKit={capturedBy:Ee.sensor},L.current=je,et(ge,Ee))},[U,et]),st=rje(d,Qe);fje(d),Wo(()=>{Ae&&E===lu.Initializing&&T(lu.Initialized)},[Ae,E]),C.useEffect(()=>{const{onDragMove:Le}=Q.current,{active:Ee,activatorEvent:ge,collisions:je,over:at}=le.current;if(!Ee||!ge)return;const yt={active:Ee,activatorEvent:ge,collisions:je,delta:{x:xe.x,y:xe.y},over:at};Il.unstable_batchedUpdates(()=>{Le?.(yt),M({type:"onDragMove",event:yt})})},[xe.x,xe.y]),C.useEffect(()=>{const{active:Le,activatorEvent:Ee,collisions:ge,droppableContainers:je,scrollAdjustedTranslate:at}=le.current;if(!Le||L.current==null||!Ee||!at)return;const{onDragOver:yt}=Q.current,Ct=je.get(ke),tn=Ct&&Ct.rect.current?{id:Ct.id,rect:Ct.rect.current,data:Ct.data,disabled:Ct.disabled}:null,Pt={active:Le,activatorEvent:Ee,collisions:ge,delta:{x:at.x,y:at.y},over:tn};Il.unstable_batchedUpdates(()=>{rt(tn),yt?.(Pt),M({type:"onDragOver",event:Pt})})},[ke]),Wo(()=>{le.current={activatorEvent:G,active:W,activeNode:me,collisionRect:fe,collisions:Ke,droppableRects:re,draggableNodes:U,draggingNode:V,draggingNodeRect:ne,droppableContainers:O,over:$e,scrollableAncestors:ie,scrollAdjustedTranslate:xe},I.current={initial:ne,translated:fe}},[W,me,Ke,fe,U,V,ne,re,O,$e,ie,xe]),eje({...De,delta:N,draggingRect:fe,pointerCoordinates:F,scrollableAncestors:ie,scrollableAncestorRects:we});const ue=C.useMemo(()=>({active:W,activeNode:me,activeNodeRect:Ae,activatorEvent:G,collisions:Ke,containerNodeRect:Be,dragOverlay:z,draggableNodes:U,droppableContainers:O,droppableRects:re,over:$e,measureDroppableContainers:ce,scrollableAncestors:ie,scrollableAncestorRects:we,measuringConfiguration:X,measuringScheduled:ye,windowRect:ae}),[W,me,Ae,G,Ke,Be,z,U,O,re,$e,ce,ie,we,X,ye,ae]),tt=C.useMemo(()=>({activatorEvent:G,activators:st,active:W,activeNodeRect:Ae,ariaDescribedById:{draggable:se},dispatch:v,draggableNodes:U,over:$e,measureDroppableContainers:ce}),[G,st,W,Ae,v,se,U,$e,ce]);return yi.createElement(PZ.Provider,{value:w},yi.createElement(Ew.Provider,{value:tt},yi.createElement($Z.Provider,{value:ue},yi.createElement(WZ.Provider,{value:Pe},c)),yi.createElement(wje,{disabled:o?.restoreFocus===!1})),yi.createElement(M5e,{...o,hiddenTextDescribedById:se}));function de(){const Le=$?.autoScrollEnabled===!1,Ee=typeof l=="object"?l.enabled===!1:l===!1,ge=P&&!Le&&!Ee;return typeof l=="object"?{...l,enabled:ge}:{enabled:ge}}}),Cje=C.createContext(null),TV="button",Rje="Draggable";function Nje(t){let{id:e,data:n,disabled:i=!1,attributes:r}=t;const a=zv(Rje),{activators:s,activatorEvent:o,active:l,activeNodeRect:c,ariaDescribedById:d,draggableNodes:f,over:p}=C.useContext(Ew),{role:m=TV,roleDescription:y="draggable",tabIndex:b=0}=r??{},x=l?.id===e,v=C.useContext(x?WZ:Cje),[M,w]=Z1(),[E,T]=Z1(),P=hje(s,e),R=Y0(n);Wo(()=>(f.set(e,{id:e,key:a,node:M,activatorNode:E,data:R}),()=>{const N=f.get(e);N&&N.key===a&&f.delete(e)}),[f,e]);const U=C.useMemo(()=>({role:m,tabIndex:b,"aria-disabled":i,"aria-pressed":x&&m===TV?!0:void 0,"aria-roledescription":y,"aria-describedby":d.draggable}),[i,m,b,x,y,d.draggable]);return{active:l,activatorEvent:o,activeNodeRect:c,attributes:U,isDragging:x,listeners:i?void 0:P,node:M,over:p,setNodeRef:w,setActivatorNodeRef:T,transform:v}}function Pje(){return C.useContext($Z)}const Dje="Droppable",Oje={timeout:25};function Lje(t){let{data:e,disabled:n=!1,id:i,resizeObserverConfig:r}=t;const a=zv(Dje),{active:s,dispatch:o,over:l,measureDroppableContainers:c}=C.useContext(Ew),d=C.useRef({disabled:n}),f=C.useRef(!1),p=C.useRef(null),m=C.useRef(null),{disabled:y,updateMeasurementsFor:b,timeout:x}={...Oje,...r},v=Y0(b??i),M=C.useCallback(()=>{if(!f.current){f.current=!0;return}m.current!=null&&clearTimeout(m.current),m.current=setTimeout(()=>{c(Array.isArray(v.current)?v.current:[v.current]),m.current=null},x)},[x]),w=Mw({callback:M,disabled:y||!s}),E=C.useCallback((U,N)=>{w&&(N&&(w.unobserve(N),f.current=!1),U&&w.observe(U))},[w]),[T,P]=Z1(E),R=Y0(e);return C.useEffect(()=>{!w||!T.current||(w.disconnect(),f.current=!1,w.observe(T.current))},[T,w]),C.useEffect(()=>(o({type:Qi.RegisterDroppable,element:{id:i,key:a,disabled:n,node:T,rect:p,data:R}}),()=>o({type:Qi.UnregisterDroppable,key:a,id:i})),[i]),C.useEffect(()=>{n!==d.current.disabled&&(o({type:Qi.SetDroppableDisabled,id:i,key:a,disabled:n}),d.current.disabled=n)},[i,a,n,o]),{active:s,rect:p,isOver:l?.id===i,node:T,over:l,setNodeRef:P}}function tL(t,e,n){const i=t.slice();return i.splice(n<0?i.length+n:n,0,i.splice(e,1)[0]),i}function kje(t,e){return t.reduce((n,i,r)=>{const a=e.get(i);return a&&(n[r]=a),n},Array(t.length))}function Ab(t){return t!==null&&t>=0}function Ije(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 Uje(t){return typeof t=="boolean"?{draggable:t,droppable:t}:t}const nL=t=>{let{rects:e,activeIndex:n,overIndex:i,index:r}=t;const a=tL(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}},qZ="Sortable",XZ=yi.createContext({activeIndex:-1,containerId:qZ,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:nL,disabled:{draggable:!1,droppable:!1}});function Fje(t){let{children:e,id:n,items:i,strategy:r=nL,disabled:a=!1}=t;const{active:s,dragOverlay:o,droppableRects:l,over:c,measureDroppableContainers:d}=Pje(),f=zv(qZ,n),p=o.rect!==null,m=C.useMemo(()=>i.map(P=>typeof P=="object"&&"id"in P?P.id:P),[i]),y=s!=null,b=s?m.indexOf(s.id):-1,x=c?m.indexOf(c.id):-1,v=C.useRef(m),M=!Ije(m,v.current),w=x!==-1&&b===-1||M,E=Uje(a);Wo(()=>{M&&y&&d(m)},[M,m,y,d]),C.useEffect(()=>{v.current=m},[m]);const T=C.useMemo(()=>({activeIndex:b,containerId:f,disabled:E,disableTransforms:w,items:m,overIndex:x,useDragOverlay:p,sortedRects:kje(m,l),strategy:r}),[b,f,E.draggable,E.droppable,w,m,x,l,p,r]);return yi.createElement(XZ.Provider,{value:T},e)}const zje=t=>{let{id:e,items:n,activeIndex:i,overIndex:r}=t;return tL(n,i,r).indexOf(e)},Bje=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},jje={duration:200,easing:"ease"},YZ="transform",Hje=Z0.Transition.toString({property:YZ,duration:0,easing:"linear"}),Vje={roleDescription:"sortable"};function Gje(t){let{disabled:e,index:n,node:i,rect:r}=t;const[a,s]=C.useState(null),o=C.useRef(n);return Wo(()=>{if(!e&&n!==o.current&&i.current){const l=r.current;if(l){const c=pm(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]),C.useEffect(()=>{a&&s(null)},[a]),a}function $je(t){let{animateLayoutChanges:e=Bje,attributes:n,disabled:i,data:r,getNewIndex:a=zje,id:s,strategy:o,resizeObserverConfig:l,transition:c=jje}=t;const{items:d,containerId:f,activeIndex:p,disabled:m,disableTransforms:y,sortedRects:b,overIndex:x,useDragOverlay:v,strategy:M}=C.useContext(XZ),w=Wje(i,m),E=d.indexOf(s),T=C.useMemo(()=>({sortable:{containerId:f,index:E,items:d},...r}),[f,r,E,d]),P=C.useMemo(()=>d.slice(d.indexOf(s)),[d,s]),{rect:R,node:U,isOver:N,setNodeRef:O}=Lje({id:s,data:T,disabled:w.droppable,resizeObserverConfig:{updateMeasurementsFor:P,...l}}),{active:B,activatorEvent:I,activeNodeRect:W,attributes:L,setNodeRef:$,listeners:q,isDragging:G,over:Y,setActivatorNodeRef:Q,transform:se}=Nje({id:s,data:T,attributes:{...Vje,...n},disabled:w.draggable}),H=d5e(O,$),X=!!B,re=X&&!y&&Ab(p)&&Ab(x),ce=!v&&G,ye=ce&&re?se:null,be=re?ye??(o??M)({rects:b,activeNodeRect:W,activeIndex:p,overIndex:x,index:E}):null,De=Ab(p)&&Ab(x)?a({id:s,items:d,activeIndex:p,overIndex:x}):E,he=B?.id,Ae=C.useRef({activeId:he,items:d,newIndex:De,containerId:f}),Be=d!==Ae.current.items,le=e({active:B,containerId:f,isDragging:G,isSorting:X,id:s,index:E,items:d,newIndex:Ae.current.newIndex,previousItems:Ae.current.items,previousContainerId:Ae.current.containerId,transition:c,wasDragging:Ae.current.activeId!=null}),ut=Gje({disabled:!le,index:E,node:U,rect:R});return C.useEffect(()=>{X&&Ae.current.newIndex!==De&&(Ae.current.newIndex=De),f!==Ae.current.containerId&&(Ae.current.containerId=f),d!==Ae.current.items&&(Ae.current.items=d)},[X,De,f,d]),C.useEffect(()=>{if(he===Ae.current.activeId)return;if(he!=null&&Ae.current.activeId==null){Ae.current.activeId=he;return}const V=setTimeout(()=>{Ae.current.activeId=he},50);return()=>clearTimeout(V)},[he]),{active:B,activeIndex:p,attributes:L,data:T,rect:R,index:E,newIndex:De,items:d,isOver:N,isSorting:X,isDragging:G,listeners:q,node:U,overIndex:x,over:Y,setNodeRef:H,setActivatorNodeRef:Q,setDroppableNodeRef:O,setDraggableNodeRef:$,transform:ut??be,transition:z()};function z(){if(ut||Be&&Ae.current.newIndex===E)return Hje;if(!(ce&&!KO(I)||!c)&&(X||le))return Z0.Transition.toString({...c,property:YZ})}}function Wje(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 eS(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 qje=[pn.Down,pn.Right,pn.Up,pn.Left],Xje=(t,e)=>{let{context:{active:n,collisionRect:i,droppableRects:r,droppableContainers:a,over:s,scrollableAncestors:o}}=e;if(qje.includes(t.code)){if(t.preventDefault(),!n||!i)return;const l=[];a.getEnabled().forEach(f=>{if(!f||f!=null&&f.disabled)return;const p=r.get(f.id);if(p)switch(t.code){case pn.Down:i.top<p.top&&l.push(f);break;case pn.Up:i.top>p.top&&l.push(f);break;case pn.Left:i.left>p.left&&l.push(f);break;case pn.Right:i.left<p.left&&l.push(f);break}});const c=C5e({collisionRect:i,droppableRects:r,droppableContainers:l});let d=LZ(c,"id");if(d===s?.id&&c.length>1&&(d=c[1].id),d!=null){const f=a.get(n.id),p=a.get(d),m=p?r.get(p.id):null,y=p?.node.current;if(y&&m&&f&&p){const x=ww(y).some((P,R)=>o[R]!==P),v=KZ(f,p),M=Yje(f,p),w=x||!v?{x:0,y:0}:{x:M?i.width-m.width:0,y:M?i.height-m.height:0},E={x:m.left,y:m.top};return w.x&&w.y?E:K0(E,w)}}}};function KZ(t,e){return!eS(t)||!eS(e)?!1:t.data.current.sortable.containerId===e.data.current.sortable.containerId}function Yje(t,e){return!eS(t)||!eS(e)||!KZ(t,e)?!1:t.data.current.sortable.index<e.data.current.sortable.index}function Kje({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:p}=$je({id:t}),m={transform:Z0.Transform.toString(d),transition:f,opacity:p?.5:1};return i?null:S.jsxs("div",{ref:c,style:{...m,gridColumn:`span ${r}`},className:`bg-bambu-dark-secondary rounded-xl border border-bambu-dark-tertiary overflow-hidden ${p?"ring-2 ring-bambu-green shadow-lg":""}`,children:[S.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-bambu-dark-tertiary bg-bambu-dark/30",children:[S.jsxs("div",{className:"flex items-center gap-2",children:[S.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:S.jsx(Cie,{className:"w-4 h-4 text-bambu-gray"})}),S.jsx("h3",{className:"text-sm font-medium text-white",children:e})]}),S.jsxs("div",{className:"flex items-center gap-1",children:[S.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?S.jsx(Qie,{className:"w-4 h-4 text-bambu-gray hover:text-white"}):S.jsx(Zie,{className:"w-4 h-4 text-bambu-gray hover:text-white"})}),S.jsx("button",{onClick:a,className:"p-1 hover:bg-bambu-dark-tertiary rounded transition-colors",title:"Hide widget",children:S.jsx(uie,{className:"w-4 h-4 text-bambu-gray hover:text-white"})})]})]}),S.jsx("div",{className:"p-4",children:n})]})}function Zje({widgets:t,storageKey:e,columns:n=4}){const i=()=>{const x={};return t.forEach(v=>{x[v.id]=v.defaultSize||4}),x},[r,a]=C.useState(()=>{const x=localStorage.getItem(e);if(x)try{const v=JSON.parse(x);return v.sizes||(v.sizes=i()),v}catch{}return{order:t.map(v=>v.id),hidden:t.filter(v=>v.defaultVisible===!1).map(v=>v.id),sizes:i()}}),[s,o]=C.useState(!1);C.useEffect(()=>{localStorage.setItem(e,JSON.stringify(r))},[r,e]),C.useEffect(()=>{const v=t.map(M=>M.id).filter(M=>!r.order.includes(M));v.length>0&&a(M=>({...M,order:[...M.order,...v]}))},[t,r.order]);const l=E5e(mV(eL,{activationConstraint:{distance:8}}),mV(JO,{coordinateGetter:Xje})),c=x=>{const{active:v,over:M}=x;M&&v.id!==M.id&&a(w=>{const E=w.order.indexOf(v.id),T=w.order.indexOf(M.id);return{...w,order:tL(w.order,E,T)}})},d=x=>{a(v=>({...v,hidden:v.hidden.includes(x)?v.hidden.filter(M=>M!==x):[...v.hidden,x]}))},f=x=>{a(v=>{const M=v.sizes[x]||4,w=M===1?2:M===2?4:1;return{...v,sizes:{...v.sizes,[x]:w}}})},p=()=>{const x={order:t.map(v=>v.id),hidden:t.filter(v=>v.defaultVisible===!1).map(v=>v.id),sizes:i()};a(x)},m=r.order.map(x=>t.find(v=>v.id===x)).filter(Boolean),y=m.filter(x=>!r.hidden.includes(x.id)),b=m.filter(x=>r.hidden.includes(x.id));return S.jsxs("div",{className:"space-y-4",children:[S.jsxs("div",{className:"flex items-center justify-end gap-2",children:[b.length>0&&S.jsxs(xt,{variant:"secondary",size:"sm",onClick:()=>o(!s),children:[S.jsx(d4,{className:"w-4 h-4"}),b.length," Hidden"]}),S.jsxs(xt,{variant:"secondary",size:"sm",onClick:p,children:[S.jsx(fG,{className:"w-4 h-4"}),"Reset Layout"]})]}),s&&b.length>0&&S.jsxs("div",{className:"p-4 bg-bambu-dark rounded-xl border border-bambu-dark-tertiary",children:[S.jsx("p",{className:"text-sm text-bambu-gray mb-3",children:"Hidden widgets (click to show):"}),S.jsx("div",{className:"flex flex-wrap gap-2",children:b.map(x=>S.jsxs("button",{onClick:()=>d(x.id),className:"px-3 py-1.5 bg-bambu-dark-tertiary hover:bg-bambu-green/20 rounded-lg text-sm text-white transition-colors flex items-center gap-2",children:[S.jsx(d4,{className:"w-3 h-3"}),x.title]},x.id))})]}),S.jsx(Tje,{sensors:l,collisionDetection:T5e,onDragEnd:c,children:S.jsx(Fje,{items:y.map(x=>x.id),strategy:nL,children:S.jsx("div",{className:"grid gap-6",style:{gridTemplateColumns:`repeat(${n}, minmax(0, 1fr))`},children:y.map(x=>S.jsx(Kje,{id:x.id,title:x.title,isHidden:r.hidden.includes(x.id),size:r.sizes[x.id]||2,onToggleVisibility:()=>d(x.id),onToggleSize:()=>f(x.id),children:x.component},x.id))})})}),y.length===0&&S.jsxs("div",{className:"text-center py-12 text-bambu-gray",children:[S.jsx("p",{children:"All widgets are hidden."}),S.jsx(xt,{className:"mt-4",onClick:p,children:"Reset Layout"})]})]})}function Jje({stats:t,currency:e}){return S.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[S.jsxs("div",{className:"flex items-start gap-3",children:[S.jsx("div",{className:"p-2 rounded-lg bg-bambu-dark text-bambu-green",children:S.jsx(Qb,{className:"w-5 h-5"})}),S.jsxs("div",{children:[S.jsx("p",{className:"text-xs text-bambu-gray",children:"Total Prints"}),S.jsx("p",{className:"text-xl font-bold text-white",children:t?.total_prints||0})]})]}),S.jsxs("div",{className:"flex items-start gap-3",children:[S.jsx("div",{className:"p-2 rounded-lg bg-bambu-dark text-blue-400",children:S.jsx(nv,{className:"w-5 h-5"})}),S.jsxs("div",{children:[S.jsx("p",{className:"text-xs text-bambu-gray",children:"Print Time"}),S.jsxs("p",{className:"text-xl font-bold text-white",children:[t?.total_print_time_hours.toFixed(1)||0,"h"]})]})]}),S.jsxs("div",{className:"flex items-start gap-3",children:[S.jsx("div",{className:"p-2 rounded-lg bg-bambu-dark text-orange-400",children:S.jsx(Qb,{className:"w-5 h-5"})}),S.jsxs("div",{children:[S.jsx("p",{className:"text-xs text-bambu-gray",children:"Filament Used"}),S.jsxs("p",{className:"text-xl font-bold text-white",children:[((t?.total_filament_grams||0)/1e3).toFixed(2),"kg"]})]})]}),S.jsxs("div",{className:"flex items-start gap-3",children:[S.jsx("div",{className:"p-2 rounded-lg bg-bambu-dark text-green-400",children:S.jsx(nie,{className:"w-5 h-5"})}),S.jsxs("div",{children:[S.jsx("p",{className:"text-xs text-bambu-gray",children:"Total Cost"}),S.jsxs("p",{className:"text-xl font-bold text-white",children:[e," ",t?.total_cost.toFixed(2)||"0.00"]})]})]})]})}function Qje({stats:t}){const e=t?.total_prints?Math.round(t.successful_prints/t.total_prints*100):0;return S.jsxs("div",{className:"flex items-center gap-6",children:[S.jsxs("div",{className:"relative w-28 h-28",children:[S.jsxs("svg",{className:"w-full h-full -rotate-90",children:[S.jsx("circle",{cx:"56",cy:"56",r:"48",fill:"none",stroke:"#3d3d3d",strokeWidth:"10"}),S.jsx("circle",{cx:"56",cy:"56",r:"48",fill:"none",stroke:"#00ae42",strokeWidth:"10",strokeLinecap:"round",strokeDasharray:`${e*3.02} 302`})]}),S.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:S.jsxs("span",{className:"text-xl font-bold text-white",children:[e,"%"]})})]}),S.jsxs("div",{className:"space-y-2",children:[S.jsxs("div",{className:"flex items-center gap-2",children:[S.jsx(iS,{className:"w-4 h-4 text-bambu-green"}),S.jsx("span",{className:"text-sm text-bambu-gray",children:"Successful:"}),S.jsx("span",{className:"text-sm text-white font-medium",children:t?.successful_prints||0})]}),S.jsxs("div",{className:"flex items-center gap-2",children:[S.jsx(sG,{className:"w-4 h-4 text-red-400"}),S.jsx("span",{className:"text-sm text-bambu-gray",children:"Failed:"}),S.jsx("span",{className:"text-sm text-white font-medium",children:t?.failed_prints||0})]})]})]})}function eHe({stats:t,printerMap:e}){const n=t?.average_time_accuracy;if(n==null)return S.jsx("div",{className:"flex items-center justify-center h-full",children:S.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 S.jsxs("div",{className:"flex items-center gap-6",children:[S.jsxs("div",{className:"relative w-28 h-28",children:[S.jsxs("svg",{className:"w-full h-full -rotate-90",children:[S.jsx("circle",{cx:"56",cy:"56",r:"48",fill:"none",stroke:"#3d3d3d",strokeWidth:"10"}),S.jsx("circle",{cx:"56",cy:"56",r:"48",fill:"none",stroke:s,strokeWidth:"10",strokeLinecap:"round",strokeDasharray:`${r*3.02} 302`})]}),S.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center",children:[S.jsxs("span",{className:"text-xl font-bold text-white",children:[n.toFixed(0),"%"]}),S.jsxs("span",{className:`text-xs ${o>=0?"text-blue-400":"text-orange-400"}`,children:[o>=0?"+":"",o.toFixed(0),"%"]})]})]}),S.jsxs("div",{className:"space-y-2 flex-1",children:[S.jsxs("div",{className:"flex items-center gap-2 text-xs text-bambu-gray",children:[S.jsx(Bre,{className:"w-3 h-3"}),S.jsx("span",{children:"100% = perfect estimate"})]}),t?.time_accuracy_by_printer&&Object.keys(t.time_accuracy_by_printer).length>0&&S.jsx("div",{className:"space-y-1 mt-2",children:Object.entries(t.time_accuracy_by_printer).slice(0,3).map(([l,c])=>S.jsxs("div",{className:"flex items-center justify-between text-xs",children:[S.jsx("span",{className:"text-bambu-gray truncate max-w-[100px]",children:e.get(l)||`Printer ${l}`}),S.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 tHe({stats:t}){if(!t?.prints_by_filament_type||Object.keys(t.prints_by_filament_type).length===0)return S.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 S.jsx("div",{className:"space-y-3",children:e.map(([n,i])=>{const r=Math.round(i/(t.total_prints||1)*100);return S.jsxs("div",{children:[S.jsxs("div",{className:"flex justify-between text-sm mb-1",children:[S.jsx("span",{className:"text-white",children:n}),S.jsxs("span",{className:"text-bambu-gray",children:[i," prints"]})]}),S.jsx("div",{className:"h-2 bg-bambu-dark rounded-full",children:S.jsx("div",{className:"h-full bg-bambu-green rounded-full transition-all",style:{width:`${r}%`}})})]},n)})})}function nHe({printDates:t}){return S.jsx(iEe,{printDates:t,months:4})}function iHe({stats:t,printerMap:e}){return!t?.prints_by_printer||Object.keys(t.prints_by_printer).length===0?S.jsx("p",{className:"text-bambu-gray text-center py-4",children:"No printer data available"}):S.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:Object.entries(t.prints_by_printer).map(([n,i])=>S.jsxs("div",{className:"flex items-center gap-3 p-3 bg-bambu-dark rounded-lg",children:[S.jsx("div",{className:"p-2 bg-bambu-dark-tertiary rounded-lg",children:S.jsx(rf,{className:"w-4 h-4 text-bambu-green"})}),S.jsxs("div",{children:[S.jsx("p",{className:"text-white font-medium text-sm",children:e.get(n)||`Printer ${n}`}),S.jsxs("p",{className:"text-xs text-bambu-gray",children:[i," prints"]})]})]},n))})}function rHe({archives:t,currency:e}){return!t||t.length===0?S.jsx("p",{className:"text-bambu-gray text-center py-4",children:"No print data available"}):S.jsx(u5e,{archives:t,currency:e})}function aHe(){const{data:t,isLoading:e}=ei({queryKey:["archiveStats"],queryFn:vt.getArchiveStats}),{data:n}=ei({queryKey:["printers"],queryFn:vt.getPrinters}),{data:i}=ei({queryKey:["archives"],queryFn:()=>vt.getArchives(void 0,1e3,0)}),{data:r}=ei({queryKey:["settings"],queryFn:vt.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 S.jsx("div",{className:"p-8",children:S.jsx("div",{className:"text-center py-12 text-bambu-gray",children:"Loading statistics..."})});const l=[{id:"quick-stats",title:"Quick Stats",component:S.jsx(Jje,{stats:t,currency:a}),defaultSize:2},{id:"success-rate",title:"Success Rate",component:S.jsx(Qje,{stats:t}),defaultSize:1},{id:"time-accuracy",title:"Time Accuracy",component:S.jsx(eHe,{stats:t,printerMap:s}),defaultSize:1},{id:"filament-types",title:"Filament Types",component:S.jsx(tHe,{stats:t}),defaultSize:1},{id:"print-activity",title:"Print Activity",component:S.jsx(nHe,{printDates:o}),defaultSize:2},{id:"prints-by-printer",title:"Prints by Printer",component:S.jsx(iHe,{stats:t,printerMap:s}),defaultSize:2},{id:"filament-trends",title:"Filament Usage Trends",component:S.jsx(rHe,{archives:i||[],currency:a}),defaultSize:4}];return S.jsxs("div",{className:"p-8",children:[S.jsxs("div",{className:"mb-6",children:[S.jsx("h1",{className:"text-2xl font-bold text-white",children:"Dashboard"}),S.jsx("p",{className:"text-bambu-gray",children:"Drag widgets to rearrange. Click the eye icon to hide."})]}),S.jsx(Zje,{widgets:l,storageKey:"bambusy-dashboard-layout"})]})}function sHe({plug:t,onEdit:e}){const n=Hr(),[i,r]=C.useState(!1),[a,s]=C.useState(!1),{data:o,isLoading:l,refetch:c}=ei({queryKey:["smart-plug-status",t.id],queryFn:()=>vt.getSmartPlugStatus(t.id),refetchInterval:3e4}),{data:d}=ei({queryKey:["printers"],queryFn:vt.getPrinters}),f=d?.find(M=>M.id===t.printer_id),p=Gn({mutationFn:M=>vt.controlSmartPlug(t.id,M),onSuccess:()=>{c()}}),m=Gn({mutationFn:M=>vt.updateSmartPlug(t.id,M),onSuccess:()=>{n.invalidateQueries({queryKey:["smart-plugs"]})}}),y=Gn({mutationFn:()=>vt.deleteSmartPlug(t.id),onSuccess:()=>{n.invalidateQueries({queryKey:["smart-plugs"]})}}),b=o?.state==="ON",x=o?.reachable??!1,v=p.isPending;return S.jsxs(S.Fragment,{children:[S.jsx(bi,{className:"relative",children:S.jsxs(Ri,{className:"p-4",children:[S.jsxs("div",{className:"flex items-start justify-between mb-3",children:[S.jsxs("div",{className:"flex items-center gap-3",children:[S.jsx("div",{className:`p-2 rounded-lg ${x?b?"bg-bambu-green/20":"bg-bambu-dark":"bg-red-500/20"}`,children:S.jsx(N2,{className:`w-5 h-5 ${x?b?"text-bambu-green":"text-bambu-gray":"text-red-400"}`})}),S.jsxs("div",{children:[S.jsx("h3",{className:"font-medium text-white",children:t.name}),S.jsx("p",{className:"text-sm text-bambu-gray",children:t.ip_address})]})]}),S.jsx("div",{className:"flex items-center gap-2",children:l?S.jsx(ci,{className:"w-4 h-4 text-bambu-gray animate-spin"}):x?S.jsxs("div",{className:"flex items-center gap-1 text-sm",children:[S.jsx(DN,{className:"w-4 h-4 text-bambu-green"}),S.jsx("span",{className:b?"text-bambu-green":"text-bambu-gray",children:o?.state||"Unknown"})]}):S.jsxs("div",{className:"flex items-center gap-1 text-sm text-red-400",children:[S.jsx(PN,{className:"w-4 h-4"}),S.jsx("span",{children:"Offline"})]})})]}),f&&S.jsxs("div",{className:"mb-3 px-2 py-1.5 bg-bambu-dark rounded-lg",children:[S.jsx("span",{className:"text-xs text-bambu-gray",children:"Linked to: "}),S.jsx("span",{className:"text-sm text-white",children:f.name})]}),S.jsxs("div",{className:"flex gap-2 mb-3",children:[S.jsxs(xt,{size:"sm",variant:b?"primary":"secondary",disabled:!x||v,onClick:()=>p.mutate("on"),className:"flex-1",children:[v?S.jsx(ci,{className:"w-4 h-4 animate-spin"}):S.jsx(mre,{className:"w-4 h-4"}),"On"]}),S.jsxs(xt,{size:"sm",variant:b?"secondary":"primary",disabled:!x||v,onClick:()=>p.mutate("off"),className:"flex-1",children:[v?S.jsx(ci,{className:"w-4 h-4 animate-spin"}):S.jsx(hre,{className:"w-4 h-4"}),"Off"]})]}),S.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",children:[S.jsxs("span",{className:"flex items-center gap-2",children:[S.jsx(pG,{className:"w-4 h-4"}),"Automation Settings"]}),S.jsx("span",{children:a?"-":"+"})]}),a&&S.jsxs("div",{className:"pt-3 border-t border-bambu-dark-tertiary space-y-4",children:[S.jsxs("div",{className:"flex items-center justify-between",children:[S.jsxs("div",{children:[S.jsx("p",{className:"text-sm text-white",children:"Enabled"}),S.jsx("p",{className:"text-xs text-bambu-gray",children:"Enable automation for this plug"})]}),S.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[S.jsx("input",{type:"checkbox",checked:t.enabled,onChange:M=>m.mutate({enabled:M.target.checked}),className:"sr-only peer"}),S.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"})]})]}),S.jsxs("div",{className:"flex items-center justify-between",children:[S.jsxs("div",{children:[S.jsx("p",{className:"text-sm text-white",children:"Auto On"}),S.jsx("p",{className:"text-xs text-bambu-gray",children:"Turn on when print starts"})]}),S.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[S.jsx("input",{type:"checkbox",checked:t.auto_on,onChange:M=>m.mutate({auto_on:M.target.checked}),className:"sr-only peer"}),S.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"})]})]}),S.jsxs("div",{className:"flex items-center justify-between",children:[S.jsxs("div",{children:[S.jsx("p",{className:"text-sm text-white",children:"Auto Off"}),S.jsx("p",{className:"text-xs text-bambu-gray",children:"Turn off when print completes"})]}),S.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[S.jsx("input",{type:"checkbox",checked:t.auto_off,onChange:M=>m.mutate({auto_off:M.target.checked}),className:"sr-only peer"}),S.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&&S.jsxs("div",{className:"space-y-3 pl-4 border-l-2 border-bambu-dark-tertiary",children:[S.jsxs("div",{children:[S.jsx("p",{className:"text-sm text-white mb-2",children:"Turn Off Delay Mode"}),S.jsxs("div",{className:"flex gap-2",children:[S.jsxs("button",{onClick:()=>m.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:[S.jsx(nv,{className:"w-4 h-4"}),"Time"]}),S.jsxs("button",{onClick:()=>m.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:[S.jsx(Rb,{className:"w-4 h-4"}),"Temp"]})]})]}),t.off_delay_mode==="time"?S.jsxs("div",{children:[S.jsx("label",{className:"block text-xs text-bambu-gray mb-1",children:"Delay (minutes)"}),S.jsx("input",{type:"number",min:"1",max:"60",value:t.off_delay_minutes,onChange:M=>m.mutate({off_delay_minutes:parseInt(M.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"})]}):S.jsxs("div",{children:[S.jsx("label",{className:"block text-xs text-bambu-gray mb-1",children:"Temperature threshold (C)"}),S.jsx("input",{type:"number",min:"30",max:"100",value:t.off_temp_threshold,onChange:M=>m.mutate({off_temp_threshold:parseInt(M.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"}),S.jsx("p",{className:"text-xs text-bambu-gray mt-1",children:"Turns off when nozzle cools below this temperature"})]})]}),S.jsxs("div",{className:"flex gap-2 pt-2",children:[S.jsxs(xt,{size:"sm",variant:"secondary",onClick:()=>e(t),className:"flex-1",children:[S.jsx(ore,{className:"w-4 h-4"}),"Edit"]}),S.jsx(xt,{size:"sm",variant:"secondary",onClick:()=>r(!0),className:"text-red-400 hover:text-red-300",children:S.jsx(Jl,{className:"w-4 h-4"})})]})]})]})}),i&&S.jsx(qp,{title:"Delete Smart Plug",message:`Are you sure you want to delete "${t.name}"? This cannot be undone.`,confirmText:"Delete",variant:"danger",onConfirm:()=>{y.mutate(),r(!1)},onCancel:()=>r(!1)})]})}function oHe({plug:t,onClose:e}){const n=Hr(),i=!!t,[r,a]=C.useState(t?.name||""),[s,o]=C.useState(t?.ip_address||""),[l,c]=C.useState(t?.username||""),[d,f]=C.useState(t?.password||""),[p,m]=C.useState(t?.printer_id||null),[y,b]=C.useState(null),[x,v]=C.useState(null),{data:M}=ei({queryKey:["printers"],queryFn:vt.getPrinters}),{data:w}=ei({queryKey:["smart-plugs"],queryFn:vt.getSmartPlugs});C.useEffect(()=>{const O=B=>{B.key==="Escape"&&e()};return window.addEventListener("keydown",O),()=>window.removeEventListener("keydown",O)},[e]);const E=Gn({mutationFn:()=>vt.testSmartPlugConnection(s,l||null,d||null),onSuccess:O=>{b(O),v(null),!r&&O.device_name&&a(O.device_name)},onError:O=>{b(null),v(O.message)}}),T=Gn({mutationFn:O=>vt.createSmartPlug(O),onSuccess:()=>{n.invalidateQueries({queryKey:["smart-plugs"]}),e()},onError:O=>{v(O.message)}}),P=Gn({mutationFn:O=>vt.updateSmartPlug(t.id,O),onSuccess:()=>{n.invalidateQueries({queryKey:["smart-plugs"]}),e()},onError:O=>{v(O.message)}}),R=M?.filter(O=>!w?.some(I=>I.printer_id===O.id&&I.id!==t?.id)),U=O=>{if(O.preventDefault(),v(null),!r.trim()){v("Name is required");return}if(!s.trim()){v("IP address is required");return}const B={name:r.trim(),ip_address:s.trim(),username:l.trim()||null,password:d.trim()||null,printer_id:p};i?P.mutate(B):T.mutate(B)},N=T.isPending||P.isPending;return S.jsx("div",{className:"fixed inset-0 bg-black/70 flex items-center justify-center z-50 p-4",onClick:e,children:S.jsxs("div",{className:"bg-bambu-dark-secondary rounded-xl border border-bambu-dark-tertiary w-full max-w-md",onClick:O=>O.stopPropagation(),children:[S.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-bambu-dark-tertiary",children:[S.jsx("h2",{className:"text-lg font-semibold text-white",children:i?"Edit Smart Plug":"Add Smart Plug"}),S.jsx("button",{onClick:e,className:"text-bambu-gray hover:text-white transition-colors",children:S.jsx(_i,{className:"w-5 h-5"})})]}),S.jsxs("form",{onSubmit:U,className:"p-6 space-y-4",children:[x&&S.jsx("div",{className:"p-3 bg-red-500/20 border border-red-500/50 rounded-lg text-sm text-red-400",children:x}),S.jsxs("div",{children:[S.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:"IP Address *"}),S.jsxs("div",{className:"flex gap-2",children:[S.jsx("input",{type:"text",value:s,onChange:O=>{o(O.target.value),b(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"}),S.jsxs(xt,{type:"button",variant:"secondary",onClick:()=>E.mutate(),disabled:!s.trim()||E.isPending,children:[E.isPending?S.jsx(ci,{className:"w-4 h-4 animate-spin"}):S.jsx(DN,{className:"w-4 h-4"}),"Test"]})]})]}),y&&S.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?S.jsxs(S.Fragment,{children:[S.jsx(iS,{className:"w-5 h-5"}),S.jsxs("div",{children:[S.jsx("p",{className:"font-medium",children:"Connected!"}),S.jsxs("p",{className:"text-sm opacity-80",children:[y.device_name&&`Device: ${y.device_name} - `,"State: ",y.state]})]})]}):S.jsxs(S.Fragment,{children:[S.jsx(PN,{className:"w-5 h-5"}),S.jsx("span",{children:"Connection failed"})]})}),S.jsxs("div",{children:[S.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:"Name *"}),S.jsx("input",{type:"text",value:r,onChange:O=>a(O.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"})]}),S.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[S.jsxs("div",{children:[S.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:"Username"}),S.jsx("input",{type:"text",value:l,onChange:O=>c(O.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"})]}),S.jsxs("div",{children:[S.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:"Password"}),S.jsx("input",{type:"password",value:d,onChange:O=>f(O.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"})]})]}),S.jsx("p",{className:"text-xs text-bambu-gray -mt-2",children:"Leave empty if your Tasmota device doesn't require authentication"}),S.jsxs("div",{children:[S.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:"Link to Printer"}),S.jsxs("select",{value:p??"",onChange:O=>m(O.target.value?Number(O.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:[S.jsx("option",{value:"",children:"No printer (manual control only)"}),R?.map(O=>S.jsx("option",{value:O.id,children:O.name},O.id))]}),S.jsx("p",{className:"text-xs text-bambu-gray mt-1",children:"Linking enables automatic on/off when prints start/complete"})]}),S.jsxs("div",{className:"flex gap-3 pt-2",children:[S.jsx(xt,{type:"button",variant:"secondary",onClick:e,className:"flex-1",children:"Cancel"}),S.jsxs(xt,{type:"submit",disabled:N,className:"flex-1",children:[N?S.jsx(ci,{className:"w-4 h-4 animate-spin"}):S.jsx(sS,{className:"w-4 h-4"}),i?"Save":"Add"]})]})]})]})})}function lHe(){const t=Hr(),[e,n]=C.useState(null),[i,r]=C.useState(!1),[a,s]=C.useState(!1),[o,l]=C.useState(!1),[c,d]=C.useState(null),{data:f,isLoading:p}=ei({queryKey:["settings"],queryFn:vt.getSettings}),{data:m,isLoading:y}=ei({queryKey:["smart-plugs"],queryFn:vt.getSmartPlugs});C.useEffect(()=>{f&&!e&&n(f)},[f,e]),C.useEffect(()=>{if(f&&e){const M=f.auto_archive!==e.auto_archive||f.save_thumbnails!==e.save_thumbnails||f.default_filament_cost!==e.default_filament_cost||f.currency!==e.currency;r(M)}},[f,e]);const b=Gn({mutationFn:vt.updateSettings,onSuccess:M=>{t.setQueryData(["settings"],M),n(M),r(!1),s(!0),setTimeout(()=>s(!1),2e3)}}),x=()=>{e&&b.mutate(e)},v=(M,w)=>{e&&n({...e,[M]:w})};return p||!e?S.jsx("div",{className:"p-8 flex justify-center",children:S.jsx(ci,{className:"w-8 h-8 text-bambu-green animate-spin"})}):S.jsxs("div",{className:"p-8",children:[S.jsxs("div",{className:"mb-8 flex items-center justify-between",children:[S.jsxs("div",{children:[S.jsx("h1",{className:"text-2xl font-bold text-white",children:"Settings"}),S.jsx("p",{className:"text-bambu-gray",children:"Configure Bambusy"})]}),S.jsxs(xt,{onClick:x,disabled:!i||b.isPending,children:[b.isPending?S.jsx(ci,{className:"w-4 h-4 animate-spin"}):a?S.jsx(Hne,{className:"w-4 h-4"}):S.jsx(sS,{className:"w-4 h-4"}),a?"Saved!":"Save"]})]}),b.isError&&S.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: ",b.error.message]}),S.jsxs("div",{className:"flex gap-8",children:[S.jsxs("div",{className:"space-y-6 flex-1 max-w-xl",children:[S.jsxs(bi,{children:[S.jsx(Ng,{children:S.jsx("h2",{className:"text-lg font-semibold text-white",children:"Archive Settings"})}),S.jsxs(Ri,{className:"space-y-4",children:[S.jsxs("div",{className:"flex items-center justify-between",children:[S.jsxs("div",{children:[S.jsx("p",{className:"text-white",children:"Auto-archive prints"}),S.jsx("p",{className:"text-sm text-bambu-gray",children:"Automatically save 3MF files when prints complete"})]}),S.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[S.jsx("input",{type:"checkbox",checked:e.auto_archive,onChange:M=>v("auto_archive",M.target.checked),className:"sr-only peer"}),S.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"})]})]}),S.jsxs("div",{className:"flex items-center justify-between",children:[S.jsxs("div",{children:[S.jsx("p",{className:"text-white",children:"Save thumbnails"}),S.jsx("p",{className:"text-sm text-bambu-gray",children:"Extract and save preview images from 3MF files"})]}),S.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[S.jsx("input",{type:"checkbox",checked:e.save_thumbnails,onChange:M=>v("save_thumbnails",M.target.checked),className:"sr-only peer"}),S.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"})]})]})]})]}),S.jsxs(bi,{children:[S.jsx(Ng,{children:S.jsx("h2",{className:"text-lg font-semibold text-white",children:"Cost Tracking"})}),S.jsxs(Ri,{className:"space-y-4",children:[S.jsxs("div",{children:[S.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:"Default filament cost (per kg)"}),S.jsx("input",{type:"number",step:"0.01",min:"0",value:e.default_filament_cost,onChange:M=>v("default_filament_cost",parseFloat(M.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"})]}),S.jsxs("div",{children:[S.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:"Currency"}),S.jsxs("select",{value:e.currency,onChange:M=>v("currency",M.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:[S.jsx("option",{value:"USD",children:"USD ($)"}),S.jsx("option",{value:"EUR",children:"EUR (€)"}),S.jsx("option",{value:"GBP",children:"GBP (£)"}),S.jsx("option",{value:"CHF",children:"CHF (Fr.)"}),S.jsx("option",{value:"JPY",children:"JPY (¥)"}),S.jsx("option",{value:"CNY",children:"CNY (¥)"}),S.jsx("option",{value:"CAD",children:"CAD ($)"}),S.jsx("option",{value:"AUD",children:"AUD ($)"})]})]})]})]}),S.jsxs(bi,{children:[S.jsx(Ng,{children:S.jsx("h2",{className:"text-lg font-semibold text-white",children:"About"})}),S.jsx(Ri,{children:S.jsxs("div",{className:"space-y-2 text-sm",children:[S.jsx("p",{className:"text-white",children:"Bambusy v0.1.2"}),S.jsx("p",{className:"text-bambu-gray",children:"Archive and manage your Bambu Lab 3MF files"}),S.jsx("p",{className:"text-bambu-gray",children:"Connect to printers via LAN mode (developer mode required)"})]})})]})]}),S.jsx("div",{className:"w-96 flex-shrink-0",children:S.jsxs(bi,{children:[S.jsx(Ng,{children:S.jsxs("div",{className:"flex items-center justify-between",children:[S.jsxs("div",{className:"flex items-center gap-2",children:[S.jsx(N2,{className:"w-5 h-5 text-bambu-green"}),S.jsx("h2",{className:"text-lg font-semibold text-white",children:"Smart Plugs"})]}),S.jsxs(xt,{size:"sm",onClick:()=>{d(null),l(!0)},children:[S.jsx(d0,{className:"w-4 h-4"}),"Add"]})]})}),S.jsxs(Ri,{children:[S.jsx("p",{className:"text-sm text-bambu-gray mb-4",children:"Connect Tasmota-based smart plugs to automate power control for your printers."}),y?S.jsx("div",{className:"flex justify-center py-8",children:S.jsx(ci,{className:"w-6 h-6 text-bambu-green animate-spin"})}):m&&m.length>0?S.jsx("div",{className:"space-y-4",children:m.map(M=>S.jsx(sHe,{plug:M,onEdit:w=>{d(w),l(!0)}},M.id))}):S.jsxs("div",{className:"text-center py-8 text-bambu-gray",children:[S.jsx(N2,{className:"w-12 h-12 mx-auto mb-3 opacity-30"}),S.jsx("p",{children:"No smart plugs configured"}),S.jsx("p",{className:"text-sm mt-1",children:"Add a Tasmota plug to get started"})]})]})]})})]}),o&&S.jsx(oHe,{plug:c,onClose:()=>{l(!1),d(null)}})]})}function cHe({onSuccess:t}){const{showToast:e}=Mf(),[n,i]=C.useState("email"),[r,a]=C.useState(""),[s,o]=C.useState(""),[l,c]=C.useState(""),[d,f]=C.useState(""),[p,m]=C.useState("global"),y=Gn({mutationFn:()=>vt.cloudLogin(r,s,p),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")}}),b=Gn({mutationFn:()=>vt.cloudVerify(r,l),onSuccess:w=>{w.success?(e("Logged in successfully"),t()):e(w.message,"error")},onError:w=>{e(w.message,"error")}}),x=Gn({mutationFn:()=>vt.cloudSetToken(d),onSuccess:()=>{e("Token set successfully"),t()},onError:w=>{e(w.message,"error")}}),v=w=>{w.preventDefault(),n==="email"?y.mutate():n==="code"?b.mutate():n==="token"&&x.mutate()},M=y.isPending||b.isPending||x.isPending;return S.jsxs(bi,{className:"max-w-md mx-auto",children:[S.jsx(Ng,{children:S.jsxs("div",{className:"flex items-center gap-2",children:[S.jsx(NN,{className:"w-5 h-5 text-bambu-green"}),S.jsx("h2",{className:"text-xl font-semibold text-white",children:"Connect to Bambu Cloud"})]})}),S.jsx(Ri,{children:S.jsxs("form",{onSubmit:v,className:"space-y-4",children:[n==="email"&&S.jsxs(S.Fragment,{children:[S.jsxs("div",{children:[S.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:"Email"}),S.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})]}),S.jsxs("div",{children:[S.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:"Password"}),S.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})]}),S.jsxs("div",{children:[S.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:"Region"}),S.jsxs("select",{value:p,onChange:w=>m(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:[S.jsx("option",{value:"global",children:"Global"}),S.jsx("option",{value:"china",children:"China"})]})]})]}),n==="code"&&S.jsxs("div",{children:[S.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:"Verification Code"}),S.jsxs("p",{className:"text-xs text-bambu-gray mb-2",children:["Check your email (",r,") for a 6-digit code"]}),S.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"&&S.jsxs("div",{children:[S.jsx("label",{className:"block text-sm text-bambu-gray mb-1",children:"Access Token"}),S.jsx("p",{className:"text-xs text-bambu-gray mb-2",children:"Paste your Bambu Lab access token (from Bambu Studio)"}),S.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})]}),S.jsxs("div",{className:"flex gap-2",children:[n==="code"&&S.jsx(xt,{type:"button",variant:"secondary",onClick:()=>i("email"),className:"flex-1",children:"Back"}),S.jsxs(xt,{type:"submit",disabled:M,className:"flex-1",children:[M?S.jsx(ci,{className:"w-4 h-4 animate-spin"}):S.jsx(h4,{className:"w-4 h-4"}),n==="email"?"Login":n==="code"?"Verify":"Set Token"]})]}),n==="email"&&S.jsx("div",{className:"pt-4 border-t border-bambu-dark-tertiary",children:S.jsxs("button",{type:"button",onClick:()=>i("token"),className:"text-sm text-bambu-gray hover:text-white flex items-center gap-1",children:[S.jsx(Iie,{className:"w-3 h-3"}),"Use access token instead"]})}),n==="token"&&S.jsx("div",{className:"pt-4 border-t border-bambu-dark-tertiary",children:S.jsxs("button",{type:"button",onClick:()=>i("email"),className:"text-sm text-bambu-gray hover:text-white flex items-center gap-1",children:[S.jsx(h4,{className:"w-3 h-3"}),"Login with email instead"]})})]})})]})}function uHe({setting:t,onClick:e}){return S.jsxs("button",{onClick:e,className:"w-full text-left p-3 bg-bambu-dark rounded-lg hover:bg-bambu-dark-tertiary transition-colors",children:[S.jsx("p",{className:"text-white font-medium truncate",children:t.name}),t.updated_time&&S.jsxs("p",{className:"text-xs text-bambu-gray mt-1",children:["Updated: ",new Date(t.updated_time).toLocaleDateString()]})]})}function dHe({setting:t,onClose:e}){const{data:n,isLoading:i}=ei({queryKey:["cloudSettingDetail",t.setting_id],queryFn:()=>vt.getCloudSettingDetail(t.setting_id)});return S.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4",children:S.jsx(bi,{className:"w-full max-w-2xl max-h-[90vh] flex flex-col",children:S.jsxs(Ri,{className:"p-0 flex flex-col h-full",children:[S.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-bambu-dark-tertiary",children:[S.jsxs("div",{children:[S.jsx("h2",{className:"text-xl font-semibold text-white",children:t.name}),S.jsxs("p",{className:"text-sm text-bambu-gray capitalize",children:[t.type," preset"]})]}),S.jsx("button",{onClick:e,className:"text-bambu-gray hover:text-white transition-colors",children:S.jsx(_i,{className:"w-5 h-5"})})]}),S.jsx("div",{className:"flex-1 overflow-y-auto p-4",children:i?S.jsx("div",{className:"flex justify-center py-8",children:S.jsx(ci,{className:"w-8 h-8 text-bambu-green animate-spin"})}):n?S.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)}):S.jsx("p",{className:"text-bambu-gray text-center py-8",children:"Failed to load preset details"})}),S.jsx("div",{className:"p-4 border-t border-bambu-dark-tertiary",children:S.jsx(xt,{variant:"secondary",onClick:e,className:"w-full",children:"Close"})})]})})})}function fHe({settings:t}){const[e,n]=C.useState(new Set),[i,r]=C.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:aie,items:a(t.filament)},{key:"printer",label:"Printer Presets",icon:rf,items:a(t.printer)},{key:"process",label:"Process Presets",icon:pG,items:a(t.process)}];return S.jsxs(S.Fragment,{children:[S.jsx("div",{className:"space-y-4",children:o.map(({key:l,label:c,icon:d,items:f})=>S.jsxs(bi,{children:[S.jsxs("button",{onClick:()=>s(l),className:"w-full flex items-center justify-between p-4",children:[S.jsxs("div",{className:"flex items-center gap-3",children:[S.jsx(d,{className:"w-5 h-5 text-bambu-green"}),S.jsx("span",{className:"text-lg font-semibold text-white",children:c}),S.jsxs("span",{className:"text-sm text-bambu-gray",children:["(",f.length,")"]})]}),e.has(l)?S.jsx(Gne,{className:"w-5 h-5 text-bambu-gray"}):S.jsx(Wp,{className:"w-5 h-5 text-bambu-gray"})]}),e.has(l)&&f.length>0&&S.jsx(Ri,{className:"pt-0",children:S.jsx("div",{className:"grid gap-2 sm:grid-cols-2 lg:grid-cols-3",children:f.map(p=>S.jsx(uHe,{setting:p,onClick:()=>r(p)},p.setting_id))})}),e.has(l)&&f.length===0&&S.jsx(Ri,{className:"pt-0",children:S.jsx("p",{className:"text-bambu-gray text-sm",children:"No presets found"})})]},l))}),i&&S.jsx(dHe,{setting:i,onClose:()=>r(null)})]})}function hHe(){const t=Hr(),{showToast:e}=Mf(),{data:n,isLoading:i}=ei({queryKey:["cloudStatus"],queryFn:vt.getCloudStatus}),{data:r,isLoading:a,refetch:s}=ei({queryKey:["cloudSettings"],queryFn:()=>vt.getCloudSettings(),enabled:!!n?.is_authenticated,retry:!1,staleTime:1e3*60*5}),o=Gn({mutationFn:vt.cloudLogout,onSuccess:()=>{t.invalidateQueries({queryKey:["cloudStatus"]}),t.removeQueries({queryKey:["cloudSettings"]}),e("Logged out")}}),l=()=>{t.invalidateQueries({queryKey:["cloudStatus"]})};return i?S.jsx("div",{className:"p-8 flex justify-center",children:S.jsx(ci,{className:"w-8 h-8 text-bambu-green animate-spin"})}):S.jsxs("div",{className:"p-8",children:[S.jsxs("div",{className:"mb-8 flex items-center justify-between",children:[S.jsxs("div",{children:[S.jsxs("h1",{className:"text-2xl font-bold text-white flex items-center gap-2",children:[S.jsx(NN,{className:"w-6 h-6 text-bambu-green"}),"Cloud Profiles"]}),S.jsx("p",{className:"text-bambu-gray",children:n?.is_authenticated?`Connected as ${n.email}`:"Manage your Bambu Cloud slicer presets"})]}),n?.is_authenticated&&S.jsxs("div",{className:"flex gap-2",children:[S.jsxs(xt,{variant:"secondary",onClick:()=>s(),disabled:a,children:[S.jsx(aS,{className:`w-4 h-4 ${a?"animate-spin":""}`}),"Refresh"]}),S.jsxs(xt,{variant:"secondary",onClick:()=>o.mutate(),disabled:o.isPending,children:[S.jsx(Yie,{className:"w-4 h-4"}),"Logout"]})]})]}),n?.is_authenticated?a?S.jsx("div",{className:"flex justify-center py-12",children:S.jsx(ci,{className:"w-8 h-8 text-bambu-green animate-spin"})}):r?S.jsx(fHe,{settings:r}):S.jsx(bi,{children:S.jsxs(Ri,{className:"py-8 text-center",children:[S.jsx("p",{className:"text-bambu-gray",children:"Failed to load profiles"}),S.jsx(xt,{className:"mt-4",onClick:()=>s(),children:"Retry"})]})}):S.jsx(cHe,{onSuccess:l})]})}function pHe(){const t=C.useRef(null),e=C.useRef(null),n=Hr(),[i,r]=C.useState(!1),a=C.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);d.onopen=()=>{r(!0);const f=setInterval(()=>{d.readyState===WebSocket.OPEN&&d.send(JSON.stringify({type:"ping"}))},3e4);d.onclose=()=>{clearInterval(f)}},d.onmessage=f=>{try{const p=JSON.parse(f.data);s(p)}catch{}},d.onclose=()=>{r(!1),t.current=null,e.current=window.setTimeout(()=>{a()},3e3)},d.onerror=()=>{d.close()},t.current=d},[]),s=C.useCallback(l=>{switch(l.type){case"printer_status":l.printer_id!==void 0&&n.setQueryData(["printerStatus",l.printer_id],c=>({...c,...l.data}));break;case"print_complete":n.invalidateQueries({queryKey:["archives"]}),n.invalidateQueries({queryKey:["archiveStats"]});break;case"archive_created":n.invalidateQueries({queryKey:["archives"]}),n.invalidateQueries({queryKey:["archiveStats"]});break}},[n]);C.useEffect(()=>(a(),()=>{e.current&&clearTimeout(e.current),t.current&&t.current.close()}),[a]);const o=C.useCallback(l=>{t.current?.readyState===WebSocket.OPEN&&t.current.send(JSON.stringify(l))},[]);return{isConnected:i,sendMessage:o}}const mHe=new sne({defaultOptions:{queries:{staleTime:1e3*60,retry:1}}});function gHe({children:t}){return pHe(),S.jsx(S.Fragment,{children:t})}function vHe(){return S.jsx(dae,{children:S.jsx(yae,{children:S.jsx(one,{client:mHe,children:S.jsx(gHe,{children:S.jsx(Cte,{children:S.jsx(ate,{children:S.jsxs(bd,{path:"/",element:S.jsx(gae,{}),children:[S.jsx(bd,{index:!0,element:S.jsx(Rae,{})}),S.jsx(bd,{path:"archives",element:S.jsx(nEe,{})}),S.jsx(bd,{path:"stats",element:S.jsx(aHe,{})}),S.jsx(bd,{path:"cloud",element:S.jsx(hHe,{})}),S.jsx(bd,{path:"settings",element:S.jsx(lHe,{})})]})})})})})})})}dee.createRoot(document.getElementById("root")).render(S.jsx(C.StrictMode,{children:S.jsx(vHe,{})}));